@anlyx/ui 0.1.3 → 0.1.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/capture/capture-runtime.d.ts +14 -0
- package/dist/capture/capture-runtime.js +300 -0
- package/dist/components/CaptureStatusEmptyState.js +2 -2
- package/dist/components/EndpointMapCanvas.js +1 -1
- package/dist/components/InspectorPanel.js +27 -1
- package/dist/components/StatusBadge.d.ts +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/overlay/MainFlowCanvas.js +1 -1
- package/dist/overlay/overlay-ui.js +1 -1
- package/dist/readme-demo/ReadmeDemoApp.d.ts +12 -1
- package/dist/readme-demo/ReadmeDemoApp.js +74 -16
- package/dist/styles.css +17 -4
- package/dist/viewer/ViewerApp.js +35 -15
- package/dist/viewer/styles.css +2639 -0
- package/dist/viewer/viewer-entry.d.ts +1 -0
- package/dist/viewer/viewer-entry.js +1 -0
- package/dist/viewer/workspace/anlyx-logo-transparent.png +0 -0
- package/dist/viewer/workspace/workspace.css +11938 -0
- package/dist/workspace/ScanTreeMap.d.ts +6 -0
- package/dist/workspace/ScanTreeMap.js +838 -0
- package/dist/workspace/WorkspaceApp.d.ts +9 -0
- package/dist/workspace/WorkspaceApp.js +3016 -0
- package/dist/workspace/project-view-model.d.ts +63 -0
- package/dist/workspace/project-view-model.js +170 -0
- package/dist/workspace/workspace.css +11938 -0
- package/package.json +10 -2
|
@@ -11,4 +11,4 @@ Error generating stack: `+e.message+`
|
|
|
11
11
|
`,`
|
|
12
12
|
+`).split(`
|
|
13
13
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,S.useEffect)(()=>{let n=t?.target??Bc,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&xo(e))return!1;let n=Hc(e.code,s);if(a.current.add(e[n]),Q(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Hc(e.code,s);Q(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function Q(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Hc(e,t){return t.includes(e)?`code`:`key`}var Uc=()=>{let e=Z();return(0,S.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=co(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return ro(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=io(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Wc(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Gc(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Gc(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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 Kc(e,t){return Wc(e,t)}function qc(e,t){return Wc(e,t)}function Jc(e,t){return{id:e,type:`select`,selected:t}}function Yc(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(Jc(a.id,e)))}return r}function Xc({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Zc(e){return{id:e.id,type:`remove`}}var Qc=to(`React Flow`,`https://reactflow.dev/`);function $c(e,t,n={}){return No(e,t,{...n,onError:n.onError??Qc})}var el=e=>Aa(e),tl=e=>ka(e);function nl(e){return(0,S.forwardRef)(e)}var rl=typeof window<`u`?S.useLayoutEffect:S.useEffect;function il(e){let[t,n]=(0,S.useState)(BigInt(0)),[r]=(0,S.useState)(()=>al(()=>n(e=>e+BigInt(1))));return rl(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function al(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var ol=(0,S.createContext)(null);function sl({children:e}){let t=Z(),n=il((0,S.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=Xc({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=il((0,S.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(Xc({items:s,lookup:o}))},[])),i=(0,S.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,_.jsx)(ol.Provider,{value:i,children:e})}function cl(){let e=(0,S.useContext)(ol);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var ll=e=>!!e.panZoom;function ul(){let e=Uc(),t=Z(),n=cl(),r=X(ll),i=(0,S.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=el(e)?e:n.get(e.id),a=i.parentId?mo(i.position,i.measured,i.parentId,n,r):i.position;return Ya({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&el(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&tl(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Ba({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Zc);o?.(f),c(e)}if(m){let e=d.map(Zc);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=$a(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Ya(s?r:a),l=Qa(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=$a(e)?e:a(e);if(!r)return!1;let i=Qa(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Na(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??go();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,S.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var dl=e=>e.selected,fl=typeof window<`u`?window:void 0;function pl({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Z(),{deleteElements:r}=ul(),i=Vc(e,{actInsideInputWithModifier:!1}),a=Vc(t,{target:fl});(0,S.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(dl),edges:e.filter(dl)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,S.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function ml(e){let t=Z();(0,S.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=K(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,va.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var hl={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},gl=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function _l({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Ca.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let C=Z(),w=(0,S.useRef)(null),{userSelectionActive:T,lib:E,connectionInProgress:D}=X(gl,J),O=Vc(f),k=(0,S.useRef)();ml(w);let A=(0,S.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||C.setState({transform:e})},[v,y]);return(0,S.useEffect)(()=>{if(w.current){k.current=Hs({domNode:w.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>C.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=C.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=C.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=C.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=k.current.getViewport();return C.setState({panZoom:k.current,transform:[e,t,n],domNode:w.current.closest(`.react-flow`)}),()=>{k.current?.destroy()}}},[]),(0,S.useEffect)(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:g,userSelectionActive:T,noWheelClassName:h,lib:E,onTransformChange:A,connectionInProgress:D,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,O,p,g,T,h,E,A,D,x,b]),(0,_.jsx)(`div`,{className:`react-flow__renderer`,ref:w,style:hl,children:m})}var vl=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function yl(){let{userSelectionActive:e,userSelectionRect:t}=X(vl,J);return e&&t?(0,_.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}var bl=(e,t)=>n=>{n.target===t.current&&e?.(n)},xl=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Sl({isSelecting:e,selectionKeyPressed:t,selectionMode:n=wa.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,S.useRef)(0),v=Z(),{userSelectionActive:y,elementsSelectable:b,dragging:x,connectionInProgress:w,panBy:T,autoPanSpeed:E}=X(xl,J),D=b&&(e||y),O=(0,S.useRef)(null),k=(0,S.useRef)(),A=(0,S.useRef)(new Set),j=(0,S.useRef)(new Set),M=(0,S.useRef)(!1),N=(0,S.useRef)({x:0,y:0}),P=(0,S.useRef)(!1),F=e=>{if(M.current||w){M.current=!1;return}l?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},ee=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},te=d?e=>d(e):void 0,ne=e=>{M.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=v.getState();if(k.current=r?.getBoundingClientRect(),!k.current)return;let a=n.target===O.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),M.current=!1;let{x:s,y:c}=Co(n.nativeEvent,k.current),l=ro({x:s,y:c},i);v.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=v.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=v.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=io(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=A.current,g=j.current;A.current=new Set(Fa(a,m,i,n===wa.Partial,!0).map(e=>e.id)),j.current=new Set;let _=u?.selectable??!0;for(let e of A.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??_)&&j.current.add(e)}}ho(h,A.current)||c(Yc(a,A.current,!0)),ho(g,j.current)||l(Yc(o,j.current)),v.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!k.current)return;let[e,t]=Ga(N.current,k.current,E);T({x:e,y:t}).then(e=>{if(!M.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=N.current;L(t,n),g.current=requestAnimationFrame(R)})}let z=()=>{cancelAnimationFrame(g.current),g.current=0,P.current=!1};return(0,S.useEffect)(()=>()=>z(),[]),(0,_.jsxs)(`div`,{className:C([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:x,selection:e}]),onClick:D?void 0:bl(F,O),onContextMenu:bl(ee,O),onWheel:bl(te,O),onPointerEnter:D?void 0:f,onPointerMove:D?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=v.getState();if(!k.current||!n)return;let{x:o,y:c}=Co(e.nativeEvent,k.current);N.current={x:o,y:c};let l=io({x:n.startX,y:n.startY},r);if(!M.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}M.current=!0,P.current||=(R(),!0),L(o,c)}:p,onPointerUp:D?e=>{e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!y&&e.target===O.current&&v.getState().userSelectionRect&&F?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(c?.(e),v.setState({nodesSelectionActive:A.current.size>0})),z())}:void 0,onPointerCancel:D?e=>{e.target?.releasePointerCapture?.(e.pointerId),z()}:void 0,onPointerDownCapture:D?I:void 0,onClickCapture:D?ne:void 0,onPointerLeave:m,ref:O,style:hl,children:[h,(0,_.jsx)(yl,{})]})}function Cl({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,va.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function wl({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Z(),[c,l]=(0,S.useState)(!1),u=(0,S.useRef)();return(0,S.useEffect)(()=>{u.current=_s({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Cl({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,S.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Tl=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function El(){let e=Z();return(0,S.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Tl(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=no(t,i));let{position:a,positionAbsolute:s}=za({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Dl=(0,S.createContext)(null),Ol=Dl.Provider;Dl.Consumer;var kl=()=>(0,S.useContext)(Dl),Al=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),jl=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Sa.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Ml({type:e=`source`,position:t=G.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Z(),v=kl(),{connectOnClick:y,noPanClassName:b,rfId:x}=X(Al,J),{connectingFrom:S,connectingTo:w,clickConnecting:T,isPossibleEndHandle:E,connectionInProcess:D,clickConnectionInProcess:O,valid:k}=X(jl(v,m,e),J);v||g.getState().onError?.(`010`,va.error010());let A=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t($c(i,e,{onError:n}))}n?.(i),s?.(i)},j=e=>{if(!v)return;let t=So(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ds.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:v,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:A,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,_.jsx)(`div`,{"data-handleid":m,"data-nodeid":v,"data-handlepos":t,"data-id":`${x}-${v}-${m}-${e}`,className:C([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,b,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:T,connectingfrom:S,connectingto:w,valid:k,connectionindicator:r&&(!D||E)&&(D||O?a:i)}]),onMouseDown:j,onTouchStart:j,onClick:y?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!v||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:v,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:v,type:e,id:m}});return}let p=yo(t.target),h=n||c,{connection:_,isValid:y}=Ds.isValid(t.nativeEvent,{handle:{nodeId:v,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&_&&A(_);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Nl=(0,S.memo)(nl(Ml));function Pl({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return(0,_.jsxs)(_.Fragment,{children:[e?.label,(0,_.jsx)(Nl,{type:`source`,position:n,isConnectable:t})]})}function Fl({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Nl,{type:`target`,position:n,isConnectable:t}),e?.label,(0,_.jsx)(Nl,{type:`source`,position:r,isConnectable:t})]})}function Il(){return null}function Ll({data:e,isConnectable:t,targetPosition:n=G.Top}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Nl,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Rl={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$={input:Pl,default:Fl,output:Ll,group:Il};function zl(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Bl=e=>{let{width:t,height:n,x:r,y:i}=Pa(e.nodeLookup,{filter:e=>!!e.selected});return{width:eo(t)?t:null,height:eo(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Vl({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Z(),{width:i,height:a,transformString:o,userSelectionActive:s}=X(Bl,J),c=El(),l=(0,S.useRef)(null);(0,S.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(wl({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,_.jsx)(`div`,{className:C([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,_.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Rl,e.key)&&(e.preventDefault(),c({direction:Rl[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Hl=typeof window<`u`?window:void 0,Ul=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Wl({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:T,autoPanOnSelection:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F,onViewportChange:ee,isControlledViewport:te}){let{nodesSelectionActive:ne,userSelectionActive:I}=X(Ul,J),L=Vc(l,{target:Hl}),R=Vc(h,{target:Hl}),z=R||T,re=R||x,ie=u&&z!==!0,ae=L||I||ie;return pl({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,_.jsx)(_l,{onPaneContextMenu:a,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:b,panOnScroll:re,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:!L&&z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:g,preventScrolling:j,noWheelClassName:N,noPanClassName:P,onViewportChange:ee,isControlledViewport:te,paneClickDistance:s,selectionOnDrag:ie,children:(0,_.jsxs)(Sl,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:z,autoPanOnSelection:E,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:L,paneClickDistance:s,selectionOnDrag:ie,children:[e,ne&&(0,_.jsx)(Vl,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})]})})}Wl.displayName=`FlowRenderer`;var Gl=(0,S.memo)(Wl),Kl=e=>t=>e?Fa(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function ql(e){return X((0,S.useCallback)(Kl(e),[e]),J)}var Jl=e=>e.updateNodeInternals;function Yl(){let e=X(Jl),[t]=(0,S.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,S.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Xl({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Z(),a=(0,S.useRef)(null),o=(0,S.useRef)(null),s=(0,S.useRef)(e.sourcePosition),c=(0,S.useRef)(e.targetPosition),l=(0,S.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,S.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,S.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,S.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Zl({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:v,onError:y}){let{node:b,internals:x,isParent:S}=X(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},J),w=b.type||`default`,T=g?.[w]||$[w];T===void 0&&(y?.(`003`,va.error003(w)),w=`default`,T=g?.default||$.default);let E=!!(b.draggable||s&&b.draggable===void 0),D=!!(b.selectable||c&&b.selectable===void 0),O=!!(b.connectable||l&&b.connectable===void 0),k=!!(b.focusable||u&&b.focusable===void 0),A=Z(),j=po(b),M=Xl({node:b,nodeType:w,hasDimensions:j,resizeObserver:d}),N=wl({nodeRef:M,disabled:b.hidden||!E,noDragClassName:f,handleSelector:b.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:v}),P=El();if(b.hidden)return null;let F=fo(b),ee=zl(b),te=D||E||t||n||r||i,ne=n?e=>n(e,{...x.userNode}):void 0,I=r?e=>r(e,{...x.userNode}):void 0,L=i?e=>i(e,{...x.userNode}):void 0,R=a?e=>a(e,{...x.userNode}):void 0,z=o?e=>o(e,{...x.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=A.getState();D&&(!r||!E||i>0)&&Cl({id:e,store:A,nodeRef:M}),t&&t(n,{...x.userNode})},ie=t=>{if(!(xo(t.nativeEvent)||m)){if(ba.includes(t.key)&&D)Cl({id:e,store:A,unselect:t.key===`Escape`,nodeRef:M});else if(E&&b.selected&&Object.prototype.hasOwnProperty.call(Rl,t.key)){t.preventDefault();let{ariaLabelConfig:e}=A.getState();A.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),P({direction:Rl[t.key],factor:t.shiftKey?4:1})}}},ae=()=>{if(m||!M.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=A.getState();i&&(Fa(new Map([[e,b]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(b.position.x+F.width/2,b.position.y+F.height/2,{zoom:t[2]}))};return(0,_.jsx)(`div`,{className:C([`react-flow__node`,`react-flow__node-${w}`,{[p]:E},b.className,{selected:b.selected,selectable:D,parent:S,draggable:E,dragging:N}]),ref:M,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:te?`all`:`none`,visibility:j?`visible`:`hidden`,...b.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:ne,onMouseMove:I,onMouseLeave:L,onContextMenu:R,onClick:re,onDoubleClick:z,onKeyDown:k?ie:void 0,tabIndex:k?0:void 0,onFocus:k?ae:void 0,role:b.ariaRole??(k?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${_c}-${h}`,"aria-label":b.ariaLabel,...b.domAttributes,children:(0,_.jsx)(Ol,{value:e,children:(0,_.jsx)(T,{id:e,data:b.data,type:w,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:b.selected??!1,selectable:D,draggable:E,deletable:b.deletable??!0,isConnectable:O,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:N,dragHandle:b.dragHandle,zIndex:x.z,parentId:b.parentId,...F})})})}var Ql=(0,S.memo)(Zl),$l=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function eu(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=X($l,J),o=ql(e.onlyRenderVisibleElements),s=Yl();return(0,_.jsx)(`div`,{className:`react-flow__nodes`,style:hl,children:o.map(o=>(0,_.jsx)(Ql,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}eu.displayName=`NodeRenderer`;var tu=(0,S.memo)(eu);function nu(e){return X((0,S.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Ao({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),J)}var ru=({color:e=`none`,strokeWidth:t=1})=>(0,_.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),iu=({color:e=`none`,strokeWidth:t=1})=>(0,_.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),au={[Ea.Arrow]:ru,[Ea.ArrowClosed]:iu};function ou(e){let t=Z();return(0,S.useMemo)(()=>Object.prototype.hasOwnProperty.call(au,e)?au[e]:(t.getState().onError?.(`009`,va.error009(e)),null),[e])}var su=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=ou(t);return c?(0,_.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,_.jsx)(c,{color:n,strokeWidth:o})}):null},cu=({defaultColor:e,rfId:t})=>{let n=X(e=>e.edges),r=X(e=>e.defaultEdgeOptions),i=(0,S.useMemo)(()=>qo(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,_.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,_.jsx)(`defs`,{children:i.map(e=>(0,_.jsx)(su,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};cu.displayName=`MarkerDefinitions`;var lu=(0,S.memo)(cu);function uu({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,S.useState)({x:1,y:0,width:0,height:0}),p=C([`react-flow__edge-textwrapper`,l]),m=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,_.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,_.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,_.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}uu.displayName=`EdgeText`;var du=(0,S.memo)(uu);function fu({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`path`,{...u,d:e,fill:`none`,className:C([`react-flow__edge-path`,u.className])}),l?(0,_.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&eo(t)&&eo(n)?(0,_.jsx)(du,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function pu({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===G.Left||e===G.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function mu({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:i,targetPosition:a=G.Top}){let[o,s]=pu({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=pu({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=q({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function hu(e){return(0,S.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})=>{let[y,b,x]=mu({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,_.jsx)(fu,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var gu=hu({isInternal:!1}),_u=hu({isInternal:!0});gu.displayName=`SimpleBezierEdge`,_u.displayName=`SimpleBezierEdgeInternal`;function vu(e){return(0,S.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=G.Bottom,targetPosition:m=G.Top,markerEnd:h,markerStart:g,pathOptions:v,interactionWidth:y})=>{let[b,x,S]=Bo({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition});return(0,_.jsx)(fu,{id:e.isInternal?void 0:t,path:b,labelX:x,labelY:S,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:y})})}var yu=vu({isInternal:!1}),bu=vu({isInternal:!0});yu.displayName=`SmoothStepEdge`,bu.displayName=`SmoothStepEdgeInternal`;function xu(e){return(0,S.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,_.jsx)(yu,{...n,id:r,pathOptions:(0,S.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Su=xu({isInternal:!1}),Cu=xu({isInternal:!0});Su.displayName=`StepEdge`,Cu.displayName=`StepEdgeInternal`;function wu(e){return(0,S.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,v,y]=Po({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,_.jsx)(fu,{id:e.isInternal?void 0:t,path:g,labelX:v,labelY:y,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Tu=wu({isInternal:!1}),Eu=wu({isInternal:!0});Tu.displayName=`StraightEdge`,Eu.displayName=`StraightEdgeInternal`;function Du(e){return(0,S.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=G.Bottom,targetPosition:s=G.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:v,interactionWidth:y})=>{let[b,x,S]=Do({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:v?.curvature});return(0,_.jsx)(fu,{id:e.isInternal?void 0:t,path:b,labelX:x,labelY:S,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:y})})}var Ou=Du({isInternal:!1}),ku=Du({isInternal:!0});Ou.displayName=`BezierEdge`,ku.displayName=`BezierEdgeInternal`;var Au={default:ku,straight:Eu,step:Cu,smoothstep:bu,simplebezier:_u},ju={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Mu=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,Nu=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Pu=`react-flow__edgeupdater`;function Fu({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,_.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:C([Pu,`${Pu}-${s}`]),cx:Mu(t,r,e),cy:Nu(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Iu({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Z(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ds.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),v=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),y=()=>p(!0),b=()=>p(!1);return(0,_.jsxs)(_.Fragment,{children:[(e===!0||e===`source`)&&(0,_.jsx)(Fu,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:y,onMouseOut:b,type:`source`}),(e===!0||e===`target`)&&(0,_.jsx)(Fu,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:b,type:`target`})]})}function Lu({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:v,disableKeyboardA11y:y}){let b=X(t=>t.edgeLookup.get(e)),x=X(e=>e.defaultEdgeOptions);b=x?{...x,...b}:b;let w=b.type||`default`,T=h?.[w]||Au[w];T===void 0&&(v?.(`011`,va.error011(w)),w=`default`,T=h?.default||Au.default);let E=!!(b.focusable||t&&b.focusable===void 0),D=d!==void 0&&(b.reconnectable||n&&b.reconnectable===void 0),O=!!(b.selectable||r&&b.selectable===void 0),k=(0,S.useRef)(null),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),P=Z(),{zIndex:F,sourceX:ee,sourceY:te,targetX:ne,targetY:I,sourcePosition:L,targetPosition:R}=X((0,S.useCallback)(t=>{let n=t.nodeLookup.get(b.source),r=t.nodeLookup.get(b.target);if(!n||!r)return{zIndex:b.zIndex,...ju};let i=Ho({id:e,sourceNode:n,targetNode:r,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:t.connectionMode,onError:v});return{zIndex:ko({selected:b.selected,zIndex:b.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||ju}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),J),z=(0,S.useMemo)(()=>b.markerStart?`url('#${Ko(b.markerStart,m)}')`:void 0,[b.markerStart,m]),re=(0,S.useMemo)(()=>b.markerEnd?`url('#${Ko(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||ee===null||te===null||ne===null||I===null)return null;let ie=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=P.getState();O&&(P.setState({nodesSelectionActive:!1}),b.selected&&a?(r({nodes:[],edges:[b]}),k.current?.blur()):n([e])),i&&i(t,b)},ae=a?e=>{a(e,{...b})}:void 0,oe=o?e=>{o(e,{...b})}:void 0,se=s?e=>{s(e,{...b})}:void 0,ce=c?e=>{c(e,{...b})}:void 0,le=l?e=>{l(e,{...b})}:void 0;return(0,_.jsx)(`svg`,{style:{zIndex:F},children:(0,_.jsxs)(`g`,{className:C([`react-flow__edge`,`react-flow__edge-${w}`,b.className,g,{selected:b.selected,animated:b.animated,inactive:!O&&!i,updating:A,selectable:O}]),onClick:ie,onDoubleClick:ae,onContextMenu:oe,onMouseEnter:se,onMouseMove:ce,onMouseLeave:le,onKeyDown:E?t=>{if(!y&&ba.includes(t.key)&&O){let{unselectNodesAndEdges:n,addSelectedEdges:r}=P.getState();t.key===`Escape`?(k.current?.blur(),n({edges:[b]})):r([e])}}:void 0,tabIndex:E?0:void 0,role:b.ariaRole??(E?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":E?`${vc}-${m}`:void 0,ref:k,...b.domAttributes,children:[!M&&(0,_.jsx)(T,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:O,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:ee,sourceY:te,targetX:ne,targetY:I,sourcePosition:L,targetPosition:R,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:z,markerEnd:re,pathOptions:`pathOptions`in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),D&&(0,_.jsx)(Iu,{edge:b,isReconnectable:D,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:ee,sourceY:te,targetX:ne,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:j,setReconnecting:N})]})})}var Ru=(0,S.memo)(Lu),zu=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Bu({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:v,elementsSelectable:y,onError:b}=X(zu,J),x=nu(t);return(0,_.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,_.jsx)(lu,{defaultColor:e,rfId:n}),x.map(e=>(0,_.jsx)(Ru,{id:e,edgesFocusable:g,edgesReconnectable:v,elementsSelectable:y,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:h},e))]})}Bu.displayName=`EdgeRenderer`;var Vu=(0,S.memo)(Bu),Hu=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Uu({children:e}){return(0,_.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:X(Hu)},children:e})}function Wu(e){let t=ul(),n=(0,S.useRef)(!1);(0,S.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Gu=e=>e.panZoom?.syncViewport;function Ku(e){let t=X(Gu),n=Z();return(0,S.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function qu(e){return e.connection.inProgress?{...e.connection,to:ro(e.connection.to,e.transform)}:{...e.connection}}function Ju(e){return e?t=>e(qu(t)):qu}function Yu(e){return X(Ju(e),J)}var Xu=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Zu({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=X(Xu,J);return a&&i&&c?(0,_.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,_.jsx)(`g`,{className:C([`react-flow__connection`,Oa(s)]),children:(0,_.jsx)(Qu,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Qu=({style:e,type:t=Ta.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=Yu();if(!i)return;if(n)return(0,_.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Oa(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ta.Bezier:[m]=Do(h);break;case Ta.SimpleBezier:[m]=mu(h);break;case Ta.Step:[m]=Bo({...h,borderRadius:0});break;case Ta.SmoothStep:[m]=Bo(h);break;default:[m]=Po(h)}return(0,_.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Qu.displayName=`ConnectionLine`;var $u={};function ed(e=$u){(0,S.useRef)(e),Z(),(0,S.useEffect)(()=>{},[e])}function td(){Z(),(0,S.useRef)(!1),(0,S.useEffect)(()=>{},[])}function nd({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:v,selectionKeyCode:y,selectionOnDrag:b,selectionMode:x,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,deleteKeyCode:T,onlyRenderVisibleElements:E,elementsSelectable:D,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:F,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,zoomOnDoubleClick:I,panOnDrag:L,autoPanOnSelection:R,onPaneClick:z,onPaneMouseEnter:re,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:we,onViewportChange:Te}){return ed(e),ed(t),td(),Wu(n),Ku(we),(0,_.jsx)(Gl,{onPaneClick:z,onPaneMouseEnter:re,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,deleteKeyCode:T,selectionKeyCode:y,selectionOnDrag:b,selectionMode:x,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,elementsSelectable:D,zoomOnScroll:P,zoomOnPinch:F,zoomOnDoubleClick:I,panOnScroll:ee,panOnScrollSpeed:te,panOnScrollMode:ne,panOnDrag:L,autoPanOnSelection:R,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:Te,isControlledViewport:!!we,children:(0,_.jsxs)(Uu,{children:[(0,_.jsx)(Vu,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:E,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:N,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,_.jsx)(Zu,{style:h,type:m,component:g,containerStyle:v}),(0,_.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,_.jsx)(tu,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:E,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce}),(0,_.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}nd.displayName=`GraphView`;var rd=(0,S.memo)(nd),id=to(`React Flow`,`https://reactflow.dev/`),ad=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??ya;ds(h,g,_);let{nodesInitialized:x}=ns(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=co(Pa(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:ya,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sa.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...W},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:id,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:xa,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},od=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>fc((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ra({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...ad({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=ns(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();ds(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=cs(e,n,r,i,a,o,l);d&&($o(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Wo(e,o.fromHandle,G.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=ss(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Kc(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(qc(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>Jc(e,!0)));return}i(Yc(r,new Set([...e]),!0)),a(Yc(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Jc(e,!0)));return}a(Yc(n,new Set([...e]))),i(Yc(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(Jc(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Jc(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,Jc(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Jc(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(ns(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ls({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...W}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...ad()})}},Object.is);function sd({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,S.useState)(()=>od({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,_.jsx)(mc,{value:m,children:(0,_.jsx)(sl,{children:p})})}function cd({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,S.useContext)(pc)?(0,_.jsx)(_.Fragment,{children:e}):(0,_.jsx)(sd,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var ld={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function ud({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:x,onNodeContextMenu:w,onNodeDoubleClick:T,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:k,onEdgesDelete:A,onDelete:j,onSelectionChange:M,onSelectionDragStart:N,onSelectionDrag:P,onSelectionDragStop:F,onSelectionContextMenu:ee,onSelectionStart:te,onSelectionEnd:ne,onBeforeDelete:I,connectionMode:L,connectionLineType:R=Ta.Bezier,connectionLineStyle:z,connectionLineComponent:re,connectionLineContainerStyle:ie,deleteKeyCode:ae=`Backspace`,selectionKeyCode:oe=`Shift`,selectionOnDrag:se=!1,selectionMode:ce=wa.Full,panActivationKeyCode:le=`Space`,multiSelectionKeyCode:ue=lo()?`Meta`:`Control`,zoomActivationKeyCode:de=lo()?`Meta`:`Control`,snapToGrid:fe,snapGrid:pe,onlyRenderVisibleElements:me=!1,selectNodesOnDrag:he,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,nodeOrigin:be=Mc,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce=!0,defaultViewport:we=Nc,minZoom:Te=.5,maxZoom:Ee=2,translateExtent:De=ya,preventScrolling:Oe=!0,nodeExtent:ke,defaultMarkerColor:Ae=`#b1b1b7`,zoomOnScroll:je=!0,zoomOnPinch:Me=!0,panOnScroll:Ne=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:Fe=Ca.Free,zoomOnDoubleClick:Ie=!0,panOnDrag:Le=!0,onPaneClick:Re,onPaneMouseEnter:ze,onPaneMouseMove:Be,onPaneMouseLeave:Ve,onPaneScroll:He,onPaneContextMenu:Ue,paneClickDistance:We=1,nodeClickDistance:Ge=0,children:Ke,onReconnect:qe,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:tt=10,onNodesChange:nt,onEdgesChange:rt,noDragClassName:it=`nodrag`,noWheelClassName:at=`nowheel`,noPanClassName:ot=`nopan`,fitView:st,fitViewOptions:ct,connectOnClick:lt,attributionPosition:ut,proOptions:dt,defaultEdgeOptions:ft,elevateNodesOnSelect:pt=!0,elevateEdgesOnSelect:mt=!1,disableKeyboardA11y:ht=!1,autoPanOnConnect:gt,autoPanOnNodeDrag:_t,autoPanOnSelection:vt=!0,autoPanSpeed:yt,connectionRadius:bt,isValidConnection:xt,onError:St,style:Ct,id:wt,nodeDragThreshold:Tt,connectionDragThreshold:Et,viewport:Dt,onViewportChange:Ot,width:kt,height:At,colorMode:jt=`light`,debug:Mt,onScroll:Nt,ariaLabelConfig:Pt,zIndexMode:Ft=`basic`,...It},Lt){let Rt=wt||`1`,zt=zc(jt),Bt=(0,S.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Nt?.(e)},[Nt]);return(0,_.jsx)(`div`,{"data-testid":`rf__wrapper`,...It,onScroll:Bt,style:{...Ct,...ld},ref:Lt,className:C([`react-flow`,i,zt]),id:wt,role:`application`,children:(0,_.jsxs)(cd,{nodes:e,edges:t,width:kt,height:At,fitView:st,fitViewOptions:ct,minZoom:Te,maxZoom:Ee,nodeOrigin:be,nodeExtent:ke,zIndexMode:Ft,children:[(0,_.jsx)(Lc,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:v,nodesDraggable:ge,autoPanOnNodeFocus:_e,nodesConnectable:ve,nodesFocusable:ye,edgesFocusable:xe,edgesReconnectable:Se,elementsSelectable:Ce,elevateNodesOnSelect:pt,elevateEdgesOnSelect:mt,minZoom:Te,maxZoom:Ee,nodeExtent:ke,onNodesChange:nt,onEdgesChange:rt,snapToGrid:fe,snapGrid:pe,connectionMode:L,translateExtent:De,connectOnClick:lt,defaultEdgeOptions:ft,fitView:st,fitViewOptions:ct,onNodesDelete:k,onEdgesDelete:A,onDelete:j,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:P,onSelectionDragStart:N,onSelectionDragStop:F,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:ot,nodeOrigin:be,rfId:Rt,autoPanOnConnect:gt,autoPanOnNodeDrag:_t,autoPanSpeed:yt,onError:St,connectionRadius:bt,isValidConnection:xt,selectNodesOnDrag:he,nodeDragThreshold:Tt,connectionDragThreshold:Et,onBeforeDelete:I,debug:Mt,ariaLabelConfig:Pt,zIndexMode:Ft}),(0,_.jsx)(rd,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:x,onNodeContextMenu:w,onNodeDoubleClick:T,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:re,connectionLineContainerStyle:ie,selectionKeyCode:oe,selectionOnDrag:se,selectionMode:ce,deleteKeyCode:ae,multiSelectionKeyCode:ue,panActivationKeyCode:le,zoomActivationKeyCode:de,onlyRenderVisibleElements:me,defaultViewport:we,translateExtent:De,minZoom:Te,maxZoom:Ee,preventScrolling:Oe,zoomOnScroll:je,zoomOnPinch:Me,zoomOnDoubleClick:Ie,panOnScroll:Ne,panOnScrollSpeed:Pe,panOnScrollMode:Fe,panOnDrag:Le,autoPanOnSelection:vt,onPaneClick:Re,onPaneMouseEnter:ze,onPaneMouseMove:Be,onPaneMouseLeave:Ve,onPaneScroll:He,onPaneContextMenu:Ue,paneClickDistance:We,nodeClickDistance:Ge,onSelectionContextMenu:ee,onSelectionStart:te,onSelectionEnd:ne,onReconnect:qe,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:tt,defaultMarkerColor:Ae,noDragClassName:it,noWheelClassName:at,noPanClassName:ot,rfId:Rt,disableKeyboardA11y:ht,nodeExtent:ke,viewport:Dt,onViewportChange:Ot}),(0,_.jsx)(jc,{onSelectionChange:M}),Ke,(0,_.jsx)(Tc,{proOptions:dt,position:ut}),(0,_.jsx)(Cc,{rfId:Rt,disableKeyboardA11y:ht})]})})}var dd=nl(ud);va.error014();function fd({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,_.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:C([`react-flow__background-pattern`,n,r])})}function pd({radius:e,className:t}){return(0,_.jsx)(`circle`,{cx:e,cy:e,r:e,className:C([`react-flow__background-pattern`,`dots`,t])})}var md;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(md||={});var hd={[md.Dots]:1,[md.Lines]:1,[md.Cross]:6},gd=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function _d({id:e,variant:t=md.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,S.useRef)(null),{transform:f,patternId:p}=X(gd,J),m=r||hd[t],h=t===md.Dots,g=t===md.Cross,v=Array.isArray(n)?n:[n,n],y=[v[0]*f[2]||1,v[1]*f[2]||1],b=m*f[2],x=Array.isArray(a)?a:[a,a],w=g?[b,b]:y,T=[x[0]*f[2]||1+w[0]/2,x[1]*f[2]||1+w[1]/2],E=`${p}${e||``}`;return(0,_.jsxs)(`svg`,{className:C([`react-flow__background`,l]),style:{...c,...hl,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,_.jsx)(`pattern`,{id:E,x:f[0]%y[0],y:f[1]%y[1],width:y[0],height:y[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${T[0]},-${T[1]})`,children:h?(0,_.jsx)(pd,{radius:b/2,className:u}):(0,_.jsx)(fd,{dimensions:w,lineWidth:i,variant:t,className:u})}),(0,_.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${E})`})]})}_d.displayName=`Background`;var vd=(0,S.memo)(_d);function yd(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,_.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function bd(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,_.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function xd(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,_.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 Sd(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,_.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 Cd(){return(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,_.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 wd({children:e,className:t,...n}){return(0,_.jsx)(`button`,{type:`button`,className:C([`react-flow__controls-button`,t]),...n,children:e})}var Td=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Ed({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Z(),{isInteractive:h,minZoomReached:g,maxZoomReached:v,ariaLabelConfig:y}=X(Td,J),{zoomIn:b,zoomOut:x,fitView:S}=ul();return(0,_.jsxs)(wc,{className:C([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??y[`controls.ariaLabel`],children:[t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(wd,{onClick:()=>{b(),a?.()},className:`react-flow__controls-zoomin`,title:y[`controls.zoomIn.ariaLabel`],"aria-label":y[`controls.zoomIn.ariaLabel`],disabled:v,children:(0,_.jsx)(yd,{})}),(0,_.jsx)(wd,{onClick:()=>{x(),o?.()},className:`react-flow__controls-zoomout`,title:y[`controls.zoomOut.ariaLabel`],"aria-label":y[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,_.jsx)(bd,{})})]}),n&&(0,_.jsx)(wd,{className:`react-flow__controls-fitview`,onClick:()=>{S(i),s?.()},title:y[`controls.fitView.ariaLabel`],"aria-label":y[`controls.fitView.ariaLabel`],children:(0,_.jsx)(xd,{})}),r&&(0,_.jsx)(wd,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:y[`controls.interactive.ariaLabel`],"aria-label":y[`controls.interactive.ariaLabel`],children:h?(0,_.jsx)(Cd,{}):(0,_.jsx)(Sd,{})}),u]})}Ed.displayName=`Controls`,(0,S.memo)(Ed);function Dd({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,_.jsx)(`rect`,{className:C([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Od=(0,S.memo)(Dd),kd=e=>e.nodes.map(e=>e.id),Ad=e=>e instanceof Function?e:()=>e;function jd({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Od,onClick:o}){let s=X(kd,J),c=Ad(t),l=Ad(e),u=Ad(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,_.jsx)(_.Fragment,{children:s.map(e=>(0,_.jsx)(Nd,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Md({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=X(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=fo(r);return{node:r,x:i,y:a,width:o,height:s}},J);return!l||l.hidden||!po(l)?null:(0,_.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Nd=(0,S.memo)(Md),Pd=(0,S.memo)(jd),Fd=200,Id=150,Ld=e=>!e.hidden,Rd=e=>{let 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?Za(Pa(e.nodeLookup,{filter:Ld}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},zd=`react-flow__minimap-desc`;function Bd({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:v,inversePan:y,zoomStep:b=1,offsetScale:x=5}){let w=Z(),T=(0,S.useRef)(null),{boundingRect:E,viewBB:D,rfId:O,panZoom:k,translateExtent:A,flowWidth:j,flowHeight:M,ariaLabelConfig:N}=X(Rd,J),P=e?.width??Fd,F=e?.height??Id,ee=E.width/P,te=E.height/F,ne=Math.max(ee,te),I=ne*P,L=ne*F,R=x*ne,z=E.x-(I-E.width)/2-R,re=E.y-(L-E.height)/2-R,ie=I+R*2,ae=L+R*2,oe=`${zd}-${O}`,se=(0,S.useRef)(0),ce=(0,S.useRef)();se.current=ne,(0,S.useEffect)(()=>{if(T.current&&k)return ce.current=Os({domNode:T.current,panZoom:k,getTransform:()=>w.getState().transform,getViewScale:()=>se.current}),()=>{ce.current?.destroy()}},[k]),(0,S.useEffect)(()=>{ce.current?.update({translateExtent:A,width:j,height:M,inversePan:y,pannable:h,zoomStep:b,zoomable:g})},[h,g,y,b,A,j,M]);let le=p?e=>{let[t,n]=ce.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ue=m?(0,S.useCallback)((e,t)=>{let n=w.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,de=v??N[`minimap.ariaLabel`];return(0,_.jsx)(wc,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ne: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 o==`number`?o:void 0},className:C([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,_.jsxs)(`svg`,{width:P,height:F,viewBox:`${z} ${re} ${ie} ${ae}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":oe,ref:T,onClick:le,children:[de&&(0,_.jsx)(`title`,{id:oe,children:de}),(0,_.jsx)(Pd,{onClick:ue,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,_.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${re-R}h${ie+R*2}v${ae+R*2}h${-ie-R*2}z
|
|
14
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Bd.displayName=`MiniMap`,(0,S.memo)(Bd);var Vd=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Hd={[Us.Line]:`right`,[Us.Handle]:`bottom-right`};function Ud({nodeId:e,position:t,variant:n=Us.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:v}){let y=kl(),b=typeof e==`string`?e:y,x=Z(),w=(0,S.useRef)(null),T=n===Us.Handle,E=X((0,S.useCallback)(Vd(T&&p),[T,p]),J),D=(0,S.useRef)(null),O=t??Hd[n];return(0,S.useEffect)(()=>{if(!(!w.current||!b))return D.current||=ec({domNode:w.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=x.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=x.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=ss([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...mo({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};x.getState().triggerNodeChanges([n])}}),D.current.update({controlPosition:O,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:m}),()=>{D.current?.destroy()}},[O,s,c,l,u,d,h,g,v,m]),(0,_.jsx)(`div`,{className:C([`react-flow__resize-control`,`nodrag`,...O.split(`-`),n,r]),ref:w,style:{...i,scale:E,...o&&{[T?`backgroundColor`:`borderColor`]:o}},children:a})}(0,S.memo)(Ud);function Wd({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,markerEnd:s,data:c}){let[l]=Bo({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o,borderRadius:14});return(0,_.jsx)(fu,{id:e,className:`anlyx-flow-rf-edge anlyx-flow-rf-edge--${(c?.tone??`blue`).toLowerCase()}`,path:l,...s?{markerEnd:s}:{}})}var Gd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Kd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jd=e=>{let t=qd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yd={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Xd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Zd=(0,S.createContext)({}),Qd=()=>(0,S.useContext)(Zd),$d=(0,S.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Qd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,S.createElement)(`svg`,{ref:c,...Yd,width:t??l??Yd.width,height:t??l??Yd.height,stroke:e??f,strokeWidth:m,className:Gd(`lucide`,p,i),...!a&&!Xd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ef=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)($d,{ref:i,iconNode:t,className:Gd(`lucide-${Kd(Jd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jd(e),n},tf=ef(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),nf=ef(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),rf=ef(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),af=ef(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),of=ef(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),sf=ef(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),cf=ef(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);function lf({data:e}){let t=e,n=uf(t.kind),r=t.state??`taken`;return(0,_.jsxs)(v,{className:`anlyx-flow-rf-node anlyx-flow-rf-node--${t.accent} anlyx-flow-rf-node--${r}`,children:[(0,_.jsx)(Nl,{className:`anlyx-flow-rf-handle`,position:G.Left,type:`target`}),(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-node__top`,children:[(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__icon`,"aria-hidden":`true`,children:(0,_.jsx)(n,{size:14,strokeWidth:2.25})}),(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__label`,children:t.label}),t.step?(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__step`,children:t.step}):null]}),(0,_.jsx)(b,{content:t.fullValue??t.value,children:(0,_.jsx)(`p`,{className:`anlyx-flow-rf-node__value`,children:t.value})}),t.sub?(0,_.jsx)(`p`,{className:`anlyx-flow-rf-node__sub`,children:t.sub}):null,(0,_.jsx)(y,{tone:t.accent===`violet`?`violet`:t.accent,children:t.badge}),(0,_.jsx)(Nl,{className:`anlyx-flow-rf-handle`,position:G.Right,type:`source`})]})}function uf(e){switch(e){case`api`:return af;case`controller`:return nf;case`service`:return of;case`repository`:return tf;case`database`:return rf;case`auth`:return sf;case`result`:return cf}}var df={anlyxFlowNode:lf},ff={anlyxFlowEdge:Wd},pf=224,mf=76,hf=54,gf=196;function _f({flow:e,method:t,path:n,status:r,endpointConfidence:i}){let a=(0,S.useMemo)(()=>yf({flow:e,method:t,path:n,status:r}),[e,t,n,r]);return a.nodes.length===0?(0,_.jsxs)(`section`,{className:`anlyx-flow-rf-section`,children:[(0,_.jsx)(`div`,{className:`anlyx-flow-rf-head`,children:(0,_.jsx)(`h3`,{children:`Matched backend flow`})}),(0,_.jsx)(`div`,{className:`anlyx-flow-rf-empty`,children:`No scanned main flow was inferred yet.`})]}):(0,_.jsxs)(`section`,{className:`anlyx-flow-rf-section`,children:[(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Matched backend flow`}),(0,_.jsx)(`p`,{children:`Live path first, scanned downstream stays muted.`})]}),(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-head__badges`,children:[(0,_.jsx)(y,{tone:`blue`,children:t}),(0,_.jsxs)(y,{tone:`green`,children:[`confidence `,i??`unknown`]})]})]}),(0,_.jsx)(`div`,{className:`anlyx-flow-rf-canvas`,"data-testid":`anlyx-react-flow-main`,children:(0,_.jsxs)(dd,{edgeTypes:ff,edges:a.edges,elementsSelectable:!1,fitView:!0,fitViewOptions:{padding:.16},maxZoom:1.35,minZoom:.58,nodes:a.nodes,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:df,panOnDrag:!0,proOptions:{hideAttribution:!0},zoomOnDoubleClick:!1,zoomOnPinch:!0,zoomOnScroll:!0,children:[(0,_.jsx)(vf,{}),(0,_.jsx)(vd,{color:`rgba(148, 163, 184, .42)`,gap:18,size:1,variant:md.Dots})]})}),(0,_.jsx)(`p`,{className:`anlyx-flow-rf-note`,children:`Anlyx mapped this browser-visible request to the scanned backend flow. Muted nodes are known code paths; framework server-side fetches, such as Next.js server component data loading, require the scanned path until a server runtime bridge is enabled.`})]})}function vf(){let{fitView:e,setViewport:t}=ul(),n=(0,S.useCallback)(()=>{e({padding:.18,duration:160})},[e]),r=(0,S.useCallback)(()=>{t({x:20,y:22,zoom:.82},{duration:160})},[t]);return(0,_.jsxs)(wc,{className:`anlyx-flow-rf-controls`,position:`top-right`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:n,title:`Fit the full flow into view`,children:`Fit view`}),(0,_.jsx)(`button`,{type:`button`,onClick:r,title:`Reset to the default canvas position`,children:`Reset view`})]})}function yf({flow:e,method:t,path:n,status:r}){let i=Number(r)===401||Number(r)===403,a=Cf(e),o=a.find(e=>e.type===`controller`),s=a.filter(e=>e.type!==`endpoint`&&e.type!==`controller`),c=[],l=[];if(c.push(bf(`api`,0,mf,{kind:`api`,label:`API`,value:`${t} ${n}`,badge:`high`,accent:`blue`,fullValue:`${t} ${n}`,step:`01`,state:`taken`})),o&&c.push(bf(`controller`,pf,mf,{kind:`controller`,label:`Controller`,value:jf(o.label),sub:Mf(o.label),badge:o.confidence??`unknown`,accent:`blue`,fullValue:o.label,step:`02`,state:`taken`})),i){let e=o?pf*2:pf,t=o?pf*3:pf*2;return c.push(bf(`auth`,e,hf,{kind:`auth`,label:`Auth / Session`,value:`Auth gate inferred`,sub:Number(r)===403?`Likely permission gate`:`Likely login gate`,badge:`inferred ${r}`,accent:`violet`,fullValue:`Inferred from the browser 401/403 result, not a runtime server trace.`,step:o?`03`:`02`,state:`taken`})),c.push(bf(`result`,t,hf,Sf(r,{step:o?`04`:`03`}))),s.forEach((t,n)=>{c.push(bf(`support-${n}`,e+n*pf,gf,wf(t,!0)))}),l.push(xf(`api-controller`,`api`,o?`controller`:`auth`,`blue`,!0)),o&&l.push(xf(`controller-auth`,`controller`,`auth`,`violet`,!0)),l.push(xf(`auth-result`,`auth`,`result`,`amber`,!0)),s.forEach((e,t)=>{l.push(xf(`support-${t}`,t===0?o?`controller`:`api`:`support-${t-1}`,`support-${t}`,`gray`,!1))}),{nodes:c,edges:l}}return s.forEach((e,t)=>{c.push(bf(`support-${t}`,(t+(o?2:1))*pf,mf,wf(e)))}),c.push(bf(`result`,(s.length+(o?2:1))*pf,mf,Sf(r,{step:String(s.length+(o?3:2)).padStart(2,`0`)}))),c.slice(0,-1).forEach((e,t)=>{let n=c[t+1];l.push(xf(`main-${t}`,e.id,n.id,kf(t,n.data.kind),!0))}),{nodes:c,edges:l}}function bf(e,t,n,r){return{id:e,type:`anlyxFlowNode`,position:{x:t,y:n},data:r}}function xf(e,t,n,r,i){return{id:`drawer-edge-${e}`,source:t,target:n,type:`anlyxFlowEdge`,animated:i,markerEnd:{type:Ea.ArrowClosed,width:10,height:10,color:Af(r)},data:{tone:r}}}function Sf(e,t={}){return{kind:`result`,label:`Result`,value:`${e} ${Pf(e)}`,sub:Number(e)>=400?`Request blocked`:`Request completed`,badge:Number(e)>=400?`blocked`:`observed`,accent:Number(e)>=400?`amber`:`green`,fullValue:Ff(e),...t.step?{step:t.step}:{},state:Number(e)>=400?`blocked`:`taken`}}function Cf(e){if(!e||!Array.isArray(e.mainPath))return[];let t=new Map(e.nodes.map(e=>[e.id,e]));return e.mainPath.map(e=>t.get(e)).filter(e=>!!e)}function wf(e,t=!1){let n=Tf(e.type),r=t?`Scanned ${Df(n)?.toLowerCase()??`step`}`:Df(n);return{kind:n,label:Ef(n),value:jf(e.label),badge:t?`scanned`:e.confidence??`unknown`,accent:t?`gray`:Of(n),fullValue:e.label,state:t?`scanned`:`taken`,...r?{sub:r}:{}}}function Tf(e){return e===`service`?`service`:e===`repository`?`repository`:e===`database`?`database`:`service`}function Ef(e){return e===`repository`?`Repository`:e===`database`?`Database`:`Service`}function Df(e){return e===`repository`?`Data access`:e===`database`?`Persistence`:`Business logic`}function Of(e){return e===`database`?`green`:e===`repository`?`amber`:`violet`}function kf(e,t){return t===`auth`?`violet`:t===`result`?`amber`:e===0?`blue`:`violet`}function Af(e){return e===`amber`?`#f59e0b`:e===`violet`?`#7c3aed`:e===`gray`?`#94a3b8`:`#2563eb`}function jf(e){if(!e)return`Unknown`;if(e.includes(`#`)){let[t,n]=e.split(`#`);return`${Nf(t??``)}#${n??``}`}return Nf(e)}function Mf(e){if(!e)return`Unknown`;if(e.includes(`#`)){let[t]=e.split(`#`);return Nf(t??``)}return Nf(e)}function Nf(e){let t=String(e).split(`.`);return t[t.length-1]||e}function Pf(e){let t=Number(e);return t===401?`Auth required`:t===403?`Permission denied`:t>=500?`Server error`:t>=400?`Client error`:t>=200&&t<300?`OK`:`Observed`}function Ff(e){let t=Number(e);return t===401?`login required · 401`:t===403?`permission denied · 403`:t>=500?`server error · ${e}`:t>=400?`client error · ${e}`:t>=200&&t<300?`success · ${e}`:`status ${e}`}function If({events:e,selectedEventId:t}){let[n,r]=(0,S.useState)(`action`),i=(0,S.useMemo)(()=>e.filter(e=>!!e.triggeredBy),[e]),a=(0,S.useMemo)(()=>e.filter(e=>!e.triggeredBy),[e]),o=n===`action`?i:n===`background`?a:e,s=n===`action`?`No user-action API requests yet.`:n===`background`?`No background API requests observed.`:`No API events observed yet.`;return(0,_.jsxs)(`section`,{className:`anlyx-events-table-section`,children:[(0,_.jsxs)(`div`,{className:`anlyx-events-table-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Recent API events`}),(0,_.jsx)(`p`,{children:`Action requests are primary. Background traffic stays quiet until selected.`})]}),(0,_.jsxs)(`div`,{className:`anlyx-events-filter`,role:`tablist`,"aria-label":`Filter API events`,children:[(0,_.jsxs)(`button`,{"aria-selected":n===`action`,type:`button`,onClick:()=>r(`action`),children:[`Actions `,(0,_.jsx)(`span`,{children:i.length})]}),(0,_.jsxs)(`button`,{"aria-selected":n===`background`,type:`button`,onClick:()=>r(`background`),children:[`Background `,(0,_.jsx)(`span`,{children:a.length})]}),(0,_.jsxs)(`button`,{"aria-selected":n===`all`,type:`button`,onClick:()=>r(`all`),children:[`All `,(0,_.jsx)(`span`,{children:e.length})]})]})]}),o.length===0?(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:s}):(0,_.jsxs)(x,{children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`Method`}),(0,_.jsx)(`th`,{children:`Path`}),(0,_.jsx)(`th`,{children:`Status`}),(0,_.jsx)(`th`,{children:`Match`}),(0,_.jsx)(`th`,{children:`Source`}),(0,_.jsx)(`th`,{children:`Duration`})]})}),(0,_.jsx)(`tbody`,{children:o.slice(0,6).map(e=>(0,_.jsxs)(`tr`,{className:e.id===t?`anlyx-events-table-row--selected`:``,"data-event-id":e.id,tabIndex:0,title:`Inspect this API event`,children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:`blue`,children:e.method})}),(0,_.jsx)(`td`,{className:`anlyx-events-table-path`,children:e.path}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:Number(e.status)>=400?`amber`:`green`,children:e.status})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:e.matchedEndpoint?`green`:`amber`,children:e.matchedEndpoint?`matched`:`unmatched`})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:e.triggeredBy?`blue`:`gray`,children:e.triggeredBy?`action`:e.source===`health`?`health`:`background`})}),(0,_.jsxs)(`td`,{children:[e.durationMs,`ms`]})]},e.id))})]})]})}function Lf({selectedEvent:e,events:t,latestAction:n,scannedHints:r=[],loadError:i}){return i?(0,_.jsx)(`div`,{className:`anlyx-flow-drawer-body`,children:(0,_.jsxs)(v,{children:[(0,_.jsx)(`h3`,{className:`anlyx-ov-section-title`,children:`Report data`}),(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:i})]})}):e?(0,_.jsxs)(`div`,{className:`anlyx-flow-drawer-body`,children:[(0,_.jsx)(Vf,{event:e}),e.matchedEndpoint?(0,_.jsx)(_f,{flow:e.matchedFlow,method:e.method,path:e.path,status:e.status,...e.matchedEndpoint.confidence?{endpointConfidence:e.matchedEndpoint.confidence}:{}}):(0,_.jsxs)(v,{className:`anlyx-unmatched-card`,children:[(0,_.jsx)(`h3`,{children:`No scanned endpoint matched`}),(0,_.jsx)(`p`,{children:`Anlyx saw this browser request, but no scanned endpoint path matched it.`})]}),(0,_.jsx)(If,{events:t,selectedEventId:e.id})]}):(0,_.jsxs)(`div`,{className:`anlyx-flow-drawer-body`,children:[n?(0,_.jsx)(Bf,{latestAction:n}):(0,_.jsx)(zf,{}),r.length>0?(0,_.jsx)(Rf,{hints:r}):null,(0,_.jsx)(If,{events:t,selectedEventId:null})]})}function Rf({hints:e}){return(0,_.jsxs)(v,{className:`anlyx-scanned-hints`,children:[(0,_.jsxs)(`div`,{className:`anlyx-scanned-hints__head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Scanned / inferred hints`}),(0,_.jsx)(`p`,{children:`These are known page links, not browser-live requests.`})]}),(0,_.jsx)(y,{tone:`gray`,children:`Not browser-live`})]}),(0,_.jsx)(`div`,{className:`anlyx-scanned-hints__list`,children:e.slice(0,4).map((e,t)=>(0,_.jsxs)(`div`,{className:`anlyx-scanned-hint`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(y,{tone:e.evidence===`capture`?`green`:`violet`,children:e.evidence===`capture`?`captured page link`:`scanned page link`}),(0,_.jsx)(`strong`,{title:e.endpointLabel??`${e.method} ${e.path}`,children:e.endpointLabel??`${e.method} ${e.path}`})]}),(0,_.jsx)(`p`,{title:e.pageFilePath??e.pageRoute,children:e.pageRoute})]},`${e.pageRoute}:${e.method}:${e.path}:${t}`))})]})}function zf(){return(0,_.jsxs)(v,{children:[(0,_.jsx)(`h3`,{className:`anlyx-ov-section-title`,children:`Waiting`}),(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:`Use the app normally. Anlyx opens the main flow for requests caused by your direct action. Background requests stay in Recent API events until you select them.`})]})}function Bf({latestAction:e}){return(0,_.jsxs)(v,{className:`anlyx-no-primary-card`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(y,{tone:`amber`,children:`No action API yet`}),(0,_.jsx)(`h3`,{children:Uf(e)}),(0,_.jsx)(`p`,{children:e.selector??`No stable selector captured`})]}),(0,_.jsx)(`div`,{className:`anlyx-no-primary-card__note`,children:`Only background session checks were detected. They are hidden from the main flow.`})]})}function Vf({event:e}){let t=!!e.matchedEndpoint;return(0,_.jsxs)(v,{className:`anlyx-captured-request`,children:[(0,_.jsxs)(`div`,{className:`anlyx-captured-request__top`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Captured request`}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__path`,children:[(0,_.jsx)(y,{tone:`blue`,children:e.method}),(0,_.jsx)(`strong`,{children:e.path})]})]}),(0,_.jsx)(y,{tone:t?`green`:`amber`,children:t?`matched`:`unmatched`})]}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__summary`,children:[(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`b`,{children:e.matchedEndpoint?`endpoint`:`browser`}),` `,e.matchedEndpoint?`${e.matchedEndpoint.method} ${e.matchedEndpoint.path}`:e.path]}),(0,_.jsx)(`span`,{children:(0,_.jsx)(`b`,{children:Wf(e.status)})}),(0,_.jsxs)(`span`,{children:[e.durationMs,`ms`,e.count&&e.count>1?` · seen x${e.count}`:``]}),e.matchedEndpoint?.confidence?(0,_.jsxs)(`span`,{children:[`confidence `,e.matchedEndpoint.confidence]}):null,(0,_.jsx)(`span`,{children:e.triggeredBy?`user action`:e.source===`health`?`health/background`:`background`})]}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__steps`,children:[(0,_.jsx)(Hf,{label:`Action`,title:e.triggeredBy?Uf(e.triggeredBy):`No user action captured`,detail:e.triggeredBy?.selector??`Request may have fired on page load`,tone:e.triggeredBy?`blue`:`amber`}),(0,_.jsx)(Hf,{label:`Request`,title:`${e.method} ${e.path}`,detail:t?`Matched scanned endpoint`:`No scanned endpoint matched`,tone:t?`green`:`amber`}),(0,_.jsx)(Hf,{label:`Result`,title:Wf(e.status),detail:`${e.durationMs}ms${e.count&&e.count>1?` · seen x${e.count}`:``}`,tone:Number(e.status)>=400?`amber`:`green`})]})]})}function Hf({label:e,title:t,detail:n,tone:r}){return(0,_.jsxs)(`div`,{className:`anlyx-captured-step anlyx-captured-step--${r}`,children:[(0,_.jsx)(`span`,{className:`anlyx-captured-step__dot`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{children:e}),(0,_.jsx)(`strong`,{children:t}),(0,_.jsx)(`span`,{children:n})]})]})}function Uf(e){return`${e.type??`Action`} ${e.label??`unnamed element`}`}function Wf(e){let t=Number(e);return t===401?`login required · 401`:t===403?`permission denied · 403`:t>=500?`server error · ${e}`:t>=400?`client error · ${e}`:t>=200?`success · ${e}`:`status ${e}`}var Gf=new WeakMap;window.__ANLYX_RENDER_FLOW_DRAWER__=(e,t)=>{let n=Gf.get(e),r=n??(0,h.createRoot)(e);n||Gf.set(e,r),r.render((0,_.jsx)(Lf,{...t}))}})();
|
|
14
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Bd.displayName=`MiniMap`,(0,S.memo)(Bd);var Vd=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Hd={[Us.Line]:`right`,[Us.Handle]:`bottom-right`};function Ud({nodeId:e,position:t,variant:n=Us.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:v}){let y=kl(),b=typeof e==`string`?e:y,x=Z(),w=(0,S.useRef)(null),T=n===Us.Handle,E=X((0,S.useCallback)(Vd(T&&p),[T,p]),J),D=(0,S.useRef)(null),O=t??Hd[n];return(0,S.useEffect)(()=>{if(!(!w.current||!b))return D.current||=ec({domNode:w.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=x.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=x.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=ss([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...mo({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};x.getState().triggerNodeChanges([n])}}),D.current.update({controlPosition:O,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:m}),()=>{D.current?.destroy()}},[O,s,c,l,u,d,h,g,v,m]),(0,_.jsx)(`div`,{className:C([`react-flow__resize-control`,`nodrag`,...O.split(`-`),n,r]),ref:w,style:{...i,scale:E,...o&&{[T?`backgroundColor`:`borderColor`]:o}},children:a})}(0,S.memo)(Ud);function Wd({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,markerEnd:s,data:c}){let[l]=Bo({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o,borderRadius:14});return(0,_.jsx)(fu,{id:e,className:`anlyx-flow-rf-edge anlyx-flow-rf-edge--${(c?.tone??`blue`).toLowerCase()}`,path:l,...s?{markerEnd:s}:{}})}var Gd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Kd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jd=e=>{let t=qd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yd={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Xd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Zd=(0,S.createContext)({}),Qd=()=>(0,S.useContext)(Zd),$d=(0,S.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Qd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,S.createElement)(`svg`,{ref:c,...Yd,width:t??l??Yd.width,height:t??l??Yd.height,stroke:e??f,strokeWidth:m,className:Gd(`lucide`,p,i),...!a&&!Xd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ef=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)($d,{ref:i,iconNode:t,className:Gd(`lucide-${Kd(Jd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jd(e),n},tf=ef(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),nf=ef(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),rf=ef(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),af=ef(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),of=ef(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),sf=ef(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),cf=ef(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);function lf({data:e}){let t=e,n=uf(t.kind),r=t.state??`taken`;return(0,_.jsxs)(v,{className:`anlyx-flow-rf-node anlyx-flow-rf-node--${t.accent} anlyx-flow-rf-node--${r}`,children:[(0,_.jsx)(Nl,{className:`anlyx-flow-rf-handle`,position:G.Left,type:`target`}),(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-node__top`,children:[(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__icon`,"aria-hidden":`true`,children:(0,_.jsx)(n,{size:14,strokeWidth:2.25})}),(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__label`,children:t.label}),t.step?(0,_.jsx)(`span`,{className:`anlyx-flow-rf-node__step`,children:t.step}):null]}),(0,_.jsx)(b,{content:t.fullValue??t.value,children:(0,_.jsx)(`p`,{className:`anlyx-flow-rf-node__value`,children:t.value})}),t.sub?(0,_.jsx)(`p`,{className:`anlyx-flow-rf-node__sub`,children:t.sub}):null,(0,_.jsx)(y,{tone:t.accent===`violet`?`violet`:t.accent,children:t.badge}),(0,_.jsx)(Nl,{className:`anlyx-flow-rf-handle`,position:G.Right,type:`source`})]})}function uf(e){switch(e){case`api`:return af;case`controller`:return nf;case`service`:return of;case`repository`:return tf;case`database`:return rf;case`auth`:return sf;case`result`:return cf}}var df={anlyxFlowNode:lf},ff={anlyxFlowEdge:Wd},pf=224,mf=76,hf=54,gf=196;function _f({flow:e,method:t,path:n,status:r,endpointConfidence:i}){let a=(0,S.useMemo)(()=>yf({flow:e,method:t,path:n,status:r}),[e,t,n,r]);return a.nodes.length===0?(0,_.jsxs)(`section`,{className:`anlyx-flow-rf-section`,children:[(0,_.jsx)(`div`,{className:`anlyx-flow-rf-head`,children:(0,_.jsx)(`h3`,{children:`Matched backend flow`})}),(0,_.jsx)(`div`,{className:`anlyx-flow-rf-empty`,children:`No scanned main flow was inferred yet.`})]}):(0,_.jsxs)(`section`,{className:`anlyx-flow-rf-section`,children:[(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Matched backend flow`}),(0,_.jsx)(`p`,{children:`Browser request first, scanned backend path follows.`})]}),(0,_.jsxs)(`div`,{className:`anlyx-flow-rf-head__badges`,children:[(0,_.jsx)(y,{tone:`blue`,children:t}),(0,_.jsxs)(y,{tone:`green`,children:[`confidence `,i??`unknown`]})]})]}),(0,_.jsx)(`div`,{className:`anlyx-flow-rf-canvas`,"data-testid":`anlyx-react-flow-main`,children:(0,_.jsxs)(dd,{edgeTypes:ff,edges:a.edges,elementsSelectable:!1,fitView:!0,fitViewOptions:{padding:.16},maxZoom:1.35,minZoom:.58,nodes:a.nodes,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:df,panOnDrag:!0,proOptions:{hideAttribution:!0},zoomOnDoubleClick:!1,zoomOnPinch:!0,zoomOnScroll:!0,children:[(0,_.jsx)(vf,{}),(0,_.jsx)(vd,{color:`rgba(148, 163, 184, .42)`,gap:18,size:1,variant:md.Dots})]})}),(0,_.jsx)(`p`,{className:`anlyx-flow-rf-note`,children:`Anlyx mapped this browser-observed request to a scanned backend path. Backend nodes are source-derived evidence, not a runtime trace; muted nodes are known code paths that the browser result did not prove were executed.`})]})}function vf(){let{fitView:e,setViewport:t}=ul(),n=(0,S.useCallback)(()=>{e({padding:.18,duration:160})},[e]),r=(0,S.useCallback)(()=>{t({x:20,y:22,zoom:.82},{duration:160})},[t]);return(0,_.jsxs)(wc,{className:`anlyx-flow-rf-controls`,position:`top-right`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:n,title:`Fit the full flow into view`,children:`Fit view`}),(0,_.jsx)(`button`,{type:`button`,onClick:r,title:`Reset to the default canvas position`,children:`Reset view`})]})}function yf({flow:e,method:t,path:n,status:r}){let i=Number(r)===401||Number(r)===403,a=Cf(e),o=a.find(e=>e.type===`controller`),s=a.filter(e=>e.type!==`endpoint`&&e.type!==`controller`),c=[],l=[];if(c.push(bf(`api`,0,mf,{kind:`api`,label:`API`,value:`${t} ${n}`,badge:`high`,accent:`blue`,fullValue:`${t} ${n}`,step:`01`,state:`taken`})),o&&c.push(bf(`controller`,pf,mf,{kind:`controller`,label:`Controller`,value:jf(o.label),sub:Mf(o.label),badge:o.confidence??`unknown`,accent:`blue`,fullValue:o.label,step:`02`,state:`taken`})),i){let e=o?pf*2:pf,t=o?pf*3:pf*2;return c.push(bf(`auth`,e,hf,{kind:`auth`,label:`Auth / Session`,value:`Auth gate inferred`,sub:Number(r)===403?`Likely permission gate`:`Likely login gate`,badge:`inferred ${r}`,accent:`violet`,fullValue:`Inferred from the browser 401/403 result, not a runtime server trace.`,step:o?`03`:`02`,state:`taken`})),c.push(bf(`result`,t,hf,Sf(r,{step:o?`04`:`03`}))),s.forEach((t,n)=>{c.push(bf(`support-${n}`,e+n*pf,gf,wf(t,!0)))}),l.push(xf(`api-controller`,`api`,o?`controller`:`auth`,`blue`,!0)),o&&l.push(xf(`controller-auth`,`controller`,`auth`,`violet`,!0)),l.push(xf(`auth-result`,`auth`,`result`,`amber`,!0)),s.forEach((e,t)=>{l.push(xf(`support-${t}`,t===0?o?`controller`:`api`:`support-${t-1}`,`support-${t}`,`gray`,!1))}),{nodes:c,edges:l}}return s.forEach((e,t)=>{c.push(bf(`support-${t}`,(t+(o?2:1))*pf,mf,wf(e)))}),c.push(bf(`result`,(s.length+(o?2:1))*pf,mf,Sf(r,{step:String(s.length+(o?3:2)).padStart(2,`0`)}))),c.slice(0,-1).forEach((e,t)=>{let n=c[t+1];l.push(xf(`main-${t}`,e.id,n.id,kf(t,n.data.kind),!0))}),{nodes:c,edges:l}}function bf(e,t,n,r){return{id:e,type:`anlyxFlowNode`,position:{x:t,y:n},data:r}}function xf(e,t,n,r,i){return{id:`drawer-edge-${e}`,source:t,target:n,type:`anlyxFlowEdge`,animated:i,markerEnd:{type:Ea.ArrowClosed,width:10,height:10,color:Af(r)},data:{tone:r}}}function Sf(e,t={}){return{kind:`result`,label:`Result`,value:`${e} ${Pf(e)}`,sub:Number(e)>=400?`Request blocked`:`Request completed`,badge:Number(e)>=400?`blocked`:`observed`,accent:Number(e)>=400?`amber`:`green`,fullValue:Ff(e),...t.step?{step:t.step}:{},state:Number(e)>=400?`blocked`:`taken`}}function Cf(e){if(!e||!Array.isArray(e.mainPath))return[];let t=new Map(e.nodes.map(e=>[e.id,e]));return e.mainPath.map(e=>t.get(e)).filter(e=>!!e)}function wf(e,t=!1){let n=Tf(e.type),r=t?`Scanned ${Df(n)?.toLowerCase()??`step`}`:Df(n);return{kind:n,label:Ef(n),value:jf(e.label),badge:t?`scanned`:e.confidence??`unknown`,accent:t?`gray`:Of(n),fullValue:e.label,state:t?`scanned`:`taken`,...r?{sub:r}:{}}}function Tf(e){return e===`service`?`service`:e===`repository`?`repository`:e===`database`?`database`:`service`}function Ef(e){return e===`repository`?`Repository`:e===`database`?`Database`:`Service`}function Df(e){return e===`repository`?`Data access`:e===`database`?`Persistence`:`Business logic`}function Of(e){return e===`database`?`green`:e===`repository`?`amber`:`violet`}function kf(e,t){return t===`auth`?`violet`:t===`result`?`amber`:e===0?`blue`:`violet`}function Af(e){return e===`amber`?`#f59e0b`:e===`violet`?`#7c3aed`:e===`gray`?`#94a3b8`:`#2563eb`}function jf(e){if(!e)return`Unknown`;if(e.includes(`#`)){let[t,n]=e.split(`#`);return`${Nf(t??``)}#${n??``}`}return Nf(e)}function Mf(e){if(!e)return`Unknown`;if(e.includes(`#`)){let[t]=e.split(`#`);return Nf(t??``)}return Nf(e)}function Nf(e){let t=String(e).split(`.`);return t[t.length-1]||e}function Pf(e){let t=Number(e);return t===401?`Auth required`:t===403?`Permission denied`:t>=500?`Server error`:t>=400?`Client error`:t>=200&&t<300?`OK`:`Observed`}function Ff(e){let t=Number(e);return t===401?`login required · 401`:t===403?`permission denied · 403`:t>=500?`server error · ${e}`:t>=400?`client error · ${e}`:t>=200&&t<300?`success · ${e}`:`status ${e}`}function If({events:e,selectedEventId:t}){let[n,r]=(0,S.useState)(`action`),i=(0,S.useMemo)(()=>e.filter(e=>!!e.triggeredBy),[e]),a=(0,S.useMemo)(()=>e.filter(e=>!e.triggeredBy),[e]),o=n===`action`?i:n===`background`?a:e,s=n===`action`?`No user-action API requests yet.`:n===`background`?`No background API requests observed.`:`No API events observed yet.`;return(0,_.jsxs)(`section`,{className:`anlyx-events-table-section`,children:[(0,_.jsxs)(`div`,{className:`anlyx-events-table-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Recent API events`}),(0,_.jsx)(`p`,{children:`Action requests are primary. Background traffic stays quiet until selected.`})]}),(0,_.jsxs)(`div`,{className:`anlyx-events-filter`,role:`tablist`,"aria-label":`Filter API events`,children:[(0,_.jsxs)(`button`,{"aria-selected":n===`action`,type:`button`,onClick:()=>r(`action`),children:[`Actions `,(0,_.jsx)(`span`,{children:i.length})]}),(0,_.jsxs)(`button`,{"aria-selected":n===`background`,type:`button`,onClick:()=>r(`background`),children:[`Background `,(0,_.jsx)(`span`,{children:a.length})]}),(0,_.jsxs)(`button`,{"aria-selected":n===`all`,type:`button`,onClick:()=>r(`all`),children:[`All `,(0,_.jsx)(`span`,{children:e.length})]})]})]}),o.length===0?(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:s}):(0,_.jsxs)(x,{children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`Method`}),(0,_.jsx)(`th`,{children:`Path`}),(0,_.jsx)(`th`,{children:`Status`}),(0,_.jsx)(`th`,{children:`Match`}),(0,_.jsx)(`th`,{children:`Source`}),(0,_.jsx)(`th`,{children:`Duration`})]})}),(0,_.jsx)(`tbody`,{children:o.slice(0,6).map(e=>(0,_.jsxs)(`tr`,{className:e.id===t?`anlyx-events-table-row--selected`:``,"data-event-id":e.id,tabIndex:0,title:`Inspect this API event`,children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:`blue`,children:e.method})}),(0,_.jsx)(`td`,{className:`anlyx-events-table-path`,children:e.path}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:Number(e.status)>=400?`amber`:`green`,children:e.status})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:e.matchedEndpoint?`green`:`amber`,children:e.matchedEndpoint?`matched`:`unmatched`})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(y,{tone:e.triggeredBy?`blue`:`gray`,children:e.triggeredBy?`action`:e.source===`health`?`health`:`background`})}),(0,_.jsxs)(`td`,{children:[e.durationMs,`ms`]})]},e.id))})]})]})}function Lf({selectedEvent:e,events:t,latestAction:n,scannedHints:r=[],loadError:i}){return i?(0,_.jsx)(`div`,{className:`anlyx-flow-drawer-body`,children:(0,_.jsxs)(v,{children:[(0,_.jsx)(`h3`,{className:`anlyx-ov-section-title`,children:`Report data`}),(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:i})]})}):e?(0,_.jsxs)(`div`,{className:`anlyx-flow-drawer-body`,children:[(0,_.jsx)(Vf,{event:e}),e.matchedEndpoint?(0,_.jsx)(_f,{flow:e.matchedFlow,method:e.method,path:e.path,status:e.status,...e.matchedEndpoint.confidence?{endpointConfidence:e.matchedEndpoint.confidence}:{}}):(0,_.jsxs)(v,{className:`anlyx-unmatched-card`,children:[(0,_.jsx)(`h3`,{children:`No scanned endpoint matched`}),(0,_.jsx)(`p`,{children:`Anlyx saw this browser request, but no scanned endpoint path matched it.`})]}),(0,_.jsx)(If,{events:t,selectedEventId:e.id})]}):(0,_.jsxs)(`div`,{className:`anlyx-flow-drawer-body`,children:[n?(0,_.jsx)(Bf,{latestAction:n}):(0,_.jsx)(zf,{}),r.length>0?(0,_.jsx)(Rf,{hints:r}):null,(0,_.jsx)(If,{events:t,selectedEventId:null})]})}function Rf({hints:e}){return(0,_.jsxs)(v,{className:`anlyx-scanned-hints`,children:[(0,_.jsxs)(`div`,{className:`anlyx-scanned-hints__head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Scanned / inferred hints`}),(0,_.jsx)(`p`,{children:`These are known page links, not browser-live requests.`})]}),(0,_.jsx)(y,{tone:`gray`,children:`Not browser-live`})]}),(0,_.jsx)(`div`,{className:`anlyx-scanned-hints__list`,children:e.slice(0,4).map((e,t)=>(0,_.jsxs)(`div`,{className:`anlyx-scanned-hint`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(y,{tone:e.evidence===`capture`?`green`:`violet`,children:e.evidence===`capture`?`captured page link`:`scanned page link`}),(0,_.jsx)(`strong`,{title:e.endpointLabel??`${e.method} ${e.path}`,children:e.endpointLabel??`${e.method} ${e.path}`})]}),(0,_.jsx)(`p`,{title:e.pageFilePath??e.pageRoute,children:e.pageRoute})]},`${e.pageRoute}:${e.method}:${e.path}:${t}`))})]})}function zf(){return(0,_.jsxs)(v,{children:[(0,_.jsx)(`h3`,{className:`anlyx-ov-section-title`,children:`Waiting`}),(0,_.jsx)(`div`,{className:`anlyx-ov-empty`,children:`Use the app normally. Anlyx opens the main flow for requests caused by your direct action. Background requests stay in Recent API events until you select them.`})]})}function Bf({latestAction:e}){return(0,_.jsxs)(v,{className:`anlyx-no-primary-card`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(y,{tone:`amber`,children:`No action API yet`}),(0,_.jsx)(`h3`,{children:Uf(e)}),(0,_.jsx)(`p`,{children:e.selector??`No stable selector captured`})]}),(0,_.jsx)(`div`,{className:`anlyx-no-primary-card__note`,children:`Only background session checks were detected. They are hidden from the main flow.`})]})}function Vf({event:e}){let t=!!e.matchedEndpoint;return(0,_.jsxs)(v,{className:`anlyx-captured-request`,children:[(0,_.jsxs)(`div`,{className:`anlyx-captured-request__top`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h3`,{children:`Captured request`}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__path`,children:[(0,_.jsx)(y,{tone:`blue`,children:e.method}),(0,_.jsx)(`strong`,{children:e.path})]})]}),(0,_.jsx)(y,{tone:t?`green`:`amber`,children:t?`matched`:`unmatched`})]}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__summary`,children:[(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`b`,{children:e.matchedEndpoint?`endpoint`:`browser`}),` `,e.matchedEndpoint?`${e.matchedEndpoint.method} ${e.matchedEndpoint.path}`:e.path]}),(0,_.jsx)(`span`,{children:(0,_.jsx)(`b`,{children:Wf(e.status)})}),(0,_.jsxs)(`span`,{children:[e.durationMs,`ms`,e.count&&e.count>1?` · seen x${e.count}`:``]}),e.matchedEndpoint?.confidence?(0,_.jsxs)(`span`,{children:[`confidence `,e.matchedEndpoint.confidence]}):null,(0,_.jsx)(`span`,{children:e.triggeredBy?`user action`:e.source===`health`?`health/background`:`background`})]}),(0,_.jsxs)(`div`,{className:`anlyx-captured-request__steps`,children:[(0,_.jsx)(Hf,{label:`Action`,title:e.triggeredBy?Uf(e.triggeredBy):`No user action captured`,detail:e.triggeredBy?.selector??`Request may have fired on page load`,tone:e.triggeredBy?`blue`:`amber`}),(0,_.jsx)(Hf,{label:`Request`,title:`${e.method} ${e.path}`,detail:t?`Matched scanned endpoint`:`No scanned endpoint matched`,tone:t?`green`:`amber`}),(0,_.jsx)(Hf,{label:`Result`,title:Wf(e.status),detail:`${e.durationMs}ms${e.count&&e.count>1?` · seen x${e.count}`:``}`,tone:Number(e.status)>=400?`amber`:`green`})]})]})}function Hf({label:e,title:t,detail:n,tone:r}){return(0,_.jsxs)(`div`,{className:`anlyx-captured-step anlyx-captured-step--${r}`,children:[(0,_.jsx)(`span`,{className:`anlyx-captured-step__dot`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{children:e}),(0,_.jsx)(`strong`,{children:t}),(0,_.jsx)(`span`,{children:n})]})]})}function Uf(e){return`${e.type??`Action`} ${e.label??`unnamed element`}`}function Wf(e){let t=Number(e);return t===401?`login required · 401`:t===403?`permission denied · 403`:t>=500?`server error · ${e}`:t>=400?`client error · ${e}`:t>=200?`success · ${e}`:`status ${e}`}var Gf=new WeakMap;window.__ANLYX_RENDER_FLOW_DRAWER__=(e,t)=>{let n=Gf.get(e),r=n??(0,h.createRoot)(e);n||Gf.set(e,r),r.render((0,_.jsx)(Lf,{...t}))}})();
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import "@xyflow/react/dist/style.css";
|
|
2
2
|
import "../overlay/overlay.css";
|
|
3
3
|
import "./readme-demo.css";
|
|
4
|
-
|
|
4
|
+
import type { Endpoint, EndpointFlow } from "@anlyx/core";
|
|
5
|
+
export type FixtureDetailFlow = {
|
|
6
|
+
endpoint: Endpoint;
|
|
7
|
+
flow: EndpointFlow;
|
|
8
|
+
};
|
|
9
|
+
export type ReadmeDemoAppProps = {
|
|
10
|
+
eyebrow?: string;
|
|
11
|
+
fixtureDetail?: FixtureDetailFlow | null;
|
|
12
|
+
iconSrc?: string;
|
|
13
|
+
logoSrc?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function ReadmeDemoApp({ eyebrow, fixtureDetail: fixtureDetailProp, iconSrc, logoSrc }?: ReadmeDemoAppProps): JSX.Element;
|
|
@@ -2,9 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "@xyflow/react/dist/style.css";
|
|
3
3
|
import "../overlay/overlay.css";
|
|
4
4
|
import "./readme-demo.css";
|
|
5
|
-
import { useMemo, useState } from "react";
|
|
5
|
+
import { useEffect, useMemo, useState } from "react";
|
|
6
6
|
import { FlowDrawer } from "../overlay/FlowDrawer.js";
|
|
7
|
-
const demoOrder = ["
|
|
7
|
+
const demoOrder = ["detail", "search", "save", "admin"];
|
|
8
|
+
const fixtureEndpointsUrl = "/fixtures/spring-next-sample/expected/endpoints.json";
|
|
9
|
+
const fixtureFlowsUrl = "/fixtures/spring-next-sample/expected/flows.json";
|
|
10
|
+
const defaultLogoSrc = "/docs/assets/brand/anlyx-logo-transparent.png";
|
|
11
|
+
const defaultIconSrc = "/docs/assets/brand/anlyx-icon-transparent.png";
|
|
8
12
|
const flows = {
|
|
9
13
|
search: makeFlow("GET", "/api/public/search", [
|
|
10
14
|
["endpoint:search", "endpoint", "GET /api/public/search"],
|
|
@@ -41,20 +45,18 @@ const endpoints = {
|
|
|
41
45
|
save: endpoint("POST", "/api/account/saved-benefits", "SavedBenefitController#create"),
|
|
42
46
|
admin: endpoint("POST", "/api/admin/benefits", "AdminBenefitController#create")
|
|
43
47
|
};
|
|
44
|
-
const
|
|
48
|
+
const baseEvents = {
|
|
45
49
|
search: event("search", "GET", "/api/public/search", 200, 28, "Clicked Search benefits"),
|
|
46
50
|
detail: event("detail", "GET", "/api/public/benefits/123", 200, 34, "Opened benefit detail"),
|
|
47
51
|
save: event("save", "POST", "/api/account/saved-benefits", 401, 31, "Clicked Save to my box"),
|
|
48
52
|
admin: event("admin", "POST", "/api/admin/benefits", 403, 42, "Clicked Try admin action")
|
|
49
53
|
};
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const [selectedKey, setSelectedKey] = useState("save");
|
|
57
|
-
const selectedEvent = events[selectedKey];
|
|
54
|
+
export function ReadmeDemoApp({ eyebrow = "Real UI preview", fixtureDetail: fixtureDetailProp, iconSrc = defaultIconSrc, logoSrc = defaultLogoSrc } = {}) {
|
|
55
|
+
const [selectedKey, setSelectedKey] = useState("detail");
|
|
56
|
+
const fetchedFixtureDetail = useFixtureDetailFlow(fixtureDetailProp !== undefined);
|
|
57
|
+
const fixtureDetail = fixtureDetailProp ?? fetchedFixtureDetail;
|
|
58
|
+
const hydratedEvents = useMemo(() => Object.fromEntries(demoOrder.map((key) => [key, hydrateEvent(key, key === "detail" ? fixtureDetail : null)])), [fixtureDetail]);
|
|
59
|
+
const selectedEvent = hydratedEvents[selectedKey];
|
|
58
60
|
const eventList = useMemo(() => [
|
|
59
61
|
selectedEvent,
|
|
60
62
|
{
|
|
@@ -68,12 +70,68 @@ export function ReadmeDemoApp() {
|
|
|
68
70
|
matchedEndpoint: endpoint("GET", "/api/account/me", "AccountController#me"),
|
|
69
71
|
matchedFlow: null
|
|
70
72
|
},
|
|
71
|
-
...demoOrder.filter((key) => key !== selectedKey).map((key) =>
|
|
72
|
-
], [selectedEvent, selectedKey]);
|
|
73
|
-
return (_jsxs("main", { className: "anlyx-readme-demo", children: [_jsxs("section", { className: "anlyx-readme-demo__control", children: [
|
|
73
|
+
...demoOrder.filter((key) => key !== selectedKey).map((key) => hydratedEvents[key])
|
|
74
|
+
], [hydratedEvents, selectedEvent, selectedKey]);
|
|
75
|
+
return (_jsxs("main", { className: "anlyx-readme-demo", children: [_jsxs("section", { className: "anlyx-readme-demo__control", children: [_jsxs("div", { className: "anlyx-readme-demo__intro", children: [_jsx("img", { src: logoSrc, alt: "Anlyx" }), _jsxs("div", { children: [_jsx("p", { className: "anlyx-readme-demo__eyebrow", children: eyebrow }), _jsx("h1", { children: "Click an action. See the backend path." }), _jsx("p", { children: "Rendered by the same Flow Drawer component used by the Anlyx overlay." })] })] }), _jsxs("div", { className: "anlyx-readme-demo__actions", "aria-label": "Demo actions", children: [_jsxs("div", { className: "anlyx-readme-demo__actions-head", children: [_jsx("span", { children: "Demo buttons" }), _jsx("small", { children: "Pick one request" })] }), _jsx(DemoButton, { active: selectedKey === "search", index: "01", method: "GET", label: "Search benefits", meta: "GET /api/public/search", onClick: () => setSelectedKey("search"), demoKey: "search" }), _jsx(DemoButton, { active: selectedKey === "detail", index: "02", method: "GET", label: "Open benefit detail", meta: "GET /api/public/benefits/{id}", onClick: () => setSelectedKey("detail"), demoKey: "detail" }), _jsx(DemoButton, { active: selectedKey === "save", index: "03", method: "POST", label: "Save to my box", meta: "POST /api/account/saved-benefits", onClick: () => setSelectedKey("save"), demoKey: "save" }), _jsx(DemoButton, { active: selectedKey === "admin", index: "04", method: "POST", label: "Try admin action", meta: "POST /api/admin/benefits", onClick: () => setSelectedKey("admin"), demoKey: "admin" })] })] }), _jsxs("section", { className: "anlyx-readme-demo__drawer-shell", "aria-label": "Anlyx Flow Drawer", children: [_jsxs("header", { className: "anlyx-readme-demo__drawer-head", children: [_jsxs("div", { className: "anlyx-readme-demo__drawer-brand", children: [_jsx("img", { src: iconSrc, alt: "" }), _jsxs("div", { children: [_jsx("strong", { children: "Anlyx Flow Drawer" }), _jsx("span", { children: "Actual component preview" })] })] }), _jsxs("div", { className: "anlyx-readme-demo__drawer-tools", children: [_jsx("span", { children: "Live" }), _jsx("span", { children: "fixture-backed" })] })] }), _jsx(FlowDrawer, { events: eventList, latestAction: selectedEvent.triggeredBy ?? null, scannedHints: [], selectedEvent: selectedEvent })] })] }));
|
|
74
76
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
+
function useFixtureDetailFlow(skip) {
|
|
78
|
+
const [fixtureDetail, setFixtureDetail] = useState(null);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (skip) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const controller = new AbortController();
|
|
84
|
+
const loadFixture = async () => {
|
|
85
|
+
try {
|
|
86
|
+
const [endpointResponse, flowResponse] = await Promise.all([
|
|
87
|
+
fetch(fixtureEndpointsUrl, { signal: controller.signal }),
|
|
88
|
+
fetch(fixtureFlowsUrl, { signal: controller.signal })
|
|
89
|
+
]);
|
|
90
|
+
if (!endpointResponse.ok || !flowResponse.ok) {
|
|
91
|
+
throw new Error("README fixture request failed");
|
|
92
|
+
}
|
|
93
|
+
const fixtureEndpoints = (await endpointResponse.json());
|
|
94
|
+
const fixtureFlows = (await flowResponse.json());
|
|
95
|
+
const flow = fixtureFlows.find((candidate) => candidate.endpointId === "endpoint:get:/api/public/benefits/{id}");
|
|
96
|
+
const endpoint = fixtureEndpoints.find((candidate) => candidate.id === "endpoint:get:/api/public/benefits/{id}");
|
|
97
|
+
if (flow && endpoint) {
|
|
98
|
+
setFixtureDetail({ endpoint, flow: toBackendOnlyFlow(flow) });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (!controller.signal.aborted) {
|
|
103
|
+
console.warn("[anlyx] Falling back to embedded README demo data.", error);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
void loadFixture();
|
|
108
|
+
return () => controller.abort();
|
|
109
|
+
}, [skip]);
|
|
110
|
+
return fixtureDetail;
|
|
111
|
+
}
|
|
112
|
+
function toBackendOnlyFlow(flow) {
|
|
113
|
+
const backendNodeIds = new Set(flow.nodes.filter((node) => node.type !== "page").map((node) => node.id));
|
|
114
|
+
return {
|
|
115
|
+
...flow,
|
|
116
|
+
nodes: flow.nodes.filter((node) => backendNodeIds.has(node.id)),
|
|
117
|
+
edges: flow.edges.filter((edge) => backendNodeIds.has(edge.from) && backendNodeIds.has(edge.to)),
|
|
118
|
+
mainPath: flow.mainPath.filter((nodeId) => backendNodeIds.has(nodeId)),
|
|
119
|
+
subFlows: flow.subFlows.map((subFlow) => ({
|
|
120
|
+
...subFlow,
|
|
121
|
+
nodes: subFlow.nodes.filter((node) => node.type !== "page"),
|
|
122
|
+
edges: subFlow.edges.filter((edge) => !edge.from.startsWith("page:") && !edge.to.startsWith("page:"))
|
|
123
|
+
}))
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function hydrateEvent(key, fixtureDetail) {
|
|
127
|
+
return {
|
|
128
|
+
...baseEvents[key],
|
|
129
|
+
matchedEndpoint: fixtureDetail?.endpoint ?? endpoints[key],
|
|
130
|
+
matchedFlow: fixtureDetail?.flow ?? flows[key]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function DemoButton({ active, index, method, label, meta, onClick, demoKey }) {
|
|
134
|
+
return (_jsxs("button", { "aria-pressed": active, className: "anlyx-readme-demo__action", "data-demo": demoKey, type: "button", onClick: onClick, children: [_jsx("span", { className: "anlyx-readme-demo__action-index", children: index }), _jsxs("span", { className: "anlyx-readme-demo__action-copy", children: [_jsx("strong", { children: label }), _jsx("span", { children: meta })] }), _jsx("span", { className: "anlyx-readme-demo__method", children: method })] }));
|
|
77
135
|
}
|
|
78
136
|
function makeFlow(method, path, nodes) {
|
|
79
137
|
const mainPath = nodes.map(([id]) => id);
|
package/dist/styles.css
CHANGED
|
@@ -2163,6 +2163,12 @@ body {
|
|
|
2163
2163
|
font-size: 12px;
|
|
2164
2164
|
}
|
|
2165
2165
|
|
|
2166
|
+
.anlyx-shape-json {
|
|
2167
|
+
max-height: 220px;
|
|
2168
|
+
overflow-wrap: normal;
|
|
2169
|
+
white-space: pre;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2166
2172
|
.anlyx-empty {
|
|
2167
2173
|
padding: 20px;
|
|
2168
2174
|
color: var(--anlyx-color-text-secondary);
|
|
@@ -2500,7 +2506,10 @@ body {
|
|
|
2500
2506
|
|
|
2501
2507
|
.anlyx-status-badge--get,
|
|
2502
2508
|
.anlyx-status-badge--success,
|
|
2503
|
-
.anlyx-status-badge--high
|
|
2509
|
+
.anlyx-status-badge--high,
|
|
2510
|
+
.anlyx-status-badge--observed,
|
|
2511
|
+
.anlyx-status-badge--measured,
|
|
2512
|
+
.anlyx-status-badge--source-matched {
|
|
2504
2513
|
border-color: #b7ead8;
|
|
2505
2514
|
background: #eefdf7;
|
|
2506
2515
|
color: var(--anlyx-color-method-get);
|
|
@@ -2515,7 +2524,8 @@ body {
|
|
|
2515
2524
|
.anlyx-status-badge--put,
|
|
2516
2525
|
.anlyx-status-badge--patch,
|
|
2517
2526
|
.anlyx-status-badge--pending,
|
|
2518
|
-
.anlyx-status-badge--medium
|
|
2527
|
+
.anlyx-status-badge--medium,
|
|
2528
|
+
.anlyx-status-badge--manual {
|
|
2519
2529
|
border-color: #fed7aa;
|
|
2520
2530
|
background: #fff7ed;
|
|
2521
2531
|
color: var(--anlyx-color-method-update);
|
|
@@ -2523,13 +2533,16 @@ body {
|
|
|
2523
2533
|
|
|
2524
2534
|
.anlyx-status-badge--delete,
|
|
2525
2535
|
.anlyx-status-badge--failed,
|
|
2526
|
-
.anlyx-status-badge--low
|
|
2536
|
+
.anlyx-status-badge--low,
|
|
2537
|
+
.anlyx-status-badge--agent-inferred,
|
|
2538
|
+
.anlyx-status-badge--not-proven {
|
|
2527
2539
|
border-color: #fecaca;
|
|
2528
2540
|
background: #fff1f2;
|
|
2529
2541
|
color: var(--anlyx-color-method-delete);
|
|
2530
2542
|
}
|
|
2531
2543
|
|
|
2532
|
-
.anlyx-status-badge--unknown
|
|
2544
|
+
.anlyx-status-badge--unknown,
|
|
2545
|
+
.anlyx-status-badge--neutral {
|
|
2533
2546
|
border-color: #d9e1ee;
|
|
2534
2547
|
background: #f8fafc;
|
|
2535
2548
|
color: var(--anlyx-color-confidence-unknown);
|
package/dist/viewer/ViewerApp.js
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { projectDataSchema, projectValidationReportSchema } from "@anlyx/core";
|
|
4
|
+
import { WorkspaceApp } from "../workspace/WorkspaceApp.js";
|
|
5
5
|
export function ViewerApp() {
|
|
6
6
|
const [state, setState] = useState({ status: "loading" });
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
let active = true;
|
|
9
|
-
async function
|
|
9
|
+
async function loadViewerData() {
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
if (!response.ok) {
|
|
13
|
-
throw new Error(`/api/report-data returned ${response.status}`);
|
|
14
|
-
}
|
|
15
|
-
const parsed = scanResultSchema.parse(await response.json());
|
|
11
|
+
const viewerData = await fetchViewerData();
|
|
16
12
|
if (active) {
|
|
17
|
-
setState({ status: "success",
|
|
13
|
+
setState({ status: "success", viewerData });
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
catch (error) {
|
|
21
17
|
if (active) {
|
|
22
18
|
setState({
|
|
23
19
|
status: "error",
|
|
24
|
-
detail: error instanceof Error ? error.message : "Unknown
|
|
20
|
+
detail: error instanceof Error ? error.message : "Unknown project data loading error"
|
|
25
21
|
});
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
void
|
|
25
|
+
void loadViewerData();
|
|
30
26
|
return () => {
|
|
31
27
|
active = false;
|
|
32
28
|
};
|
|
33
29
|
}, []);
|
|
34
30
|
if (state.status === "loading") {
|
|
35
|
-
return (_jsx(ViewerStateCard, { detail: "Reading /api/
|
|
31
|
+
return (_jsx(ViewerStateCard, { detail: "Reading /api/project-data from the local Anlyx runtime.", label: "Anlyx project data loading", status: "loading", title: "Loading Anlyx project data" }));
|
|
36
32
|
}
|
|
37
33
|
if (state.status === "error") {
|
|
38
|
-
return (_jsx(ViewerStateCard, { detail: state.detail, label: "Anlyx
|
|
34
|
+
return (_jsx(ViewerStateCard, { detail: state.detail, label: "Anlyx project data load failed", status: "error", title: "Failed to load Anlyx project data" }));
|
|
35
|
+
}
|
|
36
|
+
return (_jsx(WorkspaceApp, { projectData: state.viewerData.data, ...(state.viewerData.validationReport
|
|
37
|
+
? { projectValidationReport: state.viewerData.validationReport }
|
|
38
|
+
: {}) }));
|
|
39
|
+
}
|
|
40
|
+
async function fetchViewerData() {
|
|
41
|
+
const projectResponse = await fetch("/api/project-data");
|
|
42
|
+
if (projectResponse.ok) {
|
|
43
|
+
const validationReport = await fetchValidationReport();
|
|
44
|
+
return {
|
|
45
|
+
kind: "project",
|
|
46
|
+
data: projectDataSchema.parse(await projectResponse.json()),
|
|
47
|
+
...(validationReport ? { validationReport } : {})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`/api/project-data returned ${projectResponse.status}`);
|
|
51
|
+
}
|
|
52
|
+
async function fetchValidationReport() {
|
|
53
|
+
const response = await fetch("/api/validation-report");
|
|
54
|
+
if (response.status === 404) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
throw new Error(`/api/validation-report returned ${response.status}`);
|
|
39
59
|
}
|
|
40
|
-
return
|
|
60
|
+
return projectValidationReportSchema.parse(await response.json());
|
|
41
61
|
}
|
|
42
62
|
function ViewerStateCard({ detail, label, status, title }) {
|
|
43
63
|
const role = status === "error" ? "alert" : "status";
|
|
44
|
-
return (_jsx("main", { className: `anlyx-viewer-state anlyx-viewer-state--${status}`, children: _jsxs("section", { className: "anlyx-viewer-state__card", role: role, "aria-label": label, children: [_jsx("span", { className: "anlyx-viewer-state__eyebrow", children: status === "error" ? "Viewer waiting for
|
|
64
|
+
return (_jsx("main", { className: `anlyx-viewer-state anlyx-viewer-state--${status}`, children: _jsxs("section", { className: "anlyx-viewer-state__card", role: role, "aria-label": label, children: [_jsx("span", { className: "anlyx-viewer-state__eyebrow", children: status === "error" ? "Viewer waiting for project data" : "Preparing local project" }), _jsx("h1", { children: title }), _jsx("p", { children: detail }), status === "error" ? _jsx("p", { children: "Run `anlyx dev` again, then reload." }) : null] }) }));
|
|
45
65
|
}
|