@squeed/flow-sdk 0.1.0
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/README.md +234 -0
- package/dist/index.cjs +358 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +192 -0
- package/dist/index.js +30584 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("react/jsx-runtime"),Re=require("react"),Ee=require("@chakra-ui/react"),bt=require("react-icons/pi"),$L=require("react-icons/hi2"),VL=require("react-icons/gr"),vu=require("react-icons/vsc"),GL=require("react-icons/tb"),O1=require("react-icons/io5"),FR=Re.createContext(null);function si(){const r=Re.useContext(FR);if(!r)throw new Error("useFlowDiagramContext must be used within FlowDiagram");return r}function WL({config:r,callbacks:e,children:t}){const n=Re.useRef(null),[a,i]=Re.useState([]),[o,s]=Re.useState(!1),[u,l]=Re.useState(!1),[c,v]=Re.useState(!1),[h,g]=Re.useState(r.edgeHandles!==!1),[p,E]=Re.useState(!1),[m,b]=Re.useState(!0),w=Re.useRef(e);w.current=e;const x=Re.useMemo(()=>{const $=G=>(...U)=>{var J,W;return(W=(J=w.current)==null?void 0:J[G])==null?void 0:W.call(J,...U)};return{onNodeSelect:$("onNodeSelect"),onNodeDeselect:$("onNodeDeselect"),onNodeDoubleClick:$("onNodeDoubleClick"),onEdgeCreate:$("onEdgeCreate"),onEdgeSelect:$("onEdgeSelect"),onEdgeDeselect:$("onEdgeDeselect"),onEdgeRemove:$("onEdgeRemove"),onViewportChange:$("onViewportChange"),onNodeHoverAction:$("onNodeHoverAction"),onNodeCreate:$("onNodeCreate"),onCyInit:$("onCyInit"),onDirectionChange:$("onDirectionChange"),onNodeColorChange:$("onNodeColorChange"),onEdgeColorChange:$("onEdgeColorChange"),onArrayModeChange:$("onArrayModeChange"),onNodeDelete:$("onNodeDelete")}},[]),_=r.themeColor||"blue.500",C=r.colorMode||"light",R=r.direction||"LR",S=r.readOnly??!1,A=r.minZoom,P=r.maxZoom,I=r.backgroundPattern,D=r.edgeColor,M=r.edgeHandles;r.initialViewport;const O=Re.useRef(r);O.current=r;const N=Re.useMemo(()=>({get direction(){return O.current.direction},get themeColor(){return O.current.themeColor},get colorMode(){return O.current.colorMode},get readOnly(){return O.current.readOnly},get minZoom(){return O.current.minZoom},get maxZoom(){return O.current.maxZoom},get backgroundPattern(){return O.current.backgroundPattern},get edgeColor(){return O.current.edgeColor},get edgeHandles(){return O.current.edgeHandles},get initialViewport(){return O.current.initialViewport},get nodeOverlayActions(){return O.current.nodeOverlayActions},get renderNodeOverlay(){return O.current.renderNodeOverlay},get renderSelectedNodeToolbar(){return O.current.renderSelectedNodeToolbar}}),[]),V=Re.useMemo(()=>({themeColor:_,colorMode:C,direction:R,selectedNodeIds:a,setSelectedNodeIds:i,isZoomMode:o,setIsZoomMode:s,isMultiSelectMode:u,setIsMultiSelectMode:l,isDragMode:c,setIsDragMode:v,isEdgeHandlesEnabled:h,setIsEdgeHandlesEnabled:g,isArrayNodeMode:p,setIsArrayNodeMode:E,isPinned:m,setIsPinned:b,cyRef:n,callbacks:x,config:N,readOnly:S}),[_,C,R,a,o,u,c,h,p,m,A,P,I,D,M,S,x,N]);return me.jsx(FR.Provider,{value:V,children:t})}const UL=({children:r,pattern:e="dot"})=>{const t=Ee.useColorModeValue("--chakra-colors-gray-500","--chakra-colors-gray-700"),n=Ee.useColorModeValue("--chakra-colors-gray-800","--chakra-colors-gray-700");return e==="none"?me.jsx(Ee.Box,{width:"100%",height:"100%",padding:0,children:r}):me.jsxs(Ee.Box,{position:"relative",width:"100%",height:"100%",padding:0,children:[me.jsx(Ee.Box,{position:"absolute",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",zIndex:0,pointerEvents:"none",style:{backgroundImage:e==="dot"?`radial-gradient(var(${t}) 8%, transparent 8%)`:e==="steel"?`repeating-linear-gradient(45deg, var(${n}) 0, var(${n}) 1px, transparent 1px, transparent 20px)`:`linear-gradient(var(${n}) 1px, transparent 1px), linear-gradient(90deg, var(${n}) 1px, transparent 1px)`,backgroundSize:"20px 20px",opacity:.3}}),me.jsx(Ee.Box,{position:"relative",width:"100%",height:"100%",zIndex:1,padding:0,children:r})]})};function $u(r,e=.2){const t=r.replace(/^#/,""),n=parseInt(t,16);let a=n>>16&255,i=n>>8&255,o=n&255;return a=Math.max(0,Math.floor(a*(1-e))),i=Math.max(0,Math.floor(i*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),"#"+((1<<24)+(a<<16)+(i<<8)+o).toString(16).slice(1).toUpperCase()}const Pn=r=>r!=null&&r.startsWith("#")?{background:r,highlight:$u(r,.1),border:$u(r,.5),property:"gray.900",boolean:"green.200",string:"gray.900",number:"orange.800"}:r==="gray"?{background:"gray.950",highlight:"gray.800",border:"gray.700",property:"gray.200",boolean:"green.400",string:"gray.200",number:"orange.600"}:r==="white"?{background:"white",highlight:"gray.200",border:"gray.400",property:"gray.900",boolean:"green.400",string:"gray.900",number:"orange.600"}:{background:r+".100",highlight:r+".200",border:r+".700",property:"gray.900",boolean:"green.800",string:"gray.900",number:"orange.800"},zR=r=>{let e=r;if(e!=null&&e.startsWith("#"))return{secondary:$u(r)};let t=String(Number(r.slice(-3))+200);t=r.slice(0,-3).concat(t);let n=String(Number(r.slice(-3))-100);return n=r.slice(0,-3).concat(n),{primary:e,secondary:t,light:n}},Pt=(r,e)=>{if(r!=null&&r.startsWith("#"))return r;if(!r)return"whitesmoke";const t=r.replace(/\./g,"-"),n=`var(--chakra-colors-${t})`;try{const i=getComputedStyle(document.documentElement).getPropertyValue(`--chakra-colors-${t}`).trim();if(i&&i!=="")return i}catch{}return n};function os(r){const[e]=(r==null?void 0:r.split("."))||[],{secondary:t}=zR(r),n=Pn(e).background,a=Pn(e).highlight,i=Pn(e).border,o=Pn(e).property,s=Pn(e).property;let u=Pn(e).background,l=Pn(e).highlight;return u=Pt(u)+50,l=Pt(l)+20,{bgColor:n,highlightColor:a,borderColor:i,textColor:o,propertyColor:s,secondary:t,bgColorFaint:u,highlightColorFaint:l}}function ss(r=null){const e=r==null?void 0:r.includes("gray"),t=Ee.useColorModeValue("gray.100","gray.900"),n=Ee.useColorModeValue("gray.200","blackAlpha.400"),a=Ee.useColorModeValue("gray.200","blackAlpha.600"),i=Ee.useColorModeValue("gray.500","gray.800"),o=Ee.useColorModeValue("gray.700","gray.700"),s=Ee.useColorModeValue("gray.900","gray.900"),u=Ee.useColorModeValue("gray.400","gray.500"),l=Ee.useColorModeValue("gray.400","gray.700"),c=Ee.useColorModeValue("gray.900","gray.200"),v=Ee.useColorModeValue(e?"gray.900":"gray.200",e?"gray.200":"gray.900"),h=Ee.useColorModeValue("gray.900","gray.200"),g=Ee.useColorModeValue(r&&"#000000",r||"#ffffff"),p=Ee.useColorModeValue(r||"#ffffff",r?"#000000":"#ffffff"),E=o,m=Ee.useColorModeValue("gray.300","gray.800"),b=Ee.useColorModeValue("white","blackAlpha.400"),w=Ee.useColorModeValue("green.100","green.700");return{background:t,backgroundSecondary:n,darkBackgroundSecondary:a,border:i,darkColor:s,backgroundWhiteColor:b,borderSecondary:o,colorActive:u,colorInactive:l,iconColor:h,moreIconColor:E,colorText:c,themedColorText:v,logoColor:g,logoColorSecondary:p,darkColorActive:m,greenColor:w}}const HL=({icon:r,label:e,onClick:t,color:n,boxSize:a=6,...i})=>{const{background:o,border:s,colorText:u}=ss();return me.jsx(Ee.Tooltip,{bgColor:i.bgColor||o,borderColor:i.borderColor||s,borderWidth:1,color:i.textColor||u,label:e,borderRadius:15,placement:i.placement||"top",fontWeight:300,fontSize:"sm",p:2,px:4,shadow:"none",children:me.jsx(Ee.Flex,{children:me.jsx(Ee.Icon,{as:r,boxSize:a,color:n,cursor:t?"pointer":void 0,onClick:t})})})},KL=({data:r,children:e,isInverted:t,isParent:n,childNodes:a})=>{const{selectedNodeIds:i,setSelectedNodeIds:o,isMultiSelectMode:s,cyRef:u,callbacks:l,config:c}=si(),{background:v,border:h,colorText:g}=ss(),p=Re.useRef(null),E=Re.useRef(null),[m,b]=Re.useState(!1),w=r==null?void 0:r.id,x=i.includes(w),_=c.nodeOverlayActions,C=c.renderNodeOverlay,R=(()=>{var D;try{const M=(D=u.current)==null?void 0:D.zoom();return M!==void 0&&M<.08}catch{return!1}})(),S=Re.useCallback(()=>{var D,M,O;if(s){const N=i.includes(w),V=N?i.filter($=>$!==w):[...i,w];o(V),N?(D=l.onNodeDeselect)==null||D.call(l):(M=l.onNodeSelect)==null||M.call(l,w,r)}else o([w]),(O=l.onNodeSelect)==null||O.call(l,w,r)},[w,r,i,s,o,l]),A=Re.useCallback(()=>{var D;(D=l.onNodeDoubleClick)==null||D.call(l,w,r)},[w,r,l]),P=Re.useCallback(()=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>b(!0),100)},[]),I=Re.useCallback(()=>{E.current&&clearTimeout(E.current),b(!1)},[]);return n?me.jsx(Ee.Box,{ref:p,children:e({id:w,data:r,isActive:x,isLowZoom:R})}):me.jsxs(Ee.Box,{ref:p,onClick:S,onDoubleClick:A,onMouseEnter:P,onMouseLeave:I,cursor:"pointer",transition:"transform 0.1s ease",position:"relative",children:[(C||_&&_.length>0)&&m&&!R&&me.jsxs(me.Fragment,{children:[me.jsx(Ee.Box,{position:"absolute",top:-150,left:"0",right:"0",height:"150px",pointerEvents:"auto",onMouseEnter:()=>b(!0),onMouseLeave:I}),C?me.jsx(Ee.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",onMouseEnter:()=>b(!0),onMouseLeave:I,willChange:"transform",children:C({nodeId:w,nodeData:r,isRoot:w==="root",isParent:!!n,isHovered:m,setIsHovered:b})}):me.jsx(Ee.Box,{position:"absolute",zIndex:1e3,top:"-100px",left:"50%",bg:v,p:3,borderColor:h,borderWidth:1,borderRadius:15,pointerEvents:"auto",transform:"translateX(-50%) scale3d(3, 3, 1)",boxShadow:"lg",onMouseEnter:()=>b(!0),onMouseLeave:I,willChange:"transform",children:me.jsx(Ee.HStack,{px:2,spacing:2,children:_.map((D,M)=>me.jsxs(Ee.Box,{display:"contents",children:[M>0&&me.jsx(Ee.Box,{borderColor:h,height:5,borderRightWidth:1}),me.jsx(HL,{icon:D.icon,label:D.label,color:g,bgColor:v,borderColor:h,textColor:g,boxSize:5,onClick:O=>{var N;O.stopPropagation(),(N=l.onNodeHoverAction)==null||N.call(l,D.id,w,r)}})]},D.id))})})]}),e({id:w,data:r,isActive:x,isLowZoom:R})]})},nl=Re.memo(KL),jL=({id:r,data:e,isActive:t})=>{var u,l,c;const{themeColor:n}=si(),{bgColor:a,borderColor:i,textColor:o}=os(((u=e==null?void 0:e.viewProps)==null?void 0:u.bgColor)||n),s=Pt(((l=e==null?void 0:e.viewProps)==null?void 0:l.textColor)||o);return me.jsx(Ee.Box,{borderRadius:(c=e==null?void 0:e.viewProps)==null?void 0:c.borderRadius,bgColor:a,borderColor:t?"white":i,_hover:{borderColor:"white"},borderWidth:2,py:14,px:20,whiteSpace:"normal",children:me.jsx(Ee.Flex,{justifyContent:"start",w:900,fontSize:"5xl",lineHeight:"normal",children:me.jsx(Ee.Text,{color:s,fontWeight:"bold",children:(e==null?void 0:e.label)||(e==null?void 0:e.text)||""})})})},YL=({id:r,isActive:e,data:t})=>{var v,h,g,p;const{themeColor:n}=si(),a=((v=t==null?void 0:t.viewProps)==null?void 0:v.bgColor)||n,{borderColor:i,highlightColor:o,textColor:s}=os(a),u=Pt(((h=t==null?void 0:t.viewProps)==null?void 0:h.textColor)||s),l=Pt(((g=t==null?void 0:t.viewProps)==null?void 0:g.borderColor)||i),c=a!=null&&a.startsWith("#")?a:Pt(o);return me.jsx(Ee.Flex,{align:"center",borderRadius:(p=t==null?void 0:t.viewProps)==null?void 0:p.borderRadius,bgColor:c,style:{backgroundColor:c},textTransform:"capitalize",borderColor:e?"white":l,_hover:{borderColor:"white"},borderWidth:2,px:50,whiteSpace:"nowrap",children:me.jsx(Ee.Flex,{justifyContent:"start",py:14,fontSize:"5xl",lineHeight:"normal",w:900,children:me.jsx(Ee.Text,{color:u,fontWeight:"bold",children:(t==null?void 0:t.label)||(t==null?void 0:t.text)||""})})})},$R=(r,e)=>{var u,l,c;const t=((u=r==null?void 0:r.viewProps)==null?void 0:u.bgColor)||e,[n]=t.split("."),a=os(t),i=t!=null&&t.startsWith("#")?Pt(t):Pt(a.bgColor),o=Pt(((l=r==null?void 0:r.viewProps)==null?void 0:l.textColor)||a.textColor),s=Pt(((c=r==null?void 0:r.viewProps)==null?void 0:c.borderColor)||a.borderColor);return{...a,bg:t,wordBeforeDot:n,hexbgColor:i,hextextColor:o,hexborderColor:s}},ZL=(r,e=350)=>`${String(r).substring(0,e)}${String(r).length>e?"...":""}`,VR=r=>r!=null&&r.includes("root")?r.replace("root","untitled"):r,XL=r=>{const e=Math.max(...Object.keys(r||{}).map(n=>n.length),0);return Math.max(e*28+30,200)},GR=r=>me.jsx(nl,{...r,children:e=>me.jsx(jL,{...e})}),WR=r=>me.jsx(nl,{...r,children:e=>me.jsx(YL,{...e})}),UR=r=>{const{themeColor:e}=si();return me.jsx(nl,{...r,children:({data:t,isActive:n,isLowZoom:a})=>{var u,l,c;const i=$R(t,e),o=Object.entries(t.description||{}).length>0,s=XL(t.description);return me.jsx(Ee.Flex,{justifyContent:"space-between",...t==null?void 0:t.viewProps,direction:"column",p:0,borderRadius:(u=t==null?void 0:t.viewProps)==null?void 0:u.borderRadius,overflow:"hidden",alignItems:"center",style:{backgroundColor:i.hexbgColor,transition:"border-color 0.2s ease-in-out"},width:"100%",borderColor:n?"white":i.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:me.jsxs(Ee.Flex,{width:"100%",direction:"column",borderRadius:(l=t==null?void 0:t.viewProps)==null?void 0:l.borderRadius,borderColor:i.hexborderColor,borderWidth:0,overflow:"hidden",children:[t.headerTitle&&me.jsx(Ee.Flex,{justify:"flex-start",direction:"row",p:Object.entries(t.description||{}).length?8:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:"center",textOverflow:"ellipsis",alignItems:"center",fontWeight:"bold",textColor:i.propertyColor,bgColor:i.highlightColor,borderBottomColor:o?i.hexborderColor:"transparent",children:me.jsx(Ee.Text,{fontSize:"5xl",noOfLines:2,textOverflow:"ellipsis",whiteSpace:"nowrap",color:(c=t==null?void 0:t.viewProps)==null?void 0:c.textColor,children:VR(t.headerTitle)})}),me.jsx(Ee.Box,{children:Object.entries(t.description||{}).map(([v,h],g)=>{var m,b;const p=Pn(i.wordBeforeDot)[typeof h],E=Pn(i.wordBeforeDot).property;return me.jsxs(Ee.Box,{children:[me.jsxs(Ee.Flex,{flexWrap:"nowrap",overflow:"hidden",children:[me.jsx(Ee.Flex,{justifyContent:"start",align:"center",background:i.highlightColor,width:`${s}px`,minWidth:`${s}px`,borderRightColor:i.hexborderColor,borderRightWidth:1,children:me.jsx(Ee.Text,{py:5,px:10,w:"100%",whiteSpace:"nowrap",fontWeight:"bold",fontSize:"4xl",textColor:((m=t==null?void 0:t.viewProps)==null?void 0:m.textColor)||E,children:v})}),me.jsx(Ee.Flex,{flex:1,justifyContent:"start",overflow:"hidden",p:4,background:i.hexbgColor,w:600,maxH:200,children:me.jsx(Ee.Text,{overflow:"hidden",py:3,px:4,whiteSpace:"normal",textOverflow:"ellipsis",fontSize:"4xl",textColor:((b=t==null?void 0:t.viewProps)==null?void 0:b.textColor)||p,fontWeight:400,children:ZL(h)})})]}),g!==Object.entries(t.description||{}).length-1&&me.jsx(Ee.Divider,{borderWidth:1,orientation:"horizontal",my:0,borderColor:i.hexborderColor})]},g)})})]})})}})},HR=r=>{const{themeColor:e}=si();return me.jsx(nl,{...r,children:({data:t,isActive:n})=>{var i,o;const a=$R(t,e);return me.jsx(Ee.Flex,{justifyContent:"space-between",...t==null?void 0:t.viewProps,direction:"column",p:0,borderRadius:((i=t==null?void 0:t.viewProps)==null?void 0:i.borderRadius)||15,overflow:"hidden",bgColor:a.bgColor,position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",style:{backgroundColor:a.hexbgColor,transition:"border-color 0.2s ease-in-out"},borderColor:n?"white":a.hexborderColor,_hover:{borderColor:"white"},borderWidth:3,children:t.headerTitle&&me.jsx(Ee.Flex,{justify:"flex-start",direction:"row",p:20,borderBottomWidth:1,minWidth:"max-content !important",width:"100%",textTransform:"capitalize",align:"center",alignItems:"center",fontWeight:"bold",textColor:a.propertyColor,bgColor:a.highlightColor,borderBottomColor:a.hexborderColor,children:me.jsx(Ee.Text,{fontSize:"5xl",noOfLines:2,textOverflow:"ellipsis",whiteSpace:"nowrap",color:(o=t==null?void 0:t.viewProps)==null?void 0:o.textColor,children:VR(t.headerTitle)})})})}})};GR.displayName="text";WR.displayName="arrayView";UR.displayName="NodeJsonObjectView";HR.displayName="ParentContainerView";const ic={objectView:Re.memo(UR),arrayView:Re.memo(WR),text:Re.memo(GR),parentContainer:Re.memo(HR)},QL=r=>[{selector:"node",style:{"outline-opacity":0,"background-opacity":0,"background-color":"transparent","border-color":"transparent",color:"transparent","border-opacity":0,"text-valign":"center","text-halign":"center","border-width":0,"outline-width":0,width:60,height:60}},{selector:"node:selected",style:{"overlay-opacity":0,"overlay-color":"transparent"}},{selector:"node:active",style:{"overlay-opacity":0,"overlay-color":"transparent"}},{selector:":parent",style:{shape:"round-rectangle","background-opacity":.4,"corner-radius":50,"line-color":r("light"),"background-color":r(),"border-color":r(),"border-width":6,"border-style":"solid","border-opacity":1,padding:"120px","text-valign":"top","font-size":"70px","font-weight":"bold","text-margin-y":90,"text-background-opacity":0,"text-background-padding":"45px","z-index":1e3,"compound-sizing-wrt-labels":"include",label:"data(label)"}},{selector:"edge",style:{width:6,label:"data(label)","z-index":-100,"control-point-step-size":10,"taxi-direction":"horizontal","curve-style":"round-taxi","edge-distances":"intersection","line-color":r("light"),color:r("light"),"text-rotation":"autorotate","target-arrow-color":r("light"),"source-arrow-color":r("light"),"target-arrow-shape":"triangle","arrow-scale":"3","text-background-color":r("dark"),"text-background-opacity":1,"text-background-padding":"15px","taxi-radius":500,"source-arrow-fill":"filled","target-arrow-fill":"filled","text-max-width":"200px","font-size":"45px","text-wrap":"wrap","text-margin-x":50,"transition-duration":"0.5s","source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","source-distance-from-node":40,"target-distance-from-node":40}}],oc=(r,e,t,n)=>{if(!r)return{controlPointDistances:[0],controlPointWeights:[.5]};const a=r.edges().filter(l=>{const c=l.data();return c.source===e&&c.target===t||c.source===t&&c.target===e});if(a.length<=1)return{controlPointDistances:[0],controlPointWeights:[.5]};let i=0;a.forEach((l,c)=>{l.data().id===n&&(i=c)});const o=a.length;return{controlPointDistances:[(i-(o-1)/2)*60],controlPointWeights:[.5]}},JL=r=>{const n=1/(Math.cbrt(r)*.8);let a=Math.round(650*n),i=Math.round(350*n);return a=Math.max(40,Math.min(450,a)),i=Math.max(30,Math.min(300,i)),{edgeSep:a,rankSep:i}};function eq({cytoInstance:r,id:e,source:t,type:n,target:a,label:i,children:o,layout:s,styleCallback:u}){const l=Re.useRef(null),c=Re.useRef(null),[v,h]=Re.useState(2);let g,p;function E(C){if(u){const R=u(C,t,a);g=R.hasOwnProperty("line-style"),p=R.hasOwnProperty("source-arrow-shape"),C.style(R)}}const m=Re.useCallback(()=>{if(!g)return;const C=r.getElementById(e);if(C.length===0)return;const P=Date.now()*.1%(20*50),I=p?P:-P;C.style("line-dash-offset",I),c.current=requestAnimationFrame(m)},[g,r,e,p]);function b(C){const R=oc(r,t,a,e),S=r.add({data:{...C,controlPointDistances:R.controlPointDistances,controlPointWeights:R.controlPointWeights}});E(S),g&&(c.current=requestAnimationFrame(m))}function w(C,R){let S=2;return r.getElementById(C).length===1&&(S-=1),r.getElementById(R).length===1&&(S-=1),S}if(Re.useEffect(()=>{if(w(t,a)===0){const R=r.getElementById(e);if(R.length===0){const S=oc(r,t,a,e),A=r.add({data:{id:e,source:t,target:a,label:i,type:n,controlPointDistances:S.controlPointDistances,controlPointWeights:S.controlPointWeights}});E(A),g&&(c.current=requestAnimationFrame(m))}else{const S=oc(r,t,a,e);R.data({source:t,target:a,label:i,type:n,controlPointDistances:S.controlPointDistances,controlPointWeights:S.controlPointWeights}),E(R)}}},[t,a,e,i,n,r,g,m]),Re.useEffect(()=>{function C(S){const A=S.target.id();if(A===t||A===a){const P=w(t,a);P!==v&&h(P),P===0&&b({id:e,source:t,target:a,label:i,type:n})}}function R(S){const A=S.target.id();if(A===t||A===a){const P=w(t,a);P!==v&&h(P),P>0&&(r.getElementById(e).remove(),c.current&&cancelAnimationFrame(c.current))}}return r.on("add","node",C),r.on("remove","node",R),g&&v===0&&(c.current=requestAnimationFrame(m)),()=>{r.getElementById(e).remove(),r.off("add","node",C),r.off("remove","node",R),c.current&&cancelAnimationFrame(c.current)}},[]),Re.useEffect(()=>(g&&v===0?c.current||(c.current=requestAnimationFrame(m)):!g&&c.current&&(cancelAnimationFrame(c.current),c.current=null),()=>{c.current&&cancelAnimationFrame(c.current)}),[g,v,m]),Re.useEffect(()=>{s()},[e,o]),Re.useEffect(()=>{if(!v){const C=r.getElementById(e);E(C)}},[u,v]),v>0)return null;function x(C){return Re.cloneElement(C,{cytoInstance:r,layout:s})}const _=Re.Children.map(o,x);return me.jsx("div",{ref:l,className:"cytoscape-react-edge",children:_})}function am(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function rq(r){if(Array.isArray(r))return r}function tq(r){if(Array.isArray(r))return am(r)}function Da(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nq(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,jR(n.key),n)}}function Ia(r,e,t){return e&&nq(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Ft(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Cm(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:a}}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 i,o=!0,s=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||t.return==null||t.return()}finally{if(s)throw i}}}}function KR(r,e,t){return(e=jR(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aq(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function iq(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,a,i,o,s=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(c){l=!0,a=c}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}function oq(){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 sq(){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 Kr(r,e){return rq(r)||iq(r,e)||Cm(r,e)||oq()}function Vu(r){return tq(r)||aq(r)||Cm(r)||sq()}function uq(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function jR(r){var e=uq(r,"string");return typeof e=="symbol"?e:e+""}function et(r){"@babel/helpers - typeof";return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},et(r)}function Cm(r,e){if(r){if(typeof r=="string")return am(r,e);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)?am(r,e):void 0}}var Qr=typeof window>"u"?null:window,M1=Qr?Qr.navigator:null;Qr&&Qr.document;var lq=et(""),YR=et({}),fq=et(function(){}),cq=typeof HTMLElement>"u"?"undefined":et(HTMLElement),us=function(e){return e&&e.instanceString&&Nr(e.instanceString)?e.instanceString():null},Ge=function(e){return e!=null&&et(e)==lq},Nr=function(e){return e!=null&&et(e)===fq},Sr=function(e){return!jt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},pr=function(e){return e!=null&&et(e)===YR&&!Sr(e)&&e.constructor===Object},dq=function(e){return e!=null&&et(e)===YR},De=function(e){return e!=null&&et(e)===et(1)&&!isNaN(e)},vq=function(e){return De(e)&&Math.floor(e)===e},Gu=function(e){if(cq!=="undefined")return e!=null&&e instanceof HTMLElement},jt=function(e){return ls(e)||ZR(e)},ls=function(e){return us(e)==="collection"&&e._private.single},ZR=function(e){return us(e)==="collection"&&!e._private.single},Sm=function(e){return us(e)==="core"},XR=function(e){return us(e)==="stylesheet"},hq=function(e){return us(e)==="event"},xa=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},gq=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},pq=function(e){return pr(e)&&De(e.x1)&&De(e.x2)&&De(e.y1)&&De(e.y2)},yq=function(e){return dq(e)&&Nr(e.then)},mq=function(){return M1&&M1.userAgent.match(/msie|trident|edge/i)},Qi=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var n=function(){var i=this,o=arguments,s,u=t.apply(i,o),l=n.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return n.cache={},n},Tm=Qi(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),al=Qi(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),QR=Qi(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),k1=function(e){return xa(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ga=function(e,t){return e.slice(-1*t.length)===t},Jr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",bq="rgb[a]?\\(("+Jr+"[%]?)\\s*,\\s*("+Jr+"[%]?)\\s*,\\s*("+Jr+"[%]?)(?:\\s*,\\s*("+Jr+"))?\\)",wq="rgb[a]?\\((?:"+Jr+"[%]?)\\s*,\\s*(?:"+Jr+"[%]?)\\s*,\\s*(?:"+Jr+"[%]?)(?:\\s*,\\s*(?:"+Jr+"))?\\)",xq="hsl[a]?\\(("+Jr+")\\s*,\\s*("+Jr+"[%])\\s*,\\s*("+Jr+"[%])(?:\\s*,\\s*("+Jr+"))?\\)",Eq="hsl[a]?\\((?:"+Jr+")\\s*,\\s*(?:"+Jr+"[%])\\s*,\\s*(?:"+Jr+"[%])(?:\\s*,\\s*(?:"+Jr+"))?\\)",_q="\\#[0-9a-fA-F]{3}",Cq="\\#[0-9a-fA-F]{6}",JR=function(e,t){return e<t?-1:e>t?1:0},Sq=function(e,t){return-1*JR(e,t)},He=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var n=e[t];if(n!=null)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i];r[o]=n[o]}}return r},Tq=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,a,i,o=16;return t?(n=parseInt(e[1]+e[1],o),a=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),a=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[n,a,i]}},Rq=function(e){var t,n,a,i,o,s,u,l;function c(p,E,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(E-p)*6*m:m<1/2?E:m<2/3?p+(E-p)*(2/3-m)*6:p}var v=new RegExp("^"+xq+"$").exec(e);if(v){if(n=parseInt(v[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,a=parseFloat(v[2]),a<0||a>100||(a=a/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,o=v[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(a===0)s=u=l=Math.round(i*255);else{var h=i<.5?i*(1+a):i+a-i*a,g=2*i-h;s=Math.round(255*c(g,h,n+1/3)),u=Math.round(255*c(g,h,n)),l=Math.round(255*c(g,h,n-1/3))}t=[s,u,l,o]}return t},Aq=function(e){var t,n=new RegExp("^"+bq+"$").exec(e);if(n){t=[];for(var a=[],i=1;i<=3;i++){var o=n[i];if(o[o.length-1]==="%"&&(a[i]=!0),o=parseFloat(o),a[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=a[1]||a[2]||a[3],u=a[1]&&a[2]&&a[3];if(s&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},Pq=function(e){return Dq[e.toLowerCase()]},e2=function(e){return(Sr(e)?e:null)||Pq(e)||Tq(e)||Aq(e)||Rq(e)},Dq={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]},r2=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(pr(o))throw Error("Tried to set map with object key");i<n.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},t2=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var o=n[i];if(pr(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t},hu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var sc,L1;function cs(){if(L1)return sc;L1=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return sc=r,sc}var uc,q1;function Iq(){if(q1)return uc;q1=1;var r=typeof hu=="object"&&hu&&hu.Object===Object&&hu;return uc=r,uc}var lc,N1;function il(){if(N1)return lc;N1=1;var r=Iq(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return lc=t,lc}var fc,F1;function Bq(){if(F1)return fc;F1=1;var r=il(),e=function(){return r.Date.now()};return fc=e,fc}var cc,z1;function Oq(){if(z1)return cc;z1=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return cc=e,cc}var dc,$1;function Mq(){if($1)return dc;$1=1;var r=Oq(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return dc=t,dc}var vc,V1;function Rm(){if(V1)return vc;V1=1;var r=il(),e=r.Symbol;return vc=e,vc}var hc,G1;function kq(){if(G1)return hc;G1=1;var r=Rm(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;function i(o){var s=t.call(o,a),u=o[a];try{o[a]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[a]=u:delete o[a]),c}return hc=i,hc}var gc,W1;function Lq(){if(W1)return gc;W1=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return gc=t,gc}var pc,U1;function n2(){if(U1)return pc;U1=1;var r=Rm(),e=kq(),t=Lq(),n="[object Null]",a="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?a:n:i&&i in Object(s)?e(s):t(s)}return pc=o,pc}var yc,H1;function qq(){if(H1)return yc;H1=1;function r(e){return e!=null&&typeof e=="object"}return yc=r,yc}var mc,K1;function ds(){if(K1)return mc;K1=1;var r=n2(),e=qq(),t="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&r(a)==t}return mc=n,mc}var bc,j1;function Nq(){if(j1)return bc;j1=1;var r=Mq(),e=cs(),t=ds(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var v=i.test(l);return v||o.test(l)?s(l.slice(2),v?2:8):a.test(l)?n:+l}return bc=u,bc}var wc,Y1;function Fq(){if(Y1)return wc;Y1=1;var r=cs(),e=Bq(),t=Nq(),n="Expected a function",a=Math.max,i=Math.min;function o(s,u,l){var c,v,h,g,p,E,m=0,b=!1,w=!1,x=!0;if(typeof s!="function")throw new TypeError(n);u=t(u)||0,r(l)&&(b=!!l.leading,w="maxWait"in l,h=w?a(t(l.maxWait)||0,u):h,x="trailing"in l?!!l.trailing:x);function _(O){var N=c,V=v;return c=v=void 0,m=O,g=s.apply(V,N),g}function C(O){return m=O,p=setTimeout(A,u),b?_(O):g}function R(O){var N=O-E,V=O-m,$=u-N;return w?i($,h-V):$}function S(O){var N=O-E,V=O-m;return E===void 0||N>=u||N<0||w&&V>=h}function A(){var O=e();if(S(O))return P(O);p=setTimeout(A,R(O))}function P(O){return p=void 0,x&&c?_(O):(c=v=void 0,g)}function I(){p!==void 0&&clearTimeout(p),m=0,c=E=v=p=void 0}function D(){return p===void 0?g:P(e())}function M(){var O=e(),N=S(O);if(c=arguments,v=this,E=O,N){if(p===void 0)return C(E);if(w)return clearTimeout(p),p=setTimeout(A,u),_(E)}return p===void 0&&(p=setTimeout(A,u)),g}return M.cancel=I,M.flush=D,M}return wc=o,wc}var zq=Fq(),vs=fs(zq),xc=Qr?Qr.performance:null,a2=xc&&xc.now?function(){return xc.now()}:function(){return Date.now()},$q=(function(){if(Qr){if(Qr.requestAnimationFrame)return function(r){Qr.requestAnimationFrame(r)};if(Qr.mozRequestAnimationFrame)return function(r){Qr.mozRequestAnimationFrame(r)};if(Qr.webkitRequestAnimationFrame)return function(r){Qr.webkitRequestAnimationFrame(r)};if(Qr.msRequestAnimationFrame)return function(r){Qr.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(a2())},1e3/60)}})(),Wu=function(e){return $q(e)},jn=a2,Xa=9261,i2=65599,Vi=5381,o2=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xa,n=t,a;a=e.next(),!a.done;)n=n*i2+a.value|0;return n},Yo=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xa;return t*i2+e|0},Zo=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Vi;return(t<<5)+t+e|0},Vq=function(e,t){return e*2097152+t},da=function(e){return e[0]*2097152+e[1]},gu=function(e,t){return[Yo(e[0],t[0]),Zo(e[1],t[1])]},Z1=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e[a++]:n.done=!0,n}};return o2(o,t)},ti=function(e,t){var n={value:0,done:!1},a=0,i=e.length,o={next:function(){return a<i?n.value=e.charCodeAt(a++):n.done=!0,n}};return o2(o,t)},s2=function(){return Gq(arguments)},Gq=function(e){for(var t,n=0;n<e.length;n++){var a=e[n];n===0?t=ti(a):t=ti(a,t)}return t};function Wq(r,e,t,n,a){var i=a*Math.PI/180,o=Math.cos(i)*(r-t)-Math.sin(i)*(e-n)+t,s=Math.sin(i)*(r-t)+Math.cos(i)*(e-n)+n;return{x:o,y:s}}var Uq=function(e,t,n,a,i,o){return{x:(e-n)*i+n,y:(t-a)*o+a}};function Hq(r,e,t){if(t===0)return r;var n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=Wq(r.x,r.y,n,a,t),u=Uq(s.x,s.y,n,a,i,o);return{x:u.x,y:u.y}}var X1=!0,Kq=console.warn!=null,jq=console.trace!=null,Am=Number.MAX_SAFE_INTEGER||9007199254740991,u2=function(){return!0},Uu=function(){return!1},Q1=function(){return 0},Pm=function(){},Mr=function(e){throw new Error(e)},l2=function(e){if(e!==void 0)X1=!!e;else return X1},Er=function(e){l2()&&(Kq?console.warn(e):(console.log(e),jq&&console.trace()))},Yq=function(e){return He({},e)},Dn=function(e){return e==null?e:Sr(e)?e.slice():pr(e)?Yq(e):e},Zq=function(e){return e.slice()},f2=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},Xq={},c2=function(){return Xq},ht=function(e){var t=Object.keys(e);return function(n){for(var a={},i=0;i<t.length;i++){var o=t[i],s=n==null?void 0:n[o];a[o]=s===void 0?e[o]:s}return a}},Ea=function(e,t,n){for(var a=e.length-1;a>=0;a--)e[a]===t&&e.splice(a,1)},Dm=function(e){e.splice(0,e.length)},Qq=function(e,t){for(var n=0;n<t.length;n++){var a=t[n];e.push(a)}},qt=function(e,t,n){return n&&(t=QR(n,t)),e[t]},Hn=function(e,t,n,a){n&&(t=QR(n,t)),e[t]=a},Jq=(function(){function r(){Da(this,r),this._obj={}}return Ia(r,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}])})(),Kn=typeof Map<"u"?Map:Jq,eN="undefined",rN=(function(){function r(e){if(Da(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var n=0;n<t.length;n++)this.add(t[n])}}return Ia(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}])})(),ro=(typeof Set>"u"?"undefined":et(Set))!==eN?Set:rN,ol=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Sm(e)){Mr("An element must have a core reference and parameters set");return}var a=t.group;if(a==null&&(t.data&&t.data.source!=null&&t.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){Mr("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?a==="edges":!!t.pannable,active:!1,classes:new ro,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Sr(t.classes)?l=t.classes:Ge(t.classes)&&(l=t.classes.split(/\s+/));for(var c=0,v=l.length;c<v;c++){var h=l[c];!h||h===""||i.classes.add(h)}this.createEmitter(),(n===void 0||n)&&this.restore();var g=t.style||t.css;g&&(Er("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(g))},J1=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,a,i){var o;pr(n)&&!jt(n)&&(o=n,n=o.roots||o.root,a=o.visit,i=o.directed),i=arguments.length===2&&!Nr(a)?a:i,a=Nr(a)?a:function(){};for(var s=this._private.cy,u=n=Ge(n)?this.filter(n):n,l=[],c=[],v={},h={},g={},p=0,E,m=this.byGroup(),b=m.nodes,w=m.edges,x=0;x<u.length;x++){var _=u[x],C=_.id();_.isNode()&&(l.unshift(_),e.bfs&&(g[C]=!0,c.push(_)),h[C]=0)}for(var R=function(){var O=e.bfs?l.shift():l.pop(),N=O.id();if(e.dfs){if(g[N])return 0;g[N]=!0,c.push(O)}var V=h[N],$=v[N],G=$!=null?$.source():null,U=$!=null?$.target():null,J=$==null?void 0:O.same(G)?U[0]:G[0],W;if(W=a(O,$,J,p++,V),W===!0)return E=O,1;if(W===!1)return 1;for(var H=O.connectedEdges().filter(function(j){return(!i||j.source().same(O))&&w.has(j)}),Z=0;Z<H.length;Z++){var ne=H[Z],F=ne.connectedNodes().filter(function(j){return!j.same(O)&&b.has(j)}),z=F.id();F.length!==0&&!g[z]&&(F=F[0],l.push(F),e.bfs&&(g[z]=!0,c.push(F)),v[z]=ne,h[z]=h[N]+1)}},S;l.length!==0&&(S=R(),!(S!==0&&S===1)););for(var A=s.collection(),P=0;P<c.length;P++){var I=c[P],D=v[I.id()];D!=null&&A.push(D),A.push(I)}return{path:s.collection(A),found:s.collection(E)}}},Xo={breadthFirstSearch:J1({bfs:!0}),depthFirstSearch:J1({dfs:!0})};Xo.bfs=Xo.breadthFirstSearch;Xo.dfs=Xo.depthFirstSearch;var Au={exports:{}},tN=Au.exports,ew;function nN(){return ew||(ew=1,(function(r,e){(function(){var t,n,a,i,o,s,u,l,c,v,h,g,p,E,m;a=Math.floor,v=Math.min,n=function(b,w){return b<w?-1:b>w?1:0},c=function(b,w,x,_,C){var R;if(x==null&&(x=0),C==null&&(C=n),x<0)throw new Error("lo must be non-negative");for(_==null&&(_=b.length);x<_;)R=a((x+_)/2),C(w,b[R])<0?_=R:x=R+1;return[].splice.apply(b,[x,x-x].concat(w)),w},s=function(b,w,x){return x==null&&(x=n),b.push(w),E(b,0,b.length-1,x)},o=function(b,w){var x,_;return w==null&&(w=n),x=b.pop(),b.length?(_=b[0],b[0]=x,m(b,0,w)):_=x,_},l=function(b,w,x){var _;return x==null&&(x=n),_=b[0],b[0]=w,m(b,0,x),_},u=function(b,w,x){var _;return x==null&&(x=n),b.length&&x(b[0],w)<0&&(_=[b[0],w],w=_[0],b[0]=_[1],m(b,0,x)),w},i=function(b,w){var x,_,C,R,S,A;for(w==null&&(w=n),R=(function(){A=[];for(var P=0,I=a(b.length/2);0<=I?P<I:P>I;0<=I?P++:P--)A.push(P);return A}).apply(this).reverse(),S=[],_=0,C=R.length;_<C;_++)x=R[_],S.push(m(b,x,w));return S},p=function(b,w,x){var _;if(x==null&&(x=n),_=b.indexOf(w),_!==-1)return E(b,0,_,x),m(b,_,x)},h=function(b,w,x){var _,C,R,S,A;if(x==null&&(x=n),C=b.slice(0,w),!C.length)return C;for(i(C,x),A=b.slice(w),R=0,S=A.length;R<S;R++)_=A[R],u(C,_,x);return C.sort(x).reverse()},g=function(b,w,x){var _,C,R,S,A,P,I,D,M;if(x==null&&(x=n),w*10<=b.length){if(R=b.slice(0,w).sort(x),!R.length)return R;for(C=R[R.length-1],I=b.slice(w),S=0,P=I.length;S<P;S++)_=I[S],x(_,C)<0&&(c(R,_,0,null,x),R.pop(),C=R[R.length-1]);return R}for(i(b,x),M=[],A=0,D=v(w,b.length);0<=D?A<D:A>D;0<=D?++A:--A)M.push(o(b,x));return M},E=function(b,w,x,_){var C,R,S;for(_==null&&(_=n),C=b[x];x>w;){if(S=x-1>>1,R=b[S],_(C,R)<0){b[x]=R,x=S;continue}break}return b[x]=C},m=function(b,w,x){var _,C,R,S,A;for(x==null&&(x=n),C=b.length,A=w,R=b[w],_=2*w+1;_<C;)S=_+1,S<C&&!(x(b[_],b[S])<0)&&(_=S),b[w]=b[_],w=_,_=2*w+1;return b[w]=R,E(b,A,w,x)},t=(function(){b.push=s,b.pop=o,b.replace=l,b.pushpop=u,b.heapify=i,b.updateItem=p,b.nlargest=h,b.nsmallest=g;function b(w){this.cmp=w??n,this.nodes=[]}return b.prototype.push=function(w){return s(this.nodes,w,this.cmp)},b.prototype.pop=function(){return o(this.nodes,this.cmp)},b.prototype.peek=function(){return this.nodes[0]},b.prototype.contains=function(w){return this.nodes.indexOf(w)!==-1},b.prototype.replace=function(w){return l(this.nodes,w,this.cmp)},b.prototype.pushpop=function(w){return u(this.nodes,w,this.cmp)},b.prototype.heapify=function(){return i(this.nodes,this.cmp)},b.prototype.updateItem=function(w){return p(this.nodes,w,this.cmp)},b.prototype.clear=function(){return this.nodes=[]},b.prototype.empty=function(){return this.nodes.length===0},b.prototype.size=function(){return this.nodes.length},b.prototype.clone=function(){var w;return w=new b,w.nodes=this.nodes.slice(0),w},b.prototype.toArray=function(){return this.nodes.slice(0)},b.prototype.insert=b.prototype.push,b.prototype.top=b.prototype.peek,b.prototype.front=b.prototype.peek,b.prototype.has=b.prototype.contains,b.prototype.copy=b.prototype.clone,b})(),(function(b,w){return r.exports=w()})(this,function(){return t})}).call(tN)})(Au)),Au.exports}var Ec,rw;function aN(){return rw||(rw=1,Ec=nN()),Ec}var iN=aN(),hs=fs(iN),oN=ht({root:null,weight:function(e){return 1},directed:!1}),sN={dijkstra:function(e){if(!pr(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=oN(e),a=n.root,i=n.weight,o=n.directed,s=this,u=i,l=Ge(a)?this.filter(a)[0]:a[0],c={},v={},h={},g=this.byGroup(),p=g.nodes,E=g.edges;E.unmergeBy(function(V){return V.isLoop()});for(var m=function($){return c[$.id()]},b=function($,G){c[$.id()]=G,w.updateItem($)},w=new hs(function(V,$){return m(V)-m($)}),x=0;x<p.length;x++){var _=p[x];c[_.id()]=_.same(l)?0:1/0,w.push(_)}for(var C=function($,G){for(var U=(o?$.edgesTo(G):$.edgesWith(G)).intersect(E),J=1/0,W,H=0;H<U.length;H++){var Z=U[H],ne=u(Z);(ne<J||!W)&&(J=ne,W=Z)}return{edge:W,dist:J}};w.size()>0;){var R=w.pop(),S=m(R),A=R.id();if(h[A]=S,S!==1/0)for(var P=R.neighborhood().intersect(p),I=0;I<P.length;I++){var D=P[I],M=D.id(),O=C(R,D),N=S+O.dist;N<m(D)&&(b(D,N),v[M]={node:R,edge:O.edge})}}return{distanceTo:function($){var G=Ge($)?p.filter($)[0]:$[0];return h[G.id()]},pathTo:function($){var G=Ge($)?p.filter($)[0]:$[0],U=[],J=G,W=J.id();if(G.length>0)for(U.unshift(G);v[W];){var H=v[W];U.unshift(H.edge),U.unshift(H.node),J=H.node,W=J.id()}return s.spawn(U)}}}},uN={kruskal:function(e){e=e||function(x){return 1};for(var t=this.byGroup(),n=t.nodes,a=t.edges,i=n.length,o=new Array(i),s=n,u=function(_){for(var C=0;C<o.length;C++){var R=o[C];if(R.has(_))return C}},l=0;l<i;l++)o[l]=this.spawn(n[l]);for(var c=a.sort(function(x,_){return e(x)-e(_)}),v=0;v<c.length;v++){var h=c[v],g=h.source()[0],p=h.target()[0],E=u(g),m=u(p),b=o[E],w=o[m];E!==m&&(s.merge(h),b.merge(w),o.splice(m,1))}return s}},lN=ht({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),fN={aStar:function(e){var t=this.cy(),n=lN(e),a=n.root,i=n.goal,o=n.heuristic,s=n.directed,u=n.weight;a=t.collection(a)[0],i=t.collection(i)[0];var l=a.id(),c=i.id(),v={},h={},g={},p=new hs(function(W,H){return h[W.id()]-h[H.id()]}),E=new ro,m={},b={},w=function(H,Z){p.push(H),E.add(Z)},x,_,C=function(){x=p.pop(),_=x.id(),E.delete(_)},R=function(H){return E.has(H)};w(a,l),v[l]=0,h[l]=o(a);for(var S=0;p.size()>0;){if(C(),S++,_===c){for(var A=[],P=i,I=c,D=b[I];A.unshift(P),D!=null&&A.unshift(D),P=m[I],P!=null;)I=P.id(),D=b[I];return{found:!0,distance:v[_],path:this.spawn(A),steps:S}}g[_]=!0;for(var M=x._private.edges,O=0;O<M.length;O++){var N=M[O];if(this.hasElementWithId(N.id())&&!(s&&N.data("source")!==_)){var V=N.source(),$=N.target(),G=V.id()!==_?V:$,U=G.id();if(this.hasElementWithId(U)&&!g[U]){var J=v[_]+u(N);if(!R(U)){v[U]=J,h[U]=J+o(G),w(G,U),m[U]=x,b[U]=N;continue}J<v[U]&&(v[U]=J,h[U]=J+o(G),m[U]=x,b[U]=N)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},cN=ht({weight:function(e){return 1},directed:!1}),dN={floydWarshall:function(e){for(var t=this.cy(),n=cN(e),a=n.weight,i=n.directed,o=a,s=this.byGroup(),u=s.nodes,l=s.edges,c=u.length,v=c*c,h=function(ne){return u.indexOf(ne)},g=function(ne){return u[ne]},p=new Array(v),E=0;E<v;E++){var m=E%c,b=(E-m)/c;b===m?p[E]=0:p[E]=1/0}for(var w=new Array(v),x=new Array(v),_=0;_<l.length;_++){var C=l[_],R=C.source()[0],S=C.target()[0];if(R!==S){var A=h(R),P=h(S),I=A*c+P,D=o(C);if(p[I]>D&&(p[I]=D,w[I]=P,x[I]=C),!i){var M=P*c+A;!i&&p[M]>D&&(p[M]=D,w[M]=A,x[M]=C)}}}for(var O=0;O<c;O++)for(var N=0;N<c;N++)for(var V=N*c+O,$=0;$<c;$++){var G=N*c+$,U=O*c+$;p[V]+p[U]<p[G]&&(p[G]=p[V]+p[U],w[G]=w[V])}var J=function(ne){return(Ge(ne)?t.filter(ne):ne)[0]},W=function(ne){return h(J(ne))},H={distance:function(ne,F){var z=W(ne),j=W(F);return p[z*c+j]},path:function(ne,F){var z=W(ne),j=W(F),ee=g(z);if(z===j)return ee.collection();if(w[z*c+j]==null)return t.collection();var ie=t.collection(),oe=z,Y;for(ie.merge(ee);z!==j;)oe=z,z=w[z*c+j],Y=x[oe*c+z],ie.merge(Y),ie.merge(g(z));return ie}};return H}},vN=ht({weight:function(e){return 1},directed:!1,root:null}),hN={bellmanFord:function(e){var t=this,n=vN(e),a=n.weight,i=n.directed,o=n.root,s=a,u=this,l=this.cy(),c=this.byGroup(),v=c.edges,h=c.nodes,g=h.length,p=new Kn,E=!1,m=[];o=l.collection(o)[0],v.unmergeBy(function(ue){return ue.isLoop()});for(var b=v.length,w=function(Se){var Ae=p.get(Se.id());return Ae||(Ae={},p.set(Se.id(),Ae)),Ae},x=function(Se){return(Ge(Se)?l.$(Se):Se)[0]},_=function(Se){return w(x(Se)).dist},C=function(Se){for(var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Te=x(Se),Pe=[],Ie=Te;;){if(Ie==null)return t.spawn();var Le=w(Ie),Fe=Le.edge,je=Le.pred;if(Pe.unshift(Ie[0]),Ie.same(Ae)&&Pe.length>0)break;Fe!=null&&Pe.unshift(Fe),Ie=je}return u.spawn(Pe)},R=0;R<g;R++){var S=h[R],A=w(S);S.same(o)?A.dist=0:A.dist=1/0,A.pred=null,A.edge=null}for(var P=!1,I=function(Se,Ae,Te,Pe,Ie,Le){var Fe=Pe.dist+Le;Fe<Ie.dist&&!Te.same(Pe.edge)&&(Ie.dist=Fe,Ie.pred=Se,Ie.edge=Te,P=!0)},D=1;D<g;D++){P=!1;for(var M=0;M<b;M++){var O=v[M],N=O.source(),V=O.target(),$=s(O),G=w(N),U=w(V);I(N,V,O,G,U,$),i||I(V,N,O,U,G,$)}if(!P)break}if(P)for(var J=[],W=0;W<b;W++){var H=v[W],Z=H.source(),ne=H.target(),F=s(H),z=w(Z).dist,j=w(ne).dist;if(z+F<j||!i&&j+F<z)if(E||(Er("Graph contains a negative weight cycle for Bellman-Ford"),E=!0),e.findNegativeWeightCycles!==!1){var ee=[];z+F<j&&ee.push(Z),!i&&j+F<z&&ee.push(ne);for(var ie=ee.length,oe=0;oe<ie;oe++){var Y=ee[oe],X=[Y];X.push(w(Y).edge);for(var re=w(Y).pred;X.indexOf(re)===-1;)X.push(re),X.push(w(re).edge),re=w(re).pred;X=X.slice(X.indexOf(re));for(var le=X[0].id(),he=0,be=2;be<X.length;be+=2)X[be].id()<le&&(le=X[be].id(),he=be);X=X.slice(he).concat(X.slice(0,he)),X.push(X[0]);var fe=X.map(function(ue){return ue.id()}).join(",");J.indexOf(fe)===-1&&(m.push(u.spawn(X)),J.push(fe))}}else break}return{distanceTo:_,pathTo:C,hasNegativeWeightCycle:E,negativeWeightCycles:m}}},gN=Math.sqrt(2),pN=function(e,t,n){n.length===0&&Mr("Karger-Stein must be run on a connected (sub)graph");for(var a=n[e],i=a[1],o=a[2],s=t[i],u=t[o],l=n,c=l.length-1;c>=0;c--){var v=l[c],h=v[1],g=v[2];(t[h]===s&&t[g]===u||t[h]===u&&t[g]===s)&&l.splice(c,1)}for(var p=0;p<l.length;p++){var E=l[p];E[1]===u?(l[p]=E.slice(),l[p][1]=s):E[2]===u&&(l[p]=E.slice(),l[p][2]=s)}for(var m=0;m<t.length;m++)t[m]===u&&(t[m]=s);return l},_c=function(e,t,n,a){for(;n>a;){var i=Math.floor(Math.random()*t.length);t=pN(i,e,t),n--}return t},yN={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,a=t.edges;a.unmergeBy(function(U){return U.isLoop()});var i=n.length,o=a.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/gN);if(i<2){Mr("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],c=0;c<o;c++){var v=a[c];l.push([c,n.indexOf(v.source()),n.indexOf(v.target())])}for(var h=1/0,g=[],p=new Array(i),E=new Array(i),m=new Array(i),b=function(J,W){for(var H=0;H<i;H++)W[H]=J[H]},w=0;w<=s;w++){for(var x=0;x<i;x++)E[x]=x;var _=_c(E,l.slice(),i,u),C=_.slice();b(E,m);var R=_c(E,_,u,2),S=_c(m,C,u,2);R.length<=S.length&&R.length<h?(h=R.length,g=R,b(E,p)):S.length<=R.length&&S.length<h&&(h=S.length,g=S,b(m,p))}for(var A=this.spawn(g.map(function(U){return a[U[0]]})),P=this.spawn(),I=this.spawn(),D=p[0],M=0;M<p.length;M++){var O=p[M],N=n[M];O===D?P.merge(N):I.merge(N)}var V=function(J){var W=e.spawn();return J.forEach(function(H){W.merge(H),H.connectedEdges().forEach(function(Z){e.contains(Z)&&!A.contains(Z)&&W.merge(Z)})}),W},$=[V(P),V(I)],G={cut:A,components:$,partition1:P,partition2:I};return G}},Cc,mN=function(e){return{x:e.x,y:e.y}},sl=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},d2=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Gi=function(e){return{x:e[0],y:e[1]}},bN=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.min(o,a))}return a},wN=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=-1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(a=Math.max(o,a))}return a},xN=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=0,i=0,o=t;o<n;o++){var s=e[o];isFinite(s)&&(a+=s,i++)}return a/i},EN=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;a?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(h,g){return h-g});var c=e.length,v=Math.floor(c/2);return c%2!==0?e[v+1+s]:(e[v-1+s]+e[v+s])/2},_N=function(e){return Math.PI*e/180},pu=function(e,t){return Math.atan2(t,e)-Math.PI/2},Im=Math.log2||function(r){return Math.log(r)/Math.log(2)},Bm=function(e){return e>0?1:e<0?-1:0},ni=function(e,t){return Math.sqrt(Ya(e,t))},Ya=function(e,t){var n=t.x-e.x,a=t.y-e.y;return n*n+a*a},CN=function(e){for(var t=e.length,n=0,a=0;a<t;a++)n+=e[a];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},at=function(e,t,n,a){return(1-a)*(1-a)*e+2*(1-a)*a*t+a*a*n},Ki=function(e,t,n,a){return{x:at(e.x,t.x,n.x,a),y:at(e.y,t.y,n.y,a)}},SN=function(e,t,n,a){var i={x:t.x-e.x,y:t.y-e.y},o=ni(e,t),s={x:i.x/o,y:i.y/o};return n=n??0,a=a??n*o,{x:e.x+s.x*a,y:e.y+s.y*a}},Qo=function(e,t,n){return Math.max(e,Math.min(n,t))},Dt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},TN=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},RN=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},AN=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},v2=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Pu=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Du=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,a,i,o;if(t.length===1)n=a=i=o=t[0];else if(t.length===2)n=i=t[0],o=a=t[1];else if(t.length===4){var s=Kr(t,4);n=s[0],a=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=a,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tw=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Om=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},pa=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},nw=function(e,t){return pa(e,t.x,t.y)},h2=function(e,t){return pa(e,t.x1,t.y1)&&pa(e,t.x2,t.y2)},PN=(Cc=Math.hypot)!==null&&Cc!==void 0?Cc:function(r,e){return Math.sqrt(r*r+e*e)};function DN(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(A,P){return{x:A.x+P.x,y:A.y+P.y}},n=function(A,P){return{x:A.x-P.x,y:A.y-P.y}},a=function(A,P){return{x:A.x*P,y:A.y*P}},i=function(A,P){return A.x*P.y-A.y*P.x},o=function(A){var P=PN(A.x,A.y);return P===0?{x:0,y:0}:{x:A.x/P,y:A.y/P}},s=function(A){for(var P=0,I=0;I<A.length;I++){var D=A[I],M=A[(I+1)%A.length];P+=D.x*M.y-M.x*D.y}return P/2},u=function(A,P,I,D){var M=n(P,A),O=n(D,I),N=i(M,O);if(Math.abs(N)<1e-9)return t(A,a(M,.5));var V=i(n(I,A),O)/N;return t(A,a(M,V))},l=r.map(function(S){return{x:S.x,y:S.y}});s(l)<0&&l.reverse();for(var c=l.length,v=[],h=0;h<c;h++){var g=l[h],p=l[(h+1)%c],E=n(p,g),m=o({x:E.y,y:-E.x});v.push(m)}for(var b=v.map(function(S,A){var P=t(l[A],a(S,e)),I=t(l[(A+1)%c],a(S,e));return{p1:P,p2:I}}),w=[],x=0;x<c;x++){var _=b[(x-1+c)%c],C=b[x],R=u(_.p1,_.p2,C.p1,C.p2);w.push(R)}return w}function IN(r,e,t,n,a,i){var o=zN(r,e,t,n,a),s=DN(o,i),u=Dt();return s.forEach(function(l){return v2(u,l.x,l.y)}),u}var g2=function(e,t,n,a,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?_a(i,o):u,c=i/2,v=o/2;l=Math.min(l,c,v);var h=l!==c,g=l!==v,p;if(h){var E=n-c+l-s,m=a-v-s,b=n+c-l+s,w=m;if(p=ya(e,t,n,a,E,m,b,w,!1),p.length>0)return p}if(g){var x=n+c+s,_=a-v+l-s,C=x,R=a+v-l+s;if(p=ya(e,t,n,a,x,_,C,R,!1),p.length>0)return p}if(h){var S=n-c+l-s,A=a+v+s,P=n+c-l+s,I=A;if(p=ya(e,t,n,a,S,A,P,I,!1),p.length>0)return p}if(g){var D=n-c-s,M=a-v+l-s,O=D,N=a+v-l+s;if(p=ya(e,t,n,a,D,M,O,N,!1),p.length>0)return p}var V;{var $=n-c+l,G=a-v+l;if(V=Lo(e,t,n,a,$,G,l+s),V.length>0&&V[0]<=$&&V[1]<=G)return[V[0],V[1]]}{var U=n+c-l,J=a-v+l;if(V=Lo(e,t,n,a,U,J,l+s),V.length>0&&V[0]>=U&&V[1]<=J)return[V[0],V[1]]}{var W=n+c-l,H=a+v-l;if(V=Lo(e,t,n,a,W,H,l+s),V.length>0&&V[0]>=W&&V[1]>=H)return[V[0],V[1]]}{var Z=n-c+l,ne=a+v-l;if(V=Lo(e,t,n,a,Z,ne,l+s),V.length>0&&V[0]<=Z&&V[1]>=ne)return[V[0],V[1]]}return[]},BN=function(e,t,n,a,i,o,s){var u=s,l=Math.min(n,i),c=Math.max(n,i),v=Math.min(a,o),h=Math.max(a,o);return l-u<=e&&e<=c+u&&v-u<=t&&t<=h+u},ON=function(e,t,n,a,i,o,s,u,l){var c={x1:Math.min(n,s,i)-l,x2:Math.max(n,s,i)+l,y1:Math.min(a,u,o)-l,y2:Math.max(a,u,o)+l};return!(e<c.x1||e>c.x2||t<c.y1||t>c.y2)},MN=function(e,t,n,a){n-=a;var i=t*t-4*e*n;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-t+o)/s,l=(-t-o)/s;return[u,l]},kN=function(e,t,n,a,i){var o=1e-5;e===0&&(e=o),t/=e,n/=e,a/=e;var s,u,l,c,v,h,g,p;if(u=(3*n-t*t)/9,l=-(27*a)+t*(9*n-2*(t*t)),l/=54,s=u*u*u+l*l,i[1]=0,g=t/3,s>0){v=l+Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),h=l-Math.sqrt(s),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-g+v+h,g+=(v+h)/2,i[4]=i[2]=-g,g=Math.sqrt(3)*(-h+v)/2,i[3]=g,i[5]=-g;return}if(i[5]=i[3]=0,s===0){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-g+2*p,i[4]=i[2]=-(p+g);return}u=-u,c=u*u*u,c=Math.acos(l/Math.sqrt(c)),p=2*Math.sqrt(u),i[0]=-g+p*Math.cos(c/3),i[2]=-g+p*Math.cos((c+2*Math.PI)/3),i[4]=-g+p*Math.cos((c+4*Math.PI)/3)},LN=function(e,t,n,a,i,o,s,u){var l=1*n*n-4*n*i+2*n*s+4*i*i-4*i*s+s*s+a*a-4*a*o+2*a*u+4*o*o-4*o*u+u*u,c=9*n*i-3*n*n-3*n*s-6*i*i+3*i*s+9*a*o-3*a*a-3*a*u-6*o*o+3*o*u,v=3*n*n-6*n*i+n*s-n*e+2*i*i+2*i*e-s*e+3*a*a-6*a*o+a*u-a*t+2*o*o+2*o*t-u*t,h=1*n*i-n*n+n*e-i*e+a*o-a*a+a*t-o*t,g=[];kN(l,c,v,h,g);for(var p=1e-7,E=[],m=0;m<6;m+=2)Math.abs(g[m+1])<p&&g[m]>=0&&g[m]<=1&&E.push(g[m]);E.push(1),E.push(0);for(var b=-1,w,x,_,C=0;C<E.length;C++)w=Math.pow(1-E[C],2)*n+2*(1-E[C])*E[C]*i+E[C]*E[C]*s,x=Math.pow(1-E[C],2)*a+2*(1-E[C])*E[C]*o+E[C]*E[C]*u,_=Math.pow(w-e,2)+Math.pow(x-t,2),b>=0?_<b&&(b=_):b=_;return b},qN=function(e,t,n,a,i,o){var s=[e-n,t-a],u=[i-n,o-a],l=u[0]*u[0]+u[1]*u[1],c=s[0]*s[0]+s[1]*s[1],v=s[0]*u[0]+s[1]*u[1],h=v*v/l;return v<0?c:h>l?(e-i)*(e-i)+(t-o)*(t-o):c-h},Nt=function(e,t,n){for(var a,i,o,s,u,l=0,c=0;c<n.length/2;c++)if(a=n[c*2],i=n[c*2+1],c+1<n.length/2?(o=n[(c+1)*2],s=n[(c+1)*2+1]):(o=n[(c+1-n.length/2)*2],s=n[(c+1-n.length/2)*2+1]),!(a==e&&o==e))if(a>=e&&e>=o||a<=e&&e<=o)u=(e-a)/(o-a)*(s-i)+i,u>t&&l++;else continue;return l%2!==0},Yn=function(e,t,n,a,i,o,s,u,l){var c=new Array(n.length),v;u[0]!=null?(v=Math.atan(u[1]/u[0]),u[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=u;for(var h=Math.cos(-v),g=Math.sin(-v),p=0;p<c.length/2;p++)c[p*2]=o/2*(n[p*2]*h-n[p*2+1]*g),c[p*2+1]=s/2*(n[p*2+1]*h+n[p*2]*g),c[p*2]+=a,c[p*2+1]+=i;var E;if(l>0){var m=Ku(c,-l);E=Hu(m)}else E=c;return Nt(e,t,E)},NN=function(e,t,n,a,i,o,s,u){for(var l=new Array(n.length*2),c=0;c<u.length;c++){var v=u[c];l[c*4+0]=v.startX,l[c*4+1]=v.startY,l[c*4+2]=v.stopX,l[c*4+3]=v.stopY;var h=Math.pow(v.cx-e,2)+Math.pow(v.cy-t,2);if(h<=Math.pow(v.radius,2))return!0}return Nt(e,t,l)},Hu=function(e){for(var t=new Array(e.length/2),n,a,i,o,s,u,l,c,v=0;v<e.length/4;v++){n=e[v*4],a=e[v*4+1],i=e[v*4+2],o=e[v*4+3],v<e.length/4-1?(s=e[(v+1)*4],u=e[(v+1)*4+1],l=e[(v+1)*4+2],c=e[(v+1)*4+3]):(s=e[0],u=e[1],l=e[2],c=e[3]);var h=ya(n,a,i,o,s,u,l,c,!0);t[v*2]=h[0],t[v*2+1]=h[1]}return t},Ku=function(e,t){for(var n=new Array(e.length*2),a,i,o,s,u=0;u<e.length/2;u++){a=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,c=-(o-a),v=Math.sqrt(l*l+c*c),h=l/v,g=c/v;n[u*4]=a+h*t,n[u*4+1]=i+g*t,n[u*4+2]=o+h*t,n[u*4+3]=s+g*t}return n},FN=function(e,t,n,a,i,o){var s=n-e,u=a-t;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),c=l-1;if(c<0)return[];var v=c/l;return[(n-e)*v+e,(a-t)*v+t]},ei=function(e,t,n,a,i,o,s){return e-=i,t-=o,e/=n/2+s,t/=a/2+s,e*e+t*t<=1},Lo=function(e,t,n,a,i,o,s){var u=[n-e,a-t],l=[e-i,t-o],c=u[0]*u[0]+u[1]*u[1],v=2*(l[0]*u[0]+l[1]*u[1]),h=l[0]*l[0]+l[1]*l[1]-s*s,g=v*v-4*c*h;if(g<0)return[];var p=(-v+Math.sqrt(g))/(2*c),E=(-v-Math.sqrt(g))/(2*c),m=Math.min(p,E),b=Math.max(p,E),w=[];if(m>=0&&m<=1&&w.push(m),b>=0&&b<=1&&w.push(b),w.length===0)return[];var x=w[0]*u[0]+e,_=w[0]*u[1]+t;if(w.length>1){if(w[0]==w[1])return[x,_];var C=w[1]*u[0]+e,R=w[1]*u[1]+t;return[x,_,C,R]}else return[x,_]},Sc=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},ya=function(e,t,n,a,i,o,s,u,l){var c=e-i,v=n-e,h=s-i,g=t-o,p=a-t,E=u-o,m=h*g-E*c,b=v*g-p*c,w=E*v-h*p;if(w!==0){var x=m/w,_=b/w,C=.001,R=0-C,S=1+C;return R<=x&&x<=S&&R<=_&&_<=S?[e+x*v,t+x*p]:l?[e+x*v,t+x*p]:[]}else return m===0||b===0?Sc(e,n,s)===s?[s,u]:Sc(e,n,i)===i?[i,o]:Sc(i,s,n)===n?[n,a]:[]:[]},zN=function(e,t,n,a,i){var o=[],s=a/2,u=i/2,l=t,c=n;o.push({x:l+s*e[0],y:c+u*e[1]});for(var v=1;v<e.length/2;v++)o.push({x:l+s*e[v*2],y:c+u*e[v*2+1]});return o},Jo=function(e,t,n,a,i,o,s,u){var l=[],c,v=new Array(n.length),h=!0;o==null&&(h=!1);var g;if(h){for(var p=0;p<v.length/2;p++)v[p*2]=n[p*2]*o+a,v[p*2+1]=n[p*2+1]*s+i;if(u>0){var E=Ku(v,-u);g=Hu(E)}else g=v}else g=n;for(var m,b,w,x,_=0;_<g.length/2;_++)m=g[_*2],b=g[_*2+1],_<g.length/2-1?(w=g[(_+1)*2],x=g[(_+1)*2+1]):(w=g[0],x=g[1]),c=ya(e,t,a,i,m,b,w,x),c.length!==0&&l.push(c[0],c[1]);return l},$N=function(e,t,n,a,i,o,s,u,l){var c=[],v,h=new Array(n.length*2);l.forEach(function(w,x){x===0?(h[h.length-2]=w.startX,h[h.length-1]=w.startY):(h[x*4-2]=w.startX,h[x*4-1]=w.startY),h[x*4]=w.stopX,h[x*4+1]=w.stopY,v=Lo(e,t,a,i,w.cx,w.cy,w.radius),v.length!==0&&c.push(v[0],v[1])});for(var g=0;g<h.length/4;g++)v=ya(e,t,a,i,h[g*4],h[g*4+1],h[g*4+2],h[g*4+3],!1),v.length!==0&&c.push(v[0],v[1]);if(c.length>2){for(var p=[c[0],c[1]],E=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),m=1;m<c.length/2;m++){var b=Math.pow(c[m*2]-e,2)+Math.pow(c[m*2+1]-t,2);b<=E&&(p[0]=c[m*2],p[1]=c[m*2+1],E=b)}return p}return c},yu=function(e,t,n){var a=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=(i-n)/i;return o<0&&(o=1e-5),[t[0]+o*a[0],t[1]+o*a[1]]},At=function(e,t){var n=im(e,t);return n=p2(n),n},p2=function(e){for(var t,n,a=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<a;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);for(var c=2/(s-i),v=2/(u-o),h=0;h<a;h++)t=e[2*h]=e[2*h]*c,n=e[2*h+1]=e[2*h+1]*v,i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,n),u=Math.max(u,n);if(o<-1)for(var g=0;g<a;g++)n=e[2*g+1]=e[2*g+1]+(-1-o);return e},im=function(e,t){var n=1/e*2*Math.PI,a=e%2===0?Math.PI/2+n/2:Math.PI/2;a+=t;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*n+a,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},_a=function(e,t){return Math.min(e/4,t/4,8)},y2=function(e,t){return Math.min(e/10,t/10,8)},Mm=function(){return 8},VN=function(e,t,n){return[e-2*t+n,2*(t-e),e]},om=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Tc(r,e){function t(v){for(var h=[],g=0;g<v.length;g++){var p=v[g],E=v[(g+1)%v.length],m={x:E.x-p.x,y:E.y-p.y},b={x:-m.y,y:m.x},w=Math.sqrt(b.x*b.x+b.y*b.y);h.push({x:b.x/w,y:b.y/w})}return h}function n(v,h){var g=1/0,p=-1/0,E=Ft(v),m;try{for(E.s();!(m=E.n()).done;){var b=m.value,w=b.x*h.x+b.y*h.y;g=Math.min(g,w),p=Math.max(p,w)}}catch(x){E.e(x)}finally{E.f()}return{min:g,max:p}}function a(v,h){return!(v.max<h.min||h.max<v.min)}var i=[].concat(Vu(t(r)),Vu(t(e))),o=Ft(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=n(r,u),c=n(e,u);if(!a(l,c))return!1}}catch(v){o.e(v)}finally{o.f()}return!0}var GN=ht({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),WN={pageRank:function(e){for(var t=GN(e),n=t.dampingFactor,a=t.precision,i=t.iterations,o=t.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,c=u.edges,v=l.length,h=v*v,g=c.length,p=new Array(h),E=new Array(v),m=(1-n)/v,b=0;b<v;b++){for(var w=0;w<v;w++){var x=b*v+w;p[x]=0}E[b]=0}for(var _=0;_<g;_++){var C=c[_],R=C.data("source"),S=C.data("target");if(R!==S){var A=l.indexOfId(R),P=l.indexOfId(S),I=o(C),D=P*v+A;p[D]+=I,E[A]+=I}}for(var M=1/v+m,O=0;O<v;O++)if(E[O]===0)for(var N=0;N<v;N++){var V=N*v+O;p[V]=M}else for(var $=0;$<v;$++){var G=$*v+O;p[G]=p[G]/E[O]+m}for(var U=new Array(v),J=new Array(v),W,H=0;H<v;H++)U[H]=1;for(var Z=0;Z<i;Z++){for(var ne=0;ne<v;ne++)J[ne]=0;for(var F=0;F<v;F++)for(var z=0;z<v;z++){var j=F*v+z;J[F]+=p[j]*U[z]}CN(J),W=U,U=J,J=W;for(var ee=0,ie=0;ie<v;ie++){var oe=W[ie]-U[ie];ee+=oe*oe}if(ee<a)break}var Y={rank:function(re){return re=s.collection(re)[0],U[l.indexOf(re)]}};return Y}},aw=ht({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ji={degreeCentralityNormalized:function(e){e=aw(e);var t=this.cy(),n=this.nodes(),a=n.length;if(e.directed){for(var c={},v={},h=0,g=0,p=0;p<a;p++){var E=n[p],m=E.id();e.root=E;var b=this.degreeCentrality(e);h<b.indegree&&(h=b.indegree),g<b.outdegree&&(g=b.outdegree),c[m]=b.indegree,v[m]=b.outdegree}return{indegree:function(x){return h==0?0:(Ge(x)&&(x=t.filter(x)),c[x.id()]/h)},outdegree:function(x){return g===0?0:(Ge(x)&&(x=t.filter(x)),v[x.id()]/g)}}}else{for(var i={},o=0,s=0;s<a;s++){var u=n[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(x){return o===0?0:(Ge(x)&&(x=t.filter(x)),i[x.id()]/o)}}}},degreeCentrality:function(e){e=aw(e);var t=this.cy(),n=this,a=e,i=a.root,o=a.weight,s=a.directed,u=a.alpha;if(i=t.collection(i)[0],s){for(var g=i.connectedEdges(),p=g.filter(function(R){return R.target().same(i)&&n.has(R)}),E=g.filter(function(R){return R.source().same(i)&&n.has(R)}),m=p.length,b=E.length,w=0,x=0,_=0;_<p.length;_++)w+=o(p[_]);for(var C=0;C<E.length;C++)x+=o(E[C]);return{indegree:Math.pow(m,1-u)*Math.pow(w,u),outdegree:Math.pow(b,1-u)*Math.pow(x,u)}}else{for(var l=i.connectedEdges().intersection(n),c=l.length,v=0,h=0;h<l.length;h++)v+=o(l[h]);return{degree:Math.pow(c,1-u)*Math.pow(v,u)}}}};ji.dc=ji.degreeCentrality;ji.dcn=ji.degreeCentralityNormalised=ji.degreeCentralityNormalized;var iw=ht({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Yi={closenessCentralityNormalized:function(e){for(var t=iw(e),n=t.harmonic,a=t.weight,i=t.directed,o=this.cy(),s={},u=0,l=this.nodes(),c=this.floydWarshall({weight:a,directed:i}),v=0;v<l.length;v++){for(var h=0,g=l[v],p=0;p<l.length;p++)if(v!==p){var E=c.distance(g,l[p]);n?h+=1/E:h+=E}n||(h=1/h),u<h&&(u=h),s[g.id()]=h}return{closeness:function(b){return u==0?0:(Ge(b)?b=o.filter(b)[0].id():b=b.id(),s[b]/u)}}},closenessCentrality:function(e){var t=iw(e),n=t.root,a=t.weight,i=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var s=this.dijkstra({root:n,weight:a,directed:i}),u=0,l=this.nodes(),c=0;c<l.length;c++){var v=l[c];if(!v.same(n)){var h=s.distanceTo(v);o?u+=1/h:u+=h}}return o?u:1/u}};Yi.cc=Yi.closenessCentrality;Yi.ccn=Yi.closenessCentralityNormalised=Yi.closenessCentralityNormalized;var UN=ht({weight:null,directed:!1}),sm={betweennessCentrality:function(e){for(var t=UN(e),n=t.directed,a=t.weight,i=a!=null,o=this.cy(),s=this.nodes(),u={},l={},c=0,v={set:function(x,_){l[x]=_,_>c&&(c=_)},get:function(x){return l[x]}},h=0;h<s.length;h++){var g=s[h],p=g.id();n?u[p]=g.outgoers().nodes():u[p]=g.openNeighborhood().nodes(),v.set(p,0)}for(var E=function(){for(var x=s[m].id(),_=[],C={},R={},S={},A=new hs(function(F,z){return S[F]-S[z]}),P=0;P<s.length;P++){var I=s[P].id();C[I]=[],R[I]=0,S[I]=1/0}for(R[x]=1,S[x]=0,A.push(x);!A.empty();){var D=A.pop();if(_.push(D),i)for(var M=0;M<u[D].length;M++){var O=u[D][M],N=o.getElementById(D),V=void 0;N.edgesTo(O).length>0?V=N.edgesTo(O)[0]:V=O.edgesTo(N)[0];var $=a(V);O=O.id(),S[O]>S[D]+$&&(S[O]=S[D]+$,A.nodes.indexOf(O)<0?A.push(O):A.updateItem(O),R[O]=0,C[O]=[]),S[O]==S[D]+$&&(R[O]=R[O]+R[D],C[O].push(D))}else for(var G=0;G<u[D].length;G++){var U=u[D][G].id();S[U]==1/0&&(A.push(U),S[U]=S[D]+1),S[U]==S[D]+1&&(R[U]=R[U]+R[D],C[U].push(D))}}for(var J={},W=0;W<s.length;W++)J[s[W].id()]=0;for(;_.length>0;){for(var H=_.pop(),Z=0;Z<C[H].length;Z++){var ne=C[H][Z];J[ne]=J[ne]+R[ne]/R[H]*(1+J[H])}H!=s[m].id()&&v.set(H,v.get(H)+J[H])}},m=0;m<s.length;m++)E();var b={betweenness:function(x){var _=o.collection(x).id();return v.get(_)},betweennessNormalized:function(x){if(c==0)return 0;var _=o.collection(x).id();return v.get(_)/c}};return b.betweennessNormalised=b.betweennessNormalized,b}};sm.bc=sm.betweennessCentrality;var HN=ht({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),KN=function(e){return HN(e)},jN=function(e,t){for(var n=0,a=0;a<t.length;a++)n+=t[a](e);return n},YN=function(e,t,n){for(var a=0;a<t;a++)e[a*t+a]=n},m2=function(e,t){for(var n,a=0;a<t;a++){n=0;for(var i=0;i<t;i++)n+=e[i*t+a];for(var o=0;o<t;o++)e[o*t+a]=e[o*t+a]/n}},ZN=function(e,t,n){for(var a=new Array(n*n),i=0;i<n;i++){for(var o=0;o<n;o++)a[i*n+o]=0;for(var s=0;s<n;s++)for(var u=0;u<n;u++)a[i*n+u]+=e[i*n+s]*t[s*n+u]}return a},XN=function(e,t,n){for(var a=e.slice(0),i=1;i<n;i++)e=ZN(e,a,t);return e},QN=function(e,t,n){for(var a=new Array(t*t),i=0;i<t*t;i++)a[i]=Math.pow(e[i],n);return m2(a,t),a},JN=function(e,t,n,a){for(var i=0;i<n;i++){var o=Math.round(e[i]*Math.pow(10,a))/Math.pow(10,a),s=Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a);if(o!==s)return!1}return!0},eF=function(e,t,n,a){for(var i=[],o=0;o<t;o++){for(var s=[],u=0;u<t;u++)Math.round(e[o*t+u]*1e3)/1e3>0&&s.push(n[u]);s.length!==0&&i.push(a.collection(s))}return i},rF=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},tF=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&rF(e[t],e[n])&&e.splice(n,1);return e},ow=function(e){for(var t=this.nodes(),n=this.edges(),a=this.cy(),i=KN(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var u=t.length,l=u*u,c=new Array(l),v,h=0;h<l;h++)c[h]=0;for(var g=0;g<n.length;g++){var p=n[g],E=o[p.source().id()],m=o[p.target().id()],b=jN(p,i.attributes);c[E*u+m]+=b,c[m*u+E]+=b}YN(c,u,i.multFactor),m2(c,u);for(var w=!0,x=0;w&&x<i.maxIterations;)w=!1,v=XN(c,u,i.expandFactor),c=QN(v,u,i.inflateFactor),JN(c,v,l,4)||(w=!0),x++;var _=eF(c,u,t,a);return _=tF(_),_},nF={markovClustering:ow,mcl:ow},aF=function(e){return e},b2=function(e,t){return Math.abs(t-e)},sw=function(e,t,n){return e+b2(t,n)},uw=function(e,t,n){return e+Math.pow(n-t,2)},iF=function(e){return Math.sqrt(e)},oF=function(e,t,n){return Math.max(e,b2(t,n))},Po=function(e,t,n,a,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:aF,s=a,u,l,c=0;c<e;c++)u=t(c),l=n(c),s=i(s,u,l);return o(s)},Ji={euclidean:function(e,t,n){return e>=2?Po(e,t,n,0,uw,iF):Po(e,t,n,0,sw)},squaredEuclidean:function(e,t,n){return Po(e,t,n,0,uw)},manhattan:function(e,t,n){return Po(e,t,n,0,sw)},max:function(e,t,n){return Po(e,t,n,-1/0,oF)}};Ji["squared-euclidean"]=Ji.squaredEuclidean;Ji.squaredeuclidean=Ji.squaredEuclidean;function ul(r,e,t,n,a,i){var o;return Nr(r)?o=r:o=Ji[r]||Ji.euclidean,e===0&&Nr(r)?o(a,i):o(e,t,n,a,i)}var sF=ht({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),km=function(e){return sF(e)},ju=function(e,t,n,a,i){var o=i!=="kMedoids",s=o?function(v){return n[v]}:function(v){return a[v](n)},u=function(h){return a[h](t)},l=n,c=t;return ul(e,a.length,s,u,l,c)},Rc=function(e,t,n){for(var a=n.length,i=new Array(a),o=new Array(a),s=new Array(t),u=null,l=0;l<a;l++)i[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var c=0;c<t;c++){u=[];for(var v=0;v<a;v++)u[v]=Math.random()*(o[v]-i[v])+i[v];s[c]=u}return s},w2=function(e,t,n,a,i){for(var o=1/0,s=0,u=0;u<t.length;u++){var l=ju(n,e,t[u],a,i);l<o&&(o=l,s=u)}return s},x2=function(e,t,n){for(var a=[],i=null,o=0;o<t.length;o++)i=t[o],n[i.id()]===e&&a.push(i);return a},uF=function(e,t,n){return Math.abs(t-e)<=n},lF=function(e,t,n){for(var a=0;a<e.length;a++)for(var i=0;i<e[a].length;i++){var o=Math.abs(e[a][i]-t[a][i]);if(o>n)return!1}return!0},fF=function(e,t,n){for(var a=0;a<n;a++)if(e===t[a])return!0;return!1},lw=function(e,t){var n=new Array(t);if(e.length<50)for(var a=0;a<t;a++){for(var i=e[Math.floor(Math.random()*e.length)];fF(i,n,a);)i=e[Math.floor(Math.random()*e.length)];n[a]=i}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},fw=function(e,t,n){for(var a=0,i=0;i<t.length;i++)a+=ju("manhattan",t[i],e,n,"kMedoids");return a},cF=function(e){var t=this.cy(),n=this.nodes(),a=null,i=km(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=Rc(n,i.k,i.attributes)):et(i.testCentroids)==="object"?u=i.testCentroids:u=Rc(n,i.k,i.attributes):u=Rc(n,i.k,i.attributes);for(var l=!0,c=0;l&&c<i.maxIterations;){for(var v=0;v<n.length;v++)a=n[v],s[a.id()]=w2(a,u,i.distance,i.attributes,"kMeans");l=!1;for(var h=0;h<i.k;h++){var g=x2(h,n,s);if(g.length!==0){for(var p=i.attributes.length,E=u[h],m=new Array(p),b=new Array(p),w=0;w<p;w++){b[w]=0;for(var x=0;x<g.length;x++)a=g[x],b[w]+=i.attributes[w](a);m[w]=b[w]/g.length,uF(m[w],E[w],i.sensitivityThreshold)||(l=!0)}u[h]=m,o[h]=t.collection(g)}}c++}return o},dF=function(e){var t=this.cy(),n=this.nodes(),a=null,i=km(e),o=new Array(i.k),s,u={},l,c=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(et(i.testCentroids)==="object"?s=i.testCentroids:s=lw(n,i.k)):s=lw(n,i.k);for(var v=!0,h=0;v&&h<i.maxIterations;){for(var g=0;g<n.length;g++)a=n[g],u[a.id()]=w2(a,s,i.distance,i.attributes,"kMedoids");v=!1;for(var p=0;p<s.length;p++){var E=x2(p,n,u);if(E.length!==0){c[p]=fw(s[p],E,i.attributes);for(var m=0;m<E.length;m++)l=fw(E[m],E,i.attributes),l<c[p]&&(c[p]=l,s[p]=E[m],v=!0);o[p]=t.collection(E)}}h++}return o},vF=function(e,t,n,a,i){for(var o,s,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)a[u][l]=Math.pow(n[u][l],i.m);for(var c=0;c<e.length;c++)for(var v=0;v<i.attributes.length;v++){o=0,s=0;for(var h=0;h<t.length;h++)o+=a[h][c]*i.attributes[v](t[h]),s+=a[h][c];e[c][v]=o/s}},hF=function(e,t,n,a,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var s,u,l,c=2/(i.m-1),v=0;v<n.length;v++)for(var h=0;h<a.length;h++){s=0;for(var g=0;g<n.length;g++)u=ju(i.distance,a[h],n[v],i.attributes,"cmeans"),l=ju(i.distance,a[h],n[g],i.attributes,"cmeans"),s+=Math.pow(u/l,c);e[h][v]=1/s}},gF=function(e,t,n,a){for(var i=new Array(n.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<t.length;l++){s=-1/0,u=-1;for(var c=0;c<t[0].length;c++)t[l][c]>s&&(s=t[l][c],u=c);i[u].push(e[l])}for(var v=0;v<i.length;v++)i[v]=a.collection(i[v]);return i},cw=function(e){var t=this.cy(),n=this.nodes(),a=km(e),i,o,s,u,l;u=new Array(n.length);for(var c=0;c<n.length;c++)u[c]=new Array(a.k);s=new Array(n.length);for(var v=0;v<n.length;v++)s[v]=new Array(a.k);for(var h=0;h<n.length;h++){for(var g=0,p=0;p<a.k;p++)s[h][p]=Math.random(),g+=s[h][p];for(var E=0;E<a.k;E++)s[h][E]=s[h][E]/g}o=new Array(a.k);for(var m=0;m<a.k;m++)o[m]=new Array(a.attributes.length);l=new Array(n.length);for(var b=0;b<n.length;b++)l[b]=new Array(a.k);for(var w=!0,x=0;w&&x<a.maxIterations;)w=!1,vF(o,n,s,l,a),hF(s,u,o,n,a),lF(s,u,a.sensitivityThreshold)||(w=!0),x++;return i=gF(n,s,a,t),{clusters:i,degreeOfMembership:s}},pF={kMeans:cF,kMedoids:dF,fuzzyCMeans:cw,fcm:cw},yF=ht({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),mF={single:"min",complete:"max"},bF=function(e){var t=yF(e),n=mF[t.linkage];return n!=null&&(t.linkage=n),t},dw=function(e,t,n,a,i){for(var o=0,s=1/0,u,l=i.attributes,c=function(P,I){return ul(i.distance,l.length,function(D){return l[D](P)},function(D){return l[D](I)},P,I)},v=0;v<e.length;v++){var h=e[v].key,g=n[h][a[h]];g<s&&(o=h,s=g)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var p=t[o],E=t[a[o]],m;i.mode==="dendrogram"?m={left:p,right:E,key:p.key}:m={value:p.value.concat(E.value),key:p.key},e[p.index]=m,e.splice(E.index,1),t[p.key]=m;for(var b=0;b<e.length;b++){var w=e[b];p.key===w.key?u=1/0:i.linkage==="min"?(u=n[p.key][w.key],n[p.key][w.key]>n[E.key][w.key]&&(u=n[E.key][w.key])):i.linkage==="max"?(u=n[p.key][w.key],n[p.key][w.key]<n[E.key][w.key]&&(u=n[E.key][w.key])):i.linkage==="mean"?u=(n[p.key][w.key]*p.size+n[E.key][w.key]*E.size)/(p.size+E.size):i.mode==="dendrogram"?u=c(w.value,p.value):u=c(w.value[0],p.value[0]),n[p.key][w.key]=n[w.key][p.key]=u}for(var x=0;x<e.length;x++){var _=e[x].key;if(a[_]===p.key||a[_]===E.key){for(var C=_,R=0;R<e.length;R++){var S=e[R].key;n[_][S]<n[_][C]&&(C=S)}a[_]=C}e[x].index=x}return p.key=E.key=p.index=E.index=null,!0},Wi=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&Wi(e.left,t),e.right&&Wi(e.right,t)))},um=function(e,t){if(!e)return"";if(e.left&&e.right){var n=um(e.left,t),a=um(e.right,t),i=t.add({group:"nodes",data:{id:n+","+a}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},lm=function(e,t,n){if(!e)return[];var a=[],i=[],o=[];return t===0?(e.left&&Wi(e.left,a),e.right&&Wi(e.right,i),o=a.concat(i),[n.collection(o)]):t===1?e.value?[n.collection(e.value)]:(e.left&&Wi(e.left,a),e.right&&Wi(e.right,i),[n.collection(a),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(a=lm(e.left,t-1,n)),e.right&&(i=lm(e.right,t-1,n)),a.concat(i))},vw=function(e){for(var t=this.cy(),n=this.nodes(),a=bF(e),i=a.attributes,o=function(x,_){return ul(a.distance,i.length,function(C){return i[C](x)},function(C){return i[C](_)},x,_)},s=[],u=[],l=[],c=[],v=0;v<n.length;v++){var h={value:a.mode==="dendrogram"?n[v]:[n[v]],key:v,index:v};s[v]=h,c[v]=h,u[v]=[],l[v]=0}for(var g=0;g<s.length;g++)for(var p=0;p<=g;p++){var E=void 0;a.mode==="dendrogram"?E=g===p?1/0:o(s[g].value,s[p].value):E=g===p?1/0:o(s[g].value[0],s[p].value[0]),u[g][p]=E,u[p][g]=E,E<u[g][l[g]]&&(l[g]=p)}for(var m=dw(s,c,u,l,a);m;)m=dw(s,c,u,l,a);var b;return a.mode==="dendrogram"?(b=lm(s[0],a.dendrogramDepth,t),a.addDendrogram&&um(s[0],t)):(b=new Array(s.length),s.forEach(function(w,x){w.key=w.index=null,b[x]=t.collection(w.value)})),b},wF={hierarchicalClustering:vw,hca:vw},xF=ht({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),EF=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Mr("Damping must range on [0.5, 1). Got: ".concat(t));var a=["median","mean","min","max"];return a.some(function(i){return i===n})||De(n)||Mr("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(n)),xF(e)},_F=function(e,t,n,a){var i=function(s,u){return a[u](s)};return-ul(e,a.length,function(o){return i(t,o)},function(o){return i(n,o)},t,n)},CF=function(e,t){var n=null;return t==="median"?n=EN(e):t==="mean"?n=xN(e):t==="min"?n=bN(e):t==="max"?n=wN(e):n=t,n},SF=function(e,t,n){for(var a=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&a.push(i);return a},hw=function(e,t,n){for(var a=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<n.length;u++){var l=n[u];t[i*e+l]>s&&(o=l,s=t[i*e+l])}o>0&&a.push(o)}for(var c=0;c<n.length;c++)a[n[c]]=n[c];return a},TF=function(e,t,n){for(var a=hw(e,t,n),i=0;i<n.length;i++){for(var o=[],s=0;s<a.length;s++)a[s]===n[i]&&o.push(s);for(var u=-1,l=-1/0,c=0;c<o.length;c++){for(var v=0,h=0;h<o.length;h++)v+=t[o[h]*e+o[c]];v>l&&(u=c,l=v)}n[i]=o[u]}return a=hw(e,t,n),a},gw=function(e){for(var t=this.cy(),n=this.nodes(),a=EF(e),i={},o=0;o<n.length;o++)i[n[o].id()]=o;var s,u,l,c,v,h;s=n.length,u=s*s,l=new Array(u);for(var g=0;g<u;g++)l[g]=-1/0;for(var p=0;p<s;p++)for(var E=0;E<s;E++)p!==E&&(l[p*s+E]=_F(a.distance,n[p],n[E],a.attributes));c=CF(l,a.preference);for(var m=0;m<s;m++)l[m*s+m]=c;v=new Array(u);for(var b=0;b<u;b++)v[b]=0;h=new Array(u);for(var w=0;w<u;w++)h[w]=0;for(var x=new Array(s),_=new Array(s),C=new Array(s),R=0;R<s;R++)x[R]=0,_[R]=0,C[R]=0;for(var S=new Array(s*a.minIterations),A=0;A<S.length;A++)S[A]=0;var P;for(P=0;P<a.maxIterations;P++){for(var I=0;I<s;I++){for(var D=-1/0,M=-1/0,O=-1,N=0,V=0;V<s;V++)x[V]=v[I*s+V],N=h[I*s+V]+l[I*s+V],N>=D?(M=D,D=N,O=V):N>M&&(M=N);for(var $=0;$<s;$++)v[I*s+$]=(1-a.damping)*(l[I*s+$]-D)+a.damping*x[$];v[I*s+O]=(1-a.damping)*(l[I*s+O]-M)+a.damping*x[O]}for(var G=0;G<s;G++){for(var U=0,J=0;J<s;J++)x[J]=h[J*s+G],_[J]=Math.max(0,v[J*s+G]),U+=_[J];U-=_[G],_[G]=v[G*s+G],U+=_[G];for(var W=0;W<s;W++)h[W*s+G]=(1-a.damping)*Math.min(0,U-_[W])+a.damping*x[W];h[G*s+G]=(1-a.damping)*(U-_[G])+a.damping*x[G]}for(var H=0,Z=0;Z<s;Z++){var ne=h[Z*s+Z]+v[Z*s+Z]>0?1:0;S[P%a.minIterations*s+Z]=ne,H+=ne}if(H>0&&(P>=a.minIterations-1||P==a.maxIterations-1)){for(var F=0,z=0;z<s;z++){C[z]=0;for(var j=0;j<a.minIterations;j++)C[z]+=S[j*s+z];(C[z]===0||C[z]===a.minIterations)&&F++}if(F===s)break}}for(var ee=SF(s,v,h),ie=TF(s,l,ee),oe={},Y=0;Y<ee.length;Y++)oe[ee[Y]]=[];for(var X=0;X<n.length;X++){var re=i[n[X].id()],le=ie[re];le!=null&&oe[le].push(n[X])}for(var he=new Array(ee.length),be=0;be<ee.length;be++)he[be]=t.collection(oe[ee[be]]);return he},RF={affinityPropagation:gw,ap:gw},AF=ht({root:void 0,directed:!1}),PF={hierholzer:function(e){if(!pr(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=AF(e),a=n.root,i=n.directed,o=this,s=!1,u,l,c;a&&(c=Ge(a)?this.filter(a)[0].id():a[0].id());var v={},h={};i?o.forEach(function(w){var x=w.id();if(w.isNode()){var _=w.indegree(!0),C=w.outdegree(!0),R=_-C,S=C-_;R==1?u?s=!0:u=x:S==1?l?s=!0:l=x:(S>1||R>1)&&(s=!0),v[x]=[],w.outgoers().forEach(function(A){A.isEdge()&&v[x].push(A.id())})}else h[x]=[void 0,w.target().id()]}):o.forEach(function(w){var x=w.id();if(w.isNode()){var _=w.degree(!0);_%2&&(u?l?s=!0:l=x:u=x),v[x]=[],w.connectedEdges().forEach(function(C){return v[x].push(C.id())})}else h[x]=[w.source().id(),w.target().id()]});var g={found:!1,trail:void 0};if(s)return g;if(l&&u)if(i){if(c&&l!=c)return g;c=l}else{if(c&&l!=c&&u!=c)return g;c||(c=l)}else c||(c=o[0].id());var p=function(x){for(var _=x,C=[x],R,S,A;v[_].length;)R=v[_].shift(),S=h[R][0],A=h[R][1],_!=A?(v[A]=v[A].filter(function(P){return P!=R}),_=A):!i&&_!=S&&(v[S]=v[S].filter(function(P){return P!=R}),_=S),C.unshift(R),C.unshift(_);return C},E=[],m=[];for(m=p(c);m.length!=1;)v[m[0]].length==0?(E.unshift(o.getElementById(m.shift())),E.unshift(o.getElementById(m.shift()))):m=p(m.shift()).concat(m);E.unshift(o.getElementById(m.shift()));for(var b in v)if(v[b].length)return g;return g.found=!0,g.trail=this.spawn(E,!0),g}},mu=function(){var e=this,t={},n=0,a=0,i=[],o=[],s={},u=function(h,g){for(var p=o.length-1,E=[],m=e.spawn();o[p].x!=h||o[p].y!=g;)E.push(o.pop().edge),p--;E.push(o.pop().edge),E.forEach(function(b){var w=b.connectedNodes().intersection(e);m.merge(b),w.forEach(function(x){var _=x.id(),C=x.connectedEdges().intersection(e);m.merge(x),t[_].cutVertex?m.merge(C.filter(function(R){return R.isLoop()})):m.merge(C)})}),i.push(m)},l=function(h,g,p){h===p&&(a+=1),t[g]={id:n,low:n++,cutVertex:!1};var E=e.getElementById(g).connectedEdges().intersection(e);if(E.size()===0)i.push(e.spawn(e.getElementById(g)));else{var m,b,w,x;E.forEach(function(_){m=_.source().id(),b=_.target().id(),w=m===g?b:m,w!==p&&(x=_.id(),s[x]||(s[x]=!0,o.push({x:g,y:w,edge:_})),w in t?t[g].low=Math.min(t[g].low,t[w].id):(l(h,w,g),t[g].low=Math.min(t[g].low,t[w].low),t[g].id<=t[w].low&&(t[g].cutVertex=!0,u(g,w))))})}};e.forEach(function(v){if(v.isNode()){var h=v.id();h in t||(a=0,l(h,h),t[h].cutVertex=a>1)}});var c=Object.keys(t).filter(function(v){return t[v].cutVertex}).map(function(v){return e.getElementById(v)});return{cut:e.spawn(c),components:i}},DF={hopcroftTarjanBiconnected:mu,htbc:mu,htb:mu,hopcroftTarjanBiconnectedComponents:mu},bu=function(){var e=this,t={},n=0,a=[],i=[],o=e.spawn(e),s=function(l){i.push(l),t[l]={index:n,low:n++,explored:!1};var c=e.getElementById(l).connectedEdges().intersection(e);if(c.forEach(function(E){var m=E.target().id();m!==l&&(m in t||s(m),t[m].explored||(t[l].low=Math.min(t[l].low,t[m].low)))}),t[l].index===t[l].low){for(var v=e.spawn();;){var h=i.pop();if(v.merge(e.getElementById(h)),t[h].low=t[l].index,t[h].explored=!0,h===l)break}var g=v.edgesWith(v),p=v.merge(g);a.push(p),o=o.difference(p)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||s(l)}}),{cut:o,components:a}},IF={tarjanStronglyConnected:bu,tsc:bu,tscc:bu,tarjanStronglyConnectedComponents:bu},E2={};[Xo,sN,uN,fN,dN,hN,yN,WN,ji,Yi,sm,nF,pF,wF,RF,PF,DF,IF].forEach(function(r){He(E2,r)});/*!
|
|
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 _2=0,C2=1,S2=2,bn=function(e){if(!(this instanceof bn))return new bn(e);this.id="Thenable/1.0.7",this.state=_2,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};bn.prototype={fulfill:function(e){return pw(this,C2,"fulfillValue",e)},reject:function(e){return pw(this,S2,"rejectReason",e)},then:function(e,t){var n=this,a=new bn;return n.onFulfilled.push(mw(e,a,"fulfill")),n.onRejected.push(mw(t,a,"reject")),T2(n),a.proxy}};var pw=function(e,t,n,a){return e.state===_2&&(e.state=t,e[n]=a,T2(e)),e},T2=function(e){e.state===C2?yw(e,"onFulfilled",e.fulfillValue):e.state===S2&&yw(e,"onRejected",e.rejectReason)},yw=function(e,t,n){if(e[t].length!==0){var a=e[t];e[t]=[];var i=function(){for(var s=0;s<a.length;s++)a[s](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},mw=function(e,t,n){return function(a){if(typeof e!="function")t[n].call(t,a);else{var i;try{i=e(a)}catch(o){t.reject(o);return}R2(t,i)}}},R2=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(et(t)==="object"&&t!==null||typeof t=="function")try{n=t.then}catch(i){e.reject(i);return}if(typeof n=="function"){var a=!1;try{n.call(t,function(i){a||(a=!0,i===t?e.reject(new TypeError("circular thenable chain")):R2(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(t)};bn.all=function(r){return new bn(function(e,t){for(var n=new Array(r.length),a=0,i=function(u,l){n[u]=l,a++,a===r.length&&e(n)},o=0;o<r.length;o++)(function(s){var u=r[s],l=u!=null&&u.then!=null;if(l)u.then(function(v){i(s,v)},function(v){t(v)});else{var c=u;i(s,c)}})(o)})};bn.resolve=function(r){return new bn(function(e,t){e(r)})};bn.reject=function(r){return new bn(function(e,t){t(r)})};var to=typeof Promise<"u"?Promise:bn,fm=function(e,t,n){var a=Sm(e),i=!a,o=this._private=He({duration:1e3},t,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Nr(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(a){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},ai=fm.prototype;He(ai,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),jt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(l,c){var v=e[l];v!=null&&(e[l]=e[c],e[c]=v)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[a]=s}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new to(function(a,i){n.push(function(){a()})})}});ai.complete=ai.completed;ai.run=ai.play;ai.running=ai.playing;var BF={animated:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=a[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,n=t.length!==void 0,a=n?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){var s=a[o];s._private.animation.queue=[]}return this}},delay:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:t,duration:t,complete:n}):this}},delayAnimation:function(){return function(t,n){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:t,duration:t,complete:n}):this}},animation:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var c=s.style();t=He({},t,n);var v=Object.keys(t).length===0;if(v)return new fm(o[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(l&&(t.style=c.getPropsList(t.style||t.css),t.css=void 0),l&&t.renderedPosition!=null){var h=t.renderedPosition,g=s.pan(),p=s.zoom();t.position=d2(h,p,g)}if(u&&t.panBy!=null){var E=t.panBy,m=s.pan();t.pan={x:m.x+E.x,y:m.y+E.y}}var b=t.center||t.centre;if(u&&b!=null){var w=s.getCenterPan(b.eles,t.zoom);w!=null&&(t.pan=w)}if(u&&t.fit!=null){var x=t.fit,_=s.getFitViewport(x.eles||x.boundingBox,x.padding);_!=null&&(t.pan=_.pan,t.zoom=_.zoom)}if(u&&pr(t.zoom)){var C=s.getZoomedViewport(t.zoom);C!=null?(C.zoomed&&(t.zoom=C.zoom),C.panned&&(t.pan=C.pan)):t.zoom=null}return new fm(o[0],t)}},animate:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;n&&(t=He({},t,n));for(var u=0;u<o.length;u++){var l=o[u],c=l.animated()&&(t.queue===void 0||t.queue),v=l.animation(t,c?{queue:!0}:void 0);v.play()}return this}},stop:function(){return function(t,n){var a=this,i=a.length!==void 0,o=i?a:[a],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],c=l._private,v=c.animation.current,h=0;h<v.length;h++){var g=v[h],p=g._private;n&&(p.duration=0)}t&&(c.animation.queue=[]),n||(c.animation.current=[])}return s.notify("draw"),this}}},Ac,bw;function ll(){if(bw)return Ac;bw=1;var r=Array.isArray;return Ac=r,Ac}var Pc,ww;function OF(){if(ww)return Pc;ww=1;var r=ll(),e=ds(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:n.test(i)||!t.test(i)||o!=null&&i in Object(o)}return Pc=a,Pc}var Dc,xw;function MF(){if(xw)return Dc;xw=1;var r=n2(),e=cs(),t="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=r(s);return u==n||u==a||u==t||u==i}return Dc=o,Dc}var Ic,Ew;function kF(){if(Ew)return Ic;Ew=1;var r=il(),e=r["__core-js_shared__"];return Ic=e,Ic}var Bc,_w;function LF(){if(_w)return Bc;_w=1;var r=kF(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return Bc=t,Bc}var Oc,Cw;function qF(){if(Cw)return Oc;Cw=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Oc=t,Oc}var Mc,Sw;function NF(){if(Sw)return Mc;Sw=1;var r=MF(),e=LF(),t=cs(),n=qF(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(h){if(!t(h)||e(h))return!1;var g=r(h)?c:i;return g.test(n(h))}return Mc=v,Mc}var kc,Tw;function FF(){if(Tw)return kc;Tw=1;function r(e,t){return e==null?void 0:e[t]}return kc=r,kc}var Lc,Rw;function Lm(){if(Rw)return Lc;Rw=1;var r=NF(),e=FF();function t(n,a){var i=e(n,a);return r(i)?i:void 0}return Lc=t,Lc}var qc,Aw;function fl(){if(Aw)return qc;Aw=1;var r=Lm(),e=r(Object,"create");return qc=e,qc}var Nc,Pw;function zF(){if(Pw)return Nc;Pw=1;var r=fl();function e(){this.__data__=r?r(null):{},this.size=0}return Nc=e,Nc}var Fc,Dw;function $F(){if(Dw)return Fc;Dw=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return Fc=r,Fc}var zc,Iw;function VF(){if(Iw)return zc;Iw=1;var r=fl(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function a(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return n.call(o,i)?o[i]:void 0}return zc=a,zc}var $c,Bw;function GF(){if(Bw)return $c;Bw=1;var r=fl(),e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:t.call(i,a)}return $c=n,$c}var Vc,Ow;function WF(){if(Ow)return Vc;Ow=1;var r=fl(),e="__lodash_hash_undefined__";function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&a===void 0?e:a,this}return Vc=t,Vc}var Gc,Mw;function UF(){if(Mw)return Gc;Mw=1;var r=zF(),e=$F(),t=VF(),n=GF(),a=WF();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Gc=i,Gc}var Wc,kw;function HF(){if(kw)return Wc;kw=1;function r(){this.__data__=[],this.size=0}return Wc=r,Wc}var Uc,Lw;function A2(){if(Lw)return Uc;Lw=1;function r(e,t){return e===t||e!==e&&t!==t}return Uc=r,Uc}var Hc,qw;function cl(){if(qw)return Hc;qw=1;var r=A2();function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}return Hc=e,Hc}var Kc,Nw;function KF(){if(Nw)return Kc;Nw=1;var r=cl(),e=Array.prototype,t=e.splice;function n(a){var i=this.__data__,o=r(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return Kc=n,Kc}var jc,Fw;function jF(){if(Fw)return jc;Fw=1;var r=cl();function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}return jc=e,jc}var Yc,zw;function YF(){if(zw)return Yc;zw=1;var r=cl();function e(t){return r(this.__data__,t)>-1}return Yc=e,Yc}var Zc,$w;function ZF(){if($w)return Zc;$w=1;var r=cl();function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}return Zc=e,Zc}var Xc,Vw;function XF(){if(Vw)return Xc;Vw=1;var r=HF(),e=KF(),t=jF(),n=YF(),a=ZF();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Xc=i,Xc}var Qc,Gw;function QF(){if(Gw)return Qc;Gw=1;var r=Lm(),e=il(),t=r(e,"Map");return Qc=t,Qc}var Jc,Ww;function JF(){if(Ww)return Jc;Ww=1;var r=UF(),e=XF(),t=QF();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Jc=n,Jc}var ed,Uw;function ez(){if(Uw)return ed;Uw=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return ed=r,ed}var rd,Hw;function dl(){if(Hw)return rd;Hw=1;var r=ez();function e(t,n){var a=t.__data__;return r(n)?a[typeof n=="string"?"string":"hash"]:a.map}return rd=e,rd}var td,Kw;function rz(){if(Kw)return td;Kw=1;var r=dl();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return td=e,td}var nd,jw;function tz(){if(jw)return nd;jw=1;var r=dl();function e(t){return r(this,t).get(t)}return nd=e,nd}var ad,Yw;function nz(){if(Yw)return ad;Yw=1;var r=dl();function e(t){return r(this,t).has(t)}return ad=e,ad}var id,Zw;function az(){if(Zw)return id;Zw=1;var r=dl();function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}return id=e,id}var od,Xw;function iz(){if(Xw)return od;Xw=1;var r=JF(),e=rz(),t=tz(),n=nz(),a=az();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,od=i,od}var sd,Qw;function oz(){if(Qw)return sd;Qw=1;var r=iz(),e="Expected a function";function t(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,sd=t,sd}var ud,Jw;function sz(){if(Jw)return ud;Jw=1;var r=oz(),e=500;function t(n){var a=r(n,function(o){return i.size===e&&i.clear(),o}),i=a.cache;return a}return ud=t,ud}var ld,ex;function P2(){if(ex)return ld;ex=1;var r=sz(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(o,s,u,l){i.push(u?l.replace(t,"$1"):s||o)}),i});return ld=n,ld}var fd,rx;function D2(){if(rx)return fd;rx=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}return fd=r,fd}var cd,tx;function uz(){if(tx)return cd;tx=1;var r=Rm(),e=D2(),t=ll(),n=ds(),a=r?r.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(n(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return cd=o,cd}var dd,nx;function I2(){if(nx)return dd;nx=1;var r=uz();function e(t){return t==null?"":r(t)}return dd=e,dd}var vd,ax;function B2(){if(ax)return vd;ax=1;var r=ll(),e=OF(),t=P2(),n=I2();function a(i,o){return r(i)?i:e(i,o)?[i]:t(n(i))}return vd=a,vd}var hd,ix;function qm(){if(ix)return hd;ix=1;var r=ds();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return hd=e,hd}var gd,ox;function lz(){if(ox)return gd;ox=1;var r=B2(),e=qm();function t(n,a){a=r(a,n);for(var i=0,o=a.length;n!=null&&i<o;)n=n[e(a[i++])];return i&&i==o?n:void 0}return gd=t,gd}var pd,sx;function fz(){if(sx)return pd;sx=1;var r=lz();function e(t,n,a){var i=t==null?void 0:r(t,n);return i===void 0?a:i}return pd=e,pd}var cz=fz(),dz=fs(cz),yd,ux;function vz(){if(ux)return yd;ux=1;var r=Lm(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return yd=e,yd}var md,lx;function hz(){if(lx)return md;lx=1;var r=vz();function e(t,n,a){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}return md=e,md}var bd,fx;function gz(){if(fx)return bd;fx=1;var r=hz(),e=A2(),t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s){var u=i[o];(!(n.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&r(i,o,s)}return bd=a,bd}var wd,cx;function pz(){if(cx)return wd;cx=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,a){var i=typeof n;return a=a??r,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return wd=t,wd}var xd,dx;function yz(){if(dx)return xd;dx=1;var r=gz(),e=B2(),t=pz(),n=cs(),a=qm();function i(o,s,u,l){if(!n(o))return o;s=e(s,o);for(var c=-1,v=s.length,h=v-1,g=o;g!=null&&++c<v;){var p=a(s[c]),E=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(c!=h){var m=g[p];E=l?l(m,p,g):void 0,E===void 0&&(E=n(m)?m:t(s[c+1])?[]:{})}r(g,p,E),g=g[p]}return o}return xd=i,xd}var Ed,vx;function mz(){if(vx)return Ed;vx=1;var r=yz();function e(t,n,a){return t==null?t:r(t,n,a)}return Ed=e,Ed}var bz=mz(),wz=fs(bz),_d,hx;function xz(){if(hx)return _d;hx=1;function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}return _d=r,_d}var Cd,gx;function Ez(){if(gx)return Cd;gx=1;var r=D2(),e=xz(),t=ll(),n=ds(),a=P2(),i=qm(),o=I2();function s(u){return t(u)?r(u,i):n(u)?[u]:e(a(o(u)))}return Cd=s,Cd}var _z=Ez(),Cz=fs(_z),Sz={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=He({},t,e),function(a,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],c=u?s[0]:s;if(Ge(a)){var v=a.indexOf(".")!==-1,h=v&&Cz(a);if(o.allowGetting&&i===void 0){var g;return c&&(o.beforeGet(c),h&&c._private[o.field][a]===void 0?g=dz(c._private[o.field],h):g=c._private[o.field][a]),g}else if(o.allowSetting&&i!==void 0){var p=!o.immutableKeys[a];if(p){var E=KR({},a,i);o.beforeSet(s,E);for(var m=0,b=l.length;m<b;m++){var w=l[m];o.canSet(w)&&(h&&c._private[o.field][a]===void 0?wz(w._private[o.field],h,i):w._private[o.field][a]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&pr(a)){var x=a,_,C,R=Object.keys(x);o.beforeSet(s,x);for(var S=0;S<R.length;S++){_=R[S],C=x[_];var A=!o.immutableKeys[_];if(A)for(var P=0;P<l.length;P++){var I=l[P];o.canSet(I)&&(I._private[o.field][_]=C)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Nr(a)){var D=a;s.on(o.bindingEvent,D)}else if(o.allowGetting&&a===void 0){var M;return c&&(o.beforeGet(c),M=c._private[o.field]),M}return s}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=He({},t,e),function(a){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(Ge(a)){for(var l=a.split(/\s+/),c=l.length,v=0;v<c;v++){var h=l[v];if(!xa(h)){var g=!i.immutableKeys[h];if(g)for(var p=0,E=u.length;p<E;p++)u[p]._private[i.field][h]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(a===void 0){for(var m=0,b=u.length;m<b;m++)for(var w=u[m]._private[i.field],x=Object.keys(w),_=0;_<x.length;_++){var C=x[_],R=!i.immutableKeys[C];R&&(w[C]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Tz={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,a){var i=this,o=Array.prototype.slice.call(arguments,0);return new to(function(s,u){var l=function(g){i.off.apply(i,v),s(g)},c=o.concat([l]),v=c.concat([]);i.on.apply(i,c)})}}},xr={};[BF,Sz,Tz].forEach(function(r){He(xr,r)});var Rz={animate:xr.animate(),animation:xr.animation(),animated:xr.animated(),clearQueue:xr.clearQueue(),delay:xr.delay(),delayAnimation:xr.delayAnimation(),stop:xr.stop()},Iu={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(p){return n.push(p)}),n}else Sr(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new ro(e),o=0;o<t.length;o++){for(var s=t[o],u=s._private,l=u.classes,c=!1,v=0;v<e.length;v++){var h=e[v],g=l.has(h);if(!g){c=!0;break}}c||(c=l.size!==e.length),c&&(u.classes=i,a.push(s))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Sr(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=t===void 0,i=[],o=0,s=n.length;o<s;o++)for(var u=n[o],l=u._private.classes,c=!1,v=0;v<e.length;v++){var h=e[v],g=l.has(h),p=!1;t||a&&!g?(l.add(h),p=!0):(!t||a&&g)&&(l.delete(h),p=!0),!c&&p&&(i.push(u),c=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Iu.className=Iu.classNames=Iu.classes;var hr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Jr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};hr.variable="(?:[\\w-.]|(?:\\\\"+hr.metaChar+"))+";hr.className="(?:[\\w-]|(?:\\\\"+hr.metaChar+"))+";hr.value=hr.string+"|"+hr.number;hr.id=hr.variable;(function(){var r,e,t;for(r=hr.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],hr.comparatorOp+="|@"+e;for(r=hr.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(hr.comparatorOp+="|\\!"+e)})();var _r=function(){return{checks:[]}},Ne={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},cm=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return Sq(r.selector,e.selector)}),Az=(function(){for(var r={},e,t=0;t<cm.length;t++)e=cm[t],r[e.selector]=e.matches;return r})(),Pz=function(e,t){return Az[e](t)},Dz="("+cm.map(function(r){return r.selector}).join("|")+")",Mi=function(e){return e.replace(new RegExp("\\\\("+hr.metaChar+")","g"),function(t,n){return n})},va=function(e,t,n){e[e.length-1]=n},dm=[{name:"group",query:!0,regex:"("+hr.group+")",populate:function(e,t,n){var a=Kr(n,1),i=a[0];t.checks.push({type:Ne.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Dz,populate:function(e,t,n){var a=Kr(n,1),i=a[0];t.checks.push({type:Ne.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+hr.id+")",populate:function(e,t,n){var a=Kr(n,1),i=a[0];t.checks.push({type:Ne.ID,value:Mi(i)})}},{name:"className",query:!0,regex:"\\.("+hr.className+")",populate:function(e,t,n){var a=Kr(n,1),i=a[0];t.checks.push({type:Ne.CLASS,value:Mi(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+hr.variable+")\\s*\\]",populate:function(e,t,n){var a=Kr(n,1),i=a[0];t.checks.push({type:Ne.DATA_EXIST,field:Mi(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+hr.variable+")\\s*("+hr.comparatorOp+")\\s*("+hr.value+")\\s*\\]",populate:function(e,t,n){var a=Kr(n,3),i=a[0],o=a[1],s=a[2],u=new RegExp("^"+hr.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),t.checks.push({type:Ne.DATA_COMPARE,field:Mi(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+hr.boolOp+")\\s*("+hr.variable+")\\s*\\]",populate:function(e,t,n){var a=Kr(n,2),i=a[0],o=a[1];t.checks.push({type:Ne.DATA_BOOL,field:Mi(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+hr.meta+")\\s*("+hr.comparatorOp+")\\s*("+hr.number+")\\s*\\]\\]",populate:function(e,t,n){var a=Kr(n,3),i=a[0],o=a[1],s=a[2];t.checks.push({type:Ne.META_COMPARE,field:Mi(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:hr.separator,populate:function(e,t){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=a,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=_r();return s}},{name:"directedEdge",separator:!0,regex:hr.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=t,i=_r();return n.checks.push({type:Ne.DIRECTED_EDGE,source:a,target:i}),va(e,t,n),e.edgeCount++,i}else{var o=_r(),s=t,u=_r();return o.checks.push({type:Ne.NODE_SOURCE,source:s,target:u}),va(e,t,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:hr.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=t,i=_r();return n.checks.push({type:Ne.UNDIRECTED_EDGE,nodes:[a,i]}),va(e,t,n),e.edgeCount++,i}else{var o=_r(),s=t,u=_r();return o.checks.push({type:Ne.NODE_NEIGHBOR,node:s,neighbor:u}),va(e,t,o),u}}},{name:"child",separator:!0,regex:hr.child,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=_r(),i=e[e.length-1];return n.checks.push({type:Ne.CHILD,parent:i,child:a}),va(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=_r(),s=e[e.length-1],u=_r(),l=_r(),c=_r(),v=_r();return o.checks.push({type:Ne.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:Ne.TRUE}],v.checks.push({type:Ne.TRUE}),u.checks.push({type:Ne.PARENT,parent:v,child:c}),va(e,s,o),e.currentSubject=l,e.compoundCount++,c}else{var h=_r(),g=_r(),p=[{type:Ne.PARENT,parent:h,child:g}];return h.checks=t.checks,t.checks=p,e.compoundCount++,g}}},{name:"descendant",separator:!0,regex:hr.descendant,populate:function(e,t){if(e.currentSubject==null){var n=_r(),a=_r(),i=e[e.length-1];return n.checks.push({type:Ne.DESCENDANT,ancestor:i,descendant:a}),va(e,t,n),e.compoundCount++,a}else if(e.currentSubject===t){var o=_r(),s=e[e.length-1],u=_r(),l=_r(),c=_r(),v=_r();return o.checks.push({type:Ne.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:Ne.TRUE}],v.checks.push({type:Ne.TRUE}),u.checks.push({type:Ne.ANCESTOR,ancestor:v,descendant:c}),va(e,s,o),e.currentSubject=l,e.compoundCount++,c}else{var h=_r(),g=_r(),p=[{type:Ne.ANCESTOR,ancestor:h,descendant:g}];return h.checks=t.checks,t.checks=p,e.compoundCount++,g}}},{name:"subject",modifier:!0,regex:hr.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Er("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],a=n.checks[0],i=a==null?null:a.type;i===Ne.DIRECTED_EDGE?a.type=Ne.NODE_TARGET:i===Ne.UNDIRECTED_EDGE&&(a.type=Ne.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];dm.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var Iz=function(e){for(var t,n,a,i=0;i<dm.length;i++){var o=dm[i],s=o.name,u=e.match(o.regexObj);if(u!=null){n=u,t=o,a=s;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:a,remaining:e}},Bz=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Oz=function(e){var t=this,n=t.inputText=e,a=t[0]=_r();for(t.length=1,n=Bz(n);;){var i=Iz(n);if(i.expr==null)return Er("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(t,a,o);if(s===!1)return!1;if(s!=null&&(a=s),n=i.remaining,n.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var c=t[l];if(c.compoundCount>0&&c.edgeCount>0)return Er("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Er("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&Er("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Mz=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},t=function(c){return Ge(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},a=function(c,v){var h=c.type,g=c.value;switch(h){case Ne.GROUP:{var p=e(g);return p.substring(0,p.length-1)}case Ne.DATA_COMPARE:{var E=c.field,m=c.operator;return"["+E+n(e(m))+t(g)+"]"}case Ne.DATA_BOOL:{var b=c.operator,w=c.field;return"["+e(b)+w+"]"}case Ne.DATA_EXIST:{var x=c.field;return"["+x+"]"}case Ne.META_COMPARE:{var _=c.operator,C=c.field;return"[["+C+n(e(_))+t(g)+"]]"}case Ne.STATE:return g;case Ne.ID:return"#"+g;case Ne.CLASS:return"."+g;case Ne.PARENT:case Ne.CHILD:return i(c.parent,v)+n(">")+i(c.child,v);case Ne.ANCESTOR:case Ne.DESCENDANT:return i(c.ancestor,v)+" "+i(c.descendant,v);case Ne.COMPOUND_SPLIT:{var R=i(c.left,v),S=i(c.subject,v),A=i(c.right,v);return R+(R.length>0?" ":"")+S+A}case Ne.TRUE:return""}},i=function(c,v){return c.checks.reduce(function(h,g,p){return h+(v===c&&p===0?"$":"")+a(g,v)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},kz={parse:Oz,toString:Mz},O2=function(e,t,n){var a,i=Ge(e),o=De(e),s=Ge(n),u,l,c=!1,v=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),v=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(i||s||c)&&(u=!i&&!o?"":""+e,l=""+n),c&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":a=u.indexOf(l)>=0;break;case"$=":a=u.indexOf(l,u.length-l.length)>=0;break;case"^=":a=u.indexOf(l)===0;break;case"=":a=e===n;break;case">":h=!0,a=e>n;break;case">=":h=!0,a=e>=n;break;case"<":h=!0,a=e<n;break;case"<=":h=!0,a=e<=n;break;default:a=!1;break}return v&&(e!=null||!h)&&(a=!a),a},Lz=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},qz=function(e){return e!==void 0},Nm=function(e,t){return e.data(t)},Nz=function(e,t){return e[t]()},$r=[],Dr=function(e,t){return e.checks.every(function(n){return $r[n.type](n,t)})};$r[Ne.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};$r[Ne.STATE]=function(r,e){var t=r.value;return Pz(t,e)};$r[Ne.ID]=function(r,e){var t=r.value;return e.id()===t};$r[Ne.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};$r[Ne.META_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return O2(Nz(e,t),n,a)};$r[Ne.DATA_COMPARE]=function(r,e){var t=r.field,n=r.operator,a=r.value;return O2(Nm(e,t),n,a)};$r[Ne.DATA_BOOL]=function(r,e){var t=r.field,n=r.operator;return Lz(Nm(e,t),n)};$r[Ne.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,qz(Nm(e,t))};$r[Ne.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],n=r.nodes[1],a=e.source(),i=e.target();return Dr(t,a)&&Dr(n,i)||Dr(n,a)&&Dr(t,i)};$r[Ne.NODE_NEIGHBOR]=function(r,e){return Dr(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&Dr(r.neighbor,t)})};$r[Ne.DIRECTED_EDGE]=function(r,e){return Dr(r.source,e.source())&&Dr(r.target,e.target())};$r[Ne.NODE_SOURCE]=function(r,e){return Dr(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&Dr(r.target,t)})};$r[Ne.NODE_TARGET]=function(r,e){return Dr(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&Dr(r.source,t)})};$r[Ne.CHILD]=function(r,e){return Dr(r.child,e)&&Dr(r.parent,e.parent())};$r[Ne.PARENT]=function(r,e){return Dr(r.parent,e)&&e.children().some(function(t){return Dr(r.child,t)})};$r[Ne.DESCENDANT]=function(r,e){return Dr(r.descendant,e)&&e.ancestors().some(function(t){return Dr(r.ancestor,t)})};$r[Ne.ANCESTOR]=function(r,e){return Dr(r.ancestor,e)&&e.descendants().some(function(t){return Dr(r.descendant,t)})};$r[Ne.COMPOUND_SPLIT]=function(r,e){return Dr(r.subject,e)&&Dr(r.left,e)&&Dr(r.right,e)};$r[Ne.TRUE]=function(){return!0};$r[Ne.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};$r[Ne.FILTER]=function(r,e){var t=r.value;return t(e)};var Fz=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===Ne.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(i){for(var o=0;o<t.length;o++){var s=t[o];if(Dr(s,i))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},zz=function(e){for(var t=this,n=0;n<t.length;n++){var a=t[n];if(Dr(a,e))return!0}return!1},$z={matches:zz,filter:Fz},Ca=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Ge(e)&&e.match(/^\s*$/)||(jt(e)?this.addQuery({checks:[{type:Ne.COLLECTION,value:e.collection()}]}):Nr(e)?this.addQuery({checks:[{type:Ne.FILTER,value:e}]}):Ge(e)?this.parse(e)||(this.invalid=!0):Mr("A selector must be created from a string; found "))},Sa=Ca.prototype;[kz,$z].forEach(function(r){return He(Sa,r)});Sa.text=function(){return this.inputText};Sa.size=function(){return this.length};Sa.eq=function(r){return this[r]};Sa.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};Sa.addQuery=function(r){this[this.length++]=r};Sa.selector=Sa.toString;var ba={allAre:function(e){var t=new Ca(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new Ca(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(a)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var a=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};ba.allAreNeighbours=ba.allAreNeighbors;ba.has=ba.contains;ba.equal=ba.equals=ba.same;var un=function(e,t){return function(a,i,o,s){var u=a,l=this,c;if(u==null?c="":jt(u)&&u.length===1&&(c=u.id()),l.length===1&&c){var v=l[0]._private,h=v.traversalCache=v.traversalCache||{},g=h[t]=h[t]||[],p=ti(c),E=g[p];return E||(g[p]=e.call(l,a,i,o,s))}else return e.call(l,a,i,o,s)}},eo={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var i=this[a],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++){var i=n[a];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var a=this[n],i=a.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:un(function(r){for(var e=[],t=0;t<this.length;t++)for(var n=this[t],a=n._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(a){for(var i=0;i<a.length;i++){var o=a[i];t.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function Fm(r,e,t,n){for(var a=[],i=new ro,o=r.cy(),s=o.hasCompoundNodes(),u=0;u<r.length;u++){var l=r[u];t?a.push(l):s&&n(a,i,l)}for(;a.length>0;){var c=a.shift();e(c),i.add(c.id()),s&&n(a,i,c)}return r}function M2(r,e,t){if(t.isParent())for(var n=t._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||r.push(i)}}eo.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Fm(this,r,e,M2)};function k2(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}eo.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Fm(this,r,e,k2)};function Vz(r,e,t){k2(r,e,t),M2(r,e,t)}eo.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Fm(this,r,e,Vz)};eo.ancestors=eo.parents;var es,L2;es=L2={data:xr.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:xr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:xr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:xr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:xr.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:xr.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};es.attr=es.data;es.removeAttr=es.removeData;var Gz=L2,vl={};function Sd(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var n=0,a=t[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(n+=r(a,s))}return n}else return}}He(vl,{degree:Sd(function(r,e){return e.source().same(e.target())?2:1}),indegree:Sd(function(r,e){return e.target().same(r)?1:0}),outdegree:Sd(function(r,e){return e.source().same(r)?1:0})});function ki(r,e){return function(t){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],s=o[r](t);s!==void 0&&(n===void 0||e(s,n))&&(n=s)}return n}}He(vl,{minDegree:ki("degree",function(r,e){return r<e}),maxDegree:ki("degree",function(r,e){return r>e}),minIndegree:ki("indegree",function(r,e){return r<e}),maxIndegree:ki("indegree",function(r,e){return r>e}),minOutdegree:ki("outdegree",function(r,e){return r<e}),maxOutdegree:ki("outdegree",function(r,e){return r>e})});He(vl,{totalDegree:function(e){for(var t=0,n=this.nodes(),a=0;a<n.length;a++)t+=n[a].degree(e);return t}});var mn,q2,N2=function(e,t,n){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var o=i._private.position,s={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,n),i.dirtyBoundingBoxCache()}}},px={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){N2(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};mn=q2={position:xr.data(px),silentPosition:xr.data(He({},px,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){N2(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(pr(e))t?this.silentPosition(e):this.position(e);else if(Nr(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=n(o,i))&&(t?o.silentPosition(s):o.position(s))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var a;if(pr(e)?(a={x:De(e.x)?e.x:0,y:De(e.y)?e.y:0},n=t):Ge(e)&&De(t)&&(a={x:0,y:0},a[e]=t),a!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+a.x,y:u.y+a.y};n?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return pr(e)?this.shift(e,!0):Ge(e)&&De(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],a=this.cy(),i=a.zoom(),o=a.pan(),s=pr(e)?e:void 0,u=s!==void 0||t!==void 0&&Ge(e);if(n&&n.isNode())if(u)for(var l=0;l<this.length;l++){var c=this[l];t!==void 0?c.position(e,(t-o[e])/i):s!==void 0&&c.position(d2(s,i,o))}else{var v=n.position();return s=sl(v,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,t){var n=this[0],a=this.cy(),i=pr(e)?e:void 0,o=i!==void 0||t!==void 0&&Ge(e),s=a.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],c=s?l.parent():null,v=c&&c.length>0,h=v;v&&(c=c[0]);var g=h?c.position():{x:0,y:0};t!==void 0?l.position(e,t+g[e]):i!==void 0&&l.position({x:i.x+g.x,y:i.y+g.y})}else{var p=n.position(),E=s?n.parent():null,m=E&&E.length>0,b=m;m&&(E=E[0]);var w=b?E.position():{x:0,y:0};return i={x:p.x-w.x,y:p.y-w.y},e===void 0?i:i[e]}else if(!o)return;return this}};mn.modelPosition=mn.point=mn.position;mn.modelPositions=mn.points=mn.positions;mn.renderedPoint=mn.renderedPosition;mn.relativePoint=mn.relativePosition;var Wz=q2,Zi,Ba;Zi=Ba={};Ba.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),n=t.zoom(),a=t.pan(),i=e.x1*n+a.x,o=e.x2*n+a.x,s=e.y1*n+a.y,u=e.y2*n+a.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};Ba.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};Ba.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},v=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),h=s.position;(v.w===0||v.h===0)&&(v={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},v.x1=h.x-v.w/2,v.x2=h.x+v.w/2,v.y1=h.y-v.h/2,v.y2=h.y+v.h/2);function g(P,I,D){var M=0,O=0,N=I+D;return P>0&&N>0&&(M=I/N*P,O=D/N*P),{biasDiff:M,biasComplementDiff:O}}function p(P,I,D,M){if(D.units==="%")switch(M){case"width":return P>0?D.pfValue*P:0;case"height":return I>0?D.pfValue*I:0;case"average":return P>0&&I>0?D.pfValue*(P+I)/2:0;case"min":return P>0&&I>0?P>I?D.pfValue*I:D.pfValue*P:0;case"max":return P>0&&I>0?P>I?D.pfValue*P:D.pfValue*I:0;default:return 0}else return D.units==="px"?D.pfValue:0}var E=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(E=E*100/c.width.val);var m=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(m=m*100/c.width.val);var b=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(b=b*100/c.height.val);var w=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(w=w*100/c.height.val);var x=g(c.width.val-v.w,E,m),_=x.biasDiff,C=x.biasComplementDiff,R=g(c.height.val-v.h,b,w),S=R.biasDiff,A=R.biasComplementDiff;s.autoPadding=p(v.w,v.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(v.w,c.width.val),h.x=(-_+v.x1+v.x2+C)/2,s.autoHeight=Math.max(v.h,c.height.val),h.y=(-S+v.y1+v.y2+A)/2}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||r)&&(t(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var on=function(e){return e===1/0||e===-1/0?0:e},yn=function(e,t,n,a,i){a-t===0||i-n===0||t==null||n==null||a==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ha=function(e,t){return t==null?e:yn(e,t.x1,t.y1,t.x2,t.y2)},Do=function(e,t,n){return qt(e,t,n)},wu=function(e,t,n){if(!t.cy().headless()){var a=t._private,i=a.rstyle,o=i.arrowWidth/2,s=t.pstyle(n+"-arrow-shape").value,u,l;if(s!=="none"){n==="source"?(u=i.srcX,l=i.srcY):n==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var c=a.arrowBounds=a.arrowBounds||{},v=c[n]=c[n]||{};v.x1=u-o,v.y1=l-o,v.x2=u+o,v.y2=l+o,v.w=v.x2-v.x1,v.h=v.y2-v.y1,Pu(v,1),yn(e,v.x1,v.y1,v.x2,v.y2)}}},Td=function(e,t,n){if(!t.cy().headless()){var a;n?a=n+"-":a="";var i=t._private,o=i.rstyle,s=t.pstyle(a+"label").strValue;if(s){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),c=Do(o,"labelWidth",n),v=Do(o,"labelHeight",n),h=Do(o,"labelX",n),g=Do(o,"labelY",n),p=t.pstyle(a+"text-margin-x").pfValue,E=t.pstyle(a+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,x=t.pstyle("text-border-width").pfValue,_=x/2,C=t.pstyle("text-background-padding").pfValue,R=2,S=v,A=c,P=A/2,I=S/2,D,M,O,N;if(m)D=h-P,M=h+P,O=g-I,N=g+I;else{switch(u.value){case"left":D=h-A,M=h;break;case"center":D=h-P,M=h+P;break;case"right":D=h,M=h+A;break}switch(l.value){case"top":O=g-S,N=g;break;case"center":O=g-I,N=g+I;break;case"bottom":O=g,N=g+S;break}}var V=p-Math.max(w,_)-C-R,$=p+Math.max(w,_)+C+R,G=E-Math.max(w,_)-C-R,U=E+Math.max(w,_)+C+R;D+=V,M+=$,O+=G,N+=U;var J=n||"main",W=i.labelBounds,H=W[J]=W[J]||{};H.x1=D,H.y1=O,H.x2=M,H.y2=N,H.w=M-D,H.h=N-O,H.leftPad=V,H.rightPad=$,H.topPad=G,H.botPad=U;var Z=m&&b.strValue==="autorotate",ne=b.pfValue!=null&&b.pfValue!==0;if(Z||ne){var F=Z?Do(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(F),j=Math.sin(F),ee=(D+M)/2,ie=(O+N)/2;if(!m){switch(u.value){case"left":ee=M;break;case"right":ee=D;break}switch(l.value){case"top":ie=N;break;case"bottom":ie=O;break}}var oe=function(ue,Se){return ue=ue-ee,Se=Se-ie,{x:ue*z-Se*j+ee,y:ue*j+Se*z+ie}},Y=oe(D,O),X=oe(D,N),re=oe(M,O),le=oe(M,N);D=Math.min(Y.x,X.x,re.x,le.x),M=Math.max(Y.x,X.x,re.x,le.x),O=Math.min(Y.y,X.y,re.y,le.y),N=Math.max(Y.y,X.y,re.y,le.y)}var he=J+"Rot",be=W[he]=W[he]||{};be.x1=D,be.y1=O,be.x2=M,be.y2=N,be.w=M-D,be.h=N-O,yn(e,D,O,M,N),yn(i.labelBounds.all,D,O,M,N)}return e}},yx=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,a=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,o=a+i;F2(e,t,n,o,"outside",o/2)}},F2=function(e,t,n,a,i,o){if(!(n===0||a<=0||i==="inside")){var s=t.cy(),u=t.pstyle("shape").value,l=s.renderer().nodeShapes[u],c=t.position(),v=c.x,h=c.y,g=t.width(),p=t.height();if(l.hasMiterBounds){i==="center"&&(a/=2);var E=l.miterBounds(v,h,g,p,a);ha(e,E)}else o!=null&&o>0&&Du(e,[o,o,o,o])}},Uz=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,a=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;F2(e,t,n,a,i)}},Hz=function(e,t){var n=e._private.cy,a=n.styleEnabled(),i=n.headless(),o=Dt(),s=e._private,u=e.isNode(),l=e.isEdge(),c,v,h,g,p,E,m=s.rstyle,b=u&&a?e.pstyle("bounds-expansion").pfValue:[0],w=function(fe){return fe.pstyle("display").value!=="none"},x=!a||w(e)&&(!l||w(e.source())&&w(e.target()));if(x){var _=0,C=0;a&&t.includeOverlays&&(_=e.pstyle("overlay-opacity").value,_!==0&&(C=e.pstyle("overlay-padding").value));var R=0,S=0;a&&t.includeUnderlays&&(R=e.pstyle("underlay-opacity").value,R!==0&&(S=e.pstyle("underlay-padding").value));var A=Math.max(C,S),P=0,I=0;if(a&&(P=e.pstyle("width").pfValue,I=P/2),u&&t.includeNodes){var D=e.position();p=D.x,E=D.y;var M=e.outerWidth(),O=M/2,N=e.outerHeight(),V=N/2;c=p-O,v=p+O,h=E-V,g=E+V,yn(o,c,h,v,g),a&&yx(o,e),a&&t.includeOutlines&&!i&&yx(o,e),a&&Uz(o,e)}else if(l&&t.includeEdges)if(a&&!i){var $=e.pstyle("curve-style").strValue;if(c=Math.min(m.srcX,m.midX,m.tgtX),v=Math.max(m.srcX,m.midX,m.tgtX),h=Math.min(m.srcY,m.midY,m.tgtY),g=Math.max(m.srcY,m.midY,m.tgtY),c-=I,v+=I,h-=I,g+=I,yn(o,c,h,v,g),$==="haystack"){var G=m.haystackPts;if(G&&G.length===2){if(c=G[0].x,h=G[0].y,v=G[1].x,g=G[1].y,c>v){var U=c;c=v,v=U}if(h>g){var J=h;h=g,g=J}yn(o,c-I,h-I,v+I,g+I)}}else if($==="bezier"||$==="unbundled-bezier"||ga($,"segments")||ga($,"taxi")){var W;switch($){case"bezier":case"unbundled-bezier":W=m.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":W=m.linePts;break}if(W!=null)for(var H=0;H<W.length;H++){var Z=W[H];c=Z.x-I,v=Z.x+I,h=Z.y-I,g=Z.y+I,yn(o,c,h,v,g)}}}else{var ne=e.source(),F=ne.position(),z=e.target(),j=z.position();if(c=F.x,v=j.x,h=F.y,g=j.y,c>v){var ee=c;c=v,v=ee}if(h>g){var ie=h;h=g,g=ie}c-=I,v+=I,h-=I,g+=I,yn(o,c,h,v,g)}if(a&&t.includeEdges&&l&&(wu(o,e,"mid-source"),wu(o,e,"mid-target"),wu(o,e,"source"),wu(o,e,"target")),a){var oe=e.pstyle("ghost").value==="yes";if(oe){var Y=e.pstyle("ghost-offset-x").pfValue,X=e.pstyle("ghost-offset-y").pfValue;yn(o,o.x1+Y,o.y1+X,o.x2+Y,o.y2+X)}}var re=s.bodyBounds=s.bodyBounds||{};tw(re,o),Du(re,b),Pu(re,1),a&&(c=o.x1,v=o.x2,h=o.y1,g=o.y2,yn(o,c-A,h-A,v+A,g+A));var le=s.overlayBounds=s.overlayBounds||{};tw(le,o),Du(le,b),Pu(le,1);var he=s.labelBounds=s.labelBounds||{};he.all!=null?RN(he.all):he.all=Dt(),a&&t.includeLabels&&(t.includeMainLabels&&Td(o,e,null),l&&(t.includeSourceLabels&&Td(o,e,"source"),t.includeTargetLabels&&Td(o,e,"target")))}return o.x1=on(o.x1),o.y1=on(o.y1),o.x2=on(o.x2),o.y2=on(o.y2),o.w=on(o.x2-o.x1),o.h=on(o.y2-o.y1),o.w>0&&o.h>0&&x&&(Du(o,b),Pu(o,1)),o},z2=function(e){var t=0,n=function(o){return(o?1:0)<<t++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),a+=n(e.includeOverlays),a+=n(e.includeOutlines),a},$2=function(e){var t=function(s){return Math.round(s)};if(e.isEdge()){var n=e.source().position(),a=e.target().position();return Z1([t(n.x),t(n.y),t(a.x),t(a.y)])}else{var i=e.position();return Z1([t(i.x),t(i.y)])}},mx=function(e,t){var n=e._private,a,i=e.isEdge(),o=t==null?bx:z2(t),s=o===bx;if(n.bbCache==null?(a=Hz(e,rs),n.bbCache=a,n.bbCachePosKey=$2(e)):a=n.bbCache,!s){var u=e.isNode();a=Dt(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?ha(a,n.overlayBounds):ha(a,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ha(a,n.labelBounds.all):(t.includeMainLabels&&ha(a,n.labelBounds.mainRot),t.includeSourceLabels&&ha(a,n.labelBounds.sourceRot),t.includeTargetLabels&&ha(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},rs={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},bx=z2(rs),wx=ht(rs);Ba.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,n=Qi(function(c){var v=c._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==$2(c)},function(c){return c.id()});if(t&&this.length===1&&!n(this[0]))r===void 0?r=rs:r=wx(r),e=mx(this[0],r);else{e=Dt(),r=r||rs;var a=wx(r),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),s&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var u=0;u<i.length;u++){var l=i[u];n(l)&&l.dirtyBoundingBoxCache(),ha(e,mx(l,a))}}return e.x1=on(e.x1),e.y1=on(e.y1),e.x2=on(e.x2),e.y2=on(e.y2),e.w=on(e.x2-e.x1),e.h=on(e.y2-e.y1),e};Ba.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};Ba.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),n=t.hasCompoundNodes(),a=t.collection();if(n&&(a=e.filter(function(l){return l.isParent()}),e=e.not(a)),pr(r)){var i=r;r=function(){return i}}var o=function(c,v){return c._private.bbAtOldPos=r(c,v)},s=function(c){return c._private.bbAtOldPos};t.startBatch(),e.forEach(o).silentPositions(r),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var u=TN(this.boundingBox({useCache:!1}));return e.silentPositions(s),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),t.endBatch(),u};Zi.boundingbox=Zi.bb=Zi.boundingBox;Zi.renderedBoundingbox=Zi.renderedBoundingBox;var Kz=Ba,qo,gs;qo=gs={};var V2=function(e){e.uppercaseName=k1(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=k1(e.outerName),qo[e.name]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var s=n.pstyle(e.name);switch(s.strValue){case"label":return n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},qo["outer"+e.uppercaseName]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){var s=n[e.name](),u=n.pstyle("border-position").value,l;u==="center"?l=n.pstyle("border-width").pfValue:u==="outside"?l=2*n.pstyle("border-width").pfValue:l=0;var c=2*n.padding();return s+l+c}else return 1},qo["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var a=n[e.name]();return a*this.cy().zoom()}},qo["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var a=n[e.outerName]();return a*this.cy().zoom()}}};V2({name:"width"});V2({name:"height"});gs.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};gs.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};gs.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var jz=gs,Yz=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},Zz=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return sl(t(e),n.zoom(),n.pan())}},Xz=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),a=n.pan(),i=n.zoom();return t(e).map(function(o){return sl(o,i,a)})}},Qz=function(e){return e.renderer().getControlPoints(e)},Jz=function(e){return e.renderer().getSegmentPoints(e)},e5=function(e){return e.renderer().getSourceEndpoint(e)},r5=function(e){return e.renderer().getTargetEndpoint(e)},t5=function(e){return e.renderer().getEdgeMidpoint(e)},xx={controlPoints:{get:Qz,mult:!0},segmentPoints:{get:Jz,mult:!0},sourceEndpoint:{get:e5},targetEndpoint:{get:r5},midpoint:{get:t5}},n5=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},a5=Object.keys(xx).reduce(function(r,e){var t=xx[e],n=n5(e);return r[e]=function(){return Yz(this,t.get)},t.mult?r[n]=function(){return Xz(this,t.get)}:r[n]=function(){return Zz(this,t.get)},r},{}),i5=He({},Wz,Kz,jz,a5);/*!
|
|
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 G2=function(e,t){this.recycle(e,t)};function Io(){return!1}function xu(){return!0}G2.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Io,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?xu:Io):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=xu;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=xu;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=xu,this.stopPropagation()},isDefaultPrevented:Io,isPropagationStopped:Io,isImmediatePropagationStopped:Io};var W2=/^([^.]+)(\.(?:[^.]+))?$/,o5=".*",U2={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Ex=Object.keys(U2),s5={};function hl(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s5,e=arguments.length>1?arguments[1]:void 0,t=0;t<Ex.length;t++){var n=Ex[t];this[n]=r[n]||U2[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Ta=hl.prototype,H2=function(e,t,n,a,i,o,s){Nr(a)&&(i=a,a=null),s&&(o==null?o=s:o=He({},o,s));for(var u=Sr(n)?n:n.split(/\s+/),l=0;l<u.length;l++){var c=u[l];if(!xa(c)){var v=c.match(W2);if(v){var h=v[1],g=v[2]?v[2]:null,p=t(e,c,h,g,a,i,o);if(p===!1)break}}}},_x=function(e,t){return e.addEventFields(e.context,t),new G2(t.type,t)},u5=function(e,t,n){if(hq(n)){t(e,n);return}else if(pr(n)){t(e,_x(e,n));return}for(var a=Sr(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var o=a[i];if(!xa(o)){var s=o.match(W2);if(s){var u=s[1],l=s[2]?s[2]:null,c=_x(e,{type:u,namespace:l,target:e.context});t(e,c)}}}};Ta.on=Ta.addListener=function(r,e,t,n,a){return H2(this,function(i,o,s,u,l,c,v){Nr(c)&&i.listeners.push({event:o,callback:c,type:s,namespace:u,qualifier:l,conf:v})},r,e,t,n,a),this};Ta.one=function(r,e,t,n){return this.on(r,e,t,n,{one:!0})};Ta.removeListener=Ta.off=function(r,e,t,n){var a=this;this.emitting!==0&&(this.listeners=Zq(this.listeners));for(var i=this.listeners,o=function(l){var c=i[l];H2(a,function(v,h,g,p,E,m){if((c.type===g||r==="*")&&(!p&&c.namespace!==".*"||c.namespace===p)&&(!E||v.qualifierCompare(c.qualifier,E))&&(!m||c.callback===m))return i.splice(l,1),!1},r,e,t,n)},s=i.length-1;s>=0;s--)o(s);return this};Ta.removeAllListeners=function(){return this.removeListener("*")};Ta.emit=Ta.trigger=function(r,e,t){var n=this.listeners,a=n.length;return this.emitting++,Sr(e)||(e=[e]),u5(this,function(i,o){t!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],a=n.length);for(var s=function(){var c=n[u];if(c.type===o.type&&(!c.namespace||c.namespace===o.namespace||c.namespace===o5)&&i.eventMatches(i.context,c,o)){var v=[o];e!=null&&Qq(v,e),i.beforeEmit(i.context,c,o),c.conf&&c.conf.one&&(i.listeners=i.listeners.filter(function(p){return p!==c}));var h=i.callbackContext(i.context,c,o),g=c.callback.apply(h,v);i.afterEmit(i.context,c,o),g===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<a;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},r),this.emitting--,this};var l5={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&ls(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Eu=function(e){return Ge(e)?new Ca(e):e},K2={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new hl(l5,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var a=Eu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n)}return this},removeListener:function(e,t,n){for(var a=Eu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,a,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var a=Eu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,a,n)}return this},once:function(e,t,n){for(var a=Eu(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var a=this[n];a.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};xr.eventAliasesOn(K2);var j2={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var a=this[n];a.isNode()?e.push(a):t.push(a)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(Ge(e)||jt(e))return new Ca(e).filter(this);if(Nr(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){Ge(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var a=this[n],i=e.has(a);i||t.push(a)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Ge(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),a=this,i=e,o=this.length<e.length,s=o?a:i,u=o?i:a,l=0;l<s.length;l++){var c=s[l];u.has(c)&&n.push(c)}return n},xor:function(e){var t=this._private.cy;Ge(e)&&(e=t.$(e));var n=this.spawn(),a=this,i=e,o=function(u,l){for(var c=0;c<u.length;c++){var v=u[c],h=v._private.data.id,g=l.hasElementWithId(h);g||n.push(v)}};return o(a,i),o(i,a),n},diff:function(e){var t=this._private.cy;Ge(e)&&(e=t.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=this,s=e,u=function(c,v,h){for(var g=0;g<c.length;g++){var p=c[g],E=p._private.data.id,m=v.hasElementWithId(E);m?i.merge(p):h.push(p)}};return u(o,s,n),u(s,o,a),{left:n,right:a,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(Ge(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&a.push(o)}return a},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&Ge(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=t.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var c=this.length++;this[c]=s,i.set(u,{ele:s,index:c})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,a=t.map,i=a.get(n);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&Ge(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);n.push(s)}return n},reduce:function(e,t){for(var n=t,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,t){for(var n=-1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u>n&&(n=u,a=s)}return{value:n,ele:a}},min:function(e,t){for(var n=1/0,a,i=this,o=0;o<i.length;o++){var s=i[o],u=t?e.apply(t,[s,o,i]):e(s,o,i);u<n&&(n=u,a=s)}return{value:n,ele:a}}},yr=j2;yr.u=yr["|"]=yr["+"]=yr.union=yr.or=yr.add;yr["\\"]=yr["!"]=yr["-"]=yr.difference=yr.relativeComplement=yr.subtract=yr.not;yr.n=yr["&"]=yr["."]=yr.and=yr.intersection=yr.intersect;yr["^"]=yr["(+)"]=yr["(-)"]=yr.symmetricDifference=yr.symdiff=yr.xor;yr.fnFilter=yr.filterFn=yr.stdFilter=yr.filter;yr.complement=yr.abscomp=yr.absoluteComplement;var f5={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Y2=function(e,t){var n=e.cy(),a=n.hasCompoundNodes();function i(c){var v=c.pstyle("z-compound-depth");return v.value==="auto"?a?c.zDepth():0:v.value==="bottom"?-1:v.value==="top"?Am:0}var o=i(e)-i(t);if(o!==0)return o;function s(c){var v=c.pstyle("z-index-compare");return v.value==="auto"&&c.isNode()?1:0}var u=s(e)-s(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},Yu={forEach:function(e,t){if(Nr(e))for(var n=this.length,a=0;a<n;a++){var i=this[a],o=t?e.apply(t,[i,a,this]):e(i,a,this);if(o===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],a=this.length;t==null&&(t=a),e==null&&(e=0),e<0&&(e=a+e),t<0&&(t=a+t);for(var i=e;i>=0&&i<t&&i<a;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Nr(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Y2)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var a=t.data.parent?e.parents().size():0;return e.isParent()?a:Am-1}else{var i=t.source,o=t.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};Yu.each=Yu.forEach;var c5=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":et(Symbol))!=e&&et(Symbol.iterator)!=e;t&&(Yu[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,o=this.length;return KR({next:function(){return i<o?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};c5();var d5=ht({nodeDimensionsIncludeLabels:!1}),Bu={layoutDimensions:function(e){e=d5(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var a=this.nodes().filter(function(C){return!C.isParent()}),i=this.cy(),o=t.eles,s=function(R){return R.id()},u=Qi(n,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(R,S,A){var P={x:S.x1+S.w/2,y:S.y1+S.h/2},I={x:(A.x-P.x)*R,y:(A.y-P.y)*R};return{x:P.x+I.x,y:P.y+I.y}},c=t.spacingFactor&&t.spacingFactor!==1,v=function(){if(!c)return null;for(var R=Dt(),S=0;S<a.length;S++){var A=a[S],P=u(A,S);v2(R,P.x,P.y)}return R},h=v(),g=Qi(function(C,R){var S=u(C,R);if(c){var A=Math.abs(t.spacingFactor);S=l(A,h,S)}return t.transform!=null&&(S=t.transform(C,S)),S},s);if(t.animate){for(var p=0;p<a.length;p++){var E=a[p],m=g(E,p),b=t.animateFilter==null||t.animateFilter(E,p);if(b){var w=E.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(w)}else E.position(m)}if(t.fit){var x=i.animation({fit:{boundingBox:o.boundingBoxAt(g),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(C){return C.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),to.all(e.animations.map(function(C){return C.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(g),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(He({},e,{eles:this}))}};Bu.createLayout=Bu.makeLayout=Bu.layout;function Z2(r,e,t){var n=t._private,a=n.styleCache=n.styleCache||[],i;return(i=a[r])!=null||(i=a[r]=e(t)),i}function gl(r,e){return r=ti(r),function(n){return Z2(r,e,n)}}function pl(r,e){r=ti(r);var t=function(a){return e.call(a)};return function(){var a=this[0];if(a)return Z2(r,t,a)}}var dt={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),a=t.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(a){t(a),a.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var a=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],a=n.cy();if(a.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,a.style().apply(n));var i=n._private.style[e];return i??(t?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(pr(e)){var o=e;i.applyBypass(this,o,a),this.emitAndNotify("style")}else if(Ge(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,a),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,a=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];a.removeAllBypasses(s,n)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];a.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var a=n._private,i=n.pstyle("opacity").value;if(!t)return i;var o=a.data.parent?n.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function Rd(r,e){var t=r._private,n=t.data.parent?r.parents():null;if(n)for(var a=0;a<n.length;a++){var i=n[a];if(!e(i))return!1}return!0}function zm(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,n=r.parentOk||r.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||Rd(i,n);var u=s.source,l=s.target;return t(u)&&(!o||Rd(u,t))&&(u===l||t(l)&&(!o||Rd(l,t)))}}}var no=gl("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});dt.takesUpSpace=pl("takesUpSpace",zm({ok:no}));var v5=gl("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&no(r)}),h5=gl("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&no(r)});dt.interactive=pl("interactive",zm({ok:v5,parentOk:h5,edgeOkViaNode:no}));dt.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var g5=gl("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&no(r)}),p5=no;dt.visible=pl("visible",zm({ok:g5,edgeOkViaNode:p5}));dt.hidden=function(){var r=this[0];if(r)return!r.visible()};dt.isBundledBezier=pl("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});dt.bypass=dt.css=dt.style;dt.renderedCss=dt.renderedStyle;dt.removeBypass=dt.removeCss=dt.removeStyle;dt.pstyle=dt.parsedStyle;var wa={};function Cx(r){return function(){var e=arguments,t=[];if(e.length===2){var n=e[0],a=e[1];this.on(r.event,n,a)}else if(e.length===1&&Nr(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&Sr(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!r.ableField||u._private[r.ableField],c=u._private[r.field]!=r.value;if(r.overrideAble){var v=r.overrideAble(u);if(v!==void 0&&(l=v,!v))return this}l&&(u._private[r.field]=r.value,c&&t.push(u))}var h=this.spawn(t);h.updateStyle(),h.emit(r.event),o&&h.emit(o)}return this}}function ao(r){wa[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},wa[r.on]=Cx({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),wa[r.off]=Cx({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}ao({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});ao({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});ao({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});ao({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});wa.deselect=wa.unselect;wa.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};ao({field:"active",on:"activate",off:"unactivate"});ao({field:"pannable",on:"panify",off:"unpanify"});wa.inactive=function(){var r=this[0];if(r)return!r._private.active};var xt={},Sx=function(e){return function(n){for(var a=this,i=[],o=0;o<a.length;o++){var s=a[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),c=0;c<l.length;c++){var v=l[c],h=v.source(),g=v.target();if(e.noIncomingEdges&&g===s&&h!==s||e.noOutgoingEdges&&h===s&&g!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(n)}},Tx=function(e){return function(t){for(var n=this,a=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],c=l.source(),v=l.target();e.outgoing&&c===o?(a.push(l),a.push(v)):e.incoming&&v===o&&(a.push(l),a.push(c))}}return this.spawn(a,!0).filter(t)}},Rx=function(e){return function(t){for(var n=this,a=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],c=l.id();i[c]||(i[c]=!0,a.push(l),s=!0)}if(!s)break;n=o}return this.spawn(a,!0).filter(t)}};xt.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};He(xt,{roots:Sx({noIncomingEdges:!0}),leaves:Sx({noOutgoingEdges:!0}),outgoers:un(Tx({outgoing:!0}),"outgoers"),successors:Rx({outgoing:!0}),incomers:un(Tx({incoming:!0}),"incomers"),predecessors:Rx({})});He(xt,{neighborhood:un(function(r){for(var e=[],t=this.nodes(),n=0;n<t.length;n++)for(var a=t[n],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),c=a===u?l:u;c.length>0&&e.push(c[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});xt.neighbourhood=xt.neighborhood;xt.closedNeighbourhood=xt.closedNeighborhood;xt.openNeighbourhood=xt.openNeighborhood;He(xt,{source:un(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:un(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:Ax({attr:"source"}),targets:Ax({attr:"target"})});function Ax(r){return function(t){for(var n=[],a=0;a<this.length;a++){var i=this[a],o=i._private[r.attr];o&&n.push(o)}return this.spawn(n,!0).filter(t)}}He(xt,{edgesWith:un(Px(),"edgesWith"),edgesTo:un(Px({thisIsSrc:!0}),"edgesTo")});function Px(r){return function(t){var n=[],a=this._private.cy,i=r||{};Ge(t)&&(t=a.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,u=0;u<s.length;u++){var l=s[u],c=l._private.data,v=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),h=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target),g=v||h;g&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!v||i.thisIsTgt&&!h)||n.push(l))}return this.spawn(n,!0)}}He(xt,{connectedEdges:un(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:un(function(r){for(var e=[],t=this,n=0;n<t.length;n++){var a=t[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:un(Dx(),"parallelEdges"),codirectedEdges:un(Dx({codirected:!0}),"codirectedEdges")});function Dx(r){var e={codirected:!1};return r=He({},e,r),function(n){for(var a=[],i=this.edges(),o=r,s=0;s<i.length;s++)for(var u=i[s],l=u._private,c=l.source,v=c._private.data.id,h=l.data.target,g=c._private.edges,p=0;p<g.length;p++){var E=g[p],m=E._private.data,b=m.target,w=m.source,x=b===h&&w===v,_=v===b&&h===w;(o.codirected&&x||!o.codirected&&(x||_))&&a.push(E)}return this.spawn(a,!0).filter(n)}}He(xt,{components:function(e){var t=this,n=t.cy(),a=n.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(c,v){a.merge(c),i.unmerge(c),v.merge(c)};if(i.empty())return t.spawn();var u=function(){var c=n.collection();o.push(c);var v=i[0];s(v,c),t.bfs({directed:!1,roots:v,visit:function(g){return s(g,c)}}),c.forEach(function(h){h.connectedEdges().forEach(function(g){t.has(g)&&c.has(g.source())&&c.has(g.target())&&c.merge(g)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});xt.componentsOf=xt.components;var vt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Mr("A collection must have a reference to the core");return}var i=new Kn,o=!1;if(!t)t=[];else if(t.length>0&&pr(t[0])&&!ls(t[0])){o=!0;for(var s=[],u=new ro,l=0,c=t.length;l<c;l++){var v=t[l];v.data==null&&(v.data={});var h=v.data;if(h.id==null)h.id=f2();else if(e.hasElementWithId(h.id)||u.has(h.id))continue;var g=new ol(e,v,!1);s.push(g),u.add(h.id)}t=s}this.length=0;for(var p=0,E=t.length;p<E;p++){var m=t[p][0];if(m!=null){var b=m._private.data.id;(!n||!i.has(b))&&(n&&i.set(b,{index:this.length,ele:m}),this[this.length]=m,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(w){this.lazyMap=w},rebuildMap:function(){for(var x=this.lazyMap=new Kn,_=this.eles,C=0;C<_.length;C++){var R=_[C];x.set(R.id(),{index:C,ele:R})}}},n&&(this._private.map=i),o&&!a&&this.restore()},Ar=ol.prototype=vt.prototype=Object.create(Array.prototype);Ar.instanceString=function(){return"collection"};Ar.spawn=function(r,e){return new vt(this.cy(),r,e)};Ar.spawnSelf=function(){return this.spawn(this)};Ar.cy=function(){return this._private.cy};Ar.renderer=function(){return this._private.cy.renderer()};Ar.element=function(){return this[0]};Ar.collection=function(){return ZR(this)?this:new vt(this._private.cy,[this])};Ar.unique=function(){return new vt(this._private.cy,this,!0)};Ar.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};Ar.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new vt(e)};Ar.$id=Ar.getElementById;Ar.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};Ar.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};Ar.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};Ar.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var n=e._private;if(pr(r)){if(t.startBatch(),r.data){e.data(r.data);var a=n.data;if(e.isEdge()){var i=!1,o={},s=r.data.source,u=r.data.target;s!=null&&s!=a.source&&(o.source=""+s,i=!0),u!=null&&u!=a.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in r.data,c=r.data.parent;l&&(c!=null||a.parent!=null)&&c!=a.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),e=e.move({parent:c}))}}r.position&&e.position(r.position);var v=function(E,m,b){var w=r[E];w!=null&&w!==n[E]&&(w?e[m]():e[b]())};return v("removed","remove","restore"),v("selected","select","unselect"),v("selectable","selectify","unselectify"),v("locked","lock","unlock"),v("grabbable","grabify","ungrabify"),v("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var h={data:Dn(n.data),position:Dn(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};h.classes="";var g=0;return n.classes.forEach(function(p){return h.classes+=g++===0?p:" "+p}),h}}};Ar.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],n=t.json();r.push(n)}return r};Ar.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var n=this[t],a=n.json(),i=new ol(r,a,!1);e.push(i)}return new vt(r,e)};Ar.copy=Ar.clone;Ar.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,n=t.cy(),a=n._private,i=[],o=[],s,u=0,l=t.length;u<l;u++){var c=t[u];e&&!c.removed()||(c.isNode()?i.push(c):o.push(c))}s=i.concat(o);var v,h=function(){s.splice(v,1),v--};for(v=0;v<s.length;v++){var g=s[v],p=g._private,E=p.data;if(g.clearTraversalCache(),!(!e&&!p.removed)){if(E.id===void 0)E.id=f2();else if(De(E.id))E.id=""+E.id;else if(xa(E.id)||!Ge(E.id)){Mr("Can not create element with invalid string ID `"+E.id+"`"),h();continue}else if(n.hasElementWithId(E.id)){Mr("Can not create second element with ID `"+E.id+"`"),h();continue}}var m=E.id;if(g.isNode()){var b=p.position;b.x==null&&(b.x=0),b.y==null&&(b.y=0)}if(g.isEdge()){for(var w=g,x=["source","target"],_=x.length,C=!1,R=0;R<_;R++){var S=x[R],A=E[S];De(A)&&(A=E[S]=""+E[S]),A==null||A===""?(Mr("Can not create edge `"+m+"` with unspecified "+S),C=!0):n.hasElementWithId(A)||(Mr("Can not create edge `"+m+"` with nonexistant "+S+" `"+A+"`"),C=!0)}if(C){h();continue}var P=n.getElementById(E.source),I=n.getElementById(E.target);P.same(I)?P._private.edges.push(w):(P._private.edges.push(w),I._private.edges.push(w)),w._private.source=P,w._private.target=I}p.map=new Kn,p.map.set(m,{ele:g,index:0}),p.removed=!1,e&&n.addToPool(g)}for(var D=0;D<i.length;D++){var M=i[D],O=M._private.data;De(O.parent)&&(O.parent=""+O.parent);var N=O.parent,V=N!=null;if(V||M._private.parent){var $=M._private.parent?n.collection().merge(M._private.parent):n.getElementById(N);if($.empty())O.parent=void 0;else if($[0].removed())Er("Node added with missing parent, reference to parent removed"),O.parent=void 0,M._private.parent=null;else{for(var G=!1,U=$;!U.empty();){if(M.same(U)){G=!0,O.parent=void 0;break}U=U.parent()}G||($[0]._private.children.push(M),M._private.parent=$[0],a.hasCompoundNodes=!0)}}}if(s.length>0){for(var J=s.length===t.length?t:new vt(n,s),W=0;W<J.length;W++){var H=J[W];H.isNode()||(H.parallelEdges().clearTraversalCache(),H.source().clearTraversalCache(),H.target().clearTraversalCache())}var Z;a.hasCompoundNodes?Z=n.collection().merge(J).merge(J.connectedNodes()).merge(J.parent()):Z=J,Z.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?J.emitAndNotify("add"):e&&J.emit("add")}return t};Ar.removed=function(){var r=this[0];return r&&r._private.removed};Ar.inside=function(){var r=this[0];return r&&!r._private.removed};Ar.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,n=[],a={},i=t._private.cy;function o(N){for(var V=N._private.edges,$=0;$<V.length;$++)u(V[$])}function s(N){for(var V=N._private.children,$=0;$<V.length;$++)u(V[$])}function u(N){var V=a[N.id()];e&&N.removed()||V||(a[N.id()]=!0,N.isNode()?(n.push(N),o(N),s(N)):n.unshift(N))}for(var l=0,c=t.length;l<c;l++){var v=t[l];u(v)}function h(N,V){var $=N._private.edges;Ea($,V),N.clearTraversalCache()}function g(N){N.clearTraversalCache()}var p=[];p.ids={};function E(N,V){V=V[0],N=N[0];var $=N._private.children,G=N.id();Ea($,V),V._private.parent=null,p.ids[G]||(p.ids[G]=!0,p.push(N))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var m=0;m<n.length;m++){var b=n[m];if(b.isEdge()){var w=b.source()[0],x=b.target()[0];h(w,b),h(x,b);for(var _=b.parallelEdges(),C=0;C<_.length;C++){var R=_[C];g(R),R.isBundledBezier()&&R.dirtyBoundingBoxCache()}}else{var S=b.parent();S.length!==0&&E(S,b)}e&&(b._private.removed=!0)}var A=i._private.elements;i._private.hasCompoundNodes=!1;for(var P=0;P<A.length;P++){var I=A[P];if(I.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new vt(this.cy(),n);D.size()>0&&(r?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var M=0;M<p.length;M++){var O=p[M];(!e||!O.removed())&&O.updateStyle()}return D};Ar.move=function(r){var e=this._private.cy,t=this,n=!1,a=!1,i=function(p){return p==null?p:""+p};if(r.source!==void 0||r.target!==void 0){var o=i(r.source),s=i(r.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){t.remove(n,a),t.emitAndNotify("moveout");for(var g=0;g<t.length;g++){var p=t[g],E=p._private.data;p.isEdge()&&(u&&(E.source=o),l&&(E.target=s))}t.restore(n,a)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var c=i(r.parent),v=c===null||e.hasElementWithId(c);if(v){var h=c===null?void 0:c;e.batch(function(){var g=t.remove(n,a);g.emitAndNotify("moveout");for(var p=0;p<t.length;p++){var E=t[p],m=E._private.data;E.isNode()&&(m.parent=h)}g.restore(n,a)}),t.emitAndNotify("move")}}return this};[E2,Rz,Iu,ba,eo,Gz,vl,i5,K2,j2,f5,Yu,Bu,dt,wa,xt].forEach(function(r){He(Ar,r)});var y5={add:function(e){var t,n=this;if(jt(e)){var a=e;if(a._private.cy===n)t=a.restore();else{for(var i=[],o=0;o<a.length;o++){var s=a[o];i.push(s.json())}t=new vt(n,i)}}else if(Sr(e)){var u=e;t=new vt(n,u)}else if(pr(e)&&(Sr(e.nodes)||Sr(e.edges))){for(var l=e,c=[],v=["nodes","edges"],h=0,g=v.length;h<g;h++){var p=v[h],E=l[p];if(Sr(E))for(var m=0,b=E.length;m<b;m++){var w=He({group:p},E[m]);c.push(w)}}t=new vt(n,c)}else{var x=e;t=new ol(n,x).collection()}return t},remove:function(e){if(!jt(e)){if(Ge(e)){var t=e;e=this.$(t)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function m5(r,e,t,n){var a=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var v=0;v<4;++v)if(typeof arguments[v]!="number"||isNaN(arguments[v])||!isFinite(arguments[v]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var h=c?new Float32Array(u):new Array(u);function g(I,D){return 1-3*D+3*I}function p(I,D){return 3*D-6*I}function E(I){return 3*I}function m(I,D,M){return((g(D,M)*I+p(D,M))*I+E(D))*I}function b(I,D,M){return 3*g(D,M)*I*I+2*p(D,M)*I+E(D)}function w(I,D){for(var M=0;M<a;++M){var O=b(D,r,t);if(O===0)return D;var N=m(D,r,t)-I;D-=N/O}return D}function x(){for(var I=0;I<u;++I)h[I]=m(I*l,r,t)}function _(I,D,M){var O,N,V=0;do N=D+(M-D)/2,O=m(N,r,t)-I,O>0?M=N:D=N;while(Math.abs(O)>o&&++V<s);return N}function C(I){for(var D=0,M=1,O=u-1;M!==O&&h[M]<=I;++M)D+=l;--M;var N=(I-h[M])/(h[M+1]-h[M]),V=D+N*l,$=b(V,r,t);return $>=i?w(I,V):$===0?V:_(I,D,D+l)}var R=!1;function S(){R=!0,(r!==e||t!==n)&&x()}var A=function(D){return R||S(),r===e&&t===n?D:D===0?0:D===1?1:m(C(D),e,n)};A.getControlPoints=function(){return[{x:r,y:e},{x:t,y:n}]};var P="generateBezier("+[r,e,t,n]+")";return A.toString=function(){return P},A}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var b5=(function(){function r(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var o={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:o.v,dv:r(o)}}function t(n,a){var i={dx:n.v,dv:r(n)},o=e(n,a*.5,i),s=e(n,a*.5,o),u=e(n,a,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),c=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return n.x=n.x+l*a,n.v=n.v+c*a,n}return function n(a,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,c=1/1e4,v=16/1e3,h,g,p;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,s.tension=a,s.friction=i,h=o!==null,h?(l=n(a,i),g=l/o*v):g=v;p=t(p||s,g),u.push(1+p.x),l+=16,Math.abs(p.x)>c&&Math.abs(p.v)>c;);return h?function(E){return u[E*(u.length-1)|0]}:l}})(),Rr=function(e,t,n,a){var i=m5(e,t,n,a);return function(o,s,u){return o+(s-o)*i(u)}},Ou={linear:function(e,t,n){return e+(t-e)*n},ease:Rr(.25,.1,.25,1),"ease-in":Rr(.42,0,1,1),"ease-out":Rr(0,0,.58,1),"ease-in-out":Rr(.42,0,.58,1),"ease-in-sine":Rr(.47,0,.745,.715),"ease-out-sine":Rr(.39,.575,.565,1),"ease-in-out-sine":Rr(.445,.05,.55,.95),"ease-in-quad":Rr(.55,.085,.68,.53),"ease-out-quad":Rr(.25,.46,.45,.94),"ease-in-out-quad":Rr(.455,.03,.515,.955),"ease-in-cubic":Rr(.55,.055,.675,.19),"ease-out-cubic":Rr(.215,.61,.355,1),"ease-in-out-cubic":Rr(.645,.045,.355,1),"ease-in-quart":Rr(.895,.03,.685,.22),"ease-out-quart":Rr(.165,.84,.44,1),"ease-in-out-quart":Rr(.77,0,.175,1),"ease-in-quint":Rr(.755,.05,.855,.06),"ease-out-quint":Rr(.23,1,.32,1),"ease-in-out-quint":Rr(.86,0,.07,1),"ease-in-expo":Rr(.95,.05,.795,.035),"ease-out-expo":Rr(.19,1,.22,1),"ease-in-out-expo":Rr(1,0,0,1),"ease-in-circ":Rr(.6,.04,.98,.335),"ease-out-circ":Rr(.075,.82,.165,1),"ease-in-out-circ":Rr(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Ou.linear;var a=b5(e,t,n);return function(i,o,s){return i+(o-i)*a(s)}},"cubic-bezier":Rr};function Ix(r,e,t,n,a){if(n===1||e===t)return t;var i=a(e,t,n);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function Bx(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Li(r,e,t,n,a){var i=a!=null?a.type:null;t<0?t=0:t>1&&(t=1);var o=Bx(r,a),s=Bx(e,a);if(De(o)&&De(s))return Ix(i,o,s,t,n);if(Sr(o)&&Sr(s)){for(var u=[],l=0;l<s.length;l++){var c=o[l],v=s[l];if(c!=null&&v!=null){var h=Ix(i,c,v,t,n);u.push(h)}else u.push(v)}return u}}function w5(r,e,t,n){var a=!n,i=r._private,o=e._private,s=o.easing,u=o.startTime,l=n?r:r.cy(),c=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=Ou.linear;else{var v;if(Ge(s)){var h=c.parse("transition-timing-function",s);v=h.value}else v=s;var g,p;Ge(v)?(g=v,p=[]):(g=v[1],p=v.slice(2).map(function(J){return+J})),p.length>0?(g==="spring"&&p.push(o.duration),o.easingImpl=Ou[g].apply(null,p)):o.easingImpl=Ou[g]}var E=o.easingImpl,m;if(o.duration===0?m=1:m=(t-u)/o.duration,o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var b=o.startPosition,w=o.position;if(w&&a&&!r.locked()){var x={};Bo(b.x,w.x)&&(x.x=Li(b.x,w.x,m,E)),Bo(b.y,w.y)&&(x.y=Li(b.y,w.y,m,E)),r.position(x)}var _=o.startPan,C=o.pan,R=i.pan,S=C!=null&&n;S&&(Bo(_.x,C.x)&&(R.x=Li(_.x,C.x,m,E)),Bo(_.y,C.y)&&(R.y=Li(_.y,C.y,m,E)),r.emit("pan"));var A=o.startZoom,P=o.zoom,I=P!=null&&n;I&&(Bo(A,P)&&(i.zoom=Qo(i.minZoom,Li(A,P,m,E),i.maxZoom)),r.emit("zoom")),(S||I)&&r.emit("viewport");var D=o.style;if(D&&D.length>0&&a){for(var M=0;M<D.length;M++){var O=D[M],N=O.name,V=O,$=o.startStyle[N],G=c.properties[$.name],U=Li($,V,m,E,G);c.overrideBypass(r,N,U)}r.emit("style")}}return o.progress=m,m}function Bo(r,e){return r==null||e==null?!1:De(r)&&De(e)?!0:!!(r&&e)}function x5(r,e,t,n){var a=e._private;a.started=!0,a.startTime=t-a.progress*a.duration}function Ox(r,e){var t=e._private.aniEles,n=[];function a(c,v){var h=c._private,g=h.animation.current,p=h.animation.queue,E=!1;if(g.length===0){var m=p.shift();m&&g.push(m)}for(var b=function(R){for(var S=R.length-1;S>=0;S--){var A=R[S];A()}R.splice(0,R.length)},w=g.length-1;w>=0;w--){var x=g[w],_=x._private;if(_.stopped){g.splice(w,1),_.hooked=!1,_.playing=!1,_.started=!1,b(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||x5(c,x,r),w5(c,x,r,v),_.applying&&(_.applying=!1),b(_.frames),_.step!=null&&_.step(r),x.completed()&&(g.splice(w,1),_.hooked=!1,_.playing=!1,_.started=!1,b(_.completes)),E=!0)}return!v&&g.length===0&&p.length===0&&n.push(c),E}for(var i=!1,o=0;o<t.length;o++){var s=t[o],u=a(s);i=i||u}var l=a(e,!0);(i||l)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(n),e.emit("step")}var E5={animate:xr.animate(),animation:xr.animation(),animated:xr.animated(),clearQueue:xr.clearQueue(),delay:xr.delay(),delayAnimation:xr.delayAnimation(),stop:xr.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Wu(function(i){Ox(i,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,o){Ox(o,e)},n.beforeRenderPriorities.animations):t()}},_5={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return a!=null?e!==n.target&&ls(n.target)&&a.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},_u=function(e){return Ge(e)?new Ca(e):e},X2={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new hl(_5,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,_u(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,_u(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,_u(t),n),this},once:function(e,t,n){return this.emitter().one(e,_u(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};xr.eventAliasesOn(X2);var vm={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};vm.jpeg=vm.jpg;var Mu={layout:function(e){var t=this;if(e==null){Mr("Layout options must be specified to make a layout");return}if(e.name==null){Mr("A `name` must be specified to make a layout");return}var n=e.name,a=t.extension("layout",n);if(a==null){Mr("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Ge(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new a(He({},e,{cy:t,eles:i}));return o}};Mu.createLayout=Mu.makeLayout=Mu.layout;var C5={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&a.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var a=e.batchNotifications[n];a.empty()?t.notify(n):t.notify(n,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],s=t.getElementById(i);s.data(o)}})}},S5=ht({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]}),hm={renderTo:function(e,t,n,a){var i=this._private.renderer;return i.renderTo(e,t,n,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){Mr("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Er("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var a=S5(e);a.cy=t,t._private.renderer=new n(a),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};hm.invalidateDimensions=hm.resize;var ku={collection:function(e,t){return Ge(e)?this.$(e):jt(e)?e.collection():Sr(e)?(t||(t={}),new vt(this,e,t.unique,t.removed)):new vt(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ku.elements=ku.filter=ku.$;var ot={},Wo="t",T5="f";ot.apply=function(r){for(var e=this,t=e._private,n=t.cy,a=n.collection(),i=0;i<r.length;i++){var o=r[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var c=e.updateStyleHints(o);c&&a.push(o)}}return a};ot.getPropertiesDiff=function(r,e){var t=this,n=t._private.propDiffs=t._private.propDiffs||{},a=r+"-"+e,i=n[a];if(i)return i;for(var o=[],s={},u=0;u<t.length;u++){var l=t[u],c=r[u]===Wo,v=e[u]===Wo,h=c!==v,g=l.mappedProperties.length>0;if(h||v&&g){var p=void 0;h&&g||h?p=l.properties:g&&(p=l.mappedProperties);for(var E=0;E<p.length;E++){for(var m=p[E],b=m.name,w=!1,x=u+1;x<t.length;x++){var _=t[x],C=e[x]===Wo;if(C&&(w=_.properties[m.name]!=null,w))break}!s[b]&&!w&&(s[b]=!0,o.push(b))}}}return n[a]=o,o};ot.getContextMeta=function(r){for(var e=this,t="",n,a=r._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(r);s?t+=Wo:t+=T5}return n=e.getPropertiesDiff(a,t),r._private.styleCxtKey=t,{key:t,diffPropNames:n,empty:n.length===0}};ot.getContextStyle=function(r){var e=r.key,t=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<t.length;i++){var o=t[i],s=e[i]===Wo;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];a[l.name]=l}}return n[e]=a,a};ot.applyContextStyle=function(r,e,t){for(var n=this,a=r.diffPropNames,i={},o=n.types,s=0;s<a.length;s++){var u=a[s],l=e[u],c=t.pstyle(u);if(!l)if(c)c.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(c!==l){if(l.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===l.value){var v=c.mapping,h=v.fnValue=l.value(t);if(h===v.prevFnValue)continue}var g=i[u]={prev:c};n.applyParsedProperty(t,l),g.next=t.pstyle(u),g.next&&g.next.bypass&&(g.next=g.next.bypassed)}}return{diffProps:i}};ot.updateStyleHints=function(r){var e=r._private,t=this,n=t.propertyGroupNames,a=t.propertyGroupKeys,i=function(re,le,he){return t.getPropertiesHash(re,le,he)},o=e.styleKey;if(r.removed())return!1;var s=e.group==="nodes",u=r._private.style;n=Object.keys(u);for(var l=0;l<a.length;l++){var c=a[l];e.styleKeys[c]=[Xa,Vi]}for(var v=function(re,le){return e.styleKeys[le][0]=Yo(re,e.styleKeys[le][0])},h=function(re,le){return e.styleKeys[le][1]=Zo(re,e.styleKeys[le][1])},g=function(re,le){v(re,le),h(re,le)},p=function(re,le){for(var he=0;he<re.length;he++){var be=re.charCodeAt(he);v(be,le),h(be,le)}},E=2e9,m=function(re){return-128<re&&re<128&&Math.floor(re)!==re?E-(re*1024|0):re},b=0;b<n.length;b++){var w=n[b],x=u[w];if(x!=null){var _=this.properties[w],C=_.type,R=_.groupKey,S=void 0;_.hashOverride!=null?S=_.hashOverride(r,x):x.pfValue!=null&&(S=x.pfValue);var A=_.enums==null?x.value:null,P=S!=null,I=A!=null,D=P||I,M=x.units;if(C.number&&D&&!C.multiple){var O=P?S:A;g(m(O),R),!P&&M!=null&&p(M,R)}else p(x.strValue,R)}}for(var N=[Xa,Vi],V=0;V<a.length;V++){var $=a[V],G=e.styleKeys[$];N[0]=Yo(G[0],N[0]),N[1]=Zo(G[1],N[1])}e.styleKey=Vq(N[0],N[1]);var U=e.styleKeys;e.labelDimsKey=da(U.labelDimensions);var J=i(r,["label"],U.labelDimensions);if(e.labelKey=da(J),e.labelStyleKey=da(gu(U.commonLabel,J)),!s){var W=i(r,["source-label"],U.labelDimensions);e.sourceLabelKey=da(W),e.sourceLabelStyleKey=da(gu(U.commonLabel,W));var H=i(r,["target-label"],U.labelDimensions);e.targetLabelKey=da(H),e.targetLabelStyleKey=da(gu(U.commonLabel,H))}if(s){var Z=e.styleKeys,ne=Z.nodeBody,F=Z.nodeBorder,z=Z.nodeOutline,j=Z.backgroundImage,ee=Z.compound,ie=Z.pie,oe=Z.stripe,Y=[ne,F,z,j,ee,ie,oe].filter(function(X){return X!=null}).reduce(gu,[Xa,Vi]);e.nodeKey=da(Y),e.hasPie=ie!=null&&ie[0]!==Xa&&ie[1]!==Vi,e.hasStripe=oe!=null&&oe[0]!==Xa&&oe[1]!==Vi}return o!==e.styleKey};ot.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};ot.applyParsedProperty=function(r,e){var t=this,n=e,a=r._private.style,i,o=t.types,s=t.properties[n.name].type,u=n.bypass,l=a[n.name],c=l&&l.bypass,v=r._private,h="mapping",g=function(ne){return ne==null?null:ne.pfValue!=null?ne.pfValue:ne.value},p=function(){var ne=g(l),F=g(n);t.checkTriggers(r,n.name,ne,F)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(n=e=this.parse(e.name,"bezier",u)),n.delete)return a[n.name]=void 0,p(),!0;if(n.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,p(),!0):!1:(p(),!0);if(n.deleteBypass)return l?l.bypass?(a[n.name]=l.bypassed,p(),!0):!1:(p(),!0);var E=function(){Er("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var m=n.field.split("."),b=v.data,w=0;w<m.length&&b;w++){var x=m[w];b=b[x]}if(b==null)return E(),!1;var _;if(De(b)){var C=n.fieldMax-n.fieldMin;C===0?_=0:_=(b-n.fieldMin)/C}else return Er("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+b+"` for `"+r.id()+"` is non-numeric)"),!1;if(_<0?_=0:_>1&&(_=1),s.color){var R=n.valueMin[0],S=n.valueMax[0],A=n.valueMin[1],P=n.valueMax[1],I=n.valueMin[2],D=n.valueMax[2],M=n.valueMin[3]==null?1:n.valueMin[3],O=n.valueMax[3]==null?1:n.valueMax[3],N=[Math.round(R+(S-R)*_),Math.round(A+(P-A)*_),Math.round(I+(D-I)*_),Math.round(M+(O-M)*_)];i={bypass:n.bypass,name:n.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(s.number){var V=n.valueMin+(n.valueMax-n.valueMin)*_;i=this.parse(n.name,V,n.bypass,h)}else return!1;if(!i)return E(),!1;i.mapping=n,n=i;break}case o.data:{for(var $=n.field.split("."),G=v.data,U=0;U<$.length&&G;U++){var J=$[U];G=G[J]}if(G!=null&&(i=this.parse(n.name,G,n.bypass,h)),!i)return E(),!1;i.mapping=n,n=i;break}case o.fn:{var W=n.value,H=n.fnValue!=null?n.fnValue:W(r);if(n.prevFnValue=H,H==null)return Er("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(n.name,H,n.bypass,h),!i)return Er("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=Dn(n),n=i;break}case void 0:break;default:return!1}return u?(c?n.bypassed=l.bypassed:n.bypassed=l,a[n.name]=n):c?l.bypassed=n:a[n.name]=n,p(),!0};ot.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s];u!=null&&(u.bypass?u.bypassed=null:a[s]=null)}}};ot.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};ot.updateTransitions=function(r,e){var t=this,n=r._private,a=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,o=r.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},u=!1,l=0;l<a.length;l++){var c=a[l],v=r.pstyle(c),h=e[c];if(h){var g=h.prev,p=g,E=h.next!=null?h.next:v,m=!1,b=void 0,w=1e-6;p&&(De(p.pfValue)&&De(E.pfValue)?(m=E.pfValue-p.pfValue,b=p.pfValue+w*m):De(p.value)&&De(E.value)?(m=E.value-p.value,b=p.value+w*m):Sr(p.value)&&Sr(E.value)&&(m=p.value[0]!==E.value[0]||p.value[1]!==E.value[1]||p.value[2]!==E.value[2],b=p.strValue),m&&(s[c]=E.strValue,this.applyBypass(r,c,b),u=!0))}}if(!u)return;n.transitioning=!0,new to(function(x){o>0?r.delayAnimation(o).play().promise().then(x):x()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1)};ot.checkTrigger=function(r,e,t,n,a,i){var o=this.properties[e],s=a(o);r.removed()||s!=null&&s(t,n,r)&&i(o)};ot.checkZOrderTrigger=function(r,e,t,n){var a=this;this.checkTrigger(r,e,t,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",r)})};ot.checkBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBounds},function(a){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};ot.checkConnectedEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfConnectedEdges},function(a){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ot.checkParallelEdgesBoundsTrigger=function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfParallelEdges},function(a){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ot.checkTriggers=function(r,e,t,n){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,n),this.checkBoundsTrigger(r,e,t,n),this.checkConnectedEdgesBoundsTrigger(r,e,t,n),this.checkParallelEdgesBoundsTrigger(r,e,t,n)};var ps={};ps.applyBypass=function(r,e,t,n){var a=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;s<a.properties.length;s++){var u=a.properties[s],l=u.name,c=this.parse(l,t,!0);c&&i.push(c)}}else if(Ge(e)){var v=this.parse(e,t,!0);v&&i.push(v)}else if(pr(e)){var h=e;n=t;for(var g=Object.keys(h),p=0;p<g.length;p++){var E=g[p],m=h[E];if(m===void 0&&(m=h[al(E)]),m!==void 0){var b=this.parse(E,m,!0);b&&i.push(b)}}}else return!1;if(i.length===0)return!1;for(var w=!1,x=0;x<r.length;x++){for(var _=r[x],C={},R=void 0,S=0;S<i.length;S++){var A=i[S];if(n){var P=_.pstyle(A.name);R=C[A.name]={prev:P}}w=this.applyParsedProperty(_,Dn(A))||w,n&&(R.next=_.pstyle(A.name))}w&&this.updateStyleHints(_),n&&this.updateTransitions(_,C,o)}return w};ps.overrideBypass=function(r,e,t){e=Tm(e);for(var n=0;n<r.length;n++){var a=r[n],i=a._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),s?i.strValue="rgb("+t.join(",")+")":u?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(a)),this.checkTriggers(a,e,l,t)}};ps.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};ps.removeBypasses=function(r,e,t){for(var n=!0,a=0;a<r.length;a++){for(var i=r[a],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],c=i.pstyle(l.name);if(!(!c||!c.bypass)){var v="",h=this.parse(u,v,!0),g=o[l.name]={prev:c};this.applyParsedProperty(i,h),g.next=i.pstyle(l.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,o,n)}};var $m={};$m.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};$m.containerCss=function(r){var e=this._private.cy,t=e.container(),n=e.window();if(n&&t&&n.getComputedStyle)return n.getComputedStyle(t).getPropertyValue(r)};var In={};In.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};In.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var n={},a=0;a<t.properties.length;a++){var i=t.properties[a],o=t.getStylePropertyValue(r,i.name,e);o!=null&&(n[i.name]=o,n[al(i.name)]=o)}return n}};In.getIndexedStyle=function(r,e,t,n){var a=r.pstyle(e)[t][n];return a??r.cy().style().getDefaultProperty(e)[t][0]};In.getStylePropertyValue=function(r,e,t){var n=this;if(r=r[0],r){var a=n.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,o=r.pstyle(a.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(t&&i.number&&s!=null&&De(s)){var c=r.cy().zoom(),v=function(m){return m*c},h=function(m,b){return v(m)+b},g=Sr(s),p=g?u.every(function(E){return E!=null}):u!=null;return p?g?s.map(function(E,m){return h(E,u[m])}).join(" "):h(s,u):g?s.map(function(E){return Ge(E)?E:""+v(E)}).join(" "):""+v(s)}else if(l!=null)return l}return null}};In.getAnimationStartStyle=function(r,e){for(var t={},n=0;n<e.length;n++){var a=e[n],i=a.name,o=r.pstyle(i);o!==void 0&&(pr(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(t[i]=o)}return t};In.getPropsList=function(r){var e=this,t=[],n=r,a=e.properties;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s],l=a[s]||a[Tm(s)],c=this.parse(l.name,u);c&&t.push(c)}return t};In.getNonDefaultPropertiesHash=function(r,e,t){var n=t.slice(),a,i,o,s,u,l;for(u=0;u<e.length;u++)if(a=e[u],i=r.pstyle(a,!1),i!=null)if(i.pfValue!=null)n[0]=Yo(s,n[0]),n[1]=Zo(s,n[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),n[0]=Yo(s,n[0]),n[1]=Zo(s,n[1]);return n};In.getPropertiesHash=In.getNonDefaultPropertiesHash;var yl={};yl.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var n=r[t],a=n.selector,i=n.style||n.css,o=Object.keys(i);e.selector(a);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};yl.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};yl.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],n=t.selector,a=t.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}r.push({selector:n?n.toString():"core",style:i})}return r};var Vm={};Vm.appendFromString=function(r){var e=this,t=this,n=""+r,a,i,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){n.length>a.length?n=n.substr(a.length):n=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=n.match(/^\s*$/);if(l)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Er("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=c[0];var v=c[1];if(v!=="core"){var h=new Ca(v);if(h.invalid){Er("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}}var g=c[2],p=!1;i=g;for(var E=[];;){var m=i.match(/^\s*$/);if(m)break;var b=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!b){Er("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+g),p=!0;break}o=b[0];var w=b[1],x=b[2],_=e.properties[w];if(!_){Er("Skipping property: Invalid property name in: "+o),u();continue}var C=t.parse(w,x);if(!C){Er("Skipping property: Invalid property definition in: "+o),u();continue}E.push({name:w,val:x}),u()}if(p){s();break}t.selector(v);for(var R=0;R<E.length;R++){var S=E[R];t.css(S.name,S.val)}s()}return t};Vm.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var Hr={};(function(){var r=Jr,e=wq,t=Eq,n=_q,a=Cq,i=function(X){return"^"+X+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(X){var re=r+"|\\w+|"+e+"|"+t+"|"+n+"|"+a;return"^"+X+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+re+")\\s*\\,\\s*("+re+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Hr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,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(X,re){switch(X.length){case 2:return re[0]!=="deg"&&re[0]!=="rad"&&re[1]!=="deg"&&re[1]!=="rad";case 1:return Ge(X[0])||re[0]==="deg"||re[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(X){var re=X.length;return re===1||re===2||re===4}}};var u={zeroNonZero:function(X,re){return(X==null||re==null)&&X!==re||X==0&&re!=0?!0:X!=0&&re==0},any:function(X,re){return X!=re},emptyNonEmpty:function(X,re){var le=xa(X),he=xa(re);return le&&!he||!le&&he}},l=Hr.types,c=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],v=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],g=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],p=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],E=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],m=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(X,re,le){return X===re?!1:le.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],b=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],w=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],x=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],_=function(X,re){return re.value==="label"?-X.poolIndex():re.pfValue},C=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:_},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:_},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],R=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],S=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],A=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],P=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],I=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(X,re){return X===re?!1:X==="bezier"||re==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],D=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],M=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],O=[];Hr.pieBackgroundN=16,O.push({name:"pie-size",type:l.sizeMaybePercent}),O.push({name:"pie-hole",type:l.sizeMaybePercent}),O.push({name:"pie-start-angle",type:l.angle});for(var N=1;N<=Hr.pieBackgroundN;N++)O.push({name:"pie-"+N+"-background-color",type:l.color}),O.push({name:"pie-"+N+"-background-size",type:l.percent}),O.push({name:"pie-"+N+"-background-opacity",type:l.zeroOneNumber});var V=[];Hr.stripeBackgroundN=16,V.push({name:"stripe-size",type:l.sizeMaybePercent}),V.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var $=1;$<=Hr.stripeBackgroundN;$++)V.push({name:"stripe-"+$+"-background-color",type:l.color}),V.push({name:"stripe-"+$+"-background-size",type:l.percent}),V.push({name:"stripe-"+$+"-background-opacity",type:l.zeroOneNumber});var G=[],U=Hr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(Y){U.forEach(function(X){var re=X+"-"+Y.name,le=Y.type,he=Y.triggersBounds;G.push({name:re,type:le,triggersBounds:he})})},{});var J=Hr.properties=[].concat(E,x,m,b,w,D,p,g,c,v,h,C,R,S,A,O,V,P,I,G,M),W=Hr.propertyGroups={behavior:E,transition:x,visibility:m,overlay:b,underlay:w,ghost:D,commonLabel:p,labelDimensions:g,mainLabel:c,sourceLabel:v,targetLabel:h,nodeBody:C,nodeBorder:R,nodeOutline:S,backgroundImage:A,pie:O,stripe:V,compound:P,edgeLine:I,edgeArrow:G,core:M},H=Hr.propertyGroupNames={},Z=Hr.propertyGroupKeys=Object.keys(W);Z.forEach(function(Y){H[Y]=W[Y].map(function(X){return X.name}),W[Y].forEach(function(X){return X.groupKey=Y})});var ne=Hr.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"}];Hr.propertyNames=J.map(function(Y){return Y.name});for(var F=0;F<J.length;F++){var z=J[F];J[z.name]=z}for(var j=0;j<ne.length;j++){var ee=ne[j],ie=J[ee.pointsTo],oe={name:ee.name,alias:!0,pointsTo:ie};J.push(oe),J[ee.name]=oe}})();Hr.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};Hr.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=He({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","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(u,l){for(var c=1;c<=Hr.pieBackgroundN;c++){var v=l.name.replace("{{i}}",c),h=l.value;u[v]=h}return u},{}),{"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(u,l){for(var c=1;c<=Hr.stripeBackgroundN;c++){var v=l.name.replace("{{i}}",c),h=l.value;u[v]=h}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Hr.arrowPrefixes.forEach(function(c){var v=c+"-"+l.name,h=l.value;u[v]=h}),u},{})),t={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=e[i],s=this.parse(i,o);t[i]=s}}return r.defaultProperties=t,r.defaultProperties};Hr.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 ml={};ml.parse=function(r,e,t,n){var a=this;if(Nr(e))return a.parseImplWarn(r,e,t,n);var i=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=t?"t":"f",s=""+e,u=s2(r,s,o,i),l=a.propCache=a.propCache||[],c;return(c=l[u])||(c=l[u]=a.parseImplWarn(r,e,t,n)),(t||n==="mapping")&&(c=Dn(c),c&&(c.value=Dn(c.value))),c};ml.parseImplWarn=function(r,e,t,n){var a=this.parseImpl(r,e,t,n);return!a&&e!=null&&Er("The style property `".concat(r,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&Er("The style value of `label` is deprecated for `"+a.name+"`"),a};ml.parseImpl=function(r,e,t,n){var a=this;r=Tm(r);var i=a.properties[r],o=e,s=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var u=Ge(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(Nr(e))return{name:r,value:e,strValue:"fn",mapped:s.fn,bypass:t};var c,v;if(!(!u||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(c=new RegExp(s.data.regex).exec(e))){if(t)return!1;var h=s.data;return{name:r,value:c,strValue:""+e,mapped:h,field:c[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(e))){if(t||l.multiple)return!1;var g=s.mapData;if(!(l.color||l.number))return!1;var p=this.parse(r,v[4]);if(!p||p.mapped)return!1;var E=this.parse(r,v[5]);if(!E||E.mapped)return!1;if(p.pfValue===E.pfValue||p.strValue===E.strValue)return Er("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+p.strValue+"`"),this.parse(r,p.strValue);if(l.color){var m=p.value,b=E.value,w=m[0]===b[0]&&m[1]===b[1]&&m[2]===b[2]&&(m[3]===b[3]||(m[3]==null||m[3]===1)&&(b[3]==null||b[3]===1));if(w)return!1}return{name:r,value:v,strValue:""+e,mapped:g,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:p.value,valueMax:E.value,bypass:t}}}if(l.multiple&&n!=="multiple"){var x;if(u?x=e.split(/\s+/):Sr(e)?x=e:x=[e],l.evenMultiple&&x.length%2!==0)return null;for(var _=[],C=[],R=[],S="",A=!1,P=0;P<x.length;P++){var I=a.parse(r,x[P],t,"multiple");A=A||Ge(I.value),_.push(I.value),R.push(I.pfValue!=null?I.pfValue:I.value),C.push(I.units),S+=(P>0?" ":"")+I.strValue}return l.validate&&!l.validate(_,C)?null:l.singleEnum&&A?_.length===1&&Ge(_[0])?{name:r,value:_[0],strValue:_[0],bypass:t}:null:{name:r,value:_,pfValue:R,strValue:S,bypass:t,units:C}}var D=function(){for(var oe=0;oe<l.enums.length;oe++){var Y=l.enums[oe];if(Y===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(l.number){var M,O="px";if(l.units&&(M=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless)if(u){var N="px|em"+(l.allowPercent?"|\\%":"");M&&(N=M);var V=e.match("^("+Jr+")("+N+")?$");V&&(e=V[1],M=V[2]||O)}else(!M||l.implicitUnits)&&(M=O);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,D();if(l.integer&&!vq(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var $={name:r,value:e,strValue:""+e+(M||""),units:M,bypass:t};return l.unitless||M!=="px"&&M!=="em"?$.pfValue=e:$.pfValue=M==="px"||!M?e:this.getEmSizeInPixels()*e,(M==="ms"||M==="s")&&($.pfValue=M==="ms"?e:1e3*e),(M==="deg"||M==="rad")&&($.pfValue=M==="rad"?e:_N(e)),M==="%"&&($.pfValue=e/100),$}else if(l.propList){var G=[],U=""+e;if(U!=="none"){for(var J=U.split(/\s*,\s*|\s+/),W=0;W<J.length;W++){var H=J[W].trim();a.properties[H]?G.push(H):Er("`"+H+"` is not a valid property name")}if(G.length===0)return null}return{name:r,value:G,strValue:G.length===0?"none":G.join(" "),bypass:t}}else if(l.color){var Z=e2(e);return Z?{name:r,value:Z,pfValue:Z,strValue:"rgb("+Z[0]+","+Z[1]+","+Z[2]+")",bypass:t}:null}else if(l.regex||l.regexes){if(l.enums){var ne=D();if(ne)return ne}for(var F=l.regexes?l.regexes:[l.regex],z=0;z<F.length;z++){var j=new RegExp(F[z]),ee=j.exec(e);if(ee)return{name:r,value:l.singleRegexMatchValue?ee[1]:ee,strValue:""+e,bypass:t}}return null}else return l.string?{name:r,value:""+e,strValue:""+e,bypass:t}:l.enums?D():null};var it=function(e){if(!(this instanceof it))return new it(e);if(!Sm(e)){Mr("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Et=it.prototype;Et.instanceString=function(){return"style"};Et.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};Et.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Et.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};Et.selector=function(r){var e=r==="core"?null:new Ca(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};Et.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],n=0;n<r.properties.length;n++){var a=r.properties[n],i=t[a.name];i===void 0&&(i=t[al(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Et.style=Et.css;Et.cssRule=function(r,e){var t=this.parse(r,e);if(t){var n=this.length-1;this[n].properties.push(t),this[n].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[n].mappedProperties.push(t);var a=!this[n].selector;a&&(this._private.coreStyle[t.name]=t)}return this};Et.append=function(r){return XR(r)?r.appendToStyle(this):Sr(r)?this.appendFromJson(r):Ge(r)&&this.appendFromString(r),this};it.fromJson=function(r,e){var t=new it(r);return t.fromJson(e),t};it.fromString=function(r,e){return new it(r).fromString(e)};[ot,ps,$m,In,yl,Vm,Hr,ml].forEach(function(r){He(Et,r)});it.types=Et.types;it.properties=Et.properties;it.propertyGroups=Et.propertyGroups;it.propertyGroupNames=Et.propertyGroupNames;it.propertyGroupKeys=Et.propertyGroupKeys;var R5={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return XR(e)?t.style=e.generateStyle(this):Sr(e)?t.style=it.fromJson(this,e):Ge(e)?t.style=it.fromString(this,e):t.style=it(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},A5="single",ii={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=A5),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,a,i,o,s;switch(e.length){case 0:return t;case 1:if(Ge(e[0]))return n=e[0],t[n];if(pr(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,De(o)&&(t.x=o),De(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],a=e[1],(n==="x"||n==="y")&&De(a)&&(t[n]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,a=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:pr(e)&&(s=n[0],u=s.x,l=s.y,De(u)&&(a.x+=u),De(l)&&(a.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&De(o)&&(a[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(De(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(Ge(e)){var a=e;e=this.$(a)}else if(pq(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else jt(e)||(e=this.mutableElements());if(!(jt(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),s=this.height(),u;if(t=De(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*t)/n.w,(s-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(n.x1+n.x2))/2,y:(s-u*(n.y1+n.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var a=e;e=a.min,t=a.max}return De(e)&&De(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):De(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:De(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,a=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),De(e)?o=e:pr(e)&&(o=e.level,e.position!=null?i=sl(e.position,a,n):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,s||!De(o)||o===a||i!=null&&(!De(i.x)||!De(i.y)))return null;if(i!=null){var u=n,l=a,c=o,v={x:-c/l*(i.x-u.x)+i.x,y:-c/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:c,pan:v}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,a=!0,i=[],o=!1,s=!1;if(!e)return this;if(De(e.zoom)||(n=!1),pr(e.pan)||(a=!1),!n&&!a)return this;if(n){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=u,i.push("zoom"))}if(a&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;De(l.x)&&(t.pan.x=l.x,s=!1),De(l.y)&&(t.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(Ge(e)){var n=e;e=this.mutableElements().filter(n)}else jt(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(a.x1+a.x2))/2,y:(o-t*(a.y1+a.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?(function(){var a=n.window().getComputedStyle(t),i=function(s){return parseFloat(a.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),a={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};ii.centre=ii.center;ii.autolockNodes=ii.autolock;ii.autoungrabifyNodes=ii.autoungrabify;var ts={data:xr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:xr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:xr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:xr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ts.attr=ts.data;ts.removeAttr=ts.removeData;var ns=function(e){var t=this;e=He({},e);var n=e.container;n&&!Gu(n)&&Gu(n[0])&&(n=n[0]);var a=n?n._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=t;var o=Qr!==void 0&&n!==void 0&&!e.headless,s=e;s.layout=He({name:o?"grid":"null"},s.layout),s.renderer=He({name:o?"canvas":"null"},s.renderer);var u=function(p,E,m){return E!==void 0?E:m!==void 0?m:p},l=this._private={container:n,ready:!1,options:s,elements:new vt(this),listeners:[],aniEles:new vt(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:De(s.zoom)?s.zoom:1,pan:{x:pr(s.pan)&&De(s.pan.x)?s.pan.x:0,y:pr(s.pan)&&De(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var c=function(p,E){var m=p.some(yq);if(m)return to.all(p).then(E);E(p)};l.styleEnabled&&t.setStyle([]);var v=He({},s,s.renderer);t.initRenderer(v);var h=function(p,E,m){t.notifications(!1);var b=t.mutableElements();b.length>0&&b.remove(),p!=null&&(pr(p)||Sr(p))&&t.add(p),t.one("layoutready",function(x){t.notifications(!0),t.emit(x),t.one("load",E),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",m),t.emit("done")});var w=He({},t._private.options.layout);w.eles=t.elements(),t.layout(w).run()};c([s.style,s.elements],function(g){var p=g[0],E=g[1];l.styleEnabled&&t.style().append(p),h(E,function(){t.startAnimationLoop(),l.ready=!0,Nr(s.ready)&&t.on("ready",s.ready);for(var m=0;m<i.length;m++){var b=i[m];t.on("ready",b)}a&&(a.readies=[]),t.emit("ready")},s.done)})},Zu=ns.prototype;He(Zu,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return Qr;var t=this._private.container.ownerDocument;return t===void 0||t==null?Qr:t.defaultView||Qr},mount:function(e){if(e!=null){var t=this,n=t._private,a=n.options;return!Gu(e)&&Gu(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(He({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),t.startAnimationLoop(),t.style(a.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Dn(this._private.options)},json:function(e){var t=this,n=t._private,a=t.mutableElements(),i=function(_){return t.getElementById(_.id())};if(pr(e)){if(t.startBatch(),e.elements){var o={},s=function(_,C){for(var R=[],S=[],A=0;A<_.length;A++){var P=_[A];if(!P.data.id){Er("cy.json() cannot handle elements without an ID attribute");continue}var I=""+P.data.id,D=t.getElementById(I);o[I]=!0,D.length!==0?S.push({ele:D,json:P}):(C&&(P.group=C),R.push(P))}t.add(R);for(var M=0;M<S.length;M++){var O=S[M],N=O.ele,V=O.json;N.json(V)}};if(Sr(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var c=u[l],v=e.elements[c];Sr(v)&&s(v,c)}var h=t.collection();a.filter(function(x){return!o[x.id()]}).forEach(function(x){x.isParent()?h.merge(x):x.remove()}),h.forEach(function(x){return x.children().move({parent:null})}),h.forEach(function(x){return i(x).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var g=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<g.length;p++){var E=g[p];e[E]!=null&&t[E](e[E])}return t.endBatch(),this}else{var m=!!e,b={};m?b.elements=this.elements().map(function(x){return x.json()}):(b.elements={},a.forEach(function(x){var _=x.group();b.elements[_]||(b.elements[_]=[]),b.elements[_].push(x.json())})),this._private.styleEnabled&&(b.style=t.style().json()),b.data=Dn(t.data());var w=n.options;return b.zoomingEnabled=n.zoomingEnabled,b.userZoomingEnabled=n.userZoomingEnabled,b.zoom=n.zoom,b.minZoom=n.minZoom,b.maxZoom=n.maxZoom,b.panningEnabled=n.panningEnabled,b.userPanningEnabled=n.userPanningEnabled,b.pan=Dn(n.pan),b.boxSelectionEnabled=n.boxSelectionEnabled,b.renderer=Dn(w.renderer),b.hideEdgesOnViewport=w.hideEdgesOnViewport,b.textureOnViewport=w.textureOnViewport,b.wheelSensitivity=w.wheelSensitivity,b.motionBlur=w.motionBlur,b.multiClickDebounceTime=w.multiClickDebounceTime,b}}});Zu.$id=Zu.getElementById;[y5,E5,X2,vm,Mu,C5,hm,ku,R5,ii,ts].forEach(function(r){He(Zu,r)});var P5={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},D5={maximal:!1,acyclic:!1},qi=function(e){return e.scratch("breadthfirst")},Mx=function(e,t){return e.scratch("breadthfirst",t)};function Q2(r){this.options=He({},P5,D5,r)}Q2.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=t.nodes().filter(function(Ae){return Ae.isChildless()}),a=t,i=r.directed,o=r.acyclic||r.maximal||r.maximalAdjustments>0,s=!!r.boundingBox,u=Dt(s?r.boundingBox:structuredClone(e.extent())),l;if(jt(r.roots))l=r.roots;else if(Sr(r.roots)){for(var c=[],v=0;v<r.roots.length;v++){var h=r.roots[v],g=e.getElementById(h);c.push(g)}l=e.collection(c)}else if(Ge(r.roots))l=e.$(r.roots);else if(i)l=n.roots();else{var p=t.components();l=e.collection();for(var E=function(){var Te=p[m],Pe=Te.maxDegree(!1),Ie=Te.filter(function(Le){return Le.degree(!1)===Pe});l=l.add(Ie)},m=0;m<p.length;m++)E()}var b=[],w={},x=function(Te,Pe){b[Pe]==null&&(b[Pe]=[]);var Ie=b[Pe].length;b[Pe].push(Te),Mx(Te,{index:Ie,depth:Pe})},_=function(Te,Pe){var Ie=qi(Te),Le=Ie.depth,Fe=Ie.index;b[Le][Fe]=null,Te.isChildless()&&x(Te,Pe)};a.bfs({roots:l,directed:r.directed,visit:function(Te,Pe,Ie,Le,Fe){var je=Te[0],lr=je.id();je.isChildless()&&x(je,Fe),w[lr]=!0}});for(var C=[],R=0;R<n.length;R++){var S=n[R];w[S.id()]||C.push(S)}var A=function(Te){for(var Pe=b[Te],Ie=0;Ie<Pe.length;Ie++){var Le=Pe[Ie];if(Le==null){Pe.splice(Ie,1),Ie--;continue}Mx(Le,{depth:Te,index:Ie})}},P=function(Te,Pe){for(var Ie=qi(Te),Le=Te.incomers().filter(function(Ue){return Ue.isNode()&&t.has(Ue)}),Fe=-1,je=Te.id(),lr=0;lr<Le.length;lr++){var ir=Le[lr],Xe=qi(ir);Fe=Math.max(Fe,Xe.depth)}if(Ie.depth<=Fe){if(!r.acyclic&&Pe[je])return null;var fr=Fe+1;return _(Te,fr),Pe[je]=fr,!0}return!1};if(i&&o){var I=[],D={},M=function(Te){return I.push(Te)},O=function(){return I.shift()};for(n.forEach(function(Ae){return I.push(Ae)});I.length>0;){var N=O(),V=P(N,D);if(V)N.outgoers().filter(function(Ae){return Ae.isNode()&&t.has(Ae)}).forEach(M);else if(V===null){Er("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var $=0;if(r.avoidOverlap)for(var G=0;G<n.length;G++){var U=n[G],J=U.layoutDimensions(r),W=J.w,H=J.h;$=Math.max($,W,H)}var Z={},ne=function(Te){if(Z[Te.id()])return Z[Te.id()];for(var Pe=qi(Te).depth,Ie=Te.neighborhood(),Le=0,Fe=0,je=0;je<Ie.length;je++){var lr=Ie[je];if(!(lr.isEdge()||lr.isParent()||!n.has(lr))){var ir=qi(lr);if(ir!=null){var Xe=ir.index,fr=ir.depth;if(!(Xe==null||fr==null)){var Ue=b[fr].length;fr<Pe&&(Le+=Xe/Ue,Fe++)}}}}return Fe=Math.max(1,Fe),Le=Le/Fe,Fe===0&&(Le=0),Z[Te.id()]=Le,Le},F=function(Te,Pe){var Ie=ne(Te),Le=ne(Pe),Fe=Ie-Le;return Fe===0?JR(Te.id(),Pe.id()):Fe};r.depthSort!==void 0&&(F=r.depthSort);for(var z=b.length,j=0;j<z;j++)b[j].sort(F),A(j);for(var ee=[],ie=0;ie<C.length;ie++)ee.push(C[ie]);var oe=function(){for(var Te=0;Te<z;Te++)A(Te)};ee.length&&(b.unshift(ee),z=b.length,oe());for(var Y=0,X=0;X<z;X++)Y=Math.max(b[X].length,Y);var re={x:u.x1+u.w/2,y:u.y1+u.h/2},le=n.reduce(function(Ae,Te){return(function(Pe){return{w:Ae.w===-1?Pe.w:(Ae.w+Pe.w)/2,h:Ae.h===-1?Pe.h:(Ae.h+Pe.h)/2}})(Te.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),he=Math.max(z===1?0:s?(u.h-r.padding*2-le.h)/(z-1):(u.h-r.padding*2-le.h)/(z+1),$),be=b.reduce(function(Ae,Te){return Math.max(Ae,Te.length)},0),fe=function(Te){var Pe=qi(Te),Ie=Pe.depth,Le=Pe.index;if(r.circle){var Fe=Math.min(u.w/2/z,u.h/2/z);Fe=Math.max(Fe,$);var je=Fe*Ie+Fe-(z>0&&b[0].length<=3?Fe/2:0),lr=2*Math.PI/b[Ie].length*Le;return Ie===0&&b[0].length===1&&(je=1),{x:re.x+je*Math.cos(lr),y:re.y+je*Math.sin(lr)}}else{var ir=b[Ie].length,Xe=Math.max(ir===1?0:s?(u.w-r.padding*2-le.w)/((r.grid?be:ir)-1):(u.w-r.padding*2-le.w)/((r.grid?be:ir)+1),$),fr={x:re.x+(Le+1-(ir+1)/2)*Xe,y:re.y+(Ie+1-(z+1)/2)*he};return fr}},ue={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(ue).indexOf(r.direction)===-1&&Mr("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(ue).join(", ")));var Se=function(Te){return Hq(fe(Te),u,ue[r.direction])};return t.nodes().layoutPositions(this,r,Se),this};var I5={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function J2(r){this.options=He({},I5,r)}J2.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=Dt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),c,v=0,h=0;h<i.length;h++){var g=i[h],p=g.layoutDimensions(e),E=p.w,m=p.h;v=Math.max(v,E,m)}if(De(e.radius)?c=e.radius:i.length<=1?c=0:c=Math.min(o.h,o.w)/2-v,i.length>1&&e.avoidOverlap){v*=1.75;var b=Math.cos(l)-Math.cos(0),w=Math.sin(l)-Math.sin(0),x=Math.sqrt(v*v/(b*b+w*w));c=Math.max(x,c)}var _=function(R,S){var A=e.startAngle+S*l*(a?1:-1),P=c*Math.cos(A),I=c*Math.sin(A),D={x:s.x+P,y:s.y+I};return D};return n.nodes().layoutPositions(this,e,_),this};var B5={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function eA(r){this.options=He({},B5,r)}eA.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=r.cy,a=e.eles,i=a.nodes().not(":parent"),o=Dt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,c=0;c<i.length;c++){var v=i[c],h=void 0;h=e.concentric(v),u.push({value:h,node:v}),v._private.scratch.concentric=h}i.updateStyle();for(var g=0;g<i.length;g++){var p=i[g],E=p.layoutDimensions(e);l=Math.max(l,E.w,E.h)}u.sort(function(he,be){return be.value-he.value});for(var m=e.levelWidth(i),b=[[]],w=b[0],x=0;x<u.length;x++){var _=u[x];if(w.length>0){var C=Math.abs(w[0].value-_.value);C>=m&&(w=[],b.push(w))}w.push(_)}var R=l+e.minNodeSpacing;if(!e.avoidOverlap){var S=b.length>0&&b[0].length>1,A=Math.min(o.w,o.h)/2-R,P=A/(b.length+S?1:0);R=Math.min(R,P)}for(var I=0,D=0;D<b.length;D++){var M=b[D],O=e.sweep===void 0?2*Math.PI-2*Math.PI/M.length:e.sweep,N=M.dTheta=O/Math.max(1,M.length-1);if(M.length>1&&e.avoidOverlap){var V=Math.cos(N)-Math.cos(0),$=Math.sin(N)-Math.sin(0),G=Math.sqrt(R*R/(V*V+$*$));I=Math.max(G,I)}M.r=I,I+=R}if(e.equidistant){for(var U=0,J=0,W=0;W<b.length;W++){var H=b[W],Z=H.r-J;U=Math.max(U,Z)}J=0;for(var ne=0;ne<b.length;ne++){var F=b[ne];ne===0&&(J=F.r),F.r=J,J+=U}}for(var z={},j=0;j<b.length;j++)for(var ee=b[j],ie=ee.dTheta,oe=ee.r,Y=0;Y<ee.length;Y++){var X=ee[Y],re=e.startAngle+(t?1:-1)*ie*Y,le={x:s.x+oe*Math.cos(re),y:s.y+oe*Math.sin(re)};z[X.node.id()]=le}return a.nodes().layoutPositions(this,e,function(he){var be=he.id();return z[be]}),this};var Ad,O5={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function bl(r){this.options=He({},O5,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),n=t.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(n)}bl.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?Ad=!0:Ad=!1;var n=M5(e,t,r);Ad&&L5(n),r.randomize&&q5(n);var a=jn(),i=function(){N5(n,e,r),r.fit===!0&&e.fit(r.padding)},o=function(h){return!(t.stopped||h>=r.numIter||(F5(n,r),n.temperature=n.temperature*r.coolingFactor,n.temperature<r.minTemp))},s=function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var h=r.eles.nodes(),g=tA(n,r,h);h.layoutPositions(t,r,g)}},u=0,l=!0;if(r.animate===!0){var c=function(){for(var h=0;l&&h<r.refresh;)l=o(u),u++,h++;if(!l)Lx(n,r),s();else{var g=jn();g-a>=r.animationThreshold&&i(),Wu(c)}};c()}else{for(;l;)l=o(u),u++;Lx(n,r),s()}return this};bl.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};bl.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var M5=function(e,t,n){for(var a=n.eles.edges(),i=n.eles.nodes(),o=Dt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),l={},c=0;c<u.length;c++)for(var v=u[c],h=0;h<v.length;h++){var g=v[h];l[g.id()]=c}for(var c=0;c<s.nodeSize;c++){var p=i[c],E=p.layoutDimensions(n),m={};m.isLocked=p.locked(),m.id=p.data("id"),m.parentId=p.data("parent"),m.cmptId=l[p.id()],m.children=[],m.positionX=p.position("x"),m.positionY=p.position("y"),m.offsetX=0,m.offsetY=0,m.height=E.w,m.width=E.h,m.maxX=m.positionX+m.width/2,m.minX=m.positionX-m.width/2,m.maxY=m.positionY+m.height/2,m.minY=m.positionY-m.height/2,m.padLeft=parseFloat(p.style("padding")),m.padRight=parseFloat(p.style("padding")),m.padTop=parseFloat(p.style("padding")),m.padBottom=parseFloat(p.style("padding")),m.nodeRepulsion=Nr(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,s.layoutNodes.push(m),s.idToIndex[m.id]=c}for(var b=[],w=0,x=-1,_=[],c=0;c<s.nodeSize;c++){var p=s.layoutNodes[c],C=p.parentId;C!=null?s.layoutNodes[s.idToIndex[C]].children.push(p.id):(b[++x]=p.id,_.push(p.id))}for(s.graphSet.push(_);w<=x;){var R=b[w++],S=s.idToIndex[R],g=s.layoutNodes[S],A=g.children;if(A.length>0){s.graphSet.push(A);for(var c=0;c<A.length;c++)b[++x]=A[c]}}for(var c=0;c<s.graphSet.length;c++)for(var P=s.graphSet[c],h=0;h<P.length;h++){var I=s.idToIndex[P[h]];s.indexToGraph[I]=c}for(var c=0;c<s.edgeSize;c++){var D=a[c],M={};M.id=D.data("id"),M.sourceId=D.data("source"),M.targetId=D.data("target");var O=Nr(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,N=Nr(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,V=s.idToIndex[M.sourceId],$=s.idToIndex[M.targetId],G=s.indexToGraph[V],U=s.indexToGraph[$];if(G!=U){for(var J=k5(M.sourceId,M.targetId,s),W=s.graphSet[J],H=0,m=s.layoutNodes[V];W.indexOf(m.id)===-1;)m=s.layoutNodes[s.idToIndex[m.parentId]],H++;for(m=s.layoutNodes[$];W.indexOf(m.id)===-1;)m=s.layoutNodes[s.idToIndex[m.parentId]],H++;O*=H*n.nestingFactor}M.idealLength=O,M.elasticity=N,s.layoutEdges.push(M)}return s},k5=function(e,t,n){var a=rA(e,t,0,n);return 2>a.count?0:a.graph},rA=function(e,t,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=a.idToIndex[u],c=a.layoutNodes[l].children;if(c.length!==0){var v=a.indexToGraph[a.idToIndex[c[0]]],h=rA(e,t,v,a);if(h.count!==0)if(h.count===1){if(o++,o===2)break}else return h}}return{count:o,graph:n}},L5,q5=function(e,t){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*a)}},tA=function(e,t,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,c=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:a.x1+l*a.w,y:a.y1+c*a.h}}else return{x:u.positionX,y:u.positionY}}},N5=function(e,t,n){var a=n.layout,i=n.eles.nodes(),o=tA(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},F5=function(e,t,n){z5(e,t),G5(e),W5(e,t),U5(e),H5(e)},z5=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[a[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[a[u]]];$5(s,l,e,t)}},kx=function(e){return-1+2*e*Math.random()},$5=function(e,t,n,a){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!n.isCompound)){var s=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;s===0&&u===0&&(s=kx(l),u=kx(l));var c=V5(e,t,s,u);if(c>0)var v=a.nodeOverlap*c,h=Math.sqrt(s*s+u*u),g=v*s/h,p=v*u/h;else var E=Xu(e,s,u),m=Xu(t,-1*s,-1*u),b=m.x-E.x,w=m.y-E.y,x=b*b+w*w,h=Math.sqrt(x),v=(e.nodeRepulsion+t.nodeRepulsion)/x,g=v*b/h,p=v*w/h;e.isLocked||(e.offsetX-=g,e.offsetY-=p),t.isLocked||(t.offsetX+=g,t.offsetY+=p)}},V5=function(e,t,n,a){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(a>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Xu=function(e,t,n){var a=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=n/t,l=o/s,c={};return t===0&&0<n||t===0&&0>n?(c.x=a,c.y=i+o/2,c):0<t&&-1*l<=u&&u<=l?(c.x=a+s/2,c.y=i+s*n/2/t,c):0>t&&-1*l<=u&&u<=l?(c.x=a-s/2,c.y=i-s*n/2/t,c):0<n&&(u<=-1*l||u>=l)?(c.x=a+o*t/2/n,c.y=i+o/2,c):(0>n&&(u<=-1*l||u>=l)&&(c.x=a-o*t/2/n,c.y=i-o/2),c)},G5=function(e,t){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],i=e.idToIndex[a.sourceId],o=e.layoutNodes[i],s=e.idToIndex[a.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,c=u.positionY-o.positionY;if(!(l===0&&c===0)){var v=Xu(o,l,c),h=Xu(u,-1*l,-1*c),g=h.x-v.x,p=h.y-v.y,E=Math.sqrt(g*g+p*p),m=Math.pow(a.idealLength-E,2)/a.elasticity;if(E!==0)var b=m*g/E,w=m*p/E;else var b=0,w=0;o.isLocked||(o.offsetX+=b,o.offsetY+=w),u.isLocked||(u.offsetX-=b,u.offsetY-=w)}}},W5=function(e,t){if(t.gravity!==0)for(var n=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],o=i.length;if(a===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],c=e.layoutNodes[e.idToIndex[l.parentId]],s=c.positionX,u=c.positionY;for(var v=0;v<o;v++){var h=e.layoutNodes[e.idToIndex[i[v]]];if(!h.isLocked){var g=s-h.positionX,p=u-h.positionY,E=Math.sqrt(g*g+p*p);if(E>n){var m=t.gravity*g/E,b=t.gravity*p/E;h.offsetX+=m,h.offsetY+=b}}}}},U5=function(e,t){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var o=n[a++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var c=u.offsetX,v=u.offsetY,h=0;h<l.length;h++){var g=e.layoutNodes[e.idToIndex[l[h]]];g.offsetX+=c,g.offsetY+=v,n[++i]=l[h]}u.offsetX=0,u.offsetY=0}}},H5=function(e,t){for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];if(!(0<a.children.length||a.isLocked)){var i=K5(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,nA(a,e)}}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},K5=function(e,t,n){var a=Math.sqrt(e*e+t*t);if(a>n)var i={x:n*e/a,y:n*t/a};else var i={x:e,y:t};return i},nA=function(e,t){var n=e.parentId;if(n!=null){var a=t.layoutNodes[t.idToIndex[n]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return nA(a,t)}},Lx=function(e,t){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var o=n[i],s=o.cmptId,u=a[s]=a[s]||[];u.push(o)}for(var l=0,i=0;i<a.length;i++){var c=a[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var v=0;v<c.length;v++){var h=c[v];c.x1=Math.min(c.x1,h.positionX-h.width/2),c.x2=Math.max(c.x2,h.positionX+h.width/2),c.y1=Math.min(c.y1,h.positionY-h.height/2),c.y2=Math.max(c.y2,h.positionY+h.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,l+=c.w*c.h}}a.sort(function(w,x){return x.w*x.h-w.w*w.h});for(var g=0,p=0,E=0,m=0,b=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var c=a[i];if(c){for(var v=0;v<c.length;v++){var h=c[v];h.isLocked||(h.positionX+=g-c.x1,h.positionY+=p-c.y1)}g+=c.w+t.componentSpacing,E+=c.w+t.componentSpacing,m=Math.max(m,c.h),E>b&&(p+=m+t.componentSpacing,g=0,E=0,m=0)}}},j5={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function aA(r){this.options=He({},j5,r)}aA.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=Dt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)n.nodes().layoutPositions(this,e,function(ne){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),c=function(F){if(F==null)return Math.min(u,l);var z=Math.min(u,l);z==u?u=F:l=F},v=function(F){if(F==null)return Math.max(u,l);var z=Math.max(u,l);z==u?u=F:l=F},h=e.rows,g=e.cols!=null?e.cols:e.columns;if(h!=null&&g!=null)u=h,l=g;else if(h!=null&&g==null)u=h,l=Math.ceil(o/u);else if(h==null&&g!=null)l=g,u=Math.ceil(o/l);else if(l*u>o){var p=c(),E=v();(p-1)*E>=o?c(p-1):(E-1)*p>=o&&v(E-1)}else for(;l*u<o;){var m=c(),b=v();(b+1)*m>=o?v(b+1):c(m+1)}var w=i.w/l,x=i.h/u;if(e.condense&&(w=0,x=0),e.avoidOverlap)for(var _=0;_<a.length;_++){var C=a[_],R=C._private.position;(R.x==null||R.y==null)&&(R.x=0,R.y=0);var S=C.layoutDimensions(e),A=e.avoidOverlapPadding,P=S.w+A,I=S.h+A;w=Math.max(w,P),x=Math.max(x,I)}for(var D={},M=function(F,z){return!!D["c-"+F+"-"+z]},O=function(F,z){D["c-"+F+"-"+z]=!0},N=0,V=0,$=function(){V++,V>=l&&(V=0,N++)},G={},U=0;U<a.length;U++){var J=a[U],W=e.position(J);if(W&&(W.row!==void 0||W.col!==void 0)){var H={row:W.row,col:W.col};if(H.col===void 0)for(H.col=0;M(H.row,H.col);)H.col++;else if(H.row===void 0)for(H.row=0;M(H.row,H.col);)H.row++;G[J.id()]=H,O(H.row,H.col)}}var Z=function(F,z){var j,ee;if(F.locked()||F.isParent())return!1;var ie=G[F.id()];if(ie)j=ie.col*w+w/2+i.x1,ee=ie.row*x+x/2+i.y1;else{for(;M(N,V);)$();j=V*w+w/2+i.x1,ee=N*x+x/2+i.y1,O(N,V),$()}return{x:j,y:ee}};a.layoutPositions(this,e,Z)}return this};var Y5={ready:function(){},stop:function(){}};function Gm(r){this.options=He({},Y5,r)}Gm.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};Gm.prototype.stop=function(){return this};var Z5={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function iA(r){this.options=He({},Z5,r)}iA.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),n=Nr(r.positions);function a(i){if(r.positions==null)return mN(i.position());if(n)return r.positions(i);var o=r.positions[i._private.data.id];return o??null}return t.layoutPositions(this,r,function(i,o){var s=a(i);return i.locked()||s==null?!1:s}),this};var X5={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oA(r){this.options=He({},X5,r)}oA.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=Dt(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(o,s){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return t.nodes().layoutPositions(this,r,a),this};var Q5=[{name:"breadthfirst",impl:Q2},{name:"circle",impl:J2},{name:"concentric",impl:eA},{name:"cose",impl:bl},{name:"grid",impl:aA},{name:"null",impl:Gm},{name:"preset",impl:iA},{name:"random",impl:oA}];function sA(r){this.options=r,this.notifications=0}var qx=function(){},Nx=function(){throw new Error("A headless instance can not render images")};sA.prototype={recalculateRenderedStyle:qx,notify:function(){this.notifications++},init:qx,isHeadless:function(){return!0},png:Nx,jpg:Nx};var Wm={};Wm.arrowShapeWidth=.3;Wm.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(l,c,v,h,g,p,E){var m=g.x-v/2-E,b=g.x+v/2+E,w=g.y-v/2-E,x=g.y+v/2+E,_=m<=l&&l<=b&&w<=c&&c<=x;return _},n=function(l,c,v,h,g){var p=l*Math.cos(h)-c*Math.sin(h),E=l*Math.sin(h)+c*Math.cos(h),m=p*v,b=E*v,w=m+g.x,x=b+g.y;return{x:w,y:x}},a=function(l,c,v,h){for(var g=[],p=0;p<l.length;p+=2){var E=l[p],m=l[p+1];g.push(n(E,m,c,v,h))}return g},i=function(l){for(var c=[],v=0;v<l.length;v++){var h=l[v];c.push(h.x,h.y)}return c},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,c){Ge(c)&&(c=r[c]),r[l]=He({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(h,g,p,E,m,b){var w=i(a(this.points,p+2*b,E,m)),x=Nt(h,g,w);return x},roughCollide:t,draw:function(h,g,p,E){var m=a(this.points,g,p,E);e.arrowShapeImpl("polygon")(h,m)},spacing:function(h){return 0},gap:o},c)};s("none",{collide:Uu,roughCollide:Uu,draw:Pm,spacing:Q1,gap:Q1}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(l,c,v,h,g){var p=a(this.points,c,v,h),E=this.controlPoint,m=n(E[0],E[1],c,v,h);e.arrowShapeImpl(this.name)(l,p,m)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,c,v,h,g,p,E){var m=i(a(this.points,v+2*E,h,g)),b=i(a(this.pointsTee,v+2*E,h,g)),w=Nt(l,c,m)||Nt(l,c,b);return w},draw:function(l,c,v,h,g){var p=a(this.points,c,v,h),E=a(this.pointsTee,c,v,h);e.arrowShapeImpl(this.name)(l,p,E)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,c,v,h,g,p,E){var m=g,b=Math.pow(m.x-l,2)+Math.pow(m.y-c,2)<=Math.pow((v+2*E)*this.radius,2),w=i(a(this.points,v+2*E,h,g));return Nt(l,c,w)||b},draw:function(l,c,v,h,g){var p=a(this.pointsTr,c,v,h);e.arrowShapeImpl(this.name)(l,p,h.x,h.y,this.radius*c)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,c){var v=this.baseCrossLinePts.slice(),h=c/l,g=3,p=5;return v[g]=v[g]-h,v[p]=v[p]-h,v},collide:function(l,c,v,h,g,p,E){var m=i(a(this.points,v+2*E,h,g)),b=i(a(this.crossLinePts(v,p),v+2*E,h,g)),w=Nt(l,c,m)||Nt(l,c,b);return w},draw:function(l,c,v,h,g){var p=a(this.points,c,v,h),E=a(this.crossLinePts(c,g),c,v,h);e.arrowShapeImpl(this.name)(l,p,E)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,c,v,h,g,p,E){var m=g,b=Math.pow(m.x-l,2)+Math.pow(m.y-c,2)<=Math.pow((v+2*E)*this.radius,2);return b},draw:function(l,c,v,h,g){e.arrowShapeImpl(this.name)(l,h.x,h.y,this.radius*c)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var ui={};ui.projectIntoViewport=function(r,e){var t=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],s=t.pan(),u=t.zoom(),l=((r-a)/o-s.x)/u,c=((e-i)/o-s.y)/u;return[l,c]};ui.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),n=function(b){return parseFloat(t.getPropertyValue(b))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=r.clientWidth,s=r.clientHeight,u=a.left+a.right,l=a.top+a.bottom,c=i.left+i.right,v=e.width/(o+c),h=o-u,g=s-l,p=e.left+a.left+i.left,E=e.top+a.top+i.top;return this.containerBB=[p,E,h,g,v]};ui.invalidateContainerClientCoordsCache=function(){this.containerBB=null};ui.findNearestElement=function(r,e,t,n){return this.findNearestElements(r,e,t,n)[0]};ui.findNearestElements=function(r,e,t,n){var a=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),c=(n?24:8)/u,v=(n?8:2)/u,h=(n?8:2)/u,g=1/0,p,E;t&&(o=o.interactive);function m(S,A){if(S.isNode()){if(E)return;E=S,s.push(S)}if(S.isEdge()&&(A==null||A<g))if(p){if(p.pstyle("z-compound-depth").value===S.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===S.pstyle("z-compound-depth").value){for(var P=0;P<s.length;P++)if(s[P].isEdge()){s[P]=S,p=S,g=A??g;break}}}else s.push(S),p=S,g=A??g}function b(S){var A=S.outerWidth()+2*v,P=S.outerHeight()+2*v,I=A/2,D=P/2,M=S.position(),O=S.pstyle("corner-radius").value==="auto"?"auto":S.pstyle("corner-radius").pfValue,N=S._private.rscratch;if(M.x-I<=r&&r<=M.x+I&&M.y-D<=e&&e<=M.y+D){var V=i.nodeShapes[a.getNodeShape(S)];if(V.checkPoint(r,e,0,A,P,M.x,M.y,O,N))return m(S,0),!0}}function w(S){var A=S._private,P=A.rscratch,I=S.pstyle("width").pfValue,D=S.pstyle("arrow-scale").value,M=I/2+c,O=M*M,N=M*2,U=A.source,J=A.target,V;if(P.edgeType==="segments"||P.edgeType==="straight"||P.edgeType==="haystack"){for(var $=P.allpts,G=0;G+3<$.length;G+=2)if(BN(r,e,$[G],$[G+1],$[G+2],$[G+3],N)&&O>(V=qN(r,e,$[G],$[G+1],$[G+2],$[G+3])))return m(S,V),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(var $=P.allpts,G=0;G+5<P.allpts.length;G+=4)if(ON(r,e,$[G],$[G+1],$[G+2],$[G+3],$[G+4],$[G+5],N)&&O>(V=LN(r,e,$[G],$[G+1],$[G+2],$[G+3],$[G+4],$[G+5])))return m(S,V),!0}for(var U=U||A.source,J=J||A.target,W=a.getArrowWidth(I,D),H=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}],G=0;G<H.length;G++){var Z=H[G],ne=i.arrowShapes[S.pstyle(Z.name+"-arrow-shape").value],F=S.pstyle("width").pfValue;if(ne.roughCollide(r,e,W,Z.angle,{x:Z.x,y:Z.y},F,c)&&ne.collide(r,e,W,Z.angle,{x:Z.x,y:Z.y},F,c))return m(S),!0}l&&s.length>0&&(b(U),b(J))}function x(S,A,P){return qt(S,A,P)}function _(S,A){var P=S._private,I=h,D;A?D=A+"-":D="",S.boundingBox();var M=P.labelBounds[A||"main"],O=S.pstyle(D+"label").value,N=S.pstyle("text-events").strValue==="yes";if(!(!N||!O)){var V=x(P.rscratch,"labelX",A),$=x(P.rscratch,"labelY",A),G=x(P.rscratch,"labelAngle",A),U=S.pstyle(D+"text-margin-x").pfValue,J=S.pstyle(D+"text-margin-y").pfValue,W=M.x1-I-U,H=M.x2+I-U,Z=M.y1-I-J,ne=M.y2+I-J;if(G){var F=Math.cos(G),z=Math.sin(G),j=function(le,he){return le=le-V,he=he-$,{x:le*F-he*z+V,y:le*z+he*F+$}},ee=j(W,Z),ie=j(W,ne),oe=j(H,Z),Y=j(H,ne),X=[ee.x+U,ee.y+J,oe.x+U,oe.y+J,Y.x+U,Y.y+J,ie.x+U,ie.y+J];if(Nt(r,e,X))return m(S),!0}else if(pa(M,r,e))return m(S),!0}}for(var C=o.length-1;C>=0;C--){var R=o[C];R.isNode()?b(R)||_(R):w(R)||_(R)||_(R,"source")||_(R,"target")}return s};ui.getAllInBox=function(r,e,t,n){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(r,t),l=Math.max(r,t),c=Math.min(e,n),v=Math.max(e,n);r=u,t=l,e=c,n=v;var h=Dt({x1:r,y1:e,x2:t,y2:n}),g=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]],[g[3],g[0]]];function E(le,he,be){return qt(le,he,be)}function m(le,he){var be=le._private,fe=o,ue="";le.boundingBox();var Se=be.labelBounds.main;if(!Se)return null;var Ae=E(be.rscratch,"labelX",he),Te=E(be.rscratch,"labelY",he),Pe=E(be.rscratch,"labelAngle",he),Ie=le.pstyle(ue+"text-margin-x").pfValue,Le=le.pstyle(ue+"text-margin-y").pfValue,Fe=Se.x1-fe-Ie,je=Se.x2+fe-Ie,lr=Se.y1-fe-Le,ir=Se.y2+fe-Le;if(Pe){var Xe=Math.cos(Pe),fr=Math.sin(Pe),Ue=function(ge,L){return ge=ge-Ae,L=L-Te,{x:ge*Xe-L*fr+Ae,y:ge*fr+L*Xe+Te}};return[Ue(Fe,lr),Ue(je,lr),Ue(je,ir),Ue(Fe,ir)]}else return[{x:Fe,y:lr},{x:je,y:lr},{x:je,y:ir},{x:Fe,y:ir}]}function b(le,he,be,fe){function ue(Se,Ae,Te){return(Te.y-Se.y)*(Ae.x-Se.x)>(Ae.y-Se.y)*(Te.x-Se.x)}return ue(le,be,fe)!==ue(he,be,fe)&&ue(le,he,be)!==ue(le,he,fe)}for(var w=0;w<a.length;w++){var x=a[w];if(x.isNode()){var _=x,C=_.pstyle("text-events").strValue==="yes",R=_.pstyle("box-selection").strValue,S=_.pstyle("box-select-labels").strValue==="yes";if(R==="none")continue;var A=(R==="overlap"||S)&&C,P=_.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:A});if(R==="contain"){var I=!1;if(S&&C){var D=m(_);D&&Tc(D,g)&&(s.push(_),I=!0)}!I&&h2(h,P)&&s.push(_)}else if(R==="overlap"&&Om(h,P)){var M=_.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),O=[{x:M.x1,y:M.y1},{x:M.x2,y:M.y1},{x:M.x2,y:M.y2},{x:M.x1,y:M.y2}];if(Tc(O,g))s.push(_);else{var N=m(_);N&&Tc(N,g)&&s.push(_)}}}else{var V=x,$=V._private,G=$.rscratch,U=V.pstyle("box-selection").strValue;if(U==="none")continue;if(U==="contain"){if(G.startX!=null&&G.startY!=null&&!pa(h,G.startX,G.startY)||G.endX!=null&&G.endY!=null&&!pa(h,G.endX,G.endY))continue;if(G.edgeType==="bezier"||G.edgeType==="multibezier"||G.edgeType==="self"||G.edgeType==="compound"||G.edgeType==="segments"||G.edgeType==="haystack"){for(var J=$.rstyle.bezierPts||$.rstyle.linePts||$.rstyle.haystackPts,W=!0,H=0;H<J.length;H++)if(!nw(h,J[H])){W=!1;break}W&&s.push(V)}else G.edgeType==="straight"&&s.push(V)}else if(U==="overlap"){var Z=!1;if(G.startX!=null&&G.startY!=null&&G.endX!=null&&G.endY!=null&&(pa(h,G.startX,G.startY)||pa(h,G.endX,G.endY)))s.push(V),Z=!0;else if(!Z&&G.edgeType==="haystack"){for(var ne=$.rstyle.haystackPts,F=0;F<ne.length;F++)if(nw(h,ne[F])){s.push(V),Z=!0;break}}if(!Z){var z=$.rstyle.bezierPts||$.rstyle.linePts||$.rstyle.haystackPts;if((!z||z.length<2)&&G.edgeType==="straight"&&G.startX!=null&&G.startY!=null&&G.endX!=null&&G.endY!=null&&(z=[{x:G.startX,y:G.startY},{x:G.endX,y:G.endY}]),!z||z.length<2)continue;for(var j=0;j<z.length-1;j++){for(var ee=z[j],ie=z[j+1],oe=0;oe<p.length;oe++){var Y=Kr(p[oe],2),X=Y[0],re=Y[1];if(b(ee,ie,X,re)){s.push(V),Z=!0;break}}if(Z)break}}}}}return s};var Qu={};Qu.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",n=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,c,v,h,g,b,w;if(t?(c=e.haystackPts[0],v=e.haystackPts[1],h=e.haystackPts[2],g=e.haystackPts[3]):(c=e.arrowStartX,v=e.arrowStartY,h=e.arrowEndX,g=e.arrowEndY),b=e.midX,w=e.midY,i)u=c-e.segpts[0],l=v-e.segpts[1];else if(a||o||s||n){var p=e.allpts,E=at(p[0],p[2],p[4],.1),m=at(p[1],p[3],p[5],.1);u=c-E,l=v-m}else u=c-b,l=v-w;e.srcArrowAngle=pu(u,l);var b=e.midX,w=e.midY;if(t&&(b=(c+h)/2,w=(v+g)/2),u=h-c,l=g-v,i){var p=e.allpts;if(p.length/2%2===0){var x=p.length/2,_=x-2;u=p[x]-p[_],l=p[x+1]-p[_+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var x=p.length/2-1,_=x-2;u=p[x]-p[_],l=p[x+1]-p[_+1]}}else if(a||o||s){var p=e.allpts,C=e.ctrlpts,R,S,A,P;if(C.length/2%2===0){var I=p.length/2-1,D=I+2,M=D+2;R=at(p[I],p[D],p[M],0),S=at(p[I+1],p[D+1],p[M+1],0),A=at(p[I],p[D],p[M],1e-4),P=at(p[I+1],p[D+1],p[M+1],1e-4)}else{var D=p.length/2-1,I=D-2,M=D+2;R=at(p[I],p[D],p[M],.4999),S=at(p[I+1],p[D+1],p[M+1],.4999),A=at(p[I],p[D],p[M],.5),P=at(p[I+1],p[D+1],p[M+1],.5)}u=A-R,l=P-S}if(e.midtgtArrowAngle=pu(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var p=e.allpts;if(p.length/2%2!==0){if(!e.isRound){var x=p.length/2-1,O=x+2;u=-(p[O]-p[x]),l=-(p[O+1]-p[x+1])}}}if(e.midsrcArrowAngle=pu(u,l),i)u=h-e.segpts[e.segpts.length-2],l=g-e.segpts[e.segpts.length-1];else if(a||o||s||n){var p=e.allpts,N=p.length,E=at(p[N-6],p[N-4],p[N-2],.9),m=at(p[N-5],p[N-3],p[N-1],.9);u=h-E,l=g-m}else u=h-b,l=g-w;e.tgtArrowAngle=pu(u,l)};Qu.getArrowWidth=Qu.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},n=t[r+", "+e];return n||(n=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=n,n)};var gm,pm,An={},an={},Fx,zx,Qa,Lu,Un,Ka,Za,Tn,Ni,Cu,uA,lA,ym,mm,$x,Vx=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},J5=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},e$=function(e,t,n,a,i){if(e!==$x?Vx(t,e,An):J5(an,An),Vx(t,n,an),Fx=An.nx*an.ny-An.ny*an.nx,zx=An.nx*an.nx-An.ny*-an.ny,Un=Math.asin(Math.max(-1,Math.min(1,Fx))),Math.abs(Un)<1e-6){gm=t.x,pm=t.y,Za=Ni=0;return}Qa=1,Lu=!1,zx<0?Un<0?Un=Math.PI+Un:(Un=Math.PI-Un,Qa=-1,Lu=!0):Un>0&&(Qa=-1,Lu=!0),t.radius!==void 0?Ni=t.radius:Ni=a,Ka=Un/2,Cu=Math.min(An.len/2,an.len/2),i?(Tn=Math.abs(Math.cos(Ka)*Ni/Math.sin(Ka)),Tn>Cu?(Tn=Cu,Za=Math.abs(Tn*Math.sin(Ka)/Math.cos(Ka))):Za=Ni):(Tn=Math.min(Cu,Ni),Za=Math.abs(Tn*Math.sin(Ka)/Math.cos(Ka))),ym=t.x+an.nx*Tn,mm=t.y+an.ny*Tn,gm=ym-an.ny*Za*Qa,pm=mm+an.nx*Za*Qa,uA=t.x+An.nx*Tn,lA=t.y+An.ny*Tn,$x=t};function fA(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Um(r,e,t,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(e$(r,e,t,n,a),{cx:gm,cy:pm,radius:Za,startX:uA,startY:lA,stopX:ym,stopY:mm,startAngle:An.ang+Math.PI/2*Qa,endAngle:an.ang-Math.PI/2*Qa,counterClockwise:Lu})}var as=.01,r$=Math.sqrt(2*as),_t={};_t.findMidptPtsEtc=function(r,e){var t=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(C,R,S,A){var P=A-R,I=S-C,D=Math.sqrt(I*I+P*P);return{x:-P/D,y:I/D}},c=r.pstyle("edge-distances").value;switch(c){case"node-position":i=t;break;case"intersection":i=n;break;case"endpoints":{if(u){var v=this.manualEndptToPx(r.source()[0],o),h=Kr(v,2),g=h[0],p=h[1],E=this.manualEndptToPx(r.target()[0],s),m=Kr(E,2),b=m[0],w=m[1],x={x1:g,y1:p,x2:b,y2:w};a=l(g,p,b,w),i=x}else Er("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=n;break}}return{midptPts:i,vectorNormInverse:a}};_t.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],n=t._private,a=n.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=n.source,s=n.target,u=o.position(),l=s.position(),c=o.width(),v=s.width(),h=o.height(),g=s.height(),p=t.pstyle("haystack-radius").value,E=p/2;a.haystackPts=a.allpts=[a.source.x*c*E+u.x,a.source.y*h*E+u.y,a.target.x*v*E+l.x,a.target.y*g*E+l.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};_t.findSegmentsPoints=function(r,e){var t=r._private.rscratch,n=r.pstyle("segment-weights"),a=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),o=r.pstyle("radius-type"),s=Math.min(n.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var c=0;c<s;c++){var v=n.pfValue[c],h=a.pfValue[c],g=1-v,p=v,E=this.findMidptPtsEtc(r,e),m=E.midptPts,b=E.vectorNormInverse,w={x:m.x1*g+m.x2*p,y:m.y1*g+m.y2*p};t.segpts.push(w.x+b.x*h,w.y+b.y*h),t.radii.push(i.pfValue[c]!==void 0?i.pfValue[c]:u),t.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:l)==="arc-radius")}};_t.findLoopPoints=function(r,e,t,n){var a=r._private.rscratch,i=e.dirCounts,o=e.srcPos,s=r.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=r.pstyle("loop-direction").pfValue,c=r.pstyle("loop-sweep").pfValue,v=r.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=t,g=v;n&&(h=0,g=u);var p=l-Math.PI/2,E=p-c/2,m=p+c/2,b=l+"_"+c;h=i[b]===void 0?i[b]=0:++i[b],a.ctrlpts=[o.x+Math.cos(E)*1.4*g*(h/3+1),o.y+Math.sin(E)*1.4*g*(h/3+1),o.x+Math.cos(m)*1.4*g*(h/3+1),o.y+Math.sin(m)*1.4*g*(h/3+1)]};_t.findCompoundLoopPoints=function(r,e,t,n){var a=r._private.rscratch;a.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,c=e.tgtH,v=r.pstyle("control-point-step-size").pfValue,h=r.pstyle("control-point-distances"),g=h?h.pfValue[0]:void 0,p=t,E=v;n&&(p=0,E=g);var m=50,b={x:i.x-s/2,y:i.y-u/2},w={x:o.x-l/2,y:o.y-c/2},x={x:Math.min(b.x,w.x),y:Math.min(b.y,w.y)},_=.5,C=Math.max(_,Math.log(s*as)),R=Math.max(_,Math.log(l*as));a.ctrlpts=[x.x,x.y-(1+Math.pow(m,1.12)/100)*E*(p/3+1)*C,x.x-(1+Math.pow(m,1.12)/100)*E*(p/3+1)*R,x.y]};_t.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};_t.findBezierPoints=function(r,e,t,n,a){var i=r._private.rscratch,o=r.pstyle("control-point-step-size").pfValue,s=r.pstyle("control-point-distances"),u=r.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,c=s?s.pfValue[0]:void 0,v=u.value[0],h=n;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var g=0;g<l;g++){var p=(.5-e.eles.length/2+t)*o*(a?-1:1),E=void 0,m=Bm(p);h&&(c=s?s.pfValue[g]:o,v=u.value[g]),n?E=c:E=c!==void 0?m*c:void 0;var b=E!==void 0?E:p,w=1-v,x=v,_=this.findMidptPtsEtc(r,e),C=_.midptPts,R=_.vectorNormInverse,S={x:C.x1*w+C.x2*x,y:C.y1*w+C.y2*x};i.ctrlpts.push(S.x+R.x*b,S.y+R.y*b)}};_t.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var n="vertical",a="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",c=e.posPts,v=e.srcW,h=e.srcH,g=e.tgtW,p=e.tgtH,E=r.pstyle("edge-distances").value,m=E!=="node-position",b=r.pstyle("taxi-direction").value,w=b,x=r.pstyle("taxi-turn"),_=x.units==="%",C=x.pfValue,R=C<0,S=r.pstyle("taxi-turn-min-distance").pfValue,A=m?(v+g)/2:0,P=m?(h+p)/2:0,I=c.x2-c.x1,D=c.y2-c.y1,M=function(L,se){return L>0?Math.max(L-se,0):Math.min(L+se,0)},O=M(I,A),N=M(D,P),V=!1;w===l?b=Math.abs(O)>Math.abs(N)?a:n:w===u||w===s?(b=n,V=!0):(w===i||w===o)&&(b=a,V=!0);var $=b===n,G=$?N:O,U=$?D:I,J=Bm(U),W=!1;!(V&&(_||R))&&(w===s&&U<0||w===u&&U>0||w===i&&U>0||w===o&&U<0)&&(J*=-1,G=J*Math.abs(G),W=!0);var H;if(_){var Z=C<0?1+C:C;H=Z*G}else{var ne=C<0?G:0;H=ne+C*J}var F=function(L){return Math.abs(L)<S||Math.abs(L)>=Math.abs(G)},z=F(H),j=F(Math.abs(G)-Math.abs(H)),ee=z||j;if(ee&&!W)if($){var ie=Math.abs(U)<=h/2,oe=Math.abs(I)<=g/2;if(ie){var Y=(c.x1+c.x2)/2,X=c.y1,re=c.y2;t.segpts=[Y,X,Y,re]}else if(oe){var le=(c.y1+c.y2)/2,he=c.x1,be=c.x2;t.segpts=[he,le,be,le]}else t.segpts=[c.x1,c.y2]}else{var fe=Math.abs(U)<=v/2,ue=Math.abs(D)<=p/2;if(fe){var Se=(c.y1+c.y2)/2,Ae=c.x1,Te=c.x2;t.segpts=[Ae,Se,Te,Se]}else if(ue){var Pe=(c.x1+c.x2)/2,Ie=c.y1,Le=c.y2;t.segpts=[Pe,Ie,Pe,Le]}else t.segpts=[c.x2,c.y1]}else if($){var Fe=c.y1+H+(m?h/2*J:0),je=c.x1,lr=c.x2;t.segpts=[je,Fe,lr,Fe]}else{var ir=c.x1+H+(m?v/2*J:0),Xe=c.y1,fr=c.y2;t.segpts=[ir,Xe,ir,fr]}if(t.isRound){var Ue=r.pstyle("taxi-radius").value,Oe=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(Ue),t.isArcRadius=new Array(t.segpts.length/2).fill(Oe)}};_t.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var n=e.srcPos,a=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,c=e.tgtShape,v=e.srcCornerRadius,h=e.tgtCornerRadius,g=e.srcRs,p=e.tgtRs,E=!De(t.startX)||!De(t.startY),m=!De(t.arrowStartX)||!De(t.arrowStartY),b=!De(t.endX)||!De(t.endY),w=!De(t.arrowEndX)||!De(t.arrowEndY),x=3,_=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=x*_,R=ni({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),S=R<C,A=ni({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),P=A<C,I=!1;if(E||m||S){I=!0;var D={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},M=Math.sqrt(D.x*D.x+D.y*D.y),O={x:D.x/M,y:D.y/M},N=Math.max(i,o),V={x:t.ctrlpts[0]+O.x*2*N,y:t.ctrlpts[1]+O.y*2*N},$=l.intersectLine(n.x,n.y,i,o,V.x,V.y,0,v,g);S?(t.ctrlpts[0]=t.ctrlpts[0]+O.x*(C-R),t.ctrlpts[1]=t.ctrlpts[1]+O.y*(C-R)):(t.ctrlpts[0]=$[0]+O.x*C,t.ctrlpts[1]=$[1]+O.y*C)}if(b||w||P){I=!0;var G={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},U=Math.sqrt(G.x*G.x+G.y*G.y),J={x:G.x/U,y:G.y/U},W=Math.max(i,o),H={x:t.ctrlpts[0]+J.x*2*W,y:t.ctrlpts[1]+J.y*2*W},Z=c.intersectLine(a.x,a.y,s,u,H.x,H.y,0,h,p);P?(t.ctrlpts[0]=t.ctrlpts[0]+J.x*(C-A),t.ctrlpts[1]=t.ctrlpts[1]+J.y*(C-A)):(t.ctrlpts[0]=Z[0]+J.x*C,t.ctrlpts[1]=Z[1]+J.y*C)}I&&this.findEndpoints(r)}};_t.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var n,a;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,a=.5,e.midX=at(e.allpts[n],e.allpts[n+2],e.allpts[n+4],a),e.midY=at(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],a))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(Um({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var c=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[c],e.midY=e.segpts[c+1];else{var v={x:e.segpts[c],y:e.segpts[c+1]},h=e.roundCorners[c/2];if(h.radius===0){var g={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=v.x,e.midY=v.y,e.midVector=[v.y-g.y,g.x-v.x]}else{var p=[v.x-h.cx,v.y-h.cy],E=h.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(m){return m*E}),e.midX=h.cx+p[0],e.midY=h.cy+p[1],e.midVector=p}}}}};_t.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||De(e.startX)&&De(e.startY)&&De(e.endX)&&De(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Er("Edge `"+r.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};_t.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,n=t.cy,a=n.hasCompoundNodes(),i=new Kn,o=function(P,I){return[].concat(Vu(P),[I?1:0]).join("-")},s=[],u=[],l=0;l<r.length;l++){var c=r[l],v=c._private,h=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(h==="haystack"){u.push(c);continue}var g=h==="unbundled-bezier"||ga(h,"segments")||h==="straight"||h==="straight-triangle"||ga(h,"taxi"),p=h==="unbundled-bezier"||h==="bezier",E=v.source,m=v.target,b=E.poolIndex(),w=m.poolIndex(),x=[b,w].sort(),_=o(x,g),C=i.get(_);C==null&&(C={eles:[]},s.push({pairId:x,edgeIsUnbundled:g}),i.set(_,C)),C.eles.push(c),g&&(C.hasUnbundled=!0),p&&(C.hasBezier=!0)}}for(var R=function(){var P=s[S],I=P.pairId,D=P.edgeIsUnbundled,M=o(I,D),O=i.get(M),N;if(!O.hasUnbundled){var V=O.eles[0].parallelEdges().filter(function(Oe){return Oe.isBundledBezier()});Dm(O.eles),V.forEach(function(Oe){return O.eles.push(Oe)}),O.eles.sort(function(Oe,ge){return Oe.poolIndex()-ge.poolIndex()})}var $=O.eles[0],G=$.source(),U=$.target();if(G.poolIndex()>U.poolIndex()){var J=G;G=U,U=J}var W=O.srcPos=G.position(),H=O.tgtPos=U.position(),Z=O.srcW=G.outerWidth(),ne=O.srcH=G.outerHeight(),F=O.tgtW=U.outerWidth(),z=O.tgtH=U.outerHeight(),j=O.srcShape=t.nodeShapes[e.getNodeShape(G)],ee=O.tgtShape=t.nodeShapes[e.getNodeShape(U)],ie=O.srcCornerRadius=G.pstyle("corner-radius").value==="auto"?"auto":G.pstyle("corner-radius").pfValue,oe=O.tgtCornerRadius=U.pstyle("corner-radius").value==="auto"?"auto":U.pstyle("corner-radius").pfValue,Y=O.tgtRs=U._private.rscratch,X=O.srcRs=G._private.rscratch;O.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var re=0;re<O.eles.length;re++){var le=O.eles[re],he=le[0]._private.rscratch,be=le.pstyle("curve-style").value,fe=be==="unbundled-bezier"||ga(be,"segments")||ga(be,"taxi"),ue=!G.same(le.source());if(!O.calculatedIntersection&&G!==U&&(O.hasBezier||O.hasUnbundled)){O.calculatedIntersection=!0;var Se=j.intersectLine(W.x,W.y,Z,ne,H.x,H.y,0,ie,X),Ae=O.srcIntn=Se,Te=ee.intersectLine(H.x,H.y,F,z,W.x,W.y,0,oe,Y),Pe=O.tgtIntn=Te,Ie=O.intersectionPts={x1:Se[0],x2:Te[0],y1:Se[1],y2:Te[1]},Le=O.posPts={x1:W.x,x2:H.x,y1:W.y,y2:H.y},Fe=Te[1]-Se[1],je=Te[0]-Se[0],lr=Math.sqrt(je*je+Fe*Fe);De(lr)&&lr>=r$||(lr=Math.sqrt(Math.max(je*je,as)+Math.max(Fe*Fe,as)));var ir=O.vector={x:je,y:Fe},Xe=O.vectorNorm={x:ir.x/lr,y:ir.y/lr},fr={x:-Xe.y,y:Xe.x};O.nodesOverlap=!De(lr)||ee.checkPoint(Se[0],Se[1],0,F,z,H.x,H.y,oe,Y)||j.checkPoint(Te[0],Te[1],0,Z,ne,W.x,W.y,ie,X),O.vectorNormInverse=fr,N={nodesOverlap:O.nodesOverlap,dirCounts:O.dirCounts,calculatedIntersection:!0,hasBezier:O.hasBezier,hasUnbundled:O.hasUnbundled,eles:O.eles,srcPos:H,srcRs:Y,tgtPos:W,tgtRs:X,srcW:F,srcH:z,tgtW:Z,tgtH:ne,srcIntn:Pe,tgtIntn:Ae,srcShape:ee,tgtShape:j,posPts:{x1:Le.x2,y1:Le.y2,x2:Le.x1,y2:Le.y1},intersectionPts:{x1:Ie.x2,y1:Ie.y2,x2:Ie.x1,y2:Ie.y1},vector:{x:-ir.x,y:-ir.y},vectorNorm:{x:-Xe.x,y:-Xe.y},vectorNormInverse:{x:-fr.x,y:-fr.y}}}var Ue=ue?N:O;he.nodesOverlap=Ue.nodesOverlap,he.srcIntn=Ue.srcIntn,he.tgtIntn=Ue.tgtIntn,he.isRound=be.startsWith("round"),a&&(G.isParent()||G.isChild()||U.isParent()||U.isChild())&&(G.parents().anySame(U)||U.parents().anySame(G)||G.same(U)&&G.isParent())?e.findCompoundLoopPoints(le,Ue,re,fe):G===U?e.findLoopPoints(le,Ue,re,fe):be.endsWith("segments")?e.findSegmentsPoints(le,Ue):be.endsWith("taxi")?e.findTaxiPoints(le,Ue):be==="straight"||!fe&&O.eles.length%2===1&&re===Math.floor(O.eles.length/2)?e.findStraightEdgePoints(le):e.findBezierPoints(le,Ue,re,fe,ue),e.findEndpoints(le),e.tryToCorrectInvalidPoints(le,Ue),e.checkForInvalidEdgeWarning(le),e.storeAllpts(le),e.storeEdgeProjections(le),e.calculateArrowAngles(le),e.recalculateEdgeLabelProjections(le),e.calculateLabelAngles(le)}},S=0;S<s.length;S++)R();this.findHaystackPoints(u)}};function cA(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var n=r[t],a=r[t+1];e.push({x:n,y:a})}return e}}_t.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return cA(e.segpts)};_t.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return cA(e.ctrlpts)};_t.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var ys={};ys.manualEndptToPx=function(r,e){var t=this,n=r.position(),a=r.outerWidth(),i=r.outerHeight(),o=r._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*a),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=n.x,s[1]+=n.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(a,i),c=[n.x+Math.cos(u)*l,n.y+Math.sin(u)*l];return t.nodeShapes[this.getNodeShape(r)].intersectLine(n.x,n.y,a,i,c[0],c[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,o)}};ys.findEndpoints=function(r){var e,t,n,a,i=this,o,s=r.source()[0],u=r.target()[0],l=s.position(),c=u.position(),v=r.pstyle("target-arrow-shape").value,h=r.pstyle("source-arrow-shape").value,g=r.pstyle("target-distance-from-node").pfValue,p=r.pstyle("source-distance-from-node").pfValue,E=s._private.rscratch,m=u._private.rscratch,b=r.pstyle("curve-style").value,w=r._private.rscratch,x=w.edgeType,_=ga(b,"taxi"),C=x==="self"||x==="compound",R=x==="bezier"||x==="multibezier"||C,S=x!=="bezier",A=x==="straight"||x==="segments",P=x==="segments",I=R||S||A,D=C||_,M=r.pstyle("source-endpoint"),O=D?"outside-to-node":M.value,N=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,V=r.pstyle("target-endpoint"),$=D?"outside-to-node":V.value,G=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;w.srcManEndpt=M,w.tgtManEndpt=V;var U,J,W,H,Z=(e=(V==null||(t=V.pfValue)===null||t===void 0?void 0:t.length)===2?V.pfValue:null)!==null&&e!==void 0?e:[0,0],ne=(n=(M==null||(a=M.pfValue)===null||a===void 0?void 0:a.length)===2?M.pfValue:null)!==null&&n!==void 0?n:[0,0];if(R){var F=[w.ctrlpts[0],w.ctrlpts[1]],z=S?[w.ctrlpts[w.ctrlpts.length-2],w.ctrlpts[w.ctrlpts.length-1]]:F;U=z,J=F}else if(A){var j=P?w.segpts.slice(0,2):[c.x+Z[0],c.y+Z[1]],ee=P?w.segpts.slice(w.segpts.length-2):[l.x+ne[0],l.y+ne[1]];U=ee,J=j}if($==="inside-to-node")o=[c.x,c.y];else if(V.units)o=this.manualEndptToPx(u,V);else if($==="outside-to-line")o=w.tgtIntn;else if($==="outside-to-node"||$==="outside-to-node-or-label"?W=U:($==="outside-to-line"||$==="outside-to-line-or-label")&&(W=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(c.x,c.y,u.outerWidth(),u.outerHeight(),W[0],W[1],0,G,m),$==="outside-to-node-or-label"||$==="outside-to-line-or-label"){var ie=u._private.rscratch,oe=ie.labelWidth,Y=ie.labelHeight,X=ie.labelX,re=ie.labelY,le=oe/2,he=Y/2,be=u.pstyle("text-valign").value;be==="top"?re-=he:be==="bottom"&&(re+=he);var fe=u.pstyle("text-halign").value;fe==="left"?X-=le:fe==="right"&&(X+=le);var ue=Jo(W[0],W[1],[X-le,re-he,X+le,re-he,X+le,re+he,X-le,re+he],c.x,c.y);if(ue.length>0){var Se=l,Ae=Ya(Se,Gi(o)),Te=Ya(Se,Gi(ue)),Pe=Ae;if(Te<Ae&&(o=ue,Pe=Te),ue.length>2){var Ie=Ya(Se,{x:ue[2],y:ue[3]});Ie<Pe&&(o=[ue[2],ue[3]])}}}var Le=yu(o,U,i.arrowShapes[v].spacing(r)+g),Fe=yu(o,U,i.arrowShapes[v].gap(r)+g);if(w.endX=Fe[0],w.endY=Fe[1],w.arrowEndX=Le[0],w.arrowEndY=Le[1],O==="inside-to-node")o=[l.x,l.y];else if(M.units)o=this.manualEndptToPx(s,M);else if(O==="outside-to-line")o=w.srcIntn;else if(O==="outside-to-node"||O==="outside-to-node-or-label"?H=J:(O==="outside-to-line"||O==="outside-to-line-or-label")&&(H=[c.x,c.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),H[0],H[1],0,N,E),O==="outside-to-node-or-label"||O==="outside-to-line-or-label"){var je=s._private.rscratch,lr=je.labelWidth,ir=je.labelHeight,Xe=je.labelX,fr=je.labelY,Ue=lr/2,Oe=ir/2,ge=s.pstyle("text-valign").value;ge==="top"?fr-=Oe:ge==="bottom"&&(fr+=Oe);var L=s.pstyle("text-halign").value;L==="left"?Xe-=Ue:L==="right"&&(Xe+=Ue);var se=Jo(H[0],H[1],[Xe-Ue,fr-Oe,Xe+Ue,fr-Oe,Xe+Ue,fr+Oe,Xe-Ue,fr+Oe],l.x,l.y);if(se.length>0){var de=c,ve=Ya(de,Gi(o)),ye=Ya(de,Gi(se)),Me=ve;if(ye<ve&&(o=[se[0],se[1]],Me=ye),se.length>2){var _e=Ya(de,{x:se[2],y:se[3]});_e<Me&&(o=[se[2],se[3]])}}}var ze=yu(o,J,i.arrowShapes[h].spacing(r)+p),qe=yu(o,J,i.arrowShapes[h].gap(r)+p);w.startX=qe[0],w.startY=qe[1],w.arrowStartX=ze[0],w.arrowStartY=ze[1],I&&(!De(w.startX)||!De(w.startY)||!De(w.endX)||!De(w.endY)?w.badLine=!0:w.badLine=!1)};ys.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};ys.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Hm={};function t$(r,e,t){for(var n=function(l,c,v,h){return at(l,c,v,h)},a=e._private,i=a.rstyle.bezierPts,o=0;o<r.bezierProjPcts.length;o++){var s=r.bezierProjPcts[o];i.push({x:n(t[0],t[2],t[4],s),y:n(t[1],t[3],t[5],s)})}}Hm.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,n=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<t.allpts.length;a+=4)t$(this,r,t.allpts.slice(a,a+6))}else if(n==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<t.allpts.length;a+=2)i.push({x:t.allpts[a],y:t.allpts[a+1]});else if(n==="haystack"){var o=t.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};Hm.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Bn={};Bn.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!xa(e)){var t,n,a=r._private,i=r.width(),o=r.height(),s=r.padding(),u=r.position(),l=r.pstyle("text-halign").strValue,c=r.pstyle("text-valign").strValue,v=a.rscratch,h=a.rstyle;switch(l){case"left":t=u.x-i/2-s;break;case"right":t=u.x+i/2+s;break;default:t=u.x}switch(c){case"top":n=u.y-o/2-s;break;case"bottom":n=u.y+o/2+s;break;default:n=u.y}v.labelX=t,v.labelY=n,h.labelX=t,h.labelY=n,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var dA=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},vA=function(e,t){var n=t.x-e.x,a=t.y-e.y;return dA(n,a)},n$=function(e,t,n,a){var i=Qo(0,a-.001,1),o=Qo(0,a+.001,1),s=Ki(e,t,n,i),u=Ki(e,t,n,o);return vA(s,u)};Bn.recalculateEdgeLabelProjections=function(r){var e,t=r._private,n=t.rscratch,a=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:n.midX,y:n.midY};var o=function(v,h,g){Hn(t.rscratch,v,h,g),Hn(t.rstyle,v,h,g)};o("labelX",null,e.x),o("labelY",null,e.y);var s=dA(n.midDispX,n.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var v=[],h=0;h+5<n.allpts.length;h+=4){var g={x:n.allpts[h],y:n.allpts[h+1]},p={x:n.allpts[h+2],y:n.allpts[h+3]},E={x:n.allpts[h+4],y:n.allpts[h+5]};v.push({p0:g,p1:p,p2:E,startDist:0,length:0,segments:[]})}var m=t.rstyle.bezierPts,b=a.bezierProjPcts.length;function w(S,A,P,I,D){var M=ni(A,P),O=S.segments[S.segments.length-1],N={p0:A,p1:P,t0:I,t1:D,startDist:O?O.startDist+O.length:0,length:M};S.segments.push(N),S.length+=M}for(var x=0;x<v.length;x++){var _=v[x],C=v[x-1];C&&(_.startDist=C.startDist+C.length),w(_,_.p0,m[x*b],0,a.bezierProjPcts[0]);for(var R=0;R<b-1;R++)w(_,m[x*b+R],m[x*b+R+1],a.bezierProjPcts[R],a.bezierProjPcts[R+1]);w(_,m[x*b+b-1],_.p2,a.bezierProjPcts[b-1],1)}return u.cache=v},l=function(v){var h,g=v==="source";if(i[v]){var p=r.pstyle(v+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var E=u(),m,b=0,w=0,x=0;x<E.length;x++){for(var _=E[g?x:E.length-1-x],C=0;C<_.segments.length;C++){var R=_.segments[g?C:_.segments.length-1-C],S=x===E.length-1&&C===_.segments.length-1;if(b=w,w+=R.length,w>=p||S){m={cp:_,segment:R};break}}if(m)break}var A=m.cp,P=m.segment,I=(p-b)/P.length,D=P.t1-P.t0,M=g?P.t0+D*I:P.t1-D*I;M=Qo(0,M,1),e=Ki(A.p0,A.p1,A.p2,M),h=n$(A.p0,A.p1,A.p2,M);break}case"straight":case"segments":case"haystack":{for(var O=0,N,V,$,G,U=n.allpts.length,J=0;J+3<U&&(g?($={x:n.allpts[J],y:n.allpts[J+1]},G={x:n.allpts[J+2],y:n.allpts[J+3]}):($={x:n.allpts[U-2-J],y:n.allpts[U-1-J]},G={x:n.allpts[U-4-J],y:n.allpts[U-3-J]}),N=ni($,G),V=O,O+=N,!(O>=p));J+=2);var W=p-V,H=W/N;H=Qo(0,H,1),e=SN($,G,H),h=vA($,G);break}}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,h)}};l("source"),l("target"),this.applyLabelDimensions(r)}};Bn.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Bn.applyPrefixedLabelDimensions=function(r,e){var t=r._private,n=this.getLabelText(r,e),a=ti(n,r._private.labelDimsKey);if(qt(t.rscratch,"prefixedLabelDimsKey",e)!==a){Hn(t.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(r,n),o=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,u=qt(t.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(u.length,1),c=i.height/l,v=c*o,h=i.width,g=i.height+(l-1)*(o-1)*c;Hn(t.rstyle,"labelWidth",e,h),Hn(t.rscratch,"labelWidth",e,h),Hn(t.rstyle,"labelHeight",e,g),Hn(t.rscratch,"labelHeight",e,g),Hn(t.rscratch,"labelLineHeight",e,v)}};Bn.getLabelText=function(r,e){var t=r._private,n=e?e+"-":"",a=r.pstyle(n+"label").strValue,i=r.pstyle("text-transform").value,o=function(ne,F){return F?(Hn(t.rscratch,ne,e,F),F):qt(t.rscratch,ne,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="",c=a.split(`
|
|
15
|
+
`),v=r.pstyle("text-max-width").pfValue,h=r.pstyle("text-overflow-wrap").value,g=h==="anywhere",p=[],E=/[\s\u200b]+|$/g,m=0;m<c.length;m++){var b=c[m],w=this.calculateLabelDimensions(r,b),x=w.width;if(g){var _=b.split("").join(l);b=_}if(x>v){var C=b.matchAll(E),R="",S=0,A=Ft(C),P;try{for(A.s();!(P=A.n()).done;){var I=P.value,D=I[0],M=b.substring(S,I.index);S=I.index+D.length;var O=R.length===0?M:R+M+D,N=this.calculateLabelDimensions(r,O),V=N.width;V<=v?R+=M+D:(R&&p.push(R),R=M+D)}}catch(Z){A.e(Z)}finally{A.f()}R.match(/^[\s\u200b]+$/)||p.push(R)}else p.push(b)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join(`
|
|
16
|
+
`)),o("labelWrapKey",u)}else if(s==="ellipsis"){var $=r.pstyle("text-max-width").pfValue,G="",U="…",J=!1;if(this.calculateLabelDimensions(r,a).width<$)return a;for(var W=0;W<a.length;W++){var H=this.calculateLabelDimensions(r,G+a[W]+U).width;if(H>$)break;G+=a[W],W===a.length-1&&(J=!0)}return J||(G+=U),G}return a};Bn.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Bn.calculateLabelDimensions=function(r,e){var t=this,n=t.cy.window(),a=n.document,i=0,o=r.pstyle("font-style").strValue,s=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,c=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=a.createElement("canvas"),v=this.labelCalcCanvasContext=c.getContext("2d");var h=c.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}v.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var g=0,p=0,E=e.split(`
|
|
17
|
+
`),m=0;m<E.length;m++){var b=E[m],w=v.measureText(b),x=Math.ceil(w.width),_=s;g=Math.max(x,g),p+=_}return g+=i,p+=i,{width:g,height:p}};Bn.calculateLabelAngle=function(r,e){var t=r._private,n=t.rscratch,a=r.isEdge(),i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:a&&s==="autorotate"?n.labelAutoAngle:s==="autorotate"?0:o.pfValue};Bn.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),n=r._private,a=n.rscratch;a.labelAngle=e.calculateLabelAngle(r),t&&(a.sourceLabelAngle=e.calculateLabelAngle(r,"source"),a.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var hA={},Gx=28,Wx=!1;hA.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<Gx||r.height()<Gx))return Wx||(Er("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Wx=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var n=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return t};var wl={};wl.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,n=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],c=l._private,v=c.rstyle;v.clean=!1,v.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(o){var s=o.target;n(s)}).on("style.* background.*",function(o){var s=o.target;n(s,!1)});var a=function(o){if(o){var s=t.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],c=l._private.rstyle;l.isNode()&&!c.cleanConnected&&(n(l.connectedEdges()),c.cleanConnected=!0)}if(s)for(var v=0;v<s.length;v++){var h=s[v];h(o,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){a(!0)},t.beforeRender(a,t.beforeRenderPriorities.eleCalcs)};wl.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};wl.recalculateRenderedStyle=function(r,e){var t=function(_){return _._private.rstyle.cleanConnected};if(r.length!==0){var n=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var o=r[i],s=o._private,u=s.rstyle;o.isEdge()&&(!t(o.source())||!t(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(x){return!x._private.rstyle.clean&&x.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?a.push(o):n.push(o),u.clean=!0)}for(var l=0;l<a.length;l++){var c=a[l],v=c._private,h=v.rstyle,g=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=g.x,h.nodeY=g.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var p=0;p<n.length;p++){var E=n[p],m=E._private,b=m.rstyle,w=m.rscratch;b.srcX=w.arrowStartX,b.srcY=w.arrowStartY,b.tgtX=w.arrowEndX,b.tgtY=w.arrowEndY,b.midX=w.midX,b.midY=w.midY,b.labelAngle=w.labelAngle,b.sourceLabelAngle=w.sourceLabelAngle,b.targetLabelAngle=w.targetLabelAngle}}}};var xl={};xl.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var n=r[t],a=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?r.drag.push(n):r.nondrag.push(n)}for(var t=0;t<e.length;t++){var n=e[t];r.drag.push(n)}}};xl.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};xl.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Y2),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var gA={};[ui,Qu,_t,ys,Hm,Bn,hA,wl,xl].forEach(function(r){He(gA,r)});var pA={};pA.getCachedImage=function(r,e,t){var n=this,a=n.imageCache=n.imageCache||{},i=a[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=a[r]=a[r]||{};var o=i.image=new Image;o.addEventListener("load",t),o.addEventListener("error",function(){o.error=!0});var s="data:",u=r.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=r,o};var io={};io.registerBinding=function(r,e,t,n){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],o=0;o<r.length;o++){var s=r[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,a))}}return i}var u=this.binder(r);return u.on.apply(u,a)};io.binder=function(r){var e=this,t=e.cy.window(),n=r===t||r===t.document||r===t.document.body||gq(r);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var o=function(u,l,c){var v=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(v[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:v}),(r.addEventListener||r.on).apply(r,v),this};return{on:o,addEventListener:o,addListener:o,bind:o}};io.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};io.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};io.load=function(){var r=this,e=r.cy.window(),t=function(L){return L.selected()},n=function(L){var se=L.getRootNode();if(se&&se.nodeType===11&&se.host!==void 0)return se},a=function(L,se,de,ve){L==null&&(L=r.cy);for(var ye=0;ye<se.length;ye++){var Me=se[ye];L.emit({originalEvent:de,type:Me,position:ve})}},i=function(L){return L.shiftKey||L.metaKey||L.ctrlKey},o=function(L,se){var de=!0;if(r.cy.hasCompoundNodes()&&L&&L.pannable())for(var ve=0;se&&ve<se.length;ve++){var L=se[ve];if(L.isNode()&&L.isParent()&&!L.pannable()){de=!1;break}}else de=!0;return de},s=function(L){L[0]._private.grabbed=!0},u=function(L){L[0]._private.grabbed=!1},l=function(L){L[0]._private.rscratch.inDragLayer=!0},c=function(L){L[0]._private.rscratch.inDragLayer=!1},v=function(L){L[0]._private.rscratch.isGrabTarget=!0},h=function(L){L[0]._private.rscratch.isGrabTarget=!1},g=function(L,se){var de=se.addToList,ve=de.has(L);!ve&&L.grabbable()&&!L.locked()&&(de.merge(L),s(L))},p=function(L,se){if(L.cy().hasCompoundNodes()&&!(se.inDragLayer==null&&se.addToList==null)){var de=L.descendants();se.inDragLayer&&(de.forEach(l),de.connectedEdges().forEach(l)),se.addToList&&g(de,se)}},E=function(L,se){se=se||{};var de=L.cy().hasCompoundNodes();se.inDragLayer&&(L.forEach(l),L.neighborhood().stdFilter(function(ve){return!de||ve.isEdge()}).forEach(l)),se.addToList&&L.forEach(function(ve){g(ve,se)}),p(L,se),w(L,{inDragLayer:se.inDragLayer}),r.updateCachedGrabbedEles()},m=E,b=function(L){L&&(r.getCachedZSortedEles().forEach(function(se){u(se),c(se),h(se)}),r.updateCachedGrabbedEles())},w=function(L,se){if(!(se.inDragLayer==null&&se.addToList==null)&&L.cy().hasCompoundNodes()){var de=L.ancestors().orphans();if(!de.same(L)){var ve=de.descendants().spawnSelf().merge(de).unmerge(L).unmerge(L.descendants()),ye=ve.connectedEdges();se.inDragLayer&&(ye.forEach(l),ve.forEach(l)),se.addToList&&ve.forEach(function(Me){g(Me,se)})}}},x=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},_=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";_?(r.removeObserver=new MutationObserver(function(ge){for(var L=0;L<ge.length;L++){var se=ge[L],de=se.removedNodes;if(de)for(var ve=0;ve<de.length;ve++){var ye=de[ve];if(ye===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(ge){r.destroy()});var R=vs(function(){r.cy.resize()},100);_&&(r.styleObserver=new MutationObserver(R),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",R),C&&(r.resizeObserver=new ResizeObserver(R),r.resizeObserver.observe(r.container));var S=function(L,se){for(;L!=null;)se(L),L=L.parentNode},A=function(){r.invalidateContainerClientCoordsCache()};S(r.container,function(ge){r.registerBinding(ge,"transitionend",A),r.registerBinding(ge,"animationend",A),r.registerBinding(ge,"scroll",A)}),r.registerBinding(r.container,"contextmenu",function(ge){ge.preventDefault()});var P=function(){return r.selection[4]!==0},I=function(L){for(var se=r.findContainerClientCoords(),de=se[0],ve=se[1],ye=se[2],Me=se[3],_e=L.touches?L.touches:[L],ze=!1,qe=0;qe<_e.length;qe++){var We=_e[qe];if(de<=We.clientX&&We.clientX<=de+ye&&ve<=We.clientY&&We.clientY<=ve+Me){ze=!0;break}}if(!ze)return!1;for(var nr=r.container,er=L.target,$e=er.parentNode,or=!1;$e;){if($e===nr){or=!0;break}$e=$e.parentNode}return!!or};r.registerBinding(r.container,"mousedown",function(L){if(I(L)&&!(r.hoverData.which===1&&L.which!==1)){L.preventDefault(),x(),r.hoverData.capture=!0,r.hoverData.which=L.which;var se=r.cy,de=[L.clientX,L.clientY],ve=r.projectIntoViewport(de[0],de[1]),ye=r.selection,Me=r.findNearestElements(ve[0],ve[1],!0,!1),_e=Me[0],ze=r.dragData.possibleDragElements;r.hoverData.mdownPos=ve,r.hoverData.mdownGPos=de;var qe=function(rr){return{originalEvent:L,type:rr,position:{x:ve[0],y:ve[1]}}},We=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var rr=r.hoverData.down;rr?rr.emit(qe("taphold")):se.emit(qe("taphold"))}},r.tapholdDuration)};if(L.which==3){r.hoverData.cxtStarted=!0;var nr={originalEvent:L,type:"cxttapstart",position:{x:ve[0],y:ve[1]}};_e?(_e.activate(),_e.emit(nr),r.hoverData.down=_e):se.emit(nr),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(L.which==1){_e&&_e.activate();{if(_e!=null&&r.nodeIsGrabbable(_e)){var er=function(rr){rr.emit(qe("grab"))};if(v(_e),!_e.selected())ze=r.dragData.possibleDragElements=se.collection(),m(_e,{addToList:ze}),_e.emit(qe("grabon")).emit(qe("grab"));else{ze=r.dragData.possibleDragElements=se.collection();var $e=se.$(function(or){return or.isNode()&&or.selected()&&r.nodeIsGrabbable(or)});E($e,{addToList:ze}),_e.emit(qe("grabon")),$e.forEach(er)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=_e,r.hoverData.downs=Me,r.hoverData.downTime=new Date().getTime()}a(_e,["mousedown","tapstart","vmousedown"],L,{x:ve[0],y:ve[1]}),_e==null?(ye[4]=1,r.data.bgActivePosistion={x:ve[0],y:ve[1]},r.redrawHint("select",!0),r.redraw()):_e.pannable()&&(ye[4]=1),We()}ye[0]=ye[2]=ve[0],ye[1]=ye[3]=ve[1]}},!1);var D=n(r.container);r.registerBinding([e,D],"mousemove",function(L){var se=r.hoverData.capture;if(!(!se&&!I(L))){var de=!1,ve=r.cy,ye=ve.zoom(),Me=[L.clientX,L.clientY],_e=r.projectIntoViewport(Me[0],Me[1]),ze=r.hoverData.mdownPos,qe=r.hoverData.mdownGPos,We=r.selection,nr=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(nr=r.findNearestElement(_e[0],_e[1],!0,!1));var er=r.hoverData.last,$e=r.hoverData.down,or=[_e[0]-We[2],_e[1]-We[3]],rr=r.dragData.possibleDragElements,Vr;if(qe){var Ir=Me[0]-qe[0],st=Ir*Ir,Br=Me[1]-qe[1],Ur=Br*Br,Lr=st+Ur;r.hoverData.isOverThresholdDrag=Vr=Lr>=r.desktopTapThreshold2}var Yr=i(L);Vr&&(r.hoverData.tapholdCancelled=!0);var En=function(){var Bt=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Bt.length===0?(Bt.push(or[0]),Bt.push(or[1])):(Bt[0]+=or[0],Bt[1]+=or[1])};de=!0,a(nr,["mousemove","vmousemove","tapdrag"],L,{x:_e[0],y:_e[1]});var Fr=function(Bt){return{originalEvent:L,type:Bt,position:{x:_e[0],y:_e[1]}}},cn=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||ve.emit(Fr("boxstart")),We[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Vr){var dn=Fr("cxtdrag");$e?$e.emit(dn):ve.emit(dn),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||nr!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(Fr("cxtdragout")),r.hoverData.cxtOver=nr,nr&&nr.emit(Fr("cxtdragover")))}}else if(r.hoverData.dragging){if(de=!0,ve.panningEnabled()&&ve.userPanningEnabled()){var ea;if(r.hoverData.justStartedPan){var hi=r.hoverData.mdownPos;ea={x:(_e[0]-hi[0])*ye,y:(_e[1]-hi[1])*ye},r.hoverData.justStartedPan=!1}else ea={x:or[0]*ye,y:or[1]*ye};ve.panBy(ea),ve.emit(Fr("dragpan")),r.hoverData.dragged=!0}_e=r.projectIntoViewport(L.clientX,L.clientY)}else if(We[4]==1&&($e==null||$e.pannable())){if(Vr){if(!r.hoverData.dragging&&ve.boxSelectionEnabled()&&(Yr||!ve.panningEnabled()||!ve.userPanningEnabled()))cn();else if(!r.hoverData.selecting&&ve.panningEnabled()&&ve.userPanningEnabled()){var kn=o($e,r.hoverData.downs);kn&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,We[4]=0,r.data.bgActivePosistion=Gi(ze),r.redrawHint("select",!0),r.redraw())}$e&&$e.pannable()&&$e.active()&&$e.unactivate()}}else{if($e&&$e.pannable()&&$e.active()&&$e.unactivate(),(!$e||!$e.grabbed())&&nr!=er&&(er&&a(er,["mouseout","tapdragout"],L,{x:_e[0],y:_e[1]}),nr&&a(nr,["mouseover","tapdragover"],L,{x:_e[0],y:_e[1]}),r.hoverData.last=nr),$e)if(Vr){if(ve.boxSelectionEnabled()&&Yr)$e&&$e.grabbed()&&(b(rr),$e.emit(Fr("freeon")),rr.emit(Fr("free")),r.dragData.didDrag&&($e.emit(Fr("dragfreeon")),rr.emit(Fr("dragfree")))),cn();else if($e&&$e.grabbed()&&r.nodeIsDraggable($e)){var ut=!r.dragData.didDrag;ut&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||E(rr,{inDragLayer:!0});var tt={x:0,y:0};if(De(or[0])&&De(or[1])&&(tt.x+=or[0],tt.y+=or[1],ut)){var pt=r.hoverData.dragDelta;pt&&De(pt[0])&&De(pt[1])&&(tt.x+=pt[0],tt.y+=pt[1])}r.hoverData.draggingEles=!0,rr.silentShift(tt).emit(Fr("position")).emit(Fr("drag")),r.redrawHint("drag",!0),r.redraw()}}else En();de=!0}if(We[2]=_e[0],We[3]=_e[1],de)return L.stopPropagation&&L.stopPropagation(),L.preventDefault&&L.preventDefault(),!1}},!1);var M,O,N;r.registerBinding(e,"mouseup",function(L){if(!(r.hoverData.which===1&&L.which!==1&&r.hoverData.capture)){var se=r.hoverData.capture;if(se){r.hoverData.capture=!1;var de=r.cy,ve=r.projectIntoViewport(L.clientX,L.clientY),ye=r.selection,Me=r.findNearestElement(ve[0],ve[1],!0,!1),_e=r.dragData.possibleDragElements,ze=r.hoverData.down,qe=i(L);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ze&&ze.unactivate();var We=function(Ir){return{originalEvent:L,type:Ir,position:{x:ve[0],y:ve[1]}}};if(r.hoverData.which===3){var nr=We("cxttapend");if(ze?ze.emit(nr):de.emit(nr),!r.hoverData.cxtDragged){var er=We("cxttap");ze?ze.emit(er):de.emit(er)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(Me,["mouseup","tapend","vmouseup"],L,{x:ve[0],y:ve[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(ze,["click","tap","vclick"],L,{x:ve[0],y:ve[1]}),O=!1,L.timeStamp-N<=de.multiClickDebounceTime()?(M&&clearTimeout(M),O=!0,N=null,a(ze,["dblclick","dbltap","vdblclick"],L,{x:ve[0],y:ve[1]})):(M=setTimeout(function(){O||a(ze,["oneclick","onetap","voneclick"],L,{x:ve[0],y:ve[1]})},de.multiClickDebounceTime()),N=L.timeStamp)),ze==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(L)&&(de.$(t).unselect(["tapunselect"]),_e.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=_e=de.collection()),Me==ze&&!r.dragData.didDrag&&!r.hoverData.selecting&&Me!=null&&Me._private.selectable&&(r.hoverData.dragging||(de.selectionType()==="additive"||qe?Me.selected()?Me.unselect(["tapunselect"]):Me.select(["tapselect"]):qe||(de.$(t).unmerge(Me).unselect(["tapunselect"]),Me.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var $e=de.collection(r.getAllInBox(ye[0],ye[1],ye[2],ye[3]));r.redrawHint("select",!0),$e.length>0&&r.redrawHint("eles",!0),de.emit(We("boxend"));var or=function(Ir){return Ir.selectable()&&!Ir.selected()};de.selectionType()==="additive"||qe||de.$(t).unmerge($e).unselect(),$e.emit(We("box")).stdFilter(or).select().emit(We("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!ye[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var rr=ze&&ze.grabbed();b(_e),rr&&(ze.emit(We("freeon")),_e.emit(We("free")),r.dragData.didDrag&&(ze.emit(We("dragfreeon")),_e.emit(We("dragfree"))))}}ye[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 V=[],$=4,G,U=1e5,J=function(L,se){for(var de=0;de<L.length;de++)if(L[de]%se!==0)return!1;return!0},W=function(L){for(var se=Math.abs(L[0]),de=1;de<L.length;de++)if(Math.abs(L[de])!==se)return!1;return!0},H=function(L){var se=!1,de=L.deltaY;if(de==null&&(L.wheelDeltaY!=null?de=L.wheelDeltaY/4:L.wheelDelta!=null&&(de=L.wheelDelta/4)),de!==0){if(G==null)if(V.length>=$){var ve=V;if(G=J(ve,5),!G){var ye=Math.abs(ve[0]);G=W(ve)&&ye>5}if(G)for(var Me=0;Me<ve.length;Me++)U=Math.min(Math.abs(ve[Me]),U)}else V.push(de),se=!0;else G&&(U=Math.min(Math.abs(de),U));if(!r.scrollingPage){var _e=r.cy,ze=_e.zoom(),qe=_e.pan(),We=r.projectIntoViewport(L.clientX,L.clientY),nr=[We[0]*ze+qe.x,We[1]*ze+qe.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||P()){L.preventDefault();return}if(_e.panningEnabled()&&_e.userPanningEnabled()&&_e.zoomingEnabled()&&_e.userZoomingEnabled()){L.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 er;se&&Math.abs(de)>5&&(de=Bm(de)*5),er=de/-250,G&&(er/=U,er*=3),er=er*r.wheelSensitivity;var $e=L.deltaMode===1;$e&&(er*=33);var or=_e.zoom()*Math.pow(10,er);L.type==="gesturechange"&&(or=r.gestureStartZoom*L.scale),_e.zoom({level:or,renderedPosition:{x:nr[0],y:nr[1]}}),_e.emit({type:L.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:L,position:{x:We[0],y:We[1]}})}}}};r.registerBinding(r.container,"wheel",H,!0),r.registerBinding(e,"scroll",function(L){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(L){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||L.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(ge){r.hasTouchStarted||H(ge)},!0),r.registerBinding(r.container,"mouseout",function(L){var se=r.projectIntoViewport(L.clientX,L.clientY);r.cy.emit({originalEvent:L,type:"mouseout",position:{x:se[0],y:se[1]}})},!1),r.registerBinding(r.container,"mouseover",function(L){var se=r.projectIntoViewport(L.clientX,L.clientY);r.cy.emit({originalEvent:L,type:"mouseover",position:{x:se[0],y:se[1]}})},!1);var Z,ne,F,z,j,ee,ie,oe,Y,X,re,le,he,be=function(L,se,de,ve){return Math.sqrt((de-L)*(de-L)+(ve-se)*(ve-se))},fe=function(L,se,de,ve){return(de-L)*(de-L)+(ve-se)*(ve-se)},ue;r.registerBinding(r.container,"touchstart",ue=function(L){if(r.hasTouchStarted=!0,!!I(L)){x(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var se=r.cy,de=r.touchData.now,ve=r.touchData.earlier;if(L.touches[0]){var ye=r.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);de[0]=ye[0],de[1]=ye[1]}if(L.touches[1]){var ye=r.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);de[2]=ye[0],de[3]=ye[1]}if(L.touches[2]){var ye=r.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);de[4]=ye[0],de[5]=ye[1]}var Me=function(Yr){return{originalEvent:L,type:Yr,position:{x:de[0],y:de[1]}}};if(L.touches[1]){r.touchData.singleTouchMoved=!0,b(r.dragData.touchDragEles);var _e=r.findContainerClientCoords();Y=_e[0],X=_e[1],re=_e[2],le=_e[3],Z=L.touches[0].clientX-Y,ne=L.touches[0].clientY-X,F=L.touches[1].clientX-Y,z=L.touches[1].clientY-X,he=0<=Z&&Z<=re&&0<=F&&F<=re&&0<=ne&&ne<=le&&0<=z&&z<=le;var ze=se.pan(),qe=se.zoom();j=be(Z,ne,F,z),ee=fe(Z,ne,F,z),ie=[(Z+F)/2,(ne+z)/2],oe=[(ie[0]-ze.x)/qe,(ie[1]-ze.y)/qe];var We=200,nr=We*We;if(ee<nr&&!L.touches[2]){var er=r.findNearestElement(de[0],de[1],!0,!0),$e=r.findNearestElement(de[2],de[3],!0,!0);er&&er.isNode()?(er.activate().emit(Me("cxttapstart")),r.touchData.start=er):$e&&$e.isNode()?($e.activate().emit(Me("cxttapstart")),r.touchData.start=$e):se.emit(Me("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(L.touches[2])se.boxSelectionEnabled()&&L.preventDefault();else if(!L.touches[1]){if(L.touches[0]){var or=r.findNearestElements(de[0],de[1],!0,!0),rr=or[0];if(rr!=null&&(rr.activate(),r.touchData.start=rr,r.touchData.starts=or,r.nodeIsGrabbable(rr))){var Vr=r.dragData.touchDragEles=se.collection(),Ir=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),rr.selected()?(Ir=se.$(function(Lr){return Lr.selected()&&r.nodeIsGrabbable(Lr)}),E(Ir,{addToList:Vr})):m(rr,{addToList:Vr}),v(rr),rr.emit(Me("grabon")),Ir?Ir.forEach(function(Lr){Lr.emit(Me("grab"))}):rr.emit(Me("grab"))}a(rr,["touchstart","tapstart","vmousedown"],L,{x:de[0],y:de[1]}),rr==null&&(r.data.bgActivePosistion={x:ye[0],y:ye[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&&a(r.touchData.start,["taphold"],L,{x:de[0],y:de[1]})},r.tapholdDuration)}}if(L.touches.length>=1){for(var st=r.touchData.startPosition=[null,null,null,null,null,null],Br=0;Br<de.length;Br++)st[Br]=ve[Br]=de[Br];var Ur=L.touches[0];r.touchData.startGPosition=[Ur.clientX,Ur.clientY]}}},!1);var Se;r.registerBinding(e,"touchmove",Se=function(L){var se=r.touchData.capture;if(!(!se&&!I(L))){var de=r.selection,ve=r.cy,ye=r.touchData.now,Me=r.touchData.earlier,_e=ve.zoom();if(L.touches[0]){var ze=r.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);ye[0]=ze[0],ye[1]=ze[1]}if(L.touches[1]){var ze=r.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);ye[2]=ze[0],ye[3]=ze[1]}if(L.touches[2]){var ze=r.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);ye[4]=ze[0],ye[5]=ze[1]}var qe=function(bi){return{originalEvent:L,type:bi,position:{x:ye[0],y:ye[1]}}},We=r.touchData.startGPosition,nr;if(se&&L.touches[0]&&We){for(var er=[],$e=0;$e<ye.length;$e++)er[$e]=ye[$e]-Me[$e];var or=L.touches[0].clientX-We[0],rr=or*or,Vr=L.touches[0].clientY-We[1],Ir=Vr*Vr,st=rr+Ir;nr=st>=r.touchTapThreshold2}if(se&&r.touchData.cxt){L.preventDefault();var Br=L.touches[0].clientX-Y,Ur=L.touches[0].clientY-X,Lr=L.touches[1].clientX-Y,Yr=L.touches[1].clientY-X,En=fe(Br,Ur,Lr,Yr),Fr=En/ee,cn=150,dn=cn*cn,ea=1.5,hi=ea*ea;if(Fr>=hi||En>=dn){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var kn=qe("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(kn),r.touchData.start=null):ve.emit(kn)}}if(se&&r.touchData.cxt){var kn=qe("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(kn):ve.emit(kn),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var ut=r.findNearestElement(ye[0],ye[1],!0,!0);(!r.touchData.cxtOver||ut!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(qe("cxtdragout")),r.touchData.cxtOver=ut,ut&&ut.emit(qe("cxtdragover")))}else if(se&&L.touches[2]&&ve.boxSelectionEnabled())L.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||ve.emit(qe("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,de[4]=1,!de||de.length===0||de[0]===void 0?(de[0]=(ye[0]+ye[2]+ye[4])/3,de[1]=(ye[1]+ye[3]+ye[5])/3,de[2]=(ye[0]+ye[2]+ye[4])/3+1,de[3]=(ye[1]+ye[3]+ye[5])/3+1):(de[2]=(ye[0]+ye[2]+ye[4])/3,de[3]=(ye[1]+ye[3]+ye[5])/3),r.redrawHint("select",!0),r.redraw();else if(se&&L.touches[1]&&!r.touchData.didSelect&&ve.zoomingEnabled()&&ve.panningEnabled()&&ve.userZoomingEnabled()&&ve.userPanningEnabled()){L.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var tt=r.dragData.touchDragEles;if(tt){r.redrawHint("drag",!0);for(var pt=0;pt<tt.length;pt++){var La=tt[pt]._private;La.grabbed=!1,La.rscratch.inDragLayer=!1}}var Bt=r.touchData.start,Br=L.touches[0].clientX-Y,Ur=L.touches[0].clientY-X,Lr=L.touches[1].clientX-Y,Yr=L.touches[1].clientY-X,Ss=be(Br,Ur,Lr,Yr),$l=Ss/j;if(he){var gi=Br-Z,Vl=Ur-ne,pi=Lr-F,Gl=Yr-z,Wl=(gi+pi)/2,Ul=(Vl+Gl)/2,ra=ve.zoom(),yi=ra*$l,qa=ve.pan(),Ts=oe[0]*ra+qa.x,Rs=oe[1]*ra+qa.y,Hl={x:-yi/ra*(Ts-qa.x-Wl)+Ts,y:-yi/ra*(Rs-qa.y-Ul)+Rs};if(Bt&&Bt.active()){var tt=r.dragData.touchDragEles;b(tt),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Bt.unactivate().emit(qe("freeon")),tt.emit(qe("free")),r.dragData.didDrag&&(Bt.emit(qe("dragfreeon")),tt.emit(qe("dragfree")))}ve.viewport({zoom:yi,pan:Hl,cancelOnFailedZoom:!0}),ve.emit(qe("pinchzoom")),j=Ss,Z=Br,ne=Ur,F=Lr,z=Yr,r.pinching=!0}if(L.touches[0]){var ze=r.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);ye[0]=ze[0],ye[1]=ze[1]}if(L.touches[1]){var ze=r.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);ye[2]=ze[0],ye[3]=ze[1]}if(L.touches[2]){var ze=r.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);ye[4]=ze[0],ye[5]=ze[1]}}else if(L.touches[0]&&!r.touchData.didSelect){var $t=r.touchData.start,mi=r.touchData.last,ut;if(!r.hoverData.draggingEles&&!r.swipePanning&&(ut=r.findNearestElement(ye[0],ye[1],!0,!0)),se&&$t!=null&&L.preventDefault(),se&&$t!=null&&r.nodeIsDraggable($t))if(nr){var tt=r.dragData.touchDragEles,vo=!r.dragData.didDrag;vo&&E(tt,{inDragLayer:!0}),r.dragData.didDrag=!0;var ta={x:0,y:0};if(De(er[0])&&De(er[1])&&(ta.x+=er[0],ta.y+=er[1],vo)){r.redrawHint("eles",!0);var Ct=r.touchData.dragDelta;Ct&&De(Ct[0])&&De(Ct[1])&&(ta.x+=Ct[0],ta.y+=Ct[1])}r.hoverData.draggingEles=!0,tt.silentShift(ta).emit(qe("position")).emit(qe("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==Me[0]&&r.touchData.startPosition[1]==Me[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Ct=r.touchData.dragDelta=r.touchData.dragDelta||[];Ct.length===0?(Ct.push(er[0]),Ct.push(er[1])):(Ct[0]+=er[0],Ct[1]+=er[1])}if(a($t||ut,["touchmove","tapdrag","vmousemove"],L,{x:ye[0],y:ye[1]}),(!$t||!$t.grabbed())&&ut!=mi&&(mi&&mi.emit(qe("tapdragout")),ut&&ut.emit(qe("tapdragover"))),r.touchData.last=ut,se)for(var pt=0;pt<ye.length;pt++)ye[pt]&&r.touchData.startPosition[pt]&&nr&&(r.touchData.singleTouchMoved=!0);if(se&&($t==null||$t.pannable())&&ve.panningEnabled()&&ve.userPanningEnabled()){var Kl=o($t,r.touchData.starts);Kl&&(L.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Gi(r.touchData.startPosition)),r.swipePanning?(ve.panBy({x:er[0]*_e,y:er[1]*_e}),ve.emit(qe("dragpan"))):nr&&(r.swipePanning=!0,ve.panBy({x:or*_e,y:Vr*_e}),ve.emit(qe("dragpan")),$t&&($t.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var ze=r.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);ye[0]=ze[0],ye[1]=ze[1]}}for(var $e=0;$e<ye.length;$e++)Me[$e]=ye[$e];se&&L.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 Ae;r.registerBinding(e,"touchcancel",Ae=function(L){var se=r.touchData.start;r.touchData.capture=!1,se&&se.unactivate()});var Te,Pe,Ie,Le;if(r.registerBinding(e,"touchend",Te=function(L){var se=r.touchData.start,de=r.touchData.capture;if(de)L.touches.length===0&&(r.touchData.capture=!1),L.preventDefault();else return;var ve=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var ye=r.cy,Me=ye.zoom(),_e=r.touchData.now,ze=r.touchData.earlier;if(L.touches[0]){var qe=r.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);_e[0]=qe[0],_e[1]=qe[1]}if(L.touches[1]){var qe=r.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);_e[2]=qe[0],_e[3]=qe[1]}if(L.touches[2]){var qe=r.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);_e[4]=qe[0],_e[5]=qe[1]}var We=function(dn){return{originalEvent:L,type:dn,position:{x:_e[0],y:_e[1]}}};se&&se.unactivate();var nr;if(r.touchData.cxt){if(nr=We("cxttapend"),se?se.emit(nr):ye.emit(nr),!r.touchData.cxtDragged){var er=We("cxttap");se?se.emit(er):ye.emit(er)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!L.touches[2]&&ye.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var $e=ye.collection(r.getAllInBox(ve[0],ve[1],ve[2],ve[3]));ve[0]=void 0,ve[1]=void 0,ve[2]=void 0,ve[3]=void 0,ve[4]=0,r.redrawHint("select",!0),ye.emit(We("boxend"));var or=function(dn){return dn.selectable()&&!dn.selected()};$e.emit(We("box")).stdFilter(or).select().emit(We("boxselect")),$e.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(se!=null&&se.unactivate(),L.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!L.touches[1]){if(!L.touches[0]){if(!L.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var rr=r.dragData.touchDragEles;if(se!=null){var Vr=se._private.grabbed;b(rr),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Vr&&(se.emit(We("freeon")),rr.emit(We("free")),r.dragData.didDrag&&(se.emit(We("dragfreeon")),rr.emit(We("dragfree")))),a(se,["touchend","tapend","vmouseup","tapdragout"],L,{x:_e[0],y:_e[1]}),se.unactivate(),r.touchData.start=null}else{var Ir=r.findNearestElement(_e[0],_e[1],!0,!0);a(Ir,["touchend","tapend","vmouseup","tapdragout"],L,{x:_e[0],y:_e[1]})}var st=r.touchData.startPosition[0]-_e[0],Br=st*st,Ur=r.touchData.startPosition[1]-_e[1],Lr=Ur*Ur,Yr=Br+Lr,En=Yr*Me*Me;r.touchData.singleTouchMoved||(se||ye.$(":selected").unselect(["tapunselect"]),a(se,["tap","vclick"],L,{x:_e[0],y:_e[1]}),Pe=!1,L.timeStamp-Le<=ye.multiClickDebounceTime()?(Ie&&clearTimeout(Ie),Pe=!0,Le=null,a(se,["dbltap","vdblclick"],L,{x:_e[0],y:_e[1]})):(Ie=setTimeout(function(){Pe||a(se,["onetap","voneclick"],L,{x:_e[0],y:_e[1]})},ye.multiClickDebounceTime()),Le=L.timeStamp)),se!=null&&!r.dragData.didDrag&&se._private.selectable&&En<r.touchTapThreshold2&&!r.pinching&&(ye.selectionType()==="single"?(ye.$(t).unmerge(se).unselect(["tapunselect"]),se.select(["tapselect"])):se.selected()?se.unselect(["tapunselect"]):se.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var Fr=0;Fr<_e.length;Fr++)ze[Fr]=_e[Fr];r.dragData.didDrag=!1,L.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),L.touches.length<2&&(L.touches.length===1&&(r.touchData.startGPosition=[L.touches[0].clientX,L.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var Fe=[],je=function(L){return{clientX:L.clientX,clientY:L.clientY,force:1,identifier:L.pointerId,pageX:L.pageX,pageY:L.pageY,radiusX:L.width/2,radiusY:L.height/2,screenX:L.screenX,screenY:L.screenY,target:L.target}},lr=function(L){return{event:L,touch:je(L)}},ir=function(L){Fe.push(lr(L))},Xe=function(L){for(var se=0;se<Fe.length;se++){var de=Fe[se];if(de.event.pointerId===L.pointerId){Fe.splice(se,1);return}}},fr=function(L){var se=Fe.filter(function(de){return de.event.pointerId===L.pointerId})[0];se.event=L,se.touch=je(L)},Ue=function(L){L.touches=Fe.map(function(se){return se.touch})},Oe=function(L){return L.pointerType==="mouse"||L.pointerType===4};r.registerBinding(r.container,"pointerdown",function(ge){Oe(ge)||(ge.preventDefault(),ir(ge),Ue(ge),ue(ge))}),r.registerBinding(r.container,"pointerup",function(ge){Oe(ge)||(Xe(ge),Ue(ge),Te(ge))}),r.registerBinding(r.container,"pointercancel",function(ge){Oe(ge)||(Xe(ge),Ue(ge),Ae(ge))}),r.registerBinding(r.container,"pointermove",function(ge){Oe(ge)||(ge.preventDefault(),fr(ge),Ue(ge),Se(ge))})}};var Zn={};Zn.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(n,a,i,o,s,u){this.renderer.nodeShapeImpl("polygon",n,a,i,o,s,this.points)},intersectLine:function(n,a,i,o,s,u,l,c){return Jo(s,u,this.points,n,a,i/2,o/2,l)},checkPoint:function(n,a,i,o,s,u,l,c){return Yn(n,a,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:r!=="rectangle",miterBounds:function(n,a,i,o,s,u){return IN(this.points,n,a,i,o,s)}}};Zn.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){return FN(i,o,e,t,n/2+s,a/2+s)},checkPoint:function(e,t,n,a,i,o,s,u){return ei(e,t,a,i,o,s,n)}}};Zn.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(n,a,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===n&&u[l+"-cy"]===a)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=n,u[l+"-cy"]=a;var c=i/2,v=o/2;s=s==="auto"?y2(i,o):s;for(var h=new Array(e.length/2),g=0;g<e.length/2;g++)h[g]={x:n+c*e[g*2],y:a+v*e[g*2+1]};var p,E,m,b,w=h.length;for(E=h[w-1],p=0;p<w;p++)m=h[p%w],b=h[(p+1)%w],u[l][p]=Um(E,m,b,s),E=m,m=b;return u[l]},draw:function(n,a,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",n,a,i,o,s,this.points,this.getOrCreateCorners(a,i,o,s,u,l,"drawCorners"))},intersectLine:function(n,a,i,o,s,u,l,c,v){return $N(s,u,this.points,n,a,i,o,l,this.getOrCreateCorners(n,a,i,o,c,v,"corners"))},checkPoint:function(n,a,i,o,s,u,l,c,v){return NN(n,a,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,c,v,"corners"))}}};Zn.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:At(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){return g2(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){var l=a/2,c=i/2;u=u==="auto"?_a(a,i):u,u=Math.min(l,c,u);var v=u*2;return!!(Yn(e,t,this.points,o,s,a,i-v,[0,-1],n)||Yn(e,t,this.points,o,s,a-v,i,[0,-1],n)||ei(e,t,v,v,o-l+u,s-c+u,n)||ei(e,t,v,v,o+l-u,s-c+u,n)||ei(e,t,v,v,o+l-u,s+c-u,n)||ei(e,t,v,v,o-l+u,s+c-u,n))}}};Zn.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Mm(),points:At(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,null,o)},generateCutTrianglePts:function(e,t,n,a,i){var o=i==="auto"?this.cornerLength:i,s=t/2,u=e/2,l=n-u,c=n+u,v=a-s,h=a+s;return{topLeft:[l,v+o,l+o,v,l+o,v+o],topRight:[c-o,v,c,v+o,c-o,v+o],bottomRight:[c,h-o,c-o,h,c-o,h-o],bottomLeft:[l+o,h,l,h-o,l+o,h-o]}},intersectLine:function(e,t,n,a,i,o,s,u){var l=this.generateCutTrianglePts(n+2*s,a+2*s,e,t,u),c=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Jo(i,o,c,e,t)},checkPoint:function(e,t,n,a,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(Yn(e,t,this.points,o,s,a,i-2*l,[0,-1],n)||Yn(e,t,this.points,o,s,a-2*l,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(a,i,o,s);return Nt(e,t,c.topLeft)||Nt(e,t,c.topRight)||Nt(e,t,c.bottomRight)||Nt(e,t,c.bottomLeft)}}};Zn.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:At(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,o,s,u){var l=.15,c=.5,v=.85,h=this.generateBarrelBezierPts(n+2*s,a+2*s,e,t),g=function(m){var b=Ki({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},l),w=Ki({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},c),x=Ki({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},v);return[m[0],m[1],b.x,b.y,w.x,w.y,x.x,x.y,m[4],m[5]]},p=[].concat(g(h.topLeft),g(h.topRight),g(h.bottomRight),g(h.bottomLeft));return Jo(i,o,p,e,t)},generateBarrelBezierPts:function(e,t,n,a){var i=t/2,o=e/2,s=n-o,u=n+o,l=a-i,c=a+i,v=om(e,t),h=v.heightOffset,g=v.widthOffset,p=v.ctrlPtOffsetPct*e,E={topLeft:[s,l+h,s+p,l,s+g,l],topRight:[u-g,l,u-p,l,u,l+h],bottomRight:[u,c-h,u-p,c,u-g,c],bottomLeft:[s+g,c,s+p,c,s,c-h]};return E.topLeft.isTop=!0,E.topRight.isTop=!0,E.bottomLeft.isBottom=!0,E.bottomRight.isBottom=!0,E},checkPoint:function(e,t,n,a,i,o,s,u){var l=om(a,i),c=l.heightOffset,v=l.widthOffset;if(Yn(e,t,this.points,o,s,a,i-2*c,[0,-1],n)||Yn(e,t,this.points,o,s,a-2*v,i,[0,-1],n))return!0;for(var h=this.generateBarrelBezierPts(a,i,o,s),g=function(A,P,I){var D=I[4],M=I[2],O=I[0],N=I[5],V=I[1],$=Math.min(D,O),G=Math.max(D,O),U=Math.min(N,V),J=Math.max(N,V);if($<=A&&A<=G&&U<=P&&P<=J){var W=VN(D,M,O),H=MN(W[0],W[1],W[2],A),Z=H.filter(function(ne){return 0<=ne&&ne<=1});if(Z.length>0)return Z[0]}return null},p=Object.keys(h),E=0;E<p.length;E++){var m=p[E],b=h[m],w=g(e,t,b);if(w!=null){var x=b[5],_=b[3],C=b[1],R=at(x,_,C,w);if(b.isTop&&R<=t||b.isBottom&&t<=R)return!0}}return!1}}};Zn.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:At(4,0),draw:function(e,t,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,o)},intersectLine:function(e,t,n,a,i,o,s,u){var l=e-(n/2+s),c=t-(a/2+s),v=c,h=e+(n/2+s),g=ya(i,o,e,t,l,c,h,v,!1);return g.length>0?g:g2(i,o,e,t,n,a,s,u)},checkPoint:function(e,t,n,a,i,o,s,u){u=u==="auto"?_a(a,i):u;var l=2*u;if(Yn(e,t,this.points,o,s,a,i-l,[0,-1],n)||Yn(e,t,this.points,o,s,a-l,i,[0,-1],n))return!0;var c=a/2+2*n,v=i/2+2*n,h=[o-c,s-v,o-c,s,o+c,s,o+c,s-v];return!!(Nt(e,t,h)||ei(e,t,l,l,o+a/2-u,s+i/2-u,n)||ei(e,t,l,l,o-a/2+u,s+i/2-u,n))}}};Zn.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",At(3,0)),this.generateRoundPolygon("round-triangle",At(3,0)),this.generatePolygon("rectangle",At(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",At(5,0)),this.generateRoundPolygon("round-pentagon",At(5,0)),this.generatePolygon("hexagon",At(6,0)),this.generateRoundPolygon("round-hexagon",At(6,0)),this.generatePolygon("heptagon",At(7,0)),this.generateRoundPolygon("round-heptagon",At(7,0)),this.generatePolygon("octagon",At(8,0)),this.generateRoundPolygon("round-octagon",At(8,0));var n=new Array(20);{var a=im(5,0),i=im(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)n[s*4]=a[s*2],n[s*4+1]=a[s*2+1],n[s*4+2]=i[s*2],n[s*4+3]=i[s*2+1]}n=p2(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}r.makePolygon=function(l){var c=l.join("$"),v="polygon-"+c,h;return(h=this[v])?h:e.generatePolygon(v,l)}};var ms={};ms.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};ms.redraw=function(r){r=r||c2();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};ms.beforeRender=function(r,e){if(!this.destroyed){e==null&&Mr("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(n,a){return a.priority-n.priority})}};var Ux=function(e,t,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(t,n)};ms.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(a){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){Ux(r,!0,a);var i=jn();r.render(r.renderOptions);var o=r.lastDrawTime=jn();r.averageRedrawTime===void 0&&(r.averageRedrawTime=o-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var s=o-i;r.redrawTotalTime+=s,r.lastRedrawTime=s,r.averageRedrawTime=r.averageRedrawTime/2+s/2,r.requestedFrame=!1}else Ux(r,!1,a);r.skipFrame=!1,Wu(t)}};Wu(t)}};var a$=function(e){this.init(e)},yA=a$,oo=yA.prototype;oo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];oo.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=a.getElementById(o)!=null;if(t.className.indexOf(s)<0&&(t.className=(t.className||"")+" "+s),!u){var l=a.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var c=n.getComputedStyle(t),v=c.getPropertyValue("position");v==="static"&&Er("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=De(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};oo.notify=function(r,e){var t=this,n=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&n.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),r==="gc"&&t.redrawHint("gc",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};oo.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],n=t,a=n.target;(a.off||a.removeEventListener).apply(a,n.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{}};oo.isHeadless=function(){return!1};[Wm,gA,pA,io,Zn,ms].forEach(function(r){He(oo,r)});var Pd=1e3/60,mA={setupDequeueing:function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=vs(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),o=function(l,c){var v=jn(),h=a.averageRedrawTime,g=a.lastRedrawTime,p=[],E=a.cy.extent(),m=a.getPixelRatio();for(l||a.flushRenderedStyleQueue();;){var b=jn(),w=b-v,x=b-c;if(g<Pd){var _=Pd-(l?h:0);if(x>=e.deqFastCost*_)break}else if(l){if(w>=e.deqCost*g||w>=e.deqAvgCost*h)break}else if(x>=e.deqNoDrawCost*Pd)break;var C=e.deq(n,m,E);if(C.length>0)for(var R=0;R<C.length;R++)p.push(C[R]);else break}p.length>0&&(e.onDeqd(n,p),!l&&e.shouldRedraw(n,p,m,E)&&i())},s=e.priority||Pm;a.beforeRender(o,s(n))}}}},i$=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uu;Da(this,r),this.idsByKey=new Kn,this.keyForId=new Kn,this.cachesByLvl=new Kn,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return Ia(r,[{key:"getIdsFor",value:function(t){t==null&&Mr("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(t);return a||(a=new ro,n.set(t,a)),a}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);return a!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,a=this.lvls,i=n.get(t);return i||(i=new Kn,n.set(t,i),a.push(t)),i}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var a=this.getKey(t),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,n){var a=this.keyForId.get(t.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var a=this.getKey(t);return this.hasCache(a,n)}},{key:"setCache",value:function(t,n,a){a.key=t,this.getCachesAt(n).set(t,a)}},{key:"set",value:function(t,n,a){var i=this.getKey(t);this.setCache(i,n,a),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var a=this.getKey(t);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(a){return n.deleteCache(t,a)})}},{key:"invalidate",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])})(),Hx=25,Su=50,qu=-4,bm=3,bA=7.99,o$=8,s$=1024,u$=1024,l$=1024,f$=.2,c$=.8,d$=10,v$=.15,h$=.1,g$=.9,p$=.9,y$=100,m$=1,Ui={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},b$=ht({getKey:null,doesEleInvalidateKey:Uu,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:u2,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),No=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var a=b$(t);He(n,a),n.lookup=new i$(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},rt=No.prototype;rt.reasons=Ui;rt.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};rt.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=t[r]=t[r]||[];return n};rt.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new hs(function(t,n){return n.reqs-t.reqs});return e};rt.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};rt.getElement=function(r,e,t,n,a){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(n==null&&(n=Math.ceil(Im(s*t))),n<qu)n=qu;else if(s>=bA||n>bm)return null;var l=Math.pow(2,n),c=e.h*l,v=e.w*l,h=o.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,h))return null;var g=u.get(r,n);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;var p;if(c<=Hx?p=Hx:c<=Su?p=Su:p=Math.ceil(c/Su)*Su,c>l$||v>u$)return null;var E=i.getTextureQueue(p),m=E[E.length-2],b=function(){return i.recycleTexture(p,v)||i.addTexture(p,v)};m||(m=E[E.length-1]),m||(m=b()),m.width-m.usedWidth<v&&(m=b());for(var w=function($){return $&&$.scaledLabelShown===h},x=a&&a===Ui.dequeue,_=a&&a===Ui.highQuality,C=a&&a===Ui.downscale,R,S=n+1;S<=bm;S++){var A=u.get(r,S);if(A){R=A;break}}var P=R&&R.level===n+1?R:null,I=function(){m.context.drawImage(P.texture.canvas,P.x,0,P.width,P.height,m.usedWidth,0,v,c)};if(m.context.setTransform(1,0,0,1,0,0),m.context.clearRect(m.usedWidth,0,v,p),w(P))I();else if(w(R))if(_){for(var D=R.level;D>n;D--)P=i.getElement(r,e,t,D,Ui.downscale);I()}else return i.queueElement(r,R.level-1),R;else{var M;if(!x&&!_&&!C)for(var O=n-1;O>=qu;O--){var N=u.get(r,O);if(N){M=N;break}}if(w(M))return i.queueElement(r,n),M;m.context.translate(m.usedWidth,0),m.context.scale(l,l),this.drawElement(m.context,r,e,h,!1),m.context.scale(1/l,1/l),m.context.translate(-m.usedWidth,0)}return g={x:m.usedWidth,texture:m,level:n,scale:l,width:v,height:c,scaledLabelShown:h},m.usedWidth+=Math.ceil(v+o$),m.eleCaches.push(g),u.set(r,n,g),i.checkTextureFullness(m),g};rt.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};rt.invalidateElement=function(r){var e=this,t=e.lookup,n=[],a=t.isInvalid(r);if(a){for(var i=qu;i<=bm;i++){var o=t.getForCachedKey(r,i);o&&n.push(o)}var s=t.invalidate(r);if(s)for(var u=0;u<n.length;u++){var l=n[u],c=l.texture;c.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(r)}};rt.checkTextureUtility=function(r){r.invalidatedWidth>=f$*r.width&&this.retireTexture(r)};rt.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>c$&&r.fullnessChecks>=d$?Ea(t,r):r.fullnessChecks++};rt.retireTexture=function(r){var e=this,t=r.height,n=e.getTextureQueue(t),a=this.lookup;Ea(n,r),r.retired=!0;for(var i=r.eleCaches,o=0;o<i.length;o++){var s=i[o];a.deleteCache(s.key,s.level)}Dm(i);var u=e.getRetiredTextureQueue(t);u.push(r)};rt.addTexture=function(r,e){var t=this,n=t.getTextureQueue(r),a={};return n.push(a),a.eleCaches=[],a.height=r,a.width=Math.max(s$,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=t.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};rt.recycleTexture=function(r,e){for(var t=this,n=t.getTextureQueue(r),a=t.getRetiredTextureQueue(r),i=0;i<a.length;i++){var o=a[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Dm(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Ea(a,o),n.push(o),o}};rt.queueElement=function(r,e){var t=this,n=t.getElementQueue(),a=t.getElementKeyToQueue(),i=this.getKey(r),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,n.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};n.push(s),a[i]=s}};rt.dequeue=function(r){for(var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o<m$&&t.size()>0;o++){var s=t.pop(),u=s.key,l=s.eles[0],c=i.hasCache(l,s.level);if(n[u]=null,c)continue;a.push(s);var v=e.getBoundingBox(l);e.getElement(l,v,r,s.level,Ui.dequeue)}return a};rt.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(r),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Am,t.updateItem(i),t.pop(),n[a]=null):i.eles.unmerge(r))};rt.onDequeue=function(r){this.onDequeues.push(r)};rt.offDequeue=function(r){Ea(this.onDequeues,r)};rt.setupDequeueing=mA.setupDequeueing({deqRedrawThreshold:y$,deqCost:v$,deqAvgCost:h$,deqNoDrawCost:g$,deqFastCost:p$,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var a=e.onDequeues[n];a(t)}},shouldRedraw:function(e,t,n,a){for(var i=0;i<t.length;i++)for(var o=t[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(Om(u,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var w$=1,Uo=-4,Ju=2,x$=3.99,E$=50,_$=50,C$=.15,S$=.1,T$=.9,R$=.9,A$=1,Kx=250,P$=4e3*4e3,jx=32767,D$=!0,wA=function(e){var t=this,n=t.renderer=e,a=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=jn()-2*Kx,t.skipping=!1,t.eleTxrDeqs=a.collection(),t.scheduleElementRefinement=vs(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},_$),n.beforeRender(function(o,s){s-t.lastInvalidationTime<=Kx?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};t.layersQueue=new hs(i),t.setupDequeueing()},gt=wA.prototype,Yx=0,I$=Math.pow(2,53)-1;gt.makeLayer=function(r,e){var t=Math.pow(2,e),n=Math.ceil(r.w*t),a=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(n,a),o={id:Yx=++Yx%I$,bb:r,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(t,t),s.translate(u,l),o};gt.getLayers=function(r,e,t){var n=this,a=n.renderer,i=a.cy,o=i.zoom(),s=n.firstGet;if(n.firstGet=!1,t==null){if(t=Math.ceil(Im(o*e)),t<Uo)t=Uo;else if(o>=x$||t>Ju)return null}n.validateLayersElesOrdering(t,r);var u=n.layersByLevel,l=Math.pow(2,t),c=u[t]=u[t]||[],v,h=n.levelIsComplete(t,r),g,p=function(){var I=function(V){if(n.validateLayersElesOrdering(V,r),n.levelIsComplete(V,r))return g=u[V],!0},D=function(V){if(!g)for(var $=t+V;Uo<=$&&$<=Ju&&!I($);$+=V);};D(1),D(-1);for(var M=c.length-1;M>=0;M--){var O=c[M];O.invalid&&Ea(c,O)}};if(!h)p();else return c;var E=function(){if(!v){v=Dt();for(var I=0;I<r.length;I++)AN(v,r[I].boundingBox())}return v},m=function(I){I=I||{};var D=I.after;E();var M=Math.ceil(v.w*l),O=Math.ceil(v.h*l);if(M>jx||O>jx)return null;var N=M*O;if(N>P$)return null;var V=n.makeLayer(v,t);if(D!=null){var $=c.indexOf(D)+1;c.splice($,0,V)}else(I.insert===void 0||I.insert)&&c.unshift(V);return V};if(n.skipping&&!s)return null;for(var b=null,w=r.length/w$,x=!s,_=0;_<r.length;_++){var C=r[_],R=C._private.rscratch,S=R.imgLayerCaches=R.imgLayerCaches||{},A=S[t];if(A){b=A;continue}if((!b||b.eles.length>=w||!h2(b.bb,C.boundingBox()))&&(b=m({insert:!0,after:b}),!b))return null;g||x?n.queueLayer(b,C):n.drawEleInLayer(b,C,t,e),b.eles.push(C),S[t]=b}return g||(x?null:c)};gt.getEleLevelForLayerLevel=function(r,e){return r};gt.drawEleInLayer=function(r,e,t,n){var a=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=a.getEleLevelForLayerLevel(t,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,D$),i.setImgSmoothing(o,!0))};gt.levelIsComplete=function(r,e){var t=this,n=t.layersByLevel[r];if(!n||n.length===0)return!1;for(var a=0,i=0;i<n.length;i++){var o=n[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===e.length};gt.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var n=0;n<t.length;n++){for(var a=t[n],i=-1,o=0;o<e.length;o++)if(a.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var s=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==e[s+o]){this.invalidateLayer(a);break}}};gt.updateElementsInLayers=function(r,e){for(var t=this,n=ls(r[0]),a=0;a<r.length;a++)for(var i=n?null:r[a],o=n?r[a]:r[a].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Uo;l<=Ju;l++){var c=u[l];c&&(i&&t.getEleLevelForLayerLevel(c.level)!==i.level||e(c,o,i))}};gt.haveLayers=function(){for(var r=this,e=!1,t=Uo;t<=Ju;t++){var n=r.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e};gt.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=jn(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(n,a,i){e.invalidateLayer(n)}))};gt.invalidateLayer=function(r){if(this.lastInvalidationTime=jn(),!r.invalid){var e=r.level,t=r.eles,n=this.layersByLevel[e];Ea(n,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var a=0;a<t.length;a++){var i=t[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};gt.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(n,a,i){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};gt.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};gt.queueLayer=function(r,e){var t=this,n=t.layersQueue,a=r.elesQueue,i=a.hasId=a.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,n.updateItem(r)):(r.reqs=1,n.push(r))}};gt.dequeue=function(r){for(var e=this,t=e.layersQueue,n=[],a=0;a<A$&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,r),a++),n.length===0&&n.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return n};gt.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],n=r.replaces,a=t.indexOf(n);if(!(a<0||n.invalid)){t[a]=r;for(var i=0;i<r.eles.length;i++){var o=r.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[r.level]=r)}e.requestRedraw()}};gt.requestRedraw=vs(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);gt.setupDequeueing=mA.setupDequeueing({deqRedrawThreshold:E$,deqCost:C$,deqAvgCost:S$,deqNoDrawCost:T$,deqFastCost:R$,deq:function(e,t){return e.dequeue(t)},onDeqd:Pm,shouldRedraw:u2,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var xA={},Zx;function B$(r,e){for(var t=0;t<e.length;t++){var n=e[t];r.lineTo(n.x,n.y)}}function O$(r,e,t){for(var n,a=0;a<e.length;a++){var i=e[a];a===0&&(n=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,n.x,n.y)}function Xx(r,e,t){r.beginPath&&r.beginPath();for(var n=e,a=0;a<n.length;a++){var i=n[a];r.lineTo(i.x,i.y)}var o=t,s=t[0];r.moveTo(s.x,s.y);for(var a=1;a<o.length;a++){var i=o[a];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function M$(r,e,t,n,a){r.beginPath&&r.beginPath(),r.arc(t,n,a,0,Math.PI*2,!1);var i=e,o=i[0];r.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];r.lineTo(u.x,u.y)}r.closePath&&r.closePath()}function k$(r,e,t,n){r.arc(e,t,n,0,Math.PI*2,!1)}xA.arrowShapeImpl=function(r){return(Zx||(Zx={polygon:B$,"triangle-backcurve":O$,"triangle-tee":Xx,"circle-triangle":M$,"triangle-cross":Xx,circle:k$}))[r]};var On={};On.drawElement=function(r,e,t,n,a,i){var o=this;e.isNode()?o.drawNode(r,e,t,n,a,i):o.drawEdge(r,e,t,n,a,i)};On.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};On.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};On.drawCachedElementPortion=function(r,e,t,n,a,i,o,s){var u=this,l=t.getBoundingBox(e);if(!(l.w===0||l.h===0)){var c=t.getElement(e,l,n,a,i);if(c!=null){var v=s(u,e);if(v===0)return;var h=o(u,e),g=l.x1,p=l.y1,E=l.w,m=l.h,b,w,x,_,C;if(h!==0){var R=t.getRotationPoint(e);x=R.x,_=R.y,r.translate(x,_),r.rotate(h),C=u.getImgSmoothing(r),C||u.setImgSmoothing(r,!0);var S=t.getRotationOffset(e);b=S.x,w=S.y}else b=g,w=p;var A;v!==1&&(A=r.globalAlpha,r.globalAlpha=A*v),r.drawImage(c.texture.canvas,c.x,0,c.width,c.height,b,w,E,m),v!==1&&(r.globalAlpha=A),h!==0&&(r.rotate(-h),r.translate(-x,-_),C||u.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var L$=function(){return 0},q$=function(e,t){return e.getTextAngle(t,null)},N$=function(e,t){return e.getTextAngle(t,"source")},F$=function(e,t){return e.getTextAngle(t,"target")},z$=function(e,t){return t.effectiveOpacity()},Dd=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};On.drawCachedElement=function(r,e,t,n,a,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,c=s.slbTxrCache,v=s.tlbTxrCache,h=e.boundingBox(),g=i===!0?u.reasons.highQuality:null;if(!(h.w===0||h.h===0||!e.visible())&&(!n||Om(h,n))){var p=e.isEdge(),E=e.element()._private.rscratch.badLine;o.drawElementUnderlay(r,e),o.drawCachedElementPortion(r,e,u,t,a,g,L$,z$),(!p||!E)&&o.drawCachedElementPortion(r,e,l,t,a,g,q$,Dd),p&&!E&&(o.drawCachedElementPortion(r,e,c,t,a,g,N$,Dd),o.drawCachedElementPortion(r,e,v,t,a,g,F$,Dd)),o.drawElementOverlay(r,e)}};On.drawElements=function(r,e){for(var t=this,n=0;n<e.length;n++){var a=e[n];t.drawElement(r,a)}};On.drawCachedElements=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];a.drawCachedElement(r,o,t,n)}};On.drawCachedNodes=function(r,e,t,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&a.drawCachedElement(r,o,t,n)}};On.drawLayeredElements=function(r,e,t,n){var a=this,i=a.data.lyrTxrCache.getLayers(e,t);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||r.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(r,e,t,n)};var Xn={};Xn.drawEdge=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,c=i?e.pstyle("line-opacity").value:1,v=e.pstyle("curve-style").value,h=e.pstyle("line-style").value,g=e.pstyle("width").pfValue,p=e.pstyle("line-cap").value,E=e.pstyle("line-outline-width").value,m=e.pstyle("line-outline-color").value,b=l*c,w=l*c,x=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;v==="straight-triangle"?(o.eleStrokeStyle(r,e,V),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=g,r.lineCap=p,o.eleStrokeStyle(r,e,V),o.drawEdgePath(e,r,s.allpts,h),r.lineCap="butt")},_=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;if(r.lineWidth=g+E,r.lineCap=p,E>0)o.colorStrokeStyle(r,m[0],m[1],m[2],V);else{r.lineCap="butt";return}v==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,h),r.lineCap="butt")},C=function(){a&&o.drawEdgeOverlay(r,e)},R=function(){a&&o.drawEdgeUnderlay(r,e)},S=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w;o.drawArrowheads(r,e,V)},A=function(){o.drawElementText(r,e,null,n)};r.lineJoin="round";var P=e.pstyle("ghost").value==="yes";if(P){var I=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,M=e.pstyle("ghost-opacity").value,O=b*M;r.translate(I,D),x(O),S(O),r.translate(-I,-D)}else _();R(),x(),S(),C(),A(),t&&r.translate(u.x1,u.y1)}};var EA=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),s=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,c=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,c[0],c[1],c[2],a),i.drawEdgePath(n,t,s.allpts,"solid")}}}};Xn.drawEdgeOverlay=EA("overlay");Xn.drawEdgeUnderlay=EA("underlay");Xn.drawEdgePath=function(r,e,t,n){var a=r._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,c=r.pstyle("line-dash-offset").pfValue;if(u){var v=t.join("$"),h=a.pathCacheKey&&a.pathCacheKey===v;h?(o=e=a.pathCache,s=!0):(o=e=new Path2D,a.pathCacheKey=v,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=c;break;case"solid":i.setLineDash([]);break}if(!s&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var g=2;g+3<t.length;g+=4)e.quadraticCurveTo(t[g],t[g+1],t[g+2],t[g+3]);break;case"straight":case"haystack":for(var p=2;p+1<t.length;p+=2)e.lineTo(t[p],t[p+1]);break;case"segments":if(a.isRound){var E=Ft(a.roundCorners),m;try{for(E.s();!(m=E.n()).done;){var b=m.value;fA(e,b)}}catch(x){E.e(x)}finally{E.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var w=2;w+1<t.length;w+=2)e.lineTo(t[w],t[w+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Xn.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var n=r.pstyle("width").pfValue,a=0;a+1<t.length;a+=2){var i=[t[a+2]-t[a],t[a+3]-t[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*n/2,s[1]*n/2];e.beginPath(),e.moveTo(t[a]-u[0],t[a+1]-u[1]),e.lineTo(t[a]+u[0],t[a+1]+u[1]),e.lineTo(t[a+2],t[a+3]),e.closePath(),e.fill()}};Xn.drawArrowheads=function(r,e,t){var n=e._private.rscratch,a=n.edgeType==="haystack";a||this.drawArrowhead(r,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,t),a||this.drawArrowhead(r,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,t)};Xn.drawArrowhead=function(r,e,t,n,a,i,o){if(!(isNaN(n)||n==null||isNaN(a)||a==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(t+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",c=e.pstyle(t+"-arrow-fill").value,v=e.pstyle("width").pfValue,h=e.pstyle(t+"-arrow-width"),g=h.value==="match-line"?v:h.pfValue;h.units==="%"&&(g*=v);var p=e.pstyle("opacity").value;o===void 0&&(o=p);var E=r.globalCompositeOperation;(o!==1||c==="hollow")&&(r.globalCompositeOperation="destination-out",s.colorFillStyle(r,255,255,255,1),s.colorStrokeStyle(r,255,255,255,1),s.drawArrowShape(e,r,l,v,u,g,n,a,i),r.globalCompositeOperation=E);var m=e.pstyle(t+"-arrow-color").value;s.colorFillStyle(r,m[0],m[1],m[2],o),s.colorStrokeStyle(r,m[0],m[1],m[2],o),s.drawArrowShape(e,r,c,v,u,g,n,a,i)}}};Xn.drawArrowShape=function(r,e,t,n,a,i,o,s,u){var l=this,c=this.usePaths()&&a!=="triangle-cross",v=!1,h,g=e,p={x:o,y:s},E=r.pstyle("arrow-scale").value,m=this.getArrowWidth(n,E),b=l.arrowShapes[a];if(c){var w=l.arrowPathCache=l.arrowPathCache||[],x=ti(a),_=w[x];_!=null?(h=e=_,v=!0):(h=e=new Path2D,w[x]=h)}v||(e.beginPath&&e.beginPath(),c?b.draw(e,1,0,{x:0,y:0},1):b.draw(e,m,u,p,n),e.closePath&&e.closePath()),e=g,c&&(e.translate(o,s),e.rotate(u),e.scale(m,m)),(t==="filled"||t==="both")&&(c?e.fill(h):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(c?m:1),e.lineJoin="miter",c?e.stroke(h):e.stroke()),c&&(e.scale(1/m,1/m),e.rotate(-u),e.translate(-o,-s))};var Km={};Km.safeDrawImage=function(r,e,t,n,a,i,o,s,u,l){if(!(a<=0||i<=0||u<=0||l<=0))try{r.drawImage(e,t,n,a,i,o,s,u,l)}catch(c){Er(c)}};Km.drawInscribedImage=function(r,e,t,n,a){var i=this,o=t.position(),s=o.x,u=o.y,l=t.cy().style(),c=l.getIndexedStyle.bind(l),v=c(t,"background-fit","value",n),h=c(t,"background-repeat","value",n),g=t.width(),p=t.height(),E=t.padding()*2,m=g+(c(t,"background-width-relative-to","value",n)==="inner"?0:E),b=p+(c(t,"background-height-relative-to","value",n)==="inner"?0:E),w=t._private.rscratch,x=c(t,"background-clip","value",n),_=x==="node",C=c(t,"background-image-opacity","value",n)*a,R=c(t,"background-image-smoothing","value",n),S=t.pstyle("corner-radius").value;S!=="auto"&&(S=t.pstyle("corner-radius").pfValue);var A=e.width||e.cachedW,P=e.height||e.cachedH;(A==null||P==null)&&(document.body.appendChild(e),A=e.cachedW=e.width||e.offsetWidth,P=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var I=A,D=P;if(c(t,"background-width","value",n)!=="auto"&&(c(t,"background-width","units",n)==="%"?I=c(t,"background-width","pfValue",n)*m:I=c(t,"background-width","pfValue",n)),c(t,"background-height","value",n)!=="auto"&&(c(t,"background-height","units",n)==="%"?D=c(t,"background-height","pfValue",n)*b:D=c(t,"background-height","pfValue",n)),!(I===0||D===0)){if(v==="contain"){var M=Math.min(m/I,b/D);I*=M,D*=M}else if(v==="cover"){var M=Math.max(m/I,b/D);I*=M,D*=M}var O=s-m/2,N=c(t,"background-position-x","units",n),V=c(t,"background-position-x","pfValue",n);N==="%"?O+=(m-I)*V:O+=V;var $=c(t,"background-offset-x","units",n),G=c(t,"background-offset-x","pfValue",n);$==="%"?O+=(m-I)*G:O+=G;var U=u-b/2,J=c(t,"background-position-y","units",n),W=c(t,"background-position-y","pfValue",n);J==="%"?U+=(b-D)*W:U+=W;var H=c(t,"background-offset-y","units",n),Z=c(t,"background-offset-y","pfValue",n);H==="%"?U+=(b-D)*Z:U+=Z,w.pathCache&&(O-=s,U-=u,s=0,u=0);var ne=r.globalAlpha;r.globalAlpha=C;var F=i.getImgSmoothing(r),z=!1;if(R==="no"&&F?(i.setImgSmoothing(r,!1),z=!0):R==="yes"&&!F&&(i.setImgSmoothing(r,!0),z=!0),h==="no-repeat")_&&(r.save(),w.pathCache?r.clip(w.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,m,b,S,w),r.clip())),i.safeDrawImage(r,e,0,0,A,P,O,U,I,D),_&&r.restore();else{var j=r.createPattern(e,h);r.fillStyle=j,i.nodeShapes[i.getNodeShape(t)].draw(r,s,u,m,b,S,w),r.translate(O,U),r.fill(),r.translate(-O,-U)}r.globalAlpha=ne,z&&i.setImgSmoothing(r,F)}};var li={};li.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Im(t*n));e=Math.pow(2,a)}var i=r.pstyle("font-size").pfValue*e,o=r.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};li.drawElementText=function(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,c=e.pstyle("label"),v=e.pstyle("source-label"),h=e.pstyle("target-label");if(l||(!c||!c.value)&&(!v||!v.value)&&(!h||!h.value))return;r.textAlign="center",r.textBaseline="bottom"}var g=!t,p;t&&(p=t,r.translate(-p.x1,-p.y1)),a==null?(o.drawText(r,e,null,g,i),e.isEdge()&&(o.drawText(r,e,"source",g,i),o.drawText(r,e,"target",g,i))):o.drawText(r,e,a,g,i),t&&r.translate(p.x1,p.y1)};li.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};li.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;r.font=n+" "+o+" "+a+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],s),this.colorStrokeStyle(r,c[0],c[1],c[2],u)};function $$(r,e,t,n,a){var i=Math.min(n,a),o=i/2,s=e+n/2,u=t+a/2;r.beginPath(),r.arc(s,u,o,0,Math.PI*2),r.closePath()}function Qx(r,e,t,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,n/2,a/2);r.beginPath(),r.moveTo(e+o,t),r.lineTo(e+n-o,t),r.quadraticCurveTo(e+n,t,e+n,t+o),r.lineTo(e+n,t+a-o),r.quadraticCurveTo(e+n,t+a,e+n-o,t+a),r.lineTo(e+o,t+a),r.quadraticCurveTo(e,t+a,e,t+a-o),r.lineTo(e,t+o),r.quadraticCurveTo(e,t,e+o,t),r.closePath()}li.getTextAngle=function(r,e){var t,n=r._private,a=n.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=qt(a,"labelAngle",e);t=r.isEdge()?s:0}else o.strValue==="none"?t=0:t=o.pfValue;return t};li.drawText=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=a?e.effectiveOpacity():1;if(!(a&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=qt(o,"labelX",t),l=qt(o,"labelY",t),c,v,h=this.getLabelText(e,t);if(h!=null&&h!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,a);var g=t?t+"-":"",p=qt(o,"labelWidth",t),E=qt(o,"labelHeight",t),m=e.pstyle(g+"text-margin-x").pfValue,b=e.pstyle(g+"text-margin-y").pfValue,w=e.isEdge(),x=e.pstyle("text-halign").value,_=e.pstyle("text-valign").value;w&&(x="center",_="center"),u+=m,l+=b;var C;switch(n?C=this.getTextAngle(e,t):C=0,C!==0&&(c=u,v=l,r.translate(c,v),r.rotate(C),u=0,l=0),_){case"top":break;case"center":l+=E/2;break;case"bottom":l+=E;break}var R=e.pstyle("text-background-opacity").value,S=e.pstyle("text-border-opacity").value,A=e.pstyle("text-border-width").pfValue,P=e.pstyle("text-background-padding").pfValue,I=e.pstyle("text-background-shape").strValue,D=I==="round-rectangle"||I==="roundrectangle",M=I==="circle",O=2;if(R>0||A>0&&S>0){var N=r.fillStyle,V=r.strokeStyle,$=r.lineWidth,G=e.pstyle("text-background-color").value,U=e.pstyle("text-border-color").value,J=e.pstyle("text-border-style").value,W=R>0,H=A>0&&S>0,Z=u-P;switch(x){case"left":Z-=p;break;case"center":Z-=p/2;break}var ne=l-E-P,F=p+2*P,z=E+2*P;if(W&&(r.fillStyle="rgba(".concat(G[0],",").concat(G[1],",").concat(G[2],",").concat(R*s,")")),H&&(r.strokeStyle="rgba(".concat(U[0],",").concat(U[1],",").concat(U[2],",").concat(S*s,")"),r.lineWidth=A,r.setLineDash))switch(J){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=A/4,r.setLineDash([]);break;case"solid":default:r.setLineDash([]);break}if(D?(r.beginPath(),Qx(r,Z,ne,F,z,O)):M?(r.beginPath(),$$(r,Z,ne,F,z)):(r.beginPath(),r.rect(Z,ne,F,z)),W&&r.fill(),H&&r.stroke(),H&&J==="double"){var j=A/2;r.beginPath(),D?Qx(r,Z+j,ne+j,F-2*j,z-2*j,O):r.rect(Z+j,ne+j,F-2*j,z-2*j),r.stroke()}r.fillStyle=N,r.strokeStyle=V,r.lineWidth=$,r.setLineDash&&r.setLineDash([])}var ee=2*e.pstyle("text-outline-width").pfValue;if(ee>0&&(r.lineWidth=ee),e.pstyle("text-wrap").value==="wrap"){var ie=qt(o,"labelWrapCachedLines",t),oe=qt(o,"labelLineHeight",t),Y=p/2,X=this.getLabelJustification(e);switch(X==="auto"||(x==="left"?X==="left"?u+=-p:X==="center"&&(u+=-Y):x==="center"?X==="left"?u+=-Y:X==="right"&&(u+=Y):x==="right"&&(X==="center"?u+=Y:X==="right"&&(u+=p))),_){case"top":l-=(ie.length-1)*oe;break;case"center":case"bottom":l-=(ie.length-1)*oe;break}for(var re=0;re<ie.length;re++)ee>0&&r.strokeText(ie[re],u,l),r.fillText(ie[re],u,l),l+=oe}else ee>0&&r.strokeText(h,u,l),r.fillText(h,u,l);C!==0&&(r.rotate(-C),r.translate(-c,-v))}}};var Oa={};Oa.drawNode=function(r,e,t){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,c=l.rscratch,v=e.position();if(!(!De(v.x)||!De(v.y))&&!(i&&!e.visible())){var h=i?e.effectiveOpacity():1,g=o.usePaths(),p,E=!1,m=e.padding();s=e.width()+2*m,u=e.height()+2*m;var b;t&&(b=t,r.translate(-b.x1,-b.y1));for(var w=e.pstyle("background-image"),x=w.value,_=new Array(x.length),C=new Array(x.length),R=0,S=0;S<x.length;S++){var A=x[S],P=_[S]=A!=null&&A!=="none";if(P){var I=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",S);R++,C[S]=o.getCachedImage(A,I,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,M=e.pstyle("border-width").pfValue,O=e.pstyle("background-opacity").value*h,N=e.pstyle("border-color").value,V=e.pstyle("border-style").value,$=e.pstyle("border-join").value,G=e.pstyle("border-cap").value,U=e.pstyle("border-position").value,J=e.pstyle("border-dash-pattern").pfValue,W=e.pstyle("border-dash-offset").pfValue,H=e.pstyle("border-opacity").value*h,Z=e.pstyle("outline-width").pfValue,ne=e.pstyle("outline-color").value,F=e.pstyle("outline-style").value,z=e.pstyle("outline-opacity").value*h,j=e.pstyle("outline-offset").value,ee=e.pstyle("corner-radius").value;ee!=="auto"&&(ee=e.pstyle("corner-radius").pfValue);var ie=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:O;o.eleFillStyle(r,e,Oe)},oe=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H;o.colorStrokeStyle(r,N[0],N[1],N[2],Oe)},Y=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;o.colorStrokeStyle(r,ne[0],ne[1],ne[2],Oe)},X=function(Oe,ge,L,se){var de=o.nodePathCache=o.nodePathCache||[],ve=s2(L==="polygon"?L+","+se.join(","):L,""+ge,""+Oe,""+ee),ye=de[ve],Me,_e=!1;return ye!=null?(Me=ye,_e=!0,c.pathCache=Me):(Me=new Path2D,de[ve]=c.pathCache=Me),{path:Me,cacheHit:_e}},re=e.pstyle("shape").strValue,le=e.pstyle("shape-polygon-points").pfValue;if(g){r.translate(v.x,v.y);var he=X(s,u,re,le);p=he.path,E=he.cacheHit}var be=function(){if(!E){var Oe=v;g&&(Oe={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(p||r,Oe.x,Oe.y,s,u,ee,c)}g?r.fill(p):r.fill()},fe=function(){for(var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,L=l.backgrounding,se=0,de=0;de<C.length;de++){var ve=e.cy().style().getIndexedStyle(e,"background-image-containment","value",de);if(ge&&ve==="over"||!ge&&ve==="inside"){se++;continue}_[de]&&C[de].complete&&!C[de].error&&(se++,o.drawInscribedImage(r,C[de],e,de,Oe))}l.backgrounding=se!==R,L!==l.backgrounding&&e.updateStyle(!1)},ue=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasPie(e)&&(o.drawPie(r,e,ge),Oe&&(g||o.nodeShapes[o.getNodeShape(e)].draw(r,v.x,v.y,s,u,ee,c)))},Se=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasStripe(e)&&(r.save(),g?r.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(r,v.x,v.y,s,u,ee,c),r.clip()),o.drawStripe(r,e,ge),r.restore(),Oe&&(g||o.nodeShapes[o.getNodeShape(e)].draw(r,v.x,v.y,s,u,ee,c)))},Ae=function(){var Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ge=(D>0?D:-D)*Oe,L=D>0?0:255;D!==0&&(o.colorFillStyle(r,L,L,L,ge),g?r.fill(p):r.fill())},Te=function(){if(M>0){if(r.lineWidth=M,r.lineCap=G,r.lineJoin=$,r.setLineDash)switch(V){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(J),r.lineDashOffset=W;break;case"solid":case"double":r.setLineDash([]);break}if(U!=="center"){if(r.save(),r.lineWidth*=2,U==="inside")g?r.clip(p):r.clip();else{var Oe=new Path2D;Oe.rect(-s/2-M,-u/2-M,s+2*M,u+2*M),Oe.addPath(p),r.clip(Oe,"evenodd")}g?r.stroke(p):r.stroke(),r.restore()}else g?r.stroke(p):r.stroke();if(V==="double"){r.lineWidth=M/3;var ge=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(p):r.stroke(),r.globalCompositeOperation=ge}r.setLineDash&&r.setLineDash([])}},Pe=function(){if(Z>0){if(r.lineWidth=Z,r.lineCap="butt",r.setLineDash)switch(F){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var Oe=v;g&&(Oe={x:0,y:0});var ge=o.getNodeShape(e),L=M;U==="inside"&&(L=0),U==="outside"&&(L*=2);var se=(s+L+(Z+j))/s,de=(u+L+(Z+j))/u,ve=s*se,ye=u*de,Me=o.nodeShapes[ge].points,_e;if(g){var ze=X(ve,ye,ge,Me);_e=ze.path}if(ge==="ellipse")o.drawEllipsePath(_e||r,Oe.x,Oe.y,ve,ye);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ge)){var qe=0,We=0,nr=0;ge==="round-diamond"?qe=(L+j+Z)*1.4:ge==="round-heptagon"?(qe=(L+j+Z)*1.075,nr=-(L/2+j+Z)/35):ge==="round-hexagon"?qe=(L+j+Z)*1.12:ge==="round-pentagon"?(qe=(L+j+Z)*1.13,nr=-(L/2+j+Z)/15):ge==="round-tag"?(qe=(L+j+Z)*1.12,We=(L/2+Z+j)*.07):ge==="round-triangle"&&(qe=(L+j+Z)*(Math.PI/2),nr=-(L+j/2+Z)/Math.PI),qe!==0&&(se=(s+qe)/s,ve=s*se,["round-hexagon","round-tag"].includes(ge)||(de=(u+qe)/u,ye=u*de)),ee=ee==="auto"?y2(ve,ye):ee;for(var er=ve/2,$e=ye/2,or=ee+(L+Z+j)/2,rr=new Array(Me.length/2),Vr=new Array(Me.length/2),Ir=0;Ir<Me.length/2;Ir++)rr[Ir]={x:Oe.x+We+er*Me[Ir*2],y:Oe.y+nr+$e*Me[Ir*2+1]};var st,Br,Ur,Lr,Yr=rr.length;for(Br=rr[Yr-1],st=0;st<Yr;st++)Ur=rr[st%Yr],Lr=rr[(st+1)%Yr],Vr[st]=Um(Br,Ur,Lr,or),Br=Ur,Ur=Lr;o.drawRoundPolygonPath(_e||r,Oe.x+We,Oe.y+nr,s*se,u*de,Me,Vr)}else if(["roundrectangle","round-rectangle"].includes(ge))ee=ee==="auto"?_a(ve,ye):ee,o.drawRoundRectanglePath(_e||r,Oe.x,Oe.y,ve,ye,ee+(L+Z+j)/2);else if(["cutrectangle","cut-rectangle"].includes(ge))ee=ee==="auto"?Mm():ee,o.drawCutRectanglePath(_e||r,Oe.x,Oe.y,ve,ye,null,ee+(L+Z+j)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ge))ee=ee==="auto"?_a(ve,ye):ee,o.drawBottomRoundRectanglePath(_e||r,Oe.x,Oe.y,ve,ye,ee+(L+Z+j)/2);else if(ge==="barrel")o.drawBarrelPath(_e||r,Oe.x,Oe.y,ve,ye);else if(ge.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ge)){var En=(L+Z+j)/s;Me=Hu(Ku(Me,En)),o.drawPolygonPath(_e||r,Oe.x,Oe.y,s,u,Me)}else{var Fr=(L+Z+j)/s;Me=Hu(Ku(Me,-Fr)),o.drawPolygonPath(_e||r,Oe.x,Oe.y,s,u,Me)}if(g?r.stroke(_e):r.stroke(),F==="double"){r.lineWidth=L/3;var cn=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(_e):r.stroke(),r.globalCompositeOperation=cn}r.setLineDash&&r.setLineDash([])}},Ie=function(){a&&o.drawNodeOverlay(r,e,v,s,u)},Le=function(){a&&o.drawNodeUnderlay(r,e,v,s,u)},Fe=function(){o.drawElementText(r,e,null,n)},je=e.pstyle("ghost").value==="yes";if(je){var lr=e.pstyle("ghost-offset-x").pfValue,ir=e.pstyle("ghost-offset-y").pfValue,Xe=e.pstyle("ghost-opacity").value,fr=Xe*h;r.translate(lr,ir),Y(),Pe(),ie(Xe*O),be(),fe(fr,!0),oe(Xe*H),Te(),ue(D!==0||M!==0),Se(D!==0||M!==0),fe(fr,!1),Ae(fr),r.translate(-lr,-ir)}g&&r.translate(-v.x,-v.y),Le(),g&&r.translate(v.x,v.y),Y(),Pe(),ie(),be(),fe(h,!0),oe(),Te(),ue(D!==0||M!==0),Se(D!==0||M!==0),fe(h,!1),Ae(),g&&r.translate(-v.x,-v.y),Fe(),Ie(),t&&r.translate(b.x1,b.y1)}};var _A=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,a,i,o){var s=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,v=n.pstyle("".concat(e,"-shape")).value,h=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(a=a||n.position(),i==null||o==null){var g=n.padding();i=n.width()+2*g,o=n.height()+2*g}s.colorFillStyle(t,c[0],c[1],c[2],l),s.nodeShapes[v].draw(t,a.x,a.y,i+u*2,o+u*2,h),t.fill()}}}};Oa.drawNodeOverlay=_A("overlay");Oa.drawNodeUnderlay=_A("underlay");Oa.hasPie=function(r){return r=r[0],r._private.hasPie};Oa.hasStripe=function(r){return r=r[0],r._private.hasStripe};Oa.drawPie=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=n.x,l=n.y,c=e.width(),v=e.height(),h=Math.min(c,v)/2,g,p=0,E=this.usePaths();if(E&&(u=0,l=0),i.units==="%"?h=h*i.pfValue:i.pfValue!==void 0&&(h=i.pfValue/2),o.units==="%"?g=h*o.pfValue:o.pfValue!==void 0&&(g=o.pfValue/2),!(g>=h))for(var m=1;m<=a.pieBackgroundN;m++){var b=e.pstyle("pie-"+m+"-background-size").value,w=e.pstyle("pie-"+m+"-background-color").value,x=e.pstyle("pie-"+m+"-background-opacity").value*t,_=b/100;_+p>1&&(_=1-p);var C=1.5*Math.PI+2*Math.PI*p;C+=s;var R=2*Math.PI*_,S=C+R;b===0||p>=1||p+_>1||(g===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,h,C,S),r.closePath()):(r.beginPath(),r.arc(u,l,h,C,S),r.arc(u,l,g,S,C,!0),r.closePath()),this.colorFillStyle(r,w[0],w[1],w[2],x),r.fill(),p+=_)}};Oa.drawStripe=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=n.x,o=n.y,s=e.width(),u=e.height(),l=0,c=this.usePaths();r.save();var v=e.pstyle("stripe-direction").value,h=e.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var g=s,p=u;h.units==="%"?(g=g*h.pfValue,p=p*h.pfValue):h.pfValue!==void 0&&(g=h.pfValue,p=h.pfValue),c&&(i=0,o=0),o-=g/2,i-=p/2;for(var E=1;E<=a.stripeBackgroundN;E++){var m=e.pstyle("stripe-"+E+"-background-size").value,b=e.pstyle("stripe-"+E+"-background-color").value,w=e.pstyle("stripe-"+E+"-background-opacity").value*t,x=m/100;x+l>1&&(x=1-l),!(m===0||l>=1||l+x>1)&&(r.beginPath(),r.rect(i,o+p*l,g,p*x),r.closePath(),this.colorFillStyle(r,b[0],b[1],b[2],w),r.fill(),l+=x)}r.restore()};var It={},V$=100;It.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};It.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,n,a=0;a<e.length;a++)if(n=e[a],n.context===r){t=!1;break}return t&&(n={context:r},e.push(n)),n};It.createGradientStyleFor=function(r,e,t,n,a){var i,o=this.usePaths(),s=t.pstyle(e+"-gradient-stop-colors").value,u=t.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(t.isEdge()){var l=t.sourceEndpoint(),c=t.targetEndpoint(),v=t.midpoint(),h=ni(l,v),g=ni(c,v);i=r.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(h,g))}else{var p=o?{x:0,y:0}:t.position(),E=t.paddedWidth(),m=t.paddedHeight();i=r.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(E,m))}else if(t.isEdge()){var b=t.sourceEndpoint(),w=t.targetEndpoint();i=r.createLinearGradient(b.x,b.y,w.x,w.y)}else{var x=o?{x:0,y:0}:t.position(),_=t.paddedWidth(),C=t.paddedHeight(),R=_/2,S=C/2,A=t.pstyle("background-gradient-direction").value;switch(A){case"to-bottom":i=r.createLinearGradient(x.x,x.y-S,x.x,x.y+S);break;case"to-top":i=r.createLinearGradient(x.x,x.y+S,x.x,x.y-S);break;case"to-left":i=r.createLinearGradient(x.x+R,x.y,x.x-R,x.y);break;case"to-right":i=r.createLinearGradient(x.x-R,x.y,x.x+R,x.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(x.x-R,x.y-S,x.x+R,x.y+S);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(x.x-R,x.y+S,x.x+R,x.y-S);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(x.x+R,x.y-S,x.x-R,x.y+S);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(x.x+R,x.y+S,x.x-R,x.y-S);break}}if(!i)return null;for(var P=u.length===s.length,I=s.length,D=0;D<I;D++)i.addColorStop(P?u[D]:D/(I-1),"rgba("+s[D][0]+","+s[D][1]+","+s[D][2]+","+a+")");return i};It.gradientFillStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"background",e,t,n);if(!a)return null;r.fillStyle=a};It.colorFillStyle=function(r,e,t,n,a){r.fillStyle="rgba("+e+","+t+","+n+","+a+")"};It.eleFillStyle=function(r,e,t){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(r,e,n,t);else{var a=e.pstyle("background-color").value;this.colorFillStyle(r,a[0],a[1],a[2],t)}};It.gradientStrokeStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"line",e,t,n);if(!a)return null;r.strokeStyle=a};It.colorStrokeStyle=function(r,e,t,n,a){r.strokeStyle="rgba("+e+","+t+","+n+","+a+")"};It.eleStrokeStyle=function(r,e,t){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(r,e,n,t);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(r,a[0],a[1],a[2],t)}};It.matchCanvasSize=function(r){var e=this,t=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=a*o,l=i*o,c;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var v=t.canvasContainer;v.style.width=a+"px",v.style.height=i+"px";for(var h=0;h<e.CANVAS_LAYERS;h++)c=t.canvases[h],c.width=u,c.height=l,c.style.width=a+"px",c.style.height=i+"px";for(var h=0;h<e.BUFFER_COUNT;h++)c=t.bufferCanvases[h],c.width=u,c.height=l,c.style.width=a+"px",c.style.height=i+"px";e.textureMult=1,o<=1&&(c=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=u*e.textureMult,c.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};It.renderTo=function(r,e,t,n){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:n})};It.clearCanvas=function(){var r=this,e=r.data;function t(n){n.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};It.render=function(r){var e=this;r=r||c2();var t=e.cy,n=r.forcedContext,a=r.drawAllLayers,i=r.drawOnlyNodeLayer,o=r.forcedZoom,s=r.forcedPan,u=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=e.data,c=l.canvasNeedsRedraw,v=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),h=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,g=e.motionBlurPxRatio,p=t.hasCompoundNodes(),E=e.hoverData.draggingEles,m=!!(e.hoverData.selecting||e.touchData.selecting);h=h&&!n&&e.motionBlurEnabled&&!m;var b=h;n||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),h&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(b=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!v&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var w=t.style(),x=t.zoom(),_=o!==void 0?o:x,C=t.pan(),R={x:C.x,y:C.y},S={zoom:x,pan:{x:C.x,y:C.y}},A=e.prevViewport,P=A===void 0||S.zoom!==A.zoom||S.pan.x!==A.pan.x||S.pan.y!==A.pan.y;!P&&!(E&&!p)&&(e.motionBlurPxRatio=1),s&&(R=s),_*=u,R.x*=u,R.y*=u;var I=e.getCachedZSortedEles();function D(oe,Y,X,re,le){var he=oe.globalCompositeOperation;oe.globalCompositeOperation="destination-out",e.colorFillStyle(oe,255,255,255,e.motionBlurTransparency),oe.fillRect(Y,X,re,le),oe.globalCompositeOperation=he}function M(oe,Y){var X,re,le,he;!e.clearingMotionBlur&&(oe===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||oe===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(X={x:C.x*g,y:C.y*g},re=x*g,le=e.canvasWidth*g,he=e.canvasHeight*g):(X=R,re=_,le=e.canvasWidth,he=e.canvasHeight),oe.setTransform(1,0,0,1,0,0),Y==="motionBlur"?D(oe,0,0,le,he):!n&&(Y===void 0||Y)&&oe.clearRect(0,0,le,he),a||(oe.translate(X.x,X.y),oe.scale(re,re)),s&&oe.translate(s.x,s.y),o&&oe.scale(o,o)}if(v||(e.textureDrawLastFrame=!1),v){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var O=e.data.bufferContexts[e.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var S=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var N=l.contexts[e.NODE],V=e.textureCache.texture,S=e.textureCache.viewport;N.setTransform(1,0,0,1,0,0),h?D(N,0,0,S.width,S.height):N.clearRect(0,0,S.width,S.height);var $=w.core("outside-texture-bg-color").value,G=w.core("outside-texture-bg-opacity").value;e.colorFillStyle(N,$[0],$[1],$[2],G),N.fillRect(0,0,S.width,S.height);var x=t.zoom();M(N,!1),N.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/u,S.height/S.zoom/u),N.drawImage(V,S.mpan.x,S.mpan.y,S.width/S.zoom/u,S.height/S.zoom/u)}else e.textureOnViewport&&!n&&(e.textureCache=null);var U=t.extent(),J=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),W=e.hideEdgesOnViewport&&J,H=[];if(H[e.NODE]=!c[e.NODE]&&h&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,H[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),H[e.DRAG]=!c[e.DRAG]&&h&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,H[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||a||i||H[e.NODE]){var Z=h&&!H[e.NODE]&&g!==1,N=n||(Z?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),ne=h&&!Z?"motionBlur":void 0;M(N,ne),W?e.drawCachedNodes(N,I.nondrag,u,U):e.drawLayeredElements(N,I.nondrag,u,U),e.debug&&e.drawDebugPoints(N,I.nondrag),!a&&!h&&(c[e.NODE]=!1)}if(!i&&(c[e.DRAG]||a||H[e.DRAG])){var Z=h&&!H[e.DRAG]&&g!==1,N=n||(Z?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);M(N,h&&!Z?"motionBlur":void 0),W?e.drawCachedNodes(N,I.drag,u,U):e.drawCachedElements(N,I.drag,u,U),e.debug&&e.drawDebugPoints(N,I.drag),!a&&!h&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,M),h&&g!==1){var F=l.contexts[e.NODE],z=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],j=l.contexts[e.DRAG],ee=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ie=function(Y,X,re){Y.setTransform(1,0,0,1,0,0),re||!b?Y.clearRect(0,0,e.canvasWidth,e.canvasHeight):D(Y,0,0,e.canvasWidth,e.canvasHeight);var le=g;Y.drawImage(X,0,0,e.canvasWidth*le,e.canvasHeight*le,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||H[e.NODE])&&(ie(F,z,H[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||H[e.DRAG])&&(ie(j,ee,H[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=S,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),h&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!v,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},V$)),n||t.emit("render")};var Oo;It.drawSelectionRectangle=function(r,e){var t=this,n=t.cy,a=t.data,i=n.style(),o=r.drawOnlyNodeLayer,s=r.drawAllLayers,u=a.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!o&&u[t.SELECT_BOX]&&!s){var c=l||a.contexts[t.SELECT_BOX];if(e(c),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var v=t.cy.zoom(),h=i.core("selection-box-border-width").value/v;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(a.bgActivePosistion&&!t.hoverData.selecting){var v=t.cy.zoom(),g=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(g.x,g.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),c.fill()}var p=t.lastRedrawTime;if(t.showFps&&p){p=Math.round(p);var E=Math.round(1e3/p),m="1 frame = "+p+" ms = "+E+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Oo){var b=c.measureText(m);Oo=b.actualBoundingBoxAscent}c.fillText(m,0,Oo);var w=60;c.strokeRect(0,Oo+10,250,20),c.fillRect(0,Oo+10,250*Math.min(E/w,1),20)}s||(u[t.SELECT_BOX]=!1)}};function Jx(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(n));return n}function G$(r,e,t){var n=Jx(r,r.VERTEX_SHADER,e),a=Jx(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,n),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function W$(r,e,t){t===void 0&&(t=e);var n=r.makeOffscreenCanvas(e,t),a=n.context=n.getContext("2d");return n.clear=function(){return a.clearRect(0,0,n.width,n.height)},n.clear(),n}function jm(r){var e=r.pixelRatio,t=r.cy.zoom(),n=r.cy.pan();return{zoom:t*e,pan:{x:n.x*e,y:n.y*e}}}function U$(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function H$(r,e,t,n,a){var i=n*t+e.x,o=a*t+e.y;return o=Math.round(r.canvasHeight-o),[i,o]}function K$(r){return r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function j$(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function ja(r,e,t){var n=r[0]/255,a=r[1]/255,i=r[2]/255,o=e,s=t||new Array(4);return s[0]=n*o,s[1]=a*o,s[2]=i*o,s[3]=o,s}function Fi(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Y$(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function Z$(r,e){var t=r.createTexture();return t.buffer=function(n){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function CA(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function SA(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function X$(r,e,t,n,a,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*n,a);case r.INT:return new Int32Array(t.buffer,i*n,a)}}function Q$(r,e,t,n){var a=CA(r,e),i=Kr(a,2),o=i[0],s=i[1],u=SA(r,s,n),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),s===r.FLOAT?r.vertexAttribPointer(t,o,s,!1,0,0):s===r.INT&&r.vertexAttribIPointer(t,o,s,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),l}function Rn(r,e,t,n){var a=CA(r,t),i=Kr(a,3),o=i[0],s=i[1],u=i[2],l=SA(r,s,e*o),c=o*u,v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,e*c,r.DYNAMIC_DRAW),r.enableVertexAttribArray(n),s===r.FLOAT?r.vertexAttribPointer(n,o,s,!1,c,0):s===r.INT&&r.vertexAttribIPointer(n,o,s,c,0),r.vertexAttribDivisor(n,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var h=new Array(e),g=0;g<e;g++)h[g]=X$(r,s,l,c,o,g);return v.dataArray=l,v.stride=c,v.size=o,v.getView=function(p){return h[p]},v.setPoint=function(p,E,m){var b=h[p];b[0]=E,b[1]=m},v.bufferSubData=function(p){r.bindBuffer(r.ARRAY_BUFFER,v),p?r.bufferSubData(r.ARRAY_BUFFER,0,l,0,p*o):r.bufferSubData(r.ARRAY_BUFFER,0,l)},v}function J$(r,e,t){for(var n=9,a=new Float32Array(e*n),i=new Array(e),o=0;o<e;o++){var s=o*n*4;i[o]=new Float32Array(a.buffer,s,n)}var u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,a.byteLength,r.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=t+l;r.enableVertexAttribArray(c),r.vertexAttribPointer(c,3,r.FLOAT,!1,36,l*12),r.vertexAttribDivisor(c,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),u.getMatrixView=function(v){return i[v]},u.setData=function(v,h){i[h].set(v,0)},u.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferSubData(r.ARRAY_BUFFER,0,a)},u}function eV(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(n,a){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,n,a,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}var eE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function Id(){var r=new eE(9);return eE!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function rE(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function rV(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],v=e[8],h=t[0],g=t[1],p=t[2],E=t[3],m=t[4],b=t[5],w=t[6],x=t[7],_=t[8];return r[0]=h*n+g*o+p*l,r[1]=h*a+g*s+p*c,r[2]=h*i+g*u+p*v,r[3]=E*n+m*o+b*l,r[4]=E*a+m*s+b*c,r[5]=E*i+m*u+b*v,r[6]=w*n+x*o+_*l,r[7]=w*a+x*s+_*c,r[8]=w*i+x*u+_*v,r}function Nu(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],v=e[8],h=t[0],g=t[1];return r[0]=n,r[1]=a,r[2]=i,r[3]=o,r[4]=s,r[5]=u,r[6]=h*n+g*o+l,r[7]=h*a+g*s+c,r[8]=h*i+g*u+v,r}function tE(r,e,t){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],c=e[7],v=e[8],h=Math.sin(t),g=Math.cos(t);return r[0]=g*n+h*o,r[1]=g*a+h*s,r[2]=g*i+h*u,r[3]=g*o-h*n,r[4]=g*s-h*a,r[5]=g*u-h*i,r[6]=l,r[7]=c,r[8]=v,r}function wm(r,e,t){var n=t[0],a=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=a*e[3],r[4]=a*e[4],r[5]=a*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function tV(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}var nV=(function(){function r(e,t,n,a){Da(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=n,this.texHeight=Math.floor(t/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(e,t,t),this.scratch=a(e,t,this.texHeight,"scratch")}return Ia(r,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var n=t.w,a=t.h,i=this.texHeight,o=this.texSize,s=i/a,u=n*s,l=a*s;return u>o&&(s=o/n,u=n*s,l=a*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(t,n,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(n),c=l.scale,v=l.texW,h=l.texH,g=function(x,_){if(a&&_){var C=_.context,R=x.x,S=x.row,A=R,P=u*S;C.save(),C.translate(A,P),C.scale(c,c),a(C,n),C.restore()}},p=[null,null],E=function(){g(i.freePointer,i.canvas),p[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:v,h},p[1]={x:i.freePointer.x+v,y:i.freePointer.row*u,w:0,h},i.freePointer.x+=v,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},m=function(){var x=i.scratch,_=i.canvas;x.clear(),g({x:0,row:0},x);var C=o-i.freePointer.x,R=v-C,S=u;{var A=i.freePointer.x,P=i.freePointer.row*u,I=C;_.context.drawImage(x,0,0,I,S,A,P,I,S),p[0]={x:A,y:P,w:I,h}}{var D=C,M=(i.freePointer.row+1)*u,O=R;_&&_.context.drawImage(x,D,0,O,S,0,M,O,S),p[1]={x:0,y:M,w:O,h}}i.freePointer.x=R,i.freePointer.row++},b=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=o)E();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(b(),E()):this.enableWrapping?m():(b(),E())}return this.keyToLocation.set(t,p),this.needsBuffer=!0,p}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var n=this.texSize,a=this.texRows,i=this.getScale(t),o=i.texW;return this.freePointer.x+o>n?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=Z$(t,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}}])})(),aV=(function(){function r(e,t,n,a){Da(this,r),this.r=e,this.texSize=t,this.texRows=n,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return Ia(r,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new nV(t,n,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,n=this.texSize,a=this.texRows,i=this.createTextureCanvas,o=Math.floor(n/a);this.scratch=i(t,n,o,"scratch")}return this.scratch}},{key:"draw",value:function(t,n,a){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(n))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,n,a),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,o=null,s=Ft(this.atlases),u;try{var l=function(){var v=u.value,h=v.getKeys(),g=iV(n,h);if(g.size===0)return a.push(v),h.forEach(function(C){return i.set(C,v)}),1;o||(o=t._createAtlas(),a.push(o));var p=Ft(h),E;try{for(p.s();!(E=p.n()).done;){var m=E.value;if(!g.has(m)){var b=v.getOffsets(m),w=Kr(b,2),x=w[0],_=w[1];o.canFit({w:x.w+_.w,h:x.h})||(o.lock(),o=t._createAtlas(),a.push(o)),v.canvas&&(t._copyTextureToNewAtlas(m,v,o),i.set(m,o))}}}catch(C){p.e(C)}finally{p.f()}v.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(c){s.e(c)}finally{s.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,n,a){var i=n.getOffsets(t),o=Kr(i,2),s=o[0],u=o[1];if(u.w===0)a.draw(t,s,function(h){h.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(n.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(n.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var c=s.w+u.w,v=s.h;a.draw(t,{w:c,h:v},function(h){h.drawImage(l,0,0,c,v,0,0,c,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function iV(r,e){return r.intersection?r.intersection(e):new Set(Vu(r).filter(function(t){return e.has(t)}))}var oV=(function(){function r(e,t){Da(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return Ia(r,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,n){var a=this.globalOptions,i=a.webglTexSize,o=a.createTextureCanvas,s=n.texRows,u=this._cacheScratchCanvas(o),l=new aV(this.r,i,s,u);this.collections.set(t,l)}},{key:"addRenderType",value:function(t,n){var a=n.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),o=He({type:t,atlasCollection:i},n);this.renderTypes.set(t,o)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var n=-1,a=-1,i=null;return function(o,s,u,l){return l?((!i||s!=n||u!=a)&&(n=s,a=u,i=t(o,s,u)),i):t(o,s,u)}}},{key:"_key",value:function(t,n){return"".concat(t,"-").concat(n)}},{key:"invalidate",value:function(t){var n=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,o=i===void 0?!1:i,s=a.filterEle,u=s===void 0?function(){return!0}:s,l=a.filterType,c=l===void 0?function(){return!0}:l,v=!1,h=!1,g=Ft(t),p;try{for(g.s();!(p=g.n()).done;){var E=p.value;if(u(E)){var m=Ft(this.renderTypes.values()),b;try{var w=function(){var _=b.value,C=_.type;if(c(C)){var R=n.collections.get(_.collection),S=_.getKey(E),A=Array.isArray(S)?S:[S];if(o)A.forEach(function(M){return R.markKeyForGC(M)}),h=!0;else{var P=_.getID?_.getID(E):E.id(),I=n._key(C,P),D=n.typeAndIdToKey.get(I);D!==void 0&&!j$(A,D)&&(v=!0,n.typeAndIdToKey.delete(I),D.forEach(function(M){return R.markKeyForGC(M)}))}}};for(m.s();!(b=m.n()).done;)w()}catch(x){m.e(x)}finally{m.f()}}}}catch(x){g.e(x)}finally{g.f()}return h&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var t=Ft(this.collections.values()),n;try{for(t.s();!(n=t.n()).done;){var a=n.value;a.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,n,a,i){var o=this.renderTypes.get(n),s=this.collections.get(o.collection),u=!1,l=s.draw(i,a,function(h){o.drawClipped?(h.save(),h.beginPath(),h.rect(0,0,a.w,a.h),h.clip(),o.drawElement(h,t,a,!0,!0),h.restore()):o.drawElement(h,t,a,!0,!0),u=!0});if(u){var c=o.getID?o.getID(t):t.id(),v=this._key(n,c);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return l}},{key:"getAtlasInfo",value:function(t,n){var a=this,i=this.renderTypes.get(n),o=i.getKey(t),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(t,u),c=a.getOrCreateAtlas(t,n,l,u),v=c.getOffsets(u),h=Kr(v,2),g=h[0],p=h[1];return{atlas:c,tex:g,tex1:g,tex2:p,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],n=Ft(this.collections),a;try{for(n.s();!(a=n.n()).done;){var i=Kr(a.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,c=u.atlasCount;t.push({type:o,keyCount:l,atlasCount:c})}}catch(v){n.e(v)}finally{n.f()}return t}}])})(),sV=(function(){function r(e){Da(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return Ia(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var n=this.batchAtlases.indexOf(t);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),n=this.batchAtlases.length-1}return n}}])})(),uV=`
|
|
18
|
+
float circleSD(vec2 p, float r) {
|
|
19
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
20
|
+
}
|
|
21
|
+
`,lV=`
|
|
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
|
+
`,fV=`
|
|
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
|
+
`,cV=`
|
|
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
|
+
`,Ho={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},el={IGNORE:1,USE_BB:2},Bd=0,nE=1,aE=2,Od=3,zi=4,Tu=5,Mo=6,ko=7,dV=(function(){function r(e,t,n){Da(this,r),this.r=e,this.gl=t,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=W$,this.atlasManager=new oV(e,n),this.batchManager=new sV(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ho.SCREEN),this.pickingProgram=this._createShaderProgram(Ho.PICKING),this.vao=this._createVAO()}return Ia(r,[{key:"addAtlasCollection",value:function(t,n){this.atlasManager.addAtlasCollection(t,n)}},{key:"addTextureAtlasRenderType",value:function(t,n){this.atlasManager.addRenderType(t,n)}},{key:"addSimpleShapeRenderType",value:function(t,n){this.simpleShapeOptions.set(t,n)}},{key:"invalidate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.type,i=this.atlasManager;return a?i.invalidate(t,{filterType:function(s){return s===a},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var n=this.gl,a=`#version 300 es
|
|
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(Bd,`) {
|
|
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(zi," || aVertType == ").concat(ko,`
|
|
119
|
+
|| aVertType == `).concat(Tu," || aVertType == ").concat(Mo,`) { // 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(nE,`) {
|
|
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(aE,`) {
|
|
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(Od,` && 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
|
+
`),i=this.batchManager.getIndexArray(),o=`#version 300 es
|
|
219
|
+
precision highp float;
|
|
220
|
+
|
|
221
|
+
// declare texture unit for each texture atlas in the batch
|
|
222
|
+
`.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).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(uV,`
|
|
244
|
+
`).concat(lV,`
|
|
245
|
+
`).concat(fV,`
|
|
246
|
+
`).concat(cV,`
|
|
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(Bd,`) {
|
|
263
|
+
// look up the texel from the texture unit
|
|
264
|
+
`).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
|
|
265
|
+
else `),`
|
|
266
|
+
}
|
|
267
|
+
else if(vVertType == `).concat(Od,`) {
|
|
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(zi,` && 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(zi," || vVertType == ").concat(ko,`
|
|
276
|
+
|| vVertType == `).concat(Tu," || vVertType == ").concat(Mo,`) { // 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(zi,`) {
|
|
288
|
+
d = rectangleSD(p, b);
|
|
289
|
+
} else if(vVertType == `).concat(ko,` && w == h) {
|
|
290
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
291
|
+
} else if(vVertType == `).concat(ko,`) {
|
|
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(t.picking?`if(outColor.a == 0.0) discard;
|
|
329
|
+
else outColor = vIndex;`:"",`
|
|
330
|
+
}
|
|
331
|
+
`),s=G$(n,a,o);s.aPosition=n.getAttribLocation(s,"aPosition"),s.aIndex=n.getAttribLocation(s,"aIndex"),s.aVertType=n.getAttribLocation(s,"aVertType"),s.aTransform=n.getAttribLocation(s,"aTransform"),s.aAtlasId=n.getAttribLocation(s,"aAtlasId"),s.aTex=n.getAttribLocation(s,"aTex"),s.aPointAPointB=n.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=n.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=n.getAttribLocation(s,"aLineWidth"),s.aColor=n.getAttribLocation(s,"aColor"),s.aCornerRadius=n.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=n.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=n.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=n.getUniformLocation(s,"uAtlasSize"),s.uBGColor=n.getUniformLocation(s,"uBGColor"),s.uZoom=n.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(n.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var n=this.maxInstances,a=this.gl,i=this.program,o=a.createVertexArray();return a.bindVertexArray(o),Q$(a,"vec2",i.aPosition,t),this.transformBuffer=J$(a,n,i.aTransform),this.indexBuffer=Rn(a,n,"vec4",i.aIndex),this.vertTypeBuffer=Rn(a,n,"int",i.aVertType),this.atlasIdBuffer=Rn(a,n,"int",i.aAtlasId),this.texBuffer=Rn(a,n,"vec4",i.aTex),this.pointAPointBBuffer=Rn(a,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Rn(a,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=Rn(a,n,"vec2",i.aLineWidth),this.colorBuffer=Rn(a,n,"vec4",i.aColor),this.cornerRadiusBuffer=Rn(a,n,"vec4",i.aCornerRadius),this.borderColorBuffer=Rn(a,n,"vec4",i.aBorderColor),a.bindVertexArray(null),o}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return ga(n,"Buffer")}).map(function(n){return t[n]})),this._buffers}},{key:"startFrame",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ho.SCREEN;this.panZoomMatrix=t,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,n){return t.visible()?n&&n.isVisible?n.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,n,a){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(a);if(this._isVisible(t,s)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(t);if(u===el.IGNORE)return;if(u==el.USE_BB){this.drawPickingRectangle(t,n,a);return}}var l=i.getAtlasInfo(t,a),c=Ft(l),v;try{for(c.s();!(v=c.n()).done;){var h=v.value,g=h.atlas,p=h.tex1,E=h.tex2;o.canAddToCurrentBatch(g)||this.endBatch();for(var m=o.getAtlasIndexForBatch(g),b=0,w=[[p,!0],[E,!1]];b<w.length;b++){var x=Kr(w[b],2),_=x[0],C=x[1];if(_.w!=0){var R=this.instanceCount;this.vertTypeBuffer.getView(R)[0]=Bd;var S=this.indexBuffer.getView(R);Fi(n,S);var A=this.atlasIdBuffer.getView(R);A[0]=m;var P=this.texBuffer.getView(R);P[0]=_.x,P[1]=_.y,P[2]=_.w,P[3]=_.h;var I=this.transformBuffer.getMatrixView(R);this.setTransformMatrix(t,I,s,h,C),this.instanceCount++,C||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){c.e(D)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(t,n,a,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(a.shapeProps&&a.shapeProps.padding&&(s=t.pstyle(a.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,c=i.tex2,v=l.w/(l.w+c.w);o||(v=1-v);var h=this._getAdjustedBB(u,s,o,v);this._applyTransformMatrix(n,h,a,t)}else{var g=a.getBoundingBox(t),p=this._getAdjustedBB(g,s,!0,1);this._applyTransformMatrix(n,p,a,t)}}},{key:"_applyTransformMatrix",value:function(t,n,a,i){var o,s;rE(t);var u=a.getRotation?a.getRotation(i):0;if(u!==0){var l=a.getRotationPoint(i),c=l.x,v=l.y;Nu(t,t,[c,v]),tE(t,t,u);var h=a.getRotationOffset(i);o=h.x+(n.xOffset||0),s=h.y+(n.yOffset||0)}else o=n.x1,s=n.y1;Nu(t,t,[o,s]),wm(t,t,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(t,n,a,i){var o=t.x1,s=t.y1,u=t.w,l=t.h,c=t.yOffset;n&&(o-=n,s-=n,u+=2*n,l+=2*n);var v=0,h=u*i;return a&&i<1?u=h:!a&&i<1&&(v=u-h,o+=v,u=h),{x1:o,y1:s,w:u,h:l,xOffset:v,yOffset:c}}},{key:"drawPickingRectangle",value:function(t,n,a){var i=this.atlasManager.getRenderTypeOpts(a),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=zi;var s=this.indexBuffer.getView(o);Fi(n,s);var u=this.colorBuffer.getView(o);ja([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,n,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(t,i)){var o=i.shapeProps,s=this._getVertTypeForShape(t,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(t)){this.drawTexture(t,n,a);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===Tu||s===Mo){var l=i.getBoundingBox(t),c=this._getCornerRadius(t,o.radius,l),v=this.cornerRadiusBuffer.getView(u);v[0]=c,v[1]=c,v[2]=c,v[3]=c,s===Mo&&(v[0]=0,v[2]=0)}var h=this.indexBuffer.getView(u);Fi(n,h);var g=t.pstyle(o.color).value,p=t.pstyle(o.opacity).value,E=this.colorBuffer.getView(u);ja(g,p,E);var m=this.lineWidthBuffer.getView(u);if(m[0]=0,m[1]=0,o.border){var b=t.pstyle("border-width").value;if(b>0){var w=t.pstyle("border-color").value,x=t.pstyle("border-opacity").value,_=this.borderColorBuffer.getView(u);ja(w,x,_);var C=t.pstyle("border-position").value;if(C==="inside")m[0]=0,m[1]=-b;else if(C==="outside")m[0]=b,m[1]=0;else{var R=b/2;m[0]=R,m[1]=-R}}}var S=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,S,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,n){var a=t.pstyle(n).value;switch(a){case"rectangle":return zi;case"ellipse":return ko;case"roundrectangle":case"round-rectangle":return Tu;case"bottom-round-rectangle":return Mo;default:return}}},{key:"_getCornerRadius",value:function(t,n,a){var i=a.w,o=a.h;if(t.pstyle(n).value==="auto")return _a(i,o);var s=t.pstyle(n).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(t,n,a){if(t.visible()){var i=t._private.rscratch,o,s,u;if(a==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=t.pstyle(a+"-arrow-shape").value;if(l!=="none"){var c=t.pstyle(a+"-arrow-color").value,v=t.pstyle("opacity").value,h=t.pstyle("line-opacity").value,g=v*h,p=t.pstyle("width").pfValue,E=t.pstyle("arrow-scale").value,m=this.r.getArrowWidth(p,E),b=this.instanceCount,w=this.transformBuffer.getMatrixView(b);rE(w),Nu(w,w,[o,s]),wm(w,w,[m,m]),tE(w,w,u),this.vertTypeBuffer.getView(b)[0]=Od;var x=this.indexBuffer.getView(b);Fi(n,x);var _=this.colorBuffer.getView(b);ja(c,g,_),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,n){if(t.visible()){var a=this._getEdgePoints(t);if(a){var i=t.pstyle("opacity").value,o=t.pstyle("line-opacity").value,s=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*o;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=nE;var v=this.indexBuffer.getView(c);Fi(n,v);var h=this.colorBuffer.getView(c);ja(u,l,h);var g=this.lineWidthBuffer.getView(c);g[0]=s;var p=this.pointAPointBBuffer.getView(c);p[0]=a[0],p[1]=a[1],p[2]=a[2],p[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var E=0;E<a.length-2;E+=2){var m=this.instanceCount;this.vertTypeBuffer.getView(m)[0]=aE;var b=this.indexBuffer.getView(m);Fi(n,b);var w=this.colorBuffer.getView(m);ja(u,l,w);var x=this.lineWidthBuffer.getView(m);x[0]=s;var _=a[E-2],C=a[E-1],R=a[E],S=a[E+1],A=a[E+2],P=a[E+3],I=a[E+4],D=a[E+5];E==0&&(_=2*R-A+.001,C=2*S-P+.001),E==a.length-4&&(I=2*A-R+.001,D=2*P-S+.001);var M=this.pointAPointBBuffer.getView(m);M[0]=_,M[1]=C,M[2]=R,M[3]=S;var O=this.pointCPointDBuffer.getView(m);O[0]=A,O[1]=P,O[2]=I,O[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var n=t._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var n=t._private.rscratch;if(this._isValidEdge(t)){var a=n.allpts;if(a.length==4)return a;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(t){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,n){if(t.length==4)return t;for(var a=Array((n+1)*2),i=0;i<=n;i++)if(i==0)a[0]=t[0],a[1]=t[1];else if(i==n)a[i*2]=t[t.length-2],a[i*2+1]=t[t.length-1];else{var o=i/n;this._setCurvePoint(t,o,a,i*2)}return a}},{key:"_setCurvePoint",value:function(t,n,a,i){if(t.length<=2)a[i]=t[0],a[i+1]=t[1];else{for(var o=Array(t.length-2),s=0;s<o.length;s+=2){var u=(1-n)*t[s]+n*t[s+2],l=(1-n)*t[s+1]+n*t[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,n,a,i)}}},{key:"endBatch",value:function(){var t=this.gl,n=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(o),t.bindVertexArray(n);var s=Ft(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(p){s.e(p)}finally{s.f()}for(var c=this.batchManager.getAtlases(),v=0;v<c.length;v++)c[v].bufferIfNeeded(t);for(var h=0;h<c.length;h++)t.activeTexture(t.TEXTURE0+h),t.bindTexture(t.TEXTURE_2D,c[h].texture),t.uniform1i(o.uTextures[h],h);t.uniform1f(o.uZoom,U$(this.r)),t.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var g=ja(this.bgColor,1);t.uniform4fv(o.uBGColor,g),t.drawArraysInstanced(t.TRIANGLES,0,a,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),n=t.reduce(function(o,s){return o+s.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(o,s){return o+s.count},0);return{atlasInfo:t,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])})(),TA={};TA.initWebgl=function(r,e){var t=this,n=t.data.contexts[t.WEBGL];r.bgColor=vV(t),r.webglTexSize=Math.min(r.webglTexSize,n.getParameter(n.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=eV(n),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new dV(t,n,r);var a=function(v){return function(h){return t.getTextAngle(h,v)}},i=function(v){return function(h){var g=h.pstyle(v);return g&&g.value}},o=function(v){return function(h){return h.pstyle("".concat(v,"-opacity")).value>0}},s=function(v){var h=v.pstyle("text-events").strValue==="yes";return h?el.USE_BB:el.IGNORE},u=function(v){var h=v.position(),g=h.x,p=h.y,E=v.outerWidth(),m=v.outerHeight();return{w:E,h:m,x1:g-E/2,y1:p-m/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:K$,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Md(e.getLabelKey,null),getBoundingBox:kd(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:a(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Md(e.getSourceLabelKey,"source"),getBoundingBox:kd(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:a("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Md(e.getTargetLabelKey,"target"),getBoundingBox:kd(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=vs(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(c,v){var h=!1;v&&v.length>0&&(h|=t.drawing.invalidate(v)),h&&l()}),hV(t)};function vV(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return e2(t)}function RA(r,e){var t=r._private.rscratch;return qt(t,"labelWrapCachedLines",e)||[]}var Md=function(e,t){return function(n){var a=e(n),i=RA(n,t);return i.length>1?i.map(function(o,s){return"".concat(a,"_").concat(s)}):a}},kd=function(e,t){return function(n,a){var i=e(n);if(typeof a=="string"){var o=a.indexOf("_");if(o>0){var s=Number(a.substring(o+1)),u=RA(n,t),l=i.h/u.length,c=l*s,v=i.y1+c;return{x1:i.x1,w:i.w,y1:v,h:l,yOffset:c}}}return i}};function hV(r){{var e=r.render;r.render=function(i){i=i||{};var o=r.cy;r.webgl&&(o.zoom()>bA?(gV(r),e.call(r,i)):(pV(r),PA(r,i,Ho.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,o,s,u){return EV(r,i,o)};{var n=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){n.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var a=r.notify;r.notify=function(i,o){a.call(r,i,o),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(o,{type:"node-body"})}}}function gV(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function pV(r){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r.canvasWidth,r.canvasHeight),n.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function yV(r){var e=r.canvasWidth,t=r.canvasHeight,n=jm(r),a=n.pan,i=n.zoom,o=Id();Nu(o,o,[a.x,a.y]),wm(o,o,[i,i]);var s=Id();tV(s,e,t);var u=Id();return rV(u,s,o),u}function AA(r,e){var t=r.canvasWidth,n=r.canvasHeight,a=jm(r),i=a.pan,o=a.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,n),e.translate(i.x,i.y),e.scale(o,o)}function mV(r,e){r.drawSelectionRectangle(e,function(t){return AA(r,t)})}function bV(r){var e=r.data.contexts[r.NODE];e.save(),AA(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function wV(r){var e=function(a,i,o){for(var s=a.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=s.atlases,c=0;c<l.length;c++){var v=l[c],h=v.canvas;if(h){var g=h.width,p=h.height,E=g*c,m=h.height*o,b=.4;u.save(),u.scale(b,b),u.drawImage(h,E,m),u.strokeStyle="black",u.rect(E,m,g,p),u.stroke(),u.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}function xV(r,e,t,n,a){var i,o,s,u,l=jm(r),c=l.pan,v=l.zoom;{var h=H$(r,c,v,e,t),g=Kr(h,2),p=g[0],E=g[1],m=6;i=p-m/2,o=E-m/2,s=m,u=m}if(s===0||u===0)return[];var b=r.data.contexts[r.WEBGL];b.bindFramebuffer(b.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(b.viewport(0,0,b.canvas.width,b.canvas.height),PA(r,null,Ho.PICKING),r.pickingFrameBuffer.needsDraw=!1);var w=s*u,x=new Uint8Array(w*4);b.readPixels(i,o,s,u,b.RGBA,b.UNSIGNED_BYTE,x),b.bindFramebuffer(b.FRAMEBUFFER,null);for(var _=new Set,C=0;C<w;C++){var R=x.slice(C*4,C*4+4),S=Y$(R)-1;S>=0&&_.add(S)}return _}function EV(r,e,t){var n=xV(r,e,t),a=r.getCachedZSortedEles(),i,o,s=Ft(n),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,c=a[l];if(!i&&c.isNode()&&(i=c),!o&&c.isEdge()&&(o=c),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function Ld(r,e,t){var n=r.drawing;e+=1,t.isNode()?(n.drawNode(t,e,"node-underlay"),n.drawNode(t,e,"node-body"),n.drawTexture(t,e,"label"),n.drawNode(t,e,"node-overlay")):(n.drawEdgeLine(t,e),n.drawEdgeArrow(t,e,"source"),n.drawEdgeArrow(t,e,"target"),n.drawTexture(t,e,"label"),n.drawTexture(t,e,"edge-source-label"),n.drawTexture(t,e,"edge-target-label"))}function PA(r,e,t){var n;r.webglDebug&&(n=performance.now());var a=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&mV(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var o=r.data.contexts[r.WEBGL];t.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=yV(r),u=r.getCachedZSortedEles();if(i=u.length,a.startFrame(s,t),t.screen){for(var l=0;l<u.nondrag.length;l++)Ld(r,l,u.nondrag[l]);for(var c=0;c<u.drag.length;c++)Ld(r,c,u.drag[c])}else if(t.picking)for(var v=0;v<u.length;v++)Ld(r,v,u[v]);a.endFrame(),t.screen&&r.webglDebugShowAtlases&&(bV(r),wV(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var h=performance.now(),g=!1,p=Math.ceil(h-n),E=a.getDebugInfo(),m=["".concat(i," elements"),"".concat(E.totalInstances," instances"),"".concat(E.batchCount," batches"),"".concat(E.totalAtlases," atlases"),"".concat(E.wrappedCount," wrapped textures"),"".concat(E.simpleCount," simple shapes")].join(", ");if(g)console.log("WebGL (".concat(t.name,") - time ").concat(p,"ms, ").concat(m));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(p,"ms")),console.log("Totals:"),console.log(" ".concat(m)),console.log("Texture Atlases Used:");var b=E.atlasInfo,w=Ft(b),x;try{for(w.s();!(x=w.n()).done;){var _=x.value;console.log(" ".concat(_.type,": ").concat(_.keyCount," keys, ").concat(_.atlasCount," atlases"))}}catch(C){w.e(C)}finally{w.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,a.gc())}var Ma={};Ma.drawPolygonPath=function(r,e,t,n,a,i){var o=n/2,s=a/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var u=1;u<i.length/2;u++)r.lineTo(e+o*i[u*2],t+s*i[u*2+1]);r.closePath()};Ma.drawRoundPolygonPath=function(r,e,t,n,a,i,o){o.forEach(function(s){return fA(r,s)}),r.closePath()};Ma.drawRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?_a(n,a):Math.min(i,s,o);r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.arcTo(e+o,t-s,e+o,t,u),r.arcTo(e+o,t+s,e,t+s,u),r.arcTo(e-o,t+s,e-o,t,u),r.arcTo(e-o,t-s,e,t-s,u),r.lineTo(e,t-s),r.closePath()};Ma.drawBottomRoundRectanglePath=function(r,e,t,n,a,i){var o=n/2,s=a/2,u=i==="auto"?_a(n,a):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.lineTo(e+o,t-s),r.lineTo(e+o,t),r.arcTo(e+o,t+s,e,t+s,u),r.arcTo(e-o,t+s,e-o,t,u),r.lineTo(e-o,t-s),r.lineTo(e,t-s),r.closePath()};Ma.drawCutRectanglePath=function(r,e,t,n,a,i,o){var s=n/2,u=a/2,l=o==="auto"?Mm():o;r.beginPath&&r.beginPath(),r.moveTo(e-s+l,t-u),r.lineTo(e+s-l,t-u),r.lineTo(e+s,t-u+l),r.lineTo(e+s,t+u-l),r.lineTo(e+s-l,t+u),r.lineTo(e-s+l,t+u),r.lineTo(e-s,t+u-l),r.lineTo(e-s,t-u+l),r.closePath()};Ma.drawBarrelPath=function(r,e,t,n,a){var i=n/2,o=a/2,s=e-i,u=e+i,l=t-o,c=t+o,v=om(n,a),h=v.widthOffset,g=v.heightOffset,p=v.ctrlPtOffsetPct*h;r.beginPath&&r.beginPath(),r.moveTo(s,l+g),r.lineTo(s,c-g),r.quadraticCurveTo(s+p,c,s+h,c),r.lineTo(u-h,c),r.quadraticCurveTo(u-p,c,u,c-g),r.lineTo(u,l+g),r.quadraticCurveTo(u-p,l,u-h,l),r.lineTo(s+h,l),r.quadraticCurveTo(s+p,l,s,l+g),r.closePath()};var iE=Math.sin(0),oE=Math.cos(0),xm={},Em={},DA=Math.PI/40;for(var $i=0*Math.PI;$i<2*Math.PI;$i+=DA)xm[$i]=Math.sin($i),Em[$i]=Math.cos($i);Ma.drawEllipsePath=function(r,e,t,n,a){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,n/2,a/2,0,0,2*Math.PI);else for(var i,o,s=n/2,u=a/2,l=0*Math.PI;l<2*Math.PI;l+=DA)i=e-s*xm[l]*iE+s*Em[l]*oE,o=t+u*Em[l]*iE+u*xm[l]*oE,l===0?r.moveTo(i,o):r.lineTo(i,o);r.closePath()};var bs={};bs.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};bs.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),n=t.boundingBox(),a=this.findContainerClientCoords(),i=r.full?Math.ceil(n.w):a[2],o=r.full?Math.ceil(n.h):a[3],s=De(r.maxWidth)||De(r.maxHeight),u=this.getPixelRatio(),l=1;if(r.scale!==void 0)i*=r.scale,o*=r.scale,l=r.scale;else if(s){var c=1/0,v=1/0;De(r.maxWidth)&&(c=l*r.maxWidth/i),De(r.maxHeight)&&(v=l*r.maxHeight/o),l=Math.min(c,v),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var h=document.createElement("canvas");h.width=i,h.height=o,h.style.width=i+"px",h.style.height=o+"px";var g=h.getContext("2d");if(i>0&&o>0){g.clearRect(0,0,i,o),g.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(r.full)g.translate(-n.x1*l,-n.y1*l),g.scale(l,l),this.drawElements(g,p),g.scale(1/l,1/l),g.translate(n.x1*l,n.y1*l);else{var E=e.pan(),m={x:E.x*l,y:E.y*l};l*=e.zoom(),g.translate(m.x,m.y),g.scale(l,l),this.drawElements(g,p),g.scale(1/l,1/l),g.translate(-m.x,-m.y)}r.bg&&(g.globalCompositeOperation="destination-over",g.fillStyle=r.bg,g.rect(0,0,i,o),g.fill())}return h};function _V(r,e){for(var t=atob(r),n=new ArrayBuffer(t.length),a=new Uint8Array(n),i=0;i<t.length;i++)a[i]=t.charCodeAt(i);return new Blob([n],{type:e})}function sE(r){var e=r.indexOf(",");return r.substr(e+1)}function IA(r,e,t){var n=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new to(function(a,i){try{e.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(o){i(o)}});case"blob":return _V(sE(n()),t);case"base64":return sE(n());case"base64uri":default:return n()}}bs.png=function(r){return IA(r,this.bufferCanvasImage(r),"image/png")};bs.jpg=function(r){return IA(r,this.bufferCanvasImage(r),"image/jpeg")};var BA={};BA.nodeShapeImpl=function(r,e,t,n,a,i,o,s){switch(r){case"ellipse":return this.drawEllipsePath(e,t,n,a,i);case"polygon":return this.drawPolygonPath(e,t,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,t,n,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,n,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,n,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,n,a,i,s);case"barrel":return this.drawBarrelPath(e,t,n,a,i)}};var CV=OA,ur=OA.prototype;ur.CANVAS_LAYERS=3;ur.SELECT_BOX=0;ur.DRAG=1;ur.NODE=2;ur.WEBGL=3;ur.CANVAS_TYPES=["2d","2d","2d","webgl2"];ur.BUFFER_COUNT=3;ur.TEXTURE_BUFFER=0;ur.MOTIONBLUR_BUFFER_NODE=1;ur.MOTIONBLUR_BUFFER_DRAG=2;function OA(r){var e=this,t=e.cy.window(),n=t.document;r.webgl&&(ur.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(ur.CANVAS_LAYERS),contexts:new Array(ur.CANVAS_LAYERS),canvasNeedsRedraw:new Array(ur.CANVAS_LAYERS),bufferCanvases:new Array(ur.BUFFER_COUNT),bufferContexts:new Array(ur.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=r.cy.container();s.appendChild(e.data.canvasContainer),s.style[a]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};mq()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<ur.CANVAS_LAYERS;l++){var c=e.data.canvases[l]=n.createElement("canvas"),v=ur.CANVAS_TYPES[l];e.data.contexts[l]=c.getContext(v),e.data.contexts[l]||Mr("Could not create canvas of type "+v),Object.keys(u).forEach(function(oe){c.style[oe]=u[oe]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(ur.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[ur.NODE].setAttribute("data-id","layer"+ur.NODE+"-node"),e.data.canvases[ur.SELECT_BOX].setAttribute("data-id","layer"+ur.SELECT_BOX+"-selectbox"),e.data.canvases[ur.DRAG].setAttribute("data-id","layer"+ur.DRAG+"-drag"),e.data.canvases[ur.WEBGL]&&e.data.canvases[ur.WEBGL].setAttribute("data-id","layer"+ur.WEBGL+"-webgl");for(var l=0;l<ur.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=n.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var h=Dt(),g=function(Y){return{x:(Y.x1+Y.x2)/2,y:(Y.y1+Y.y2)/2}},p=function(Y){return{x:-Y.w/2,y:-Y.h/2}},E=function(Y){var X=Y[0]._private,re=X.oldBackgroundTimestamp===X.backgroundTimestamp;return!re},m=function(Y){return Y[0]._private.nodeKey},b=function(Y){return Y[0]._private.labelStyleKey},w=function(Y){return Y[0]._private.sourceLabelStyleKey},x=function(Y){return Y[0]._private.targetLabelStyleKey},_=function(Y,X,re,le,he){return e.drawElement(Y,X,re,!1,!1,he)},C=function(Y,X,re,le,he){return e.drawElementText(Y,X,re,le,"main",he)},R=function(Y,X,re,le,he){return e.drawElementText(Y,X,re,le,"source",he)},S=function(Y,X,re,le,he){return e.drawElementText(Y,X,re,le,"target",he)},A=function(Y){return Y.boundingBox(),Y[0]._private.bodyBounds},P=function(Y){return Y.boundingBox(),Y[0]._private.labelBounds.main||h},I=function(Y){return Y.boundingBox(),Y[0]._private.labelBounds.source||h},D=function(Y){return Y.boundingBox(),Y[0]._private.labelBounds.target||h},M=function(Y,X){return X},O=function(Y){return g(A(Y))},N=function(Y,X,re){var le=Y?Y+"-":"";return{x:X.x+re.pstyle(le+"text-margin-x").pfValue,y:X.y+re.pstyle(le+"text-margin-y").pfValue}},V=function(Y,X,re){var le=Y[0]._private.rscratch;return{x:le[X],y:le[re]}},$=function(Y){return N("",V(Y,"labelX","labelY"),Y)},G=function(Y){return N("source",V(Y,"sourceLabelX","sourceLabelY"),Y)},U=function(Y){return N("target",V(Y,"targetLabelX","targetLabelY"),Y)},J=function(Y){return p(A(Y))},W=function(Y){return p(I(Y))},H=function(Y){return p(D(Y))},Z=function(Y){var X=P(Y),re=p(P(Y));if(Y.isNode()){switch(Y.pstyle("text-halign").value){case"left":re.x=-X.w-(X.leftPad||0);break;case"right":re.x=-(X.rightPad||0);break}switch(Y.pstyle("text-valign").value){case"top":re.y=-X.h-(X.topPad||0);break;case"bottom":re.y=-(X.botPad||0);break}}return re},ne=e.data.eleTxrCache=new No(e,{getKey:m,doesEleInvalidateKey:E,drawElement:_,getBoundingBox:A,getRotationPoint:O,getRotationOffset:J,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),F=e.data.lblTxrCache=new No(e,{getKey:b,drawElement:C,getBoundingBox:P,getRotationPoint:$,getRotationOffset:Z,isVisible:M}),z=e.data.slbTxrCache=new No(e,{getKey:w,drawElement:R,getBoundingBox:I,getRotationPoint:G,getRotationOffset:W,isVisible:M}),j=e.data.tlbTxrCache=new No(e,{getKey:x,drawElement:S,getBoundingBox:D,getRotationPoint:U,getRotationOffset:H,isVisible:M}),ee=e.data.lyrTxrCache=new wA(e);e.onUpdateEleCalcs(function(Y,X){ne.invalidateElements(X),F.invalidateElements(X),z.invalidateElements(X),j.invalidateElements(X),ee.invalidateElements(X);for(var re=0;re<X.length;re++){var le=X[re]._private;le.oldBackgroundTimestamp=le.backgroundTimestamp}});var ie=function(Y){for(var X=0;X<Y.length;X++)ee.enqueueElementRefinement(Y[X].ele)};ne.onDequeue(ie),F.onDequeue(ie),z.onDequeue(ie),j.onDequeue(ie),r.webgl&&e.initWebgl(r,{getStyleKey:m,getLabelKey:b,getSourceLabelKey:w,getTargetLabelKey:x,drawElement:_,drawLabel:C,drawSourceLabel:R,drawTargetLabel:S,getElementBox:A,getLabelBox:P,getSourceLabelBox:I,getTargetLabelBox:D,getElementRotationPoint:O,getElementRotationOffset:J,getLabelRotationPoint:$,getSourceLabelRotationPoint:G,getTargetLabelRotationPoint:U,getLabelRotationOffset:Z,getSourceLabelRotationOffset:W,getTargetLabelRotationOffset:H})}ur.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[ur.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[ur.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[ur.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var SV=typeof Path2D<"u";ur.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};ur.usePaths=function(){return SV&&this.pathsEnabled};ur.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};ur.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};ur.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":et(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var n=this.cy.window(),a=n.document;t=a.createElement("canvas"),t.width=r,t.height=e}return t};[xA,On,Xn,Km,li,Oa,It,TA,Ma,bs,BA].forEach(function(r){He(ur,r)});var TV=[{name:"null",impl:sA},{name:"base",impl:yA},{name:"canvas",impl:CV}],RV=[{type:"layout",extensions:Q5},{type:"renderer",extensions:TV}],MA={},kA={};function LA(r,e,t){var n=t,a=function(A){Er("Can not register `"+e+"` for `"+r+"` since `"+A+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(ns.prototype[e])return a(e);ns.prototype[e]=t}else if(r==="collection"){if(vt.prototype[e])return a(e);vt.prototype[e]=t}else if(r==="layout"){for(var i=function(A){this.options=A,t.call(this,A),pr(this._private)||(this._private={}),this._private.cy=A.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=t.prototype.stop;o.stop=function(){var S=this.options;if(S&&S.animate){var A=this.animations;if(A)for(var P=0;P<A.length;P++)A[P].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var v=function(A){return A._private.cy},h={addEventFields:function(A,P){P.layout=A,P.cy=v(A),P.target=A},bubble:function(){return!0},parent:function(A){return v(A)}};He(o,{createEmitter:function(){return this._private.emitter=new hl(h,this),this},emitter:function(){return this._private.emitter},on:function(A,P){return this.emitter().on(A,P),this},one:function(A,P){return this.emitter().one(A,P),this},once:function(A,P){return this.emitter().one(A,P),this},removeListener:function(A,P){return this.emitter().removeListener(A,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(A,P){return this.emitter().emit(A,P),this}}),xr.eventAliasesOn(o),n=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var g=qA("renderer","base"),p=g.prototype,E=t,m=t.prototype,b=function(){g.apply(this,arguments),E.apply(this,arguments)},w=b.prototype;for(var x in p){var _=p[x],C=m[x]!=null;if(C)return a(x);w[x]=_}for(var R in m)w[R]=m[R];p.clientFunctions.forEach(function(S){w[S]=w[S]||function(){Mr("Renderer does not implement `renderer."+S+"()` on its prototype")}}),n=b}else if(r==="__proto__"||r==="constructor"||r==="prototype")return Mr(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return r2({map:MA,keys:[r,e],value:n})}function qA(r,e){return t2({map:MA,keys:[r,e]})}function AV(r,e,t,n,a){return r2({map:kA,keys:[r,e,t,n],value:a})}function PV(r,e,t,n){return t2({map:kA,keys:[r,e,t,n]})}var _m=function(){if(arguments.length===2)return qA.apply(null,arguments);if(arguments.length===3)return LA.apply(null,arguments);if(arguments.length===4)return PV.apply(null,arguments);if(arguments.length===5)return AV.apply(null,arguments);Mr("Invalid extension access syntax")};ns.prototype.extension=_m;RV.forEach(function(r){r.extensions.forEach(function(e){LA(r.type,e.name,e.impl)})});var rl=function(){if(!(this instanceof rl))return new rl;this.length=0},oi=rl.prototype;oi.instanceString=function(){return"stylesheet"};oi.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};oi.css=function(r,e){var t=this.length-1;if(Ge(r))this[t].properties.push({name:r,value:e});else if(pr(r))for(var n=r,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o];if(s!=null){var u=it.properties[o]||it.properties[al(o)];if(u!=null){var l=u.name,c=s;this[t].properties.push({name:l,value:c})}}}return this};oi.style=oi.css;oi.generateStyle=function(r){var e=new it(r);return this.appendToStyle(e)};oi.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],n=t.selector,a=t.properties;r.selector(n);for(var i=0;i<a.length;i++){var o=a[i];r.css(o.name,o.value)}}return r};var DV="3.33.1",sn=function(e){if(e===void 0&&(e={}),pr(e))return new ns(e);if(Ge(e))return _m.apply(_m,arguments)};sn.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(sn),r.apply(null,e),this};sn.warnings=function(r){return l2(r)};sn.version=DV;sn.stylesheet=sn.Stylesheet=rl;var wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function El(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Fu={exports:{}};function Ym(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qd,uE;function IV(){if(uE)return qd;uE=1;function r(){this.__data__=[],this.size=0}return qd=r,qd}var Nd,lE;function so(){if(lE)return Nd;lE=1;function r(e,t){return e===t||e!==e&&t!==t}return Nd=r,Nd}var Fd,fE;function _l(){if(fE)return Fd;fE=1;var r=so();function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}return Fd=e,Fd}var zd,cE;function BV(){if(cE)return zd;cE=1;var r=_l(),e=Array.prototype,t=e.splice;function n(a){var i=this.__data__,o=r(i,a);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return zd=n,zd}var $d,dE;function OV(){if(dE)return $d;dE=1;var r=_l();function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}return $d=e,$d}var Vd,vE;function MV(){if(vE)return Vd;vE=1;var r=_l();function e(t){return r(this.__data__,t)>-1}return Vd=e,Vd}var Gd,hE;function kV(){if(hE)return Gd;hE=1;var r=_l();function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}return Gd=e,Gd}var Wd,gE;function Cl(){if(gE)return Wd;gE=1;var r=IV(),e=BV(),t=OV(),n=MV(),a=kV();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Wd=i,Wd}var Ud,pE;function LV(){if(pE)return Ud;pE=1;var r=Cl();function e(){this.__data__=new r,this.size=0}return Ud=e,Ud}var Hd,yE;function qV(){if(yE)return Hd;yE=1;function r(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return Hd=r,Hd}var Kd,mE;function NV(){if(mE)return Kd;mE=1;function r(e){return this.__data__.get(e)}return Kd=r,Kd}var jd,bE;function FV(){if(bE)return jd;bE=1;function r(e){return this.__data__.has(e)}return jd=r,jd}var Yd,wE;function NA(){if(wE)return Yd;wE=1;var r=typeof wt=="object"&&wt&&wt.Object===Object&&wt;return Yd=r,Yd}var Zd,xE;function xn(){if(xE)return Zd;xE=1;var r=NA(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Zd=t,Zd}var Xd,EE;function uo(){if(EE)return Xd;EE=1;var r=xn(),e=r.Symbol;return Xd=e,Xd}var Qd,_E;function zV(){if(_E)return Qd;_E=1;var r=uo(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;function i(o){var s=t.call(o,a),u=o[a];try{o[a]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[a]=u:delete o[a]),c}return Qd=i,Qd}var Jd,CE;function $V(){if(CE)return Jd;CE=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Jd=t,Jd}var ev,SE;function fi(){if(SE)return ev;SE=1;var r=uo(),e=zV(),t=$V(),n="[object Null]",a="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?a:n:i&&i in Object(s)?e(s):t(s)}return ev=o,ev}var rv,TE;function ln(){if(TE)return rv;TE=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return rv=r,rv}var tv,RE;function ws(){if(RE)return tv;RE=1;var r=fi(),e=ln(),t="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=r(s);return u==n||u==a||u==t||u==i}return tv=o,tv}var nv,AE;function VV(){if(AE)return nv;AE=1;var r=xn(),e=r["__core-js_shared__"];return nv=e,nv}var av,PE;function GV(){if(PE)return av;PE=1;var r=VV(),e=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function t(n){return!!e&&e in n}return av=t,av}var iv,DE;function FA(){if(DE)return iv;DE=1;var r=Function.prototype,e=r.toString;function t(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return iv=t,iv}var ov,IE;function WV(){if(IE)return ov;IE=1;var r=ws(),e=GV(),t=ln(),n=FA(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(h){if(!t(h)||e(h))return!1;var g=r(h)?c:i;return g.test(n(h))}return ov=v,ov}var sv,BE;function UV(){if(BE)return sv;BE=1;function r(e,t){return e==null?void 0:e[t]}return sv=r,sv}var uv,OE;function ci(){if(OE)return uv;OE=1;var r=WV(),e=UV();function t(n,a){var i=e(n,a);return r(i)?i:void 0}return uv=t,uv}var lv,ME;function Zm(){if(ME)return lv;ME=1;var r=ci(),e=xn(),t=r(e,"Map");return lv=t,lv}var fv,kE;function Sl(){if(kE)return fv;kE=1;var r=ci(),e=r(Object,"create");return fv=e,fv}var cv,LE;function HV(){if(LE)return cv;LE=1;var r=Sl();function e(){this.__data__=r?r(null):{},this.size=0}return cv=e,cv}var dv,qE;function KV(){if(qE)return dv;qE=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return dv=r,dv}var vv,NE;function jV(){if(NE)return vv;NE=1;var r=Sl(),e="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function a(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return n.call(o,i)?o[i]:void 0}return vv=a,vv}var hv,FE;function YV(){if(FE)return hv;FE=1;var r=Sl(),e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:t.call(i,a)}return hv=n,hv}var gv,zE;function ZV(){if(zE)return gv;zE=1;var r=Sl(),e="__lodash_hash_undefined__";function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&a===void 0?e:a,this}return gv=t,gv}var pv,$E;function XV(){if($E)return pv;$E=1;var r=HV(),e=KV(),t=jV(),n=YV(),a=ZV();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,pv=i,pv}var yv,VE;function QV(){if(VE)return yv;VE=1;var r=XV(),e=Cl(),t=Zm();function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return yv=n,yv}var mv,GE;function JV(){if(GE)return mv;GE=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return mv=r,mv}var bv,WE;function Tl(){if(WE)return bv;WE=1;var r=JV();function e(t,n){var a=t.__data__;return r(n)?a[typeof n=="string"?"string":"hash"]:a.map}return bv=e,bv}var wv,UE;function e3(){if(UE)return wv;UE=1;var r=Tl();function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}return wv=e,wv}var xv,HE;function r3(){if(HE)return xv;HE=1;var r=Tl();function e(t){return r(this,t).get(t)}return xv=e,xv}var Ev,KE;function t3(){if(KE)return Ev;KE=1;var r=Tl();function e(t){return r(this,t).has(t)}return Ev=e,Ev}var _v,jE;function n3(){if(jE)return _v;jE=1;var r=Tl();function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}return _v=e,_v}var Cv,YE;function Xm(){if(YE)return Cv;YE=1;var r=QV(),e=e3(),t=r3(),n=t3(),a=n3();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Cv=i,Cv}var Sv,ZE;function a3(){if(ZE)return Sv;ZE=1;var r=Cl(),e=Zm(),t=Xm(),n=200;function a(i,o){var s=this.__data__;if(s instanceof r){var u=s.__data__;if(!e||u.length<n-1)return u.push([i,o]),this.size=++s.size,this;s=this.__data__=new t(u)}return s.set(i,o),this.size=s.size,this}return Sv=a,Sv}var Tv,XE;function Rl(){if(XE)return Tv;XE=1;var r=Cl(),e=LV(),t=qV(),n=NV(),a=FV(),i=a3();function o(s){var u=this.__data__=new r(s);this.size=u.size}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,Tv=o,Tv}var Rv,QE;function Qm(){if(QE)return Rv;QE=1;function r(e,t){for(var n=-1,a=e==null?0:e.length;++n<a&&t(e[n],n,e)!==!1;);return e}return Rv=r,Rv}var Av,JE;function zA(){if(JE)return Av;JE=1;var r=ci(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return Av=e,Av}var Pv,e_;function Al(){if(e_)return Pv;e_=1;var r=zA();function e(t,n,a){n=="__proto__"&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}return Pv=e,Pv}var Dv,r_;function Pl(){if(r_)return Dv;r_=1;var r=Al(),e=so(),t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s){var u=i[o];(!(n.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&r(i,o,s)}return Dv=a,Dv}var Iv,t_;function xs(){if(t_)return Iv;t_=1;var r=Pl(),e=Al();function t(n,a,i,o){var s=!i;i||(i={});for(var u=-1,l=a.length;++u<l;){var c=a[u],v=o?o(i[c],n[c],c,i,n):void 0;v===void 0&&(v=n[c]),s?e(i,c,v):r(i,c,v)}return i}return Iv=t,Iv}var Bv,n_;function i3(){if(n_)return Bv;n_=1;function r(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}return Bv=r,Bv}var Ov,a_;function Mn(){if(a_)return Ov;a_=1;function r(e){return e!=null&&typeof e=="object"}return Ov=r,Ov}var Mv,i_;function o3(){if(i_)return Mv;i_=1;var r=fi(),e=Mn(),t="[object Arguments]";function n(a){return e(a)&&r(a)==t}return Mv=n,Mv}var kv,o_;function Es(){if(o_)return kv;o_=1;var r=o3(),e=Mn(),t=Object.prototype,n=t.hasOwnProperty,a=t.propertyIsEnumerable,i=r((function(){return arguments})())?r:function(o){return e(o)&&n.call(o,"callee")&&!a.call(o,"callee")};return kv=i,kv}var Lv,s_;function jr(){if(s_)return Lv;s_=1;var r=Array.isArray;return Lv=r,Lv}var Fo={exports:{}},qv,u_;function s3(){if(u_)return qv;u_=1;function r(){return!1}return qv=r,qv}Fo.exports;var l_;function lo(){return l_||(l_=1,(function(r,e){var t=xn(),n=s3(),a=e&&!e.nodeType&&e,i=a&&!0&&r&&!r.nodeType&&r,o=i&&i.exports===a,s=o?t.Buffer:void 0,u=s?s.isBuffer:void 0,l=u||n;r.exports=l})(Fo,Fo.exports)),Fo.exports}var Nv,f_;function Dl(){if(f_)return Nv;f_=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(n,a){var i=typeof n;return a=a??r,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return Nv=t,Nv}var Fv,c_;function Jm(){if(c_)return Fv;c_=1;var r=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=r}return Fv=e,Fv}var zv,d_;function u3(){if(d_)return zv;d_=1;var r=fi(),e=Jm(),t=Mn(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",v="[object Object]",h="[object RegExp]",g="[object Set]",p="[object String]",E="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",_="[object Int8Array]",C="[object Int16Array]",R="[object Int32Array]",S="[object Uint8Array]",A="[object Uint8ClampedArray]",P="[object Uint16Array]",I="[object Uint32Array]",D={};D[w]=D[x]=D[_]=D[C]=D[R]=D[S]=D[A]=D[P]=D[I]=!0,D[n]=D[a]=D[m]=D[i]=D[b]=D[o]=D[s]=D[u]=D[l]=D[c]=D[v]=D[h]=D[g]=D[p]=D[E]=!1;function M(O){return t(O)&&e(O.length)&&!!D[r(O)]}return zv=M,zv}var $v,v_;function Il(){if(v_)return $v;v_=1;function r(e){return function(t){return e(t)}}return $v=r,$v}var zo={exports:{}};zo.exports;var h_;function e0(){return h_||(h_=1,(function(r,e){var t=NA(),n=e&&!e.nodeType&&e,a=n&&!0&&r&&!r.nodeType&&r,i=a&&a.exports===n,o=i&&t.process,s=(function(){try{var u=a&&a.require&&a.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();r.exports=s})(zo,zo.exports)),zo.exports}var Vv,g_;function _s(){if(g_)return Vv;g_=1;var r=u3(),e=Il(),t=e0(),n=t&&t.isTypedArray,a=n?e(n):r;return Vv=a,Vv}var Gv,p_;function $A(){if(p_)return Gv;p_=1;var r=i3(),e=Es(),t=jr(),n=lo(),a=Dl(),i=_s(),o=Object.prototype,s=o.hasOwnProperty;function u(l,c){var v=t(l),h=!v&&e(l),g=!v&&!h&&n(l),p=!v&&!h&&!g&&i(l),E=v||h||g||p,m=E?r(l.length,String):[],b=m.length;for(var w in l)(c||s.call(l,w))&&!(E&&(w=="length"||g&&(w=="offset"||w=="parent")||p&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||a(w,b)))&&m.push(w);return m}return Gv=u,Gv}var Wv,y_;function Bl(){if(y_)return Wv;y_=1;var r=Object.prototype;function e(t){var n=t&&t.constructor,a=typeof n=="function"&&n.prototype||r;return t===a}return Wv=e,Wv}var Uv,m_;function VA(){if(m_)return Uv;m_=1;function r(e,t){return function(n){return e(t(n))}}return Uv=r,Uv}var Hv,b_;function l3(){if(b_)return Hv;b_=1;var r=VA(),e=r(Object.keys,Object);return Hv=e,Hv}var Kv,w_;function r0(){if(w_)return Kv;w_=1;var r=Bl(),e=l3(),t=Object.prototype,n=t.hasOwnProperty;function a(i){if(!r(i))return e(i);var o=[];for(var s in Object(i))n.call(i,s)&&s!="constructor"&&o.push(s);return o}return Kv=a,Kv}var jv,x_;function Qn(){if(x_)return jv;x_=1;var r=ws(),e=Jm();function t(n){return n!=null&&e(n.length)&&!r(n)}return jv=t,jv}var Yv,E_;function ka(){if(E_)return Yv;E_=1;var r=$A(),e=r0(),t=Qn();function n(a){return t(a)?r(a):e(a)}return Yv=n,Yv}var Zv,__;function f3(){if(__)return Zv;__=1;var r=xs(),e=ka();function t(n,a){return n&&r(a,e(a),n)}return Zv=t,Zv}var Xv,C_;function c3(){if(C_)return Xv;C_=1;function r(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return Xv=r,Xv}var Qv,S_;function d3(){if(S_)return Qv;S_=1;var r=ln(),e=Bl(),t=c3(),n=Object.prototype,a=n.hasOwnProperty;function i(o){if(!r(o))return t(o);var s=e(o),u=[];for(var l in o)l=="constructor"&&(s||!a.call(o,l))||u.push(l);return u}return Qv=i,Qv}var Jv,T_;function di(){if(T_)return Jv;T_=1;var r=$A(),e=d3(),t=Qn();function n(a){return t(a)?r(a,!0):e(a)}return Jv=n,Jv}var eh,R_;function v3(){if(R_)return eh;R_=1;var r=xs(),e=di();function t(n,a){return n&&r(a,e(a),n)}return eh=t,eh}var $o={exports:{}};$o.exports;var A_;function GA(){return A_||(A_=1,(function(r,e){var t=xn(),n=e&&!e.nodeType&&e,a=n&&!0&&r&&!r.nodeType&&r,i=a&&a.exports===n,o=i?t.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var v=l.length,h=s?s(v):new l.constructor(v);return l.copy(h),h}r.exports=u})($o,$o.exports)),$o.exports}var rh,P_;function WA(){if(P_)return rh;P_=1;function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}return rh=r,rh}var th,D_;function UA(){if(D_)return th;D_=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=0,o=[];++n<a;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}return th=r,th}var nh,I_;function HA(){if(I_)return nh;I_=1;function r(){return[]}return nh=r,nh}var ah,B_;function t0(){if(B_)return ah;B_=1;var r=UA(),e=HA(),t=Object.prototype,n=t.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),r(a(o),function(s){return n.call(o,s)}))}:e;return ah=i,ah}var ih,O_;function h3(){if(O_)return ih;O_=1;var r=xs(),e=t0();function t(n,a){return r(n,e(n),a)}return ih=t,ih}var oh,M_;function n0(){if(M_)return oh;M_=1;function r(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}return oh=r,oh}var sh,k_;function Ol(){if(k_)return sh;k_=1;var r=VA(),e=r(Object.getPrototypeOf,Object);return sh=e,sh}var uh,L_;function KA(){if(L_)return uh;L_=1;var r=n0(),e=Ol(),t=t0(),n=HA(),a=Object.getOwnPropertySymbols,i=a?function(o){for(var s=[];o;)r(s,t(o)),o=e(o);return s}:n;return uh=i,uh}var lh,q_;function g3(){if(q_)return lh;q_=1;var r=xs(),e=KA();function t(n,a){return r(n,e(n),a)}return lh=t,lh}var fh,N_;function jA(){if(N_)return fh;N_=1;var r=n0(),e=jr();function t(n,a,i){var o=a(n);return e(n)?o:r(o,i(n))}return fh=t,fh}var ch,F_;function YA(){if(F_)return ch;F_=1;var r=jA(),e=t0(),t=ka();function n(a){return r(a,t,e)}return ch=n,ch}var dh,z_;function p3(){if(z_)return dh;z_=1;var r=jA(),e=KA(),t=di();function n(a){return r(a,t,e)}return dh=n,dh}var vh,$_;function y3(){if($_)return vh;$_=1;var r=ci(),e=xn(),t=r(e,"DataView");return vh=t,vh}var hh,V_;function m3(){if(V_)return hh;V_=1;var r=ci(),e=xn(),t=r(e,"Promise");return hh=t,hh}var gh,G_;function ZA(){if(G_)return gh;G_=1;var r=ci(),e=xn(),t=r(e,"Set");return gh=t,gh}var ph,W_;function b3(){if(W_)return ph;W_=1;var r=ci(),e=xn(),t=r(e,"WeakMap");return ph=t,ph}var yh,U_;function fo(){if(U_)return yh;U_=1;var r=y3(),e=Zm(),t=m3(),n=ZA(),a=b3(),i=fi(),o=FA(),s="[object Map]",u="[object Object]",l="[object Promise]",c="[object Set]",v="[object WeakMap]",h="[object DataView]",g=o(r),p=o(e),E=o(t),m=o(n),b=o(a),w=i;return(r&&w(new r(new ArrayBuffer(1)))!=h||e&&w(new e)!=s||t&&w(t.resolve())!=l||n&&w(new n)!=c||a&&w(new a)!=v)&&(w=function(x){var _=i(x),C=_==u?x.constructor:void 0,R=C?o(C):"";if(R)switch(R){case g:return h;case p:return s;case E:return l;case m:return c;case b:return v}return _}),yh=w,yh}var mh,H_;function w3(){if(H_)return mh;H_=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n){var a=n.length,i=new n.constructor(a);return a&&typeof n[0]=="string"&&e.call(n,"index")&&(i.index=n.index,i.input=n.input),i}return mh=t,mh}var bh,K_;function XA(){if(K_)return bh;K_=1;var r=xn(),e=r.Uint8Array;return bh=e,bh}var wh,j_;function a0(){if(j_)return wh;j_=1;var r=XA();function e(t){var n=new t.constructor(t.byteLength);return new r(n).set(new r(t)),n}return wh=e,wh}var xh,Y_;function x3(){if(Y_)return xh;Y_=1;var r=a0();function e(t,n){var a=n?r(t.buffer):t.buffer;return new t.constructor(a,t.byteOffset,t.byteLength)}return xh=e,xh}var Eh,Z_;function E3(){if(Z_)return Eh;Z_=1;var r=/\w*$/;function e(t){var n=new t.constructor(t.source,r.exec(t));return n.lastIndex=t.lastIndex,n}return Eh=e,Eh}var _h,X_;function _3(){if(X_)return _h;X_=1;var r=uo(),e=r?r.prototype:void 0,t=e?e.valueOf:void 0;function n(a){return t?Object(t.call(a)):{}}return _h=n,_h}var Ch,Q_;function QA(){if(Q_)return Ch;Q_=1;var r=a0();function e(t,n){var a=n?r(t.buffer):t.buffer;return new t.constructor(a,t.byteOffset,t.length)}return Ch=e,Ch}var Sh,J_;function C3(){if(J_)return Sh;J_=1;var r=a0(),e=x3(),t=E3(),n=_3(),a=QA(),i="[object Boolean]",o="[object Date]",s="[object Map]",u="[object Number]",l="[object RegExp]",c="[object Set]",v="[object String]",h="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",E="[object Float32Array]",m="[object Float64Array]",b="[object Int8Array]",w="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",C="[object Uint8ClampedArray]",R="[object Uint16Array]",S="[object Uint32Array]";function A(P,I,D){var M=P.constructor;switch(I){case g:return r(P);case i:case o:return new M(+P);case p:return e(P,D);case E:case m:case b:case w:case x:case _:case C:case R:case S:return a(P,D);case s:return new M;case u:case v:return new M(P);case l:return t(P);case c:return new M;case h:return n(P)}}return Sh=A,Sh}var Th,eC;function JA(){if(eC)return Th;eC=1;var r=ln(),e=Object.create,t=(function(){function n(){}return function(a){if(!r(a))return{};if(e)return e(a);n.prototype=a;var i=new n;return n.prototype=void 0,i}})();return Th=t,Th}var Rh,rC;function eP(){if(rC)return Rh;rC=1;var r=JA(),e=Ol(),t=Bl();function n(a){return typeof a.constructor=="function"&&!t(a)?r(e(a)):{}}return Rh=n,Rh}var Ah,tC;function S3(){if(tC)return Ah;tC=1;var r=fo(),e=Mn(),t="[object Map]";function n(a){return e(a)&&r(a)==t}return Ah=n,Ah}var Ph,nC;function T3(){if(nC)return Ph;nC=1;var r=S3(),e=Il(),t=e0(),n=t&&t.isMap,a=n?e(n):r;return Ph=a,Ph}var Dh,aC;function R3(){if(aC)return Dh;aC=1;var r=fo(),e=Mn(),t="[object Set]";function n(a){return e(a)&&r(a)==t}return Dh=n,Dh}var Ih,iC;function A3(){if(iC)return Ih;iC=1;var r=R3(),e=Il(),t=e0(),n=t&&t.isSet,a=n?e(n):r;return Ih=a,Ih}var Bh,oC;function rP(){if(oC)return Bh;oC=1;var r=Rl(),e=Qm(),t=Pl(),n=f3(),a=v3(),i=GA(),o=WA(),s=h3(),u=g3(),l=YA(),c=p3(),v=fo(),h=w3(),g=C3(),p=eP(),E=jr(),m=lo(),b=T3(),w=ln(),x=A3(),_=ka(),C=di(),R=1,S=2,A=4,P="[object Arguments]",I="[object Array]",D="[object Boolean]",M="[object Date]",O="[object Error]",N="[object Function]",V="[object GeneratorFunction]",$="[object Map]",G="[object Number]",U="[object Object]",J="[object RegExp]",W="[object Set]",H="[object String]",Z="[object Symbol]",ne="[object WeakMap]",F="[object ArrayBuffer]",z="[object DataView]",j="[object Float32Array]",ee="[object Float64Array]",ie="[object Int8Array]",oe="[object Int16Array]",Y="[object Int32Array]",X="[object Uint8Array]",re="[object Uint8ClampedArray]",le="[object Uint16Array]",he="[object Uint32Array]",be={};be[P]=be[I]=be[F]=be[z]=be[D]=be[M]=be[j]=be[ee]=be[ie]=be[oe]=be[Y]=be[$]=be[G]=be[U]=be[J]=be[W]=be[H]=be[Z]=be[X]=be[re]=be[le]=be[he]=!0,be[O]=be[N]=be[ne]=!1;function fe(ue,Se,Ae,Te,Pe,Ie){var Le,Fe=Se&R,je=Se&S,lr=Se&A;if(Ae&&(Le=Pe?Ae(ue,Te,Pe,Ie):Ae(ue)),Le!==void 0)return Le;if(!w(ue))return ue;var ir=E(ue);if(ir){if(Le=h(ue),!Fe)return o(ue,Le)}else{var Xe=v(ue),fr=Xe==N||Xe==V;if(m(ue))return i(ue,Fe);if(Xe==U||Xe==P||fr&&!Pe){if(Le=je||fr?{}:p(ue),!Fe)return je?u(ue,a(Le,ue)):s(ue,n(Le,ue))}else{if(!be[Xe])return Pe?ue:{};Le=g(ue,Xe,Fe)}}Ie||(Ie=new r);var Ue=Ie.get(ue);if(Ue)return Ue;Ie.set(ue,Le),x(ue)?ue.forEach(function(L){Le.add(fe(L,Se,Ae,L,ue,Ie))}):b(ue)&&ue.forEach(function(L,se){Le.set(se,fe(L,Se,Ae,se,ue,Ie))});var Oe=lr?je?c:l:je?C:_,ge=ir?void 0:Oe(ue);return e(ge||ue,function(L,se){ge&&(se=L,L=ue[se]),t(Le,se,fe(L,Se,Ae,se,ue,Ie))}),Le}return Bh=fe,Bh}var Oh,sC;function P3(){if(sC)return Oh;sC=1;var r=rP(),e=4;function t(n){return r(n,e)}return Oh=t,Oh}var Mh,uC;function i0(){if(uC)return Mh;uC=1;function r(e){return function(){return e}}return Mh=r,Mh}var kh,lC;function D3(){if(lC)return kh;lC=1;function r(e){return function(t,n,a){for(var i=-1,o=Object(t),s=a(t),u=s.length;u--;){var l=s[e?u:++i];if(n(o[l],l,o)===!1)break}return t}}return kh=r,kh}var Lh,fC;function o0(){if(fC)return Lh;fC=1;var r=D3(),e=r();return Lh=e,Lh}var qh,cC;function s0(){if(cC)return qh;cC=1;var r=o0(),e=ka();function t(n,a){return n&&r(n,a,e)}return qh=t,qh}var Nh,dC;function I3(){if(dC)return Nh;dC=1;var r=Qn();function e(t,n){return function(a,i){if(a==null)return a;if(!r(a))return t(a,i);for(var o=a.length,s=n?o:-1,u=Object(a);(n?s--:++s<o)&&i(u[s],s,u)!==!1;);return a}}return Nh=e,Nh}var Fh,vC;function Ml(){if(vC)return Fh;vC=1;var r=s0(),e=I3(),t=e(r);return Fh=t,Fh}var zh,hC;function vi(){if(hC)return zh;hC=1;function r(e){return e}return zh=r,zh}var $h,gC;function tP(){if(gC)return $h;gC=1;var r=vi();function e(t){return typeof t=="function"?t:r}return $h=e,$h}var Vh,pC;function nP(){if(pC)return Vh;pC=1;var r=Qm(),e=Ml(),t=tP(),n=jr();function a(i,o){var s=n(i)?r:e;return s(i,t(o))}return Vh=a,Vh}var Gh,yC;function aP(){return yC||(yC=1,Gh=nP()),Gh}var Wh,mC;function B3(){if(mC)return Wh;mC=1;var r=Ml();function e(t,n){var a=[];return r(t,function(i,o,s){n(i,o,s)&&a.push(i)}),a}return Wh=e,Wh}var Uh,bC;function O3(){if(bC)return Uh;bC=1;var r="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,r),this}return Uh=e,Uh}var Hh,wC;function M3(){if(wC)return Hh;wC=1;function r(e){return this.__data__.has(e)}return Hh=r,Hh}var Kh,xC;function iP(){if(xC)return Kh;xC=1;var r=Xm(),e=O3(),t=M3();function n(a){var i=-1,o=a==null?0:a.length;for(this.__data__=new r;++i<o;)this.add(a[i])}return n.prototype.add=n.prototype.push=e,n.prototype.has=t,Kh=n,Kh}var jh,EC;function k3(){if(EC)return jh;EC=1;function r(e,t){for(var n=-1,a=e==null?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}return jh=r,jh}var Yh,_C;function oP(){if(_C)return Yh;_C=1;function r(e,t){return e.has(t)}return Yh=r,Yh}var Zh,CC;function sP(){if(CC)return Zh;CC=1;var r=iP(),e=k3(),t=oP(),n=1,a=2;function i(o,s,u,l,c,v){var h=u&n,g=o.length,p=s.length;if(g!=p&&!(h&&p>g))return!1;var E=v.get(o),m=v.get(s);if(E&&m)return E==s&&m==o;var b=-1,w=!0,x=u&a?new r:void 0;for(v.set(o,s),v.set(s,o);++b<g;){var _=o[b],C=s[b];if(l)var R=h?l(C,_,b,s,o,v):l(_,C,b,o,s,v);if(R!==void 0){if(R)continue;w=!1;break}if(x){if(!e(s,function(S,A){if(!t(x,A)&&(_===S||c(_,S,u,l,v)))return x.push(A)})){w=!1;break}}else if(!(_===C||c(_,C,u,l,v))){w=!1;break}}return v.delete(o),v.delete(s),w}return Zh=i,Zh}var Xh,SC;function L3(){if(SC)return Xh;SC=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(a,i){n[++t]=[i,a]}),n}return Xh=r,Xh}var Qh,TC;function u0(){if(TC)return Qh;TC=1;function r(e){var t=-1,n=Array(e.size);return e.forEach(function(a){n[++t]=a}),n}return Qh=r,Qh}var Jh,RC;function q3(){if(RC)return Jh;RC=1;var r=uo(),e=XA(),t=so(),n=sP(),a=L3(),i=u0(),o=1,s=2,u="[object Boolean]",l="[object Date]",c="[object Error]",v="[object Map]",h="[object Number]",g="[object RegExp]",p="[object Set]",E="[object String]",m="[object Symbol]",b="[object ArrayBuffer]",w="[object DataView]",x=r?r.prototype:void 0,_=x?x.valueOf:void 0;function C(R,S,A,P,I,D,M){switch(A){case w:if(R.byteLength!=S.byteLength||R.byteOffset!=S.byteOffset)return!1;R=R.buffer,S=S.buffer;case b:return!(R.byteLength!=S.byteLength||!D(new e(R),new e(S)));case u:case l:case h:return t(+R,+S);case c:return R.name==S.name&&R.message==S.message;case g:case E:return R==S+"";case v:var O=a;case p:var N=P&o;if(O||(O=i),R.size!=S.size&&!N)return!1;var V=M.get(R);if(V)return V==S;P|=s,M.set(R,S);var $=n(O(R),O(S),P,I,D,M);return M.delete(R),$;case m:if(_)return _.call(R)==_.call(S)}return!1}return Jh=C,Jh}var eg,AC;function N3(){if(AC)return eg;AC=1;var r=YA(),e=1,t=Object.prototype,n=t.hasOwnProperty;function a(i,o,s,u,l,c){var v=s&e,h=r(i),g=h.length,p=r(o),E=p.length;if(g!=E&&!v)return!1;for(var m=g;m--;){var b=h[m];if(!(v?b in o:n.call(o,b)))return!1}var w=c.get(i),x=c.get(o);if(w&&x)return w==o&&x==i;var _=!0;c.set(i,o),c.set(o,i);for(var C=v;++m<g;){b=h[m];var R=i[b],S=o[b];if(u)var A=v?u(S,R,b,o,i,c):u(R,S,b,i,o,c);if(!(A===void 0?R===S||l(R,S,s,u,c):A)){_=!1;break}C||(C=b=="constructor")}if(_&&!C){var P=i.constructor,I=o.constructor;P!=I&&"constructor"in i&&"constructor"in o&&!(typeof P=="function"&&P instanceof P&&typeof I=="function"&&I instanceof I)&&(_=!1)}return c.delete(i),c.delete(o),_}return eg=a,eg}var rg,PC;function F3(){if(PC)return rg;PC=1;var r=Rl(),e=sP(),t=q3(),n=N3(),a=fo(),i=jr(),o=lo(),s=_s(),u=1,l="[object Arguments]",c="[object Array]",v="[object Object]",h=Object.prototype,g=h.hasOwnProperty;function p(E,m,b,w,x,_){var C=i(E),R=i(m),S=C?c:a(E),A=R?c:a(m);S=S==l?v:S,A=A==l?v:A;var P=S==v,I=A==v,D=S==A;if(D&&o(E)){if(!o(m))return!1;C=!0,P=!1}if(D&&!P)return _||(_=new r),C||s(E)?e(E,m,b,w,x,_):t(E,m,S,b,w,x,_);if(!(b&u)){var M=P&&g.call(E,"__wrapped__"),O=I&&g.call(m,"__wrapped__");if(M||O){var N=M?E.value():E,V=O?m.value():m;return _||(_=new r),x(N,V,b,w,_)}}return D?(_||(_=new r),n(E,m,b,w,x,_)):!1}return rg=p,rg}var tg,DC;function uP(){if(DC)return tg;DC=1;var r=F3(),e=Mn();function t(n,a,i,o,s){return n===a?!0:n==null||a==null||!e(n)&&!e(a)?n!==n&&a!==a:r(n,a,i,o,t,s)}return tg=t,tg}var ng,IC;function z3(){if(IC)return ng;IC=1;var r=Rl(),e=uP(),t=1,n=2;function a(i,o,s,u){var l=s.length,c=l,v=!u;if(i==null)return!c;for(i=Object(i);l--;){var h=s[l];if(v&&h[2]?h[1]!==i[h[0]]:!(h[0]in i))return!1}for(;++l<c;){h=s[l];var g=h[0],p=i[g],E=h[1];if(v&&h[2]){if(p===void 0&&!(g in i))return!1}else{var m=new r;if(u)var b=u(p,E,g,i,o,m);if(!(b===void 0?e(E,p,t|n,u,m):b))return!1}}return!0}return ng=a,ng}var ag,BC;function lP(){if(BC)return ag;BC=1;var r=ln();function e(t){return t===t&&!r(t)}return ag=e,ag}var ig,OC;function $3(){if(OC)return ig;OC=1;var r=lP(),e=ka();function t(n){for(var a=e(n),i=a.length;i--;){var o=a[i],s=n[o];a[i]=[o,s,r(s)]}return a}return ig=t,ig}var og,MC;function fP(){if(MC)return og;MC=1;function r(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}return og=r,og}var sg,kC;function V3(){if(kC)return sg;kC=1;var r=z3(),e=$3(),t=fP();function n(a){var i=e(a);return i.length==1&&i[0][2]?t(i[0][0],i[0][1]):function(o){return o===a||r(o,a,i)}}return sg=n,sg}var ug,LC;function co(){if(LC)return ug;LC=1;var r=fi(),e=Mn(),t="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&r(a)==t}return ug=n,ug}var lg,qC;function l0(){if(qC)return lg;qC=1;var r=jr(),e=co(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:n.test(i)||!t.test(i)||o!=null&&i in Object(o)}return lg=a,lg}var fg,NC;function G3(){if(NC)return fg;NC=1;var r=Xm(),e="Expected a function";function t(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,fg=t,fg}var cg,FC;function W3(){if(FC)return cg;FC=1;var r=G3(),e=500;function t(n){var a=r(n,function(o){return i.size===e&&i.clear(),o}),i=a.cache;return a}return cg=t,cg}var dg,zC;function U3(){if(zC)return dg;zC=1;var r=W3(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(o,s,u,l){i.push(u?l.replace(t,"$1"):s||o)}),i});return dg=n,dg}var vg,$C;function kl(){if($C)return vg;$C=1;function r(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}return vg=r,vg}var hg,VC;function H3(){if(VC)return hg;VC=1;var r=uo(),e=kl(),t=jr(),n=co(),a=r?r.prototype:void 0,i=a?a.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(n(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return hg=o,hg}var gg,GC;function cP(){if(GC)return gg;GC=1;var r=H3();function e(t){return t==null?"":r(t)}return gg=e,gg}var pg,WC;function Ll(){if(WC)return pg;WC=1;var r=jr(),e=l0(),t=U3(),n=cP();function a(i,o){return r(i)?i:e(i,o)?[i]:t(n(i))}return pg=a,pg}var yg,UC;function Cs(){if(UC)return yg;UC=1;var r=co();function e(t){if(typeof t=="string"||r(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return yg=e,yg}var mg,HC;function ql(){if(HC)return mg;HC=1;var r=Ll(),e=Cs();function t(n,a){a=r(a,n);for(var i=0,o=a.length;n!=null&&i<o;)n=n[e(a[i++])];return i&&i==o?n:void 0}return mg=t,mg}var bg,KC;function K3(){if(KC)return bg;KC=1;var r=ql();function e(t,n,a){var i=t==null?void 0:r(t,n);return i===void 0?a:i}return bg=e,bg}var wg,jC;function j3(){if(jC)return wg;jC=1;function r(e,t){return e!=null&&t in Object(e)}return wg=r,wg}var xg,YC;function dP(){if(YC)return xg;YC=1;var r=Ll(),e=Es(),t=jr(),n=Dl(),a=Jm(),i=Cs();function o(s,u,l){u=r(u,s);for(var c=-1,v=u.length,h=!1;++c<v;){var g=i(u[c]);if(!(h=s!=null&&l(s,g)))break;s=s[g]}return h||++c!=v?h:(v=s==null?0:s.length,!!v&&a(v)&&n(g,v)&&(t(s)||e(s)))}return xg=o,xg}var Eg,ZC;function vP(){if(ZC)return Eg;ZC=1;var r=j3(),e=dP();function t(n,a){return n!=null&&e(n,a,r)}return Eg=t,Eg}var _g,XC;function Y3(){if(XC)return _g;XC=1;var r=uP(),e=K3(),t=vP(),n=l0(),a=lP(),i=fP(),o=Cs(),s=1,u=2;function l(c,v){return n(c)&&a(v)?i(o(c),v):function(h){var g=e(h,c);return g===void 0&&g===v?t(h,c):r(v,g,s|u)}}return _g=l,_g}var Cg,QC;function hP(){if(QC)return Cg;QC=1;function r(e){return function(t){return t==null?void 0:t[e]}}return Cg=r,Cg}var Sg,JC;function Z3(){if(JC)return Sg;JC=1;var r=ql();function e(t){return function(n){return r(n,t)}}return Sg=e,Sg}var Tg,eS;function X3(){if(eS)return Tg;eS=1;var r=hP(),e=Z3(),t=l0(),n=Cs();function a(i){return t(i)?r(n(i)):e(i)}return Tg=a,Tg}var Rg,rS;function Jn(){if(rS)return Rg;rS=1;var r=V3(),e=Y3(),t=vi(),n=jr(),a=X3();function i(o){return typeof o=="function"?o:o==null?t:typeof o=="object"?n(o)?e(o[0],o[1]):r(o):a(o)}return Rg=i,Rg}var Ag,tS;function gP(){if(tS)return Ag;tS=1;var r=UA(),e=B3(),t=Jn(),n=jr();function a(i,o){var s=n(i)?r:e;return s(i,t(o,3))}return Ag=a,Ag}var Pg,nS;function Q3(){if(nS)return Pg;nS=1;var r=Object.prototype,e=r.hasOwnProperty;function t(n,a){return n!=null&&e.call(n,a)}return Pg=t,Pg}var Dg,aS;function pP(){if(aS)return Dg;aS=1;var r=Q3(),e=dP();function t(n,a){return n!=null&&e(n,a,r)}return Dg=t,Dg}var Ig,iS;function J3(){if(iS)return Ig;iS=1;var r=r0(),e=fo(),t=Es(),n=jr(),a=Qn(),i=lo(),o=Bl(),s=_s(),u="[object Map]",l="[object Set]",c=Object.prototype,v=c.hasOwnProperty;function h(g){if(g==null)return!0;if(a(g)&&(n(g)||typeof g=="string"||typeof g.splice=="function"||i(g)||s(g)||t(g)))return!g.length;var p=e(g);if(p==u||p==l)return!g.size;if(o(g))return!r(g).length;for(var E in g)if(v.call(g,E))return!1;return!0}return Ig=h,Ig}var Bg,oS;function yP(){if(oS)return Bg;oS=1;function r(e){return e===void 0}return Bg=r,Bg}var Og,sS;function mP(){if(sS)return Og;sS=1;var r=Ml(),e=Qn();function t(n,a){var i=-1,o=e(n)?Array(n.length):[];return r(n,function(s,u,l){o[++i]=a(s,u,l)}),o}return Og=t,Og}var Mg,uS;function bP(){if(uS)return Mg;uS=1;var r=kl(),e=Jn(),t=mP(),n=jr();function a(i,o){var s=n(i)?r:t;return s(i,e(o,3))}return Mg=a,Mg}var kg,lS;function eG(){if(lS)return kg;lS=1;function r(e,t,n,a){var i=-1,o=e==null?0:e.length;for(a&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}return kg=r,kg}var Lg,fS;function rG(){if(fS)return Lg;fS=1;function r(e,t,n,a,i){return i(e,function(o,s,u){n=a?(a=!1,o):t(n,o,s,u)}),n}return Lg=r,Lg}var qg,cS;function wP(){if(cS)return qg;cS=1;var r=eG(),e=Ml(),t=Jn(),n=rG(),a=jr();function i(o,s,u){var l=a(o)?r:n,c=arguments.length<3;return l(o,t(s,4),u,c,e)}return qg=i,qg}var Ng,dS;function tG(){if(dS)return Ng;dS=1;var r=fi(),e=jr(),t=Mn(),n="[object String]";function a(i){return typeof i=="string"||!e(i)&&t(i)&&r(i)==n}return Ng=a,Ng}var Fg,vS;function nG(){if(vS)return Fg;vS=1;var r=hP(),e=r("length");return Fg=e,Fg}var zg,hS;function aG(){if(hS)return zg;hS=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=e+t+n,i="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+r+a+i+"]");function u(l){return s.test(l)}return zg=u,zg}var $g,gS;function iG(){if(gS)return $g;gS=1;var r="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=e+t+n,i="\\ufe0e\\ufe0f",o="["+r+"]",s="["+a+"]",u="\\ud83c[\\udffb-\\udfff]",l="(?:"+s+"|"+u+")",c="[^"+r+"]",v="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=l+"?",E="["+i+"]?",m="(?:"+g+"(?:"+[c,v,h].join("|")+")"+E+p+")*",b=E+p+m,w="(?:"+[c+s+"?",s,v,h,o].join("|")+")",x=RegExp(u+"(?="+u+")|"+w+b,"g");function _(C){for(var R=x.lastIndex=0;x.test(C);)++R;return R}return $g=_,$g}var Vg,pS;function oG(){if(pS)return Vg;pS=1;var r=nG(),e=aG(),t=iG();function n(a){return e(a)?t(a):r(a)}return Vg=n,Vg}var Gg,yS;function sG(){if(yS)return Gg;yS=1;var r=r0(),e=fo(),t=Qn(),n=tG(),a=oG(),i="[object Map]",o="[object Set]";function s(u){if(u==null)return 0;if(t(u))return n(u)?a(u):u.length;var l=e(u);return l==i||l==o?u.size:r(u).length}return Gg=s,Gg}var Wg,mS;function uG(){if(mS)return Wg;mS=1;var r=Qm(),e=JA(),t=s0(),n=Jn(),a=Ol(),i=jr(),o=lo(),s=ws(),u=ln(),l=_s();function c(v,h,g){var p=i(v),E=p||o(v)||l(v);if(h=n(h,4),g==null){var m=v&&v.constructor;E?g=p?new m:[]:u(v)?g=s(m)?e(a(v)):{}:g={}}return(E?r:t)(v,function(b,w,x){return h(g,b,w,x)}),g}return Wg=c,Wg}var Ug,bS;function lG(){if(bS)return Ug;bS=1;var r=uo(),e=Es(),t=jr(),n=r?r.isConcatSpreadable:void 0;function a(i){return t(i)||e(i)||!!(n&&i&&i[n])}return Ug=a,Ug}var Hg,wS;function f0(){if(wS)return Hg;wS=1;var r=n0(),e=lG();function t(n,a,i,o,s){var u=-1,l=n.length;for(i||(i=e),s||(s=[]);++u<l;){var c=n[u];a>0&&i(c)?a>1?t(c,a-1,i,o,s):r(s,c):o||(s[s.length]=c)}return s}return Hg=t,Hg}var Kg,xS;function fG(){if(xS)return Kg;xS=1;function r(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return Kg=r,Kg}var jg,ES;function xP(){if(ES)return jg;ES=1;var r=fG(),e=Math.max;function t(n,a,i){return a=e(a===void 0?n.length-1:a,0),function(){for(var o=arguments,s=-1,u=e(o.length-a,0),l=Array(u);++s<u;)l[s]=o[a+s];s=-1;for(var c=Array(a+1);++s<a;)c[s]=o[s];return c[a]=i(l),r(n,this,c)}}return jg=t,jg}var Yg,_S;function cG(){if(_S)return Yg;_S=1;var r=i0(),e=zA(),t=vi(),n=e?function(a,i){return e(a,"toString",{configurable:!0,enumerable:!1,value:r(i),writable:!0})}:t;return Yg=n,Yg}var Zg,CS;function dG(){if(CS)return Zg;CS=1;var r=800,e=16,t=Date.now;function n(a){var i=0,o=0;return function(){var s=t(),u=e-(s-o);if(o=s,u>0){if(++i>=r)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Zg=n,Zg}var Xg,SS;function EP(){if(SS)return Xg;SS=1;var r=cG(),e=dG(),t=e(r);return Xg=t,Xg}var Qg,TS;function Nl(){if(TS)return Qg;TS=1;var r=vi(),e=xP(),t=EP();function n(a,i){return t(e(a,i,r),a+"")}return Qg=n,Qg}var Jg,RS;function _P(){if(RS)return Jg;RS=1;function r(e,t,n,a){for(var i=e.length,o=n+(a?1:-1);a?o--:++o<i;)if(t(e[o],o,e))return o;return-1}return Jg=r,Jg}var ep,AS;function vG(){if(AS)return ep;AS=1;function r(e){return e!==e}return ep=r,ep}var rp,PS;function hG(){if(PS)return rp;PS=1;function r(e,t,n){for(var a=n-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}return rp=r,rp}var tp,DS;function gG(){if(DS)return tp;DS=1;var r=_P(),e=vG(),t=hG();function n(a,i,o){return i===i?t(a,i,o):r(a,e,o)}return tp=n,tp}var np,IS;function pG(){if(IS)return np;IS=1;var r=gG();function e(t,n){var a=t==null?0:t.length;return!!a&&r(t,n,0)>-1}return np=e,np}var ap,BS;function yG(){if(BS)return ap;BS=1;function r(e,t,n){for(var a=-1,i=e==null?0:e.length;++a<i;)if(n(t,e[a]))return!0;return!1}return ap=r,ap}var ip,OS;function mG(){if(OS)return ip;OS=1;function r(){}return ip=r,ip}var op,MS;function bG(){if(MS)return op;MS=1;var r=ZA(),e=mG(),t=u0(),n=1/0,a=r&&1/t(new r([,-0]))[1]==n?function(i){return new r(i)}:e;return op=a,op}var sp,kS;function wG(){if(kS)return sp;kS=1;var r=iP(),e=pG(),t=yG(),n=oP(),a=bG(),i=u0(),o=200;function s(u,l,c){var v=-1,h=e,g=u.length,p=!0,E=[],m=E;if(c)p=!1,h=t;else if(g>=o){var b=l?null:a(u);if(b)return i(b);p=!1,h=n,m=new r}else m=l?[]:E;e:for(;++v<g;){var w=u[v],x=l?l(w):w;if(w=c||w!==0?w:0,p&&x===x){for(var _=m.length;_--;)if(m[_]===x)continue e;l&&m.push(x),E.push(w)}else h(m,x,c)||(m!==E&&m.push(x),E.push(w))}return E}return sp=s,sp}var up,LS;function CP(){if(LS)return up;LS=1;var r=Qn(),e=Mn();function t(n){return e(n)&&r(n)}return up=t,up}var lp,qS;function xG(){if(qS)return lp;qS=1;var r=f0(),e=Nl(),t=wG(),n=CP(),a=e(function(i){return t(r(i,1,n,!0))});return lp=a,lp}var fp,NS;function EG(){if(NS)return fp;NS=1;var r=kl();function e(t,n){return r(n,function(a){return t[a]})}return fp=e,fp}var cp,FS;function SP(){if(FS)return cp;FS=1;var r=EG(),e=ka();function t(n){return n==null?[]:r(n,e(n))}return cp=t,cp}var dp,zS;function fn(){if(zS)return dp;zS=1;var r;if(typeof Ym=="function")try{r={clone:P3(),constant:i0(),each:aP(),filter:gP(),has:pP(),isArray:jr(),isEmpty:J3(),isFunction:ws(),isUndefined:yP(),keys:ka(),map:bP(),reduce:wP(),size:sG(),transform:uG(),union:xG(),values:SP()}}catch{}return r||(r=window._),dp=r,dp}var vp,$S;function c0(){if($S)return vp;$S=1;var r=fn();vp=a;var e="\0",t="\0",n="";function a(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(c){return this._label=c,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return r.keys(this._nodes)},a.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(v){return r.isEmpty(c._in[v])})},a.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(v){return r.isEmpty(c._out[v])})},a.prototype.setNodes=function(c,v){var h=arguments,g=this;return r.each(c,function(p){h.length>1?g.setNode(p,v):g.setNode(p)}),this},a.prototype.setNode=function(c,v){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=v),this):(this._nodes[c]=arguments.length>1?v:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=t,this._children[c]={},this._children[t][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},a.prototype.node=function(c){return this._nodes[c]},a.prototype.hasNode=function(c){return r.has(this._nodes,c)},a.prototype.removeNode=function(c){var v=this;if(r.has(this._nodes,c)){var h=function(g){v.removeEdge(v._edgeObjs[g])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(g){v.setParent(g)}),delete this._children[c]),r.each(r.keys(this._in[c]),h),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),h),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},a.prototype.setParent=function(c,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(v))v=t;else{v+="";for(var h=v;!r.isUndefined(h);h=this.parent(h))if(h===c)throw new Error("Setting "+v+" as parent of "+c+" would create a cycle");this.setNode(v)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=v,this._children[v][c]=!0,this},a.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},a.prototype.parent=function(c){if(this._isCompound){var v=this._parent[c];if(v!==t)return v}},a.prototype.children=function(c){if(r.isUndefined(c)&&(c=t),this._isCompound){var v=this._children[c];if(v)return r.keys(v)}else{if(c===t)return this.nodes();if(this.hasNode(c))return[]}},a.prototype.predecessors=function(c){var v=this._preds[c];if(v)return r.keys(v)},a.prototype.successors=function(c){var v=this._sucs[c];if(v)return r.keys(v)},a.prototype.neighbors=function(c){var v=this.predecessors(c);if(v)return r.union(v,this.successors(c))},a.prototype.isLeaf=function(c){var v;return this.isDirected()?v=this.successors(c):v=this.neighbors(c),v.length===0},a.prototype.filterNodes=function(c){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var h=this;r.each(this._nodes,function(E,m){c(m)&&v.setNode(m,E)}),r.each(this._edgeObjs,function(E){v.hasNode(E.v)&&v.hasNode(E.w)&&v.setEdge(E,h.edge(E))});var g={};function p(E){var m=h.parent(E);return m===void 0||v.hasNode(m)?(g[E]=m,m):m in g?g[m]:p(m)}return this._isCompound&&r.each(v.nodes(),function(E){v.setParent(E,p(E))}),v},a.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return r.values(this._edgeObjs)},a.prototype.setPath=function(c,v){var h=this,g=arguments;return r.reduce(c,function(p,E){return g.length>1?h.setEdge(p,E,v):h.setEdge(p,E),E}),this},a.prototype.setEdge=function(){var c,v,h,g,p=!1,E=arguments[0];typeof E=="object"&&E!==null&&"v"in E?(c=E.v,v=E.w,h=E.name,arguments.length===2&&(g=arguments[1],p=!0)):(c=E,v=arguments[1],h=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),c=""+c,v=""+v,r.isUndefined(h)||(h=""+h);var m=s(this._isDirected,c,v,h);if(r.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!r.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(v),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(c,v,h);var b=u(this._isDirected,c,v,h);return c=b.v,v=b.w,Object.freeze(b),this._edgeObjs[m]=b,i(this._preds[v],c),i(this._sucs[c],v),this._in[v][m]=b,this._out[c][m]=b,this._edgeCount++,this},a.prototype.edge=function(c,v,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,v,h);return this._edgeLabels[g]},a.prototype.hasEdge=function(c,v,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,v,h);return r.has(this._edgeLabels,g)},a.prototype.removeEdge=function(c,v,h){var g=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,v,h),p=this._edgeObjs[g];return p&&(c=p.v,v=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],o(this._preds[v],c),o(this._sucs[c],v),delete this._in[v][g],delete this._out[c][g],this._edgeCount--),this},a.prototype.inEdges=function(c,v){var h=this._in[c];if(h){var g=r.values(h);return v?r.filter(g,function(p){return p.v===v}):g}},a.prototype.outEdges=function(c,v){var h=this._out[c];if(h){var g=r.values(h);return v?r.filter(g,function(p){return p.w===v}):g}},a.prototype.nodeEdges=function(c,v){var h=this.inEdges(c,v);if(h)return h.concat(this.outEdges(c,v))};function i(c,v){c[v]?c[v]++:c[v]=1}function o(c,v){--c[v]||delete c[v]}function s(c,v,h,g){var p=""+v,E=""+h;if(!c&&p>E){var m=p;p=E,E=m}return p+n+E+n+(r.isUndefined(g)?e:g)}function u(c,v,h,g){var p=""+v,E=""+h;if(!c&&p>E){var m=p;p=E,E=m}var b={v:p,w:E};return g&&(b.name=g),b}function l(c,v){return s(c,v.v,v.w,v.name)}return vp}var hp,VS;function _G(){return VS||(VS=1,hp="2.1.8"),hp}var gp,GS;function CG(){return GS||(GS=1,gp={Graph:c0(),version:_G()}),gp}var pp,WS;function SG(){if(WS)return pp;WS=1;var r=fn(),e=c0();pp={write:t,read:i};function t(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:a(o)};return r.isUndefined(o.graph())||(s.value=r.clone(o.graph())),s}function n(o){return r.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),c={v:s};return r.isUndefined(u)||(c.value=u),r.isUndefined(l)||(c.parent=l),c})}function a(o){return r.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return r.isUndefined(s.name)||(l.name=s.name),r.isUndefined(u)||(l.value=u),l})}function i(o){var s=new e(o.options).setGraph(o.value);return r.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),r.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return pp}var yp,US;function TG(){if(US)return yp;US=1;var r=fn();yp=e;function e(t){var n={},a=[],i;function o(s){r.has(n,s)||(n[s]=!0,i.push(s),r.each(t.successors(s),o),r.each(t.predecessors(s),o))}return r.each(t.nodes(),function(s){i=[],o(s),i.length&&a.push(i)}),a}return yp}var mp,HS;function TP(){if(HS)return mp;HS=1;var r=fn();mp=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(t){return r.has(this._keyIndices,t)},e.prototype.priority=function(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(t,n){var a=this._keyIndices;if(t=String(t),!r.has(a,t)){var i=this._arr,o=i.length;return a[t]=o,i.push({key:t,priority:n}),this._decrease(o),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,n){var a=this._keyIndices[t];if(n>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[a].priority+" New: "+n);this._arr[a].priority=n,this._decrease(a)},e.prototype._heapify=function(t){var n=this._arr,a=2*t,i=a+1,o=t;a<n.length&&(o=n[a].priority<n[o].priority?a:o,i<n.length&&(o=n[i].priority<n[o].priority?i:o),o!==t&&(this._swap(t,o),this._heapify(o)))},e.prototype._decrease=function(t){for(var n=this._arr,a=n[t].priority,i;t!==0&&(i=t>>1,!(n[i].priority<a));)this._swap(t,i),t=i},e.prototype._swap=function(t,n){var a=this._arr,i=this._keyIndices,o=a[t],s=a[n];a[t]=s,a[n]=o,i[s.key]=t,i[o.key]=n},mp}var bp,KS;function RP(){if(KS)return bp;KS=1;var r=fn(),e=TP();bp=n;var t=r.constant(1);function n(i,o,s,u){return a(i,String(o),s||t,u||function(l){return i.outEdges(l)})}function a(i,o,s,u){var l={},c=new e,v,h,g=function(p){var E=p.v!==v?p.v:p.w,m=l[E],b=s(p),w=h.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+b);w<m.distance&&(m.distance=w,m.predecessor=v,c.decrease(E,w))};for(i.nodes().forEach(function(p){var E=p===o?0:Number.POSITIVE_INFINITY;l[p]={distance:E},c.add(p,E)});c.size()>0&&(v=c.removeMin(),h=l[v],h.distance!==Number.POSITIVE_INFINITY);)u(v).forEach(g);return l}return bp}var wp,jS;function RG(){if(jS)return wp;jS=1;var r=RP(),e=fn();wp=t;function t(n,a,i){return e.transform(n.nodes(),function(o,s){o[s]=r(n,s,a,i)},{})}return wp}var xp,YS;function AP(){if(YS)return xp;YS=1;var r=fn();xp=e;function e(t){var n=0,a=[],i={},o=[];function s(u){var l=i[u]={onStack:!0,lowlink:n,index:n++};if(a.push(u),t.successors(u).forEach(function(h){r.has(i,h)?i[h].onStack&&(l.lowlink=Math.min(l.lowlink,i[h].index)):(s(h),l.lowlink=Math.min(l.lowlink,i[h].lowlink))}),l.lowlink===l.index){var c=[],v;do v=a.pop(),i[v].onStack=!1,c.push(v);while(u!==v);o.push(c)}}return t.nodes().forEach(function(u){r.has(i,u)||s(u)}),o}return xp}var Ep,ZS;function AG(){if(ZS)return Ep;ZS=1;var r=fn(),e=AP();Ep=t;function t(n){return r.filter(e(n),function(a){return a.length>1||a.length===1&&n.hasEdge(a[0],a[0])})}return Ep}var _p,XS;function PG(){if(XS)return _p;XS=1;var r=fn();_p=t;var e=r.constant(1);function t(a,i,o){return n(a,i||e,o||function(s){return a.outEdges(s)})}function n(a,i,o){var s={},u=a.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(c){var v=c.v===l?c.w:c.v,h=i(c);s[l][v]={distance:h,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(v){var h=s[v];u.forEach(function(g){var p=h[l],E=c[g],m=h[g],b=p.distance+E.distance;b<m.distance&&(m.distance=b,m.predecessor=E.predecessor)})})}),s}return _p}var Cp,QS;function PP(){if(QS)return Cp;QS=1;var r=fn();Cp=e,e.CycleException=t;function e(n){var a={},i={},o=[];function s(u){if(r.has(i,u))throw new t;r.has(a,u)||(i[u]=!0,a[u]=!0,r.each(n.predecessors(u),s),delete i[u],o.push(u))}if(r.each(n.sinks(),s),r.size(a)!==n.nodeCount())throw new t;return o}function t(){}return t.prototype=new Error,Cp}var Sp,JS;function DG(){if(JS)return Sp;JS=1;var r=PP();Sp=e;function e(t){try{r(t)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return Sp}var Tp,eT;function DP(){if(eT)return Tp;eT=1;var r=fn();Tp=e;function e(n,a,i){r.isArray(a)||(a=[a]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),s=[],u={};return r.each(a,function(l){if(!n.hasNode(l))throw new Error("Graph does not have node: "+l);t(n,l,i==="post",u,o,s)}),s}function t(n,a,i,o,s,u){r.has(o,a)||(o[a]=!0,i||u.push(a),r.each(s(a),function(l){t(n,l,i,o,s,u)}),i&&u.push(a))}return Tp}var Rp,rT;function IG(){if(rT)return Rp;rT=1;var r=DP();Rp=e;function e(t,n){return r(t,n,"post")}return Rp}var Ap,tT;function BG(){if(tT)return Ap;tT=1;var r=DP();Ap=e;function e(t,n){return r(t,n,"pre")}return Ap}var Pp,nT;function OG(){if(nT)return Pp;nT=1;var r=fn(),e=c0(),t=TP();Pp=n;function n(a,i){var o=new e,s={},u=new t,l;function c(h){var g=h.v===l?h.w:h.v,p=u.priority(g);if(p!==void 0){var E=i(h);E<p&&(s[g]=l,u.decrease(g,E))}}if(a.nodeCount()===0)return o;r.each(a.nodes(),function(h){u.add(h,Number.POSITIVE_INFINITY),o.setNode(h)}),u.decrease(a.nodes()[0],0);for(var v=!1;u.size()>0;){if(l=u.removeMin(),r.has(s,l))o.setEdge(l,s[l]);else{if(v)throw new Error("Input graph is not connected: "+a);v=!0}a.nodeEdges(l).forEach(c)}return o}return Pp}var Dp,aT;function MG(){return aT||(aT=1,Dp={components:TG(),dijkstra:RP(),dijkstraAll:RG(),findCycles:AG(),floydWarshall:PG(),isAcyclic:DG(),postorder:IG(),preorder:BG(),prim:OG(),tarjan:AP(),topsort:PP()}),Dp}var Ip,iT;function kG(){if(iT)return Ip;iT=1;var r=CG();return Ip={Graph:r.Graph,json:SG(),alg:MG(),version:r.version},Ip}var Bp,oT;function wn(){if(oT)return Bp;oT=1;var r;if(typeof Ym=="function")try{r=kG()}catch{}return r||(r=window.graphlib),Bp=r,Bp}var Op,sT;function LG(){if(sT)return Op;sT=1;var r=rP(),e=1,t=4;function n(a){return r(a,e|t)}return Op=n,Op}var Mp,uT;function Fl(){if(uT)return Mp;uT=1;var r=so(),e=Qn(),t=Dl(),n=ln();function a(i,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?e(s)&&t(o,s.length):u=="string"&&o in s)?r(s[o],i):!1}return Mp=a,Mp}var kp,lT;function qG(){if(lT)return kp;lT=1;var r=Nl(),e=so(),t=Fl(),n=di(),a=Object.prototype,i=a.hasOwnProperty,o=r(function(s,u){s=Object(s);var l=-1,c=u.length,v=c>2?u[2]:void 0;for(v&&t(u[0],u[1],v)&&(c=1);++l<c;)for(var h=u[l],g=n(h),p=-1,E=g.length;++p<E;){var m=g[p],b=s[m];(b===void 0||e(b,a[m])&&!i.call(s,m))&&(s[m]=h[m])}return s});return kp=o,kp}var Lp,fT;function NG(){if(fT)return Lp;fT=1;var r=Jn(),e=Qn(),t=ka();function n(a){return function(i,o,s){var u=Object(i);if(!e(i)){var l=r(o,3);i=t(i),o=function(v){return l(u[v],v,u)}}var c=a(i,o,s);return c>-1?u[l?i[c]:c]:void 0}}return Lp=n,Lp}var qp,cT;function FG(){if(cT)return qp;cT=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return qp=e,qp}var Np,dT;function zG(){if(dT)return Np;dT=1;var r=FG(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Np=t,Np}var Fp,vT;function $G(){if(vT)return Fp;vT=1;var r=zG(),e=ln(),t=co(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var v=i.test(l);return v||o.test(l)?s(l.slice(2),v?2:8):a.test(l)?n:+l}return Fp=u,Fp}var zp,hT;function IP(){if(hT)return zp;hT=1;var r=$G(),e=1/0,t=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=r(a),a===e||a===-e){var i=a<0?-1:1;return i*t}return a===a?a:0}return zp=n,zp}var $p,gT;function VG(){if(gT)return $p;gT=1;var r=IP();function e(t){var n=r(t),a=n%1;return n===n?a?n-a:n:0}return $p=e,$p}var Vp,pT;function GG(){if(pT)return Vp;pT=1;var r=_P(),e=Jn(),t=VG(),n=Math.max;function a(i,o,s){var u=i==null?0:i.length;if(!u)return-1;var l=s==null?0:t(s);return l<0&&(l=n(u+l,0)),r(i,e(o,3),l)}return Vp=a,Vp}var Gp,yT;function WG(){if(yT)return Gp;yT=1;var r=NG(),e=GG(),t=r(e);return Gp=t,Gp}var Wp,mT;function BP(){if(mT)return Wp;mT=1;var r=f0();function e(t){var n=t==null?0:t.length;return n?r(t,1):[]}return Wp=e,Wp}var Up,bT;function UG(){if(bT)return Up;bT=1;var r=o0(),e=tP(),t=di();function n(a,i){return a==null?a:r(a,e(i),t)}return Up=n,Up}var Hp,wT;function HG(){if(wT)return Hp;wT=1;function r(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return Hp=r,Hp}var Kp,xT;function KG(){if(xT)return Kp;xT=1;var r=Al(),e=s0(),t=Jn();function n(a,i){var o={};return i=t(i,3),e(a,function(s,u,l){r(o,u,i(s,u,l))}),o}return Kp=n,Kp}var jp,ET;function d0(){if(ET)return jp;ET=1;var r=co();function e(t,n,a){for(var i=-1,o=t.length;++i<o;){var s=t[i],u=n(s);if(u!=null&&(l===void 0?u===u&&!r(u):a(u,l)))var l=u,c=s}return c}return jp=e,jp}var Yp,_T;function jG(){if(_T)return Yp;_T=1;function r(e,t){return e>t}return Yp=r,Yp}var Zp,CT;function YG(){if(CT)return Zp;CT=1;var r=d0(),e=jG(),t=vi();function n(a){return a&&a.length?r(a,t,e):void 0}return Zp=n,Zp}var Xp,ST;function OP(){if(ST)return Xp;ST=1;var r=Al(),e=so();function t(n,a,i){(i!==void 0&&!e(n[a],i)||i===void 0&&!(a in n))&&r(n,a,i)}return Xp=t,Xp}var Qp,TT;function ZG(){if(TT)return Qp;TT=1;var r=fi(),e=Ol(),t=Mn(),n="[object Object]",a=Function.prototype,i=Object.prototype,o=a.toString,s=i.hasOwnProperty,u=o.call(Object);function l(c){if(!t(c)||r(c)!=n)return!1;var v=e(c);if(v===null)return!0;var h=s.call(v,"constructor")&&v.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==u}return Qp=l,Qp}var Jp,RT;function MP(){if(RT)return Jp;RT=1;function r(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return Jp=r,Jp}var ey,AT;function XG(){if(AT)return ey;AT=1;var r=xs(),e=di();function t(n){return r(n,e(n))}return ey=t,ey}var ry,PT;function QG(){if(PT)return ry;PT=1;var r=OP(),e=GA(),t=QA(),n=WA(),a=eP(),i=Es(),o=jr(),s=CP(),u=lo(),l=ws(),c=ln(),v=ZG(),h=_s(),g=MP(),p=XG();function E(m,b,w,x,_,C,R){var S=g(m,w),A=g(b,w),P=R.get(A);if(P){r(m,w,P);return}var I=C?C(S,A,w+"",m,b,R):void 0,D=I===void 0;if(D){var M=o(A),O=!M&&u(A),N=!M&&!O&&h(A);I=A,M||O||N?o(S)?I=S:s(S)?I=n(S):O?(D=!1,I=e(A,!0)):N?(D=!1,I=t(A,!0)):I=[]:v(A)||i(A)?(I=S,i(S)?I=p(S):(!c(S)||l(S))&&(I=a(A))):D=!1}D&&(R.set(A,I),_(I,A,x,C,R),R.delete(A)),r(m,w,I)}return ry=E,ry}var ty,DT;function JG(){if(DT)return ty;DT=1;var r=Rl(),e=OP(),t=o0(),n=QG(),a=ln(),i=di(),o=MP();function s(u,l,c,v,h){u!==l&&t(l,function(g,p){if(h||(h=new r),a(g))n(u,l,p,c,s,v,h);else{var E=v?v(o(u,p),g,p+"",u,l,h):void 0;E===void 0&&(E=g),e(u,p,E)}},i)}return ty=s,ty}var ny,IT;function e4(){if(IT)return ny;IT=1;var r=Nl(),e=Fl();function t(n){return r(function(a,i){var o=-1,s=i.length,u=s>1?i[s-1]:void 0,l=s>2?i[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&e(i[0],i[1],l)&&(u=s<3?void 0:u,s=1),a=Object(a);++o<s;){var c=i[o];c&&n(a,c,o,u)}return a})}return ny=t,ny}var ay,BT;function r4(){if(BT)return ay;BT=1;var r=JG(),e=e4(),t=e(function(n,a,i){r(n,a,i)});return ay=t,ay}var iy,OT;function kP(){if(OT)return iy;OT=1;function r(e,t){return e<t}return iy=r,iy}var oy,MT;function t4(){if(MT)return oy;MT=1;var r=d0(),e=kP(),t=vi();function n(a){return a&&a.length?r(a,t,e):void 0}return oy=n,oy}var sy,kT;function n4(){if(kT)return sy;kT=1;var r=d0(),e=Jn(),t=kP();function n(a,i){return a&&a.length?r(a,e(i,2),t):void 0}return sy=n,sy}var uy,LT;function a4(){if(LT)return uy;LT=1;var r=xn(),e=function(){return r.Date.now()};return uy=e,uy}var ly,qT;function i4(){if(qT)return ly;qT=1;var r=Pl(),e=Ll(),t=Dl(),n=ln(),a=Cs();function i(o,s,u,l){if(!n(o))return o;s=e(s,o);for(var c=-1,v=s.length,h=v-1,g=o;g!=null&&++c<v;){var p=a(s[c]),E=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(c!=h){var m=g[p];E=l?l(m,p,g):void 0,E===void 0&&(E=n(m)?m:t(s[c+1])?[]:{})}r(g,p,E),g=g[p]}return o}return ly=i,ly}var fy,NT;function o4(){if(NT)return fy;NT=1;var r=ql(),e=i4(),t=Ll();function n(a,i,o){for(var s=-1,u=i.length,l={};++s<u;){var c=i[s],v=r(a,c);o(v,c)&&e(l,t(c,a),v)}return l}return fy=n,fy}var cy,FT;function s4(){if(FT)return cy;FT=1;var r=o4(),e=vP();function t(n,a){return r(n,a,function(i,o){return e(n,o)})}return cy=t,cy}var dy,zT;function u4(){if(zT)return dy;zT=1;var r=BP(),e=xP(),t=EP();function n(a){return t(e(a,void 0,r),a+"")}return dy=n,dy}var vy,$T;function l4(){if($T)return vy;$T=1;var r=s4(),e=u4(),t=e(function(n,a){return n==null?{}:r(n,a)});return vy=t,vy}var hy,VT;function f4(){if(VT)return hy;VT=1;var r=Math.ceil,e=Math.max;function t(n,a,i,o){for(var s=-1,u=e(r((a-n)/(i||1)),0),l=Array(u);u--;)l[o?u:++s]=n,n+=i;return l}return hy=t,hy}var gy,GT;function c4(){if(GT)return gy;GT=1;var r=f4(),e=Fl(),t=IP();function n(a){return function(i,o,s){return s&&typeof s!="number"&&e(i,o,s)&&(o=s=void 0),i=t(i),o===void 0?(o=i,i=0):o=t(o),s=s===void 0?i<o?1:-1:t(s),r(i,o,s,a)}}return gy=n,gy}var py,WT;function d4(){if(WT)return py;WT=1;var r=c4(),e=r();return py=e,py}var yy,UT;function v4(){if(UT)return yy;UT=1;function r(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return yy=r,yy}var my,HT;function h4(){if(HT)return my;HT=1;var r=co();function e(t,n){if(t!==n){var a=t!==void 0,i=t===null,o=t===t,s=r(t),u=n!==void 0,l=n===null,c=n===n,v=r(n);if(!l&&!v&&!s&&t>n||s&&u&&c&&!l&&!v||i&&u&&c||!a&&c||!o)return 1;if(!i&&!s&&!v&&t<n||v&&a&&o&&!i&&!s||l&&a&&o||!u&&o||!c)return-1}return 0}return my=e,my}var by,KT;function g4(){if(KT)return by;KT=1;var r=h4();function e(t,n,a){for(var i=-1,o=t.criteria,s=n.criteria,u=o.length,l=a.length;++i<u;){var c=r(o[i],s[i]);if(c){if(i>=l)return c;var v=a[i];return c*(v=="desc"?-1:1)}}return t.index-n.index}return by=e,by}var wy,jT;function p4(){if(jT)return wy;jT=1;var r=kl(),e=ql(),t=Jn(),n=mP(),a=v4(),i=Il(),o=g4(),s=vi(),u=jr();function l(c,v,h){v.length?v=r(v,function(E){return u(E)?function(m){return e(m,E.length===1?E[0]:E)}:E}):v=[s];var g=-1;v=r(v,i(t));var p=n(c,function(E,m,b){var w=r(v,function(x){return x(E)});return{criteria:w,index:++g,value:E}});return a(p,function(E,m){return o(E,m,h)})}return wy=l,wy}var xy,YT;function y4(){if(YT)return xy;YT=1;var r=f0(),e=p4(),t=Nl(),n=Fl(),a=t(function(i,o){if(i==null)return[];var s=o.length;return s>1&&n(i,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(i,r(o,1),[])});return xy=a,xy}var Ey,ZT;function m4(){if(ZT)return Ey;ZT=1;var r=cP(),e=0;function t(n){var a=++e;return r(n)+a}return Ey=t,Ey}var _y,XT;function b4(){if(XT)return _y;XT=1;function r(e,t,n){for(var a=-1,i=e.length,o=t.length,s={};++a<i;){var u=a<o?t[a]:void 0;n(s,e[a],u)}return s}return _y=r,_y}var Cy,QT;function w4(){if(QT)return Cy;QT=1;var r=Pl(),e=b4();function t(n,a){return e(n||[],a||[],r)}return Cy=t,Cy}var Sy,JT;function kr(){if(JT)return Sy;JT=1;var r;if(typeof Ym=="function")try{r={cloneDeep:LG(),constant:i0(),defaults:qG(),each:aP(),filter:gP(),find:WG(),flatten:BP(),forEach:nP(),forIn:UG(),has:pP(),isUndefined:yP(),last:HG(),map:bP(),mapValues:KG(),max:YG(),merge:r4(),min:t4(),minBy:n4(),now:a4(),pick:l4(),range:d4(),reduce:wP(),sortBy:y4(),uniqueId:m4(),values:SP(),zipObject:w4()}}catch{}return r||(r=window._),Sy=r,Sy}var Ty,eR;function x4(){if(eR)return Ty;eR=1,Ty=r;function r(){var n={};n._next=n._prev=n,this._sentinel=n}r.prototype.dequeue=function(){var n=this._sentinel,a=n._prev;if(a!==n)return e(a),a},r.prototype.enqueue=function(n){var a=this._sentinel;n._prev&&n._next&&e(n),n._next=a._next,a._next._prev=n,a._next=n,n._prev=a},r.prototype.toString=function(){for(var n=[],a=this._sentinel,i=a._prev;i!==a;)n.push(JSON.stringify(i,t)),i=i._prev;return"["+n.join(", ")+"]"};function e(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function t(n,a){if(n!=="_next"&&n!=="_prev")return a}return Ty}var Ry,rR;function E4(){if(rR)return Ry;rR=1;var r=kr(),e=wn().Graph,t=x4();Ry=a;var n=r.constant(1);function a(l,c){if(l.nodeCount()<=1)return[];var v=s(l,c||n),h=i(v.graph,v.buckets,v.zeroIdx);return r.flatten(r.map(h,function(g){return l.outEdges(g.v,g.w)}),!0)}function i(l,c,v){for(var h=[],g=c[c.length-1],p=c[0],E;l.nodeCount();){for(;E=p.dequeue();)o(l,c,v,E);for(;E=g.dequeue();)o(l,c,v,E);if(l.nodeCount()){for(var m=c.length-2;m>0;--m)if(E=c[m].dequeue(),E){h=h.concat(o(l,c,v,E,!0));break}}}return h}function o(l,c,v,h,g){var p=g?[]:void 0;return r.forEach(l.inEdges(h.v),function(E){var m=l.edge(E),b=l.node(E.v);g&&p.push({v:E.v,w:E.w}),b.out-=m,u(c,v,b)}),r.forEach(l.outEdges(h.v),function(E){var m=l.edge(E),b=E.w,w=l.node(b);w.in-=m,u(c,v,w)}),l.removeNode(h.v),p}function s(l,c){var v=new e,h=0,g=0;r.forEach(l.nodes(),function(m){v.setNode(m,{v:m,in:0,out:0})}),r.forEach(l.edges(),function(m){var b=v.edge(m.v,m.w)||0,w=c(m),x=b+w;v.setEdge(m.v,m.w,x),g=Math.max(g,v.node(m.v).out+=w),h=Math.max(h,v.node(m.w).in+=w)});var p=r.range(g+h+3).map(function(){return new t}),E=h+1;return r.forEach(v.nodes(),function(m){u(p,E,v.node(m))}),{graph:v,buckets:p,zeroIdx:E}}function u(l,c,v){v.out?v.in?l[v.out-v.in+c].enqueue(v):l[l.length-1].enqueue(v):l[0].enqueue(v)}return Ry}var Ay,tR;function _4(){if(tR)return Ay;tR=1;var r=kr(),e=E4();Ay={run:t,undo:a};function t(i){var o=i.graph().acyclicer==="greedy"?e(i,s(i)):n(i);r.forEach(o,function(u){var l=i.edge(u);i.removeEdge(u),l.forwardName=u.name,l.reversed=!0,i.setEdge(u.w,u.v,l,r.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(i){var o=[],s={},u={};function l(c){r.has(u,c)||(u[c]=!0,s[c]=!0,r.forEach(i.outEdges(c),function(v){r.has(s,v.w)?o.push(v):l(v.w)}),delete s[c])}return r.forEach(i.nodes(),l),o}function a(i){r.forEach(i.edges(),function(o){var s=i.edge(o);if(s.reversed){i.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,i.setEdge(o.w,o.v,s,u)}})}return Ay}var Py,nR;function zt(){if(nR)return Py;nR=1;var r=kr(),e=wn().Graph;Py={addDummyNode:t,simplify:n,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:v,maxRank:h,partition:g,time:p,notime:E};function t(m,b,w,x){var _;do _=r.uniqueId(x);while(m.hasNode(_));return w.dummy=b,m.setNode(_,w),_}function n(m){var b=new e().setGraph(m.graph());return r.forEach(m.nodes(),function(w){b.setNode(w,m.node(w))}),r.forEach(m.edges(),function(w){var x=b.edge(w.v,w.w)||{weight:0,minlen:1},_=m.edge(w);b.setEdge(w.v,w.w,{weight:x.weight+_.weight,minlen:Math.max(x.minlen,_.minlen)})}),b}function a(m){var b=new e({multigraph:m.isMultigraph()}).setGraph(m.graph());return r.forEach(m.nodes(),function(w){m.children(w).length||b.setNode(w,m.node(w))}),r.forEach(m.edges(),function(w){b.setEdge(w,m.edge(w))}),b}function i(m){var b=r.map(m.nodes(),function(w){var x={};return r.forEach(m.outEdges(w),function(_){x[_.w]=(x[_.w]||0)+m.edge(_).weight}),x});return r.zipObject(m.nodes(),b)}function o(m){var b=r.map(m.nodes(),function(w){var x={};return r.forEach(m.inEdges(w),function(_){x[_.v]=(x[_.v]||0)+m.edge(_).weight}),x});return r.zipObject(m.nodes(),b)}function s(m,b){var w=m.x,x=m.y,_=b.x-w,C=b.y-x,R=m.width/2,S=m.height/2;if(!_&&!C)throw new Error("Not possible to find intersection inside of the rectangle");var A,P;return Math.abs(C)*R>Math.abs(_)*S?(C<0&&(S=-S),A=S*_/C,P=S):(_<0&&(R=-R),A=R,P=R*C/_),{x:w+A,y:x+P}}function u(m){var b=r.map(r.range(h(m)+1),function(){return[]});return r.forEach(m.nodes(),function(w){var x=m.node(w),_=x.rank;r.isUndefined(_)||(b[_][x.order]=w)}),b}function l(m){var b=r.min(r.map(m.nodes(),function(w){return m.node(w).rank}));r.forEach(m.nodes(),function(w){var x=m.node(w);r.has(x,"rank")&&(x.rank-=b)})}function c(m){var b=r.min(r.map(m.nodes(),function(C){return m.node(C).rank})),w=[];r.forEach(m.nodes(),function(C){var R=m.node(C).rank-b;w[R]||(w[R]=[]),w[R].push(C)});var x=0,_=m.graph().nodeRankFactor;r.forEach(w,function(C,R){r.isUndefined(C)&&R%_!==0?--x:x&&r.forEach(C,function(S){m.node(S).rank+=x})})}function v(m,b,w,x){var _={width:0,height:0};return arguments.length>=4&&(_.rank=w,_.order=x),t(m,"border",_,b)}function h(m){return r.max(r.map(m.nodes(),function(b){var w=m.node(b).rank;if(!r.isUndefined(w))return w}))}function g(m,b){var w={lhs:[],rhs:[]};return r.forEach(m,function(x){b(x)?w.lhs.push(x):w.rhs.push(x)}),w}function p(m,b){var w=r.now();try{return b()}finally{console.log(m+" time: "+(r.now()-w)+"ms")}}function E(m,b){return b()}return Py}var Dy,aR;function C4(){if(aR)return Dy;aR=1;var r=kr(),e=zt();Dy={run:t,undo:a};function t(i){i.graph().dummyChains=[],r.forEach(i.edges(),function(o){n(i,o)})}function n(i,o){var s=o.v,u=i.node(s).rank,l=o.w,c=i.node(l).rank,v=o.name,h=i.edge(o),g=h.labelRank;if(c!==u+1){i.removeEdge(o);var p,E,m;for(m=0,++u;u<c;++m,++u)h.points=[],E={width:0,height:0,edgeLabel:h,edgeObj:o,rank:u},p=e.addDummyNode(i,"edge",E,"_d"),u===g&&(E.width=h.width,E.height=h.height,E.dummy="edge-label",E.labelpos=h.labelpos),i.setEdge(s,p,{weight:h.weight},v),m===0&&i.graph().dummyChains.push(p),s=p;i.setEdge(s,l,{weight:h.weight},v)}}function a(i){r.forEach(i.graph().dummyChains,function(o){var s=i.node(o),u=s.edgeLabel,l;for(i.setEdge(s.edgeObj,u);s.dummy;)l=i.successors(o)[0],i.removeNode(o),u.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(u.x=s.x,u.y=s.y,u.width=s.width,u.height=s.height),o=l,s=i.node(o)})}return Dy}var Iy,iR;function tl(){if(iR)return Iy;iR=1;var r=kr();Iy={longestPath:e,slack:t};function e(n){var a={};function i(o){var s=n.node(o);if(r.has(a,o))return s.rank;a[o]=!0;var u=r.min(r.map(n.outEdges(o),function(l){return i(l.w)-n.edge(l).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),s.rank=u}r.forEach(n.sources(),i)}function t(n,a){return n.node(a.w).rank-n.node(a.v).rank-n.edge(a).minlen}return Iy}var By,oR;function LP(){if(oR)return By;oR=1;var r=kr(),e=wn().Graph,t=tl().slack;By=n;function n(s){var u=new e({directed:!1}),l=s.nodes()[0],c=s.nodeCount();u.setNode(l,{});for(var v,h;a(u,s)<c;)v=i(u,s),h=u.hasNode(v.v)?t(s,v):-t(s,v),o(u,s,h);return u}function a(s,u){function l(c){r.forEach(u.nodeEdges(c),function(v){var h=v.v,g=c===h?v.w:h;!s.hasNode(g)&&!t(u,v)&&(s.setNode(g,{}),s.setEdge(c,g,{}),l(g))})}return r.forEach(s.nodes(),l),s.nodeCount()}function i(s,u){return r.minBy(u.edges(),function(l){if(s.hasNode(l.v)!==s.hasNode(l.w))return t(u,l)})}function o(s,u,l){r.forEach(s.nodes(),function(c){u.node(c).rank+=l})}return By}var Oy,sR;function S4(){if(sR)return Oy;sR=1;var r=kr(),e=LP(),t=tl().slack,n=tl().longestPath,a=wn().alg.preorder,i=wn().alg.postorder,o=zt().simplify;Oy=s,s.initLowLimValues=v,s.initCutValues=u,s.calcCutValue=c,s.leaveEdge=g,s.enterEdge=p,s.exchangeEdges=E;function s(x){x=o(x),n(x);var _=e(x);v(_),u(_,x);for(var C,R;C=g(_);)R=p(_,x,C),E(_,x,C,R)}function u(x,_){var C=i(x,x.nodes());C=C.slice(0,C.length-1),r.forEach(C,function(R){l(x,_,R)})}function l(x,_,C){var R=x.node(C),S=R.parent;x.edge(C,S).cutvalue=c(x,_,C)}function c(x,_,C){var R=x.node(C),S=R.parent,A=!0,P=_.edge(C,S),I=0;return P||(A=!1,P=_.edge(S,C)),I=P.weight,r.forEach(_.nodeEdges(C),function(D){var M=D.v===C,O=M?D.w:D.v;if(O!==S){var N=M===A,V=_.edge(D).weight;if(I+=N?V:-V,b(x,C,O)){var $=x.edge(C,O).cutvalue;I+=N?-$:$}}}),I}function v(x,_){arguments.length<2&&(_=x.nodes()[0]),h(x,{},1,_)}function h(x,_,C,R,S){var A=C,P=x.node(R);return _[R]=!0,r.forEach(x.neighbors(R),function(I){r.has(_,I)||(C=h(x,_,C,I,R))}),P.low=A,P.lim=C++,S?P.parent=S:delete P.parent,C}function g(x){return r.find(x.edges(),function(_){return x.edge(_).cutvalue<0})}function p(x,_,C){var R=C.v,S=C.w;_.hasEdge(R,S)||(R=C.w,S=C.v);var A=x.node(R),P=x.node(S),I=A,D=!1;A.lim>P.lim&&(I=P,D=!0);var M=r.filter(_.edges(),function(O){return D===w(x,x.node(O.v),I)&&D!==w(x,x.node(O.w),I)});return r.minBy(M,function(O){return t(_,O)})}function E(x,_,C,R){var S=C.v,A=C.w;x.removeEdge(S,A),x.setEdge(R.v,R.w,{}),v(x),u(x,_),m(x,_)}function m(x,_){var C=r.find(x.nodes(),function(S){return!_.node(S).parent}),R=a(x,C);R=R.slice(1),r.forEach(R,function(S){var A=x.node(S).parent,P=_.edge(S,A),I=!1;P||(P=_.edge(A,S),I=!0),_.node(S).rank=_.node(A).rank+(I?P.minlen:-P.minlen)})}function b(x,_,C){return x.hasEdge(_,C)}function w(x,_,C){return C.low<=_.lim&&_.lim<=C.lim}return Oy}var My,uR;function T4(){if(uR)return My;uR=1;var r=tl(),e=r.longestPath,t=LP(),n=S4();My=a;function a(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":i(u);break;default:s(u)}}var i=e;function o(u){e(u),t(u)}function s(u){n(u)}return My}var ky,lR;function R4(){if(lR)return ky;lR=1;var r=kr();ky=e;function e(a){var i=n(a);r.forEach(a.graph().dummyChains,function(o){for(var s=a.node(o),u=s.edgeObj,l=t(a,i,u.v,u.w),c=l.path,v=l.lca,h=0,g=c[h],p=!0;o!==u.w;){if(s=a.node(o),p){for(;(g=c[h])!==v&&a.node(g).maxRank<s.rank;)h++;g===v&&(p=!1)}if(!p){for(;h<c.length-1&&a.node(g=c[h+1]).minRank<=s.rank;)h++;g=c[h]}a.setParent(o,g),o=a.successors(o)[0]}})}function t(a,i,o,s){var u=[],l=[],c=Math.min(i[o].low,i[s].low),v=Math.max(i[o].lim,i[s].lim),h,g;h=o;do h=a.parent(h),u.push(h);while(h&&(i[h].low>c||v>i[h].lim));for(g=h,h=s;(h=a.parent(h))!==g;)l.push(h);return{path:u.concat(l.reverse()),lca:g}}function n(a){var i={},o=0;function s(u){var l=o;r.forEach(a.children(u),s),i[u]={low:l,lim:o++}}return r.forEach(a.children(),s),i}return ky}var Ly,fR;function A4(){if(fR)return Ly;fR=1;var r=kr(),e=zt();Ly={run:t,cleanup:o};function t(s){var u=e.addDummyNode(s,"root",{},"_root"),l=a(s),c=r.max(r.values(l))-1,v=2*c+1;s.graph().nestingRoot=u,r.forEach(s.edges(),function(g){s.edge(g).minlen*=v});var h=i(s)+1;r.forEach(s.children(),function(g){n(s,u,v,h,c,l,g)}),s.graph().nodeRankFactor=v}function n(s,u,l,c,v,h,g){var p=s.children(g);if(!p.length){g!==u&&s.setEdge(u,g,{weight:0,minlen:l});return}var E=e.addBorderNode(s,"_bt"),m=e.addBorderNode(s,"_bb"),b=s.node(g);s.setParent(E,g),b.borderTop=E,s.setParent(m,g),b.borderBottom=m,r.forEach(p,function(w){n(s,u,l,c,v,h,w);var x=s.node(w),_=x.borderTop?x.borderTop:w,C=x.borderBottom?x.borderBottom:w,R=x.borderTop?c:2*c,S=_!==C?1:v-h[g]+1;s.setEdge(E,_,{weight:R,minlen:S,nestingEdge:!0}),s.setEdge(C,m,{weight:R,minlen:S,nestingEdge:!0})}),s.parent(g)||s.setEdge(u,E,{weight:0,minlen:v+h[g]})}function a(s){var u={};function l(c,v){var h=s.children(c);h&&h.length&&r.forEach(h,function(g){l(g,v+1)}),u[c]=v}return r.forEach(s.children(),function(c){l(c,1)}),u}function i(s){return r.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,r.forEach(s.edges(),function(l){var c=s.edge(l);c.nestingEdge&&s.removeEdge(l)})}return Ly}var qy,cR;function P4(){if(cR)return qy;cR=1;var r=kr(),e=zt();qy=t;function t(a){function i(o){var s=a.children(o),u=a.node(o);if(s.length&&r.forEach(s,i),r.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,c=u.maxRank+1;l<c;++l)n(a,"borderLeft","_bl",o,u,l),n(a,"borderRight","_br",o,u,l)}}r.forEach(a.children(),i)}function n(a,i,o,s,u,l){var c={width:0,height:0,rank:l,borderType:i},v=u[i][l-1],h=e.addDummyNode(a,"border",c,o);u[i][l]=h,a.setParent(h,s),v&&a.setEdge(v,h,{weight:1})}return qy}var Ny,dR;function D4(){if(dR)return Ny;dR=1;var r=kr();Ny={adjust:e,undo:t};function e(l){var c=l.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(l)}function t(l){var c=l.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&i(l),(c==="lr"||c==="rl")&&(s(l),n(l))}function n(l){r.forEach(l.nodes(),function(c){a(l.node(c))}),r.forEach(l.edges(),function(c){a(l.edge(c))})}function a(l){var c=l.width;l.width=l.height,l.height=c}function i(l){r.forEach(l.nodes(),function(c){o(l.node(c))}),r.forEach(l.edges(),function(c){var v=l.edge(c);r.forEach(v.points,o),r.has(v,"y")&&o(v)})}function o(l){l.y=-l.y}function s(l){r.forEach(l.nodes(),function(c){u(l.node(c))}),r.forEach(l.edges(),function(c){var v=l.edge(c);r.forEach(v.points,u),r.has(v,"x")&&u(v)})}function u(l){var c=l.x;l.x=l.y,l.y=c}return Ny}var Fy,vR;function I4(){if(vR)return Fy;vR=1;var r=kr();Fy=e;function e(t){var n={},a=r.filter(t.nodes(),function(l){return!t.children(l).length}),i=r.max(r.map(a,function(l){return t.node(l).rank})),o=r.map(r.range(i+1),function(){return[]});function s(l){if(!r.has(n,l)){n[l]=!0;var c=t.node(l);o[c.rank].push(l),r.forEach(t.successors(l),s)}}var u=r.sortBy(a,function(l){return t.node(l).rank});return r.forEach(u,s),o}return Fy}var zy,hR;function B4(){if(hR)return zy;hR=1;var r=kr();zy=e;function e(n,a){for(var i=0,o=1;o<a.length;++o)i+=t(n,a[o-1],a[o]);return i}function t(n,a,i){for(var o=r.zipObject(i,r.map(i,function(h,g){return g})),s=r.flatten(r.map(a,function(h){return r.sortBy(r.map(n.outEdges(h),function(g){return{pos:o[g.w],weight:n.edge(g).weight}}),"pos")}),!0),u=1;u<i.length;)u<<=1;var l=2*u-1;u-=1;var c=r.map(new Array(l),function(){return 0}),v=0;return r.forEach(s.forEach(function(h){var g=h.pos+u;c[g]+=h.weight;for(var p=0;g>0;)g%2&&(p+=c[g+1]),g=g-1>>1,c[g]+=h.weight;v+=h.weight*p})),v}return zy}var $y,gR;function O4(){if(gR)return $y;gR=1;var r=kr();$y=e;function e(t,n){return r.map(n,function(a){var i=t.inEdges(a);if(i.length){var o=r.reduce(i,function(s,u){var l=t.edge(u),c=t.node(u.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:a,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:a}})}return $y}var Vy,pR;function M4(){if(pR)return Vy;pR=1;var r=kr();Vy=e;function e(a,i){var o={};r.forEach(a,function(u,l){var c=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};r.isUndefined(u.barycenter)||(c.barycenter=u.barycenter,c.weight=u.weight)}),r.forEach(i.edges(),function(u){var l=o[u.v],c=o[u.w];!r.isUndefined(l)&&!r.isUndefined(c)&&(c.indegree++,l.out.push(o[u.w]))});var s=r.filter(o,function(u){return!u.indegree});return t(s)}function t(a){var i=[];function o(l){return function(c){c.merged||(r.isUndefined(c.barycenter)||r.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function s(l){return function(c){c.in.push(l),--c.indegree===0&&a.push(c)}}for(;a.length;){var u=a.pop();i.push(u),r.forEach(u.in.reverse(),o(u)),r.forEach(u.out,s(u))}return r.map(r.filter(i,function(l){return!l.merged}),function(l){return r.pick(l,["vs","i","barycenter","weight"])})}function n(a,i){var o=0,s=0;a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=o/s,a.weight=s,a.i=Math.min(i.i,a.i),i.merged=!0}return Vy}var Gy,yR;function k4(){if(yR)return Gy;yR=1;var r=kr(),e=zt();Gy=t;function t(i,o){var s=e.partition(i,function(E){return r.has(E,"barycenter")}),u=s.lhs,l=r.sortBy(s.rhs,function(E){return-E.i}),c=[],v=0,h=0,g=0;u.sort(a(!!o)),g=n(c,l,g),r.forEach(u,function(E){g+=E.vs.length,c.push(E.vs),v+=E.barycenter*E.weight,h+=E.weight,g=n(c,l,g)});var p={vs:r.flatten(c,!0)};return h&&(p.barycenter=v/h,p.weight=h),p}function n(i,o,s){for(var u;o.length&&(u=r.last(o)).i<=s;)o.pop(),i.push(u.vs),s++;return s}function a(i){return function(o,s){return o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:i?s.i-o.i:o.i-s.i}}return Gy}var Wy,mR;function L4(){if(mR)return Wy;mR=1;var r=kr(),e=O4(),t=M4(),n=k4();Wy=a;function a(s,u,l,c){var v=s.children(u),h=s.node(u),g=h?h.borderLeft:void 0,p=h?h.borderRight:void 0,E={};g&&(v=r.filter(v,function(C){return C!==g&&C!==p}));var m=e(s,v);r.forEach(m,function(C){if(s.children(C.v).length){var R=a(s,C.v,l,c);E[C.v]=R,r.has(R,"barycenter")&&o(C,R)}});var b=t(m,l);i(b,E);var w=n(b,c);if(g&&(w.vs=r.flatten([g,w.vs,p],!0),s.predecessors(g).length)){var x=s.node(s.predecessors(g)[0]),_=s.node(s.predecessors(p)[0]);r.has(w,"barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+x.order+_.order)/(w.weight+2),w.weight+=2}return w}function i(s,u){r.forEach(s,function(l){l.vs=r.flatten(l.vs.map(function(c){return u[c]?u[c].vs:c}),!0)})}function o(s,u){r.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return Wy}var Uy,bR;function q4(){if(bR)return Uy;bR=1;var r=kr(),e=wn().Graph;Uy=t;function t(a,i,o){var s=n(a),u=new e({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return a.node(l)});return r.forEach(a.nodes(),function(l){var c=a.node(l),v=a.parent(l);(c.rank===i||c.minRank<=i&&i<=c.maxRank)&&(u.setNode(l),u.setParent(l,v||s),r.forEach(a[o](l),function(h){var g=h.v===l?h.w:h.v,p=u.edge(g,l),E=r.isUndefined(p)?0:p.weight;u.setEdge(g,l,{weight:a.edge(h).weight+E})}),r.has(c,"minRank")&&u.setNode(l,{borderLeft:c.borderLeft[i],borderRight:c.borderRight[i]}))}),u}function n(a){for(var i;a.hasNode(i=r.uniqueId("_root")););return i}return Uy}var Hy,wR;function N4(){if(wR)return Hy;wR=1;var r=kr();Hy=e;function e(t,n,a){var i={},o;r.forEach(a,function(s){for(var u=t.parent(s),l,c;u;){if(l=t.parent(u),l?(c=i[l],i[l]=u):(c=o,o=u),c&&c!==u){n.setEdge(c,u);return}u=l}})}return Hy}var Ky,xR;function F4(){if(xR)return Ky;xR=1;var r=kr(),e=I4(),t=B4(),n=L4(),a=q4(),i=N4(),o=wn().Graph,s=zt();Ky=u;function u(h){var g=s.maxRank(h),p=l(h,r.range(1,g+1),"inEdges"),E=l(h,r.range(g-1,-1,-1),"outEdges"),m=e(h);v(h,m);for(var b=Number.POSITIVE_INFINITY,w,x=0,_=0;_<4;++x,++_){c(x%2?p:E,x%4>=2),m=s.buildLayerMatrix(h);var C=t(h,m);C<b&&(_=0,w=r.cloneDeep(m),b=C)}v(h,w)}function l(h,g,p){return r.map(g,function(E){return a(h,E,p)})}function c(h,g){var p=new o;r.forEach(h,function(E){var m=E.graph().root,b=n(E,m,p,g);r.forEach(b.vs,function(w,x){E.node(w).order=x}),i(E,p,b.vs)})}function v(h,g){r.forEach(g,function(p){r.forEach(p,function(E,m){h.node(E).order=m})})}return Ky}var jy,ER;function z4(){if(ER)return jy;ER=1;var r=kr(),e=wn().Graph,t=zt();jy={positionX:p,findType1Conflicts:n,findType2Conflicts:a,addConflict:o,hasConflict:s,verticalAlignment:u,horizontalCompaction:l,alignCoordinates:h,findSmallestWidthAlignment:v,balance:g};function n(b,w){var x={};function _(C,R){var S=0,A=0,P=C.length,I=r.last(R);return r.forEach(R,function(D,M){var O=i(b,D),N=O?b.node(O).order:P;(O||D===I)&&(r.forEach(R.slice(A,M+1),function(V){r.forEach(b.predecessors(V),function($){var G=b.node($),U=G.order;(U<S||N<U)&&!(G.dummy&&b.node(V).dummy)&&o(x,$,V)})}),A=M+1,S=N)}),R}return r.reduce(w,_),x}function a(b,w){var x={};function _(R,S,A,P,I){var D;r.forEach(r.range(S,A),function(M){D=R[M],b.node(D).dummy&&r.forEach(b.predecessors(D),function(O){var N=b.node(O);N.dummy&&(N.order<P||N.order>I)&&o(x,O,D)})})}function C(R,S){var A=-1,P,I=0;return r.forEach(S,function(D,M){if(b.node(D).dummy==="border"){var O=b.predecessors(D);O.length&&(P=b.node(O[0]).order,_(S,I,M,A,P),I=M,A=P)}_(S,I,S.length,P,R.length)}),S}return r.reduce(w,C),x}function i(b,w){if(b.node(w).dummy)return r.find(b.predecessors(w),function(x){return b.node(x).dummy})}function o(b,w,x){if(w>x){var _=w;w=x,x=_}var C=b[w];C||(b[w]=C={}),C[x]=!0}function s(b,w,x){if(w>x){var _=w;w=x,x=_}return r.has(b[w],x)}function u(b,w,x,_){var C={},R={},S={};return r.forEach(w,function(A){r.forEach(A,function(P,I){C[P]=P,R[P]=P,S[P]=I})}),r.forEach(w,function(A){var P=-1;r.forEach(A,function(I){var D=_(I);if(D.length){D=r.sortBy(D,function($){return S[$]});for(var M=(D.length-1)/2,O=Math.floor(M),N=Math.ceil(M);O<=N;++O){var V=D[O];R[I]===I&&P<S[V]&&!s(x,I,V)&&(R[V]=I,R[I]=C[I]=C[V],P=S[V])}}})}),{root:C,align:R}}function l(b,w,x,_,C){var R={},S=c(b,w,x,C),A=C?"borderLeft":"borderRight";function P(M,O){for(var N=S.nodes(),V=N.pop(),$={};V;)$[V]?M(V):($[V]=!0,N.push(V),N=N.concat(O(V))),V=N.pop()}function I(M){R[M]=S.inEdges(M).reduce(function(O,N){return Math.max(O,R[N.v]+S.edge(N))},0)}function D(M){var O=S.outEdges(M).reduce(function(V,$){return Math.min(V,R[$.w]-S.edge($))},Number.POSITIVE_INFINITY),N=b.node(M);O!==Number.POSITIVE_INFINITY&&N.borderType!==A&&(R[M]=Math.max(R[M],O))}return P(I,S.predecessors.bind(S)),P(D,S.successors.bind(S)),r.forEach(_,function(M){R[M]=R[x[M]]}),R}function c(b,w,x,_){var C=new e,R=b.graph(),S=E(R.nodesep,R.edgesep,_);return r.forEach(w,function(A){var P;r.forEach(A,function(I){var D=x[I];if(C.setNode(D),P){var M=x[P],O=C.edge(M,D);C.setEdge(M,D,Math.max(S(b,I,P),O||0))}P=I})}),C}function v(b,w){return r.minBy(r.values(w),function(x){var _=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return r.forIn(x,function(R,S){var A=m(b,S)/2;_=Math.max(R+A,_),C=Math.min(R-A,C)}),_-C})}function h(b,w){var x=r.values(w),_=r.min(x),C=r.max(x);r.forEach(["u","d"],function(R){r.forEach(["l","r"],function(S){var A=R+S,P=b[A],I;if(P!==w){var D=r.values(P);I=S==="l"?_-r.min(D):C-r.max(D),I&&(b[A]=r.mapValues(P,function(M){return M+I}))}})})}function g(b,w){return r.mapValues(b.ul,function(x,_){if(w)return b[w.toLowerCase()][_];var C=r.sortBy(r.map(b,_));return(C[1]+C[2])/2})}function p(b){var w=t.buildLayerMatrix(b),x=r.merge(n(b,w),a(b,w)),_={},C;r.forEach(["u","d"],function(S){C=S==="u"?w:r.values(w).reverse(),r.forEach(["l","r"],function(A){A==="r"&&(C=r.map(C,function(M){return r.values(M).reverse()}));var P=(S==="u"?b.predecessors:b.successors).bind(b),I=u(b,C,x,P),D=l(b,C,I.root,I.align,A==="r");A==="r"&&(D=r.mapValues(D,function(M){return-M})),_[S+A]=D})});var R=v(b,_);return h(_,R),g(_,b.graph().align)}function E(b,w,x){return function(_,C,R){var S=_.node(C),A=_.node(R),P=0,I;if(P+=S.width/2,r.has(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":I=-S.width/2;break;case"r":I=S.width/2;break}if(I&&(P+=x?I:-I),I=0,P+=(S.dummy?w:b)/2,P+=(A.dummy?w:b)/2,P+=A.width/2,r.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":I=A.width/2;break;case"r":I=-A.width/2;break}return I&&(P+=x?I:-I),I=0,P}}function m(b,w){return b.node(w).width}return jy}var Yy,_R;function $4(){if(_R)return Yy;_R=1;var r=kr(),e=zt(),t=z4().positionX;Yy=n;function n(i){i=e.asNonCompoundGraph(i),a(i),r.forEach(t(i),function(o,s){i.node(s).x=o})}function a(i){var o=e.buildLayerMatrix(i),s=i.graph().ranksep,u=0;r.forEach(o,function(l){var c=r.max(r.map(l,function(v){return i.node(v).height}));r.forEach(l,function(v){i.node(v).y=u+c/2}),u+=c+s})}return Yy}var Zy,CR;function V4(){if(CR)return Zy;CR=1;var r=kr(),e=_4(),t=C4(),n=T4(),a=zt().normalizeRanks,i=R4(),o=zt().removeEmptyRanks,s=A4(),u=P4(),l=D4(),c=F4(),v=$4(),h=zt(),g=wn().Graph;Zy=p;function p(F,z){var j=z&&z.debugTiming?h.time:h.notime;j("layout",function(){var ee=j(" buildLayoutGraph",function(){return P(F)});j(" runLayout",function(){E(ee,j)}),j(" updateInputGraph",function(){m(F,ee)})})}function E(F,z){z(" makeSpaceForEdgeLabels",function(){I(F)}),z(" removeSelfEdges",function(){J(F)}),z(" acyclic",function(){e.run(F)}),z(" nestingGraph.run",function(){s.run(F)}),z(" rank",function(){n(h.asNonCompoundGraph(F))}),z(" injectEdgeLabelProxies",function(){D(F)}),z(" removeEmptyRanks",function(){o(F)}),z(" nestingGraph.cleanup",function(){s.cleanup(F)}),z(" normalizeRanks",function(){a(F)}),z(" assignRankMinMax",function(){M(F)}),z(" removeEdgeLabelProxies",function(){O(F)}),z(" normalize.run",function(){t.run(F)}),z(" parentDummyChains",function(){i(F)}),z(" addBorderSegments",function(){u(F)}),z(" order",function(){c(F)}),z(" insertSelfEdges",function(){W(F)}),z(" adjustCoordinateSystem",function(){l.adjust(F)}),z(" position",function(){v(F)}),z(" positionSelfEdges",function(){H(F)}),z(" removeBorderNodes",function(){U(F)}),z(" normalize.undo",function(){t.undo(F)}),z(" fixupEdgeLabelCoords",function(){$(F)}),z(" undoCoordinateSystem",function(){l.undo(F)}),z(" translateGraph",function(){N(F)}),z(" assignNodeIntersects",function(){V(F)}),z(" reversePoints",function(){G(F)}),z(" acyclic.undo",function(){e.undo(F)})}function m(F,z){r.forEach(F.nodes(),function(j){var ee=F.node(j),ie=z.node(j);ee&&(ee.x=ie.x,ee.y=ie.y,z.children(j).length&&(ee.width=ie.width,ee.height=ie.height))}),r.forEach(F.edges(),function(j){var ee=F.edge(j),ie=z.edge(j);ee.points=ie.points,r.has(ie,"x")&&(ee.x=ie.x,ee.y=ie.y)}),F.graph().width=z.graph().width,F.graph().height=z.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],w={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},x=["acyclicer","ranker","rankdir","align"],_=["width","height"],C={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},A=["labelpos"];function P(F){var z=new g({multigraph:!0,compound:!0}),j=ne(F.graph());return z.setGraph(r.merge({},w,Z(j,b),r.pick(j,x))),r.forEach(F.nodes(),function(ee){var ie=ne(F.node(ee));z.setNode(ee,r.defaults(Z(ie,_),C)),z.setParent(ee,F.parent(ee))}),r.forEach(F.edges(),function(ee){var ie=ne(F.edge(ee));z.setEdge(ee,r.merge({},S,Z(ie,R),r.pick(ie,A)))}),z}function I(F){var z=F.graph();z.ranksep/=2,r.forEach(F.edges(),function(j){var ee=F.edge(j);ee.minlen*=2,ee.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?ee.width+=ee.labeloffset:ee.height+=ee.labeloffset)})}function D(F){r.forEach(F.edges(),function(z){var j=F.edge(z);if(j.width&&j.height){var ee=F.node(z.v),ie=F.node(z.w),oe={rank:(ie.rank-ee.rank)/2+ee.rank,e:z};h.addDummyNode(F,"edge-proxy",oe,"_ep")}})}function M(F){var z=0;r.forEach(F.nodes(),function(j){var ee=F.node(j);ee.borderTop&&(ee.minRank=F.node(ee.borderTop).rank,ee.maxRank=F.node(ee.borderBottom).rank,z=r.max(z,ee.maxRank))}),F.graph().maxRank=z}function O(F){r.forEach(F.nodes(),function(z){var j=F.node(z);j.dummy==="edge-proxy"&&(F.edge(j.e).labelRank=j.rank,F.removeNode(z))})}function N(F){var z=Number.POSITIVE_INFINITY,j=0,ee=Number.POSITIVE_INFINITY,ie=0,oe=F.graph(),Y=oe.marginx||0,X=oe.marginy||0;function re(le){var he=le.x,be=le.y,fe=le.width,ue=le.height;z=Math.min(z,he-fe/2),j=Math.max(j,he+fe/2),ee=Math.min(ee,be-ue/2),ie=Math.max(ie,be+ue/2)}r.forEach(F.nodes(),function(le){re(F.node(le))}),r.forEach(F.edges(),function(le){var he=F.edge(le);r.has(he,"x")&&re(he)}),z-=Y,ee-=X,r.forEach(F.nodes(),function(le){var he=F.node(le);he.x-=z,he.y-=ee}),r.forEach(F.edges(),function(le){var he=F.edge(le);r.forEach(he.points,function(be){be.x-=z,be.y-=ee}),r.has(he,"x")&&(he.x-=z),r.has(he,"y")&&(he.y-=ee)}),oe.width=j-z+Y,oe.height=ie-ee+X}function V(F){r.forEach(F.edges(),function(z){var j=F.edge(z),ee=F.node(z.v),ie=F.node(z.w),oe,Y;j.points?(oe=j.points[0],Y=j.points[j.points.length-1]):(j.points=[],oe=ie,Y=ee),j.points.unshift(h.intersectRect(ee,oe)),j.points.push(h.intersectRect(ie,Y))})}function $(F){r.forEach(F.edges(),function(z){var j=F.edge(z);if(r.has(j,"x"))switch((j.labelpos==="l"||j.labelpos==="r")&&(j.width-=j.labeloffset),j.labelpos){case"l":j.x-=j.width/2+j.labeloffset;break;case"r":j.x+=j.width/2+j.labeloffset;break}})}function G(F){r.forEach(F.edges(),function(z){var j=F.edge(z);j.reversed&&j.points.reverse()})}function U(F){r.forEach(F.nodes(),function(z){if(F.children(z).length){var j=F.node(z),ee=F.node(j.borderTop),ie=F.node(j.borderBottom),oe=F.node(r.last(j.borderLeft)),Y=F.node(r.last(j.borderRight));j.width=Math.abs(Y.x-oe.x),j.height=Math.abs(ie.y-ee.y),j.x=oe.x+j.width/2,j.y=ee.y+j.height/2}}),r.forEach(F.nodes(),function(z){F.node(z).dummy==="border"&&F.removeNode(z)})}function J(F){r.forEach(F.edges(),function(z){if(z.v===z.w){var j=F.node(z.v);j.selfEdges||(j.selfEdges=[]),j.selfEdges.push({e:z,label:F.edge(z)}),F.removeEdge(z)}})}function W(F){var z=h.buildLayerMatrix(F);r.forEach(z,function(j){var ee=0;r.forEach(j,function(ie,oe){var Y=F.node(ie);Y.order=oe+ee,r.forEach(Y.selfEdges,function(X){h.addDummyNode(F,"selfedge",{width:X.label.width,height:X.label.height,rank:Y.rank,order:oe+ ++ee,e:X.e,label:X.label},"_se")}),delete Y.selfEdges})})}function H(F){r.forEach(F.nodes(),function(z){var j=F.node(z);if(j.dummy==="selfedge"){var ee=F.node(j.e.v),ie=ee.x+ee.width/2,oe=ee.y,Y=j.x-ie,X=ee.height/2;F.setEdge(j.e,j.label),F.removeNode(z),j.label.points=[{x:ie+2*Y/3,y:oe-X},{x:ie+5*Y/6,y:oe-X},{x:ie+Y,y:oe},{x:ie+5*Y/6,y:oe+X},{x:ie+2*Y/3,y:oe+X}],j.label.x=j.x,j.label.y=j.y}})}function Z(F,z){return r.mapValues(r.pick(F,z),Number)}function ne(F){var z={};return r.forEach(F,function(j,ee){z[ee.toLowerCase()]=j}),z}return Zy}var Xy,SR;function G4(){if(SR)return Xy;SR=1;var r=kr(),e=zt(),t=wn().Graph;Xy={debugOrdering:n};function n(a){var i=e.buildLayerMatrix(a),o=new t({compound:!0,multigraph:!0}).setGraph({});return r.forEach(a.nodes(),function(s){o.setNode(s,{label:s}),o.setParent(s,"layer"+a.node(s).rank)}),r.forEach(a.edges(),function(s){o.setEdge(s.v,s.w,{},s.name)}),r.forEach(i,function(s,u){var l="layer"+u;o.setNode(l,{rank:"same"}),r.reduce(s,function(c,v){return o.setEdge(c,v,{style:"invis"}),v})}),o}return Xy}var Qy,TR;function W4(){return TR||(TR=1,Qy="0.8.5"),Qy}var Jy,RR;function U4(){return RR||(RR=1,Jy={graphlib:wn(),layout:V4(),debug:G4(),util:{time:zt().time,notime:zt().notime},version:W4()}),Jy}var H4=Fu.exports,AR;function K4(){return AR||(AR=1,(function(r,e){(function(n,a){r.exports=a(U4())})(H4,function(t){return(function(n){var a={};function i(o){if(a[o])return a[o].exports;var s=a[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=n,i.c=a,i.d=function(o,s,u){i.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:u})},i.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,s){if(s&1&&(o=i(o)),s&8||s&4&&typeof o=="object"&&o&&o.__esModule)return o;var u=Object.create(null);if(i.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:o}),s&2&&typeof o!="string")for(var l in o)i.d(u,l,(function(c){return o[c]}).bind(null,l));return u},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([(function(n,a,i){var o=i(1),s=function(l){l&&l("layout","dagre",o)};typeof cytoscape<"u"&&s(cytoscape),n.exports=s}),(function(n,a,i){function o(h){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(p){return typeof p}:o=function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},o(h)}var s=function(g){return typeof g=="function"},u=i(2),l=i(3),c=i(4);function v(h){this.options=l({},u,h)}v.prototype.run=function(){var h=this.options,g=this,p=h.cy,E=h.eles,m=function(H,Z){return s(Z)?Z.apply(H,[H]):Z},b=h.boundingBox||{x1:0,y1:0,w:p.width(),h:p.height()};b.x2===void 0&&(b.x2=b.x1+b.w),b.w===void 0&&(b.w=b.x2-b.x1),b.y2===void 0&&(b.y2=b.y1+b.h),b.h===void 0&&(b.h=b.y2-b.y1);var w=new c.graphlib.Graph({multigraph:!0,compound:!0}),x={},_=function(H,Z){Z!=null&&(x[H]=Z)};_("nodesep",h.nodeSep),_("edgesep",h.edgeSep),_("ranksep",h.rankSep),_("rankdir",h.rankDir),_("align",h.align),_("ranker",h.ranker),_("acyclicer",h.acyclicer),w.setGraph(x),w.setDefaultEdgeLabel(function(){return{}}),w.setDefaultNodeLabel(function(){return{}});var C=E.nodes();s(h.sort)&&(C=C.sort(h.sort));for(var R=0;R<C.length;R++){var S=C[R],A=S.layoutDimensions(h);w.setNode(S.id(),{width:A.w,height:A.h,name:S.id()})}for(var P=0;P<C.length;P++){var I=C[P];I.isChild()&&w.setParent(I.id(),I.parent().id())}var D=E.edges().stdFilter(function(W){return!W.source().isParent()&&!W.target().isParent()});s(h.sort)&&(D=D.sort(h.sort));for(var M=0;M<D.length;M++){var O=D[M];w.setEdge(O.source().id(),O.target().id(),{minlen:m(O,h.minLen),weight:m(O,h.edgeWeight),name:O.id()},O.id())}c.layout(w);for(var N=w.nodes(),V=0;V<N.length;V++){var $=N[V],G=w.node($);p.getElementById($).scratch().dagre=G}var U;h.boundingBox?(U={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},C.forEach(function(W){var H=W.scratch().dagre;U.x1=Math.min(U.x1,H.x),U.x2=Math.max(U.x2,H.x),U.y1=Math.min(U.y1,H.y),U.y2=Math.max(U.y2,H.y)}),U.w=U.x2-U.x1,U.h=U.y2-U.y1):U=b;var J=function(H){if(h.boundingBox){var Z=U.w===0?0:(H.x-U.x1)/U.w,ne=U.h===0?0:(H.y-U.y1)/U.h;return{x:b.x1+Z*b.w,y:b.y1+ne*b.h}}else return H};return C.layoutPositions(g,h,function(W){W=o(W)==="object"?W:this;var H=W.scratch().dagre;return J({x:H.x,y:H.y})}),this},n.exports=v}),(function(n,a){var i={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(s){return 1},edgeWeight:function(s){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,animate:!1,animateFilter:function(s,u){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(s,u){return u},ready:function(){},sort:void 0,stop:function(){}};n.exports=i}),(function(n,a){n.exports=Object.assign!=null?Object.assign.bind(Object):function(i){for(var o=arguments.length,s=new Array(o>1?o-1:0),u=1;u<o;u++)s[u-1]=arguments[u];return s.forEach(function(l){Object.keys(l).forEach(function(c){return i[c]=l[c]})}),i}}),(function(n,a){n.exports=t})])})})(Fu)),Fu.exports}var j4=K4();const Y4=El(j4);var zu={exports:{}},em,PR;function Z4(){if(PR)return em;PR=1;var r="Expected a function",e="__lodash_hash_undefined__",t="[object Function]",n="[object GeneratorFunction]",a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=typeof wt=="object"&&wt&&wt.Object===Object&&wt,s=typeof self=="object"&&self&&self.Object===Object&&self,u=o||s||Function("return this")();function l(fe,ue){return fe==null?void 0:fe[ue]}function c(fe){var ue=!1;if(fe!=null&&typeof fe.toString!="function")try{ue=!!(fe+"")}catch{}return ue}var v=Array.prototype,h=Function.prototype,g=Object.prototype,p=u["__core-js_shared__"],E=(function(){var fe=/[^.]+$/.exec(p&&p.keys&&p.keys.IE_PROTO||"");return fe?"Symbol(src)_1."+fe:""})(),m=h.toString,b=g.hasOwnProperty,w=g.toString,x=RegExp("^"+m.call(b).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=v.splice,C=ie(u,"Map"),R=ie(Object,"create");function S(fe){var ue=-1,Se=fe?fe.length:0;for(this.clear();++ue<Se;){var Ae=fe[ue];this.set(Ae[0],Ae[1])}}function A(){this.__data__=R?R(null):{}}function P(fe){return this.has(fe)&&delete this.__data__[fe]}function I(fe){var ue=this.__data__;if(R){var Se=ue[fe];return Se===e?void 0:Se}return b.call(ue,fe)?ue[fe]:void 0}function D(fe){var ue=this.__data__;return R?ue[fe]!==void 0:b.call(ue,fe)}function M(fe,ue){var Se=this.__data__;return Se[fe]=R&&ue===void 0?e:ue,this}S.prototype.clear=A,S.prototype.delete=P,S.prototype.get=I,S.prototype.has=D,S.prototype.set=M;function O(fe){var ue=-1,Se=fe?fe.length:0;for(this.clear();++ue<Se;){var Ae=fe[ue];this.set(Ae[0],Ae[1])}}function N(){this.__data__=[]}function V(fe){var ue=this.__data__,Se=z(ue,fe);if(Se<0)return!1;var Ae=ue.length-1;return Se==Ae?ue.pop():_.call(ue,Se,1),!0}function $(fe){var ue=this.__data__,Se=z(ue,fe);return Se<0?void 0:ue[Se][1]}function G(fe){return z(this.__data__,fe)>-1}function U(fe,ue){var Se=this.__data__,Ae=z(Se,fe);return Ae<0?Se.push([fe,ue]):Se[Ae][1]=ue,this}O.prototype.clear=N,O.prototype.delete=V,O.prototype.get=$,O.prototype.has=G,O.prototype.set=U;function J(fe){var ue=-1,Se=fe?fe.length:0;for(this.clear();++ue<Se;){var Ae=fe[ue];this.set(Ae[0],Ae[1])}}function W(){this.__data__={hash:new S,map:new(C||O),string:new S}}function H(fe){return ee(this,fe).delete(fe)}function Z(fe){return ee(this,fe).get(fe)}function ne(fe){return ee(this,fe).has(fe)}function F(fe,ue){return ee(this,fe).set(fe,ue),this}J.prototype.clear=W,J.prototype.delete=H,J.prototype.get=Z,J.prototype.has=ne,J.prototype.set=F;function z(fe,ue){for(var Se=fe.length;Se--;)if(le(fe[Se][0],ue))return Se;return-1}function j(fe){if(!be(fe)||Y(fe))return!1;var ue=he(fe)||c(fe)?x:i;return ue.test(X(fe))}function ee(fe,ue){var Se=fe.__data__;return oe(ue)?Se[typeof ue=="string"?"string":"hash"]:Se.map}function ie(fe,ue){var Se=l(fe,ue);return j(Se)?Se:void 0}function oe(fe){var ue=typeof fe;return ue=="string"||ue=="number"||ue=="symbol"||ue=="boolean"?fe!=="__proto__":fe===null}function Y(fe){return!!E&&E in fe}function X(fe){if(fe!=null){try{return m.call(fe)}catch{}try{return fe+""}catch{}}return""}function re(fe,ue){if(typeof fe!="function"||ue&&typeof ue!="function")throw new TypeError(r);var Se=function(){var Ae=arguments,Te=ue?ue.apply(this,Ae):Ae[0],Pe=Se.cache;if(Pe.has(Te))return Pe.get(Te);var Ie=fe.apply(this,Ae);return Se.cache=Pe.set(Te,Ie),Ie};return Se.cache=new(re.Cache||J),Se}re.Cache=J;function le(fe,ue){return fe===ue||fe!==fe&&ue!==ue}function he(fe){var ue=be(fe)?w.call(fe):"";return ue==t||ue==n}function be(fe){var ue=typeof fe;return!!fe&&(ue=="object"||ue=="function")}return em=re,em}var rm,DR;function X4(){if(DR)return rm;DR=1;var r="Expected a function",e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt,u=typeof wt=="object"&&wt&&wt.Object===Object&&wt,l=typeof self=="object"&&self&&self.Object===Object&&self,c=u||l||Function("return this")(),v=Object.prototype,h=v.toString,g=Math.max,p=Math.min,E=function(){return c.Date.now()};function m(R,S,A){var P,I,D,M,O,N,V=0,$=!1,G=!1,U=!0;if(typeof R!="function")throw new TypeError(r);S=C(S)||0,w(A)&&($=!!A.leading,G="maxWait"in A,D=G?g(C(A.maxWait)||0,S):D,U="trailing"in A?!!A.trailing:U);function J(ie){var oe=P,Y=I;return P=I=void 0,V=ie,M=R.apply(Y,oe),M}function W(ie){return V=ie,O=setTimeout(ne,S),$?J(ie):M}function H(ie){var oe=ie-N,Y=ie-V,X=S-oe;return G?p(X,D-Y):X}function Z(ie){var oe=ie-N,Y=ie-V;return N===void 0||oe>=S||oe<0||G&&Y>=D}function ne(){var ie=E();if(Z(ie))return F(ie);O=setTimeout(ne,H(ie))}function F(ie){return O=void 0,U&&P?J(ie):(P=I=void 0,M)}function z(){O!==void 0&&clearTimeout(O),V=0,P=N=I=O=void 0}function j(){return O===void 0?M:F(E())}function ee(){var ie=E(),oe=Z(ie);if(P=arguments,I=this,N=ie,oe){if(O===void 0)return W(N);if(G)return O=setTimeout(ne,S),J(N)}return O===void 0&&(O=setTimeout(ne,S)),M}return ee.cancel=z,ee.flush=j,ee}function b(R,S,A){var P=!0,I=!0;if(typeof R!="function")throw new TypeError(r);return w(A)&&(P="leading"in A?!!A.leading:P,I="trailing"in A?!!A.trailing:I),m(R,S,{leading:P,maxWait:S,trailing:I})}function w(R){var S=typeof R;return!!R&&(S=="object"||S=="function")}function x(R){return!!R&&typeof R=="object"}function _(R){return typeof R=="symbol"||x(R)&&h.call(R)==t}function C(R){if(typeof R=="number")return R;if(_(R))return e;if(w(R)){var S=typeof R.valueOf=="function"?R.valueOf():R;R=w(S)?S+"":S}if(typeof R!="string")return R===0?R:+R;R=R.replace(n,"");var A=i.test(R);return A||o.test(R)?s(R.slice(2),A?2:8):a.test(R)?e:+R}return rm=b,rm}var Q4=zu.exports,IR;function J4(){return IR||(IR=1,(function(r,e){(function(n,a){r.exports=a(Z4(),X4())})(Q4,function(t,n){return(function(a){var i={};function o(s){if(i[s])return i[s].exports;var u=i[s]={i:s,l:!1,exports:{}};return a[s].call(u.exports,u,u.exports,o),u.l=!0,u.exports}return o.m=a,o.c=i,o.i=function(s){return s},o.d=function(s,u,l){o.o(s,u)||Object.defineProperty(s,u,{configurable:!1,enumerable:!0,get:l})},o.n=function(s){var u=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(u,"a",u),u},o.o=function(s,u){return Object.prototype.hasOwnProperty.call(s,u)},o.p="",o(o.s=12)})([(function(a,i,o){a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var u=arguments.length,l=Array(u>1?u-1:0),c=1;c<u;c++)l[c-1]=arguments[c];return l.filter(function(v){return v!=null}).forEach(function(v){Object.keys(v).forEach(function(h){return s[h]=v[h]})}),s}}),(function(a,i,o){var s=o(10),u=o(0);a.exports=function(l){var c=this;return new s(u({cy:c},l))}}),(function(a,i,o){function s(){if(this.saveGestureState(),this.cy.zoomingEnabled(!1).panningEnabled(!1).boxSelectionEnabled(!1),this.options.disableBrowserGestures){var c=this.windowListenerOptions;window.addEventListener("touchstart",this.preventDefault,c),window.addEventListener("touchmove",this.preventDefault,c),window.addEventListener("wheel",this.preventDefault,c)}return this}function u(){if(this.cy.zoomingEnabled(this.lastZoomingEnabled).panningEnabled(this.lastPanningEnabled).boxSelectionEnabled(this.lastBoxSelectionEnabled),this.options.disableBrowserGestures){var c=this.windowListenerOptions;window.removeEventListener("touchstart",this.preventDefault,c),window.removeEventListener("touchmove",this.preventDefault,c),window.removeEventListener("wheel",this.preventDefault,c)}return this}function l(){var c=this.cy;return this.lastPanningEnabled=c.panningEnabled(),this.lastZoomingEnabled=c.zoomingEnabled(),this.lastBoxSelectionEnabled=c.boxSelectionEnabled(),this}a.exports={disableGestures:s,resetGestures:u,saveGestureState:l}}),(function(a,i,o){function s(){var u=this,l=this.cy,c=this.options;return this.addListener(l,"drag",function(){return u.grabbingNode=!0}),this.addListener(l,"free",function(){return u.grabbingNode=!1}),this.addListener(l,"tapstart","node",function(v){var h=v.target;u.drawMode&&u.start(h)}),this.addListener(l,"tapdrag",function(v){u.update(v.position)}),this.addListener(l,"tapdragover","node",function(v){c.snap||u.preview(v.target)}),this.addListener(l,"tapdragout","node",function(v){c.snap||u.unpreview(v.target)}),this.addListener(l,"tapend",function(){u.stop()}),this}a.exports={addCytoscapeListeners:s}}),(function(a,i,o){var s={canConnect:function(l,c){return!l.same(c)},edgeParams:function(l,c){return{}},hoverDelay:150,snap:!0,snapThreshold:50,snapFrequency:15,noEdgeEventsInDraw:!0,disableBrowserGestures:!0};a.exports=s}),(function(a,i,o){function s(c){var v=this.cy;return this.drawMode=c??!this.drawMode,this.drawMode?(this.prevUngrabifyState=v.autoungrabify(),v.autoungrabify(!0),this.emit("drawon")):(v.autoungrabify(this.prevUngrabifyState),this.emit("drawoff")),this}function u(){return this.toggleDrawMode(!0)}function l(){return this.toggleDrawMode(!1)}a.exports={toggleDrawMode:s,enableDrawMode:u,disableDrawMode:l}}),(function(a,i,o){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},u=o(0),l=function(w){return(typeof w>"u"?"undefined":s(w))===s("")},c=function(w){return(typeof w>"u"?"undefined":s(w))===s([])&&w.length!=null};function v(b,w,x){var _={};return u(_,w,b),u(_.data,w.data,b.data),l(w.classes)?_.classes=w.classes+" "+x:c(w.classes)?_.classes=w.classes.join(" ")+" "+x:_.classes=x,_}function h(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,w=this.cy;this.options;var x=this.presumptiveTargets,_=this.previewEles,C=this.active,R=this.sourceNode,S=this.targetNode,A=b?"eh-preview":"",P=w.collection(),I=this.canConnect(S);if(C&&I){if(!S||S.size()===0){_.remove(),this.emit("cancel",this.mp(),R,x);return}if(!b){_.removeClass("eh-preview").style("events",""),this.emit("complete",this.mp(),R,S,_);return}var D=w.add(v({group:"edges",data:{source:R.id(),target:S.id()}},this.edgeParams(S),A));return P=P.merge(D),b?(this.previewEles=P,P.style("events","no")):(P.style("events",""),this.emit("complete",this.mp(),R,S,P)),this}}function g(){return this.makeEdges(!0),this}function p(){return this.previewEles.nonempty()&&this.previewEles.inside()}function E(){return this.previewShown()&&this.previewEles.remove(),this}function m(){var b=this,w=this.sourceNode,x=this.ghostNode,_=this.cy,C=this.mx,R=this.my,S=C,A=R,P=void 0,I=void 0;if(w)return(!x||x.length===0||x.removed())&&(I=this.ghostEles=_.collection(),_.batch(function(){x=b.ghostNode=_.add({group:"nodes",classes:"eh-ghost eh-ghost-node",position:{x:0,y:0}}),x.style({"background-color":"blue",width:1e-4,height:1e-4,opacity:0,events:"no"});var D={};P=_.add(u({},D,{group:"edges",data:u({},D.data,{source:w.id(),target:x.id()}),classes:"eh-ghost eh-ghost-edge"})),P.style({events:"no"})}),I.merge(x).merge(P)),x.position({x:S,y:A}),this}a.exports={makeEdges:h,makePreview:g,removePreview:E,previewShown:p,updateEdge:m}}),(function(a,i,o){function s(){return this.options.noEdgeEventsInDraw&&this.cy.edges().style("events","no"),this}function u(){return this.options.noEdgeEventsInDraw&&this.cy.edges().style("events",""),this}a.exports={disableEdgeEvents:s,enableEdgeEvents:u}}),(function(a,i,o){function s(){return this.enabled=!0,this.emit("enable"),this}function u(){return this.enabled=!1,this.emit("disable"),this}a.exports={enable:s,disable:u}}),(function(a,i,o){var s=o(13),u=Math.sqrt(2);function l(w){var x=this.previewEles,_=this.ghostEles,C=function(M){return x.anySame(M)},R=function(M){return _.anySame(M)},S=function(M){return C(M)||R(M)},A=this.enabled,P=this.active,I=this.grabbingNode;return A&&!P&&!I&&w!=null&&w.nonempty()&&!S(w)}function c(w){return this.canStartOn(w)&&this.drawMode}function v(w){return this.canStartOn(w)&&!this.drawMode}function h(w){var x=this;if(this.canStartOn(w)){this.active=!0,this.sourceNode=w,this.sourceNode.addClass("eh-source"),this.disableGestures(),this.disableEdgeEvents();var _=function(R){return R.id()};this.canConnect=s(function(C){return x.options.canConnect(x.sourceNode,C)},_),this.edgeParams=s(function(C){return x.options.edgeParams(x.sourceNode,C)},_),this.emit("start",this.hp(),w)}}function g(w){if(this.active){var x=w;return this.mx=x.x,this.my=x.y,this.updateEdge(),this.throttledSnap(),this}}function p(){if(!this.active||!this.options.snap)return!1;var w=this.cy,x=this.targetNode,_=this.options.snapThreshold,C=this.mp(),R=this.previewEles,S=this.ghostNode,A=function(z){return u*Math.max(z.outerWidth(),z.outerHeight())/2},P=function(z,j,ee,ie){var oe=ee-z,Y=ie-j;return oe*oe+Y*Y},I=function(z,j){return P(z.x,z.y,j.x,j.y)},D=function(z){return I(z.position(),C)},M=function(z){var j=A(z),ee=j+_;return ee*ee},O=function(z){return D(z)<=M(z)},N=function(z){var j=z.position(),ee=z.outerWidth()/2,ie=z.outerHeight()/2,oe=j.x,Y=j.y,X=C.x,re=C.y,le=oe-ee,he=oe+ee,be=Y-ie,fe=Y+ie,ue=le<=X&&X<=he,Se=be<=re&&re<=fe;if(ue&&Se)return 0;if(ue){var Ae=re-be,Te=re-fe;return Math.min(Ae*Ae,Te*Te)}else if(Se){var Pe=X-le,Ie=X-he;return Math.min(Pe*Pe,Ie*Ie)}else return X<le&&re<be?P(X,re,le,be):X>he&&re<be?P(X,re,he,be):X<le&&re>fe?P(X,re,le,fe):P(X,re,he,fe)},V=function(z,j){return N(z)-N(j)},$=V,G=!1,U=function(z){var j=C,ee=z.outerWidth(),ie=ee/2,oe=z.outerHeight(),Y=oe/2,X=z.position(),re=X.x-ie,le=X.x+ie,he=X.y-Y,be=X.y+Y;return re<=j.x&&j.x<=le&&he<=j.y&&j.y<=be},J=function(z){return z.same(R)||z.same(S)},W=w.nodes(function(F){return!J(F)&&O(F)}).sort($),H=!1;x.nonempty()&&!O(x)&&this.unpreview(x);for(var Z=0;Z<W.length;Z++){var ne=W[Z];if(!(ne.isParent()&&U(ne))&&!(ne.isChild()&&!U(ne.parent()))&&(ne.same(x)||this.preview(ne,G))){H=!0;break}}return H}function E(w){var x=this,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,C=this.options,R=this.sourceNode,S=this.ghostNode,A=this.ghostEles,P=this.presumptiveTargets,I=this.previewEles,D=this.active,M=R,O=w.same(S),N=!this.canConnect(w),V=w.same(this.targetNode);if(!D||O||N||V)return!1;this.targetNode.nonempty()&&this.unpreview(this.targetNode),clearTimeout(this.previewTimeout);var $=function(){x.targetNode=w,P.merge(w),w.addClass("eh-presumptive-target"),w.addClass("eh-target"),x.emit("hoverover",x.mp(),M,w),w.addClass("eh-preview"),A.addClass("eh-preview-active"),R.addClass("eh-preview-active"),w.addClass("eh-preview-active"),x.makePreview(),x.emit("previewon",x.mp(),M,w,I)};return _&&C.hoverDelay>0?this.previewTimeout=setTimeout($,C.hoverDelay):$(),!0}function m(w){if(this.active){var x=this.previewTimeout,_=this.sourceNode,C=this.previewEles,R=this.ghostEles,S=this.cy;clearTimeout(x),this.previewTimeout=null;var A=_;return w.removeClass("eh-preview eh-target eh-presumptive-target eh-preview-active"),R.removeClass("eh-preview-active"),_.removeClass("eh-preview-active"),this.targetNode=S.collection(),this.removePreview(A,w),this.emit("hoverout",this.mp(),A,w),this.emit("previewoff",this.mp(),A,w,C),this}}function b(){if(this.active){var w=this.sourceNode,x=this.targetNode,_=this.ghostEles,C=this.presumptiveTargets;return clearTimeout(this.previewTimeout),w.removeClass("eh-source eh-preview-active"),x.removeClass("eh-target eh-preview eh-hover eh-preview-active"),C.removeClass("eh-presumptive-target"),this.makeEdges(),_.remove(),this.clearCollections(),this.resetGestures(),this.enableEdgeEvents(),this.active=!1,this.emit("stop",this.mp(),w),this}}a.exports={start:h,update:g,preview:E,unpreview:m,stop:b,snap:p,canStartOn:l,canStartDrawModeOn:c,canStartNonDrawModeOn:v}}),(function(a,i,o){var s=o(4),u=o(0),l=o(14),c=o(2),v=o(3),h=o(5),g=o(6),p=o(8),E=o(9),m=o(11),b=o(7);function w(C){var R=C.cy;this.cy=R,this.listeners=[],this.enabled=!0,this.drawMode=!1,this.active=!1,this.grabbingNode=!1,this.clearCollections(),this.mx=0,this.my=0,this.options=u({},s,C),this.saveGestureState(),this.addListeners(),this.throttledSnap=l(this.snap.bind(this),1e3/C.snapFrequency),this.preventDefault=function(P){return P.preventDefault()},this.canConnect=function(){return!1};var S=!1;try{var A=Object.defineProperty({},"passive",{get:function(){S=!0}});window.addEventListener("test",null,A)}catch{}S?this.windowListenerOptions={capture:!0,passive:!1}:this.windowListenerOptions=!0}var x=w.prototype={},_=function(R){return u(x,R)};x.destroy=function(){this.removeListeners()},x.setOptions=function(C){u(this.options,C)},x.mp=function(){return{x:this.mx,y:this.my}},x.hp=function(){return{x:this.hx,y:this.hy}},x.clearCollections=function(){var C=this.cy;this.previewEles=C.collection(),this.ghostEles=C.collection(),this.ghostNode=C.collection(),this.sourceNode=C.collection(),this.targetNode=C.collection(),this.presumptiveTargets=C.collection()},[c,v,h,g,p,E,m,b].forEach(_),a.exports=w}),(function(a,i,o){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E};function u(){var E=this;return this.addCytoscapeListeners(),this.addListener(this.cy,"destroy",function(){return E.destroy()}),this}function l(){for(var E=this.listeners.length-1;E>=0;E--){var m=this.listeners[E];this.removeListener(m.target,m.event,m.selector,m.callback,m.options)}return this}function c(E,m,b,w,x){return(typeof b>"u"?"undefined":s(b))!==s("")&&(w=b,x=w,b=null),x==null&&(x=!1),{target:E,event:m,selector:b,callback:w,options:x}}function v(E){return E instanceof Element}function h(E,m,b,w,x){var _=c(E,m,b,w,x);return this.listeners.push(_),v(_.target)?_.target.addEventListener(_.event,_.callback,_.options):_.selector?_.target.addListener(_.event,_.selector,_.callback,_.options):_.target.addListener(_.event,_.callback,_.options),this}function g(E,m,b,w,x){for(var _=c(E,m,b,w,x),C=this.listeners.length-1;C>=0;C--){var R=this.listeners[C];if(_.target===R.target&&_.event===R.event&&(_.selector==null||_.selector===R.selector)&&(_.callback==null||_.callback===R.callback)){this.listeners.splice(C,1),v(_.target)?_.target.removeEventListener(_.event,_.callback,_.options):_.selector?_.target.removeListener(_.event,_.selector,_.callback,_.options):_.target.removeListener(_.event,_.callback,_.options);break}}return this}function p(E,m){for(var b=this.cy,w=arguments.length,x=Array(w>2?w-2:0),_=2;_<w;_++)x[_-2]=arguments[_];return b.emit({type:"eh"+E,position:m},x),this}a.exports={addListener:h,addListeners:u,removeListener:g,removeListeners:l,emit:p}}),(function(a,i,o){var s=o(1),u=function(c){c&&c("core","edgehandles",s)};typeof cytoscape<"u"&&u(cytoscape),a.exports=u}),(function(a,i){a.exports=t}),(function(a,i){a.exports=n})])})})(zu)),zu.exports}var eW=J4();const rW=El(eW);var tm,BR;function tW(){if(BR)return tm;BR=1;class r{constructor(n,a={}){this._cy=n,this._params=a,this._node_dom={};let i=n.container();if(a.dom_container)this._nodes_dom_container=a.dom_container;else{let s=document.createElement("div");s.style.position="absolute",s.style.zIndex=10,i.querySelector("canvas").parentNode.appendChild(s),this._nodes_dom_container=s}this._resize_observer=new ResizeObserver(s=>{for(let u of s){let l=u.target,c=l.__cy_id;n.getElementById(c).style({width:l.offsetWidth,height:l.offsetHeight,shape:"rectangle"})}}),n.on("add","node",s=>{this._add_node(s.target)}),n.on("remove","node",s=>{this._remove_node(s.target)});for(let s of n.nodes())this._add_node(s);this._nodes_dom_container.style.willChange="transform",this._nodes_dom_container.style.backfaceVisibility="hidden";let o=null;n.on("pan zoom",()=>{o===null&&(o=requestAnimationFrame(()=>{o=null;let s=n.pan(),u=n.zoom(),l="translate3d("+s.x+"px,"+s.y+"px,0) scale("+u+")";this._nodes_dom_container.style.transform=l}))}),this._panZoomRafId=o,n.on("position bounds","node",s=>{let u=s.target,l=u.id();if(!this._node_dom[l])return;let c=this._node_dom[l],v=`translate(-50%, -50%) translate3d(${u.position("x").toFixed(2)}px, ${u.position("y").toFixed(2)}px, 0)`;c.style.transform=v,c.style.display="inline",c.style.position="absolute",c.style["z-index"]=10})}_add_node(n){let a=n.data();a.dom&&(a.skip_node_append!==!0&&this._nodes_dom_container.appendChild(a.dom),a.dom.__cy_id=n.id(),a.dom.style.willChange="transform",a.dom.style.backfaceVisibility="hidden",this._node_dom[n.id()]=a.dom,this._resize_observer.observe(a.dom))}_remove_node(n){let a=n.id(),i=this._node_dom[a];i&&(this._resize_observer.unobserve(i),i.parentNode===this._nodes_dom_container&&this._nodes_dom_container.removeChild(i),delete this._node_dom[a])}node_dom(n){return this._node_dom[n]}update(n,a){let i=this._cy.getElementById(n);if(!i){console.warn(`Node with id ${n} not found`);return}let o=this._node_dom[n];if(!o){console.warn(`DOM element for node ${n} not found`);return}a(o),i.data("dom",o),this._cy.trigger("position",["node",i])}remove(){for(let n in this._node_dom)this._resize_observer.unobserve(this._node_dom[n]);for(;this._nodes_dom_container.firstChild;)this._nodes_dom_container.removeChild(this._nodes_dom_container.firstChild);this._node_dom={},this._cy.removeListener("add","node"),this._cy.removeListener("remove","node"),this._cy.removeListener("pan zoom"),this._cy.removeListener("position bounds","node"),this._params.dom_container||this._nodes_dom_container.parentNode.removeChild(this._nodes_dom_container),this._panZoomRafId!==null&&cancelAnimationFrame(this._panZoomRafId),this._cy=null,this._params=null,this._nodes_dom_container=null,this._resize_observer=null}}function e(t){t&&t("core","domNode",function(n,a){return new r(this,n,a)})}return typeof cytoscape<"u"&&e(cytoscape),tm=e,tm}var nW=tW();const aW=El(nW);sn.prototype.hasInitialised||(sn.use(Y4),sn.use(rW),sn.use(aW),sn.prototype.hasInitialised=!0);var Vo={exports:{}};/**
|
|
332
|
+
* @license
|
|
333
|
+
* Lodash <https://lodash.com/>
|
|
334
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
335
|
+
* Released under MIT license <https://lodash.com/license>
|
|
336
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
337
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
338
|
+
*/var iW=Vo.exports,OR;function oW(){return OR||(OR=1,(function(r,e){(function(){var t,n="4.17.23",a=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",s="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",v=1,h=2,g=4,p=1,E=2,m=1,b=2,w=4,x=8,_=16,C=32,R=64,S=128,A=256,P=512,I=30,D="...",M=800,O=16,N=1,V=2,$=3,G=1/0,U=9007199254740991,J=17976931348623157e292,W=NaN,H=4294967295,Z=H-1,ne=H>>>1,F=[["ary",S],["bind",m],["bindKey",b],["curry",x],["curryRight",_],["flip",P],["partial",C],["partialRight",R],["rearg",A]],z="[object Arguments]",j="[object Array]",ee="[object AsyncFunction]",ie="[object Boolean]",oe="[object Date]",Y="[object DOMException]",X="[object Error]",re="[object Function]",le="[object GeneratorFunction]",he="[object Map]",be="[object Number]",fe="[object Null]",ue="[object Object]",Se="[object Promise]",Ae="[object Proxy]",Te="[object RegExp]",Pe="[object Set]",Ie="[object String]",Le="[object Symbol]",Fe="[object Undefined]",je="[object WeakMap]",lr="[object WeakSet]",ir="[object ArrayBuffer]",Xe="[object DataView]",fr="[object Float32Array]",Ue="[object Float64Array]",Oe="[object Int8Array]",ge="[object Int16Array]",L="[object Int32Array]",se="[object Uint8Array]",de="[object Uint8ClampedArray]",ve="[object Uint16Array]",ye="[object Uint32Array]",Me=/\b__p \+= '';/g,_e=/\b(__p \+=) '' \+/g,ze=/(__e\(.*?\)|\b__t\)) \+\n'';/g,qe=/&(?:amp|lt|gt|quot|#39);/g,We=/[&<>"']/g,nr=RegExp(qe.source),er=RegExp(We.source),$e=/<%-([\s\S]+?)%>/g,or=/<%([\s\S]+?)%>/g,rr=/<%=([\s\S]+?)%>/g,Vr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/,st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Br=/[\\^$.*+?()[\]{}|]/g,Ur=RegExp(Br.source),Lr=/^\s+/,Yr=/\s/,En=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fr=/\{\n\/\* \[wrapped with (.+)\] \*/,cn=/,? & /,dn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ea=/[()=,{}\[\]\/\s]/,hi=/\\(\\)?/g,kn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ut=/\w*$/,tt=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,La=/^\[object .+?Constructor\]$/,Bt=/^0o[0-7]+$/i,Ss=/^(?:0|[1-9]\d*)$/,$l=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gi=/($^)/,Vl=/['\n\r\u2028\u2029\\]/g,pi="\\ud800-\\udfff",Gl="\\u0300-\\u036f",Wl="\\ufe20-\\ufe2f",Ul="\\u20d0-\\u20ff",ra=Gl+Wl+Ul,yi="\\u2700-\\u27bf",qa="a-z\\xdf-\\xf6\\xf8-\\xff",Ts="\\xac\\xb1\\xd7\\xf7",Rs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Hl="\\u2000-\\u206f",$t=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mi="A-Z\\xc0-\\xd6\\xd8-\\xde",vo="\\ufe0e\\ufe0f",ta=Ts+Rs+Hl+$t,Ct="['’]",Kl="["+pi+"]",jl="["+ta+"]",bi="["+ra+"]",g0="\\d+",VP="["+yi+"]",p0="["+qa+"]",y0="[^"+pi+ta+g0+yi+qa+mi+"]",Yl="\\ud83c[\\udffb-\\udfff]",GP="(?:"+bi+"|"+Yl+")",m0="[^"+pi+"]",Zl="(?:\\ud83c[\\udde6-\\uddff]){2}",Xl="[\\ud800-\\udbff][\\udc00-\\udfff]",wi="["+mi+"]",b0="\\u200d",w0="(?:"+p0+"|"+y0+")",WP="(?:"+wi+"|"+y0+")",x0="(?:"+Ct+"(?:d|ll|m|re|s|t|ve))?",E0="(?:"+Ct+"(?:D|LL|M|RE|S|T|VE))?",_0=GP+"?",C0="["+vo+"]?",UP="(?:"+b0+"(?:"+[m0,Zl,Xl].join("|")+")"+C0+_0+")*",HP="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",KP="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",S0=C0+_0+UP,jP="(?:"+[VP,Zl,Xl].join("|")+")"+S0,YP="(?:"+[m0+bi+"?",bi,Zl,Xl,Kl].join("|")+")",ZP=RegExp(Ct,"g"),XP=RegExp(bi,"g"),Ql=RegExp(Yl+"(?="+Yl+")|"+YP+S0,"g"),QP=RegExp([wi+"?"+p0+"+"+x0+"(?="+[jl,wi,"$"].join("|")+")",WP+"+"+E0+"(?="+[jl,wi+w0,"$"].join("|")+")",wi+"?"+w0+"+"+x0,wi+"+"+E0,KP,HP,g0,jP].join("|"),"g"),JP=RegExp("["+b0+pi+ra+vo+"]"),eD=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rD=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tD=-1,Pr={};Pr[fr]=Pr[Ue]=Pr[Oe]=Pr[ge]=Pr[L]=Pr[se]=Pr[de]=Pr[ve]=Pr[ye]=!0,Pr[z]=Pr[j]=Pr[ir]=Pr[ie]=Pr[Xe]=Pr[oe]=Pr[X]=Pr[re]=Pr[he]=Pr[be]=Pr[ue]=Pr[Te]=Pr[Pe]=Pr[Ie]=Pr[je]=!1;var Tr={};Tr[z]=Tr[j]=Tr[ir]=Tr[Xe]=Tr[ie]=Tr[oe]=Tr[fr]=Tr[Ue]=Tr[Oe]=Tr[ge]=Tr[L]=Tr[he]=Tr[be]=Tr[ue]=Tr[Te]=Tr[Pe]=Tr[Ie]=Tr[Le]=Tr[se]=Tr[de]=Tr[ve]=Tr[ye]=!0,Tr[X]=Tr[re]=Tr[je]=!1;var nD={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},aD={"&":"&","<":"<",">":">",'"':""","'":"'"},iD={"&":"&","<":"<",">":">",""":'"',"'":"'"},oD={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},sD=parseFloat,uD=parseInt,T0=typeof wt=="object"&&wt&&wt.Object===Object&&wt,lD=typeof self=="object"&&self&&self.Object===Object&&self,lt=T0||lD||Function("return this")(),Jl=e&&!e.nodeType&&e,Na=Jl&&!0&&r&&!r.nodeType&&r,R0=Na&&Na.exports===Jl,ef=R0&&T0.process,Zt=(function(){try{var te=Na&&Na.require&&Na.require("util").types;return te||ef&&ef.binding&&ef.binding("util")}catch{}})(),A0=Zt&&Zt.isArrayBuffer,P0=Zt&&Zt.isDate,D0=Zt&&Zt.isMap,I0=Zt&&Zt.isRegExp,B0=Zt&&Zt.isSet,O0=Zt&&Zt.isTypedArray;function Vt(te,pe,ce){switch(ce.length){case 0:return te.call(pe);case 1:return te.call(pe,ce[0]);case 2:return te.call(pe,ce[0],ce[1]);case 3:return te.call(pe,ce[0],ce[1],ce[2])}return te.apply(pe,ce)}function fD(te,pe,ce,ke){for(var Qe=-1,mr=te==null?0:te.length;++Qe<mr;){var Zr=te[Qe];pe(ke,Zr,ce(Zr),te)}return ke}function Xt(te,pe){for(var ce=-1,ke=te==null?0:te.length;++ce<ke&&pe(te[ce],ce,te)!==!1;);return te}function cD(te,pe){for(var ce=te==null?0:te.length;ce--&&pe(te[ce],ce,te)!==!1;);return te}function M0(te,pe){for(var ce=-1,ke=te==null?0:te.length;++ce<ke;)if(!pe(te[ce],ce,te))return!1;return!0}function na(te,pe){for(var ce=-1,ke=te==null?0:te.length,Qe=0,mr=[];++ce<ke;){var Zr=te[ce];pe(Zr,ce,te)&&(mr[Qe++]=Zr)}return mr}function As(te,pe){var ce=te==null?0:te.length;return!!ce&&xi(te,pe,0)>-1}function rf(te,pe,ce){for(var ke=-1,Qe=te==null?0:te.length;++ke<Qe;)if(ce(pe,te[ke]))return!0;return!1}function Or(te,pe){for(var ce=-1,ke=te==null?0:te.length,Qe=Array(ke);++ce<ke;)Qe[ce]=pe(te[ce],ce,te);return Qe}function aa(te,pe){for(var ce=-1,ke=pe.length,Qe=te.length;++ce<ke;)te[Qe+ce]=pe[ce];return te}function tf(te,pe,ce,ke){var Qe=-1,mr=te==null?0:te.length;for(ke&&mr&&(ce=te[++Qe]);++Qe<mr;)ce=pe(ce,te[Qe],Qe,te);return ce}function dD(te,pe,ce,ke){var Qe=te==null?0:te.length;for(ke&&Qe&&(ce=te[--Qe]);Qe--;)ce=pe(ce,te[Qe],Qe,te);return ce}function nf(te,pe){for(var ce=-1,ke=te==null?0:te.length;++ce<ke;)if(pe(te[ce],ce,te))return!0;return!1}var vD=af("length");function hD(te){return te.split("")}function gD(te){return te.match(dn)||[]}function k0(te,pe,ce){var ke;return ce(te,function(Qe,mr,Zr){if(pe(Qe,mr,Zr))return ke=mr,!1}),ke}function Ps(te,pe,ce,ke){for(var Qe=te.length,mr=ce+(ke?1:-1);ke?mr--:++mr<Qe;)if(pe(te[mr],mr,te))return mr;return-1}function xi(te,pe,ce){return pe===pe?RD(te,pe,ce):Ps(te,L0,ce)}function pD(te,pe,ce,ke){for(var Qe=ce-1,mr=te.length;++Qe<mr;)if(ke(te[Qe],pe))return Qe;return-1}function L0(te){return te!==te}function q0(te,pe){var ce=te==null?0:te.length;return ce?sf(te,pe)/ce:W}function af(te){return function(pe){return pe==null?t:pe[te]}}function of(te){return function(pe){return te==null?t:te[pe]}}function N0(te,pe,ce,ke,Qe){return Qe(te,function(mr,Zr,Cr){ce=ke?(ke=!1,mr):pe(ce,mr,Zr,Cr)}),ce}function yD(te,pe){var ce=te.length;for(te.sort(pe);ce--;)te[ce]=te[ce].value;return te}function sf(te,pe){for(var ce,ke=-1,Qe=te.length;++ke<Qe;){var mr=pe(te[ke]);mr!==t&&(ce=ce===t?mr:ce+mr)}return ce}function uf(te,pe){for(var ce=-1,ke=Array(te);++ce<te;)ke[ce]=pe(ce);return ke}function mD(te,pe){return Or(pe,function(ce){return[ce,te[ce]]})}function F0(te){return te&&te.slice(0,G0(te)+1).replace(Lr,"")}function Gt(te){return function(pe){return te(pe)}}function lf(te,pe){return Or(pe,function(ce){return te[ce]})}function ho(te,pe){return te.has(pe)}function z0(te,pe){for(var ce=-1,ke=te.length;++ce<ke&&xi(pe,te[ce],0)>-1;);return ce}function $0(te,pe){for(var ce=te.length;ce--&&xi(pe,te[ce],0)>-1;);return ce}function bD(te,pe){for(var ce=te.length,ke=0;ce--;)te[ce]===pe&&++ke;return ke}var wD=of(nD),xD=of(aD);function ED(te){return"\\"+oD[te]}function _D(te,pe){return te==null?t:te[pe]}function Ei(te){return JP.test(te)}function CD(te){return eD.test(te)}function SD(te){for(var pe,ce=[];!(pe=te.next()).done;)ce.push(pe.value);return ce}function ff(te){var pe=-1,ce=Array(te.size);return te.forEach(function(ke,Qe){ce[++pe]=[Qe,ke]}),ce}function V0(te,pe){return function(ce){return te(pe(ce))}}function ia(te,pe){for(var ce=-1,ke=te.length,Qe=0,mr=[];++ce<ke;){var Zr=te[ce];(Zr===pe||Zr===c)&&(te[ce]=c,mr[Qe++]=ce)}return mr}function Ds(te){var pe=-1,ce=Array(te.size);return te.forEach(function(ke){ce[++pe]=ke}),ce}function TD(te){var pe=-1,ce=Array(te.size);return te.forEach(function(ke){ce[++pe]=[ke,ke]}),ce}function RD(te,pe,ce){for(var ke=ce-1,Qe=te.length;++ke<Qe;)if(te[ke]===pe)return ke;return-1}function AD(te,pe,ce){for(var ke=ce+1;ke--;)if(te[ke]===pe)return ke;return ke}function _i(te){return Ei(te)?DD(te):vD(te)}function vn(te){return Ei(te)?ID(te):hD(te)}function G0(te){for(var pe=te.length;pe--&&Yr.test(te.charAt(pe)););return pe}var PD=of(iD);function DD(te){for(var pe=Ql.lastIndex=0;Ql.test(te);)++pe;return pe}function ID(te){return te.match(Ql)||[]}function BD(te){return te.match(QP)||[]}var OD=(function te(pe){pe=pe==null?lt:Ci.defaults(lt.Object(),pe,Ci.pick(lt,rD));var ce=pe.Array,ke=pe.Date,Qe=pe.Error,mr=pe.Function,Zr=pe.Math,Cr=pe.Object,cf=pe.RegExp,MD=pe.String,Qt=pe.TypeError,Is=ce.prototype,kD=mr.prototype,Si=Cr.prototype,Bs=pe["__core-js_shared__"],Os=kD.toString,br=Si.hasOwnProperty,LD=0,W0=(function(){var f=/[^.]+$/.exec(Bs&&Bs.keys&&Bs.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""})(),Ms=Si.toString,qD=Os.call(Cr),ND=lt._,FD=cf("^"+Os.call(br).replace(Br,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ks=R0?pe.Buffer:t,oa=pe.Symbol,Ls=pe.Uint8Array,U0=ks?ks.allocUnsafe:t,qs=V0(Cr.getPrototypeOf,Cr),H0=Cr.create,K0=Si.propertyIsEnumerable,Ns=Is.splice,j0=oa?oa.isConcatSpreadable:t,go=oa?oa.iterator:t,Fa=oa?oa.toStringTag:t,Fs=(function(){try{var f=Wa(Cr,"defineProperty");return f({},"",{}),f}catch{}})(),zD=pe.clearTimeout!==lt.clearTimeout&&pe.clearTimeout,$D=ke&&ke.now!==lt.Date.now&&ke.now,VD=pe.setTimeout!==lt.setTimeout&&pe.setTimeout,zs=Zr.ceil,$s=Zr.floor,df=Cr.getOwnPropertySymbols,GD=ks?ks.isBuffer:t,Y0=pe.isFinite,WD=Is.join,UD=V0(Cr.keys,Cr),Xr=Zr.max,yt=Zr.min,HD=ke.now,KD=pe.parseInt,Z0=Zr.random,jD=Is.reverse,vf=Wa(pe,"DataView"),po=Wa(pe,"Map"),hf=Wa(pe,"Promise"),Ti=Wa(pe,"Set"),yo=Wa(pe,"WeakMap"),mo=Wa(Cr,"create"),Vs=yo&&new yo,Ri={},YD=Ua(vf),ZD=Ua(po),XD=Ua(hf),QD=Ua(Ti),JD=Ua(yo),Gs=oa?oa.prototype:t,bo=Gs?Gs.valueOf:t,X0=Gs?Gs.toString:t;function k(f){if(zr(f)&&!Je(f)&&!(f instanceof dr)){if(f instanceof Jt)return f;if(br.call(f,"__wrapped__"))return Qb(f)}return new Jt(f)}var Ai=(function(){function f(){}return function(d){if(!qr(d))return{};if(H0)return H0(d);f.prototype=d;var y=new f;return f.prototype=t,y}})();function Ws(){}function Jt(f,d){this.__wrapped__=f,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=t}k.templateSettings={escape:$e,evaluate:or,interpolate:rr,variable:"",imports:{_:k}},k.prototype=Ws.prototype,k.prototype.constructor=k,Jt.prototype=Ai(Ws.prototype),Jt.prototype.constructor=Jt;function dr(f){this.__wrapped__=f,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=H,this.__views__=[]}function eI(){var f=new dr(this.__wrapped__);return f.__actions__=Ot(this.__actions__),f.__dir__=this.__dir__,f.__filtered__=this.__filtered__,f.__iteratees__=Ot(this.__iteratees__),f.__takeCount__=this.__takeCount__,f.__views__=Ot(this.__views__),f}function rI(){if(this.__filtered__){var f=new dr(this);f.__dir__=-1,f.__filtered__=!0}else f=this.clone(),f.__dir__*=-1;return f}function tI(){var f=this.__wrapped__.value(),d=this.__dir__,y=Je(f),T=d<0,B=y?f.length:0,q=hB(0,B,this.__views__),K=q.start,Q=q.end,ae=Q-K,we=T?Q:K-1,xe=this.__iteratees__,Ce=xe.length,Be=0,Ve=yt(ae,this.__takeCount__);if(!y||!T&&B==ae&&Ve==ae)return xb(f,this.__actions__);var Ye=[];e:for(;ae--&&Be<Ve;){we+=d;for(var ar=-1,Ze=f[we];++ar<Ce;){var cr=xe[ar],vr=cr.iteratee,Ht=cr.type,Rt=vr(Ze);if(Ht==V)Ze=Rt;else if(!Rt){if(Ht==N)continue e;break e}}Ye[Be++]=Ze}return Ye}dr.prototype=Ai(Ws.prototype),dr.prototype.constructor=dr;function za(f){var d=-1,y=f==null?0:f.length;for(this.clear();++d<y;){var T=f[d];this.set(T[0],T[1])}}function nI(){this.__data__=mo?mo(null):{},this.size=0}function aI(f){var d=this.has(f)&&delete this.__data__[f];return this.size-=d?1:0,d}function iI(f){var d=this.__data__;if(mo){var y=d[f];return y===u?t:y}return br.call(d,f)?d[f]:t}function oI(f){var d=this.__data__;return mo?d[f]!==t:br.call(d,f)}function sI(f,d){var y=this.__data__;return this.size+=this.has(f)?0:1,y[f]=mo&&d===t?u:d,this}za.prototype.clear=nI,za.prototype.delete=aI,za.prototype.get=iI,za.prototype.has=oI,za.prototype.set=sI;function Ln(f){var d=-1,y=f==null?0:f.length;for(this.clear();++d<y;){var T=f[d];this.set(T[0],T[1])}}function uI(){this.__data__=[],this.size=0}function lI(f){var d=this.__data__,y=Us(d,f);if(y<0)return!1;var T=d.length-1;return y==T?d.pop():Ns.call(d,y,1),--this.size,!0}function fI(f){var d=this.__data__,y=Us(d,f);return y<0?t:d[y][1]}function cI(f){return Us(this.__data__,f)>-1}function dI(f,d){var y=this.__data__,T=Us(y,f);return T<0?(++this.size,y.push([f,d])):y[T][1]=d,this}Ln.prototype.clear=uI,Ln.prototype.delete=lI,Ln.prototype.get=fI,Ln.prototype.has=cI,Ln.prototype.set=dI;function qn(f){var d=-1,y=f==null?0:f.length;for(this.clear();++d<y;){var T=f[d];this.set(T[0],T[1])}}function vI(){this.size=0,this.__data__={hash:new za,map:new(po||Ln),string:new za}}function hI(f){var d=nu(this,f).delete(f);return this.size-=d?1:0,d}function gI(f){return nu(this,f).get(f)}function pI(f){return nu(this,f).has(f)}function yI(f,d){var y=nu(this,f),T=y.size;return y.set(f,d),this.size+=y.size==T?0:1,this}qn.prototype.clear=vI,qn.prototype.delete=hI,qn.prototype.get=gI,qn.prototype.has=pI,qn.prototype.set=yI;function $a(f){var d=-1,y=f==null?0:f.length;for(this.__data__=new qn;++d<y;)this.add(f[d])}function mI(f){return this.__data__.set(f,u),this}function bI(f){return this.__data__.has(f)}$a.prototype.add=$a.prototype.push=mI,$a.prototype.has=bI;function hn(f){var d=this.__data__=new Ln(f);this.size=d.size}function wI(){this.__data__=new Ln,this.size=0}function xI(f){var d=this.__data__,y=d.delete(f);return this.size=d.size,y}function EI(f){return this.__data__.get(f)}function _I(f){return this.__data__.has(f)}function CI(f,d){var y=this.__data__;if(y instanceof Ln){var T=y.__data__;if(!po||T.length<a-1)return T.push([f,d]),this.size=++y.size,this;y=this.__data__=new qn(T)}return y.set(f,d),this.size=y.size,this}hn.prototype.clear=wI,hn.prototype.delete=xI,hn.prototype.get=EI,hn.prototype.has=_I,hn.prototype.set=CI;function Q0(f,d){var y=Je(f),T=!y&&Ha(f),B=!y&&!T&&ca(f),q=!y&&!T&&!B&&Bi(f),K=y||T||B||q,Q=K?uf(f.length,MD):[],ae=Q.length;for(var we in f)(d||br.call(f,we))&&!(K&&(we=="length"||B&&(we=="offset"||we=="parent")||q&&(we=="buffer"||we=="byteLength"||we=="byteOffset")||$n(we,ae)))&&Q.push(we);return Q}function J0(f){var d=f.length;return d?f[Sf(0,d-1)]:t}function SI(f,d){return au(Ot(f),Va(d,0,f.length))}function TI(f){return au(Ot(f))}function gf(f,d,y){(y!==t&&!gn(f[d],y)||y===t&&!(d in f))&&Nn(f,d,y)}function wo(f,d,y){var T=f[d];(!(br.call(f,d)&&gn(T,y))||y===t&&!(d in f))&&Nn(f,d,y)}function Us(f,d){for(var y=f.length;y--;)if(gn(f[y][0],d))return y;return-1}function RI(f,d,y,T){return sa(f,function(B,q,K){d(T,B,y(B),K)}),T}function eb(f,d){return f&&Cn(d,nt(d),f)}function AI(f,d){return f&&Cn(d,kt(d),f)}function Nn(f,d,y){d=="__proto__"&&Fs?Fs(f,d,{configurable:!0,enumerable:!0,value:y,writable:!0}):f[d]=y}function pf(f,d){for(var y=-1,T=d.length,B=ce(T),q=f==null;++y<T;)B[y]=q?t:Zf(f,d[y]);return B}function Va(f,d,y){return f===f&&(y!==t&&(f=f<=y?f:y),d!==t&&(f=f>=d?f:d)),f}function en(f,d,y,T,B,q){var K,Q=d&v,ae=d&h,we=d&g;if(y&&(K=B?y(f,T,B,q):y(f)),K!==t)return K;if(!qr(f))return f;var xe=Je(f);if(xe){if(K=pB(f),!Q)return Ot(f,K)}else{var Ce=mt(f),Be=Ce==re||Ce==le;if(ca(f))return Cb(f,Q);if(Ce==ue||Ce==z||Be&&!B){if(K=ae||Be?{}:Gb(f),!Q)return ae?iB(f,AI(K,f)):aB(f,eb(K,f))}else{if(!Tr[Ce])return B?f:{};K=yB(f,Ce,Q)}}q||(q=new hn);var Ve=q.get(f);if(Ve)return Ve;q.set(f,K),m1(f)?f.forEach(function(Ze){K.add(en(Ze,d,y,Ze,f,q))}):p1(f)&&f.forEach(function(Ze,cr){K.set(cr,en(Ze,d,y,cr,f,q))});var Ye=we?ae?Lf:kf:ae?kt:nt,ar=xe?t:Ye(f);return Xt(ar||f,function(Ze,cr){ar&&(cr=Ze,Ze=f[cr]),wo(K,cr,en(Ze,d,y,cr,f,q))}),K}function PI(f){var d=nt(f);return function(y){return rb(y,f,d)}}function rb(f,d,y){var T=y.length;if(f==null)return!T;for(f=Cr(f);T--;){var B=y[T],q=d[B],K=f[B];if(K===t&&!(B in f)||!q(K))return!1}return!0}function tb(f,d,y){if(typeof f!="function")throw new Qt(o);return Ro(function(){f.apply(t,y)},d)}function xo(f,d,y,T){var B=-1,q=As,K=!0,Q=f.length,ae=[],we=d.length;if(!Q)return ae;y&&(d=Or(d,Gt(y))),T?(q=rf,K=!1):d.length>=a&&(q=ho,K=!1,d=new $a(d));e:for(;++B<Q;){var xe=f[B],Ce=y==null?xe:y(xe);if(xe=T||xe!==0?xe:0,K&&Ce===Ce){for(var Be=we;Be--;)if(d[Be]===Ce)continue e;ae.push(xe)}else q(d,Ce,T)||ae.push(xe)}return ae}var sa=Pb(_n),nb=Pb(mf,!0);function DI(f,d){var y=!0;return sa(f,function(T,B,q){return y=!!d(T,B,q),y}),y}function Hs(f,d,y){for(var T=-1,B=f.length;++T<B;){var q=f[T],K=d(q);if(K!=null&&(Q===t?K===K&&!Ut(K):y(K,Q)))var Q=K,ae=q}return ae}function II(f,d,y,T){var B=f.length;for(y=tr(y),y<0&&(y=-y>B?0:B+y),T=T===t||T>B?B:tr(T),T<0&&(T+=B),T=y>T?0:w1(T);y<T;)f[y++]=d;return f}function ab(f,d){var y=[];return sa(f,function(T,B,q){d(T,B,q)&&y.push(T)}),y}function ft(f,d,y,T,B){var q=-1,K=f.length;for(y||(y=bB),B||(B=[]);++q<K;){var Q=f[q];d>0&&y(Q)?d>1?ft(Q,d-1,y,T,B):aa(B,Q):T||(B[B.length]=Q)}return B}var yf=Db(),ib=Db(!0);function _n(f,d){return f&&yf(f,d,nt)}function mf(f,d){return f&&ib(f,d,nt)}function Ks(f,d){return na(d,function(y){return Vn(f[y])})}function Ga(f,d){d=la(d,f);for(var y=0,T=d.length;f!=null&&y<T;)f=f[Sn(d[y++])];return y&&y==T?f:t}function ob(f,d,y){var T=d(f);return Je(f)?T:aa(T,y(f))}function St(f){return f==null?f===t?Fe:fe:Fa&&Fa in Cr(f)?vB(f):TB(f)}function bf(f,d){return f>d}function BI(f,d){return f!=null&&br.call(f,d)}function OI(f,d){return f!=null&&d in Cr(f)}function MI(f,d,y){return f>=yt(d,y)&&f<Xr(d,y)}function wf(f,d,y){for(var T=y?rf:As,B=f[0].length,q=f.length,K=q,Q=ce(q),ae=1/0,we=[];K--;){var xe=f[K];K&&d&&(xe=Or(xe,Gt(d))),ae=yt(xe.length,ae),Q[K]=!y&&(d||B>=120&&xe.length>=120)?new $a(K&&xe):t}xe=f[0];var Ce=-1,Be=Q[0];e:for(;++Ce<B&&we.length<ae;){var Ve=xe[Ce],Ye=d?d(Ve):Ve;if(Ve=y||Ve!==0?Ve:0,!(Be?ho(Be,Ye):T(we,Ye,y))){for(K=q;--K;){var ar=Q[K];if(!(ar?ho(ar,Ye):T(f[K],Ye,y)))continue e}Be&&Be.push(Ye),we.push(Ve)}}return we}function kI(f,d,y,T){return _n(f,function(B,q,K){d(T,y(B),q,K)}),T}function Eo(f,d,y){d=la(d,f),f=Kb(f,d);var T=f==null?f:f[Sn(tn(d))];return T==null?t:Vt(T,f,y)}function sb(f){return zr(f)&&St(f)==z}function LI(f){return zr(f)&&St(f)==ir}function qI(f){return zr(f)&&St(f)==oe}function _o(f,d,y,T,B){return f===d?!0:f==null||d==null||!zr(f)&&!zr(d)?f!==f&&d!==d:NI(f,d,y,T,_o,B)}function NI(f,d,y,T,B,q){var K=Je(f),Q=Je(d),ae=K?j:mt(f),we=Q?j:mt(d);ae=ae==z?ue:ae,we=we==z?ue:we;var xe=ae==ue,Ce=we==ue,Be=ae==we;if(Be&&ca(f)){if(!ca(d))return!1;K=!0,xe=!1}if(Be&&!xe)return q||(q=new hn),K||Bi(f)?zb(f,d,y,T,B,q):cB(f,d,ae,y,T,B,q);if(!(y&p)){var Ve=xe&&br.call(f,"__wrapped__"),Ye=Ce&&br.call(d,"__wrapped__");if(Ve||Ye){var ar=Ve?f.value():f,Ze=Ye?d.value():d;return q||(q=new hn),B(ar,Ze,y,T,q)}}return Be?(q||(q=new hn),dB(f,d,y,T,B,q)):!1}function FI(f){return zr(f)&&mt(f)==he}function xf(f,d,y,T){var B=y.length,q=B,K=!T;if(f==null)return!q;for(f=Cr(f);B--;){var Q=y[B];if(K&&Q[2]?Q[1]!==f[Q[0]]:!(Q[0]in f))return!1}for(;++B<q;){Q=y[B];var ae=Q[0],we=f[ae],xe=Q[1];if(K&&Q[2]){if(we===t&&!(ae in f))return!1}else{var Ce=new hn;if(T)var Be=T(we,xe,ae,f,d,Ce);if(!(Be===t?_o(xe,we,p|E,T,Ce):Be))return!1}}return!0}function ub(f){if(!qr(f)||xB(f))return!1;var d=Vn(f)?FD:La;return d.test(Ua(f))}function zI(f){return zr(f)&&St(f)==Te}function $I(f){return zr(f)&&mt(f)==Pe}function VI(f){return zr(f)&&fu(f.length)&&!!Pr[St(f)]}function lb(f){return typeof f=="function"?f:f==null?Lt:typeof f=="object"?Je(f)?db(f[0],f[1]):cb(f):I1(f)}function Ef(f){if(!To(f))return UD(f);var d=[];for(var y in Cr(f))br.call(f,y)&&y!="constructor"&&d.push(y);return d}function GI(f){if(!qr(f))return SB(f);var d=To(f),y=[];for(var T in f)T=="constructor"&&(d||!br.call(f,T))||y.push(T);return y}function _f(f,d){return f<d}function fb(f,d){var y=-1,T=Mt(f)?ce(f.length):[];return sa(f,function(B,q,K){T[++y]=d(B,q,K)}),T}function cb(f){var d=Nf(f);return d.length==1&&d[0][2]?Ub(d[0][0],d[0][1]):function(y){return y===f||xf(y,f,d)}}function db(f,d){return zf(f)&&Wb(d)?Ub(Sn(f),d):function(y){var T=Zf(y,f);return T===t&&T===d?Xf(y,f):_o(d,T,p|E)}}function js(f,d,y,T,B){f!==d&&yf(d,function(q,K){if(B||(B=new hn),qr(q))WI(f,d,K,y,js,T,B);else{var Q=T?T(Vf(f,K),q,K+"",f,d,B):t;Q===t&&(Q=q),gf(f,K,Q)}},kt)}function WI(f,d,y,T,B,q,K){var Q=Vf(f,y),ae=Vf(d,y),we=K.get(ae);if(we){gf(f,y,we);return}var xe=q?q(Q,ae,y+"",f,d,K):t,Ce=xe===t;if(Ce){var Be=Je(ae),Ve=!Be&&ca(ae),Ye=!Be&&!Ve&&Bi(ae);xe=ae,Be||Ve||Ye?Je(Q)?xe=Q:Gr(Q)?xe=Ot(Q):Ve?(Ce=!1,xe=Cb(ae,!0)):Ye?(Ce=!1,xe=Sb(ae,!0)):xe=[]:Ao(ae)||Ha(ae)?(xe=Q,Ha(Q)?xe=x1(Q):(!qr(Q)||Vn(Q))&&(xe=Gb(ae))):Ce=!1}Ce&&(K.set(ae,xe),B(xe,ae,T,q,K),K.delete(ae)),gf(f,y,xe)}function vb(f,d){var y=f.length;if(y)return d+=d<0?y:0,$n(d,y)?f[d]:t}function hb(f,d,y){d.length?d=Or(d,function(q){return Je(q)?function(K){return Ga(K,q.length===1?q[0]:q)}:q}):d=[Lt];var T=-1;d=Or(d,Gt(Ke()));var B=fb(f,function(q,K,Q){var ae=Or(d,function(we){return we(q)});return{criteria:ae,index:++T,value:q}});return yD(B,function(q,K){return nB(q,K,y)})}function UI(f,d){return gb(f,d,function(y,T){return Xf(f,T)})}function gb(f,d,y){for(var T=-1,B=d.length,q={};++T<B;){var K=d[T],Q=Ga(f,K);y(Q,K)&&Co(q,la(K,f),Q)}return q}function HI(f){return function(d){return Ga(d,f)}}function Cf(f,d,y,T){var B=T?pD:xi,q=-1,K=d.length,Q=f;for(f===d&&(d=Ot(d)),y&&(Q=Or(f,Gt(y)));++q<K;)for(var ae=0,we=d[q],xe=y?y(we):we;(ae=B(Q,xe,ae,T))>-1;)Q!==f&&Ns.call(Q,ae,1),Ns.call(f,ae,1);return f}function pb(f,d){for(var y=f?d.length:0,T=y-1;y--;){var B=d[y];if(y==T||B!==q){var q=B;$n(B)?Ns.call(f,B,1):Af(f,B)}}return f}function Sf(f,d){return f+$s(Z0()*(d-f+1))}function KI(f,d,y,T){for(var B=-1,q=Xr(zs((d-f)/(y||1)),0),K=ce(q);q--;)K[T?q:++B]=f,f+=y;return K}function Tf(f,d){var y="";if(!f||d<1||d>U)return y;do d%2&&(y+=f),d=$s(d/2),d&&(f+=f);while(d);return y}function sr(f,d){return Gf(Hb(f,d,Lt),f+"")}function jI(f){return J0(Oi(f))}function YI(f,d){var y=Oi(f);return au(y,Va(d,0,y.length))}function Co(f,d,y,T){if(!qr(f))return f;d=la(d,f);for(var B=-1,q=d.length,K=q-1,Q=f;Q!=null&&++B<q;){var ae=Sn(d[B]),we=y;if(ae==="__proto__"||ae==="constructor"||ae==="prototype")return f;if(B!=K){var xe=Q[ae];we=T?T(xe,ae,Q):t,we===t&&(we=qr(xe)?xe:$n(d[B+1])?[]:{})}wo(Q,ae,we),Q=Q[ae]}return f}var yb=Vs?function(f,d){return Vs.set(f,d),f}:Lt,ZI=Fs?function(f,d){return Fs(f,"toString",{configurable:!0,enumerable:!1,value:Jf(d),writable:!0})}:Lt;function XI(f){return au(Oi(f))}function rn(f,d,y){var T=-1,B=f.length;d<0&&(d=-d>B?0:B+d),y=y>B?B:y,y<0&&(y+=B),B=d>y?0:y-d>>>0,d>>>=0;for(var q=ce(B);++T<B;)q[T]=f[T+d];return q}function QI(f,d){var y;return sa(f,function(T,B,q){return y=d(T,B,q),!y}),!!y}function Ys(f,d,y){var T=0,B=f==null?T:f.length;if(typeof d=="number"&&d===d&&B<=ne){for(;T<B;){var q=T+B>>>1,K=f[q];K!==null&&!Ut(K)&&(y?K<=d:K<d)?T=q+1:B=q}return B}return Rf(f,d,Lt,y)}function Rf(f,d,y,T){var B=0,q=f==null?0:f.length;if(q===0)return 0;d=y(d);for(var K=d!==d,Q=d===null,ae=Ut(d),we=d===t;B<q;){var xe=$s((B+q)/2),Ce=y(f[xe]),Be=Ce!==t,Ve=Ce===null,Ye=Ce===Ce,ar=Ut(Ce);if(K)var Ze=T||Ye;else we?Ze=Ye&&(T||Be):Q?Ze=Ye&&Be&&(T||!Ve):ae?Ze=Ye&&Be&&!Ve&&(T||!ar):Ve||ar?Ze=!1:Ze=T?Ce<=d:Ce<d;Ze?B=xe+1:q=xe}return yt(q,Z)}function mb(f,d){for(var y=-1,T=f.length,B=0,q=[];++y<T;){var K=f[y],Q=d?d(K):K;if(!y||!gn(Q,ae)){var ae=Q;q[B++]=K===0?0:K}}return q}function bb(f){return typeof f=="number"?f:Ut(f)?W:+f}function Wt(f){if(typeof f=="string")return f;if(Je(f))return Or(f,Wt)+"";if(Ut(f))return X0?X0.call(f):"";var d=f+"";return d=="0"&&1/f==-G?"-0":d}function ua(f,d,y){var T=-1,B=As,q=f.length,K=!0,Q=[],ae=Q;if(y)K=!1,B=rf;else if(q>=a){var we=d?null:lB(f);if(we)return Ds(we);K=!1,B=ho,ae=new $a}else ae=d?[]:Q;e:for(;++T<q;){var xe=f[T],Ce=d?d(xe):xe;if(xe=y||xe!==0?xe:0,K&&Ce===Ce){for(var Be=ae.length;Be--;)if(ae[Be]===Ce)continue e;d&&ae.push(Ce),Q.push(xe)}else B(ae,Ce,y)||(ae!==Q&&ae.push(Ce),Q.push(xe))}return Q}function Af(f,d){d=la(d,f);var y=-1,T=d.length;if(!T)return!0;for(var B=f==null||typeof f!="object"&&typeof f!="function";++y<T;){var q=d[y];if(typeof q=="string"){if(q==="__proto__"&&!br.call(f,"__proto__"))return!1;if(q==="constructor"&&y+1<T&&typeof d[y+1]=="string"&&d[y+1]==="prototype"){if(B&&y===0)continue;return!1}}}var K=Kb(f,d);return K==null||delete K[Sn(tn(d))]}function wb(f,d,y,T){return Co(f,d,y(Ga(f,d)),T)}function Zs(f,d,y,T){for(var B=f.length,q=T?B:-1;(T?q--:++q<B)&&d(f[q],q,f););return y?rn(f,T?0:q,T?q+1:B):rn(f,T?q+1:0,T?B:q)}function xb(f,d){var y=f;return y instanceof dr&&(y=y.value()),tf(d,function(T,B){return B.func.apply(B.thisArg,aa([T],B.args))},y)}function Pf(f,d,y){var T=f.length;if(T<2)return T?ua(f[0]):[];for(var B=-1,q=ce(T);++B<T;)for(var K=f[B],Q=-1;++Q<T;)Q!=B&&(q[B]=xo(q[B]||K,f[Q],d,y));return ua(ft(q,1),d,y)}function Eb(f,d,y){for(var T=-1,B=f.length,q=d.length,K={};++T<B;){var Q=T<q?d[T]:t;y(K,f[T],Q)}return K}function Df(f){return Gr(f)?f:[]}function If(f){return typeof f=="function"?f:Lt}function la(f,d){return Je(f)?f:zf(f,d)?[f]:Xb(wr(f))}var JI=sr;function fa(f,d,y){var T=f.length;return y=y===t?T:y,!d&&y>=T?f:rn(f,d,y)}var _b=zD||function(f){return lt.clearTimeout(f)};function Cb(f,d){if(d)return f.slice();var y=f.length,T=U0?U0(y):new f.constructor(y);return f.copy(T),T}function Bf(f){var d=new f.constructor(f.byteLength);return new Ls(d).set(new Ls(f)),d}function eB(f,d){var y=d?Bf(f.buffer):f.buffer;return new f.constructor(y,f.byteOffset,f.byteLength)}function rB(f){var d=new f.constructor(f.source,ut.exec(f));return d.lastIndex=f.lastIndex,d}function tB(f){return bo?Cr(bo.call(f)):{}}function Sb(f,d){var y=d?Bf(f.buffer):f.buffer;return new f.constructor(y,f.byteOffset,f.length)}function Tb(f,d){if(f!==d){var y=f!==t,T=f===null,B=f===f,q=Ut(f),K=d!==t,Q=d===null,ae=d===d,we=Ut(d);if(!Q&&!we&&!q&&f>d||q&&K&&ae&&!Q&&!we||T&&K&&ae||!y&&ae||!B)return 1;if(!T&&!q&&!we&&f<d||we&&y&&B&&!T&&!q||Q&&y&&B||!K&&B||!ae)return-1}return 0}function nB(f,d,y){for(var T=-1,B=f.criteria,q=d.criteria,K=B.length,Q=y.length;++T<K;){var ae=Tb(B[T],q[T]);if(ae){if(T>=Q)return ae;var we=y[T];return ae*(we=="desc"?-1:1)}}return f.index-d.index}function Rb(f,d,y,T){for(var B=-1,q=f.length,K=y.length,Q=-1,ae=d.length,we=Xr(q-K,0),xe=ce(ae+we),Ce=!T;++Q<ae;)xe[Q]=d[Q];for(;++B<K;)(Ce||B<q)&&(xe[y[B]]=f[B]);for(;we--;)xe[Q++]=f[B++];return xe}function Ab(f,d,y,T){for(var B=-1,q=f.length,K=-1,Q=y.length,ae=-1,we=d.length,xe=Xr(q-Q,0),Ce=ce(xe+we),Be=!T;++B<xe;)Ce[B]=f[B];for(var Ve=B;++ae<we;)Ce[Ve+ae]=d[ae];for(;++K<Q;)(Be||B<q)&&(Ce[Ve+y[K]]=f[B++]);return Ce}function Ot(f,d){var y=-1,T=f.length;for(d||(d=ce(T));++y<T;)d[y]=f[y];return d}function Cn(f,d,y,T){var B=!y;y||(y={});for(var q=-1,K=d.length;++q<K;){var Q=d[q],ae=T?T(y[Q],f[Q],Q,y,f):t;ae===t&&(ae=f[Q]),B?Nn(y,Q,ae):wo(y,Q,ae)}return y}function aB(f,d){return Cn(f,Ff(f),d)}function iB(f,d){return Cn(f,$b(f),d)}function Xs(f,d){return function(y,T){var B=Je(y)?fD:RI,q=d?d():{};return B(y,f,Ke(T,2),q)}}function Pi(f){return sr(function(d,y){var T=-1,B=y.length,q=B>1?y[B-1]:t,K=B>2?y[2]:t;for(q=f.length>3&&typeof q=="function"?(B--,q):t,K&&Tt(y[0],y[1],K)&&(q=B<3?t:q,B=1),d=Cr(d);++T<B;){var Q=y[T];Q&&f(d,Q,T,q)}return d})}function Pb(f,d){return function(y,T){if(y==null)return y;if(!Mt(y))return f(y,T);for(var B=y.length,q=d?B:-1,K=Cr(y);(d?q--:++q<B)&&T(K[q],q,K)!==!1;);return y}}function Db(f){return function(d,y,T){for(var B=-1,q=Cr(d),K=T(d),Q=K.length;Q--;){var ae=K[f?Q:++B];if(y(q[ae],ae,q)===!1)break}return d}}function oB(f,d,y){var T=d&m,B=So(f);function q(){var K=this&&this!==lt&&this instanceof q?B:f;return K.apply(T?y:this,arguments)}return q}function Ib(f){return function(d){d=wr(d);var y=Ei(d)?vn(d):t,T=y?y[0]:d.charAt(0),B=y?fa(y,1).join(""):d.slice(1);return T[f]()+B}}function Di(f){return function(d){return tf(P1(A1(d).replace(ZP,"")),f,"")}}function So(f){return function(){var d=arguments;switch(d.length){case 0:return new f;case 1:return new f(d[0]);case 2:return new f(d[0],d[1]);case 3:return new f(d[0],d[1],d[2]);case 4:return new f(d[0],d[1],d[2],d[3]);case 5:return new f(d[0],d[1],d[2],d[3],d[4]);case 6:return new f(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new f(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var y=Ai(f.prototype),T=f.apply(y,d);return qr(T)?T:y}}function sB(f,d,y){var T=So(f);function B(){for(var q=arguments.length,K=ce(q),Q=q,ae=Ii(B);Q--;)K[Q]=arguments[Q];var we=q<3&&K[0]!==ae&&K[q-1]!==ae?[]:ia(K,ae);if(q-=we.length,q<y)return Lb(f,d,Qs,B.placeholder,t,K,we,t,t,y-q);var xe=this&&this!==lt&&this instanceof B?T:f;return Vt(xe,this,K)}return B}function Bb(f){return function(d,y,T){var B=Cr(d);if(!Mt(d)){var q=Ke(y,3);d=nt(d),y=function(Q){return q(B[Q],Q,B)}}var K=f(d,y,T);return K>-1?B[q?d[K]:K]:t}}function Ob(f){return zn(function(d){var y=d.length,T=y,B=Jt.prototype.thru;for(f&&d.reverse();T--;){var q=d[T];if(typeof q!="function")throw new Qt(o);if(B&&!K&&tu(q)=="wrapper")var K=new Jt([],!0)}for(T=K?T:y;++T<y;){q=d[T];var Q=tu(q),ae=Q=="wrapper"?qf(q):t;ae&&$f(ae[0])&&ae[1]==(S|x|C|A)&&!ae[4].length&&ae[9]==1?K=K[tu(ae[0])].apply(K,ae[3]):K=q.length==1&&$f(q)?K[Q]():K.thru(q)}return function(){var we=arguments,xe=we[0];if(K&&we.length==1&&Je(xe))return K.plant(xe).value();for(var Ce=0,Be=y?d[Ce].apply(this,we):xe;++Ce<y;)Be=d[Ce].call(this,Be);return Be}})}function Qs(f,d,y,T,B,q,K,Q,ae,we){var xe=d&S,Ce=d&m,Be=d&b,Ve=d&(x|_),Ye=d&P,ar=Be?t:So(f);function Ze(){for(var cr=arguments.length,vr=ce(cr),Ht=cr;Ht--;)vr[Ht]=arguments[Ht];if(Ve)var Rt=Ii(Ze),Kt=bD(vr,Rt);if(T&&(vr=Rb(vr,T,B,Ve)),q&&(vr=Ab(vr,q,K,Ve)),cr-=Kt,Ve&&cr<we){var Wr=ia(vr,Rt);return Lb(f,d,Qs,Ze.placeholder,y,vr,Wr,Q,ae,we-cr)}var pn=Ce?y:this,Wn=Be?pn[f]:f;return cr=vr.length,Q?vr=RB(vr,Q):Ye&&cr>1&&vr.reverse(),xe&&ae<cr&&(vr.length=ae),this&&this!==lt&&this instanceof Ze&&(Wn=ar||So(Wn)),Wn.apply(pn,vr)}return Ze}function Mb(f,d){return function(y,T){return kI(y,f,d(T),{})}}function Js(f,d){return function(y,T){var B;if(y===t&&T===t)return d;if(y!==t&&(B=y),T!==t){if(B===t)return T;typeof y=="string"||typeof T=="string"?(y=Wt(y),T=Wt(T)):(y=bb(y),T=bb(T)),B=f(y,T)}return B}}function Of(f){return zn(function(d){return d=Or(d,Gt(Ke())),sr(function(y){var T=this;return f(d,function(B){return Vt(B,T,y)})})})}function eu(f,d){d=d===t?" ":Wt(d);var y=d.length;if(y<2)return y?Tf(d,f):d;var T=Tf(d,zs(f/_i(d)));return Ei(d)?fa(vn(T),0,f).join(""):T.slice(0,f)}function uB(f,d,y,T){var B=d&m,q=So(f);function K(){for(var Q=-1,ae=arguments.length,we=-1,xe=T.length,Ce=ce(xe+ae),Be=this&&this!==lt&&this instanceof K?q:f;++we<xe;)Ce[we]=T[we];for(;ae--;)Ce[we++]=arguments[++Q];return Vt(Be,B?y:this,Ce)}return K}function kb(f){return function(d,y,T){return T&&typeof T!="number"&&Tt(d,y,T)&&(y=T=t),d=Gn(d),y===t?(y=d,d=0):y=Gn(y),T=T===t?d<y?1:-1:Gn(T),KI(d,y,T,f)}}function ru(f){return function(d,y){return typeof d=="string"&&typeof y=="string"||(d=nn(d),y=nn(y)),f(d,y)}}function Lb(f,d,y,T,B,q,K,Q,ae,we){var xe=d&x,Ce=xe?K:t,Be=xe?t:K,Ve=xe?q:t,Ye=xe?t:q;d|=xe?C:R,d&=~(xe?R:C),d&w||(d&=-4);var ar=[f,d,B,Ve,Ce,Ye,Be,Q,ae,we],Ze=y.apply(t,ar);return $f(f)&&jb(Ze,ar),Ze.placeholder=T,Yb(Ze,f,d)}function Mf(f){var d=Zr[f];return function(y,T){if(y=nn(y),T=T==null?0:yt(tr(T),292),T&&Y0(y)){var B=(wr(y)+"e").split("e"),q=d(B[0]+"e"+(+B[1]+T));return B=(wr(q)+"e").split("e"),+(B[0]+"e"+(+B[1]-T))}return d(y)}}var lB=Ti&&1/Ds(new Ti([,-0]))[1]==G?function(f){return new Ti(f)}:tc;function qb(f){return function(d){var y=mt(d);return y==he?ff(d):y==Pe?TD(d):mD(d,f(d))}}function Fn(f,d,y,T,B,q,K,Q){var ae=d&b;if(!ae&&typeof f!="function")throw new Qt(o);var we=T?T.length:0;if(we||(d&=-97,T=B=t),K=K===t?K:Xr(tr(K),0),Q=Q===t?Q:tr(Q),we-=B?B.length:0,d&R){var xe=T,Ce=B;T=B=t}var Be=ae?t:qf(f),Ve=[f,d,y,T,B,xe,Ce,q,K,Q];if(Be&&CB(Ve,Be),f=Ve[0],d=Ve[1],y=Ve[2],T=Ve[3],B=Ve[4],Q=Ve[9]=Ve[9]===t?ae?0:f.length:Xr(Ve[9]-we,0),!Q&&d&(x|_)&&(d&=-25),!d||d==m)var Ye=oB(f,d,y);else d==x||d==_?Ye=sB(f,d,Q):(d==C||d==(m|C))&&!B.length?Ye=uB(f,d,y,T):Ye=Qs.apply(t,Ve);var ar=Be?yb:jb;return Yb(ar(Ye,Ve),f,d)}function Nb(f,d,y,T){return f===t||gn(f,Si[y])&&!br.call(T,y)?d:f}function Fb(f,d,y,T,B,q){return qr(f)&&qr(d)&&(q.set(d,f),js(f,d,t,Fb,q),q.delete(d)),f}function fB(f){return Ao(f)?t:f}function zb(f,d,y,T,B,q){var K=y&p,Q=f.length,ae=d.length;if(Q!=ae&&!(K&&ae>Q))return!1;var we=q.get(f),xe=q.get(d);if(we&&xe)return we==d&&xe==f;var Ce=-1,Be=!0,Ve=y&E?new $a:t;for(q.set(f,d),q.set(d,f);++Ce<Q;){var Ye=f[Ce],ar=d[Ce];if(T)var Ze=K?T(ar,Ye,Ce,d,f,q):T(Ye,ar,Ce,f,d,q);if(Ze!==t){if(Ze)continue;Be=!1;break}if(Ve){if(!nf(d,function(cr,vr){if(!ho(Ve,vr)&&(Ye===cr||B(Ye,cr,y,T,q)))return Ve.push(vr)})){Be=!1;break}}else if(!(Ye===ar||B(Ye,ar,y,T,q))){Be=!1;break}}return q.delete(f),q.delete(d),Be}function cB(f,d,y,T,B,q,K){switch(y){case Xe:if(f.byteLength!=d.byteLength||f.byteOffset!=d.byteOffset)return!1;f=f.buffer,d=d.buffer;case ir:return!(f.byteLength!=d.byteLength||!q(new Ls(f),new Ls(d)));case ie:case oe:case be:return gn(+f,+d);case X:return f.name==d.name&&f.message==d.message;case Te:case Ie:return f==d+"";case he:var Q=ff;case Pe:var ae=T&p;if(Q||(Q=Ds),f.size!=d.size&&!ae)return!1;var we=K.get(f);if(we)return we==d;T|=E,K.set(f,d);var xe=zb(Q(f),Q(d),T,B,q,K);return K.delete(f),xe;case Le:if(bo)return bo.call(f)==bo.call(d)}return!1}function dB(f,d,y,T,B,q){var K=y&p,Q=kf(f),ae=Q.length,we=kf(d),xe=we.length;if(ae!=xe&&!K)return!1;for(var Ce=ae;Ce--;){var Be=Q[Ce];if(!(K?Be in d:br.call(d,Be)))return!1}var Ve=q.get(f),Ye=q.get(d);if(Ve&&Ye)return Ve==d&&Ye==f;var ar=!0;q.set(f,d),q.set(d,f);for(var Ze=K;++Ce<ae;){Be=Q[Ce];var cr=f[Be],vr=d[Be];if(T)var Ht=K?T(vr,cr,Be,d,f,q):T(cr,vr,Be,f,d,q);if(!(Ht===t?cr===vr||B(cr,vr,y,T,q):Ht)){ar=!1;break}Ze||(Ze=Be=="constructor")}if(ar&&!Ze){var Rt=f.constructor,Kt=d.constructor;Rt!=Kt&&"constructor"in f&&"constructor"in d&&!(typeof Rt=="function"&&Rt instanceof Rt&&typeof Kt=="function"&&Kt instanceof Kt)&&(ar=!1)}return q.delete(f),q.delete(d),ar}function zn(f){return Gf(Hb(f,t,r1),f+"")}function kf(f){return ob(f,nt,Ff)}function Lf(f){return ob(f,kt,$b)}var qf=Vs?function(f){return Vs.get(f)}:tc;function tu(f){for(var d=f.name+"",y=Ri[d],T=br.call(Ri,d)?y.length:0;T--;){var B=y[T],q=B.func;if(q==null||q==f)return B.name}return d}function Ii(f){var d=br.call(k,"placeholder")?k:f;return d.placeholder}function Ke(){var f=k.iteratee||ec;return f=f===ec?lb:f,arguments.length?f(arguments[0],arguments[1]):f}function nu(f,d){var y=f.__data__;return wB(d)?y[typeof d=="string"?"string":"hash"]:y.map}function Nf(f){for(var d=nt(f),y=d.length;y--;){var T=d[y],B=f[T];d[y]=[T,B,Wb(B)]}return d}function Wa(f,d){var y=_D(f,d);return ub(y)?y:t}function vB(f){var d=br.call(f,Fa),y=f[Fa];try{f[Fa]=t;var T=!0}catch{}var B=Ms.call(f);return T&&(d?f[Fa]=y:delete f[Fa]),B}var Ff=df?function(f){return f==null?[]:(f=Cr(f),na(df(f),function(d){return K0.call(f,d)}))}:nc,$b=df?function(f){for(var d=[];f;)aa(d,Ff(f)),f=qs(f);return d}:nc,mt=St;(vf&&mt(new vf(new ArrayBuffer(1)))!=Xe||po&&mt(new po)!=he||hf&&mt(hf.resolve())!=Se||Ti&&mt(new Ti)!=Pe||yo&&mt(new yo)!=je)&&(mt=function(f){var d=St(f),y=d==ue?f.constructor:t,T=y?Ua(y):"";if(T)switch(T){case YD:return Xe;case ZD:return he;case XD:return Se;case QD:return Pe;case JD:return je}return d});function hB(f,d,y){for(var T=-1,B=y.length;++T<B;){var q=y[T],K=q.size;switch(q.type){case"drop":f+=K;break;case"dropRight":d-=K;break;case"take":d=yt(d,f+K);break;case"takeRight":f=Xr(f,d-K);break}}return{start:f,end:d}}function gB(f){var d=f.match(Fr);return d?d[1].split(cn):[]}function Vb(f,d,y){d=la(d,f);for(var T=-1,B=d.length,q=!1;++T<B;){var K=Sn(d[T]);if(!(q=f!=null&&y(f,K)))break;f=f[K]}return q||++T!=B?q:(B=f==null?0:f.length,!!B&&fu(B)&&$n(K,B)&&(Je(f)||Ha(f)))}function pB(f){var d=f.length,y=new f.constructor(d);return d&&typeof f[0]=="string"&&br.call(f,"index")&&(y.index=f.index,y.input=f.input),y}function Gb(f){return typeof f.constructor=="function"&&!To(f)?Ai(qs(f)):{}}function yB(f,d,y){var T=f.constructor;switch(d){case ir:return Bf(f);case ie:case oe:return new T(+f);case Xe:return eB(f,y);case fr:case Ue:case Oe:case ge:case L:case se:case de:case ve:case ye:return Sb(f,y);case he:return new T;case be:case Ie:return new T(f);case Te:return rB(f);case Pe:return new T;case Le:return tB(f)}}function mB(f,d){var y=d.length;if(!y)return f;var T=y-1;return d[T]=(y>1?"& ":"")+d[T],d=d.join(y>2?", ":" "),f.replace(En,`{
|
|
339
|
+
/* [wrapped with `+d+`] */
|
|
340
|
+
`)}function bB(f){return Je(f)||Ha(f)||!!(j0&&f&&f[j0])}function $n(f,d){var y=typeof f;return d=d??U,!!d&&(y=="number"||y!="symbol"&&Ss.test(f))&&f>-1&&f%1==0&&f<d}function Tt(f,d,y){if(!qr(y))return!1;var T=typeof d;return(T=="number"?Mt(y)&&$n(d,y.length):T=="string"&&d in y)?gn(y[d],f):!1}function zf(f,d){if(Je(f))return!1;var y=typeof f;return y=="number"||y=="symbol"||y=="boolean"||f==null||Ut(f)?!0:Ir.test(f)||!Vr.test(f)||d!=null&&f in Cr(d)}function wB(f){var d=typeof f;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?f!=="__proto__":f===null}function $f(f){var d=tu(f),y=k[d];if(typeof y!="function"||!(d in dr.prototype))return!1;if(f===y)return!0;var T=qf(y);return!!T&&f===T[0]}function xB(f){return!!W0&&W0 in f}var EB=Bs?Vn:ac;function To(f){var d=f&&f.constructor,y=typeof d=="function"&&d.prototype||Si;return f===y}function Wb(f){return f===f&&!qr(f)}function Ub(f,d){return function(y){return y==null?!1:y[f]===d&&(d!==t||f in Cr(y))}}function _B(f){var d=uu(f,function(T){return y.size===l&&y.clear(),T}),y=d.cache;return d}function CB(f,d){var y=f[1],T=d[1],B=y|T,q=B<(m|b|S),K=T==S&&y==x||T==S&&y==A&&f[7].length<=d[8]||T==(S|A)&&d[7].length<=d[8]&&y==x;if(!(q||K))return f;T&m&&(f[2]=d[2],B|=y&m?0:w);var Q=d[3];if(Q){var ae=f[3];f[3]=ae?Rb(ae,Q,d[4]):Q,f[4]=ae?ia(f[3],c):d[4]}return Q=d[5],Q&&(ae=f[5],f[5]=ae?Ab(ae,Q,d[6]):Q,f[6]=ae?ia(f[5],c):d[6]),Q=d[7],Q&&(f[7]=Q),T&S&&(f[8]=f[8]==null?d[8]:yt(f[8],d[8])),f[9]==null&&(f[9]=d[9]),f[0]=d[0],f[1]=B,f}function SB(f){var d=[];if(f!=null)for(var y in Cr(f))d.push(y);return d}function TB(f){return Ms.call(f)}function Hb(f,d,y){return d=Xr(d===t?f.length-1:d,0),function(){for(var T=arguments,B=-1,q=Xr(T.length-d,0),K=ce(q);++B<q;)K[B]=T[d+B];B=-1;for(var Q=ce(d+1);++B<d;)Q[B]=T[B];return Q[d]=y(K),Vt(f,this,Q)}}function Kb(f,d){return d.length<2?f:Ga(f,rn(d,0,-1))}function RB(f,d){for(var y=f.length,T=yt(d.length,y),B=Ot(f);T--;){var q=d[T];f[T]=$n(q,y)?B[q]:t}return f}function Vf(f,d){if(!(d==="constructor"&&typeof f[d]=="function")&&d!="__proto__")return f[d]}var jb=Zb(yb),Ro=VD||function(f,d){return lt.setTimeout(f,d)},Gf=Zb(ZI);function Yb(f,d,y){var T=d+"";return Gf(f,mB(T,AB(gB(T),y)))}function Zb(f){var d=0,y=0;return function(){var T=HD(),B=O-(T-y);if(y=T,B>0){if(++d>=M)return arguments[0]}else d=0;return f.apply(t,arguments)}}function au(f,d){var y=-1,T=f.length,B=T-1;for(d=d===t?T:d;++y<d;){var q=Sf(y,B),K=f[q];f[q]=f[y],f[y]=K}return f.length=d,f}var Xb=_B(function(f){var d=[];return f.charCodeAt(0)===46&&d.push(""),f.replace(st,function(y,T,B,q){d.push(B?q.replace(hi,"$1"):T||y)}),d});function Sn(f){if(typeof f=="string"||Ut(f))return f;var d=f+"";return d=="0"&&1/f==-G?"-0":d}function Ua(f){if(f!=null){try{return Os.call(f)}catch{}try{return f+""}catch{}}return""}function AB(f,d){return Xt(F,function(y){var T="_."+y[0];d&y[1]&&!As(f,T)&&f.push(T)}),f.sort()}function Qb(f){if(f instanceof dr)return f.clone();var d=new Jt(f.__wrapped__,f.__chain__);return d.__actions__=Ot(f.__actions__),d.__index__=f.__index__,d.__values__=f.__values__,d}function PB(f,d,y){(y?Tt(f,d,y):d===t)?d=1:d=Xr(tr(d),0);var T=f==null?0:f.length;if(!T||d<1)return[];for(var B=0,q=0,K=ce(zs(T/d));B<T;)K[q++]=rn(f,B,B+=d);return K}function DB(f){for(var d=-1,y=f==null?0:f.length,T=0,B=[];++d<y;){var q=f[d];q&&(B[T++]=q)}return B}function IB(){var f=arguments.length;if(!f)return[];for(var d=ce(f-1),y=arguments[0],T=f;T--;)d[T-1]=arguments[T];return aa(Je(y)?Ot(y):[y],ft(d,1))}var BB=sr(function(f,d){return Gr(f)?xo(f,ft(d,1,Gr,!0)):[]}),OB=sr(function(f,d){var y=tn(d);return Gr(y)&&(y=t),Gr(f)?xo(f,ft(d,1,Gr,!0),Ke(y,2)):[]}),MB=sr(function(f,d){var y=tn(d);return Gr(y)&&(y=t),Gr(f)?xo(f,ft(d,1,Gr,!0),t,y):[]});function kB(f,d,y){var T=f==null?0:f.length;return T?(d=y||d===t?1:tr(d),rn(f,d<0?0:d,T)):[]}function LB(f,d,y){var T=f==null?0:f.length;return T?(d=y||d===t?1:tr(d),d=T-d,rn(f,0,d<0?0:d)):[]}function qB(f,d){return f&&f.length?Zs(f,Ke(d,3),!0,!0):[]}function NB(f,d){return f&&f.length?Zs(f,Ke(d,3),!0):[]}function FB(f,d,y,T){var B=f==null?0:f.length;return B?(y&&typeof y!="number"&&Tt(f,d,y)&&(y=0,T=B),II(f,d,y,T)):[]}function Jb(f,d,y){var T=f==null?0:f.length;if(!T)return-1;var B=y==null?0:tr(y);return B<0&&(B=Xr(T+B,0)),Ps(f,Ke(d,3),B)}function e1(f,d,y){var T=f==null?0:f.length;if(!T)return-1;var B=T-1;return y!==t&&(B=tr(y),B=y<0?Xr(T+B,0):yt(B,T-1)),Ps(f,Ke(d,3),B,!0)}function r1(f){var d=f==null?0:f.length;return d?ft(f,1):[]}function zB(f){var d=f==null?0:f.length;return d?ft(f,G):[]}function $B(f,d){var y=f==null?0:f.length;return y?(d=d===t?1:tr(d),ft(f,d)):[]}function VB(f){for(var d=-1,y=f==null?0:f.length,T={};++d<y;){var B=f[d];T[B[0]]=B[1]}return T}function t1(f){return f&&f.length?f[0]:t}function GB(f,d,y){var T=f==null?0:f.length;if(!T)return-1;var B=y==null?0:tr(y);return B<0&&(B=Xr(T+B,0)),xi(f,d,B)}function WB(f){var d=f==null?0:f.length;return d?rn(f,0,-1):[]}var UB=sr(function(f){var d=Or(f,Df);return d.length&&d[0]===f[0]?wf(d):[]}),HB=sr(function(f){var d=tn(f),y=Or(f,Df);return d===tn(y)?d=t:y.pop(),y.length&&y[0]===f[0]?wf(y,Ke(d,2)):[]}),KB=sr(function(f){var d=tn(f),y=Or(f,Df);return d=typeof d=="function"?d:t,d&&y.pop(),y.length&&y[0]===f[0]?wf(y,t,d):[]});function jB(f,d){return f==null?"":WD.call(f,d)}function tn(f){var d=f==null?0:f.length;return d?f[d-1]:t}function YB(f,d,y){var T=f==null?0:f.length;if(!T)return-1;var B=T;return y!==t&&(B=tr(y),B=B<0?Xr(T+B,0):yt(B,T-1)),d===d?AD(f,d,B):Ps(f,L0,B,!0)}function ZB(f,d){return f&&f.length?vb(f,tr(d)):t}var XB=sr(n1);function n1(f,d){return f&&f.length&&d&&d.length?Cf(f,d):f}function QB(f,d,y){return f&&f.length&&d&&d.length?Cf(f,d,Ke(y,2)):f}function JB(f,d,y){return f&&f.length&&d&&d.length?Cf(f,d,t,y):f}var eO=zn(function(f,d){var y=f==null?0:f.length,T=pf(f,d);return pb(f,Or(d,function(B){return $n(B,y)?+B:B}).sort(Tb)),T});function rO(f,d){var y=[];if(!(f&&f.length))return y;var T=-1,B=[],q=f.length;for(d=Ke(d,3);++T<q;){var K=f[T];d(K,T,f)&&(y.push(K),B.push(T))}return pb(f,B),y}function Wf(f){return f==null?f:jD.call(f)}function tO(f,d,y){var T=f==null?0:f.length;return T?(y&&typeof y!="number"&&Tt(f,d,y)?(d=0,y=T):(d=d==null?0:tr(d),y=y===t?T:tr(y)),rn(f,d,y)):[]}function nO(f,d){return Ys(f,d)}function aO(f,d,y){return Rf(f,d,Ke(y,2))}function iO(f,d){var y=f==null?0:f.length;if(y){var T=Ys(f,d);if(T<y&&gn(f[T],d))return T}return-1}function oO(f,d){return Ys(f,d,!0)}function sO(f,d,y){return Rf(f,d,Ke(y,2),!0)}function uO(f,d){var y=f==null?0:f.length;if(y){var T=Ys(f,d,!0)-1;if(gn(f[T],d))return T}return-1}function lO(f){return f&&f.length?mb(f):[]}function fO(f,d){return f&&f.length?mb(f,Ke(d,2)):[]}function cO(f){var d=f==null?0:f.length;return d?rn(f,1,d):[]}function dO(f,d,y){return f&&f.length?(d=y||d===t?1:tr(d),rn(f,0,d<0?0:d)):[]}function vO(f,d,y){var T=f==null?0:f.length;return T?(d=y||d===t?1:tr(d),d=T-d,rn(f,d<0?0:d,T)):[]}function hO(f,d){return f&&f.length?Zs(f,Ke(d,3),!1,!0):[]}function gO(f,d){return f&&f.length?Zs(f,Ke(d,3)):[]}var pO=sr(function(f){return ua(ft(f,1,Gr,!0))}),yO=sr(function(f){var d=tn(f);return Gr(d)&&(d=t),ua(ft(f,1,Gr,!0),Ke(d,2))}),mO=sr(function(f){var d=tn(f);return d=typeof d=="function"?d:t,ua(ft(f,1,Gr,!0),t,d)});function bO(f){return f&&f.length?ua(f):[]}function wO(f,d){return f&&f.length?ua(f,Ke(d,2)):[]}function xO(f,d){return d=typeof d=="function"?d:t,f&&f.length?ua(f,t,d):[]}function Uf(f){if(!(f&&f.length))return[];var d=0;return f=na(f,function(y){if(Gr(y))return d=Xr(y.length,d),!0}),uf(d,function(y){return Or(f,af(y))})}function a1(f,d){if(!(f&&f.length))return[];var y=Uf(f);return d==null?y:Or(y,function(T){return Vt(d,t,T)})}var EO=sr(function(f,d){return Gr(f)?xo(f,d):[]}),_O=sr(function(f){return Pf(na(f,Gr))}),CO=sr(function(f){var d=tn(f);return Gr(d)&&(d=t),Pf(na(f,Gr),Ke(d,2))}),SO=sr(function(f){var d=tn(f);return d=typeof d=="function"?d:t,Pf(na(f,Gr),t,d)}),TO=sr(Uf);function RO(f,d){return Eb(f||[],d||[],wo)}function AO(f,d){return Eb(f||[],d||[],Co)}var PO=sr(function(f){var d=f.length,y=d>1?f[d-1]:t;return y=typeof y=="function"?(f.pop(),y):t,a1(f,y)});function i1(f){var d=k(f);return d.__chain__=!0,d}function DO(f,d){return d(f),f}function iu(f,d){return d(f)}var IO=zn(function(f){var d=f.length,y=d?f[0]:0,T=this.__wrapped__,B=function(q){return pf(q,f)};return d>1||this.__actions__.length||!(T instanceof dr)||!$n(y)?this.thru(B):(T=T.slice(y,+y+(d?1:0)),T.__actions__.push({func:iu,args:[B],thisArg:t}),new Jt(T,this.__chain__).thru(function(q){return d&&!q.length&&q.push(t),q}))});function BO(){return i1(this)}function OO(){return new Jt(this.value(),this.__chain__)}function MO(){this.__values__===t&&(this.__values__=b1(this.value()));var f=this.__index__>=this.__values__.length,d=f?t:this.__values__[this.__index__++];return{done:f,value:d}}function kO(){return this}function LO(f){for(var d,y=this;y instanceof Ws;){var T=Qb(y);T.__index__=0,T.__values__=t,d?B.__wrapped__=T:d=T;var B=T;y=y.__wrapped__}return B.__wrapped__=f,d}function qO(){var f=this.__wrapped__;if(f instanceof dr){var d=f;return this.__actions__.length&&(d=new dr(this)),d=d.reverse(),d.__actions__.push({func:iu,args:[Wf],thisArg:t}),new Jt(d,this.__chain__)}return this.thru(Wf)}function NO(){return xb(this.__wrapped__,this.__actions__)}var FO=Xs(function(f,d,y){br.call(f,y)?++f[y]:Nn(f,y,1)});function zO(f,d,y){var T=Je(f)?M0:DI;return y&&Tt(f,d,y)&&(d=t),T(f,Ke(d,3))}function $O(f,d){var y=Je(f)?na:ab;return y(f,Ke(d,3))}var VO=Bb(Jb),GO=Bb(e1);function WO(f,d){return ft(ou(f,d),1)}function UO(f,d){return ft(ou(f,d),G)}function HO(f,d,y){return y=y===t?1:tr(y),ft(ou(f,d),y)}function o1(f,d){var y=Je(f)?Xt:sa;return y(f,Ke(d,3))}function s1(f,d){var y=Je(f)?cD:nb;return y(f,Ke(d,3))}var KO=Xs(function(f,d,y){br.call(f,y)?f[y].push(d):Nn(f,y,[d])});function jO(f,d,y,T){f=Mt(f)?f:Oi(f),y=y&&!T?tr(y):0;var B=f.length;return y<0&&(y=Xr(B+y,0)),cu(f)?y<=B&&f.indexOf(d,y)>-1:!!B&&xi(f,d,y)>-1}var YO=sr(function(f,d,y){var T=-1,B=typeof d=="function",q=Mt(f)?ce(f.length):[];return sa(f,function(K){q[++T]=B?Vt(d,K,y):Eo(K,d,y)}),q}),ZO=Xs(function(f,d,y){Nn(f,y,d)});function ou(f,d){var y=Je(f)?Or:fb;return y(f,Ke(d,3))}function XO(f,d,y,T){return f==null?[]:(Je(d)||(d=d==null?[]:[d]),y=T?t:y,Je(y)||(y=y==null?[]:[y]),hb(f,d,y))}var QO=Xs(function(f,d,y){f[y?0:1].push(d)},function(){return[[],[]]});function JO(f,d,y){var T=Je(f)?tf:N0,B=arguments.length<3;return T(f,Ke(d,4),y,B,sa)}function eM(f,d,y){var T=Je(f)?dD:N0,B=arguments.length<3;return T(f,Ke(d,4),y,B,nb)}function rM(f,d){var y=Je(f)?na:ab;return y(f,lu(Ke(d,3)))}function tM(f){var d=Je(f)?J0:jI;return d(f)}function nM(f,d,y){(y?Tt(f,d,y):d===t)?d=1:d=tr(d);var T=Je(f)?SI:YI;return T(f,d)}function aM(f){var d=Je(f)?TI:XI;return d(f)}function iM(f){if(f==null)return 0;if(Mt(f))return cu(f)?_i(f):f.length;var d=mt(f);return d==he||d==Pe?f.size:Ef(f).length}function oM(f,d,y){var T=Je(f)?nf:QI;return y&&Tt(f,d,y)&&(d=t),T(f,Ke(d,3))}var sM=sr(function(f,d){if(f==null)return[];var y=d.length;return y>1&&Tt(f,d[0],d[1])?d=[]:y>2&&Tt(d[0],d[1],d[2])&&(d=[d[0]]),hb(f,ft(d,1),[])}),su=$D||function(){return lt.Date.now()};function uM(f,d){if(typeof d!="function")throw new Qt(o);return f=tr(f),function(){if(--f<1)return d.apply(this,arguments)}}function u1(f,d,y){return d=y?t:d,d=f&&d==null?f.length:d,Fn(f,S,t,t,t,t,d)}function l1(f,d){var y;if(typeof d!="function")throw new Qt(o);return f=tr(f),function(){return--f>0&&(y=d.apply(this,arguments)),f<=1&&(d=t),y}}var Hf=sr(function(f,d,y){var T=m;if(y.length){var B=ia(y,Ii(Hf));T|=C}return Fn(f,T,d,y,B)}),f1=sr(function(f,d,y){var T=m|b;if(y.length){var B=ia(y,Ii(f1));T|=C}return Fn(d,T,f,y,B)});function c1(f,d,y){d=y?t:d;var T=Fn(f,x,t,t,t,t,t,d);return T.placeholder=c1.placeholder,T}function d1(f,d,y){d=y?t:d;var T=Fn(f,_,t,t,t,t,t,d);return T.placeholder=d1.placeholder,T}function v1(f,d,y){var T,B,q,K,Q,ae,we=0,xe=!1,Ce=!1,Be=!0;if(typeof f!="function")throw new Qt(o);d=nn(d)||0,qr(y)&&(xe=!!y.leading,Ce="maxWait"in y,q=Ce?Xr(nn(y.maxWait)||0,d):q,Be="trailing"in y?!!y.trailing:Be);function Ve(Wr){var pn=T,Wn=B;return T=B=t,we=Wr,K=f.apply(Wn,pn),K}function Ye(Wr){return we=Wr,Q=Ro(cr,d),xe?Ve(Wr):K}function ar(Wr){var pn=Wr-ae,Wn=Wr-we,B1=d-pn;return Ce?yt(B1,q-Wn):B1}function Ze(Wr){var pn=Wr-ae,Wn=Wr-we;return ae===t||pn>=d||pn<0||Ce&&Wn>=q}function cr(){var Wr=su();if(Ze(Wr))return vr(Wr);Q=Ro(cr,ar(Wr))}function vr(Wr){return Q=t,Be&&T?Ve(Wr):(T=B=t,K)}function Ht(){Q!==t&&_b(Q),we=0,T=ae=B=Q=t}function Rt(){return Q===t?K:vr(su())}function Kt(){var Wr=su(),pn=Ze(Wr);if(T=arguments,B=this,ae=Wr,pn){if(Q===t)return Ye(ae);if(Ce)return _b(Q),Q=Ro(cr,d),Ve(ae)}return Q===t&&(Q=Ro(cr,d)),K}return Kt.cancel=Ht,Kt.flush=Rt,Kt}var lM=sr(function(f,d){return tb(f,1,d)}),fM=sr(function(f,d,y){return tb(f,nn(d)||0,y)});function cM(f){return Fn(f,P)}function uu(f,d){if(typeof f!="function"||d!=null&&typeof d!="function")throw new Qt(o);var y=function(){var T=arguments,B=d?d.apply(this,T):T[0],q=y.cache;if(q.has(B))return q.get(B);var K=f.apply(this,T);return y.cache=q.set(B,K)||q,K};return y.cache=new(uu.Cache||qn),y}uu.Cache=qn;function lu(f){if(typeof f!="function")throw new Qt(o);return function(){var d=arguments;switch(d.length){case 0:return!f.call(this);case 1:return!f.call(this,d[0]);case 2:return!f.call(this,d[0],d[1]);case 3:return!f.call(this,d[0],d[1],d[2])}return!f.apply(this,d)}}function dM(f){return l1(2,f)}var vM=JI(function(f,d){d=d.length==1&&Je(d[0])?Or(d[0],Gt(Ke())):Or(ft(d,1),Gt(Ke()));var y=d.length;return sr(function(T){for(var B=-1,q=yt(T.length,y);++B<q;)T[B]=d[B].call(this,T[B]);return Vt(f,this,T)})}),Kf=sr(function(f,d){var y=ia(d,Ii(Kf));return Fn(f,C,t,d,y)}),h1=sr(function(f,d){var y=ia(d,Ii(h1));return Fn(f,R,t,d,y)}),hM=zn(function(f,d){return Fn(f,A,t,t,t,d)});function gM(f,d){if(typeof f!="function")throw new Qt(o);return d=d===t?d:tr(d),sr(f,d)}function pM(f,d){if(typeof f!="function")throw new Qt(o);return d=d==null?0:Xr(tr(d),0),sr(function(y){var T=y[d],B=fa(y,0,d);return T&&aa(B,T),Vt(f,this,B)})}function yM(f,d,y){var T=!0,B=!0;if(typeof f!="function")throw new Qt(o);return qr(y)&&(T="leading"in y?!!y.leading:T,B="trailing"in y?!!y.trailing:B),v1(f,d,{leading:T,maxWait:d,trailing:B})}function mM(f){return u1(f,1)}function bM(f,d){return Kf(If(d),f)}function wM(){if(!arguments.length)return[];var f=arguments[0];return Je(f)?f:[f]}function xM(f){return en(f,g)}function EM(f,d){return d=typeof d=="function"?d:t,en(f,g,d)}function _M(f){return en(f,v|g)}function CM(f,d){return d=typeof d=="function"?d:t,en(f,v|g,d)}function SM(f,d){return d==null||rb(f,d,nt(d))}function gn(f,d){return f===d||f!==f&&d!==d}var TM=ru(bf),RM=ru(function(f,d){return f>=d}),Ha=sb((function(){return arguments})())?sb:function(f){return zr(f)&&br.call(f,"callee")&&!K0.call(f,"callee")},Je=ce.isArray,AM=A0?Gt(A0):LI;function Mt(f){return f!=null&&fu(f.length)&&!Vn(f)}function Gr(f){return zr(f)&&Mt(f)}function PM(f){return f===!0||f===!1||zr(f)&&St(f)==ie}var ca=GD||ac,DM=P0?Gt(P0):qI;function IM(f){return zr(f)&&f.nodeType===1&&!Ao(f)}function BM(f){if(f==null)return!0;if(Mt(f)&&(Je(f)||typeof f=="string"||typeof f.splice=="function"||ca(f)||Bi(f)||Ha(f)))return!f.length;var d=mt(f);if(d==he||d==Pe)return!f.size;if(To(f))return!Ef(f).length;for(var y in f)if(br.call(f,y))return!1;return!0}function OM(f,d){return _o(f,d)}function MM(f,d,y){y=typeof y=="function"?y:t;var T=y?y(f,d):t;return T===t?_o(f,d,t,y):!!T}function jf(f){if(!zr(f))return!1;var d=St(f);return d==X||d==Y||typeof f.message=="string"&&typeof f.name=="string"&&!Ao(f)}function kM(f){return typeof f=="number"&&Y0(f)}function Vn(f){if(!qr(f))return!1;var d=St(f);return d==re||d==le||d==ee||d==Ae}function g1(f){return typeof f=="number"&&f==tr(f)}function fu(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=U}function qr(f){var d=typeof f;return f!=null&&(d=="object"||d=="function")}function zr(f){return f!=null&&typeof f=="object"}var p1=D0?Gt(D0):FI;function LM(f,d){return f===d||xf(f,d,Nf(d))}function qM(f,d,y){return y=typeof y=="function"?y:t,xf(f,d,Nf(d),y)}function NM(f){return y1(f)&&f!=+f}function FM(f){if(EB(f))throw new Qe(i);return ub(f)}function zM(f){return f===null}function $M(f){return f==null}function y1(f){return typeof f=="number"||zr(f)&&St(f)==be}function Ao(f){if(!zr(f)||St(f)!=ue)return!1;var d=qs(f);if(d===null)return!0;var y=br.call(d,"constructor")&&d.constructor;return typeof y=="function"&&y instanceof y&&Os.call(y)==qD}var Yf=I0?Gt(I0):zI;function VM(f){return g1(f)&&f>=-U&&f<=U}var m1=B0?Gt(B0):$I;function cu(f){return typeof f=="string"||!Je(f)&&zr(f)&&St(f)==Ie}function Ut(f){return typeof f=="symbol"||zr(f)&&St(f)==Le}var Bi=O0?Gt(O0):VI;function GM(f){return f===t}function WM(f){return zr(f)&&mt(f)==je}function UM(f){return zr(f)&&St(f)==lr}var HM=ru(_f),KM=ru(function(f,d){return f<=d});function b1(f){if(!f)return[];if(Mt(f))return cu(f)?vn(f):Ot(f);if(go&&f[go])return SD(f[go]());var d=mt(f),y=d==he?ff:d==Pe?Ds:Oi;return y(f)}function Gn(f){if(!f)return f===0?f:0;if(f=nn(f),f===G||f===-G){var d=f<0?-1:1;return d*J}return f===f?f:0}function tr(f){var d=Gn(f),y=d%1;return d===d?y?d-y:d:0}function w1(f){return f?Va(tr(f),0,H):0}function nn(f){if(typeof f=="number")return f;if(Ut(f))return W;if(qr(f)){var d=typeof f.valueOf=="function"?f.valueOf():f;f=qr(d)?d+"":d}if(typeof f!="string")return f===0?f:+f;f=F0(f);var y=pt.test(f);return y||Bt.test(f)?uD(f.slice(2),y?2:8):tt.test(f)?W:+f}function x1(f){return Cn(f,kt(f))}function jM(f){return f?Va(tr(f),-U,U):f===0?f:0}function wr(f){return f==null?"":Wt(f)}var YM=Pi(function(f,d){if(To(d)||Mt(d)){Cn(d,nt(d),f);return}for(var y in d)br.call(d,y)&&wo(f,y,d[y])}),E1=Pi(function(f,d){Cn(d,kt(d),f)}),du=Pi(function(f,d,y,T){Cn(d,kt(d),f,T)}),ZM=Pi(function(f,d,y,T){Cn(d,nt(d),f,T)}),XM=zn(pf);function QM(f,d){var y=Ai(f);return d==null?y:eb(y,d)}var JM=sr(function(f,d){f=Cr(f);var y=-1,T=d.length,B=T>2?d[2]:t;for(B&&Tt(d[0],d[1],B)&&(T=1);++y<T;)for(var q=d[y],K=kt(q),Q=-1,ae=K.length;++Q<ae;){var we=K[Q],xe=f[we];(xe===t||gn(xe,Si[we])&&!br.call(f,we))&&(f[we]=q[we])}return f}),ek=sr(function(f){return f.push(t,Fb),Vt(_1,t,f)});function rk(f,d){return k0(f,Ke(d,3),_n)}function tk(f,d){return k0(f,Ke(d,3),mf)}function nk(f,d){return f==null?f:yf(f,Ke(d,3),kt)}function ak(f,d){return f==null?f:ib(f,Ke(d,3),kt)}function ik(f,d){return f&&_n(f,Ke(d,3))}function ok(f,d){return f&&mf(f,Ke(d,3))}function sk(f){return f==null?[]:Ks(f,nt(f))}function uk(f){return f==null?[]:Ks(f,kt(f))}function Zf(f,d,y){var T=f==null?t:Ga(f,d);return T===t?y:T}function lk(f,d){return f!=null&&Vb(f,d,BI)}function Xf(f,d){return f!=null&&Vb(f,d,OI)}var fk=Mb(function(f,d,y){d!=null&&typeof d.toString!="function"&&(d=Ms.call(d)),f[d]=y},Jf(Lt)),ck=Mb(function(f,d,y){d!=null&&typeof d.toString!="function"&&(d=Ms.call(d)),br.call(f,d)?f[d].push(y):f[d]=[y]},Ke),dk=sr(Eo);function nt(f){return Mt(f)?Q0(f):Ef(f)}function kt(f){return Mt(f)?Q0(f,!0):GI(f)}function vk(f,d){var y={};return d=Ke(d,3),_n(f,function(T,B,q){Nn(y,d(T,B,q),T)}),y}function hk(f,d){var y={};return d=Ke(d,3),_n(f,function(T,B,q){Nn(y,B,d(T,B,q))}),y}var gk=Pi(function(f,d,y){js(f,d,y)}),_1=Pi(function(f,d,y,T){js(f,d,y,T)}),pk=zn(function(f,d){var y={};if(f==null)return y;var T=!1;d=Or(d,function(q){return q=la(q,f),T||(T=q.length>1),q}),Cn(f,Lf(f),y),T&&(y=en(y,v|h|g,fB));for(var B=d.length;B--;)Af(y,d[B]);return y});function yk(f,d){return C1(f,lu(Ke(d)))}var mk=zn(function(f,d){return f==null?{}:UI(f,d)});function C1(f,d){if(f==null)return{};var y=Or(Lf(f),function(T){return[T]});return d=Ke(d),gb(f,y,function(T,B){return d(T,B[0])})}function bk(f,d,y){d=la(d,f);var T=-1,B=d.length;for(B||(B=1,f=t);++T<B;){var q=f==null?t:f[Sn(d[T])];q===t&&(T=B,q=y),f=Vn(q)?q.call(f):q}return f}function wk(f,d,y){return f==null?f:Co(f,d,y)}function xk(f,d,y,T){return T=typeof T=="function"?T:t,f==null?f:Co(f,d,y,T)}var S1=qb(nt),T1=qb(kt);function Ek(f,d,y){var T=Je(f),B=T||ca(f)||Bi(f);if(d=Ke(d,4),y==null){var q=f&&f.constructor;B?y=T?new q:[]:qr(f)?y=Vn(q)?Ai(qs(f)):{}:y={}}return(B?Xt:_n)(f,function(K,Q,ae){return d(y,K,Q,ae)}),y}function _k(f,d){return f==null?!0:Af(f,d)}function Ck(f,d,y){return f==null?f:wb(f,d,If(y))}function Sk(f,d,y,T){return T=typeof T=="function"?T:t,f==null?f:wb(f,d,If(y),T)}function Oi(f){return f==null?[]:lf(f,nt(f))}function Tk(f){return f==null?[]:lf(f,kt(f))}function Rk(f,d,y){return y===t&&(y=d,d=t),y!==t&&(y=nn(y),y=y===y?y:0),d!==t&&(d=nn(d),d=d===d?d:0),Va(nn(f),d,y)}function Ak(f,d,y){return d=Gn(d),y===t?(y=d,d=0):y=Gn(y),f=nn(f),MI(f,d,y)}function Pk(f,d,y){if(y&&typeof y!="boolean"&&Tt(f,d,y)&&(d=y=t),y===t&&(typeof d=="boolean"?(y=d,d=t):typeof f=="boolean"&&(y=f,f=t)),f===t&&d===t?(f=0,d=1):(f=Gn(f),d===t?(d=f,f=0):d=Gn(d)),f>d){var T=f;f=d,d=T}if(y||f%1||d%1){var B=Z0();return yt(f+B*(d-f+sD("1e-"+((B+"").length-1))),d)}return Sf(f,d)}var Dk=Di(function(f,d,y){return d=d.toLowerCase(),f+(y?R1(d):d)});function R1(f){return Qf(wr(f).toLowerCase())}function A1(f){return f=wr(f),f&&f.replace($l,wD).replace(XP,"")}function Ik(f,d,y){f=wr(f),d=Wt(d);var T=f.length;y=y===t?T:Va(tr(y),0,T);var B=y;return y-=d.length,y>=0&&f.slice(y,B)==d}function Bk(f){return f=wr(f),f&&er.test(f)?f.replace(We,xD):f}function Ok(f){return f=wr(f),f&&Ur.test(f)?f.replace(Br,"\\$&"):f}var Mk=Di(function(f,d,y){return f+(y?"-":"")+d.toLowerCase()}),kk=Di(function(f,d,y){return f+(y?" ":"")+d.toLowerCase()}),Lk=Ib("toLowerCase");function qk(f,d,y){f=wr(f),d=tr(d);var T=d?_i(f):0;if(!d||T>=d)return f;var B=(d-T)/2;return eu($s(B),y)+f+eu(zs(B),y)}function Nk(f,d,y){f=wr(f),d=tr(d);var T=d?_i(f):0;return d&&T<d?f+eu(d-T,y):f}function Fk(f,d,y){f=wr(f),d=tr(d);var T=d?_i(f):0;return d&&T<d?eu(d-T,y)+f:f}function zk(f,d,y){return y||d==null?d=0:d&&(d=+d),KD(wr(f).replace(Lr,""),d||0)}function $k(f,d,y){return(y?Tt(f,d,y):d===t)?d=1:d=tr(d),Tf(wr(f),d)}function Vk(){var f=arguments,d=wr(f[0]);return f.length<3?d:d.replace(f[1],f[2])}var Gk=Di(function(f,d,y){return f+(y?"_":"")+d.toLowerCase()});function Wk(f,d,y){return y&&typeof y!="number"&&Tt(f,d,y)&&(d=y=t),y=y===t?H:y>>>0,y?(f=wr(f),f&&(typeof d=="string"||d!=null&&!Yf(d))&&(d=Wt(d),!d&&Ei(f))?fa(vn(f),0,y):f.split(d,y)):[]}var Uk=Di(function(f,d,y){return f+(y?" ":"")+Qf(d)});function Hk(f,d,y){return f=wr(f),y=y==null?0:Va(tr(y),0,f.length),d=Wt(d),f.slice(y,y+d.length)==d}function Kk(f,d,y){var T=k.templateSettings;y&&Tt(f,d,y)&&(d=t),f=wr(f),d=du({},d,T,Nb);var B=du({},d.imports,T.imports,Nb),q=nt(B),K=lf(B,q),Q,ae,we=0,xe=d.interpolate||gi,Ce="__p += '",Be=cf((d.escape||gi).source+"|"+xe.source+"|"+(xe===rr?kn:gi).source+"|"+(d.evaluate||gi).source+"|$","g"),Ve="//# sourceURL="+(br.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tD+"]")+`
|
|
341
|
+
`;f.replace(Be,function(Ze,cr,vr,Ht,Rt,Kt){return vr||(vr=Ht),Ce+=f.slice(we,Kt).replace(Vl,ED),cr&&(Q=!0,Ce+=`' +
|
|
342
|
+
__e(`+cr+`) +
|
|
343
|
+
'`),Rt&&(ae=!0,Ce+=`';
|
|
344
|
+
`+Rt+`;
|
|
345
|
+
__p += '`),vr&&(Ce+=`' +
|
|
346
|
+
((__t = (`+vr+`)) == null ? '' : __t) +
|
|
347
|
+
'`),we=Kt+Ze.length,Ze}),Ce+=`';
|
|
348
|
+
`;var Ye=br.call(d,"variable")&&d.variable;if(!Ye)Ce=`with (obj) {
|
|
349
|
+
`+Ce+`
|
|
350
|
+
}
|
|
351
|
+
`;else if(ea.test(Ye))throw new Qe(s);Ce=(ae?Ce.replace(Me,""):Ce).replace(_e,"$1").replace(ze,"$1;"),Ce="function("+(Ye||"obj")+`) {
|
|
352
|
+
`+(Ye?"":`obj || (obj = {});
|
|
353
|
+
`)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(ae?`, __j = Array.prototype.join;
|
|
354
|
+
function print() { __p += __j.call(arguments, '') }
|
|
355
|
+
`:`;
|
|
356
|
+
`)+Ce+`return __p
|
|
357
|
+
}`;var ar=D1(function(){return mr(q,Ve+"return "+Ce).apply(t,K)});if(ar.source=Ce,jf(ar))throw ar;return ar}function jk(f){return wr(f).toLowerCase()}function Yk(f){return wr(f).toUpperCase()}function Zk(f,d,y){if(f=wr(f),f&&(y||d===t))return F0(f);if(!f||!(d=Wt(d)))return f;var T=vn(f),B=vn(d),q=z0(T,B),K=$0(T,B)+1;return fa(T,q,K).join("")}function Xk(f,d,y){if(f=wr(f),f&&(y||d===t))return f.slice(0,G0(f)+1);if(!f||!(d=Wt(d)))return f;var T=vn(f),B=$0(T,vn(d))+1;return fa(T,0,B).join("")}function Qk(f,d,y){if(f=wr(f),f&&(y||d===t))return f.replace(Lr,"");if(!f||!(d=Wt(d)))return f;var T=vn(f),B=z0(T,vn(d));return fa(T,B).join("")}function Jk(f,d){var y=I,T=D;if(qr(d)){var B="separator"in d?d.separator:B;y="length"in d?tr(d.length):y,T="omission"in d?Wt(d.omission):T}f=wr(f);var q=f.length;if(Ei(f)){var K=vn(f);q=K.length}if(y>=q)return f;var Q=y-_i(T);if(Q<1)return T;var ae=K?fa(K,0,Q).join(""):f.slice(0,Q);if(B===t)return ae+T;if(K&&(Q+=ae.length-Q),Yf(B)){if(f.slice(Q).search(B)){var we,xe=ae;for(B.global||(B=cf(B.source,wr(ut.exec(B))+"g")),B.lastIndex=0;we=B.exec(xe);)var Ce=we.index;ae=ae.slice(0,Ce===t?Q:Ce)}}else if(f.indexOf(Wt(B),Q)!=Q){var Be=ae.lastIndexOf(B);Be>-1&&(ae=ae.slice(0,Be))}return ae+T}function eL(f){return f=wr(f),f&&nr.test(f)?f.replace(qe,PD):f}var rL=Di(function(f,d,y){return f+(y?" ":"")+d.toUpperCase()}),Qf=Ib("toUpperCase");function P1(f,d,y){return f=wr(f),d=y?t:d,d===t?CD(f)?BD(f):gD(f):f.match(d)||[]}var D1=sr(function(f,d){try{return Vt(f,t,d)}catch(y){return jf(y)?y:new Qe(y)}}),tL=zn(function(f,d){return Xt(d,function(y){y=Sn(y),Nn(f,y,Hf(f[y],f))}),f});function nL(f){var d=f==null?0:f.length,y=Ke();return f=d?Or(f,function(T){if(typeof T[1]!="function")throw new Qt(o);return[y(T[0]),T[1]]}):[],sr(function(T){for(var B=-1;++B<d;){var q=f[B];if(Vt(q[0],this,T))return Vt(q[1],this,T)}})}function aL(f){return PI(en(f,v))}function Jf(f){return function(){return f}}function iL(f,d){return f==null||f!==f?d:f}var oL=Ob(),sL=Ob(!0);function Lt(f){return f}function ec(f){return lb(typeof f=="function"?f:en(f,v))}function uL(f){return cb(en(f,v))}function lL(f,d){return db(f,en(d,v))}var fL=sr(function(f,d){return function(y){return Eo(y,f,d)}}),cL=sr(function(f,d){return function(y){return Eo(f,y,d)}});function rc(f,d,y){var T=nt(d),B=Ks(d,T);y==null&&!(qr(d)&&(B.length||!T.length))&&(y=d,d=f,f=this,B=Ks(d,nt(d)));var q=!(qr(y)&&"chain"in y)||!!y.chain,K=Vn(f);return Xt(B,function(Q){var ae=d[Q];f[Q]=ae,K&&(f.prototype[Q]=function(){var we=this.__chain__;if(q||we){var xe=f(this.__wrapped__),Ce=xe.__actions__=Ot(this.__actions__);return Ce.push({func:ae,args:arguments,thisArg:f}),xe.__chain__=we,xe}return ae.apply(f,aa([this.value()],arguments))})}),f}function dL(){return lt._===this&&(lt._=ND),this}function tc(){}function vL(f){return f=tr(f),sr(function(d){return vb(d,f)})}var hL=Of(Or),gL=Of(M0),pL=Of(nf);function I1(f){return zf(f)?af(Sn(f)):HI(f)}function yL(f){return function(d){return f==null?t:Ga(f,d)}}var mL=kb(),bL=kb(!0);function nc(){return[]}function ac(){return!1}function wL(){return{}}function xL(){return""}function EL(){return!0}function _L(f,d){if(f=tr(f),f<1||f>U)return[];var y=H,T=yt(f,H);d=Ke(d),f-=H;for(var B=uf(T,d);++y<f;)d(y);return B}function CL(f){return Je(f)?Or(f,Sn):Ut(f)?[f]:Ot(Xb(wr(f)))}function SL(f){var d=++LD;return wr(f)+d}var TL=Js(function(f,d){return f+d},0),RL=Mf("ceil"),AL=Js(function(f,d){return f/d},1),PL=Mf("floor");function DL(f){return f&&f.length?Hs(f,Lt,bf):t}function IL(f,d){return f&&f.length?Hs(f,Ke(d,2),bf):t}function BL(f){return q0(f,Lt)}function OL(f,d){return q0(f,Ke(d,2))}function ML(f){return f&&f.length?Hs(f,Lt,_f):t}function kL(f,d){return f&&f.length?Hs(f,Ke(d,2),_f):t}var LL=Js(function(f,d){return f*d},1),qL=Mf("round"),NL=Js(function(f,d){return f-d},0);function FL(f){return f&&f.length?sf(f,Lt):0}function zL(f,d){return f&&f.length?sf(f,Ke(d,2)):0}return k.after=uM,k.ary=u1,k.assign=YM,k.assignIn=E1,k.assignInWith=du,k.assignWith=ZM,k.at=XM,k.before=l1,k.bind=Hf,k.bindAll=tL,k.bindKey=f1,k.castArray=wM,k.chain=i1,k.chunk=PB,k.compact=DB,k.concat=IB,k.cond=nL,k.conforms=aL,k.constant=Jf,k.countBy=FO,k.create=QM,k.curry=c1,k.curryRight=d1,k.debounce=v1,k.defaults=JM,k.defaultsDeep=ek,k.defer=lM,k.delay=fM,k.difference=BB,k.differenceBy=OB,k.differenceWith=MB,k.drop=kB,k.dropRight=LB,k.dropRightWhile=qB,k.dropWhile=NB,k.fill=FB,k.filter=$O,k.flatMap=WO,k.flatMapDeep=UO,k.flatMapDepth=HO,k.flatten=r1,k.flattenDeep=zB,k.flattenDepth=$B,k.flip=cM,k.flow=oL,k.flowRight=sL,k.fromPairs=VB,k.functions=sk,k.functionsIn=uk,k.groupBy=KO,k.initial=WB,k.intersection=UB,k.intersectionBy=HB,k.intersectionWith=KB,k.invert=fk,k.invertBy=ck,k.invokeMap=YO,k.iteratee=ec,k.keyBy=ZO,k.keys=nt,k.keysIn=kt,k.map=ou,k.mapKeys=vk,k.mapValues=hk,k.matches=uL,k.matchesProperty=lL,k.memoize=uu,k.merge=gk,k.mergeWith=_1,k.method=fL,k.methodOf=cL,k.mixin=rc,k.negate=lu,k.nthArg=vL,k.omit=pk,k.omitBy=yk,k.once=dM,k.orderBy=XO,k.over=hL,k.overArgs=vM,k.overEvery=gL,k.overSome=pL,k.partial=Kf,k.partialRight=h1,k.partition=QO,k.pick=mk,k.pickBy=C1,k.property=I1,k.propertyOf=yL,k.pull=XB,k.pullAll=n1,k.pullAllBy=QB,k.pullAllWith=JB,k.pullAt=eO,k.range=mL,k.rangeRight=bL,k.rearg=hM,k.reject=rM,k.remove=rO,k.rest=gM,k.reverse=Wf,k.sampleSize=nM,k.set=wk,k.setWith=xk,k.shuffle=aM,k.slice=tO,k.sortBy=sM,k.sortedUniq=lO,k.sortedUniqBy=fO,k.split=Wk,k.spread=pM,k.tail=cO,k.take=dO,k.takeRight=vO,k.takeRightWhile=hO,k.takeWhile=gO,k.tap=DO,k.throttle=yM,k.thru=iu,k.toArray=b1,k.toPairs=S1,k.toPairsIn=T1,k.toPath=CL,k.toPlainObject=x1,k.transform=Ek,k.unary=mM,k.union=pO,k.unionBy=yO,k.unionWith=mO,k.uniq=bO,k.uniqBy=wO,k.uniqWith=xO,k.unset=_k,k.unzip=Uf,k.unzipWith=a1,k.update=Ck,k.updateWith=Sk,k.values=Oi,k.valuesIn=Tk,k.without=EO,k.words=P1,k.wrap=bM,k.xor=_O,k.xorBy=CO,k.xorWith=SO,k.zip=TO,k.zipObject=RO,k.zipObjectDeep=AO,k.zipWith=PO,k.entries=S1,k.entriesIn=T1,k.extend=E1,k.extendWith=du,rc(k,k),k.add=TL,k.attempt=D1,k.camelCase=Dk,k.capitalize=R1,k.ceil=RL,k.clamp=Rk,k.clone=xM,k.cloneDeep=_M,k.cloneDeepWith=CM,k.cloneWith=EM,k.conformsTo=SM,k.deburr=A1,k.defaultTo=iL,k.divide=AL,k.endsWith=Ik,k.eq=gn,k.escape=Bk,k.escapeRegExp=Ok,k.every=zO,k.find=VO,k.findIndex=Jb,k.findKey=rk,k.findLast=GO,k.findLastIndex=e1,k.findLastKey=tk,k.floor=PL,k.forEach=o1,k.forEachRight=s1,k.forIn=nk,k.forInRight=ak,k.forOwn=ik,k.forOwnRight=ok,k.get=Zf,k.gt=TM,k.gte=RM,k.has=lk,k.hasIn=Xf,k.head=t1,k.identity=Lt,k.includes=jO,k.indexOf=GB,k.inRange=Ak,k.invoke=dk,k.isArguments=Ha,k.isArray=Je,k.isArrayBuffer=AM,k.isArrayLike=Mt,k.isArrayLikeObject=Gr,k.isBoolean=PM,k.isBuffer=ca,k.isDate=DM,k.isElement=IM,k.isEmpty=BM,k.isEqual=OM,k.isEqualWith=MM,k.isError=jf,k.isFinite=kM,k.isFunction=Vn,k.isInteger=g1,k.isLength=fu,k.isMap=p1,k.isMatch=LM,k.isMatchWith=qM,k.isNaN=NM,k.isNative=FM,k.isNil=$M,k.isNull=zM,k.isNumber=y1,k.isObject=qr,k.isObjectLike=zr,k.isPlainObject=Ao,k.isRegExp=Yf,k.isSafeInteger=VM,k.isSet=m1,k.isString=cu,k.isSymbol=Ut,k.isTypedArray=Bi,k.isUndefined=GM,k.isWeakMap=WM,k.isWeakSet=UM,k.join=jB,k.kebabCase=Mk,k.last=tn,k.lastIndexOf=YB,k.lowerCase=kk,k.lowerFirst=Lk,k.lt=HM,k.lte=KM,k.max=DL,k.maxBy=IL,k.mean=BL,k.meanBy=OL,k.min=ML,k.minBy=kL,k.stubArray=nc,k.stubFalse=ac,k.stubObject=wL,k.stubString=xL,k.stubTrue=EL,k.multiply=LL,k.nth=ZB,k.noConflict=dL,k.noop=tc,k.now=su,k.pad=qk,k.padEnd=Nk,k.padStart=Fk,k.parseInt=zk,k.random=Pk,k.reduce=JO,k.reduceRight=eM,k.repeat=$k,k.replace=Vk,k.result=bk,k.round=qL,k.runInContext=te,k.sample=tM,k.size=iM,k.snakeCase=Gk,k.some=oM,k.sortedIndex=nO,k.sortedIndexBy=aO,k.sortedIndexOf=iO,k.sortedLastIndex=oO,k.sortedLastIndexBy=sO,k.sortedLastIndexOf=uO,k.startCase=Uk,k.startsWith=Hk,k.subtract=NL,k.sum=FL,k.sumBy=zL,k.template=Kk,k.times=_L,k.toFinite=Gn,k.toInteger=tr,k.toLength=w1,k.toLower=jk,k.toNumber=nn,k.toSafeInteger=jM,k.toString=wr,k.toUpper=Yk,k.trim=Zk,k.trimEnd=Xk,k.trimStart=Qk,k.truncate=Jk,k.unescape=eL,k.uniqueId=SL,k.upperCase=rL,k.upperFirst=Qf,k.each=o1,k.eachRight=s1,k.first=t1,rc(k,(function(){var f={};return _n(k,function(d,y){br.call(k.prototype,y)||(f[y]=d)}),f})(),{chain:!1}),k.VERSION=n,Xt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){k[f].placeholder=k}),Xt(["drop","take"],function(f,d){dr.prototype[f]=function(y){y=y===t?1:Xr(tr(y),0);var T=this.__filtered__&&!d?new dr(this):this.clone();return T.__filtered__?T.__takeCount__=yt(y,T.__takeCount__):T.__views__.push({size:yt(y,H),type:f+(T.__dir__<0?"Right":"")}),T},dr.prototype[f+"Right"]=function(y){return this.reverse()[f](y).reverse()}}),Xt(["filter","map","takeWhile"],function(f,d){var y=d+1,T=y==N||y==$;dr.prototype[f]=function(B){var q=this.clone();return q.__iteratees__.push({iteratee:Ke(B,3),type:y}),q.__filtered__=q.__filtered__||T,q}}),Xt(["head","last"],function(f,d){var y="take"+(d?"Right":"");dr.prototype[f]=function(){return this[y](1).value()[0]}}),Xt(["initial","tail"],function(f,d){var y="drop"+(d?"":"Right");dr.prototype[f]=function(){return this.__filtered__?new dr(this):this[y](1)}}),dr.prototype.compact=function(){return this.filter(Lt)},dr.prototype.find=function(f){return this.filter(f).head()},dr.prototype.findLast=function(f){return this.reverse().find(f)},dr.prototype.invokeMap=sr(function(f,d){return typeof f=="function"?new dr(this):this.map(function(y){return Eo(y,f,d)})}),dr.prototype.reject=function(f){return this.filter(lu(Ke(f)))},dr.prototype.slice=function(f,d){f=tr(f);var y=this;return y.__filtered__&&(f>0||d<0)?new dr(y):(f<0?y=y.takeRight(-f):f&&(y=y.drop(f)),d!==t&&(d=tr(d),y=d<0?y.dropRight(-d):y.take(d-f)),y)},dr.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},dr.prototype.toArray=function(){return this.take(H)},_n(dr.prototype,function(f,d){var y=/^(?:filter|find|map|reject)|While$/.test(d),T=/^(?:head|last)$/.test(d),B=k[T?"take"+(d=="last"?"Right":""):d],q=T||/^find/.test(d);B&&(k.prototype[d]=function(){var K=this.__wrapped__,Q=T?[1]:arguments,ae=K instanceof dr,we=Q[0],xe=ae||Je(K),Ce=function(cr){var vr=B.apply(k,aa([cr],Q));return T&&Be?vr[0]:vr};xe&&y&&typeof we=="function"&&we.length!=1&&(ae=xe=!1);var Be=this.__chain__,Ve=!!this.__actions__.length,Ye=q&&!Be,ar=ae&&!Ve;if(!q&&xe){K=ar?K:new dr(this);var Ze=f.apply(K,Q);return Ze.__actions__.push({func:iu,args:[Ce],thisArg:t}),new Jt(Ze,Be)}return Ye&&ar?f.apply(this,Q):(Ze=this.thru(Ce),Ye?T?Ze.value()[0]:Ze.value():Ze)})}),Xt(["pop","push","shift","sort","splice","unshift"],function(f){var d=Is[f],y=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",T=/^(?:pop|shift)$/.test(f);k.prototype[f]=function(){var B=arguments;if(T&&!this.__chain__){var q=this.value();return d.apply(Je(q)?q:[],B)}return this[y](function(K){return d.apply(Je(K)?K:[],B)})}}),_n(dr.prototype,function(f,d){var y=k[d];if(y){var T=y.name+"";br.call(Ri,T)||(Ri[T]=[]),Ri[T].push({name:d,func:y})}}),Ri[Qs(t,b).name]=[{name:"wrapper",func:t}],dr.prototype.clone=eI,dr.prototype.reverse=rI,dr.prototype.value=tI,k.prototype.at=IO,k.prototype.chain=BO,k.prototype.commit=OO,k.prototype.next=MO,k.prototype.plant=LO,k.prototype.reverse=qO,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=NO,k.prototype.first=k.prototype.head,go&&(k.prototype[go]=kO),k}),Ci=OD();Na?((Na.exports=Ci)._=Ci,Jl._=Ci):lt._=Ci}).call(iW)})(Vo,Vo.exports)),Vo.exports}var gr=oW();const MR=El(gr);function sW({cyParams:r,cyInst:e,layoutParams:t,layoutDebounce:n=50,children:a,init:i=()=>{},onCyInit:o}){const[s,u]=Re.useState(!1),l=Re.useRef(null),c=Re.useRef(null),v=Re.useRef(null),h=Re.useRef(!0),g=Re.useCallback(()=>{var m;v.current!==null&&v.current.stop(),c.current&&(v.current=c.current.layout(t),(m=v.current)==null||m.run())},[t]),p=MR.debounce(g,n);Re.useEffect(()=>{if(!l.current)return;const m=sn({container:l.current,...r}),b=l.current.querySelector(".cytoscape-react-nodes-and-edges");if(b&&m.domNode({dom_container:b}),c.current=e||m,l.current&&(l.current.cy=c.current),o==null||o(c.current),i(m),l.current&&c.current){const x=l.current.parentElement;let _=0,C=0;x&&(_=x.clientHeight,C=x.clientWidth,_===0&&(_=window.innerHeight-x.getBoundingClientRect().top-100),C===0&&(C=window.innerWidth)),_>0&&C>0&&(l.current.style.width=`${C}px`,l.current.style.height=`${_}px`),c.current.resize(),r.zoom&&r.pan&&c.current.viewport({zoom:r.zoom,pan:r.pan})}u(!0);const w=new ResizeObserver(MR.debounce(()=>{if(l.current&&c.current){const x=l.current.parentElement;let _=0,C=0;x&&(_=x.clientHeight,C=x.clientWidth,_===0&&(_=window.innerHeight-x.getBoundingClientRect().top-100),C===0&&(C=window.innerWidth),_>0&&C>0&&(l.current.style.width=`${C}px`,l.current.style.height=`${_}px`));const R=c.current.zoom()!==void 0?{zoom:c.current.zoom(),pan:c.current.pan()}:null;c.current.resize(),R&&c.current.viewport(R)}},50));return l.current&&w.observe(l.current),()=>{w.disconnect();try{m.destroy()}catch{}c.current=null,u(!1)}},[]),Re.useEffect(()=>{h.current?(h.current=!1,g()):p()},[s,t,p,g]);const E=Re.useMemo(()=>{var m;return c.current!==null?((m=Re.Children.map(a,b=>{var w;return b?Re.cloneElement(b,{key:(w=b==null?void 0:b.props)==null?void 0:w.id,cytoInstance:c.current,layout:p}):null}))==null?void 0:m.filter(Boolean))||[]:[]},[a,s,p]);return me.jsx("div",{ref:l,className:"cytoscape-react-cy-container",style:{width:"100%",height:"100%",position:"relative"},children:me.jsx("div",{className:"cytoscape-react-nodes-and-edges",style:{pointerEvents:"none",position:"absolute",top:0,left:0,transformOrigin:"0 0",zIndex:10},children:E})})}function uW({cytoInstance:r,id:e,parent:t,label:n,children:a,layout:i,classes:o,styleCallback:s}){const u=Re.useRef(null);function l(h){if(s){const g=s(h);h.isParent()&&(h.style("shape","roundrectangle"),h.style(g))}}Re.useEffect(()=>{try{if(u.current){const h={id:e,dom:u.current};t&&(h.parent=t),n&&(h.label=n);const g=r.add({data:h,classes:o});l(g)}}catch{}return()=>{r.getElementById(e).remove()}},[u,t,n]),Re.useEffect(()=>{i();const h=r.getElementById(e);h&&h.isParent()&&l(h)},[e,a]);function c(h){return Re.cloneElement(h,{cytoInstance:r,layout:i})}const v=Re.Children.map(a,c);return me.jsx("div",{ref:u,className:"cytoscape-react-node",children:v})}const lW={name:"dagre",rankDir:"LR",fit:!1,padding:20,spacingFactor:1.3,animate:!1,nodeDimensionsIncludeLabels:!0,ranker:"network-simplex",rankSep:10,nodeSep:5,edgeSep:10,avoidOverlap:!0,edgeWeight:function(r){return 1},minLen:function(r){return 1},useSimpleEdgeFunction:!0,edgeRouting:!0,controlPoints:!0},qP={padding:20,motionBlur:!1,compound:!0,pixelRatio:"auto",zoomingEnabled:!0,userZoomingEnabled:!0,dragpan:!0,avoidOverlap:!0,panningEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,selectionType:"additive",minZoom:.01,maxZoom:1.5,autoungrabify:!0,styleEnabled:!0,hideEdgesOnViewport:!1,hideLabelsOnViewport:!0,headless:!1,touchTapThreshold:8,desktopTapThreshold:4,touchHoldDuration:500,desktopHoldDuration:1e3,autolock:!1,autounselectify:!1,wheelPanEnabled:!0,wheelPanThreshold:1,wheelPanDebounce:10,wheelAction:"pan"},fW={...qP,pixelRatio:1,motionBlur:!0,textureOnViewport:!0,wheelPanDebounce:20},cW=({nodes:r,edges:e})=>{const{themeColor:t,direction:n,cyRef:a,callbacks:i,config:o,isZoomMode:s,setIsZoomMode:u,isMultiSelectMode:l,setIsMultiSelectMode:c,isDragMode:v,setIsDragMode:h,isEdgeHandlesEnabled:g}=si(),p=Re.useRef(null),E=Re.useRef(null),{edgeSep:m,rankSep:b}=Re.useMemo(()=>JL(r.length),[r.length]),{bgColor:w}=os(t),{background:x,borderSecondary:_}=ss(),C=Re.useCallback(W=>{if(W!=null&&W.includes("gray"))return"whitesmoke";if(!W)return Pt(t);switch(W){case"dark":return Pt(x);case"light":return Pt(_);default:return Pt(W)}},[t,x,_]),R=o.colorMode==="dark",S=Re.useMemo(()=>R?C(w):"dark",[R,w,C]),A=o.edgeColor?C(o.edgeColor):S,P=Re.useMemo(()=>QL(C),[C]),I=o.initialViewport||{pan:{x:0,y:0},zoom:.01},D=Re.useMemo(()=>({...r.length>100?fW:qP,style:P,zoom:I.zoom,pan:I.pan,minZoom:o.minZoom??.01,maxZoom:o.maxZoom??1.5,userZoomingEnabled:!1,userPanningEnabled:!1}),[P,I,r.length,o.minZoom,o.maxZoom]),M=Re.useMemo(()=>({...lW,...n&&{rankDir:n},edgeSep:m,rankSep:b,stop:()=>{a.current&&setTimeout(()=>{var W;(W=a.current)==null||W.fit(void 0,50)},100)}}),[n,m,b,a]),O=Re.useCallback(()=>({"corner-radius":50,"background-color":A,color:A,"border-color":A}),[A]),N=Re.useCallback((W,H,Z,ne)=>{let F={};return ne!=null&&ne.isInverted&&(ne==null?void 0:ne.source)===H&&(F["target-arrow-shape"]="none",F["source-arrow-shape"]="triangle"),ne!=null&&ne.isEdgeAnimated&&(F["line-style"]="dashed",F["line-dash-pattern"]=[32,18],F["line-dash-offset"]=0),ne!=null&&ne.isEdgeDashed&&(F["line-style"]="dashed"),n==="TB"&&(F["taxi-direction"]="downward"),n==="BT"&&(F["taxi-direction"]="upward"),n==="LR"&&(F["taxi-direction"]="rightward"),n==="RL"&&(F["taxi-direction"]="leftward"),F["line-color"]=A,F.color=A,F["target-arrow-color"]=A,F["source-arrow-color"]=A,F},[A,n]);Re.useEffect(()=>{if(a.current){const W=a.current;W.nodes().forEach(H=>{H.isParent()&&H.style(O())}),W.edges().forEach(H=>{const Z=H.data();H.style(N(H,Z.source,Z.target,Z))})}},[A,O,N]);const V=Re.useRef(o);V.current=o;const $=Re.useRef(s);$.current=s;const G=Re.useRef(g);G.current=g,Re.useEffect(()=>{if(!a.current||!a.current.container)return;const W=a.current,H=p.current;if(!H)return;let Z=null,ne=null,F=0,z=0,j=0,ee=0,ie=0;const oe=Y=>{Y.preventDefault(),Y.stopPropagation(),$.current||Y.metaKey||Y.ctrlKey?(j+=Y.deltaY,ee=Y.clientX,ie=Y.clientY,ne===null&&(ne=requestAnimationFrame(()=>{ne=null;const re=V.current,le=W.zoom(),he=j;j=0;let be=le-he*.05/100;be=Math.max(re.minZoom??.01,Math.min(re.maxZoom??1.5,be));const fe=H.getBoundingClientRect();W.zoom({level:be,renderedPosition:{x:ee-fe.left,y:ie-fe.top}})}))):(F+=Y.deltaX,z+=Y.deltaY,Z===null&&(Z=requestAnimationFrame(()=>{Z=null;const re=W.pan(),le=W.zoom(),he=.35,be=F,fe=z;F=0,z=0,W.pan({x:re.x+-be*he/le,y:re.y+-fe*he/le})})))};return H.addEventListener("wheel",oe,{passive:!1}),()=>{H.removeEventListener("wheel",oe),Z!==null&&cancelAnimationFrame(Z),ne!==null&&cancelAnimationFrame(ne)}},[a.current]),Re.useEffect(()=>{a.current&&a.current.userPanningEnabled(v)},[v]),Re.useEffect(()=>{if(!a.current)return;const W=a.current;W.boxSelectionEnabled(!!l),W.selectionType(l?"additive":"single"),W.userPanningEnabled(!l&&v)},[l,v]),Re.useEffect(()=>{E.current&&(g?E.current.enableDrawMode():E.current.disableDrawMode())},[g]),Re.useEffect(()=>{const W=H=>{const Z=H.target;Z.tagName==="INPUT"||Z.tagName==="TEXTAREA"||((H.key==="z"||H.key==="Z")&&u(!$.current),(H.key==="m"||H.key==="M")&&c(!l),(H.key==="d"||H.key==="D")&&h(!v))};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[l,v,u,c,h]),Re.useEffect(()=>()=>{if(a.current)try{a.current.removeAllListeners()}catch{}},[]);const U=Re.useMemo(()=>r.length>50?150:r.length>20?100:50,[r.length]),J=o.backgroundPattern||"dot";return me.jsx(UL,{pattern:J,children:me.jsx(Ee.Box,{ref:p,padding:0,width:"100%",height:"100%",flex:1,position:"relative",children:me.jsxs(sW,{cyParams:D,layoutParams:M,layoutDebounce:U,onCyInit:W=>{var Z;a.current=W,(Z=i.onCyInit)==null||Z.call(i,W);let H=null;if(W.on("zoom pan",()=>{H===null&&(H=requestAnimationFrame(()=>{var ne;H=null,(ne=i.onViewportChange)==null||ne.call(i,{zoom:W.zoom(),pan:W.pan()})}))}),W.on("select","edge",ne=>{var z;const F=ne.target;(z=i.onEdgeSelect)==null||z.call(i,F.id(),F.data())}),W.on("unselect","edge",()=>{var ne;(ne=i.onEdgeDeselect)==null||ne.call(i)}),W.on("remove","edge",ne=>{var z;const F=ne.target;(z=i.onEdgeRemove)==null||z.call(i,F.id(),F.data())}),o.edgeHandles!==!1){const ne={canConnect:(ee,ie)=>!ee.same(ie),edgeParams:(ee,ie)=>({data:{source:ee.id(),target:ie.id(),label:""}}),loopAllowed:()=>!1,hoverDelay:500,snap:!1,snapThreshold:10,snapFrequency:5,noEdgeEventsInDraw:!0,disableBrowserGestures:!0,handlePosition:"left",handleNodes:"node",handleSize:20,handleColor:t||"#0ea5e9",handleOutlineColor:"#B92020FF",handleOutlineWidth:2,handleLineType:"ghost",handleLineWidth:2,preview:!0,ghostEdgeParams:()=>({}),edgeType:()=>"flat",nodeParams:()=>({})},F=W.edgehandles(ne);E.current=F,G.current&&F.enableDrawMode();let z=null,j=null;W.on("ehstart",(ee,ie)=>{j=ie,z=ie.renderedPosition()}),W.on("ehcancel",ee=>{if(!z||!j)return;const ie=ee.originalEvent||window.event,oe=ie==null?void 0:ie.clientX,Y=ie==null?void 0:ie.clientY;if(oe&&Y&&i.onNodeCreate){const X=W.renderer().projectIntoViewport(oe,Y);i.onNodeCreate({type:"text",sourceNodeId:j.id(),position:{x:X[0],y:X[1]}})}z=null,j=null}),W.on("ehcomplete",(ee,ie,oe)=>{var Y;(Y=i.onEdgeCreate)==null||Y.call(i,ie.id(),oe.id())}),W.on("ehstop",()=>{z=null,j=null})}},children:[(r||[]).map(W=>{var j,ee,ie,oe,Y,X;const H=r.filter(re=>{var le,he;return((le=re.data)==null?void 0:le.parent)===((he=W.data)==null?void 0:he.id)}),Z=H.length>0&&!((j=W.data)!=null&&j.parent),ne=Z?((ee=W.data)==null?void 0:ee.label)||((ie=W.data)==null?void 0:ie.headerTitle)||"Container":void 0,F=Z?ic.parentContainer:ic[W==null?void 0:W.data.type]||ic.text,{data:z}=e.find(re=>{var le;return((le=re.data)==null?void 0:le.source)===(W==null?void 0:W.data.id)})||{};return me.jsx(uW,{id:(oe=W.data)==null?void 0:oe.id,parent:(Y=W.data)==null?void 0:Y.parent,label:ne,styleCallback:O,children:me.jsx(F,{...W,isInverted:z==null?void 0:z.isInverted,isParent:Z,childNodes:H})},(X=W.data)==null?void 0:X.id)}),(e||[]).map(({data:W})=>me.jsx(eq,{id:W==null?void 0:W.id,source:W==null?void 0:W.source,target:W==null?void 0:W.target,label:W==null?void 0:W.label,styleCallback:(H,Z,ne)=>N(H,Z,ne,W)},W==null?void 0:W.id))]})})})},dW=Re.memo(cW);var Go=(r=>(r.TOP_DOWN="TB",r.BOTTOM_UP="BT",r.LEFT_RIGHT="LR",r.RIGHT_LEFT="RL",r.CENTER="C",r))(Go||{});const vW=[{value:"BT",label:"Bottom to Up",icon:bt.PiArrowUpLight,flowType:Go.BOTTOM_UP},{value:"TB",label:"Top to Bottom",icon:bt.PiArrowDownLight,flowType:Go.TOP_DOWN},{value:"LR",label:"Left to Right",icon:bt.PiArrowArcRightLight,flowType:Go.LEFT_RIGHT},{value:"RL",label:"Right to Left",icon:bt.PiArrowArcLeftLight,flowType:Go.RIGHT_LEFT}],NP=()=>{const{cyRef:r,themeColor:e,direction:t,selectedNodeIds:n,setSelectedNodeIds:a,isZoomMode:i,setIsZoomMode:o,isMultiSelectMode:s,setIsMultiSelectMode:u,isDragMode:l,setIsDragMode:c,isEdgeHandlesEnabled:v,setIsEdgeHandlesEnabled:h,isArrayNodeMode:g,setIsArrayNodeMode:p,isPinned:E,setIsPinned:m,callbacks:b,config:w}=si(),x=w.colorMode==="dark",{background:_,border:C,colorInactive:R,colorText:S,colorActive:A,darkBackgroundSecondary:P}=ss(),[I,D]=Re.useState(!0),[M,O]=Re.useState(!1),[N,V]=Re.useState(!0),[$,G]=Re.useState(!1);Re.useEffect(()=>{const F=()=>V(window.innerWidth>=768);return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]),Re.useEffect(()=>{if(!N){D(!0);return}if(!E){D(!1);return}const F=j=>{D(window.innerHeight-j.clientY<=250)},z=()=>D(!1);return window.addEventListener("mousemove",F),window.addEventListener("mouseleave",z),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseleave",z)}},[N,E]);const U=Re.useCallback(F=>{const z=r.current;if(!z)return;const j=w.minZoom??.01,ee=w.maxZoom??1.5,ie=.02,oe=z.zoomingEnabled(),Y=z.userZoomingEnabled();z.zoomingEnabled(!0),z.userZoomingEnabled(!0);let X=z.zoom();switch(F){case"increase":X=Math.min(ee,X+ie),z.zoom(X),z.center();break;case"decrease":X=Math.max(j,X-ie),z.zoom(X),z.center();break;case"reset":z.fit(void 0,50);break}z.zoomingEnabled(oe),z.userZoomingEnabled(Y)},[r,w.minZoom,w.maxZoom]),J=I||M,W=w.renderSelectedNodeToolbar,H=n.length>0&&!!W,Z=Re.useMemo(()=>{if(!H)return[];const F=r.current;return F?n.map(z=>{const j=F.getElementById(z);return j!=null&&j.length?j.data():{id:z}}):[]},[H,n,r]),ne=Re.useCallback(()=>{var F;a([]),(F=b.onNodeDeselect)==null||F.call(b)},[a,b]);return me.jsxs(me.Fragment,{children:[H&&me.jsx(Ee.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:W({selectedNodeIds:n,selectedNodeData:Z,onDeselect:ne})}),!E&&me.jsx(Ee.Box,{position:"absolute",bottom:5,left:0,zIndex:101,w:3,children:me.jsx(Ee.Tooltip,{label:"Show Bottom Bar",placement:"top",fontSize:"xs",children:me.jsx(Ee.Flex,{align:"center",bg:_,borderColor:C,borderWidth:1,py:6,px:0,w:4,h:50,borderRadius:"15px",borderLeftRadius:0,onMouseEnter:()=>{O(!0),D(!0)},onMouseLeave:()=>O(!1),_hover:{bg:P},children:me.jsx(Ee.Icon,{ml:-1,as:bt.PiLineVerticalBold,boxSize:5,color:C})})})}),me.jsx(Ee.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",transition:"opacity 0.3s ease-in, transform 0.3s ease",transform:J?"translateY(0)":"translateY(100%)",pointerEvents:J?"auto":"none",opacity:J?1:0,onMouseEnter:()=>{E||D(!0)},onMouseLeave:()=>{E||(D(!1),O(!1))},children:me.jsxs(Ee.Flex,{w:"100%",px:5,position:"absolute",bottom:5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[me.jsx(Ee.Box,{bg:_,alignContent:"center",h:50,borderColor:C,borderWidth:1,borderRadius:"15px",children:me.jsxs(Ee.HStack,{px:4,spacing:5,children:[me.jsx(Ee.Tooltip,{label:E?"Unpin":"Pin",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Pin",icon:me.jsx(Ee.Icon,{as:E?bt.PiPushPinFill:bt.PiPushPin,boxSize:5}),size:"sm",variant:"ghost",color:E?e:R,onClick:()=>{const F=!E;m(F),D(F)}})}),me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:"Zoom Out",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Zoom out",icon:me.jsx(Ee.Icon,{as:$L.HiMinus,boxSize:5}),size:"sm",variant:"ghost",color:S,onClick:()=>U("decrease")})}),me.jsx(Ee.Tooltip,{label:"Zoom In",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Zoom in",icon:me.jsx(Ee.Icon,{as:vu.VscAdd,boxSize:5}),size:"sm",variant:"ghost",color:S,onClick:()=>U("increase")})}),me.jsx(Ee.Tooltip,{label:"Reset Zoom",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Reset zoom",icon:me.jsx(Ee.Icon,{as:VL.GrPowerReset,boxSize:5}),size:"sm",variant:"ghost",color:S,onClick:()=>U("reset")})}),me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:i?"Zoom Mode (z)":"Pan Mode (z)",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Toggle zoom mode",icon:me.jsx(Ee.Icon,{as:i?vu.VscZoomIn:vu.VscMove,boxSize:5}),size:"sm",variant:"ghost",color:i?e:R,onClick:()=>o(!i)})}),me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:s?"Multi-Select On (m)":"Multi-Select Off (m)",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Toggle multi-select",icon:me.jsx(Ee.Icon,{as:vu.VscGroupByRefType,boxSize:5}),size:"sm",variant:"ghost",color:s?e:R,onClick:()=>u(!s)})}),me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:l?"Drag Mode On (d)":"Drag Mode Off (d)",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Toggle drag mode",icon:me.jsx(Ee.Icon,{as:bt.PiHandGrabbing,boxSize:5}),size:"sm",variant:"ghost",color:l?e:R,onClick:()=>c(!l)})}),w.edgeHandles!==!1&&me.jsxs(me.Fragment,{children:[me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:v?"Draw Mode On":"Draw Mode Off",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Toggle draw mode",icon:me.jsx(Ee.Icon,{as:bt.PiPencilSimpleLine,boxSize:5}),size:"sm",variant:"ghost",color:v?e:R,onClick:()=>h(!v)})})]}),me.jsx(Ee.Icon,{mx:-4,as:bt.PiLineVerticalThin,boxSize:5,color:C}),me.jsx(Ee.Tooltip,{label:g?"List mode":"Set mode",placement:"top",fontSize:"xs",children:me.jsx(Ee.Flex,{cursor:"pointer",align:"center",onClick:()=>{var z;const F=!g;p(F),(z=b.onArrayModeChange)==null||z.call(b,F)},_hover:{color:e},children:me.jsx(Ee.Text,{fontSize:"23px",color:g?e:R,children:g?"[]":"{}"})})})]})}),me.jsxs(Ee.Box,{position:"relative",ml:"auto",children:[me.jsx(Ee.Box,{bg:_,borderWidth:1,borderColor:C,borderRadius:"15px",h:50,px:3,children:me.jsxs(Ee.Flex,{align:"center",h:"100%",children:[me.jsx(Ee.Tooltip,{label:"Flow Direction",placement:"top",fontSize:"xs",children:me.jsx(Ee.IconButton,{"aria-label":"Direction",icon:me.jsx(Ee.Icon,{as:bt.PiCaretUp,boxSize:4}),size:"sm",variant:"ghost",color:R,onClick:()=>G(!$)})}),me.jsx(Ee.Text,{fontSize:"xs",color:R,ml:1,children:t})]})}),$&&me.jsxs(Ee.Box,{position:"absolute",bottom:"60px",right:0,bg:_,borderWidth:1,borderColor:C,borderRadius:"15px",p:2,zIndex:200,minW:"180px",shadow:"lg",onMouseLeave:()=>G(!1),children:[vW.map(F=>me.jsxs(Ee.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:x?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var z;(z=b.onDirectionChange)==null||z.call(b,F.value),G(!1)},children:[me.jsx(Ee.Icon,{as:F.icon,boxSize:5,color:S}),me.jsx(Ee.Text,{fontSize:"sm",color:S,flex:1,children:F.label}),t===F.value&&me.jsx(Ee.Icon,{as:O1.IoCheckmark,boxSize:4,color:A})]},F.value)),me.jsxs(Ee.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:x?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var F;(F=b.onDirectionChange)==null||F.call(b,"LR"),G(!1)},children:[me.jsx(Ee.Icon,{as:GL.TbAlignCenter,boxSize:5,color:S}),me.jsx(Ee.Text,{fontSize:"sm",color:S,flex:1,children:"Center"}),t==="C"&&me.jsx(Ee.Icon,{as:O1.IoCheckmark,boxSize:4,color:A})]})]})]})]})})]})};NP.displayName="BottomBar";const hW=Re.memo(NP),zl={label:"Untitled",description:"",isTask:!1,isLocked:!1},v0={id:null,type:"text",data:{...zl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",borderColor:"transparent",borderRadius:25,borderWidth:0,boxShadow:"none",textOverflow:"ellipsis",fontWeight:"bold",textColor:"gray.800",textAlign:"center"}}},kR={id:null,type:"objectView",data:{...zl,headerTitle:null,viewProps:{width:"100%",borderWidth:2,borderRadius:25,height:"100%",justifyContent:"space-between",flexDirection:"row",textColor:"gray.900"}}},gW={id:null,type:"arrayView",data:{...zl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",textAlign:"center",borderRadius:25,fontSize:"5xl",borderWidth:2,textOverflow:"ellipsis",wordBreak:"keep-all",fontWeight:"bold",textColor:"gray.900",placeholder:"Start Typing"}}},LR={id:null,type:"workflowStep",data:{...zl,viewProps:{width:"max-content !important",maxWidth:350,minWidth:280,height:"100%",borderRadius:15,borderWidth:3}}};let Ru;const pW=new Uint8Array(16);function yW(){if(!Ru&&(Ru=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ru))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ru(pW)}const ct=[];for(let r=0;r<256;++r)ct.push((r+256).toString(16).slice(1));function mW(r,e=0){return ct[r[e+0]]+ct[r[e+1]]+ct[r[e+2]]+ct[r[e+3]]+"-"+ct[r[e+4]]+ct[r[e+5]]+"-"+ct[r[e+6]]+ct[r[e+7]]+"-"+ct[r[e+8]]+ct[r[e+9]]+"-"+ct[r[e+10]]+ct[r[e+11]]+ct[r[e+12]]+ct[r[e+13]]+ct[r[e+14]]+ct[r[e+15]]}const bW=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qR={randomUUID:bW};function wW(r,e,t){if(qR.randomUUID&&!r)return qR.randomUUID();r=r||{};const n=r.random||(r.rng||yW)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,mW(n)}const Yt=r=>typeof r=="object",FP=r=>Array.isArray(r),xW=["order","position","selected","locked","grabbed","grabbable","scratch"],Ra=r=>Object.entries(r).reduce((e,[t,n])=>(!Yt(n)&&!t.startsWith("$")&&(e[t]=n),e),{}),h0=(r,e)=>typeof r=="string"&&r.startsWith("$")?nm(r,e):Yt(r)&&!FP(r)?Object.entries(r).reduce((t,[n,a])=>(typeof a=="string"&&a.startsWith("$")&&n==="..."?(delete t["..."],t[n]={...nm(a,e),...r}):typeof a=="string"&&a.startsWith("$")?t[n]=nm(a,e):t[n]=a,t),{}):r,Aa=r=>Object.entries(r).reduce((e,[t,n])=>(Yt(n)&&t&&n&&!t.startsWith("$")&&(xW.includes(t)&&(t=t+"#"),e[t]=n),e),{}),Ja=(r,e,{label:t,parent:n=void 0},a,i=null)=>(i!==null&&(Yt(i)||FP(i))&&(i=JSON.stringify(i,null,2)),{data:{parent:n,...r.data,id:e,text:t||"",label:t,code:i||null,type:r.type,description:a}}),ma=(r,e,t=null,n=null,a=null,i=!1,o=null)=>({data:{id:wW(),source:a?e:r,target:a?r:e,label:n||"",isInverted:a,isEdgeAnimated:i,parent:o}}),Pa=(r,e=[])=>{const t={},n={};let a=[];if(r)for(const[i,o]of Object.entries(r))i.startsWith("$")&&i!=="$"?t[i.slice(1)]=o:i!=="$"?n[i]=o:i==="$"&&(a=o);return{newConfig:t,updatedObject:n,arrayObject:a}},Hi=(r,e)=>{let t=kR;const{view:n,borderColor:a,borderRadius:i,bgColor:o,textColor:s,fontSize:u,stepType:l}=e;r=n||r,l?t={...LR}:r==="object"?t=kR:r==="text"?t=v0:r==="array"?t=gW:r==="workflowStep"&&(t={...LR});const c=t.data.viewProps;return t.data.viewProps={...c,borderRadius:i||(l?15:50),bgColor:o,borderColor:a,textColor:s,fontSize:u},t.data.config=e,{config:t}},is=(r,e)=>(r=e.find(n=>{var a;return((a=n.data)==null?void 0:a.id)===r||n===r})?`${r}.#`:r,r),nm=(r,{ids:e,jsnObjct:t})=>{if(typeof r=="string"&&(r!=null&&r.startsWith("$"))){const n=r.replace("$","").replace("*","");r==null||r.endsWith("*");const a=e.find(s=>s.split(".").slice(-1)[0]===n||n===s);if(!a)return r;const i=EW(a,t);return JSON.stringify(i).includes(r)?r:i||r}return r},EW=(r,e)=>{let t=r.split(".").splice(1);return t=t[t.length-1]==="#"||t[t.length-1].includes("{")?t.slice(0,-2):t,(i=>t.reduce((o,s)=>{s=s.replace("[","").replace("]","");const{arrayObject:u}=Pa(o);return o=u.length?u:o,o[s]},i))(e)};function Xi(r,e="root",t=[]){try{const{arrayObject:n}=Pa(r);n.length&&(r=n);const a=Ra(r),i=Aa(r);return Yt(r)?(gr.isArray(r)||gr.isArray(r)&&e==="root"||!gr.isArray(r)&&Object.keys(a).length||e==="root")&&t.push(e):t.push(e),Object.keys(i).length&&!gr.isArray(r)?Ko({chldPth:null,itrblObjct:i,nodes:t,path:e}):gr.isArray(r)&&r.forEach((o,s)=>{const u=Ra(o),l=Aa(o),{newConfig:c,arrayObject:v}=Pa(o);let h=`${e}.${s}`;Yt(o)?Object.keys(u).length?(Xi(u,h,t),Object.keys(l).length&&!gr.isArray(o)&&Ko({chldPth:h,itrblObjct:l,nodes:t,path:e})):Object.keys(l).length&&!gr.isArray(o)?Ko({chldPth:h,itrblObjct:l,nodes:t,path:e}):gr.isArray(o)&&zP({chldPth:h,item:o,nodes:t,path:e}):t.push(h)}),{nodes:t}}catch{return{nodes:t}}}const Ko=({chldPth:r,itrblObjct:e,nodes:t,path:n})=>Object.entries(e).forEach(([a,i],o)=>{const s=Ra(i),u=Aa(i),{newConfig:l,arrayObject:c}=Pa(i);c.length&&(i=c);let v=r?`${r}.${a}`:`${n}.${a}`;if(Yt(i)&&!gr.isArray(i)){const h=Object.keys(s).length===0;if(h&&(Hi("array",l),t.push(v)),Object.keys(s).length){const g=gr.isArray(i)?`${i.length||""}`:`{${Object.keys(i).length||""}}`;let p=v;h&&(p=`${v}.${g}`),Xi(i,p,t)}else Object.keys(u).length&&!gr.isArray(i)?Ko({chldPth:v,itrblObjct:u,path:v,nodes:t}):Xi(i,v,t)}else gr.isArray(i)&&Xi(i,v,t)}),zP=({chldPth:r,item:e,nodes:t,path:n})=>e.forEach((a,i)=>{let o=`${r}.${i}`;const s=Aa(a),u=Ra(a);Yt(a)?!gr.isArray(a)&&Object.keys(u).length?Xi(a,o,t):Object.keys(s).length&&!gr.isArray(a)?Ko({chldPth:o,itrblObjct:s,path:n,nodes:t}):gr.isArray(a)&&zP({chldPth:o,item:a,nodes:t,path:n}):t.push(o)});function ri(r,e="root",t=[],n=[],a="untitled",i={hideDefaultObject:!1,sprtObjctKy:!1,isCntr:!1},o={},s){if(s||(s={invrtdRtPths:[],initalObjIds:null}),!r||typeof r!="object")return{nodes:t,edges:n};const u=r;if(!s.initalObjIds){const{nodes:v}=Xi(r);s.initalObjIds={ids:v,jsnObjct:r}}let{hideDefaultObject:l,sprtObjctKy:c}=i;try{e=is(e,t);const{newConfig:v,arrayObject:h}=Pa(r),g=Object.keys(o).length>0?o:v;h.length&&(r=h);const p=Ra(r),E=Aa(r),{label:m,collapsed:b,parent:w}=g;if(!Yt(r))t.push(Ja(v0,e,{label:m||e,parent:w},r,u));else if(gr.isArray(r)||gr.isArray(r)&&e==="root"){const{config:x}=Hi("array",g),_=gr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e==="root"?a:`${a} ${_}`;t.push(Ja(x,e,{label:m||C,parent:w},r,gr.isArray(u)?{[a]:u}:u))}else if(!gr.isArray(r)&&Object.keys(p).length||e==="root"){const{config:x}=Hi(null,g),_=e.split("."),C=_[_.length-1];let R=isNaN(Number(C))?null:Number(C)+1;const S=isNaN(Number(C))?C:_[_.length-2]+" "+R,A=e==="root"?a:S,P=r;if(m){const{config:I}=Hi("object",g);I.data.headerTitle=m,t.push(Ja(I,e,{label:m||`${m} ${Object.keys(r).length}`,parent:w},p,P))}else x.data.headerTitle=A,t.push(Ja(x,e,{label:m,parent:w},p,P))}return b||(Object.keys(E).length&&!gr.isArray(r)?jo({flowConfig:i,chldPth:null,edges:n,isInverted:null,itrblObjct:E,nodes:t,path:e,newConfig:g,ctx:s}):gr.isArray(r)&&r.forEach((x,_)=>{x=h0(x,s.initalObjIds);const C=x,R=Ra(x),S=Aa(x),{newConfig:A,arrayObject:P}=Pa(x);P.length&&(x=P);const{config:I}=Hi(typeof x=="string"?"text":"array",A),{hideConfig:D,sourceLabel:M,label:O,isEdgeAnimated:N,parent:V}=A;l=l||D;const $=e==="root"&&i.isCntr,G=e.split(".").slice(0,2).join("."),U=s.invrtdRtPths.includes(G),J=i.isCntr&&U||_%2===0&&$;let W=`${e}.${_}`;W=is(W,t),J&&s.invrtdRtPths.push(W),Yt(x)?Object.keys(R).length&&!gr.isArray(x)?(n.push(ma(e,W,null,M,J,N)),ri(x,W,t,n,O||_,i,A,s)):Object.keys(S).length&&!gr.isArray(x)?jo({flowConfig:i,chldPth:W,isInverted:J,edges:n,itrblObjct:S,nodes:t,path:e,newConfig:A,forceIsInverted:!0,ctx:s}):gr.isArray(x)?$P({flowConfig:i,chldPth:W,edges:n,isInverted:J,item:x,nodes:t,path:e,ctx:s}):Yt(x)&&jo({flowConfig:i,chldPth:W,isInverted:J,edges:n,itrblObjct:[x],nodes:t,path:e,newConfig:A,ctx:s}):(n.push(ma(e,W,null,M,J,N)),t.push(Ja(I,W,{label:O||String(x),parent:V},x,C)))})),{nodes:t,edges:n}}catch{return{nodes:t,edges:n}}}const jo=({chldPth:r,flowConfig:e,edges:t,itrblObjct:n,nodes:a,isInverted:i,path:o,newConfig:s,forceIsInverted:u=!1,ctx:l})=>{let{hideDefaultObject:c,sprtObjctKy:v}=e;return Object.entries(n).forEach(([h,g],p)=>{g=h0(g,l.initalObjIds);const E=g,m=Ra(g),b=Aa(g),{newConfig:w,arrayObject:x}=Pa(g);x.length&&(g=x);const{hideConfig:_,sourceLabel:C,label:R,content:S,target:A,targetLabel:P,collapsed:I,isEdgeAnimated:D,parent:M}=w;c=c||_;const O=o==="root"&&e.isCntr,N=o.split(".").slice(0,2).join("."),V=l.invrtdRtPths.includes(N);u||(i=e.isCntr&&V||p%2===0&&O);let $=r?`${r}.${h}`:`${o}.${h}`;if($=is($,a),i&&l.invrtdRtPths.push($),A&&t.push(ma($,A,null,P,i,D)),Yt(g)&&!gr.isArray(g)){t.push(ma(o,$,null,C,i,D));const G=v||Object.keys(m).length===0;if(G){const U=S?"object":"array",{config:J}=Hi(U,w);J.data.headerTitle=S?R:null,a.push(Ja(J,$,{label:R||h,parent:M},g,E))}if(Object.keys(m).length&&!c){let U=$;if(G){const J=gr.isArray(g)?` ${g.length||""}`:`{${Object.keys(g).length||""}}`;U=`${$}.${J}`,U=is(U,a),t.push(ma($,U,null,C,i,D))}ri(g,U,a,t,R||h,e,w,l)}else Object.keys(b).length&&!gr.isArray(g)&&!I?jo({chldPth:$,flowConfig:e,itrblObjct:b,path:$,edges:t,nodes:a,newConfig:w,isInverted:i,ctx:l}):ri(g,$,a,t,h,e,w,l)}else gr.isArray(g)&&(t.push(ma(o,$,null,C,i,D)),ri(g,$,a,t,h,e,w,l))})},$P=({flowConfig:r,chldPth:e,edges:t,isInverted:n,item:a,nodes:i,path:o,ctx:s})=>a.forEach((u,l)=>{let c=`${e}.${l}`;c=is(c,i);const v=u;u=h0(u,s.initalObjIds);const h=Aa(u),g=Ra(u),{newConfig:p}=Pa(u),{collapsed:E,label:m,parent:b,sourceLabel:w,isEdgeAnimated:x,content:_}=p;Yt(u)?!gr.isArray(u)&&Object.keys(g).length?(t.push(ma(o,c,null,w,n,x)),ri(u,c,i,t,l,r,p,s)):Object.keys(h).length&&!gr.isArray(u)&&!E?jo({chldPth:c,flowConfig:r,itrblObjct:h,path:o,edges:t,nodes:i,isInverted:n,newConfig:p,ctx:s}):gr.isArray(u)&&$P({flowConfig:r,chldPth:c,edges:t,isInverted:n,item:u,nodes:i,path:o,ctx:s}):(t.push(ma(o,c,null,w,n,x)),i.push(Ja(v0,c,{label:m||String(u),parent:b},u,v)))}),_W=".cytoscape-react-nodes-and-edges{position:absolute!important;top:0!important;left:0!important;z-index:10!important;pointer-events:none!important;overflow:visible!important;transform-origin:0 0!important}.cytoscape-react-node{z-index:0!important;overflow:visible!important;pointer-events:auto!important;position:absolute!important;transform-origin:0 0!important}.cytoscape-react-node input,.cytoscape-react-node textarea{pointer-events:auto!important;user-select:text!important;cursor:text!important}.cytoscape-react-edge{overflow:visible!important;pointer-events:none!important}.cytoscape-react-cy-container{width:100%!important;height:100%!important;overflow:visible!important;position:relative!important}.cytoscape-react-cy-container canvas{display:inline!important;vertical-align:baseline!important;overflow:visible!important}.cytoscape-react-cy-container>div{overflow:visible!important}";let NR=!1;function CW(){if(NR||typeof document>"u")return;const r=document.createElement("style");r.setAttribute("data-flow-sdk",""),r.textContent=_W,document.head.appendChild(r),NR=!0}function SW({json:r,title:e="untitled",nodes:t,edges:n,config:a={},callbacks:i={},className:o,style:s,showBottomBar:u=!0}){CW();const l=a.direction==="C",{nodes:c,edges:v}=Re.useMemo(()=>{if(t&&n)return{nodes:t,edges:n};if(r){const h=typeof r=="string"?JSON.parse(r):r;return ri(h,"root",[],[],e,{hideDefaultObject:!1,sprtObjctKy:!1,isCntr:l})}return{nodes:[],edges:[]}},[r,e,t,n,l]);return me.jsx(WL,{config:a,callbacks:i,children:me.jsxs(Ee.Box,{className:o,style:s,width:"100%",height:"100%",position:"relative",overflow:"hidden",children:[me.jsx(dW,{nodes:c,edges:v}),u&&me.jsx(hW,{})]})})}exports.FlowDiagram=SW;exports.contentObjTheme=Pn;exports.createFlowDiagram=ri;exports.getChakraColorHex=Pt;exports.getColorVariant=zR;exports.getDarkerHexColor=$u;exports.useCustomColors=ss;exports.useThemeContentColors=os;
|
|
358
|
+
//# sourceMappingURL=index.cjs.map
|