@grackle-ai/web 0.123.1 → 0.123.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{KnowledgePage-C7xIczVk.js → KnowledgePage-BnKWZKuh.js} +1 -1
- package/dist/assets/{McpAppWidget-BRXtLl5r.js → McpAppWidget-BTQyEJAZ.js} +1 -1
- package/dist/assets/{dagview-iuApGUdh.js → dagview-B70jDsRo.js} +1 -1
- package/dist/assets/{index-D85Q8aMQ.css → index-JkSx7ozY.css} +1 -1
- package/dist/assets/{index-rjOeb4eo.js → index-u6SEG1UL.js} +84 -84
- package/dist/assets/{markdown-BTjAPjWv.js → markdown-CPoGw-1N.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +3 -3
|
@@ -44,4 +44,4 @@ function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"d
|
|
|
44
44
|
`,`
|
|
45
45
|
+`).split(`
|
|
46
46
|
`)),f=u.reduce((l,d)=>l.concat(...d),[]);return[u,f]}return[[],[]]},[e]);return G.useEffect(()=>{const a=(t==null?void 0:t.target)??yo,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var E,_;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!u)&&Ni(h))return!1;const w=vo(h.code,c);if(i.current.add(h[w]),xo(s,i.current,!1)){const b=((_=(E=h.composedPath)==null?void 0:E.call(h))==null?void 0:_[0])||h.target,p=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&h.preventDefault(),r(!0)}},l=h=>{const g=vo(h.code,c);xo(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return a==null||a.addEventListener("keydown",f),a==null||a.addEventListener("keyup",l),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{a==null||a.removeEventListener("keydown",f),a==null||a.removeEventListener("keyup",l),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function xo(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function vo(e,t){return t.includes(e)?"code":"key"}const zd=()=>{const e=se();return G.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:c}=e.getState(),a=ir(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return c?(await c.setViewport(a,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:c,y:a}=s.getBoundingClientRect(),u={x:t.x-c,y:t.y-a},f=n.snapGrid??o,l=n.snapToGrid??i;return kt(u,r,l,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=Jt(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function Wi(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const c={...i};for(const a of s)Hd(a,c);n.push(c)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Hd(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Vd(e,t){return Wi(e,t)}function Bd(e,t){return Wi(e,t)}function $e(e,t){return{id:e,type:"select",selected:t}}function We(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push($e(i.id,s)))}return r}function wo({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const c=t.get(s.id),a=((o=c==null?void 0:c.internals)==null?void 0:o.userNode)??c;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function _o(e){return{id:e.id,type:"remove"}}const bo=e=>lf(e),Fd=e=>mi(e);function Gi(e){return G.forwardRef(e)}const Yd=typeof window<"u"?G.useLayoutEffect:G.useEffect;function Eo(e){const[t,n]=G.useState(BigInt(0)),[r]=G.useState(()=>Xd(()=>n(o=>o+BigInt(1))));return Yd(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Xd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const qi=G.createContext(null);function Wd({children:e}){const t=se(),n=G.useCallback(c=>{const{nodes:a=[],setNodes:u,hasDefaultNodes:f,onNodesChange:l,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let w=a;for(const _ of c)w=typeof _=="function"?_(w):_;let E=wo({items:w,lookup:d});for(const _ of g.values())E=_(E);f&&u(w),E.length>0?l==null||l(E):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:b,setNodes:p}=t.getState();_&&p(b)})},[]),r=Eo(n),o=G.useCallback(c=>{const{edges:a=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:l,edgeLookup:d}=t.getState();let h=a;for(const g of c)h=typeof g=="function"?g(h):g;f?u(h):l&&l(wo({items:h,lookup:d}))},[]),i=Eo(o),s=G.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return W.jsx(qi.Provider,{value:s,children:e})}function Gd(){const e=G.useContext(qi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const qd=e=>!!e.panZoom;function dr(){const e=zd(),t=se(),n=Gd(),r=re(qd),o=G.useMemo(()=>{const i=l=>t.getState().nodeLookup.get(l),s=l=>{n.nodeQueue.push(l)},c=l=>{n.edgeQueue.push(l)},a=l=>{var _,b;const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=bo(l)?l:d.get(l.id),w=g.parentId?bi(g.position,g.measured,g.parentId,d,h):g.position,E={...g,position:w,width:((_=g.measured)==null?void 0:_.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return Je(E)},u=(l,d,h={replace:!1})=>{s(g=>g.map(w=>{if(w.id===l){const E=typeof d=="function"?d(w):d;return h.replace&&bo(E)?E:{...w,...E}}return w}))},f=(l,d,h={replace:!1})=>{c(g=>g.map(w=>{if(w.id===l){const E=typeof d=="function"?d(w):d;return h.replace&&Fd(E)?E:{...w,...E}}return w}))};return{getNodes:()=>t.getState().nodes.map(l=>({...l})),getNode:l=>{var d;return(d=i(l))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:l=[]}=t.getState();return l.map(d=>({...d}))},getEdge:l=>t.getState().edgeLookup.get(l),setNodes:s,setEdges:c,addNodes:l=>{const d=Array.isArray(l)?l:[l];n.nodeQueue.push(h=>[...h,...d])},addEdges:l=>{const d=Array.isArray(l)?l:[l];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:l=[],edges:d=[],transform:h}=t.getState(),[g,w,E]=h;return{nodes:l.map(_=>({..._})),edges:d.map(_=>({..._})),viewport:{x:g,y:w,zoom:E}}},deleteElements:async({nodes:l=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:w,onEdgesDelete:E,triggerNodeChanges:_,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:y}=t.getState(),{nodes:T,edges:k}=await pf({nodesToRemove:l,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:y}),I=k.length>0,H=T.length>0;if(I){const F=k.map(_o);E==null||E(k),b(F)}if(H){const F=T.map(_o);w==null||w(T),_(F)}return(H||I)&&(p==null||p({nodes:T,edges:k})),{deletedNodes:T,deletedEdges:k}},getIntersectingNodes:(l,d=!0,h)=>{const g=Gr(l),w=g?l:a(l),E=h!==void 0;return w?(h||t.getState().nodes).filter(_=>{const b=t.getState().nodeLookup.get(_.id);if(b&&!g&&(_.id===l.id||!b.internals.positionAbsolute))return!1;const p=Je(E?_:b),y=vt(p,w);return d&&y>0||y>=p.width*p.height||y>=w.width*w.height}):[]},isNodeIntersecting:(l,d,h=!0)=>{const w=Gr(l)?l:a(l);if(!w)return!1;const E=vt(w,d);return h&&E>0||E>=d.width*d.height||E>=w.width*w.height},updateNode:u,updateNodeData:(l,d,h={replace:!1})=>{u(l,g=>{const w=typeof d=="function"?d(g):d;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},updateEdge:f,updateEdgeData:(l,d,h={replace:!1})=>{f(l,g=>{const w=typeof d=="function"?d(g):d;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},getNodesBounds:l=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return ff(l,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:l,id:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${l}${d?`-${d}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:l,handleId:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${l?d?`-${l}-${d}`:`-${l}`:""}`))==null?void 0:g.values())??[])},fitView:async l=>{const d=t.getState().fitViewResolver??vf();return t.setState({fitViewQueued:!0,fitViewOptions:l,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return G.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const No=e=>e.selected,Ud=typeof window<"u"?window:void 0;function Kd({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=se(),{deleteElements:r}=dr(),o=_t(e,{actInsideInputWithModifier:!1}),i=_t(t,{target:Ud});G.useEffect(()=>{if(o){const{edges:s,nodes:c}=n.getState();r({nodes:c.filter(No),edges:s.filter(No)}),n.setState({nodesSelectionActive:!1})}},[o]),G.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Zd(e){const t=se();G.useEffect(()=>{const n=()=>{var o,i,s,c;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=sr(e.current);(r.height===0||r.width===0)&&((c=(s=t.getState()).onError)==null||c.call(s,"004",Ee.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const pn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Qd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Jd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=je.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:a,translateExtent:u,minZoom:f,maxZoom:l,zoomActivationKeyCode:d,preventScrolling:h=!0,children:g,noWheelClassName:w,noPanClassName:E,onViewportChange:_,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:y}){const T=se(),k=G.useRef(null),{userSelectionActive:I,lib:H,connectionInProgress:F}=re(Qd,ie),j=_t(d),C=G.useRef();Zd(k);const R=G.useCallback(D=>{_==null||_({x:D[0],y:D[1],zoom:D[2]}),b||T.setState({transform:D})},[_,b]);return G.useEffect(()=>{if(k.current){C.current=nd({domNode:k.current,minZoom:f,maxZoom:l,translateExtent:u,viewport:a,onDraggingChange:N=>T.setState(P=>P.paneDragging===N?P:{paneDragging:N}),onPanZoomStart:(N,P)=>{const{onViewportChangeStart:A,onMoveStart:O}=T.getState();O==null||O(N,P),A==null||A(P)},onPanZoom:(N,P)=>{const{onViewportChange:A,onMove:O}=T.getState();O==null||O(N,P),A==null||A(P)},onPanZoomEnd:(N,P)=>{const{onViewportChangeEnd:A,onMoveEnd:O}=T.getState();O==null||O(N,P),A==null||A(P)}});const{x:D,y:x,zoom:L}=C.current.getViewport();return T.setState({panZoom:C.current,transform:[D,x,L],domNode:k.current.closest(".react-flow")}),()=>{var N;(N=C.current)==null||N.destroy()}}},[]),G.useEffect(()=>{var D;(D=C.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:j,preventScrolling:h,noPanClassName:E,userSelectionActive:I,noWheelClassName:w,lib:H,onTransformChange:R,connectionInProgress:F,selectionOnDrag:y,paneClickDistance:p})},[e,t,n,r,o,i,s,c,j,h,E,I,w,H,R,F,y,p]),W.jsx("div",{className:"react-flow__renderer",ref:k,style:pn,children:g})}const eh=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function th(){const{userSelectionActive:e,userSelectionRect:t}=re(eh,ie);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Rn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},nh=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function rh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=xt.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:c,onPaneClick:a,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:h,children:g}){const w=se(),{userSelectionActive:E,elementsSelectable:_,dragging:b,connectionInProgress:p}=re(nh,ie),y=_&&(e||E),T=G.useRef(null),k=G.useRef(),I=G.useRef(new Set),H=G.useRef(new Set),F=G.useRef(!1),j=A=>{if(F.current||p){F.current=!1;return}a==null||a(A),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},C=A=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){A.preventDefault();return}u==null||u(A)},R=f?A=>f(A):void 0,D=A=>{F.current&&(A.stopPropagation(),F.current=!1)},x=A=>{var v,$;const{domNode:O}=w.getState();if(k.current=O==null?void 0:O.getBoundingClientRect(),!k.current)return;const B=A.target===T.current;if(!B&&!!A.target.closest(".nokey")||!e||!(i&&B||t)||A.button!==0||!A.isPrimary)return;($=(v=A.target)==null?void 0:v.setPointerCapture)==null||$.call(v,A.pointerId),F.current=!1;const{x:Y,y:S}=xe(A.nativeEvent,k.current);w.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:S,x:Y,y:S}}),B||(A.stopPropagation(),A.preventDefault())},L=A=>{const{userSelectionRect:O,transform:B,nodeLookup:m,edgeLookup:M,connectionLookup:Y,triggerNodeChanges:S,triggerEdgeChanges:v,defaultEdgeOptions:$,resetSelectedElements:z}=w.getState();if(!k.current||!O)return;const{x:V,y:X}=xe(A.nativeEvent,k.current),{startX:q,startY:U}=O;if(!F.current){const ne=t?0:o;if(Math.hypot(V-q,X-U)<=ne)return;z(),s==null||s(A)}F.current=!0;const K={startX:q,startY:U,x:V<q?V:q,y:X<U?X:U,width:Math.abs(V-q),height:Math.abs(X-U)},Z=I.current,J=H.current;I.current=new Set(or(m,K,B,n===xt.Partial,!0).map(ne=>ne.id)),H.current=new Set;const te=($==null?void 0:$.selectable)??!0;for(const ne of I.current){const ue=Y.get(ne);if(ue)for(const{edgeId:ge}of ue.values()){const Se=M.get(ge);Se&&(Se.selectable??te)&&H.current.add(ge)}}if(!qr(Z,I.current)){const ne=We(m,I.current,!0);S(ne)}if(!qr(J,H.current)){const ne=We(M,H.current);v(ne)}w.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},N=A=>{var O,B;A.button===0&&((B=(O=A.target)==null?void 0:O.releasePointerCapture)==null||B.call(O,A.pointerId),!E&&A.target===T.current&&w.getState().userSelectionRect&&(j==null||j(A)),w.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(c==null||c(A),w.setState({nodesSelectionActive:I.current.size>0})))},P=r===!0||Array.isArray(r)&&r.includes(0);return W.jsxs("div",{className:ce(["react-flow__pane",{draggable:P,dragging:b,selection:e}]),onClick:y?void 0:Rn(j,T),onContextMenu:Rn(C,T),onWheel:Rn(R,T),onPointerEnter:y?void 0:l,onPointerMove:y?L:d,onPointerUp:y?N:void 0,onPointerDownCapture:y?x:void 0,onClickCapture:y?D:void 0,onPointerLeave:h,ref:T,style:pn,children:[g,W.jsx(th,{})]})}function Un({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:c,onError:a}=t.getState(),u=c.get(e);if(!u){a==null||a("012",Ee.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):o([e])}function Ui({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const c=se(),[a,u]=G.useState(!1),f=G.useRef();return G.useEffect(()=>{f.current=Bf({getStoreItems:()=>c.getState(),onNodeMouseDown:l=>{Un({id:l,store:c,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),G.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var l;(l=f.current)==null||l.destroy()}},[n,r,t,i,e,o,s]),a}const oh=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ki(){const e=se();return G.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:c,updateNodePositions:a,nodeLookup:u,nodeOrigin:f}=e.getState(),l=new Map,d=oh(s),h=o?i[0]:5,g=o?i[1]:5,w=n.direction.x*h*n.factor,E=n.direction.y*g*n.factor;for(const[,_]of u){if(!d(_))continue;let b={x:_.internals.positionAbsolute.x+w,y:_.internals.positionAbsolute.y+E};o&&(b=Ct(b,i));const{position:p,positionAbsolute:y}=yi({nodeId:_.id,nextPosition:b,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:c});_.position=p,_.internals.positionAbsolute=y,l.set(_.id,_)}a(l)},[])}const hr=G.createContext(null),ih=hr.Provider;hr.Consumer;const Zi=()=>G.useContext(hr),sh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ah=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:c,toHandle:a,isValid:u}=s,f=(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n,connectingTo:f,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===Ze.Strict?(c==null?void 0:c.type)!==n:e!==(c==null?void 0:c.nodeId)||t!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:f&&u}};function ch({type:e="source",position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:c,children:a,className:u,onMouseDown:f,onTouchStart:l,...d},h){var L,N;const g=s||null,w=e==="target",E=se(),_=Zi(),{connectOnClick:b,noPanClassName:p,rfId:y}=re(sh,ie),{connectingFrom:T,connectingTo:k,clickConnecting:I,isPossibleEndHandle:H,connectionInProcess:F,clickConnectionInProcess:j,valid:C}=re(ah(_,g,e),ie);_||(N=(L=E.getState()).onError)==null||N.call(L,"010",Ee.error010());const R=P=>{const{defaultEdgeOptions:A,onConnect:O,hasDefaultEdges:B}=E.getState(),m={...A,...P};if(B){const{edges:M,setEdges:Y}=E.getState();Y(Cf(m,M))}O==null||O(m),c==null||c(m)},D=P=>{if(!_)return;const A=Si(P.nativeEvent);if(o&&(A&&P.button===0||!A)){const O=E.getState();qn.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:w,handleId:g,nodeId:_,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...B)=>{var m,M;return(M=(m=E.getState()).onConnectEnd)==null?void 0:M.call(m,...B)},updateConnection:O.updateConnection,onConnect:R,isValidConnection:n||((...B)=>{var m,M;return((M=(m=E.getState()).isValidConnection)==null?void 0:M.call(m,...B))??!0}),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}A?f==null||f(P):l==null||l(P)},x=P=>{const{onClickConnectStart:A,onClickConnectEnd:O,connectionClickStartHandle:B,connectionMode:m,isValidConnection:M,lib:Y,rfId:S,nodeLookup:v,connection:$}=E.getState();if(!_||!B&&!o)return;if(!B){A==null||A(P.nativeEvent,{nodeId:_,handleId:g,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:_,type:e,id:g}});return}const z=Ei(P.target),V=n||M,{connection:X,isValid:q}=qn.isValid(P.nativeEvent,{handle:{nodeId:_,id:g,type:e},connectionMode:m,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:V,flowId:S,doc:z,lib:Y,nodeLookup:v});q&&X&&R(X);const U=structuredClone($);delete U.inProgress,U.toPosition=U.toHandle?U.toHandle.position:null,O==null||O(P,U),E.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":g,"data-nodeid":_,"data-handlepos":t,"data-id":`${y}-${_}-${g}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,u,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:I,connectingfrom:T,connectingto:k,valid:C,connectionindicator:r&&(!F||H)&&(F||j?i:o)}]),onMouseDown:D,onTouchStart:D,onClick:b?x:void 0,ref:h,...d,children:a})}const en=G.memo(Gi(ch));function uh({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(en,{type:"source",position:n,isConnectable:t})]})}function lh({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return W.jsxs(W.Fragment,{children:[W.jsx(en,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(en,{type:"source",position:r,isConnectable:t})]})}function fh(){return null}function dh({data:e,isConnectable:t,targetPosition:n=Q.Top}){return W.jsxs(W.Fragment,{children:[W.jsx(en,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const tn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},So={input:uh,default:lh,output:dh,group:fh};function hh(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const gh=e=>{const{width:t,height:n,x:r,y:o}=St(e.nodeLookup,{filter:i=>!!i.selected});return{width:ye(t)?t:null,height:ye(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function ph({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=se(),{width:o,height:i,transformString:s,userSelectionActive:c}=re(gh,ie),a=Ki(),u=G.useRef(null);G.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const f=!c&&o!==null&&i!==null;if(Ui({nodeRef:u,disabled:!f}),!f)return null;const l=e?h=>{const g=r.getState().nodes.filter(w=>w.selected);e(h,g)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(tn,h.key)&&(h.preventDefault(),a({direction:tn[h.key],factor:h.shiftKey?4:1}))};return W.jsx("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:W.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:o,height:i}})})}const Co=typeof window<"u"?window:void 0,mh=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Qi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:c,deleteKeyCode:a,selectionKeyCode:u,selectionOnDrag:f,selectionMode:l,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:E,elementsSelectable:_,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:y,panOnScrollSpeed:T,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:H,defaultViewport:F,translateExtent:j,minZoom:C,maxZoom:R,preventScrolling:D,onSelectionContextMenu:x,noWheelClassName:L,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:A,isControlledViewport:O}){const{nodesSelectionActive:B,userSelectionActive:m}=re(mh,ie),M=_t(u,{target:Co}),Y=_t(w,{target:Co}),S=Y||H,v=Y||y,$=f&&S!==!0,z=M||m||$;return Kd({deleteKeyCode:a,multiSelectionKeyCode:g}),W.jsx(Jd,{onPaneContextMenu:i,elementsSelectable:_,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:T,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:!M&&S,defaultViewport:F,translateExtent:j,minZoom:C,maxZoom:R,zoomActivationKeyCode:E,preventScrolling:D,noWheelClassName:L,noPanClassName:N,onViewportChange:A,isControlledViewport:O,paneClickDistance:c,selectionOnDrag:$,children:W.jsxs(rh,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:S,isSelecting:!!z,selectionMode:l,selectionKeyPressed:M,paneClickDistance:c,selectionOnDrag:$,children:[e,B&&W.jsx(ph,{onSelectionContextMenu:x,noPanClassName:N,disableKeyboardA11y:P})]})})}Qi.displayName="FlowRenderer";const yh=G.memo(Qi),xh=e=>t=>e?or(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function vh(e){return re(G.useCallback(xh(e),[e]),ie)}const wh=e=>e.updateNodeInternals;function _h(){const e=re(wh),[t]=G.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return G.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function bh({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=se(),i=G.useRef(null),s=G.useRef(null),c=G.useRef(e.sourcePosition),a=G.useRef(e.targetPosition),u=G.useRef(t),f=n&&!!e.internals.handleBounds;return G.useEffect(()=>{i.current&&!e.hidden&&(!f||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[f,e.hidden]),G.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),G.useEffect(()=>{if(i.current){const l=u.current!==t,d=c.current!==e.sourcePosition,h=a.current!==e.targetPosition;(l||d||h)&&(u.current=t,c.current=e.sourcePosition,a.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Eh({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:c,elementsSelectable:a,nodesConnectable:u,nodesFocusable:f,resizeObserver:l,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:w,nodeTypes:E,nodeClickDistance:_,onError:b}){const{node:p,internals:y,isParent:T}=re(V=>{const X=V.nodeLookup.get(e),q=V.parentLookup.has(e);return{node:X,internals:X.internals,isParent:q}},ie);let k=p.type||"default",I=(E==null?void 0:E[k])||So[k];I===void 0&&(b==null||b("003",Ee.error003(k)),k="default",I=(E==null?void 0:E.default)||So.default);const H=!!(p.draggable||c&&typeof p.draggable>"u"),F=!!(p.selectable||a&&typeof p.selectable>"u"),j=!!(p.connectable||u&&typeof p.connectable>"u"),C=!!(p.focusable||f&&typeof p.focusable>"u"),R=se(),D=_i(p),x=bh({node:p,nodeType:k,hasDimensions:D,resizeObserver:l}),L=Ui({nodeRef:x,disabled:p.hidden||!H,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:F,nodeClickDistance:_}),N=Ki();if(p.hidden)return null;const P=Ie(p),A=hh(p),O=F||H||t||n||r||o,B=n?V=>n(V,{...y.userNode}):void 0,m=r?V=>r(V,{...y.userNode}):void 0,M=o?V=>o(V,{...y.userNode}):void 0,Y=i?V=>i(V,{...y.userNode}):void 0,S=s?V=>s(V,{...y.userNode}):void 0,v=V=>{const{selectNodesOnDrag:X,nodeDragThreshold:q}=R.getState();F&&(!X||!H||q>0)&&Un({id:e,store:R,nodeRef:x}),t&&t(V,{...y.userNode})},$=V=>{if(!(Ni(V.nativeEvent)||g)){if(di.includes(V.key)&&F){const X=V.key==="Escape";Un({id:e,store:R,unselect:X,nodeRef:x})}else if(H&&p.selected&&Object.prototype.hasOwnProperty.call(tn,V.key)){V.preventDefault();const{ariaLabelConfig:X}=R.getState();R.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),N({direction:tn[V.key],factor:V.shiftKey?4:1})}}},z=()=>{var J;if(g||!((J=x.current)!=null&&J.matches(":focus-visible")))return;const{transform:V,width:X,height:q,autoPanOnNodeFocus:U,setCenter:K}=R.getState();if(!U)return;or(new Map([[e,p]]),{x:0,y:0,width:X,height:q},V,!0).length>0||K(p.position.x+P.width/2,p.position.y+P.height/2,{zoom:V[2]})};return W.jsx("div",{className:ce(["react-flow__node",`react-flow__node-${k}`,{[h]:H},p.className,{selected:p.selected,selectable:F,parent:T,draggable:H,dragging:L}]),ref:x,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:D?"visible":"hidden",...p.style,...A},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:m,onMouseLeave:M,onContextMenu:Y,onClick:v,onDoubleClick:S,onKeyDown:C?$:void 0,tabIndex:C?0:void 0,onFocus:C?z:void 0,role:p.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Fi}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:W.jsx(ih,{value:e,children:W.jsx(I,{id:e,data:p.data,type:k,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:p.selected??!1,selectable:F,draggable:H,deletable:p.deletable??!0,isConnectable:j,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:L,dragHandle:p.dragHandle,zIndex:y.z,parentId:p.parentId,...P})})})}var Nh=G.memo(Eh);const Sh=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ji(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=re(Sh,ie),s=vh(e.onlyRenderVisibleElements),c=_h();return W.jsx("div",{className:"react-flow__nodes",style:pn,children:s.map(a=>W.jsx(Nh,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Ji.displayName="NodeRenderer";const Ch=G.memo(Ji);function kh(e){return re(G.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&Ef({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),ie)}const Mh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return W.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Ih=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return W.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ko={[Zt.Arrow]:Mh,[Zt.ArrowClosed]:Ih};function Th(e){const t=se();return G.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(ko,e)?ko[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Ee.error009(e)),null)},[e])}const Ah=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const a=Th(t);return a?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:W.jsx(a,{color:n,strokeWidth:s})}):null},es=({defaultColor:e,rfId:t})=>{const n=re(i=>i.edges),r=re(i=>i.defaultEdgeOptions),o=G.useMemo(()=>Af(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?W.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:W.jsx("defs",{children:o.map(i=>W.jsx(Ah,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};es.displayName="MarkerDefinitions";var Ph=G.memo(es);function ts({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:c=2,children:a,className:u,...f}){const[l,d]=G.useState({x:1,y:0,width:0,height:0}),h=ce(["react-flow__edge-textwrapper",u]),g=G.useRef(null);return G.useEffect(()=>{if(g.current){const w=g.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?W.jsxs("g",{transform:`translate(${e-l.width/2} ${t-l.height/2})`,className:h,visibility:l.width?"visible":"hidden",...f,children:[o&&W.jsx("rect",{width:l.width+2*s[0],x:-s[0],y:-s[1],height:l.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),W.jsx("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:g,style:r,children:n}),a]}):null}ts.displayName="EdgeText";const Oh=G.memo(ts);function mn({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:a,interactionWidth:u=20,...f}){return W.jsxs(W.Fragment,{children:[W.jsx("path",{...f,d:e,fill:"none",className:ce(["react-flow__edge-path",f.className])}),u?W.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&ye(t)&&ye(n)?W.jsx(Oh,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:a}):null]})}function Mo({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function ns({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:i=Q.Top}){const[s,c]=Mo({pos:n,x1:e,y1:t,x2:r,y2:o}),[a,u]=Mo({pos:i,x1:r,y1:o,x2:e,y2:t}),[f,l,d,h]=Ci({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:c,targetControlX:a,targetControlY:u});return[`M${e},${t} C${s},${c} ${a},${u} ${r},${o}`,f,l,d,h]}function rs(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:c,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:_})=>{const[b,p,y]=ns({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c}),T=e.isInternal?void 0:t;return W.jsx(mn,{id:T,path:b,labelX:p,labelY:y,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:_})})}const Rh=rs({isInternal:!1}),os=rs({isInternal:!0});Rh.displayName="SimpleBezierEdge";os.displayName="SimpleBezierEdgeInternal";function is(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,sourcePosition:h=Q.Bottom,targetPosition:g=Q.Top,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[p,y,T]=Xn({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:i,targetPosition:g,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset,stepPosition:_==null?void 0:_.stepPosition}),k=e.isInternal?void 0:t;return W.jsx(mn,{id:k,path:p,labelX:y,labelY:T,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:w,markerStart:E,interactionWidth:b})})}const ss=is({isInternal:!1}),as=is({isInternal:!0});ss.displayName="SmoothStepEdge";as.displayName="SmoothStepEdgeInternal";function cs(e){return G.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return W.jsx(ss,{...n,id:r,pathOptions:G.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const $h=cs({isInternal:!1}),us=cs({isInternal:!0});$h.displayName="StepEdge";us.displayName="StepEdgeInternal";function ls(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:w})=>{const[E,_,b]=Ii({sourceX:n,sourceY:r,targetX:o,targetY:i}),p=e.isInternal?void 0:t;return W.jsx(mn,{id:p,path:E,labelX:_,labelY:b,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:w})})}const Lh=ls({isInternal:!1}),fs=ls({isInternal:!0});Lh.displayName="StraightEdge";fs.displayName="StraightEdgeInternal";function ds(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=Q.Bottom,targetPosition:c=Q.Top,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[p,y,T]=ki({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c,curvature:_==null?void 0:_.curvature}),k=e.isInternal?void 0:t;return W.jsx(mn,{id:k,path:p,labelX:y,labelY:T,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:b})})}const Dh=ds({isInternal:!1}),hs=ds({isInternal:!0});Dh.displayName="BezierEdge";hs.displayName="BezierEdgeInternal";const Io={default:hs,straight:fs,step:us,smoothstep:as,simplebezier:os},To={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},jh=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,zh=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Ao="react-flow__edgeupdater";function Po({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:c}){return W.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:ce([Ao,`${Ao}-${c}`]),cx:jh(t,r,e),cy:zh(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Hh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:c,targetPosition:a,onReconnect:u,onReconnectStart:f,onReconnectEnd:l,setReconnecting:d,setUpdateHover:h}){const g=se(),w=(y,T)=>{if(y.button!==0)return;const{autoPanOnConnect:k,domNode:I,connectionMode:H,connectionRadius:F,lib:j,onConnectStart:C,cancelConnection:R,nodeLookup:D,rfId:x,panBy:L,updateConnection:N}=g.getState(),P=T.type==="target",A=(m,M)=>{d(!1),l==null||l(m,n,T.type,M)},O=m=>u==null?void 0:u(n,m),B=(m,M)=>{d(!0),f==null||f(y,n,T.type),C==null||C(m,M)};qn.onPointerDown(y.nativeEvent,{autoPanOnConnect:k,connectionMode:H,connectionRadius:F,domNode:I,handleId:T.id,nodeId:T.nodeId,nodeLookup:D,isTarget:P,edgeUpdaterType:T.type,lib:j,flowId:x,cancelConnection:R,panBy:L,isValidConnection:(...m)=>{var M,Y;return((Y=(M=g.getState()).isValidConnection)==null?void 0:Y.call(M,...m))??!0},onConnect:O,onConnectStart:B,onConnectEnd:(...m)=>{var M,Y;return(Y=(M=g.getState()).onConnectEnd)==null?void 0:Y.call(M,...m)},onReconnectEnd:A,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},E=y=>w(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),_=y=>w(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return W.jsxs(W.Fragment,{children:[(e===!0||e==="source")&&W.jsx(Po,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&W.jsx(Po,{position:a,centerX:i,centerY:s,radius:t,onMouseDown:_,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function Vh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:c,onMouseMove:a,onMouseLeave:u,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:w,noPanClassName:E,onError:_,disableKeyboardA11y:b}){let p=re(K=>K.edgeLookup.get(e));const y=re(K=>K.defaultEdgeOptions);p=y?{...y,...p}:p;let T=p.type||"default",k=(w==null?void 0:w[T])||Io[T];k===void 0&&(_==null||_("011",Ee.error011(T)),T="default",k=(w==null?void 0:w.default)||Io.default);const I=!!(p.focusable||t&&typeof p.focusable>"u"),H=typeof l<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),F=!!(p.selectable||r&&typeof p.selectable>"u"),j=G.useRef(null),[C,R]=G.useState(!1),[D,x]=G.useState(!1),L=se(),{zIndex:N,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M}=re(G.useCallback(K=>{const Z=K.nodeLookup.get(p.source),J=K.nodeLookup.get(p.target);if(!Z||!J)return{zIndex:p.zIndex,...To};const te=Tf({id:e,sourceNode:Z,targetNode:J,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:K.connectionMode,onError:_});return{zIndex:bf({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:J,elevateOnSelect:K.elevateEdgesOnSelect,zIndexMode:K.zIndexMode}),...te||To}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),ie),Y=G.useMemo(()=>p.markerStart?`url('#${Wn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),S=G.useMemo(()=>p.markerEnd?`url('#${Wn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||P===null||A===null||O===null||B===null)return null;const v=K=>{var ne;const{addSelectedEdges:Z,unselectNodesAndEdges:J,multiSelectionActive:te}=L.getState();F&&(L.setState({nodesSelectionActive:!1}),p.selected&&te?(J({nodes:[],edges:[p]}),(ne=j.current)==null||ne.blur()):Z([e])),o&&o(K,p)},$=i?K=>{i(K,{...p})}:void 0,z=s?K=>{s(K,{...p})}:void 0,V=c?K=>{c(K,{...p})}:void 0,X=a?K=>{a(K,{...p})}:void 0,q=u?K=>{u(K,{...p})}:void 0,U=K=>{var Z;if(!b&&di.includes(K.key)&&F){const{unselectNodesAndEdges:J,addSelectedEdges:te}=L.getState();K.key==="Escape"?((Z=j.current)==null||Z.blur(),J({edges:[p]})):te([e])}};return W.jsx("svg",{style:{zIndex:N},children:W.jsxs("g",{className:ce(["react-flow__edge",`react-flow__edge-${T}`,p.className,E,{selected:p.selected,animated:p.animated,inactive:!F&&!o,updating:C,selectable:F}]),onClick:v,onDoubleClick:$,onContextMenu:z,onMouseEnter:V,onMouseMove:X,onMouseLeave:q,onKeyDown:I?U:void 0,tabIndex:I?0:void 0,role:p.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":I?`${Yi}-${g}`:void 0,ref:j,...p.domAttributes,children:[!D&&W.jsx(k,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:F,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:Y,markerEnd:S,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),H&&W.jsx(Hh,{edge:p,isReconnectable:H,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M,setUpdateHover:R,setReconnecting:x})]})})}var Bh=G.memo(Vh);const Fh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function gs({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:c,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:l,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:w}){const{edgesFocusable:E,edgesReconnectable:_,elementsSelectable:b,onError:p}=re(Fh,ie),y=kh(t);return W.jsxs("div",{className:"react-flow__edges",children:[W.jsx(Ph,{defaultColor:e,rfId:n}),y.map(T=>W.jsx(Bh,{id:T,edgesFocusable:E,edgesReconnectable:_,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:c,onMouseMove:a,onMouseLeave:u,onClick:f,reconnectRadius:l,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:w},T))]})}gs.displayName="EdgeRenderer";const Yh=G.memo(gs),Xh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Wh({children:e}){const t=re(Xh);return W.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Gh(e){const t=dr(),n=G.useRef(!1);G.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qh=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Uh(e){const t=re(qh),n=se();return G.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Kh(e){return e.connection.inProgress?{...e.connection,to:kt(e.connection.to,e.transform)}:{...e.connection}}function Zh(e){return Kh}function Qh(e){const t=Zh();return re(t,ie)}const Jh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function eg({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:c,inProgress:a}=re(Jh,ie);return!(i&&o&&a)?null:W.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:W.jsx("g",{className:ce(["react-flow__connection",pi(c)]),children:W.jsx(ps,{style:t,type:n,CustomComponent:r,isValid:c})})})}const ps=({style:e,type:t=Pe.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:c,fromPosition:a,to:u,toNode:f,toHandle:l,toPosition:d,pointer:h}=Qh();if(!o)return;if(n)return W.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:c,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:a,toPosition:d,connectionStatus:pi(r),toNode:f,toHandle:l,pointer:h});let g="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:a,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case Pe.Bezier:[g]=ki(w);break;case Pe.SimpleBezier:[g]=ns(w);break;case Pe.Step:[g]=Xn({...w,borderRadius:0});break;case Pe.SmoothStep:[g]=Xn(w);break;default:[g]=Ii(w)}return W.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ps.displayName="ConnectionLine";const tg={};function Oo(e=tg){G.useRef(e),se(),G.useEffect(()=>{},[e])}function ng(){se(),G.useRef(!1),G.useEffect(()=>{},[])}function ms({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:l,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:E,connectionLineContainerStyle:_,selectionKeyCode:b,selectionOnDrag:p,selectionMode:y,multiSelectionKeyCode:T,panActivationKeyCode:k,zoomActivationKeyCode:I,deleteKeyCode:H,onlyRenderVisibleElements:F,elementsSelectable:j,defaultViewport:C,translateExtent:R,minZoom:D,maxZoom:x,preventScrolling:L,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:A,panOnScroll:O,panOnScrollSpeed:B,panOnScrollMode:m,zoomOnDoubleClick:M,panOnDrag:Y,onPaneClick:S,onPaneMouseEnter:v,onPaneMouseMove:$,onPaneMouseLeave:z,onPaneScroll:V,onPaneContextMenu:X,paneClickDistance:q,nodeClickDistance:U,onEdgeContextMenu:K,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,onReconnect:ue,onReconnectStart:ge,onReconnectEnd:Se,noDragClassName:Re,noWheelClassName:nt,noPanClassName:rt,disableKeyboardA11y:ot,nodeExtent:yn,rfId:Mt,viewport:Fe,onViewportChange:it}){return Oo(e),Oo(t),ng(),Gh(n),Uh(Fe),W.jsx(yh,{onPaneClick:S,onPaneMouseEnter:v,onPaneMouseMove:$,onPaneMouseLeave:z,onPaneContextMenu:X,onPaneScroll:V,paneClickDistance:q,deleteKeyCode:H,selectionKeyCode:b,selectionOnDrag:p,selectionMode:y,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:T,panActivationKeyCode:k,zoomActivationKeyCode:I,elementsSelectable:j,zoomOnScroll:P,zoomOnPinch:A,zoomOnDoubleClick:M,panOnScroll:O,panOnScrollSpeed:B,panOnScrollMode:m,panOnDrag:Y,defaultViewport:C,translateExtent:R,minZoom:D,maxZoom:x,onSelectionContextMenu:l,preventScrolling:L,noDragClassName:Re,noWheelClassName:nt,noPanClassName:rt,disableKeyboardA11y:ot,onViewportChange:it,isControlledViewport:!!Fe,children:W.jsxs(Wh,{children:[W.jsx(Yh,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:ue,onReconnectStart:ge,onReconnectEnd:Se,onlyRenderVisibleElements:F,onEdgeContextMenu:K,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,defaultMarkerColor:N,noPanClassName:rt,disableKeyboardA11y:ot,rfId:Mt}),W.jsx(eg,{style:w,type:g,component:E,containerStyle:_}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(Ch,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:U,onlyRenderVisibleElements:F,noPanClassName:rt,noDragClassName:Re,disableKeyboardA11y:ot,nodeExtent:yn,rfId:Mt}),W.jsx("div",{className:"react-flow__viewport-portal"})]})})}ms.displayName="GraphView";const rg=G.memo(ms),Ro=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:l,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,w=new Map,E=new Map,_=r??t??[],b=n??e??[],p=f??[0,0],y=l??yt;Pi(w,E,_);const T=Gn(b,h,g,{nodeOrigin:p,nodeExtent:y,zIndexMode:d});let k=[0,0,1];if(s&&o&&i){const I=St(h,{filter:C=>!!((C.width||C.initialWidth)&&(C.height||C.initialHeight))}),{x:H,y:F,zoom:j}=ir(I,o,i,a,u,(c==null?void 0:c.padding)??.1);k=[H,F,j]}return{rfId:"1",width:o??0,height:i??0,transform:k,nodes:b,nodesInitialized:T,nodeLookup:h,parentLookup:g,edges:_,edgeLookup:E,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:a,maxZoom:u,translateExtent:yt,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ze.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:c,fitViewResolver:null,connection:{...gi},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mf,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hi,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},og=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a,maxZoom:u,nodeOrigin:f,nodeExtent:l,zIndexMode:d})=>wd((h,g)=>{async function w(){const{nodeLookup:E,panZoom:_,fitViewOptions:b,fitViewResolver:p,width:y,height:T,minZoom:k,maxZoom:I}=g();_&&(await gf({nodes:E,width:y,height:T,panZoom:_,minZoom:k,maxZoom:I},b),p==null||p.resolve(!0),h({fitViewResolver:null}))}return{...Ro({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a,maxZoom:u,nodeOrigin:f,nodeExtent:l,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:E=>{const{nodeLookup:_,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:y,fitViewQueued:T,zIndexMode:k}=g(),I=Gn(E,_,b,{nodeOrigin:p,nodeExtent:l,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:k});T&&I?(w(),h({nodes:E,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:E,nodesInitialized:I})},setEdges:E=>{const{connectionLookup:_,edgeLookup:b}=g();Pi(_,b,E),h({edges:E})},setDefaultNodesAndEdges:(E,_)=>{if(E){const{setNodes:b}=g();b(E),h({hasDefaultNodes:!0})}if(_){const{setEdges:b}=g();b(_),h({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:_,nodeLookup:b,parentLookup:p,domNode:y,nodeOrigin:T,nodeExtent:k,debug:I,fitViewQueued:H,zIndexMode:F}=g(),{changes:j,updatedInternals:C}=jf(E,b,p,y,T,k,F);C&&(Rf(b,p,{nodeOrigin:T,nodeExtent:k,zIndexMode:F}),H?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(j==null?void 0:j.length)>0&&(I&&console.log("React Flow: trigger node changes",j),_==null||_(j)))},updateNodePositions:(E,_=!1)=>{const b=[];let p=[];const{nodeLookup:y,triggerNodeChanges:T,connection:k,updateConnection:I,onNodesChangeMiddlewareMap:H}=g();for(const[F,j]of E){const C=y.get(F),R=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(j!=null&&j.position)),D={id:F,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:_};if(C&&k.inProgress&&k.fromNode.id===C.id){const x=Be(C,k.fromHandle,Q.Left,!0);I({...k,from:x})}R&&C.parentId&&b.push({id:F,parentId:C.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),p.push(D)}if(b.length>0){const{parentLookup:F,nodeOrigin:j}=g(),C=fr(b,y,F,j);p.push(...C)}for(const F of H.values())p=F(p);T(p)},triggerNodeChanges:E=>{const{onNodesChange:_,setNodes:b,nodes:p,hasDefaultNodes:y,debug:T}=g();if(E!=null&&E.length){if(y){const k=Vd(E,p);b(k)}T&&console.log("React Flow: trigger node changes",E),_==null||_(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:_,setEdges:b,edges:p,hasDefaultEdges:y,debug:T}=g();if(E!=null&&E.length){if(y){const k=Bd(E,p);b(k)}T&&console.log("React Flow: trigger edge changes",E),_==null||_(E)}},addSelectedNodes:E=>{const{multiSelectionActive:_,edgeLookup:b,nodeLookup:p,triggerNodeChanges:y,triggerEdgeChanges:T}=g();if(_){const k=E.map(I=>$e(I,!0));y(k);return}y(We(p,new Set([...E]),!0)),T(We(b))},addSelectedEdges:E=>{const{multiSelectionActive:_,edgeLookup:b,nodeLookup:p,triggerNodeChanges:y,triggerEdgeChanges:T}=g();if(_){const k=E.map(I=>$e(I,!0));T(k);return}T(We(b,new Set([...E]))),y(We(p,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:_}={})=>{const{edges:b,nodes:p,nodeLookup:y,triggerNodeChanges:T,triggerEdgeChanges:k}=g(),I=E||p,H=_||b,F=[];for(const C of I){if(!C.selected)continue;const R=y.get(C.id);R&&(R.selected=!1),F.push($e(C.id,!1))}const j=[];for(const C of H)C.selected&&j.push($e(C.id,!1));T(F),k(j)},setMinZoom:E=>{const{panZoom:_,maxZoom:b}=g();_==null||_.setScaleExtent([E,b]),h({minZoom:E})},setMaxZoom:E=>{const{panZoom:_,minZoom:b}=g();_==null||_.setScaleExtent([b,E]),h({maxZoom:E})},setTranslateExtent:E=>{var _;(_=g().panZoom)==null||_.setTranslateExtent(E),h({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:_,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:y}=g();if(!y)return;const T=_.reduce((I,H)=>H.selected?[...I,$e(H.id,!1)]:I,[]),k=E.reduce((I,H)=>H.selected?[...I,$e(H.id,!1)]:I,[]);b(T),p(k)},setNodeExtent:E=>{const{nodes:_,nodeLookup:b,parentLookup:p,nodeOrigin:y,elevateNodesOnSelect:T,nodeExtent:k,zIndexMode:I}=g();E[0][0]===k[0][0]&&E[0][1]===k[0][1]&&E[1][0]===k[1][0]&&E[1][1]===k[1][1]||(Gn(_,b,p,{nodeOrigin:y,nodeExtent:E,elevateNodesOnSelect:T,checkEquality:!1,zIndexMode:I}),h({nodeExtent:E}))},panBy:E=>{const{transform:_,width:b,height:p,panZoom:y,translateExtent:T}=g();return zf({delta:E,panZoom:y,transform:_,translateExtent:T,width:b,height:p})},setCenter:async(E,_,b)=>{const{width:p,height:y,maxZoom:T,panZoom:k}=g();if(!k)return Promise.resolve(!1);const I=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:T;return await k.setViewport({x:p/2-E*I,y:y/2-_*I,zoom:I},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...gi}})},updateConnection:E=>{h({connection:E})},reset:()=>h({...Ro()})}},Object.is);function ig({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:c,initialFitViewOptions:a,fitView:u,nodeOrigin:f,nodeExtent:l,zIndexMode:d,children:h}){const[g]=G.useState(()=>og({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:s,maxZoom:c,fitViewOptions:a,nodeOrigin:f,nodeExtent:l,zIndexMode:d}));return W.jsx(_d,{value:g,children:W.jsx(Wd,{children:h})})}function sg({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:c,fitViewOptions:a,minZoom:u,maxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h}){return G.useContext(hn)?W.jsx(W.Fragment,{children:e}):W.jsx(ig,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:c,initialFitViewOptions:a,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h,children:e})}const ag={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function cg({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:c,onEdgeClick:a,onInit:u,onMove:f,onMoveStart:l,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:_,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:T,onNodeDoubleClick:k,onNodeDragStart:I,onNodeDrag:H,onNodeDragStop:F,onNodesDelete:j,onEdgesDelete:C,onDelete:R,onSelectionChange:D,onSelectionDragStart:x,onSelectionDrag:L,onSelectionDragStop:N,onSelectionContextMenu:P,onSelectionStart:A,onSelectionEnd:O,onBeforeDelete:B,connectionMode:m,connectionLineType:M=Pe.Bezier,connectionLineStyle:Y,connectionLineComponent:S,connectionLineContainerStyle:v,deleteKeyCode:$="Backspace",selectionKeyCode:z="Shift",selectionOnDrag:V=!1,selectionMode:X=xt.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:U=wt()?"Meta":"Control",zoomActivationKeyCode:K=wt()?"Meta":"Control",snapToGrid:Z,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ne,nodesDraggable:ue,autoPanOnNodeFocus:ge,nodesConnectable:Se,nodesFocusable:Re,nodeOrigin:nt=Xi,edgesFocusable:rt,edgesReconnectable:ot,elementsSelectable:yn=!0,defaultViewport:Mt=Rd,minZoom:Fe=.5,maxZoom:it=2,translateExtent:gr=yt,preventScrolling:_s=!0,nodeExtent:xn,defaultMarkerColor:bs="#b1b1b7",zoomOnScroll:Es=!0,zoomOnPinch:Ns=!0,panOnScroll:Ss=!1,panOnScrollSpeed:Cs=.5,panOnScrollMode:ks=je.Free,zoomOnDoubleClick:Ms=!0,panOnDrag:Is=!0,onPaneClick:Ts,onPaneMouseEnter:As,onPaneMouseMove:Ps,onPaneMouseLeave:Os,onPaneScroll:Rs,onPaneContextMenu:$s,paneClickDistance:Ls=1,nodeClickDistance:Ds=0,children:js,onReconnect:zs,onReconnectStart:Hs,onReconnectEnd:Vs,onEdgeContextMenu:Bs,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Ys,onEdgeMouseMove:Xs,onEdgeMouseLeave:Ws,reconnectRadius:Gs=10,onNodesChange:qs,onEdgesChange:Us,noDragClassName:Ks="nodrag",noWheelClassName:Zs="nowheel",noPanClassName:pr="nopan",fitView:mr,fitViewOptions:yr,connectOnClick:Qs,attributionPosition:Js,proOptions:ea,defaultEdgeOptions:ta,elevateNodesOnSelect:na=!0,elevateEdgesOnSelect:ra=!1,disableKeyboardA11y:xr=!1,autoPanOnConnect:oa,autoPanOnNodeDrag:ia,autoPanSpeed:sa,connectionRadius:aa,isValidConnection:ca,onError:ua,style:la,id:vr,nodeDragThreshold:fa,connectionDragThreshold:da,viewport:ha,onViewportChange:ga,width:pa,height:ma,colorMode:ya="light",debug:xa,onScroll:It,ariaLabelConfig:va,zIndexMode:wr="basic",...wa},_a){const vn=vr||"1",ba=jd(ya),Ea=G.useCallback(_r=>{_r.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),It==null||It(_r)},[It]);return W.jsx("div",{"data-testid":"rf__wrapper",...wa,onScroll:Ea,style:{...la,...ag},ref:_a,className:ce(["react-flow",o,ba]),id:vr,role:"application",children:W.jsxs(sg,{nodes:e,edges:t,width:pa,height:ma,fitView:mr,fitViewOptions:yr,minZoom:Fe,maxZoom:it,nodeOrigin:nt,nodeExtent:xn,zIndexMode:wr,children:[W.jsx(rg,{onInit:u,onNodeClick:c,onEdgeClick:a,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:T,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:s,connectionLineType:M,connectionLineStyle:Y,connectionLineComponent:S,connectionLineContainerStyle:v,selectionKeyCode:z,selectionOnDrag:V,selectionMode:X,deleteKeyCode:$,multiSelectionKeyCode:U,panActivationKeyCode:q,zoomActivationKeyCode:K,onlyRenderVisibleElements:te,defaultViewport:Mt,translateExtent:gr,minZoom:Fe,maxZoom:it,preventScrolling:_s,zoomOnScroll:Es,zoomOnPinch:Ns,zoomOnDoubleClick:Ms,panOnScroll:Ss,panOnScrollSpeed:Cs,panOnScrollMode:ks,panOnDrag:Is,onPaneClick:Ts,onPaneMouseEnter:As,onPaneMouseMove:Ps,onPaneMouseLeave:Os,onPaneScroll:Rs,onPaneContextMenu:$s,paneClickDistance:Ls,nodeClickDistance:Ds,onSelectionContextMenu:P,onSelectionStart:A,onSelectionEnd:O,onReconnect:zs,onReconnectStart:Hs,onReconnectEnd:Vs,onEdgeContextMenu:Bs,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Ys,onEdgeMouseMove:Xs,onEdgeMouseLeave:Ws,reconnectRadius:Gs,defaultMarkerColor:bs,noDragClassName:Ks,noWheelClassName:Zs,noPanClassName:pr,rfId:vn,disableKeyboardA11y:xr,nodeExtent:xn,viewport:ha,onViewportChange:ga}),W.jsx(Dd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:_,nodesDraggable:ue,autoPanOnNodeFocus:ge,nodesConnectable:Se,nodesFocusable:Re,edgesFocusable:rt,edgesReconnectable:ot,elementsSelectable:yn,elevateNodesOnSelect:na,elevateEdgesOnSelect:ra,minZoom:Fe,maxZoom:it,nodeExtent:xn,onNodesChange:qs,onEdgesChange:Us,snapToGrid:Z,snapGrid:J,connectionMode:m,translateExtent:gr,connectOnClick:Qs,defaultEdgeOptions:ta,fitView:mr,fitViewOptions:yr,onNodesDelete:j,onEdgesDelete:C,onDelete:R,onNodeDragStart:I,onNodeDrag:H,onNodeDragStop:F,onSelectionDrag:L,onSelectionDragStart:x,onSelectionDragStop:N,onMove:f,onMoveStart:l,onMoveEnd:d,noPanClassName:pr,nodeOrigin:nt,rfId:vn,autoPanOnConnect:oa,autoPanOnNodeDrag:ia,autoPanSpeed:sa,onError:ua,connectionRadius:aa,isValidConnection:ca,selectNodesOnDrag:ne,nodeDragThreshold:fa,connectionDragThreshold:da,onBeforeDelete:B,debug:xa,ariaLabelConfig:va,zIndexMode:wr}),W.jsx(Od,{onSelectionChange:D}),js,W.jsx(Md,{proOptions:ea,position:Js}),W.jsx(kd,{rfId:vn,disableKeyboardA11y:xr})]})})}var sp=Gi(cg);function ug({dimensions:e,lineWidth:t,variant:n,className:r}){return W.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ce(["react-flow__background-pattern",n,r])})}function lg({radius:e,className:t}){return W.jsx("circle",{cx:e,cy:e,r:e,className:ce(["react-flow__background-pattern","dots",t])})}var Oe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Oe||(Oe={}));const fg={[Oe.Dots]:1,[Oe.Lines]:1,[Oe.Cross]:6},dg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ys({id:e,variant:t=Oe.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:c,style:a,className:u,patternClassName:f}){const l=G.useRef(null),{transform:d,patternId:h}=re(dg,ie),g=r||fg[t],w=t===Oe.Dots,E=t===Oe.Cross,_=Array.isArray(n)?n:[n,n],b=[_[0]*d[2]||1,_[1]*d[2]||1],p=g*d[2],y=Array.isArray(i)?i:[i,i],T=E?[p,p]:b,k=[y[0]*d[2]||1+T[0]/2,y[1]*d[2]||1+T[1]/2],I=`${h}${e||""}`;return W.jsxs("svg",{className:ce(["react-flow__background",u]),style:{...a,...pn,"--xy-background-color-props":c,"--xy-background-pattern-color-props":s},ref:l,"data-testid":"rf__background",children:[W.jsx("pattern",{id:I,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:w?W.jsx(lg,{radius:p/2,className:f}):W.jsx(ug,{dimensions:T,lineWidth:o,variant:t,className:f})}),W.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}ys.displayName="Background";const ap=G.memo(ys);function hg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:W.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function gg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:W.jsx("path",{d:"M0 0h32v4.2H0z"})})}function pg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:W.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function mg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:W.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function yg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:W.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function jt({children:e,className:t,...n}){return W.jsx("button",{type:"button",className:ce(["react-flow__controls-button",t]),...n,children:e})}const xg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function xs({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:c,onInteractiveChange:a,className:u,children:f,position:l="bottom-left",orientation:d="vertical","aria-label":h}){const g=se(),{isInteractive:w,minZoomReached:E,maxZoomReached:_,ariaLabelConfig:b}=re(xg,ie),{zoomIn:p,zoomOut:y,fitView:T}=dr(),k=()=>{p(),i==null||i()},I=()=>{y(),s==null||s()},H=()=>{T(o),c==null||c()},F=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),a==null||a(!w)},j=d==="horizontal"?"horizontal":"vertical";return W.jsxs(gn,{className:ce(["react-flow__controls",j,u]),position:l,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&W.jsxs(W.Fragment,{children:[W.jsx(jt,{onClick:k,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:_,children:W.jsx(hg,{})}),W.jsx(jt,{onClick:I,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:E,children:W.jsx(gg,{})})]}),n&&W.jsx(jt,{className:"react-flow__controls-fitview",onClick:H,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:W.jsx(pg,{})}),r&&W.jsx(jt,{className:"react-flow__controls-interactive",onClick:F,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?W.jsx(yg,{}):W.jsx(mg,{})}),f]})}xs.displayName="Controls";const cp=G.memo(xs);function vg({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:c,strokeWidth:a,className:u,borderRadius:f,shapeRendering:l,selected:d,onClick:h}){const{background:g,backgroundColor:w}=i||{},E=s||g||w;return W.jsx("rect",{className:ce(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:f,ry:f,width:r,height:o,style:{fill:E,stroke:c,strokeWidth:a},shapeRendering:l,onClick:h?_=>h(_,e):void 0})}const wg=G.memo(vg),_g=e=>e.nodes.map(t=>t.id),$n=e=>e instanceof Function?e:()=>e;function bg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=wg,onClick:s}){const c=re(_g,ie),a=$n(t),u=$n(e),f=$n(n),l=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return W.jsx(W.Fragment,{children:c.map(d=>W.jsx(Ng,{id:d,nodeColorFunc:a,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:l},d))})}function Eg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:c,onClick:a}){const{node:u,x:f,y:l,width:d,height:h}=re(g=>{const w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const E=w.internals.userNode,{x:_,y:b}=w.internals.positionAbsolute,{width:p,height:y}=Ie(E);return{node:E,x:_,y:b,width:p,height:y}},ie);return!u||u.hidden||!_i(u)?null:W.jsx(c,{x:f,y:l,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:s,onClick:a,id:u.id})}const Ng=G.memo(Eg);var Sg=G.memo(bg);const Cg=200,kg=150,Mg=e=>!e.hidden,Ig=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?wi(St(e.nodeLookup,{filter:Mg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Tg="react-flow__minimap-desc";function vs({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:c,bgColor:a,maskColor:u,maskStrokeColor:f,maskStrokeWidth:l,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:w=!1,zoomable:E=!1,ariaLabel:_,inversePan:b,zoomStep:p=1,offsetScale:y=5}){const T=se(),k=G.useRef(null),{boundingRect:I,viewBB:H,rfId:F,panZoom:j,translateExtent:C,flowWidth:R,flowHeight:D,ariaLabelConfig:x}=re(Ig,ie),L=(e==null?void 0:e.width)??Cg,N=(e==null?void 0:e.height)??kg,P=I.width/L,A=I.height/N,O=Math.max(P,A),B=O*L,m=O*N,M=y*O,Y=I.x-(B-I.width)/2-M,S=I.y-(m-I.height)/2-M,v=B+M*2,$=m+M*2,z=`${Tg}-${F}`,V=G.useRef(0),X=G.useRef();V.current=O,G.useEffect(()=>{if(k.current&&j)return X.current=qf({domNode:k.current,panZoom:j,getTransform:()=>T.getState().transform,getViewScale:()=>V.current}),()=>{var Z;(Z=X.current)==null||Z.destroy()}},[j]),G.useEffect(()=>{var Z;(Z=X.current)==null||Z.update({translateExtent:C,width:R,height:D,inversePan:b,pannable:w,zoomStep:p,zoomable:E})},[w,E,b,p,C,R,D]);const q=h?Z=>{var ne;const[J,te]=((ne=X.current)==null?void 0:ne.pointer(Z))||[0,0];h(Z,{x:J,y:te})}:void 0,U=g?G.useCallback((Z,J)=>{const te=T.getState().nodeLookup.get(J).internals.userNode;g(Z,te)},[]):void 0,K=_??x["minimap.ariaLabel"];return W.jsx(gn,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof l=="number"?l*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:W.jsxs("svg",{width:L,height:N,viewBox:`${Y} ${S} ${v} ${$}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":z,ref:k,onClick:q,children:[K&&W.jsx("title",{id:z,children:K}),W.jsx(Sg,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:c}),W.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-M},${S-M}h${v+M*2}v${$+M*2}h${-v-M*2}z
|
|
47
|
-
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vs.displayName="MiniMap";const up=G.memo(vs),Ag=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Pg={[tt.Line]:"right",[tt.Handle]:"bottom-right"};function Og({nodeId:e,position:t,variant:n=tt.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:c=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:w,onResize:E,onResizeEnd:_}){const b=Zi(),p=typeof e=="string"?e:b,y=se(),T=G.useRef(null),k=n===tt.Handle,I=re(G.useCallback(Ag(k&&h),[k,h]),ie),H=G.useRef(null),F=t??Pg[n];G.useEffect(()=>{if(!(!T.current||!p))return H.current||(H.current=cd({domNode:T.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,domNode:N}=y.getState();return{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,paneDomNode:N}},onChange:(C,R)=>{const{triggerNodeChanges:D,nodeLookup:x,parentLookup:L,nodeOrigin:N}=y.getState(),P=[],A={x:C.x,y:C.y},O=x.get(p);if(O&&O.expandParent&&O.parentId){const B=O.origin??N,m=C.width??O.measured.width??0,M=C.height??O.measured.height??0,Y={id:O.id,parentId:O.parentId,rect:{width:m,height:M,...bi({x:C.x??O.position.x,y:C.y??O.position.y},{width:m,height:M},O.parentId,x,B)}},S=fr([Y],x,L,N);P.push(...S),A.x=C.x?Math.max(B[0]*m,C.x):void 0,A.y=C.y?Math.max(B[1]*M,C.y):void 0}if(A.x!==void 0&&A.y!==void 0){const B={id:p,type:"position",position:{...A}};P.push(B)}if(C.width!==void 0&&C.height!==void 0){const m={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:C.width,height:C.height}};P.push(m)}for(const B of R){const m={...B,type:"position"};P.push(m)}D(P)},onEnd:({width:C,height:R})=>{const D={id:p,type:"dimensions",resizing:!1,dimensions:{width:C,height:R}};y.getState().triggerNodeChanges([D])}})),H.current.update({controlPosition:F,boundaries:{minWidth:c,minHeight:a,maxWidth:u,maxHeight:f},keepAspectRatio:l,resizeDirection:d,onResizeStart:w,onResize:E,onResizeEnd:_,shouldResize:g}),()=>{var C;(C=H.current)==null||C.destroy()}},[F,c,a,u,f,l,w,E,_,g]);const j=F.split("-");return W.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...j,n,r]),ref:T,style:{...o,scale:I,...s&&{[k?"backgroundColor":"borderColor"]:s}},children:i})}G.memo(Og);var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ve=oe((e,t)=>{var n=Object.defineProperty,r=(D,x,L)=>x in D?n(D,x,{enumerable:!0,configurable:!0,writable:!0,value:L}):D[x]=L,o=(D,x)=>()=>(x||D((x={exports:{}}).exports,x),x.exports),i=(D,x,L)=>r(D,typeof x!="symbol"?x+"":x,L),s=o((D,x)=>{var L="\0",N="\0",P="",A=class{constructor(S){i(this,"_isDirected",!0),i(this,"_isMultigraph",!1),i(this,"_isCompound",!1),i(this,"_label"),i(this,"_defaultNodeLabelFn",()=>{}),i(this,"_defaultEdgeLabelFn",()=>{}),i(this,"_nodes",{}),i(this,"_in",{}),i(this,"_preds",{}),i(this,"_out",{}),i(this,"_sucs",{}),i(this,"_edgeObjs",{}),i(this,"_edgeLabels",{}),i(this,"_nodeCount",0),i(this,"_edgeCount",0),i(this,"_parent"),i(this,"_children"),S&&(this._isDirected=Object.hasOwn(S,"directed")?S.directed:!0,this._isMultigraph=Object.hasOwn(S,"multigraph")?S.multigraph:!1,this._isCompound=Object.hasOwn(S,"compound")?S.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[N]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(S){return this._label=S,this}graph(){return this._label}setDefaultNodeLabel(S){return this._defaultNodeLabelFn=S,typeof S!="function"&&(this._defaultNodeLabelFn=()=>S),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var S=this;return this.nodes().filter(v=>Object.keys(S._in[v]).length===0)}sinks(){var S=this;return this.nodes().filter(v=>Object.keys(S._out[v]).length===0)}setNodes(S,v){var $=arguments,z=this;return S.forEach(function(V){$.length>1?z.setNode(V,v):z.setNode(V)}),this}setNode(S,v){return Object.hasOwn(this._nodes,S)?(arguments.length>1&&(this._nodes[S]=v),this):(this._nodes[S]=arguments.length>1?v:this._defaultNodeLabelFn(S),this._isCompound&&(this._parent[S]=N,this._children[S]={},this._children[N][S]=!0),this._in[S]={},this._preds[S]={},this._out[S]={},this._sucs[S]={},++this._nodeCount,this)}node(S){return this._nodes[S]}hasNode(S){return Object.hasOwn(this._nodes,S)}removeNode(S){var v=this;if(Object.hasOwn(this._nodes,S)){var $=z=>v.removeEdge(v._edgeObjs[z]);delete this._nodes[S],this._isCompound&&(this._removeFromParentsChildList(S),delete this._parent[S],this.children(S).forEach(function(z){v.setParent(z)}),delete this._children[S]),Object.keys(this._in[S]).forEach($),delete this._in[S],delete this._preds[S],Object.keys(this._out[S]).forEach($),delete this._out[S],delete this._sucs[S],--this._nodeCount}return this}setParent(S,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=N;else{v+="";for(var $=v;$!==void 0;$=this.parent($))if($===S)throw new Error("Setting "+v+" as parent of "+S+" would create a cycle");this.setNode(v)}return this.setNode(S),this._removeFromParentsChildList(S),this._parent[S]=v,this._children[v][S]=!0,this}_removeFromParentsChildList(S){delete this._children[this._parent[S]][S]}parent(S){if(this._isCompound){var v=this._parent[S];if(v!==N)return v}}children(S=N){if(this._isCompound){var v=this._children[S];if(v)return Object.keys(v)}else{if(S===N)return this.nodes();if(this.hasNode(S))return[]}}predecessors(S){var v=this._preds[S];if(v)return Object.keys(v)}successors(S){var v=this._sucs[S];if(v)return Object.keys(v)}neighbors(S){var v=this.predecessors(S);if(v){let z=new Set(v);for(var $ of this.successors(S))z.add($);return Array.from(z.values())}}isLeaf(S){var v;return this.isDirected()?v=this.successors(S):v=this.neighbors(S),v.length===0}filterNodes(S){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var $=this;Object.entries(this._nodes).forEach(function([X,q]){S(X)&&v.setNode(X,q)}),Object.values(this._edgeObjs).forEach(function(X){v.hasNode(X.v)&&v.hasNode(X.w)&&v.setEdge(X,$.edge(X))});var z={};function V(X){var q=$.parent(X);return q===void 0||v.hasNode(q)?(z[X]=q,q):q in z?z[q]:V(q)}return this._isCompound&&v.nodes().forEach(X=>v.setParent(X,V(X))),v}setDefaultEdgeLabel(S){return this._defaultEdgeLabelFn=S,typeof S!="function"&&(this._defaultEdgeLabelFn=()=>S),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(S,v){var $=this,z=arguments;return S.reduce(function(V,X){return z.length>1?$.setEdge(V,X,v):$.setEdge(V,X),X}),this}setEdge(){var S,v,$,z,V=!1,X=arguments[0];typeof X=="object"&&X!==null&&"v"in X?(S=X.v,v=X.w,$=X.name,arguments.length===2&&(z=arguments[1],V=!0)):(S=X,v=arguments[1],$=arguments[3],arguments.length>2&&(z=arguments[2],V=!0)),S=""+S,v=""+v,$!==void 0&&($=""+$);var q=m(this._isDirected,S,v,$);if(Object.hasOwn(this._edgeLabels,q))return V&&(this._edgeLabels[q]=z),this;if($!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(S),this.setNode(v),this._edgeLabels[q]=V?z:this._defaultEdgeLabelFn(S,v,$);var U=M(this._isDirected,S,v,$);return S=U.v,v=U.w,Object.freeze(U),this._edgeObjs[q]=U,O(this._preds[v],S),O(this._sucs[S],v),this._in[v][q]=U,this._out[S][q]=U,this._edgeCount++,this}edge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return this._edgeLabels[z]}edgeAsObj(){let S=this.edge(...arguments);return typeof S!="object"?{label:S}:S}hasEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return Object.hasOwn(this._edgeLabels,z)}removeEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$),V=this._edgeObjs[z];return V&&(S=V.v,v=V.w,delete this._edgeLabels[z],delete this._edgeObjs[z],B(this._preds[v],S),B(this._sucs[S],v),delete this._in[v][z],delete this._out[S][z],this._edgeCount--),this}inEdges(S,v){return this.isDirected()?this.filterEdges(this._in[S],S,v):this.nodeEdges(S,v)}outEdges(S,v){return this.isDirected()?this.filterEdges(this._out[S],S,v):this.nodeEdges(S,v)}nodeEdges(S,v){if(S in this._nodes)return this.filterEdges({...this._in[S],...this._out[S]},S,v)}filterEdges(S,v,$){if(S){var z=Object.values(S);return $?z.filter(function(V){return V.v===v&&V.w===$||V.v===$&&V.w===v}):z}}};function O(S,v){S[v]?S[v]++:S[v]=1}function B(S,v){--S[v]||delete S[v]}function m(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}return V+P+X+P+(z===void 0?L:z)}function M(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}var U={v:V,w:X};return z&&(U.name=z),U}function Y(S,v){return m(S,v.v,v.w,v.name)}x.exports=A}),c=o((D,x)=>{x.exports="3.0.2"}),a=o((D,x)=>{x.exports={Graph:s(),version:c()}}),u=o((D,x)=>{var L=s();x.exports={write:N,read:O};function N(B){var m={options:{directed:B.isDirected(),multigraph:B.isMultigraph(),compound:B.isCompound()},nodes:P(B),edges:A(B)};return B.graph()!==void 0&&(m.value=structuredClone(B.graph())),m}function P(B){return B.nodes().map(function(m){var M=B.node(m),Y=B.parent(m),S={v:m};return M!==void 0&&(S.value=M),Y!==void 0&&(S.parent=Y),S})}function A(B){return B.edges().map(function(m){var M=B.edge(m),Y={v:m.v,w:m.w};return m.name!==void 0&&(Y.name=m.name),M!==void 0&&(Y.value=M),Y})}function O(B){var m=new L(B.options).setGraph(B.value);return B.nodes.forEach(function(M){m.setNode(M.v,M.value),M.parent&&m.setParent(M.v,M.parent)}),B.edges.forEach(function(M){m.setEdge({v:M.v,w:M.w,name:M.name},M.value)}),m}}),f=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B,m){return P(A,String(O),B||L,m||function(M){return A.outEdges(M)})}function P(A,O,B,m){var M={},Y=!0,S=0,v=A.nodes(),$=function(q){var U=B(q);M[q.v].distance+U<M[q.w].distance&&(M[q.w]={distance:M[q.v].distance+U,predecessor:q.v},Y=!0)},z=function(){v.forEach(function(q){m(q).forEach(function(U){var K=U.v===q?U.v:U.w,Z=K===U.v?U.w:U.v;$({v:K,w:Z})})})};v.forEach(function(q){var U=q===O?0:Number.POSITIVE_INFINITY;M[q]={distance:U}});for(var V=v.length,X=1;X<V&&(Y=!1,S++,z(),!!Y);X++);if(S===V-1&&(Y=!1,z(),Y))throw new Error("The graph contains a negative weight cycle");return M}}),l=o((D,x)=>{x.exports=L;function L(N){var P={},A=[],O;function B(m){Object.hasOwn(P,m)||(P[m]=!0,O.push(m),N.successors(m).forEach(B),N.predecessors(m).forEach(B))}return N.nodes().forEach(function(m){O=[],B(m),O.length&&A.push(O)}),A}}),d=o((D,x)=>{var L=class{constructor(){i(this,"_arr",[]),i(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(N){return N.key})}has(N){return Object.hasOwn(this._keyIndices,N)}priority(N){var P=this._keyIndices[N];if(P!==void 0)return this._arr[P].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(N,P){var A=this._keyIndices;if(N=String(N),!Object.hasOwn(A,N)){var O=this._arr,B=O.length;return A[N]=B,O.push({key:N,priority:P}),this._decrease(B),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var N=this._arr.pop();return delete this._keyIndices[N.key],this._heapify(0),N.key}decrease(N,P){var A=this._keyIndices[N];if(P>this._arr[A].priority)throw new Error("New priority is greater than current priority. Key: "+N+" Old: "+this._arr[A].priority+" New: "+P);this._arr[A].priority=P,this._decrease(A)}_heapify(N){var P=this._arr,A=2*N,O=A+1,B=N;A<P.length&&(B=P[A].priority<P[B].priority?A:B,O<P.length&&(B=P[O].priority<P[B].priority?O:B),B!==N&&(this._swap(N,B),this._heapify(B)))}_decrease(N){for(var P=this._arr,A=P[N].priority,O;N!==0&&(O=N>>1,!(P[O].priority<A));)this._swap(N,O),N=O}_swap(N,P){var A=this._arr,O=this._keyIndices,B=A[N],m=A[P];A[N]=m,A[P]=B,O[m.key]=N,O[B.key]=P}};x.exports=L}),h=o((D,x)=>{var L=d();x.exports=P;var N=()=>1;function P(O,B,m,M){var Y=function(S){return O.outEdges(S)};return A(O,String(B),m||N,M||Y)}function A(O,B,m,M){var Y={},S=new L,v,$,z=function(V){var X=V.v!==v?V.v:V.w,q=Y[X],U=m(V),K=$.distance+U;if(U<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+V+" Weight: "+U);K<q.distance&&(q.distance=K,q.predecessor=v,S.decrease(X,K))};for(O.nodes().forEach(function(V){var X=V===B?0:Number.POSITIVE_INFINITY;Y[V]={distance:X},S.add(V,X)});S.size()>0&&(v=S.removeMin(),$=Y[v],$.distance!==Number.POSITIVE_INFINITY);)M(v).forEach(z);return Y}}),g=o((D,x)=>{var L=h();x.exports=N;function N(P,A,O){return P.nodes().reduce(function(B,m){return B[m]=L(P,m,A,O),B},{})}}),w=o((D,x)=>{x.exports=L;function L(P,A,O){if(P[A].predecessor!==void 0)throw new Error("Invalid source vertex");if(P[O].predecessor===void 0&&O!==A)throw new Error("Invalid destination vertex");return{weight:P[O].distance,path:N(P,A,O)}}function N(P,A,O){for(var B=[],m=O;m!==A;)B.push(m),m=P[m].predecessor;return B.push(A),B.reverse()}}),E=o((D,x)=>{x.exports=L;function L(N){var P=0,A=[],O={},B=[];function m(M){var Y=O[M]={onStack:!0,lowlink:P,index:P++};if(A.push(M),N.successors(M).forEach(function($){Object.hasOwn(O,$)?O[$].onStack&&(Y.lowlink=Math.min(Y.lowlink,O[$].index)):(m($),Y.lowlink=Math.min(Y.lowlink,O[$].lowlink))}),Y.lowlink===Y.index){var S=[],v;do v=A.pop(),O[v].onStack=!1,S.push(v);while(M!==v);B.push(S)}}return N.nodes().forEach(function(M){Object.hasOwn(O,M)||m(M)}),B}}),_=o((D,x)=>{var L=E();x.exports=N;function N(P){return L(P).filter(function(A){return A.length>1||A.length===1&&P.hasEdge(A[0],A[0])})}}),b=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B){return P(A,O||L,B||function(m){return A.outEdges(m)})}function P(A,O,B){var m={},M=A.nodes();return M.forEach(function(Y){m[Y]={},m[Y][Y]={distance:0},M.forEach(function(S){Y!==S&&(m[Y][S]={distance:Number.POSITIVE_INFINITY})}),B(Y).forEach(function(S){var v=S.v===Y?S.w:S.v,$=O(S);m[Y][v]={distance:$,predecessor:Y}})}),M.forEach(function(Y){var S=m[Y];M.forEach(function(v){var $=m[v];M.forEach(function(z){var V=$[Y],X=S[z],q=$[z],U=V.distance+X.distance;U<q.distance&&(q.distance=U,q.predecessor=X.predecessor)})})}),m}}),p=o((D,x)=>{function L(P){var A={},O={},B=[];function m(M){if(Object.hasOwn(O,M))throw new N;Object.hasOwn(A,M)||(O[M]=!0,A[M]=!0,P.predecessors(M).forEach(m),delete O[M],B.push(M))}if(P.sinks().forEach(m),Object.keys(A).length!==P.nodeCount())throw new N;return B}var N=class extends Error{constructor(){super(...arguments)}};x.exports=L,L.CycleException=N}),y=o((D,x)=>{var L=p();x.exports=N;function N(P){try{L(P)}catch(A){if(A instanceof L.CycleException)return!1;throw A}return!0}}),T=o((D,x)=>{x.exports=L;function L(P,A,O,B,m){Array.isArray(A)||(A=[A]);var M=(P.isDirected()?P.successors:P.neighbors).bind(P),Y={};return A.forEach(function(S){if(!P.hasNode(S))throw new Error("Graph does not have node: "+S);m=N(P,S,O==="post",Y,M,B,m)}),m}function N(P,A,O,B,m,M,Y){return Object.hasOwn(B,A)||(B[A]=!0,O||(Y=M(Y,A)),m(A).forEach(function(S){Y=N(P,S,O,B,m,M,Y)}),O&&(Y=M(Y,A))),Y}}),k=o((D,x)=>{var L=T();x.exports=N;function N(P,A,O){return L(P,A,O,function(B,m){return B.push(m),B},[])}}),I=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"post")}}),H=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"pre")}}),F=o((D,x)=>{var L=s(),N=d();x.exports=P;function P(A,O){var B=new L,m={},M=new N,Y;function S($){var z=$.v===Y?$.w:$.v,V=M.priority(z);if(V!==void 0){var X=O($);X<V&&(m[z]=Y,M.decrease(z,X))}}if(A.nodeCount()===0)return B;A.nodes().forEach(function($){M.add($,Number.POSITIVE_INFINITY),B.setNode($)}),M.decrease(A.nodes()[0],0);for(var v=!1;M.size()>0;){if(Y=M.removeMin(),Object.hasOwn(m,Y))B.setEdge(Y,m[Y]);else{if(v)throw new Error("Input graph is not connected: "+A);v=!0}A.nodeEdges(Y).forEach(S)}return B}}),j=o((D,x)=>{var L=h(),N=f();x.exports=P;function P(O,B,m,M){return A(O,B,m,M||function(Y){return O.outEdges(Y)})}function A(O,B,m,M){if(m===void 0)return L(O,B,m,M);for(var Y=!1,S=O.nodes(),v=0;v<S.length;v++){for(var $=M(S[v]),z=0;z<$.length;z++){var V=$[z],X=V.v===S[v]?V.v:V.w,q=X===V.v?V.w:V.v;m({v:X,w:q})<0&&(Y=!0)}if(Y)return N(O,B,m,M)}return L(O,B,m,M)}}),C=o((D,x)=>{x.exports={bellmanFord:f(),components:l(),dijkstra:h(),dijkstraAll:g(),extractPath:w(),findCycles:_(),floydWarshall:b(),isAcyclic:y(),postorder:I(),preorder:H(),prim:F(),shortestPaths:j(),reduce:T(),tarjan:E(),topsort:p()}}),R=a();t.exports={Graph:R.Graph,json:u(),alg:C(),version:R.version}}),Rg=oe((e,t)=>{var n=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,s=i._prev;if(s!==i)return r(s),s}enqueue(i){let s=this._sentinel;i._prev&&i._next&&r(i),i._next=s._next,s._next._prev=i,s._next=i,i._prev=s}toString(){let i=[],s=this._sentinel,c=s._prev;for(;c!==s;)i.push(JSON.stringify(c,o)),c=c._prev;return"["+i.join(", ")+"]"}};function r(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function o(i,s){if(i!=="_next"&&i!=="_prev")return s}t.exports=n}),$g=oe((e,t)=>{var n=ve().Graph,r=Rg();t.exports=i;var o=()=>1;function i(l,d){if(l.nodeCount()<=1)return[];let h=a(l,d||o);return s(h.graph,h.buckets,h.zeroIdx).flatMap(g=>l.outEdges(g.v,g.w))}function s(l,d,h){let g=[],w=d[d.length-1],E=d[0],_;for(;l.nodeCount();){for(;_=E.dequeue();)c(l,d,h,_);for(;_=w.dequeue();)c(l,d,h,_);if(l.nodeCount()){for(let b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){g=g.concat(c(l,d,h,_,!0));break}}}return g}function c(l,d,h,g,w){let E=w?[]:void 0;return l.inEdges(g.v).forEach(_=>{let b=l.edge(_),p=l.node(_.v);w&&E.push({v:_.v,w:_.w}),p.out-=b,u(d,h,p)}),l.outEdges(g.v).forEach(_=>{let b=l.edge(_),p=_.w,y=l.node(p);y.in-=b,u(d,h,y)}),l.removeNode(g.v),E}function a(l,d){let h=new n,g=0,w=0;l.nodes().forEach(b=>{h.setNode(b,{v:b,in:0,out:0})}),l.edges().forEach(b=>{let p=h.edge(b.v,b.w)||0,y=d(b),T=p+y;h.setEdge(b.v,b.w,T),w=Math.max(w,h.node(b.v).out+=y),g=Math.max(g,h.node(b.w).in+=y)});let E=f(w+g+3).map(()=>new r),_=g+1;return h.nodes().forEach(b=>{u(E,_,h.node(b))}),{graph:h,buckets:E,zeroIdx:_}}function u(l,d,h){h.out?h.in?l[h.out-h.in+d].enqueue(h):l[l.length-1].enqueue(h):l[0].enqueue(h)}function f(l){let d=[];for(let h=0;h<l;h++)d.push(h);return d}}),ae=oe((e,t)=>{var n=ve().Graph;t.exports={addBorderNode:d,addDummyNode:r,applyWithChunking:w,asNonCompoundGraph:i,buildLayerMatrix:u,intersectRect:a,mapValues:H,maxRank:E,normalizeRanks:f,notime:p,partition:_,pick:I,predecessorWeights:c,range:k,removeEmptyRanks:l,simplify:o,successorWeights:s,time:b,uniqueId:T,zipObject:F};function r(j,C,R,D){for(var x=D;j.hasNode(x);)x=T(D);return R.dummy=C,j.setNode(x,R),x}function o(j){let C=new n().setGraph(j.graph());return j.nodes().forEach(R=>C.setNode(R,j.node(R))),j.edges().forEach(R=>{let D=C.edge(R.v,R.w)||{weight:0,minlen:1},x=j.edge(R);C.setEdge(R.v,R.w,{weight:D.weight+x.weight,minlen:Math.max(D.minlen,x.minlen)})}),C}function i(j){let C=new n({multigraph:j.isMultigraph()}).setGraph(j.graph());return j.nodes().forEach(R=>{j.children(R).length||C.setNode(R,j.node(R))}),j.edges().forEach(R=>{C.setEdge(R,j.edge(R))}),C}function s(j){let C=j.nodes().map(R=>{let D={};return j.outEdges(R).forEach(x=>{D[x.w]=(D[x.w]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function c(j){let C=j.nodes().map(R=>{let D={};return j.inEdges(R).forEach(x=>{D[x.v]=(D[x.v]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function a(j,C){let R=j.x,D=j.y,x=C.x-R,L=C.y-D,N=j.width/2,P=j.height/2;if(!x&&!L)throw new Error("Not possible to find intersection inside of the rectangle");let A,O;return Math.abs(L)*N>Math.abs(x)*P?(L<0&&(P=-P),A=P*x/L,O=P):(x<0&&(N=-N),A=N,O=N*L/x),{x:R+A,y:D+O}}function u(j){let C=k(E(j)+1).map(()=>[]);return j.nodes().forEach(R=>{let D=j.node(R),x=D.rank;x!==void 0&&(C[x][D.order]=R)}),C}function f(j){let C=j.nodes().map(D=>{let x=j.node(D).rank;return x===void 0?Number.MAX_VALUE:x}),R=w(Math.min,C);j.nodes().forEach(D=>{let x=j.node(D);Object.hasOwn(x,"rank")&&(x.rank-=R)})}function l(j){let C=j.nodes().map(N=>j.node(N).rank).filter(N=>N!==void 0),R=w(Math.min,C),D=[];j.nodes().forEach(N=>{let P=j.node(N).rank-R;D[P]||(D[P]=[]),D[P].push(N)});let x=0,L=j.graph().nodeRankFactor;Array.from(D).forEach((N,P)=>{N===void 0&&P%L!==0?--x:N!==void 0&&x&&N.forEach(A=>j.node(A).rank+=x)})}function d(j,C,R,D){let x={width:0,height:0};return arguments.length>=4&&(x.rank=R,x.order=D),r(j,"border",x,C)}function h(j,C=g){let R=[];for(let D=0;D<j.length;D+=C){let x=j.slice(D,D+C);R.push(x)}return R}var g=65535;function w(j,C){if(C.length>g){let R=h(C);return j.apply(null,R.map(D=>j.apply(null,D)))}else return j.apply(null,C)}function E(j){let C=j.nodes().map(R=>{let D=j.node(R).rank;return D===void 0?Number.MIN_VALUE:D});return w(Math.max,C)}function _(j,C){let R={lhs:[],rhs:[]};return j.forEach(D=>{C(D)?R.lhs.push(D):R.rhs.push(D)}),R}function b(j,C){let R=Date.now();try{return C()}finally{console.log(j+" time: "+(Date.now()-R)+"ms")}}function p(j,C){return C()}var y=0;function T(j){var C=++y;return j+(""+C)}function k(j,C,R=1){C==null&&(C=j,j=0);let D=L=>L<C;R<0&&(D=L=>C<L);let x=[];for(let L=j;D(L);L+=R)x.push(L);return x}function I(j,C){let R={};for(let D of C)j[D]!==void 0&&(R[D]=j[D]);return R}function H(j,C){let R=C;return typeof C=="string"&&(R=D=>D[C]),Object.entries(j).reduce((D,[x,L])=>(D[x]=R(L,x),D),{})}function F(j,C){return j.reduce((R,D,x)=>(R[D]=C[x],R),{})}}),Lg=oe((e,t)=>{var n=$g(),r=ae().uniqueId;t.exports={run:o,undo:s};function o(c){(c.graph().acyclicer==="greedy"?n(c,a(c)):i(c)).forEach(u=>{let f=c.edge(u);c.removeEdge(u),f.forwardName=u.name,f.reversed=!0,c.setEdge(u.w,u.v,f,r("rev"))});function a(u){return f=>u.edge(f).weight}}function i(c){let a=[],u={},f={};function l(d){Object.hasOwn(f,d)||(f[d]=!0,u[d]=!0,c.outEdges(d).forEach(h=>{Object.hasOwn(u,h.w)?a.push(h):l(h.w)}),delete u[d])}return c.nodes().forEach(l),a}function s(c){c.edges().forEach(a=>{let u=c.edge(a);if(u.reversed){c.removeEdge(a);let f=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(a.w,a.v,u,f)}})}}),Dg=oe((e,t)=>{var n=ae();t.exports={run:r,undo:i};function r(s){s.graph().dummyChains=[],s.edges().forEach(c=>o(s,c))}function o(s,c){let a=c.v,u=s.node(a).rank,f=c.w,l=s.node(f).rank,d=c.name,h=s.edge(c),g=h.labelRank;if(l===u+1)return;s.removeEdge(c);let w,E,_;for(_=0,++u;u<l;++_,++u)h.points=[],E={width:0,height:0,edgeLabel:h,edgeObj:c,rank:u},w=n.addDummyNode(s,"edge",E,"_d"),u===g&&(E.width=h.width,E.height=h.height,E.dummy="edge-label",E.labelpos=h.labelpos),s.setEdge(a,w,{weight:h.weight},d),_===0&&s.graph().dummyChains.push(w),a=w;s.setEdge(a,f,{weight:h.weight},d)}function i(s){s.graph().dummyChains.forEach(c=>{let a=s.node(c),u=a.edgeLabel,f;for(s.setEdge(a.edgeObj,u);a.dummy;)f=s.successors(c)[0],s.removeNode(c),u.points.push({x:a.x,y:a.y}),a.dummy==="edge-label"&&(u.x=a.x,u.y=a.y,u.width=a.width,u.height=a.height),c=f,a=s.node(c)})}}),nn=oe((e,t)=>{var{applyWithChunking:n}=ae();t.exports={longestPath:r,slack:o};function r(i){var s={};function c(a){var u=i.node(a);if(Object.hasOwn(s,a))return u.rank;s[a]=!0;let f=i.outEdges(a).map(d=>d==null?Number.POSITIVE_INFINITY:c(d.w)-i.edge(d).minlen);var l=n(Math.min,f);return l===Number.POSITIVE_INFINITY&&(l=0),u.rank=l}i.sources().forEach(c)}function o(i,s){return i.node(s.w).rank-i.node(s.v).rank-i.edge(s).minlen}}),ws=oe((e,t)=>{var n=ve().Graph,r=nn().slack;t.exports=o;function o(a){var u=new n({directed:!1}),f=a.nodes()[0],l=a.nodeCount();u.setNode(f,{});for(var d,h;i(u,a)<l;)d=s(u,a),h=u.hasNode(d.v)?r(a,d):-r(a,d),c(u,a,h);return u}function i(a,u){function f(l){u.nodeEdges(l).forEach(d=>{var h=d.v,g=l===h?d.w:h;!a.hasNode(g)&&!r(u,d)&&(a.setNode(g,{}),a.setEdge(l,g,{}),f(g))})}return a.nodes().forEach(f),a.nodeCount()}function s(a,u){return u.edges().reduce((f,l)=>{let d=Number.POSITIVE_INFINITY;return a.hasNode(l.v)!==a.hasNode(l.w)&&(d=r(u,l)),d<f[0]?[d,l]:f},[Number.POSITIVE_INFINITY,null])[1]}function c(a,u,f){a.nodes().forEach(l=>u.node(l).rank+=f)}}),jg=oe((e,t)=>{var n=ws(),r=nn().slack,o=nn().longestPath,i=ve().alg.preorder,s=ve().alg.postorder,c=ae().simplify;t.exports=a,a.initLowLimValues=d,a.initCutValues=u,a.calcCutValue=l,a.leaveEdge=g,a.enterEdge=w,a.exchangeEdges=E;function a(y){y=c(y),o(y);var T=n(y);d(T),u(T,y);for(var k,I;k=g(T);)I=w(T,y,k),E(T,y,k,I)}function u(y,T){var k=s(y,y.nodes());k=k.slice(0,k.length-1),k.forEach(I=>f(y,T,I))}function f(y,T,k){var I=y.node(k),H=I.parent;y.edge(k,H).cutvalue=l(y,T,k)}function l(y,T,k){var I=y.node(k),H=I.parent,F=!0,j=T.edge(k,H),C=0;return j||(F=!1,j=T.edge(H,k)),C=j.weight,T.nodeEdges(k).forEach(R=>{var D=R.v===k,x=D?R.w:R.v;if(x!==H){var L=D===F,N=T.edge(R).weight;if(C+=L?N:-N,b(y,k,x)){var P=y.edge(k,x).cutvalue;C+=L?-P:P}}}),C}function d(y,T){arguments.length<2&&(T=y.nodes()[0]),h(y,{},1,T)}function h(y,T,k,I,H){var F=k,j=y.node(I);return T[I]=!0,y.neighbors(I).forEach(C=>{Object.hasOwn(T,C)||(k=h(y,T,k,C,I))}),j.low=F,j.lim=k++,H?j.parent=H:delete j.parent,k}function g(y){return y.edges().find(T=>y.edge(T).cutvalue<0)}function w(y,T,k){var I=k.v,H=k.w;T.hasEdge(I,H)||(I=k.w,H=k.v);var F=y.node(I),j=y.node(H),C=F,R=!1;F.lim>j.lim&&(C=j,R=!0);var D=T.edges().filter(x=>R===p(y,y.node(x.v),C)&&R!==p(y,y.node(x.w),C));return D.reduce((x,L)=>r(T,L)<r(T,x)?L:x)}function E(y,T,k,I){var H=k.v,F=k.w;y.removeEdge(H,F),y.setEdge(I.v,I.w,{}),d(y),u(y,T),_(y,T)}function _(y,T){var k=y.nodes().find(H=>!T.node(H).parent),I=i(y,k);I=I.slice(1),I.forEach(H=>{var F=y.node(H).parent,j=T.edge(H,F),C=!1;j||(j=T.edge(F,H),C=!0),T.node(H).rank=T.node(F).rank+(C?j.minlen:-j.minlen)})}function b(y,T,k){return y.hasEdge(T,k)}function p(y,T,k){return k.low<=T.lim&&T.lim<=k.lim}}),zg=oe((e,t)=>{var n=nn(),r=n.longestPath,o=ws(),i=jg();t.exports=s;function s(f){var l=f.graph().ranker;if(l instanceof Function)return l(f);switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":a(f);break;case"longest-path":c(f);break;case"none":break;default:u(f)}}var c=r;function a(f){r(f),o(f)}function u(f){i(f)}}),Hg=oe((e,t)=>{t.exports=n;function n(i){let s=o(i);i.graph().dummyChains.forEach(c=>{let a=i.node(c),u=a.edgeObj,f=r(i,s,u.v,u.w),l=f.path,d=f.lca,h=0,g=l[h],w=!0;for(;c!==u.w;){if(a=i.node(c),w){for(;(g=l[h])!==d&&i.node(g).maxRank<a.rank;)h++;g===d&&(w=!1)}if(!w){for(;h<l.length-1&&i.node(g=l[h+1]).minRank<=a.rank;)h++;g=l[h]}i.setParent(c,g),c=i.successors(c)[0]}})}function r(i,s,c,a){let u=[],f=[],l=Math.min(s[c].low,s[a].low),d=Math.max(s[c].lim,s[a].lim),h,g;h=c;do h=i.parent(h),u.push(h);while(h&&(s[h].low>l||d>s[h].lim));for(g=h,h=a;(h=i.parent(h))!==g;)f.push(h);return{path:u.concat(f.reverse()),lca:g}}function o(i){let s={},c=0;function a(u){let f=c;i.children(u).forEach(a),s[u]={low:f,lim:c++}}return i.children().forEach(a),s}}),Vg=oe((e,t)=>{var n=ae();t.exports={run:r,cleanup:c};function r(a){let u=n.addDummyNode(a,"root",{},"_root"),f=i(a),l=Object.values(f),d=n.applyWithChunking(Math.max,l)-1,h=2*d+1;a.graph().nestingRoot=u,a.edges().forEach(w=>a.edge(w).minlen*=h);let g=s(a)+1;a.children().forEach(w=>o(a,u,h,g,d,f,w)),a.graph().nodeRankFactor=h}function o(a,u,f,l,d,h,g){let w=a.children(g);if(!w.length){g!==u&&a.setEdge(u,g,{weight:0,minlen:f});return}let E=n.addBorderNode(a,"_bt"),_=n.addBorderNode(a,"_bb"),b=a.node(g);a.setParent(E,g),b.borderTop=E,a.setParent(_,g),b.borderBottom=_,w.forEach(p=>{o(a,u,f,l,d,h,p);let y=a.node(p),T=y.borderTop?y.borderTop:p,k=y.borderBottom?y.borderBottom:p,I=y.borderTop?l:2*l,H=T!==k?1:d-h[g]+1;a.setEdge(E,T,{weight:I,minlen:H,nestingEdge:!0}),a.setEdge(k,_,{weight:I,minlen:H,nestingEdge:!0})}),a.parent(g)||a.setEdge(u,E,{weight:0,minlen:d+h[g]})}function i(a){var u={};function f(l,d){var h=a.children(l);h&&h.length&&h.forEach(g=>f(g,d+1)),u[l]=d}return a.children().forEach(l=>f(l,1)),u}function s(a){return a.edges().reduce((u,f)=>u+a.edge(f).weight,0)}function c(a){var u=a.graph();a.removeNode(u.nestingRoot),delete u.nestingRoot,a.edges().forEach(f=>{var l=a.edge(f);l.nestingEdge&&a.removeEdge(f)})}}),Bg=oe((e,t)=>{var n=ae();t.exports=r;function r(i){function s(c){let a=i.children(c),u=i.node(c);if(a.length&&a.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let f=u.minRank,l=u.maxRank+1;f<l;++f)o(i,"borderLeft","_bl",c,u,f),o(i,"borderRight","_br",c,u,f)}}i.children().forEach(s)}function o(i,s,c,a,u,f){let l={width:0,height:0,rank:f,borderType:s},d=u[s][f-1],h=n.addDummyNode(i,"border",l,c);u[s][f]=h,i.setParent(h,a),d&&i.setEdge(d,h,{weight:1})}}),Fg=oe((e,t)=>{t.exports={adjust:n,undo:r};function n(f){let l=f.graph().rankdir.toLowerCase();(l==="lr"||l==="rl")&&o(f)}function r(f){let l=f.graph().rankdir.toLowerCase();(l==="bt"||l==="rl")&&s(f),(l==="lr"||l==="rl")&&(a(f),o(f))}function o(f){f.nodes().forEach(l=>i(f.node(l))),f.edges().forEach(l=>i(f.edge(l)))}function i(f){let l=f.width;f.width=f.height,f.height=l}function s(f){f.nodes().forEach(l=>c(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(c),Object.hasOwn(d,"y")&&c(d)})}function c(f){f.y=-f.y}function a(f){f.nodes().forEach(l=>u(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(u),Object.hasOwn(d,"x")&&u(d)})}function u(f){let l=f.x;f.x=f.y,f.y=l}}),Yg=oe((e,t)=>{var n=ae();t.exports=r;function r(o){let i={},s=o.nodes().filter(l=>!o.children(l).length),c=s.map(l=>o.node(l).rank),a=n.applyWithChunking(Math.max,c),u=n.range(a+1).map(()=>[]);function f(l){if(i[l])return;i[l]=!0;let d=o.node(l);u[d.rank].push(l),o.successors(l).forEach(f)}return s.sort((l,d)=>o.node(l).rank-o.node(d).rank).forEach(f),u}}),Xg=oe((e,t)=>{var n=ae().zipObject;t.exports=r;function r(i,s){let c=0;for(let a=1;a<s.length;++a)c+=o(i,s[a-1],s[a]);return c}function o(i,s,c){let a=n(c,c.map((g,w)=>w)),u=s.flatMap(g=>i.outEdges(g).map(w=>({pos:a[w.w],weight:i.edge(w).weight})).sort((w,E)=>w.pos-E.pos)),f=1;for(;f<c.length;)f<<=1;let l=2*f-1;f-=1;let d=new Array(l).fill(0),h=0;return u.forEach(g=>{let w=g.pos+f;d[w]+=g.weight;let E=0;for(;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=g.weight;h+=g.weight*E}),h}}),Wg=oe((e,t)=>{t.exports=n;function n(r,o=[]){return o.map(i=>{let s=r.inEdges(i);if(s.length){let c=s.reduce((a,u)=>{let f=r.edge(u),l=r.node(u.v);return{sum:a.sum+f.weight*l.order,weight:a.weight+f.weight}},{sum:0,weight:0});return{v:i,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:i}})}}),Gg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a={};s.forEach((f,l)=>{let d=a[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:l};f.barycenter!==void 0&&(d.barycenter=f.barycenter,d.weight=f.weight)}),c.edges().forEach(f=>{let l=a[f.v],d=a[f.w];l!==void 0&&d!==void 0&&(d.indegree++,l.out.push(a[f.w]))});let u=Object.values(a).filter(f=>!f.indegree);return o(u)}function o(s){let c=[];function a(f){return l=>{l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&i(f,l)}}function u(f){return l=>{l.in.push(f),--l.indegree===0&&s.push(l)}}for(;s.length;){let f=s.pop();c.push(f),f.in.reverse().forEach(a(f)),f.out.forEach(u(f))}return c.filter(f=>!f.merged).map(f=>n.pick(f,["vs","i","barycenter","weight"]))}function i(s,c){let a=0,u=0;s.weight&&(a+=s.barycenter*s.weight,u+=s.weight),c.weight&&(a+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=a/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),qg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a=n.partition(s,E=>Object.hasOwn(E,"barycenter")),u=a.lhs,f=a.rhs.sort((E,_)=>_.i-E.i),l=[],d=0,h=0,g=0;u.sort(i(!!c)),g=o(l,f,g),u.forEach(E=>{g+=E.vs.length,l.push(E.vs),d+=E.barycenter*E.weight,h+=E.weight,g=o(l,f,g)});let w={vs:l.flat(!0)};return h&&(w.barycenter=d/h,w.weight=h),w}function o(s,c,a){let u;for(;c.length&&(u=c[c.length-1]).i<=a;)c.pop(),s.push(u.vs),a++;return a}function i(s){return(c,a)=>c.barycenter<a.barycenter?-1:c.barycenter>a.barycenter?1:s?a.i-c.i:c.i-a.i}}),Ug=oe((e,t)=>{var n=Wg(),r=Gg(),o=qg();t.exports=i;function i(a,u,f,l){let d=a.children(u),h=a.node(u),g=h?h.borderLeft:void 0,w=h?h.borderRight:void 0,E={};g&&(d=d.filter(y=>y!==g&&y!==w));let _=n(a,d);_.forEach(y=>{if(a.children(y.v).length){let T=i(a,y.v,f,l);E[y.v]=T,Object.hasOwn(T,"barycenter")&&c(y,T)}});let b=r(_,f);s(b,E);let p=o(b,l);if(g&&(p.vs=[g,p.vs,w].flat(!0),a.predecessors(g).length)){let y=a.node(a.predecessors(g)[0]),T=a.node(a.predecessors(w)[0]);Object.hasOwn(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.order+T.order)/(p.weight+2),p.weight+=2}return p}function s(a,u){a.forEach(f=>{f.vs=f.vs.flatMap(l=>u[l]?u[l].vs:l)})}function c(a,u){a.barycenter!==void 0?(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight):(a.barycenter=u.barycenter,a.weight=u.weight)}}),Kg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports=o;function o(s,c,a,u){u||(u=s.nodes());let f=i(s),l=new n({compound:!0}).setGraph({root:f}).setDefaultNodeLabel(d=>s.node(d));return u.forEach(d=>{let h=s.node(d),g=s.parent(d);(h.rank===c||h.minRank<=c&&c<=h.maxRank)&&(l.setNode(d),l.setParent(d,g||f),s[a](d).forEach(w=>{let E=w.v===d?w.w:w.v,_=l.edge(E,d),b=_!==void 0?_.weight:0;l.setEdge(E,d,{weight:s.edge(w).weight+b})}),Object.hasOwn(h,"minRank")&&l.setNode(d,{borderLeft:h.borderLeft[c],borderRight:h.borderRight[c]}))}),l}function i(s){for(var c;s.hasNode(c=r.uniqueId("_root")););return c}}),Zg=oe((e,t)=>{t.exports=n;function n(r,o,i){let s={},c;i.forEach(a=>{let u=r.parent(a),f,l;for(;u;){if(f=r.parent(u),f?(l=s[f],s[f]=u):(l=c,c=u),l&&l!==u){o.setEdge(l,u);return}u=f}})}}),Qg=oe((e,t)=>{var n=Yg(),r=Xg(),o=Ug(),i=Kg(),s=Zg(),c=ve().Graph,a=ae();t.exports=u;function u(h,g={}){if(typeof g.customOrder=="function"){g.customOrder(h,u);return}let w=a.maxRank(h),E=f(h,a.range(1,w+1),"inEdges"),_=f(h,a.range(w-1,-1,-1),"outEdges"),b=n(h);if(d(h,b),g.disableOptimalOrderHeuristic)return;let p=Number.POSITIVE_INFINITY,y,T=g.constraints||[];for(let k=0,I=0;I<4;++k,++I){l(k%2?E:_,k%4>=2,T),b=a.buildLayerMatrix(h);let H=r(h,b);H<p?(I=0,y=Object.assign({},b),p=H):H===p&&(y=structuredClone(b))}d(h,y)}function f(h,g,w){let E=new Map,_=(b,p)=>{E.has(b)||E.set(b,[]),E.get(b).push(p)};for(let b of h.nodes()){let p=h.node(b);if(typeof p.rank=="number"&&_(p.rank,b),typeof p.minRank=="number"&&typeof p.maxRank=="number")for(let y=p.minRank;y<=p.maxRank;y++)y!==p.rank&&_(y,b)}return g.map(function(b){return i(h,b,w,E.get(b)||[])})}function l(h,g,w){let E=new c;h.forEach(function(_){w.forEach(y=>E.setEdge(y.left,y.right));let b=_.graph().root,p=o(_,b,E,g);p.vs.forEach((y,T)=>_.node(y).order=T),s(_,E,p.vs)})}function d(h,g){Object.values(g).forEach(w=>w.forEach((E,_)=>h.node(E).order=_))}}),Jg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports={positionX:w,findType1Conflicts:o,findType2Conflicts:i,addConflict:c,hasConflict:a,verticalAlignment:u,horizontalCompaction:f,alignCoordinates:h,findSmallestWidthAlignment:d,balance:g};function o(b,p){let y={};function T(k,I){let H=0,F=0,j=k.length,C=I[I.length-1];return I.forEach((R,D)=>{let x=s(b,R),L=x?b.node(x).order:j;(x||R===C)&&(I.slice(F,D+1).forEach(N=>{b.predecessors(N).forEach(P=>{let A=b.node(P),O=A.order;(O<H||L<O)&&!(A.dummy&&b.node(N).dummy)&&c(y,P,N)})}),F=D+1,H=L)}),I}return p.length&&p.reduce(T),y}function i(b,p){let y={};function T(I,H,F,j,C){let R;r.range(H,F).forEach(D=>{R=I[D],b.node(R).dummy&&b.predecessors(R).forEach(x=>{let L=b.node(x);L.dummy&&(L.order<j||L.order>C)&&c(y,x,R)})})}function k(I,H){let F=-1,j,C=0;return H.forEach((R,D)=>{if(b.node(R).dummy==="border"){let x=b.predecessors(R);x.length&&(j=b.node(x[0]).order,T(H,C,D,F,j),C=D,F=j)}T(H,C,H.length,j,I.length)}),H}return p.length&&p.reduce(k),y}function s(b,p){if(b.node(p).dummy)return b.predecessors(p).find(y=>b.node(y).dummy)}function c(b,p,y){if(p>y){let k=p;p=y,y=k}let T=b[p];T||(b[p]=T={}),T[y]=!0}function a(b,p,y){if(p>y){let T=p;p=y,y=T}return!!b[p]&&Object.hasOwn(b[p],y)}function u(b,p,y,T){let k={},I={},H={};return p.forEach(F=>{F.forEach((j,C)=>{k[j]=j,I[j]=j,H[j]=C})}),p.forEach(F=>{let j=-1;F.forEach(C=>{let R=T(C);if(R.length){R=R.sort((x,L)=>H[x]-H[L]);let D=(R.length-1)/2;for(let x=Math.floor(D),L=Math.ceil(D);x<=L;++x){let N=R[x];I[C]===C&&j<H[N]&&!a(y,C,N)&&(I[N]=C,I[C]=k[C]=k[N],j=H[N])}}})}),{root:k,align:I}}function f(b,p,y,T,k){let I={},H=l(b,p,y,k),F=k?"borderLeft":"borderRight";function j(D,x){let L=H.nodes().slice(),N={},P=L.pop();for(;P;){if(N[P])D(P);else{N[P]=!0,L.push(P);for(let A of x(P))L.push(A)}P=L.pop()}}function C(D){I[D]=H.inEdges(D).reduce((x,L)=>Math.max(x,I[L.v]+H.edge(L)),0)}function R(D){let x=H.outEdges(D).reduce((N,P)=>Math.min(N,I[P.w]-H.edge(P)),Number.POSITIVE_INFINITY),L=b.node(D);x!==Number.POSITIVE_INFINITY&&L.borderType!==F&&(I[D]=Math.max(I[D],x))}return j(C,H.predecessors.bind(H)),j(R,H.successors.bind(H)),Object.keys(T).forEach(D=>I[D]=I[y[D]]),I}function l(b,p,y,T){let k=new n,I=b.graph(),H=E(I.nodesep,I.edgesep,T);return p.forEach(F=>{let j;F.forEach(C=>{let R=y[C];if(k.setNode(R),j){var D=y[j],x=k.edge(D,R);k.setEdge(D,R,Math.max(H(b,C,j),x||0))}j=C})}),k}function d(b,p){return Object.values(p).reduce((y,T)=>{let k=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;Object.entries(T).forEach(([F,j])=>{let C=_(b,F)/2;k=Math.max(j+C,k),I=Math.min(j-C,I)});let H=k-I;return H<y[0]&&(y=[H,T]),y},[Number.POSITIVE_INFINITY,null])[1]}function h(b,p){let y=Object.values(p),T=r.applyWithChunking(Math.min,y),k=r.applyWithChunking(Math.max,y);["u","d"].forEach(I=>{["l","r"].forEach(H=>{let F=I+H,j=b[F];if(j===p)return;let C=Object.values(j),R=T-r.applyWithChunking(Math.min,C);H!=="l"&&(R=k-r.applyWithChunking(Math.max,C)),R&&(b[F]=r.mapValues(j,D=>D+R))})})}function g(b,p){return r.mapValues(b.ul,(y,T)=>{if(p)return b[p.toLowerCase()][T];{let k=Object.values(b).map(I=>I[T]).sort((I,H)=>I-H);return(k[1]+k[2])/2}})}function w(b){let p=r.buildLayerMatrix(b),y=Object.assign(o(b,p),i(b,p)),T={},k;["u","d"].forEach(H=>{k=H==="u"?p:Object.values(p).reverse(),["l","r"].forEach(F=>{F==="r"&&(k=k.map(D=>Object.values(D).reverse()));let j=(H==="u"?b.predecessors:b.successors).bind(b),C=u(b,k,y,j),R=f(b,k,C.root,C.align,F==="r");F==="r"&&(R=r.mapValues(R,D=>-D)),T[H+F]=R})});let I=d(b,T);return h(T,I),g(T,b.graph().align)}function E(b,p,y){return(T,k,I)=>{let H=T.node(k),F=T.node(I),j=0,C;if(j+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":C=-H.width/2;break;case"r":C=H.width/2;break}if(C&&(j+=y?C:-C),C=0,j+=(H.dummy?p:b)/2,j+=(F.dummy?p:b)/2,j+=F.width/2,Object.hasOwn(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":C=F.width/2;break;case"r":C=-F.width/2;break}return C&&(j+=y?C:-C),C=0,j}}function _(b,p){return b.node(p).width}}),ep=oe((e,t)=>{var n=ae(),r=Jg().positionX;t.exports=o;function o(s){s=n.asNonCompoundGraph(s),i(s),Object.entries(r(s)).forEach(([c,a])=>s.node(c).x=a)}function i(s){let c=n.buildLayerMatrix(s),a=s.graph().ranksep,u=s.graph().rankalign,f=0;c.forEach(l=>{let d=l.reduce((h,g)=>{let w=s.node(g).height;return h>w?h:w},0);l.forEach(h=>{let g=s.node(h);u==="top"?g.y=f+g.height/2:u==="bottom"?g.y=f+d-g.height/2:g.y=f+d/2}),f+=d+a})}}),tp=oe((e,t)=>{var n=Lg(),r=Dg(),o=zg(),i=ae().normalizeRanks,s=Hg(),c=ae().removeEmptyRanks,a=Vg(),u=Bg(),f=Fg(),l=Qg(),d=ep(),h=ae(),g=ve().Graph;t.exports=w;function w(v,$={}){let z=$.debugTiming?h.time:h.notime;return z("layout",()=>{let V=z(" buildLayoutGraph",()=>j(v));return z(" runLayout",()=>E(V,z,$)),z(" updateInputGraph",()=>_(v,V)),V})}function E(v,$,z){$(" makeSpaceForEdgeLabels",()=>C(v)),$(" removeSelfEdges",()=>B(v)),$(" acyclic",()=>n.run(v)),$(" nestingGraph.run",()=>a.run(v)),$(" rank",()=>o(h.asNonCompoundGraph(v))),$(" injectEdgeLabelProxies",()=>R(v)),$(" removeEmptyRanks",()=>c(v)),$(" nestingGraph.cleanup",()=>a.cleanup(v)),$(" normalizeRanks",()=>i(v)),$(" assignRankMinMax",()=>D(v)),$(" removeEdgeLabelProxies",()=>x(v)),$(" normalize.run",()=>r.run(v)),$(" parentDummyChains",()=>s(v)),$(" addBorderSegments",()=>u(v)),$(" order",()=>l(v,z)),$(" insertSelfEdges",()=>m(v)),$(" adjustCoordinateSystem",()=>f.adjust(v)),$(" position",()=>d(v)),$(" positionSelfEdges",()=>M(v)),$(" removeBorderNodes",()=>O(v)),$(" normalize.undo",()=>r.undo(v)),$(" fixupEdgeLabelCoords",()=>P(v)),$(" undoCoordinateSystem",()=>f.undo(v)),$(" translateGraph",()=>L(v)),$(" assignNodeIntersects",()=>N(v)),$(" reversePoints",()=>A(v)),$(" acyclic.undo",()=>n.undo(v))}function _(v,$){v.nodes().forEach(z=>{let V=v.node(z),X=$.node(z);V&&(V.x=X.x,V.y=X.y,V.order=X.order,V.rank=X.rank,$.children(z).length&&(V.width=X.width,V.height=X.height))}),v.edges().forEach(z=>{let V=v.edge(z),X=$.edge(z);V.points=X.points,Object.hasOwn(X,"x")&&(V.x=X.x,V.y=X.y)}),v.graph().width=$.graph().width,v.graph().height=$.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},y=["acyclicer","ranker","rankdir","align","rankalign"],T=["width","height","rank"],k={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],H={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function j(v){let $=new g({multigraph:!0,compound:!0}),z=S(v.graph());return $.setGraph(Object.assign({},p,Y(z,b),h.pick(z,y))),v.nodes().forEach(V=>{let X=S(v.node(V)),q=Y(X,T);Object.keys(k).forEach(U=>{q[U]===void 0&&(q[U]=k[U])}),$.setNode(V,q),$.setParent(V,v.parent(V))}),v.edges().forEach(V=>{let X=S(v.edge(V));$.setEdge(V,Object.assign({},H,Y(X,I),h.pick(X,F)))}),$}function C(v){let $=v.graph();$.ranksep/=2,v.edges().forEach(z=>{let V=v.edge(z);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&($.rankdir==="TB"||$.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function R(v){v.edges().forEach($=>{let z=v.edge($);if(z.width&&z.height){let V=v.node($.v),X={rank:(v.node($.w).rank-V.rank)/2+V.rank,e:$};h.addDummyNode(v,"edge-proxy",X,"_ep")}})}function D(v){let $=0;v.nodes().forEach(z=>{let V=v.node(z);V.borderTop&&(V.minRank=v.node(V.borderTop).rank,V.maxRank=v.node(V.borderBottom).rank,$=Math.max($,V.maxRank))}),v.graph().maxRank=$}function x(v){v.nodes().forEach($=>{let z=v.node($);z.dummy==="edge-proxy"&&(v.edge(z.e).labelRank=z.rank,v.removeNode($))})}function L(v){let $=Number.POSITIVE_INFINITY,z=0,V=Number.POSITIVE_INFINITY,X=0,q=v.graph(),U=q.marginx||0,K=q.marginy||0;function Z(J){let te=J.x,ne=J.y,ue=J.width,ge=J.height;$=Math.min($,te-ue/2),z=Math.max(z,te+ue/2),V=Math.min(V,ne-ge/2),X=Math.max(X,ne+ge/2)}v.nodes().forEach(J=>Z(v.node(J))),v.edges().forEach(J=>{let te=v.edge(J);Object.hasOwn(te,"x")&&Z(te)}),$-=U,V-=K,v.nodes().forEach(J=>{let te=v.node(J);te.x-=$,te.y-=V}),v.edges().forEach(J=>{let te=v.edge(J);te.points.forEach(ne=>{ne.x-=$,ne.y-=V}),Object.hasOwn(te,"x")&&(te.x-=$),Object.hasOwn(te,"y")&&(te.y-=V)}),q.width=z-$+U,q.height=X-V+K}function N(v){v.edges().forEach($=>{let z=v.edge($),V=v.node($.v),X=v.node($.w),q,U;z.points?(q=z.points[0],U=z.points[z.points.length-1]):(z.points=[],q=X,U=V),z.points.unshift(h.intersectRect(V,q)),z.points.push(h.intersectRect(X,U))})}function P(v){v.edges().forEach($=>{let z=v.edge($);if(Object.hasOwn(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function A(v){v.edges().forEach($=>{let z=v.edge($);z.reversed&&z.points.reverse()})}function O(v){v.nodes().forEach($=>{if(v.children($).length){let z=v.node($),V=v.node(z.borderTop),X=v.node(z.borderBottom),q=v.node(z.borderLeft[z.borderLeft.length-1]),U=v.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(U.x-q.x),z.height=Math.abs(X.y-V.y),z.x=q.x+z.width/2,z.y=V.y+z.height/2}}),v.nodes().forEach($=>{v.node($).dummy==="border"&&v.removeNode($)})}function B(v){v.edges().forEach($=>{if($.v===$.w){var z=v.node($.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:$,label:v.edge($)}),v.removeEdge($)}})}function m(v){var $=h.buildLayerMatrix(v);$.forEach(z=>{var V=0;z.forEach((X,q)=>{var U=v.node(X);U.order=q+V,(U.selfEdges||[]).forEach(K=>{h.addDummyNode(v,"selfedge",{width:K.label.width,height:K.label.height,rank:U.rank,order:q+ ++V,e:K.e,label:K.label},"_se")}),delete U.selfEdges})})}function M(v){v.nodes().forEach($=>{var z=v.node($);if(z.dummy==="selfedge"){var V=v.node(z.e.v),X=V.x+V.width/2,q=V.y,U=z.x-X,K=V.height/2;v.setEdge(z.e,z.label),v.removeNode($),z.label.points=[{x:X+2*U/3,y:q-K},{x:X+5*U/6,y:q-K},{x:X+U,y:q},{x:X+5*U/6,y:q+K},{x:X+2*U/3,y:q+K}],z.label.x=z.x,z.label.y=z.y}})}function Y(v,$){return h.mapValues(h.pick(v,$),Number)}function S(v){var $={};return v&&Object.entries(v).forEach(([z,V])=>{typeof z=="string"&&(z=z.toLowerCase()),$[z]=V}),$}}),np=oe((e,t)=>{var n=ae(),r=ve().Graph;t.exports={debugOrdering:o};function o(i){let s=n.buildLayerMatrix(i),c=new r({compound:!0,multigraph:!0}).setGraph({});return i.nodes().forEach(a=>{c.setNode(a,{label:a}),c.setParent(a,"layer"+i.node(a).rank)}),i.edges().forEach(a=>c.setEdge(a.v,a.w,{},a.name)),s.forEach((a,u)=>{let f="layer"+u;c.setNode(f,{rank:"same"}),a.reduce((l,d)=>(c.setEdge(l,d,{style:"invis"}),d))}),c}}),rp=oe((e,t)=>{t.exports="2.0.4"}),op=oe((e,t)=>{t.exports={graphlib:ve(),layout:tp(),debug:np(),util:{time:ae().time,notime:ae().notime},version:rp()}});const lp=op();/*! For license information please see dagre.esm.js.LEGAL.txt */export{ap as B,cp as C,en as H,up as M,Q as P,Ia as a,G as b,Oe as c,lp as d,ip as e,Zt as f,$o as g,on as h,sp as i,W as j,Ko as k,un as l,rn as r,de as s,ii as t,fi as z};
|
|
47
|
+
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vs.displayName="MiniMap";const up=G.memo(vs),Ag=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Pg={[tt.Line]:"right",[tt.Handle]:"bottom-right"};function Og({nodeId:e,position:t,variant:n=tt.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:c=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:w,onResize:E,onResizeEnd:_}){const b=Zi(),p=typeof e=="string"?e:b,y=se(),T=G.useRef(null),k=n===tt.Handle,I=re(G.useCallback(Ag(k&&h),[k,h]),ie),H=G.useRef(null),F=t??Pg[n];G.useEffect(()=>{if(!(!T.current||!p))return H.current||(H.current=cd({domNode:T.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,domNode:N}=y.getState();return{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,paneDomNode:N}},onChange:(C,R)=>{const{triggerNodeChanges:D,nodeLookup:x,parentLookup:L,nodeOrigin:N}=y.getState(),P=[],A={x:C.x,y:C.y},O=x.get(p);if(O&&O.expandParent&&O.parentId){const B=O.origin??N,m=C.width??O.measured.width??0,M=C.height??O.measured.height??0,Y={id:O.id,parentId:O.parentId,rect:{width:m,height:M,...bi({x:C.x??O.position.x,y:C.y??O.position.y},{width:m,height:M},O.parentId,x,B)}},S=fr([Y],x,L,N);P.push(...S),A.x=C.x?Math.max(B[0]*m,C.x):void 0,A.y=C.y?Math.max(B[1]*M,C.y):void 0}if(A.x!==void 0&&A.y!==void 0){const B={id:p,type:"position",position:{...A}};P.push(B)}if(C.width!==void 0&&C.height!==void 0){const m={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:C.width,height:C.height}};P.push(m)}for(const B of R){const m={...B,type:"position"};P.push(m)}D(P)},onEnd:({width:C,height:R})=>{const D={id:p,type:"dimensions",resizing:!1,dimensions:{width:C,height:R}};y.getState().triggerNodeChanges([D])}})),H.current.update({controlPosition:F,boundaries:{minWidth:c,minHeight:a,maxWidth:u,maxHeight:f},keepAspectRatio:l,resizeDirection:d,onResizeStart:w,onResize:E,onResizeEnd:_,shouldResize:g}),()=>{var C;(C=H.current)==null||C.destroy()}},[F,c,a,u,f,l,w,E,_,g]);const j=F.split("-");return W.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...j,n,r]),ref:T,style:{...o,scale:I,...s&&{[k?"backgroundColor":"borderColor"]:s}},children:i})}G.memo(Og);var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ve=oe((e,t)=>{var n=Object.defineProperty,r=(D,x,L)=>x in D?n(D,x,{enumerable:!0,configurable:!0,writable:!0,value:L}):D[x]=L,o=(D,x)=>()=>(x||D((x={exports:{}}).exports,x),x.exports),i=(D,x,L)=>r(D,typeof x!="symbol"?x+"":x,L),s=o((D,x)=>{var L="\0",N="\0",P="",A=class{constructor(S){i(this,"_isDirected",!0),i(this,"_isMultigraph",!1),i(this,"_isCompound",!1),i(this,"_label"),i(this,"_defaultNodeLabelFn",()=>{}),i(this,"_defaultEdgeLabelFn",()=>{}),i(this,"_nodes",{}),i(this,"_in",{}),i(this,"_preds",{}),i(this,"_out",{}),i(this,"_sucs",{}),i(this,"_edgeObjs",{}),i(this,"_edgeLabels",{}),i(this,"_nodeCount",0),i(this,"_edgeCount",0),i(this,"_parent"),i(this,"_children"),S&&(this._isDirected=Object.hasOwn(S,"directed")?S.directed:!0,this._isMultigraph=Object.hasOwn(S,"multigraph")?S.multigraph:!1,this._isCompound=Object.hasOwn(S,"compound")?S.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[N]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(S){return this._label=S,this}graph(){return this._label}setDefaultNodeLabel(S){return this._defaultNodeLabelFn=S,typeof S!="function"&&(this._defaultNodeLabelFn=()=>S),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var S=this;return this.nodes().filter(v=>Object.keys(S._in[v]).length===0)}sinks(){var S=this;return this.nodes().filter(v=>Object.keys(S._out[v]).length===0)}setNodes(S,v){var $=arguments,z=this;return S.forEach(function(V){$.length>1?z.setNode(V,v):z.setNode(V)}),this}setNode(S,v){return Object.hasOwn(this._nodes,S)?(arguments.length>1&&(this._nodes[S]=v),this):(this._nodes[S]=arguments.length>1?v:this._defaultNodeLabelFn(S),this._isCompound&&(this._parent[S]=N,this._children[S]={},this._children[N][S]=!0),this._in[S]={},this._preds[S]={},this._out[S]={},this._sucs[S]={},++this._nodeCount,this)}node(S){return this._nodes[S]}hasNode(S){return Object.hasOwn(this._nodes,S)}removeNode(S){var v=this;if(Object.hasOwn(this._nodes,S)){var $=z=>v.removeEdge(v._edgeObjs[z]);delete this._nodes[S],this._isCompound&&(this._removeFromParentsChildList(S),delete this._parent[S],this.children(S).forEach(function(z){v.setParent(z)}),delete this._children[S]),Object.keys(this._in[S]).forEach($),delete this._in[S],delete this._preds[S],Object.keys(this._out[S]).forEach($),delete this._out[S],delete this._sucs[S],--this._nodeCount}return this}setParent(S,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=N;else{v+="";for(var $=v;$!==void 0;$=this.parent($))if($===S)throw new Error("Setting "+v+" as parent of "+S+" would create a cycle");this.setNode(v)}return this.setNode(S),this._removeFromParentsChildList(S),this._parent[S]=v,this._children[v][S]=!0,this}_removeFromParentsChildList(S){delete this._children[this._parent[S]][S]}parent(S){if(this._isCompound){var v=this._parent[S];if(v!==N)return v}}children(S=N){if(this._isCompound){var v=this._children[S];if(v)return Object.keys(v)}else{if(S===N)return this.nodes();if(this.hasNode(S))return[]}}predecessors(S){var v=this._preds[S];if(v)return Object.keys(v)}successors(S){var v=this._sucs[S];if(v)return Object.keys(v)}neighbors(S){var v=this.predecessors(S);if(v){let z=new Set(v);for(var $ of this.successors(S))z.add($);return Array.from(z.values())}}isLeaf(S){var v;return this.isDirected()?v=this.successors(S):v=this.neighbors(S),v.length===0}filterNodes(S){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var $=this;Object.entries(this._nodes).forEach(function([X,q]){S(X)&&v.setNode(X,q)}),Object.values(this._edgeObjs).forEach(function(X){v.hasNode(X.v)&&v.hasNode(X.w)&&v.setEdge(X,$.edge(X))});var z={};function V(X){var q=$.parent(X);return q===void 0||v.hasNode(q)?(z[X]=q,q):q in z?z[q]:V(q)}return this._isCompound&&v.nodes().forEach(X=>v.setParent(X,V(X))),v}setDefaultEdgeLabel(S){return this._defaultEdgeLabelFn=S,typeof S!="function"&&(this._defaultEdgeLabelFn=()=>S),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(S,v){var $=this,z=arguments;return S.reduce(function(V,X){return z.length>1?$.setEdge(V,X,v):$.setEdge(V,X),X}),this}setEdge(){var S,v,$,z,V=!1,X=arguments[0];typeof X=="object"&&X!==null&&"v"in X?(S=X.v,v=X.w,$=X.name,arguments.length===2&&(z=arguments[1],V=!0)):(S=X,v=arguments[1],$=arguments[3],arguments.length>2&&(z=arguments[2],V=!0)),S=""+S,v=""+v,$!==void 0&&($=""+$);var q=m(this._isDirected,S,v,$);if(Object.hasOwn(this._edgeLabels,q))return V&&(this._edgeLabels[q]=z),this;if($!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(S),this.setNode(v),this._edgeLabels[q]=V?z:this._defaultEdgeLabelFn(S,v,$);var U=M(this._isDirected,S,v,$);return S=U.v,v=U.w,Object.freeze(U),this._edgeObjs[q]=U,O(this._preds[v],S),O(this._sucs[S],v),this._in[v][q]=U,this._out[S][q]=U,this._edgeCount++,this}edge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return this._edgeLabels[z]}edgeAsObj(){let S=this.edge(...arguments);return typeof S!="object"?{label:S}:S}hasEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return Object.hasOwn(this._edgeLabels,z)}removeEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$),V=this._edgeObjs[z];return V&&(S=V.v,v=V.w,delete this._edgeLabels[z],delete this._edgeObjs[z],B(this._preds[v],S),B(this._sucs[S],v),delete this._in[v][z],delete this._out[S][z],this._edgeCount--),this}inEdges(S,v){return this.isDirected()?this.filterEdges(this._in[S],S,v):this.nodeEdges(S,v)}outEdges(S,v){return this.isDirected()?this.filterEdges(this._out[S],S,v):this.nodeEdges(S,v)}nodeEdges(S,v){if(S in this._nodes)return this.filterEdges({...this._in[S],...this._out[S]},S,v)}filterEdges(S,v,$){if(S){var z=Object.values(S);return $?z.filter(function(V){return V.v===v&&V.w===$||V.v===$&&V.w===v}):z}}};function O(S,v){S[v]?S[v]++:S[v]=1}function B(S,v){--S[v]||delete S[v]}function m(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}return V+P+X+P+(z===void 0?L:z)}function M(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}var U={v:V,w:X};return z&&(U.name=z),U}function Y(S,v){return m(S,v.v,v.w,v.name)}x.exports=A}),c=o((D,x)=>{x.exports="3.0.2"}),a=o((D,x)=>{x.exports={Graph:s(),version:c()}}),u=o((D,x)=>{var L=s();x.exports={write:N,read:O};function N(B){var m={options:{directed:B.isDirected(),multigraph:B.isMultigraph(),compound:B.isCompound()},nodes:P(B),edges:A(B)};return B.graph()!==void 0&&(m.value=structuredClone(B.graph())),m}function P(B){return B.nodes().map(function(m){var M=B.node(m),Y=B.parent(m),S={v:m};return M!==void 0&&(S.value=M),Y!==void 0&&(S.parent=Y),S})}function A(B){return B.edges().map(function(m){var M=B.edge(m),Y={v:m.v,w:m.w};return m.name!==void 0&&(Y.name=m.name),M!==void 0&&(Y.value=M),Y})}function O(B){var m=new L(B.options).setGraph(B.value);return B.nodes.forEach(function(M){m.setNode(M.v,M.value),M.parent&&m.setParent(M.v,M.parent)}),B.edges.forEach(function(M){m.setEdge({v:M.v,w:M.w,name:M.name},M.value)}),m}}),f=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B,m){return P(A,String(O),B||L,m||function(M){return A.outEdges(M)})}function P(A,O,B,m){var M={},Y=!0,S=0,v=A.nodes(),$=function(q){var U=B(q);M[q.v].distance+U<M[q.w].distance&&(M[q.w]={distance:M[q.v].distance+U,predecessor:q.v},Y=!0)},z=function(){v.forEach(function(q){m(q).forEach(function(U){var K=U.v===q?U.v:U.w,Z=K===U.v?U.w:U.v;$({v:K,w:Z})})})};v.forEach(function(q){var U=q===O?0:Number.POSITIVE_INFINITY;M[q]={distance:U}});for(var V=v.length,X=1;X<V&&(Y=!1,S++,z(),!!Y);X++);if(S===V-1&&(Y=!1,z(),Y))throw new Error("The graph contains a negative weight cycle");return M}}),l=o((D,x)=>{x.exports=L;function L(N){var P={},A=[],O;function B(m){Object.hasOwn(P,m)||(P[m]=!0,O.push(m),N.successors(m).forEach(B),N.predecessors(m).forEach(B))}return N.nodes().forEach(function(m){O=[],B(m),O.length&&A.push(O)}),A}}),d=o((D,x)=>{var L=class{constructor(){i(this,"_arr",[]),i(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(N){return N.key})}has(N){return Object.hasOwn(this._keyIndices,N)}priority(N){var P=this._keyIndices[N];if(P!==void 0)return this._arr[P].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(N,P){var A=this._keyIndices;if(N=String(N),!Object.hasOwn(A,N)){var O=this._arr,B=O.length;return A[N]=B,O.push({key:N,priority:P}),this._decrease(B),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var N=this._arr.pop();return delete this._keyIndices[N.key],this._heapify(0),N.key}decrease(N,P){var A=this._keyIndices[N];if(P>this._arr[A].priority)throw new Error("New priority is greater than current priority. Key: "+N+" Old: "+this._arr[A].priority+" New: "+P);this._arr[A].priority=P,this._decrease(A)}_heapify(N){var P=this._arr,A=2*N,O=A+1,B=N;A<P.length&&(B=P[A].priority<P[B].priority?A:B,O<P.length&&(B=P[O].priority<P[B].priority?O:B),B!==N&&(this._swap(N,B),this._heapify(B)))}_decrease(N){for(var P=this._arr,A=P[N].priority,O;N!==0&&(O=N>>1,!(P[O].priority<A));)this._swap(N,O),N=O}_swap(N,P){var A=this._arr,O=this._keyIndices,B=A[N],m=A[P];A[N]=m,A[P]=B,O[m.key]=N,O[B.key]=P}};x.exports=L}),h=o((D,x)=>{var L=d();x.exports=P;var N=()=>1;function P(O,B,m,M){var Y=function(S){return O.outEdges(S)};return A(O,String(B),m||N,M||Y)}function A(O,B,m,M){var Y={},S=new L,v,$,z=function(V){var X=V.v!==v?V.v:V.w,q=Y[X],U=m(V),K=$.distance+U;if(U<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+V+" Weight: "+U);K<q.distance&&(q.distance=K,q.predecessor=v,S.decrease(X,K))};for(O.nodes().forEach(function(V){var X=V===B?0:Number.POSITIVE_INFINITY;Y[V]={distance:X},S.add(V,X)});S.size()>0&&(v=S.removeMin(),$=Y[v],$.distance!==Number.POSITIVE_INFINITY);)M(v).forEach(z);return Y}}),g=o((D,x)=>{var L=h();x.exports=N;function N(P,A,O){return P.nodes().reduce(function(B,m){return B[m]=L(P,m,A,O),B},{})}}),w=o((D,x)=>{x.exports=L;function L(P,A,O){if(P[A].predecessor!==void 0)throw new Error("Invalid source vertex");if(P[O].predecessor===void 0&&O!==A)throw new Error("Invalid destination vertex");return{weight:P[O].distance,path:N(P,A,O)}}function N(P,A,O){for(var B=[],m=O;m!==A;)B.push(m),m=P[m].predecessor;return B.push(A),B.reverse()}}),E=o((D,x)=>{x.exports=L;function L(N){var P=0,A=[],O={},B=[];function m(M){var Y=O[M]={onStack:!0,lowlink:P,index:P++};if(A.push(M),N.successors(M).forEach(function($){Object.hasOwn(O,$)?O[$].onStack&&(Y.lowlink=Math.min(Y.lowlink,O[$].index)):(m($),Y.lowlink=Math.min(Y.lowlink,O[$].lowlink))}),Y.lowlink===Y.index){var S=[],v;do v=A.pop(),O[v].onStack=!1,S.push(v);while(M!==v);B.push(S)}}return N.nodes().forEach(function(M){Object.hasOwn(O,M)||m(M)}),B}}),_=o((D,x)=>{var L=E();x.exports=N;function N(P){return L(P).filter(function(A){return A.length>1||A.length===1&&P.hasEdge(A[0],A[0])})}}),b=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B){return P(A,O||L,B||function(m){return A.outEdges(m)})}function P(A,O,B){var m={},M=A.nodes();return M.forEach(function(Y){m[Y]={},m[Y][Y]={distance:0},M.forEach(function(S){Y!==S&&(m[Y][S]={distance:Number.POSITIVE_INFINITY})}),B(Y).forEach(function(S){var v=S.v===Y?S.w:S.v,$=O(S);m[Y][v]={distance:$,predecessor:Y}})}),M.forEach(function(Y){var S=m[Y];M.forEach(function(v){var $=m[v];M.forEach(function(z){var V=$[Y],X=S[z],q=$[z],U=V.distance+X.distance;U<q.distance&&(q.distance=U,q.predecessor=X.predecessor)})})}),m}}),p=o((D,x)=>{function L(P){var A={},O={},B=[];function m(M){if(Object.hasOwn(O,M))throw new N;Object.hasOwn(A,M)||(O[M]=!0,A[M]=!0,P.predecessors(M).forEach(m),delete O[M],B.push(M))}if(P.sinks().forEach(m),Object.keys(A).length!==P.nodeCount())throw new N;return B}var N=class extends Error{constructor(){super(...arguments)}};x.exports=L,L.CycleException=N}),y=o((D,x)=>{var L=p();x.exports=N;function N(P){try{L(P)}catch(A){if(A instanceof L.CycleException)return!1;throw A}return!0}}),T=o((D,x)=>{x.exports=L;function L(P,A,O,B,m){Array.isArray(A)||(A=[A]);var M=(P.isDirected()?P.successors:P.neighbors).bind(P),Y={};return A.forEach(function(S){if(!P.hasNode(S))throw new Error("Graph does not have node: "+S);m=N(P,S,O==="post",Y,M,B,m)}),m}function N(P,A,O,B,m,M,Y){return Object.hasOwn(B,A)||(B[A]=!0,O||(Y=M(Y,A)),m(A).forEach(function(S){Y=N(P,S,O,B,m,M,Y)}),O&&(Y=M(Y,A))),Y}}),k=o((D,x)=>{var L=T();x.exports=N;function N(P,A,O){return L(P,A,O,function(B,m){return B.push(m),B},[])}}),I=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"post")}}),H=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"pre")}}),F=o((D,x)=>{var L=s(),N=d();x.exports=P;function P(A,O){var B=new L,m={},M=new N,Y;function S($){var z=$.v===Y?$.w:$.v,V=M.priority(z);if(V!==void 0){var X=O($);X<V&&(m[z]=Y,M.decrease(z,X))}}if(A.nodeCount()===0)return B;A.nodes().forEach(function($){M.add($,Number.POSITIVE_INFINITY),B.setNode($)}),M.decrease(A.nodes()[0],0);for(var v=!1;M.size()>0;){if(Y=M.removeMin(),Object.hasOwn(m,Y))B.setEdge(Y,m[Y]);else{if(v)throw new Error("Input graph is not connected: "+A);v=!0}A.nodeEdges(Y).forEach(S)}return B}}),j=o((D,x)=>{var L=h(),N=f();x.exports=P;function P(O,B,m,M){return A(O,B,m,M||function(Y){return O.outEdges(Y)})}function A(O,B,m,M){if(m===void 0)return L(O,B,m,M);for(var Y=!1,S=O.nodes(),v=0;v<S.length;v++){for(var $=M(S[v]),z=0;z<$.length;z++){var V=$[z],X=V.v===S[v]?V.v:V.w,q=X===V.v?V.w:V.v;m({v:X,w:q})<0&&(Y=!0)}if(Y)return N(O,B,m,M)}return L(O,B,m,M)}}),C=o((D,x)=>{x.exports={bellmanFord:f(),components:l(),dijkstra:h(),dijkstraAll:g(),extractPath:w(),findCycles:_(),floydWarshall:b(),isAcyclic:y(),postorder:I(),preorder:H(),prim:F(),shortestPaths:j(),reduce:T(),tarjan:E(),topsort:p()}}),R=a();t.exports={Graph:R.Graph,json:u(),alg:C(),version:R.version}}),Rg=oe((e,t)=>{var n=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,s=i._prev;if(s!==i)return r(s),s}enqueue(i){let s=this._sentinel;i._prev&&i._next&&r(i),i._next=s._next,s._next._prev=i,s._next=i,i._prev=s}toString(){let i=[],s=this._sentinel,c=s._prev;for(;c!==s;)i.push(JSON.stringify(c,o)),c=c._prev;return"["+i.join(", ")+"]"}};function r(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function o(i,s){if(i!=="_next"&&i!=="_prev")return s}t.exports=n}),$g=oe((e,t)=>{var n=ve().Graph,r=Rg();t.exports=i;var o=()=>1;function i(l,d){if(l.nodeCount()<=1)return[];let h=a(l,d||o);return s(h.graph,h.buckets,h.zeroIdx).flatMap(g=>l.outEdges(g.v,g.w))}function s(l,d,h){let g=[],w=d[d.length-1],E=d[0],_;for(;l.nodeCount();){for(;_=E.dequeue();)c(l,d,h,_);for(;_=w.dequeue();)c(l,d,h,_);if(l.nodeCount()){for(let b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){g=g.concat(c(l,d,h,_,!0));break}}}return g}function c(l,d,h,g,w){let E=w?[]:void 0;return l.inEdges(g.v).forEach(_=>{let b=l.edge(_),p=l.node(_.v);w&&E.push({v:_.v,w:_.w}),p.out-=b,u(d,h,p)}),l.outEdges(g.v).forEach(_=>{let b=l.edge(_),p=_.w,y=l.node(p);y.in-=b,u(d,h,y)}),l.removeNode(g.v),E}function a(l,d){let h=new n,g=0,w=0;l.nodes().forEach(b=>{h.setNode(b,{v:b,in:0,out:0})}),l.edges().forEach(b=>{let p=h.edge(b.v,b.w)||0,y=d(b),T=p+y;h.setEdge(b.v,b.w,T),w=Math.max(w,h.node(b.v).out+=y),g=Math.max(g,h.node(b.w).in+=y)});let E=f(w+g+3).map(()=>new r),_=g+1;return h.nodes().forEach(b=>{u(E,_,h.node(b))}),{graph:h,buckets:E,zeroIdx:_}}function u(l,d,h){h.out?h.in?l[h.out-h.in+d].enqueue(h):l[l.length-1].enqueue(h):l[0].enqueue(h)}function f(l){let d=[];for(let h=0;h<l;h++)d.push(h);return d}}),ae=oe((e,t)=>{var n=ve().Graph;t.exports={addBorderNode:d,addDummyNode:r,applyWithChunking:w,asNonCompoundGraph:i,buildLayerMatrix:u,intersectRect:a,mapValues:H,maxRank:E,normalizeRanks:f,notime:p,partition:_,pick:I,predecessorWeights:c,range:k,removeEmptyRanks:l,simplify:o,successorWeights:s,time:b,uniqueId:T,zipObject:F};function r(j,C,R,D){for(var x=D;j.hasNode(x);)x=T(D);return R.dummy=C,j.setNode(x,R),x}function o(j){let C=new n().setGraph(j.graph());return j.nodes().forEach(R=>C.setNode(R,j.node(R))),j.edges().forEach(R=>{let D=C.edge(R.v,R.w)||{weight:0,minlen:1},x=j.edge(R);C.setEdge(R.v,R.w,{weight:D.weight+x.weight,minlen:Math.max(D.minlen,x.minlen)})}),C}function i(j){let C=new n({multigraph:j.isMultigraph()}).setGraph(j.graph());return j.nodes().forEach(R=>{j.children(R).length||C.setNode(R,j.node(R))}),j.edges().forEach(R=>{C.setEdge(R,j.edge(R))}),C}function s(j){let C=j.nodes().map(R=>{let D={};return j.outEdges(R).forEach(x=>{D[x.w]=(D[x.w]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function c(j){let C=j.nodes().map(R=>{let D={};return j.inEdges(R).forEach(x=>{D[x.v]=(D[x.v]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function a(j,C){let R=j.x,D=j.y,x=C.x-R,L=C.y-D,N=j.width/2,P=j.height/2;if(!x&&!L)throw new Error("Not possible to find intersection inside of the rectangle");let A,O;return Math.abs(L)*N>Math.abs(x)*P?(L<0&&(P=-P),A=P*x/L,O=P):(x<0&&(N=-N),A=N,O=N*L/x),{x:R+A,y:D+O}}function u(j){let C=k(E(j)+1).map(()=>[]);return j.nodes().forEach(R=>{let D=j.node(R),x=D.rank;x!==void 0&&(C[x][D.order]=R)}),C}function f(j){let C=j.nodes().map(D=>{let x=j.node(D).rank;return x===void 0?Number.MAX_VALUE:x}),R=w(Math.min,C);j.nodes().forEach(D=>{let x=j.node(D);Object.hasOwn(x,"rank")&&(x.rank-=R)})}function l(j){let C=j.nodes().map(N=>j.node(N).rank).filter(N=>N!==void 0),R=w(Math.min,C),D=[];j.nodes().forEach(N=>{let P=j.node(N).rank-R;D[P]||(D[P]=[]),D[P].push(N)});let x=0,L=j.graph().nodeRankFactor;Array.from(D).forEach((N,P)=>{N===void 0&&P%L!==0?--x:N!==void 0&&x&&N.forEach(A=>j.node(A).rank+=x)})}function d(j,C,R,D){let x={width:0,height:0};return arguments.length>=4&&(x.rank=R,x.order=D),r(j,"border",x,C)}function h(j,C=g){let R=[];for(let D=0;D<j.length;D+=C){let x=j.slice(D,D+C);R.push(x)}return R}var g=65535;function w(j,C){if(C.length>g){let R=h(C);return j.apply(null,R.map(D=>j.apply(null,D)))}else return j.apply(null,C)}function E(j){let C=j.nodes().map(R=>{let D=j.node(R).rank;return D===void 0?Number.MIN_VALUE:D});return w(Math.max,C)}function _(j,C){let R={lhs:[],rhs:[]};return j.forEach(D=>{C(D)?R.lhs.push(D):R.rhs.push(D)}),R}function b(j,C){let R=Date.now();try{return C()}finally{console.log(j+" time: "+(Date.now()-R)+"ms")}}function p(j,C){return C()}var y=0;function T(j){var C=++y;return j+(""+C)}function k(j,C,R=1){C==null&&(C=j,j=0);let D=L=>L<C;R<0&&(D=L=>C<L);let x=[];for(let L=j;D(L);L+=R)x.push(L);return x}function I(j,C){let R={};for(let D of C)j[D]!==void 0&&(R[D]=j[D]);return R}function H(j,C){let R=C;return typeof C=="string"&&(R=D=>D[C]),Object.entries(j).reduce((D,[x,L])=>(D[x]=R(L,x),D),{})}function F(j,C){return j.reduce((R,D,x)=>(R[D]=C[x],R),{})}}),Lg=oe((e,t)=>{var n=$g(),r=ae().uniqueId;t.exports={run:o,undo:s};function o(c){(c.graph().acyclicer==="greedy"?n(c,a(c)):i(c)).forEach(u=>{let f=c.edge(u);c.removeEdge(u),f.forwardName=u.name,f.reversed=!0,c.setEdge(u.w,u.v,f,r("rev"))});function a(u){return f=>u.edge(f).weight}}function i(c){let a=[],u={},f={};function l(d){Object.hasOwn(f,d)||(f[d]=!0,u[d]=!0,c.outEdges(d).forEach(h=>{Object.hasOwn(u,h.w)?a.push(h):l(h.w)}),delete u[d])}return c.nodes().forEach(l),a}function s(c){c.edges().forEach(a=>{let u=c.edge(a);if(u.reversed){c.removeEdge(a);let f=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(a.w,a.v,u,f)}})}}),Dg=oe((e,t)=>{var n=ae();t.exports={run:r,undo:i};function r(s){s.graph().dummyChains=[],s.edges().forEach(c=>o(s,c))}function o(s,c){let a=c.v,u=s.node(a).rank,f=c.w,l=s.node(f).rank,d=c.name,h=s.edge(c),g=h.labelRank;if(l===u+1)return;s.removeEdge(c);let w,E,_;for(_=0,++u;u<l;++_,++u)h.points=[],E={width:0,height:0,edgeLabel:h,edgeObj:c,rank:u},w=n.addDummyNode(s,"edge",E,"_d"),u===g&&(E.width=h.width,E.height=h.height,E.dummy="edge-label",E.labelpos=h.labelpos),s.setEdge(a,w,{weight:h.weight},d),_===0&&s.graph().dummyChains.push(w),a=w;s.setEdge(a,f,{weight:h.weight},d)}function i(s){s.graph().dummyChains.forEach(c=>{let a=s.node(c),u=a.edgeLabel,f;for(s.setEdge(a.edgeObj,u);a.dummy;)f=s.successors(c)[0],s.removeNode(c),u.points.push({x:a.x,y:a.y}),a.dummy==="edge-label"&&(u.x=a.x,u.y=a.y,u.width=a.width,u.height=a.height),c=f,a=s.node(c)})}}),nn=oe((e,t)=>{var{applyWithChunking:n}=ae();t.exports={longestPath:r,slack:o};function r(i){var s={};function c(a){var u=i.node(a);if(Object.hasOwn(s,a))return u.rank;s[a]=!0;let f=i.outEdges(a).map(d=>d==null?Number.POSITIVE_INFINITY:c(d.w)-i.edge(d).minlen);var l=n(Math.min,f);return l===Number.POSITIVE_INFINITY&&(l=0),u.rank=l}i.sources().forEach(c)}function o(i,s){return i.node(s.w).rank-i.node(s.v).rank-i.edge(s).minlen}}),ws=oe((e,t)=>{var n=ve().Graph,r=nn().slack;t.exports=o;function o(a){var u=new n({directed:!1}),f=a.nodes()[0],l=a.nodeCount();u.setNode(f,{});for(var d,h;i(u,a)<l;)d=s(u,a),h=u.hasNode(d.v)?r(a,d):-r(a,d),c(u,a,h);return u}function i(a,u){function f(l){u.nodeEdges(l).forEach(d=>{var h=d.v,g=l===h?d.w:h;!a.hasNode(g)&&!r(u,d)&&(a.setNode(g,{}),a.setEdge(l,g,{}),f(g))})}return a.nodes().forEach(f),a.nodeCount()}function s(a,u){return u.edges().reduce((f,l)=>{let d=Number.POSITIVE_INFINITY;return a.hasNode(l.v)!==a.hasNode(l.w)&&(d=r(u,l)),d<f[0]?[d,l]:f},[Number.POSITIVE_INFINITY,null])[1]}function c(a,u,f){a.nodes().forEach(l=>u.node(l).rank+=f)}}),jg=oe((e,t)=>{var n=ws(),r=nn().slack,o=nn().longestPath,i=ve().alg.preorder,s=ve().alg.postorder,c=ae().simplify;t.exports=a,a.initLowLimValues=d,a.initCutValues=u,a.calcCutValue=l,a.leaveEdge=g,a.enterEdge=w,a.exchangeEdges=E;function a(y){y=c(y),o(y);var T=n(y);d(T),u(T,y);for(var k,I;k=g(T);)I=w(T,y,k),E(T,y,k,I)}function u(y,T){var k=s(y,y.nodes());k=k.slice(0,k.length-1),k.forEach(I=>f(y,T,I))}function f(y,T,k){var I=y.node(k),H=I.parent;y.edge(k,H).cutvalue=l(y,T,k)}function l(y,T,k){var I=y.node(k),H=I.parent,F=!0,j=T.edge(k,H),C=0;return j||(F=!1,j=T.edge(H,k)),C=j.weight,T.nodeEdges(k).forEach(R=>{var D=R.v===k,x=D?R.w:R.v;if(x!==H){var L=D===F,N=T.edge(R).weight;if(C+=L?N:-N,b(y,k,x)){var P=y.edge(k,x).cutvalue;C+=L?-P:P}}}),C}function d(y,T){arguments.length<2&&(T=y.nodes()[0]),h(y,{},1,T)}function h(y,T,k,I,H){var F=k,j=y.node(I);return T[I]=!0,y.neighbors(I).forEach(C=>{Object.hasOwn(T,C)||(k=h(y,T,k,C,I))}),j.low=F,j.lim=k++,H?j.parent=H:delete j.parent,k}function g(y){return y.edges().find(T=>y.edge(T).cutvalue<0)}function w(y,T,k){var I=k.v,H=k.w;T.hasEdge(I,H)||(I=k.w,H=k.v);var F=y.node(I),j=y.node(H),C=F,R=!1;F.lim>j.lim&&(C=j,R=!0);var D=T.edges().filter(x=>R===p(y,y.node(x.v),C)&&R!==p(y,y.node(x.w),C));return D.reduce((x,L)=>r(T,L)<r(T,x)?L:x)}function E(y,T,k,I){var H=k.v,F=k.w;y.removeEdge(H,F),y.setEdge(I.v,I.w,{}),d(y),u(y,T),_(y,T)}function _(y,T){var k=y.nodes().find(H=>!T.node(H).parent),I=i(y,k);I=I.slice(1),I.forEach(H=>{var F=y.node(H).parent,j=T.edge(H,F),C=!1;j||(j=T.edge(F,H),C=!0),T.node(H).rank=T.node(F).rank+(C?j.minlen:-j.minlen)})}function b(y,T,k){return y.hasEdge(T,k)}function p(y,T,k){return k.low<=T.lim&&T.lim<=k.lim}}),zg=oe((e,t)=>{var n=nn(),r=n.longestPath,o=ws(),i=jg();t.exports=s;function s(f){var l=f.graph().ranker;if(l instanceof Function)return l(f);switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":a(f);break;case"longest-path":c(f);break;case"none":break;default:u(f)}}var c=r;function a(f){r(f),o(f)}function u(f){i(f)}}),Hg=oe((e,t)=>{t.exports=n;function n(i){let s=o(i);i.graph().dummyChains.forEach(c=>{let a=i.node(c),u=a.edgeObj,f=r(i,s,u.v,u.w),l=f.path,d=f.lca,h=0,g=l[h],w=!0;for(;c!==u.w;){if(a=i.node(c),w){for(;(g=l[h])!==d&&i.node(g).maxRank<a.rank;)h++;g===d&&(w=!1)}if(!w){for(;h<l.length-1&&i.node(g=l[h+1]).minRank<=a.rank;)h++;g=l[h]}i.setParent(c,g),c=i.successors(c)[0]}})}function r(i,s,c,a){let u=[],f=[],l=Math.min(s[c].low,s[a].low),d=Math.max(s[c].lim,s[a].lim),h,g;h=c;do h=i.parent(h),u.push(h);while(h&&(s[h].low>l||d>s[h].lim));for(g=h,h=a;(h=i.parent(h))!==g;)f.push(h);return{path:u.concat(f.reverse()),lca:g}}function o(i){let s={},c=0;function a(u){let f=c;i.children(u).forEach(a),s[u]={low:f,lim:c++}}return i.children().forEach(a),s}}),Vg=oe((e,t)=>{var n=ae();t.exports={run:r,cleanup:c};function r(a){let u=n.addDummyNode(a,"root",{},"_root"),f=i(a),l=Object.values(f),d=n.applyWithChunking(Math.max,l)-1,h=2*d+1;a.graph().nestingRoot=u,a.edges().forEach(w=>a.edge(w).minlen*=h);let g=s(a)+1;a.children().forEach(w=>o(a,u,h,g,d,f,w)),a.graph().nodeRankFactor=h}function o(a,u,f,l,d,h,g){let w=a.children(g);if(!w.length){g!==u&&a.setEdge(u,g,{weight:0,minlen:f});return}let E=n.addBorderNode(a,"_bt"),_=n.addBorderNode(a,"_bb"),b=a.node(g);a.setParent(E,g),b.borderTop=E,a.setParent(_,g),b.borderBottom=_,w.forEach(p=>{o(a,u,f,l,d,h,p);let y=a.node(p),T=y.borderTop?y.borderTop:p,k=y.borderBottom?y.borderBottom:p,I=y.borderTop?l:2*l,H=T!==k?1:d-h[g]+1;a.setEdge(E,T,{weight:I,minlen:H,nestingEdge:!0}),a.setEdge(k,_,{weight:I,minlen:H,nestingEdge:!0})}),a.parent(g)||a.setEdge(u,E,{weight:0,minlen:d+h[g]})}function i(a){var u={};function f(l,d){var h=a.children(l);h&&h.length&&h.forEach(g=>f(g,d+1)),u[l]=d}return a.children().forEach(l=>f(l,1)),u}function s(a){return a.edges().reduce((u,f)=>u+a.edge(f).weight,0)}function c(a){var u=a.graph();a.removeNode(u.nestingRoot),delete u.nestingRoot,a.edges().forEach(f=>{var l=a.edge(f);l.nestingEdge&&a.removeEdge(f)})}}),Bg=oe((e,t)=>{var n=ae();t.exports=r;function r(i){function s(c){let a=i.children(c),u=i.node(c);if(a.length&&a.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let f=u.minRank,l=u.maxRank+1;f<l;++f)o(i,"borderLeft","_bl",c,u,f),o(i,"borderRight","_br",c,u,f)}}i.children().forEach(s)}function o(i,s,c,a,u,f){let l={width:0,height:0,rank:f,borderType:s},d=u[s][f-1],h=n.addDummyNode(i,"border",l,c);u[s][f]=h,i.setParent(h,a),d&&i.setEdge(d,h,{weight:1})}}),Fg=oe((e,t)=>{t.exports={adjust:n,undo:r};function n(f){let l=f.graph().rankdir.toLowerCase();(l==="lr"||l==="rl")&&o(f)}function r(f){let l=f.graph().rankdir.toLowerCase();(l==="bt"||l==="rl")&&s(f),(l==="lr"||l==="rl")&&(a(f),o(f))}function o(f){f.nodes().forEach(l=>i(f.node(l))),f.edges().forEach(l=>i(f.edge(l)))}function i(f){let l=f.width;f.width=f.height,f.height=l}function s(f){f.nodes().forEach(l=>c(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(c),Object.hasOwn(d,"y")&&c(d)})}function c(f){f.y=-f.y}function a(f){f.nodes().forEach(l=>u(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(u),Object.hasOwn(d,"x")&&u(d)})}function u(f){let l=f.x;f.x=f.y,f.y=l}}),Yg=oe((e,t)=>{var n=ae();t.exports=r;function r(o){let i={},s=o.nodes().filter(l=>!o.children(l).length),c=s.map(l=>o.node(l).rank),a=n.applyWithChunking(Math.max,c),u=n.range(a+1).map(()=>[]);function f(l){if(i[l])return;i[l]=!0;let d=o.node(l);u[d.rank].push(l),o.successors(l).forEach(f)}return s.sort((l,d)=>o.node(l).rank-o.node(d).rank).forEach(f),u}}),Xg=oe((e,t)=>{var n=ae().zipObject;t.exports=r;function r(i,s){let c=0;for(let a=1;a<s.length;++a)c+=o(i,s[a-1],s[a]);return c}function o(i,s,c){let a=n(c,c.map((g,w)=>w)),u=s.flatMap(g=>i.outEdges(g).map(w=>({pos:a[w.w],weight:i.edge(w).weight})).sort((w,E)=>w.pos-E.pos)),f=1;for(;f<c.length;)f<<=1;let l=2*f-1;f-=1;let d=new Array(l).fill(0),h=0;return u.forEach(g=>{let w=g.pos+f;d[w]+=g.weight;let E=0;for(;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=g.weight;h+=g.weight*E}),h}}),Wg=oe((e,t)=>{t.exports=n;function n(r,o=[]){return o.map(i=>{let s=r.inEdges(i);if(s.length){let c=s.reduce((a,u)=>{let f=r.edge(u),l=r.node(u.v);return{sum:a.sum+f.weight*l.order,weight:a.weight+f.weight}},{sum:0,weight:0});return{v:i,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:i}})}}),Gg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a={};s.forEach((f,l)=>{let d=a[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:l};f.barycenter!==void 0&&(d.barycenter=f.barycenter,d.weight=f.weight)}),c.edges().forEach(f=>{let l=a[f.v],d=a[f.w];l!==void 0&&d!==void 0&&(d.indegree++,l.out.push(a[f.w]))});let u=Object.values(a).filter(f=>!f.indegree);return o(u)}function o(s){let c=[];function a(f){return l=>{l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&i(f,l)}}function u(f){return l=>{l.in.push(f),--l.indegree===0&&s.push(l)}}for(;s.length;){let f=s.pop();c.push(f),f.in.reverse().forEach(a(f)),f.out.forEach(u(f))}return c.filter(f=>!f.merged).map(f=>n.pick(f,["vs","i","barycenter","weight"]))}function i(s,c){let a=0,u=0;s.weight&&(a+=s.barycenter*s.weight,u+=s.weight),c.weight&&(a+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=a/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),qg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a=n.partition(s,E=>Object.hasOwn(E,"barycenter")),u=a.lhs,f=a.rhs.sort((E,_)=>_.i-E.i),l=[],d=0,h=0,g=0;u.sort(i(!!c)),g=o(l,f,g),u.forEach(E=>{g+=E.vs.length,l.push(E.vs),d+=E.barycenter*E.weight,h+=E.weight,g=o(l,f,g)});let w={vs:l.flat(!0)};return h&&(w.barycenter=d/h,w.weight=h),w}function o(s,c,a){let u;for(;c.length&&(u=c[c.length-1]).i<=a;)c.pop(),s.push(u.vs),a++;return a}function i(s){return(c,a)=>c.barycenter<a.barycenter?-1:c.barycenter>a.barycenter?1:s?a.i-c.i:c.i-a.i}}),Ug=oe((e,t)=>{var n=Wg(),r=Gg(),o=qg();t.exports=i;function i(a,u,f,l){let d=a.children(u),h=a.node(u),g=h?h.borderLeft:void 0,w=h?h.borderRight:void 0,E={};g&&(d=d.filter(y=>y!==g&&y!==w));let _=n(a,d);_.forEach(y=>{if(a.children(y.v).length){let T=i(a,y.v,f,l);E[y.v]=T,Object.hasOwn(T,"barycenter")&&c(y,T)}});let b=r(_,f);s(b,E);let p=o(b,l);if(g&&(p.vs=[g,p.vs,w].flat(!0),a.predecessors(g).length)){let y=a.node(a.predecessors(g)[0]),T=a.node(a.predecessors(w)[0]);Object.hasOwn(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.order+T.order)/(p.weight+2),p.weight+=2}return p}function s(a,u){a.forEach(f=>{f.vs=f.vs.flatMap(l=>u[l]?u[l].vs:l)})}function c(a,u){a.barycenter!==void 0?(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight):(a.barycenter=u.barycenter,a.weight=u.weight)}}),Kg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports=o;function o(s,c,a,u){u||(u=s.nodes());let f=i(s),l=new n({compound:!0}).setGraph({root:f}).setDefaultNodeLabel(d=>s.node(d));return u.forEach(d=>{let h=s.node(d),g=s.parent(d);(h.rank===c||h.minRank<=c&&c<=h.maxRank)&&(l.setNode(d),l.setParent(d,g||f),s[a](d).forEach(w=>{let E=w.v===d?w.w:w.v,_=l.edge(E,d),b=_!==void 0?_.weight:0;l.setEdge(E,d,{weight:s.edge(w).weight+b})}),Object.hasOwn(h,"minRank")&&l.setNode(d,{borderLeft:h.borderLeft[c],borderRight:h.borderRight[c]}))}),l}function i(s){for(var c;s.hasNode(c=r.uniqueId("_root")););return c}}),Zg=oe((e,t)=>{t.exports=n;function n(r,o,i){let s={},c;i.forEach(a=>{let u=r.parent(a),f,l;for(;u;){if(f=r.parent(u),f?(l=s[f],s[f]=u):(l=c,c=u),l&&l!==u){o.setEdge(l,u);return}u=f}})}}),Qg=oe((e,t)=>{var n=Yg(),r=Xg(),o=Ug(),i=Kg(),s=Zg(),c=ve().Graph,a=ae();t.exports=u;function u(h,g={}){if(typeof g.customOrder=="function"){g.customOrder(h,u);return}let w=a.maxRank(h),E=f(h,a.range(1,w+1),"inEdges"),_=f(h,a.range(w-1,-1,-1),"outEdges"),b=n(h);if(d(h,b),g.disableOptimalOrderHeuristic)return;let p=Number.POSITIVE_INFINITY,y,T=g.constraints||[];for(let k=0,I=0;I<4;++k,++I){l(k%2?E:_,k%4>=2,T),b=a.buildLayerMatrix(h);let H=r(h,b);H<p?(I=0,y=Object.assign({},b),p=H):H===p&&(y=structuredClone(b))}d(h,y)}function f(h,g,w){let E=new Map,_=(b,p)=>{E.has(b)||E.set(b,[]),E.get(b).push(p)};for(let b of h.nodes()){let p=h.node(b);if(typeof p.rank=="number"&&_(p.rank,b),typeof p.minRank=="number"&&typeof p.maxRank=="number")for(let y=p.minRank;y<=p.maxRank;y++)y!==p.rank&&_(y,b)}return g.map(function(b){return i(h,b,w,E.get(b)||[])})}function l(h,g,w){let E=new c;h.forEach(function(_){w.forEach(y=>E.setEdge(y.left,y.right));let b=_.graph().root,p=o(_,b,E,g);p.vs.forEach((y,T)=>_.node(y).order=T),s(_,E,p.vs)})}function d(h,g){Object.values(g).forEach(w=>w.forEach((E,_)=>h.node(E).order=_))}}),Jg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports={positionX:w,findType1Conflicts:o,findType2Conflicts:i,addConflict:c,hasConflict:a,verticalAlignment:u,horizontalCompaction:f,alignCoordinates:h,findSmallestWidthAlignment:d,balance:g};function o(b,p){let y={};function T(k,I){let H=0,F=0,j=k.length,C=I[I.length-1];return I.forEach((R,D)=>{let x=s(b,R),L=x?b.node(x).order:j;(x||R===C)&&(I.slice(F,D+1).forEach(N=>{b.predecessors(N).forEach(P=>{let A=b.node(P),O=A.order;(O<H||L<O)&&!(A.dummy&&b.node(N).dummy)&&c(y,P,N)})}),F=D+1,H=L)}),I}return p.length&&p.reduce(T),y}function i(b,p){let y={};function T(I,H,F,j,C){let R;r.range(H,F).forEach(D=>{R=I[D],b.node(R).dummy&&b.predecessors(R).forEach(x=>{let L=b.node(x);L.dummy&&(L.order<j||L.order>C)&&c(y,x,R)})})}function k(I,H){let F=-1,j,C=0;return H.forEach((R,D)=>{if(b.node(R).dummy==="border"){let x=b.predecessors(R);x.length&&(j=b.node(x[0]).order,T(H,C,D,F,j),C=D,F=j)}T(H,C,H.length,j,I.length)}),H}return p.length&&p.reduce(k),y}function s(b,p){if(b.node(p).dummy)return b.predecessors(p).find(y=>b.node(y).dummy)}function c(b,p,y){if(p>y){let k=p;p=y,y=k}let T=b[p];T||(b[p]=T={}),T[y]=!0}function a(b,p,y){if(p>y){let T=p;p=y,y=T}return!!b[p]&&Object.hasOwn(b[p],y)}function u(b,p,y,T){let k={},I={},H={};return p.forEach(F=>{F.forEach((j,C)=>{k[j]=j,I[j]=j,H[j]=C})}),p.forEach(F=>{let j=-1;F.forEach(C=>{let R=T(C);if(R.length){R=R.sort((x,L)=>H[x]-H[L]);let D=(R.length-1)/2;for(let x=Math.floor(D),L=Math.ceil(D);x<=L;++x){let N=R[x];I[C]===C&&j<H[N]&&!a(y,C,N)&&(I[N]=C,I[C]=k[C]=k[N],j=H[N])}}})}),{root:k,align:I}}function f(b,p,y,T,k){let I={},H=l(b,p,y,k),F=k?"borderLeft":"borderRight";function j(D,x){let L=H.nodes().slice(),N={},P=L.pop();for(;P;){if(N[P])D(P);else{N[P]=!0,L.push(P);for(let A of x(P))L.push(A)}P=L.pop()}}function C(D){I[D]=H.inEdges(D).reduce((x,L)=>Math.max(x,I[L.v]+H.edge(L)),0)}function R(D){let x=H.outEdges(D).reduce((N,P)=>Math.min(N,I[P.w]-H.edge(P)),Number.POSITIVE_INFINITY),L=b.node(D);x!==Number.POSITIVE_INFINITY&&L.borderType!==F&&(I[D]=Math.max(I[D],x))}return j(C,H.predecessors.bind(H)),j(R,H.successors.bind(H)),Object.keys(T).forEach(D=>I[D]=I[y[D]]),I}function l(b,p,y,T){let k=new n,I=b.graph(),H=E(I.nodesep,I.edgesep,T);return p.forEach(F=>{let j;F.forEach(C=>{let R=y[C];if(k.setNode(R),j){var D=y[j],x=k.edge(D,R);k.setEdge(D,R,Math.max(H(b,C,j),x||0))}j=C})}),k}function d(b,p){return Object.values(p).reduce((y,T)=>{let k=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;Object.entries(T).forEach(([F,j])=>{let C=_(b,F)/2;k=Math.max(j+C,k),I=Math.min(j-C,I)});let H=k-I;return H<y[0]&&(y=[H,T]),y},[Number.POSITIVE_INFINITY,null])[1]}function h(b,p){let y=Object.values(p),T=r.applyWithChunking(Math.min,y),k=r.applyWithChunking(Math.max,y);["u","d"].forEach(I=>{["l","r"].forEach(H=>{let F=I+H,j=b[F];if(j===p)return;let C=Object.values(j),R=T-r.applyWithChunking(Math.min,C);H!=="l"&&(R=k-r.applyWithChunking(Math.max,C)),R&&(b[F]=r.mapValues(j,D=>D+R))})})}function g(b,p){return r.mapValues(b.ul,(y,T)=>{if(p)return b[p.toLowerCase()][T];{let k=Object.values(b).map(I=>I[T]).sort((I,H)=>I-H);return(k[1]+k[2])/2}})}function w(b){let p=r.buildLayerMatrix(b),y=Object.assign(o(b,p),i(b,p)),T={},k;["u","d"].forEach(H=>{k=H==="u"?p:Object.values(p).reverse(),["l","r"].forEach(F=>{F==="r"&&(k=k.map(D=>Object.values(D).reverse()));let j=(H==="u"?b.predecessors:b.successors).bind(b),C=u(b,k,y,j),R=f(b,k,C.root,C.align,F==="r");F==="r"&&(R=r.mapValues(R,D=>-D)),T[H+F]=R})});let I=d(b,T);return h(T,I),g(T,b.graph().align)}function E(b,p,y){return(T,k,I)=>{let H=T.node(k),F=T.node(I),j=0,C;if(j+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":C=-H.width/2;break;case"r":C=H.width/2;break}if(C&&(j+=y?C:-C),C=0,j+=(H.dummy?p:b)/2,j+=(F.dummy?p:b)/2,j+=F.width/2,Object.hasOwn(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":C=F.width/2;break;case"r":C=-F.width/2;break}return C&&(j+=y?C:-C),C=0,j}}function _(b,p){return b.node(p).width}}),ep=oe((e,t)=>{var n=ae(),r=Jg().positionX;t.exports=o;function o(s){s=n.asNonCompoundGraph(s),i(s),Object.entries(r(s)).forEach(([c,a])=>s.node(c).x=a)}function i(s){let c=n.buildLayerMatrix(s),a=s.graph().ranksep,u=s.graph().rankalign,f=0;c.forEach(l=>{let d=l.reduce((h,g)=>{let w=s.node(g).height;return h>w?h:w},0);l.forEach(h=>{let g=s.node(h);u==="top"?g.y=f+g.height/2:u==="bottom"?g.y=f+d-g.height/2:g.y=f+d/2}),f+=d+a})}}),tp=oe((e,t)=>{var n=Lg(),r=Dg(),o=zg(),i=ae().normalizeRanks,s=Hg(),c=ae().removeEmptyRanks,a=Vg(),u=Bg(),f=Fg(),l=Qg(),d=ep(),h=ae(),g=ve().Graph;t.exports=w;function w(v,$={}){let z=$.debugTiming?h.time:h.notime;return z("layout",()=>{let V=z(" buildLayoutGraph",()=>j(v));return z(" runLayout",()=>E(V,z,$)),z(" updateInputGraph",()=>_(v,V)),V})}function E(v,$,z){$(" makeSpaceForEdgeLabels",()=>C(v)),$(" removeSelfEdges",()=>B(v)),$(" acyclic",()=>n.run(v)),$(" nestingGraph.run",()=>a.run(v)),$(" rank",()=>o(h.asNonCompoundGraph(v))),$(" injectEdgeLabelProxies",()=>R(v)),$(" removeEmptyRanks",()=>c(v)),$(" nestingGraph.cleanup",()=>a.cleanup(v)),$(" normalizeRanks",()=>i(v)),$(" assignRankMinMax",()=>D(v)),$(" removeEdgeLabelProxies",()=>x(v)),$(" normalize.run",()=>r.run(v)),$(" parentDummyChains",()=>s(v)),$(" addBorderSegments",()=>u(v)),$(" order",()=>l(v,z)),$(" insertSelfEdges",()=>m(v)),$(" adjustCoordinateSystem",()=>f.adjust(v)),$(" position",()=>d(v)),$(" positionSelfEdges",()=>M(v)),$(" removeBorderNodes",()=>O(v)),$(" normalize.undo",()=>r.undo(v)),$(" fixupEdgeLabelCoords",()=>P(v)),$(" undoCoordinateSystem",()=>f.undo(v)),$(" translateGraph",()=>L(v)),$(" assignNodeIntersects",()=>N(v)),$(" reversePoints",()=>A(v)),$(" acyclic.undo",()=>n.undo(v))}function _(v,$){v.nodes().forEach(z=>{let V=v.node(z),X=$.node(z);V&&(V.x=X.x,V.y=X.y,V.order=X.order,V.rank=X.rank,$.children(z).length&&(V.width=X.width,V.height=X.height))}),v.edges().forEach(z=>{let V=v.edge(z),X=$.edge(z);V.points=X.points,Object.hasOwn(X,"x")&&(V.x=X.x,V.y=X.y)}),v.graph().width=$.graph().width,v.graph().height=$.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},y=["acyclicer","ranker","rankdir","align","rankalign"],T=["width","height","rank"],k={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],H={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function j(v){let $=new g({multigraph:!0,compound:!0}),z=S(v.graph());return $.setGraph(Object.assign({},p,Y(z,b),h.pick(z,y))),v.nodes().forEach(V=>{let X=S(v.node(V)),q=Y(X,T);Object.keys(k).forEach(U=>{q[U]===void 0&&(q[U]=k[U])}),$.setNode(V,q),$.setParent(V,v.parent(V))}),v.edges().forEach(V=>{let X=S(v.edge(V));$.setEdge(V,Object.assign({},H,Y(X,I),h.pick(X,F)))}),$}function C(v){let $=v.graph();$.ranksep/=2,v.edges().forEach(z=>{let V=v.edge(z);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&($.rankdir==="TB"||$.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function R(v){v.edges().forEach($=>{let z=v.edge($);if(z.width&&z.height){let V=v.node($.v),X={rank:(v.node($.w).rank-V.rank)/2+V.rank,e:$};h.addDummyNode(v,"edge-proxy",X,"_ep")}})}function D(v){let $=0;v.nodes().forEach(z=>{let V=v.node(z);V.borderTop&&(V.minRank=v.node(V.borderTop).rank,V.maxRank=v.node(V.borderBottom).rank,$=Math.max($,V.maxRank))}),v.graph().maxRank=$}function x(v){v.nodes().forEach($=>{let z=v.node($);z.dummy==="edge-proxy"&&(v.edge(z.e).labelRank=z.rank,v.removeNode($))})}function L(v){let $=Number.POSITIVE_INFINITY,z=0,V=Number.POSITIVE_INFINITY,X=0,q=v.graph(),U=q.marginx||0,K=q.marginy||0;function Z(J){let te=J.x,ne=J.y,ue=J.width,ge=J.height;$=Math.min($,te-ue/2),z=Math.max(z,te+ue/2),V=Math.min(V,ne-ge/2),X=Math.max(X,ne+ge/2)}v.nodes().forEach(J=>Z(v.node(J))),v.edges().forEach(J=>{let te=v.edge(J);Object.hasOwn(te,"x")&&Z(te)}),$-=U,V-=K,v.nodes().forEach(J=>{let te=v.node(J);te.x-=$,te.y-=V}),v.edges().forEach(J=>{let te=v.edge(J);te.points.forEach(ne=>{ne.x-=$,ne.y-=V}),Object.hasOwn(te,"x")&&(te.x-=$),Object.hasOwn(te,"y")&&(te.y-=V)}),q.width=z-$+U,q.height=X-V+K}function N(v){v.edges().forEach($=>{let z=v.edge($),V=v.node($.v),X=v.node($.w),q,U;z.points?(q=z.points[0],U=z.points[z.points.length-1]):(z.points=[],q=X,U=V),z.points.unshift(h.intersectRect(V,q)),z.points.push(h.intersectRect(X,U))})}function P(v){v.edges().forEach($=>{let z=v.edge($);if(Object.hasOwn(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function A(v){v.edges().forEach($=>{let z=v.edge($);z.reversed&&z.points.reverse()})}function O(v){v.nodes().forEach($=>{if(v.children($).length){let z=v.node($),V=v.node(z.borderTop),X=v.node(z.borderBottom),q=v.node(z.borderLeft[z.borderLeft.length-1]),U=v.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(U.x-q.x),z.height=Math.abs(X.y-V.y),z.x=q.x+z.width/2,z.y=V.y+z.height/2}}),v.nodes().forEach($=>{v.node($).dummy==="border"&&v.removeNode($)})}function B(v){v.edges().forEach($=>{if($.v===$.w){var z=v.node($.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:$,label:v.edge($)}),v.removeEdge($)}})}function m(v){var $=h.buildLayerMatrix(v);$.forEach(z=>{var V=0;z.forEach((X,q)=>{var U=v.node(X);U.order=q+V,(U.selfEdges||[]).forEach(K=>{h.addDummyNode(v,"selfedge",{width:K.label.width,height:K.label.height,rank:U.rank,order:q+ ++V,e:K.e,label:K.label},"_se")}),delete U.selfEdges})})}function M(v){v.nodes().forEach($=>{var z=v.node($);if(z.dummy==="selfedge"){var V=v.node(z.e.v),X=V.x+V.width/2,q=V.y,U=z.x-X,K=V.height/2;v.setEdge(z.e,z.label),v.removeNode($),z.label.points=[{x:X+2*U/3,y:q-K},{x:X+5*U/6,y:q-K},{x:X+U,y:q},{x:X+5*U/6,y:q+K},{x:X+2*U/3,y:q+K}],z.label.x=z.x,z.label.y=z.y}})}function Y(v,$){return h.mapValues(h.pick(v,$),Number)}function S(v){var $={};return v&&Object.entries(v).forEach(([z,V])=>{typeof z=="string"&&(z=z.toLowerCase()),$[z]=V}),$}}),np=oe((e,t)=>{var n=ae(),r=ve().Graph;t.exports={debugOrdering:o};function o(i){let s=n.buildLayerMatrix(i),c=new r({compound:!0,multigraph:!0}).setGraph({});return i.nodes().forEach(a=>{c.setNode(a,{label:a}),c.setParent(a,"layer"+i.node(a).rank)}),i.edges().forEach(a=>c.setEdge(a.v,a.w,{},a.name)),s.forEach((a,u)=>{let f="layer"+u;c.setNode(f,{rank:"same"}),a.reduce((l,d)=>(c.setEdge(l,d,{style:"invis"}),d))}),c}}),rp=oe((e,t)=>{t.exports="2.0.4"}),op=oe((e,t)=>{t.exports={graphlib:ve(),layout:tp(),debug:np(),util:{time:ae().time,notime:ae().notime},version:rp()}});const lp=op();/*! For license information please see dagre.esm.js.LEGAL.txt */export{ap as B,cp as C,en as H,up as M,Q as P,Ia as a,G as b,Oe as c,lp as d,ip as e,Zt as f,$o as g,Xn as h,sp as i,W as j,mn as k,on as l,Ko as m,un as n,rn as r,de as s,ii as t,fi as z};
|