repo-harness-operator-web 0.29.1 → 0.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/assets/{ArchitectureWorkspace-DuJ4QuBX.js → ArchitectureWorkspace-Ch9tQUTF.js} +1 -1
  2. package/dist/assets/{DocsPage-CXh9HCMh.js → DocsPage-CTKxVi_d.js} +3 -3
  3. package/dist/assets/{abnfDiagram-S7VZAUFO-GAXPZsyQ.js → abnfDiagram-S7VZAUFO-D5ZxK_WL.js} +1 -1
  4. package/dist/assets/{architecture-WOLXFQ4H-C6cRccEO.js → architecture-WOLXFQ4H-DegQ40bi.js} +1 -1
  5. package/dist/assets/{architectureDiagram-YGSQEFNW-gL2JZo3W.js → architectureDiagram-YGSQEFNW-BncTtxMq.js} +1 -1
  6. package/dist/assets/{blockDiagram-APKKGZFW-CdUA0M3G.js → blockDiagram-APKKGZFW-CGB7fJZ3.js} +1 -1
  7. package/dist/assets/{c4Diagram-KJ2TOQU5-BcEfW0hR.js → c4Diagram-KJ2TOQU5-DMCc8By3.js} +1 -1
  8. package/dist/assets/{chunk-6MUBBAK2-Bvhvm4XM.js → chunk-6MUBBAK2-CXupMX74.js} +1 -1
  9. package/dist/assets/{chunk-AXFCVDMN-CF9JluTf.js → chunk-AXFCVDMN-C62iZvZG.js} +1 -1
  10. package/dist/assets/{chunk-BG4553SI-9yQQoS2O.js → chunk-BG4553SI-D80bsvgj.js} +1 -1
  11. package/dist/assets/{chunk-DQASFODM-CHTNf5DS.js → chunk-DQASFODM-Bbgnk6lu.js} +1 -1
  12. package/dist/assets/{chunk-HFQBQIA3-CB1lRFHP.js → chunk-HFQBQIA3-Bc2_hs7I.js} +1 -1
  13. package/dist/assets/{chunk-KQLB2F66-oFBuF6ar.js → chunk-KQLB2F66-V2uLt6xS.js} +1 -1
  14. package/dist/assets/{chunk-KS47KZWR-FNgsUzIb.js → chunk-KS47KZWR-CJmAsapf.js} +1 -1
  15. package/dist/assets/{chunk-LEVMRMFU-BgcQFvMv.js → chunk-LEVMRMFU-kBzwr00H.js} +1 -1
  16. package/dist/assets/{chunk-M57EVK23-BattFC1P.js → chunk-M57EVK23-DAVjLyKn.js} +1 -1
  17. package/dist/assets/{chunk-OY52VR5R-BiRw8QP_.js → chunk-OY52VR5R-BJKOHEtJ.js} +1 -1
  18. package/dist/assets/{chunk-QB3YPZ4I-DuyeacFD.js → chunk-QB3YPZ4I-DK4HglYf.js} +1 -1
  19. package/dist/assets/{chunk-R3KSYZAL-CYx4TcQo.js → chunk-R3KSYZAL-DhjbHaHR.js} +1 -1
  20. package/dist/assets/{chunk-STOXU5M4-B9Jit1Rv.js → chunk-STOXU5M4-DmFaq0CP.js} +1 -1
  21. package/dist/assets/{chunk-TU62E6Q5-DcuLHeFW.js → chunk-TU62E6Q5-cBVjipyT.js} +1 -1
  22. package/dist/assets/{chunk-X4PVCEUW-1vA_8TDF.js → chunk-X4PVCEUW-5jbzkSc2.js} +1 -1
  23. package/dist/assets/{classDiagram-v2-L25IHNXF-DTNFHSeq.js → classDiagram-v2-L25IHNXF-5NWnAY6n.js} +1 -1
  24. package/dist/assets/cynefin-EF2NZ3EQ-Dxtr7sPV.js +1 -0
  25. package/dist/assets/{cynefinDiagram-L36ESFBY-Ca0c1IBc.js → cynefinDiagram-L36ESFBY-BKEGHAhg.js} +1 -1
  26. package/dist/assets/{dagre-SPEB5RXH-BT4SKBds.js → dagre-SPEB5RXH-BnX3L53T.js} +1 -1
  27. package/dist/assets/{diagram-3B7GL73J-BCeche_m.js → diagram-3B7GL73J-AoHqrLzI.js} +1 -1
  28. package/dist/assets/{diagram-DNEMPZML-3MHNiof9.js → diagram-DNEMPZML-Cr23rsk2.js} +1 -1
  29. package/dist/assets/{diagram-L3MUGCDN-DLf1Jetg.js → diagram-L3MUGCDN-D9wZo2I8.js} +1 -1
  30. package/dist/assets/{diagram-LA4NIPWU-DwZixK2x.js → diagram-LA4NIPWU-Dol2Gbsp.js} +1 -1
  31. package/dist/assets/{diagram-MHCOC4E2-a-yZO63K.js → diagram-MHCOC4E2-Cm4vmTCv.js} +1 -1
  32. package/dist/assets/{diagram-XPFHEONP-B2R3XVuo.js → diagram-XPFHEONP-CObfeX1O.js} +1 -1
  33. package/dist/assets/{ebnfDiagram-UZSYDL2S-DzbbUVTi.js → ebnfDiagram-UZSYDL2S-CFKZcNhA.js} +1 -1
  34. package/dist/assets/{elk-XV6XMXQE-CFbcVLhz.js → elk-XV6XMXQE-C5KR06wI.js} +1 -1
  35. package/dist/assets/{erDiagram-EYBAPDEH-DclyrFku.js → erDiagram-EYBAPDEH-LMD5EjiC.js} +1 -1
  36. package/dist/assets/{eventmodeling-K75KTNOO-4YWUpc8G.js → eventmodeling-K75KTNOO-crS7xeBV.js} +1 -1
  37. package/dist/assets/flowDiagram-MALGAFMO-LOnULiG1.js +1 -0
  38. package/dist/assets/{ganttDiagram-23REXITY-BCsNY2ao.js → ganttDiagram-23REXITY-CfeUKCac.js} +1 -1
  39. package/dist/assets/gitGraph-VSP46ZUC-CcDM9oJr.js +1 -0
  40. package/dist/assets/{gitGraphDiagram-STJD7YCW-DBel18p1.js → gitGraphDiagram-STJD7YCW-B7uKLdF9.js} +1 -1
  41. package/dist/assets/{index-JhsLztky.js → index-D2emB51Q.js} +14 -14
  42. package/dist/assets/info-OHQRW6UA-Dq6YbmbN.js +1 -0
  43. package/dist/assets/{infoDiagram-KBXO4MBG-B3SgK53T.js → infoDiagram-KBXO4MBG-bAJUNpd6.js} +1 -1
  44. package/dist/assets/{ishikawaDiagram-M35NCXHK-GsGu4TfT.js → ishikawaDiagram-M35NCXHK-DD88QyWX.js} +1 -1
  45. package/dist/assets/{journeyDiagram-OPLOXDXO-CDpejA47.js → journeyDiagram-OPLOXDXO-BkwG2vnC.js} +1 -1
  46. package/dist/assets/{kanban-definition-BZKZHSQY-CD9DE4ID.js → kanban-definition-BZKZHSQY-DLN9RDph.js} +1 -1
  47. package/dist/assets/{line-Cl9ynVmO.js → line-pAR9SgD0.js} +1 -1
  48. package/dist/assets/{mermaid-parser.core-DvVvYM2G.js → mermaid-parser.core-B9OVE2W-.js} +3 -3
  49. package/dist/assets/{mermaid.core-RRUS2sWE.js → mermaid.core-CO-oGRO-.js} +4 -4
  50. package/dist/assets/{mindmap-definition-I2QAS2VK-CAp_x-CM.js → mindmap-definition-I2QAS2VK-iuSxgqUS.js} +1 -1
  51. package/dist/assets/packet-JDAUHWVQ-DJ-TdKN2.js +1 -0
  52. package/dist/assets/{pegDiagram-FD4XPPHP-D8Ap8xDK.js → pegDiagram-FD4XPPHP-SZuf7NN5.js} +1 -1
  53. package/dist/assets/pie-XZMESJXO-CuR2CNzu.js +1 -0
  54. package/dist/assets/{pieDiagram-J4AKIIQI-DrTkGkrI.js → pieDiagram-J4AKIIQI-D_a3dDWU.js} +1 -1
  55. package/dist/assets/{quadrantDiagram-XTYBLID2-Dq9NVC98.js → quadrantDiagram-XTYBLID2-CaB4sU4B.js} +1 -1
  56. package/dist/assets/radar-ABXABTNO-C1bcXSc6.js +1 -0
  57. package/dist/assets/railroad-I3PHUGI6-CeTQarPb.js +1 -0
  58. package/dist/assets/{railroad-abnf-LNEFI6M7-D50Jxao1.js → railroad-abnf-LNEFI6M7-BbBG5Eqo.js} +1 -1
  59. package/dist/assets/{railroad-ebnf-DWYD2UWJ-CW69BQ6s.js → railroad-ebnf-DWYD2UWJ-DnNEdE12.js} +1 -1
  60. package/dist/assets/{railroad-peg-JR7BVNR7-CpyZHWYy.js → railroad-peg-JR7BVNR7-CQuuSyXQ.js} +1 -1
  61. package/dist/assets/{railroadDiagram-MRQ6NCDL-Bfo3XjjW.js → railroadDiagram-MRQ6NCDL-D7dfnrF4.js} +1 -1
  62. package/dist/assets/{requirementDiagram-Y7LWUY3S-DZkwLAJH.js → requirementDiagram-Y7LWUY3S-xnXctK3m.js} +1 -1
  63. package/dist/assets/{sankeyDiagram-WGJFYUXA-CdRzxX65.js → sankeyDiagram-WGJFYUXA-BZTKyWKC.js} +1 -1
  64. package/dist/assets/{sequenceDiagram-5NDRBG5M-CYCklBPT.js → sequenceDiagram-5NDRBG5M-C6q7tz2q.js} +1 -1
  65. package/dist/assets/{stateDiagram-v2-FJ4FJNEA-CEmlGwm4.js → stateDiagram-v2-FJ4FJNEA-CHfFU-NE.js} +1 -1
  66. package/dist/assets/{swimlanes-UMQ2AFYF-7RM7ZttD.js → swimlanes-UMQ2AFYF-CEN_B5k0.js} +1 -1
  67. package/dist/assets/swimlanesDiagram-OMPLPG4O-C9azkjkI.js +8 -0
  68. package/dist/assets/{timeline-definition-SEUHKTQE-DnypLBKH.js → timeline-definition-SEUHKTQE-dYxQEHUW.js} +1 -1
  69. package/dist/assets/treeView-D4JQ5SDB-y-Ytzvtx.js +1 -0
  70. package/dist/assets/treemap-SAJKECNS-DcQLnwnh.js +1 -0
  71. package/dist/assets/{usecaseDiagram-AFA6YXN4-BPpe7rag.js → usecaseDiagram-AFA6YXN4-BV-RvsAi.js} +1 -1
  72. package/dist/assets/{vennDiagram-NNMJR3RB-DQn4Ab8I.js → vennDiagram-NNMJR3RB-CB-1Wx0u.js} +1 -1
  73. package/dist/assets/wardley-7MLQ67FV-AfHbnZqF.js +1 -0
  74. package/dist/assets/{wardleyDiagram-S7YFUSEH-4w1R8Pye.js → wardleyDiagram-S7YFUSEH-i13sdlK4.js} +1 -1
  75. package/dist/assets/{xychartDiagram-GGNKY7IX-YHzot0t8.js → xychartDiagram-GGNKY7IX-CLCsiJb9.js} +1 -1
  76. package/dist/index.html +1 -1
  77. package/package.json +1 -1
  78. package/dist/assets/cynefin-EF2NZ3EQ-DMe9Cx7h.js +0 -1
  79. package/dist/assets/flowDiagram-MALGAFMO-Ced5hDxr.js +0 -1
  80. package/dist/assets/gitGraph-VSP46ZUC-BDAck3qB.js +0 -1
  81. package/dist/assets/info-OHQRW6UA-BeopOSJa.js +0 -1
  82. package/dist/assets/packet-JDAUHWVQ-CWPdoCK5.js +0 -1
  83. package/dist/assets/pie-XZMESJXO-DRjpfEai.js +0 -1
  84. package/dist/assets/radar-ABXABTNO-DMUgU1z1.js +0 -1
  85. package/dist/assets/railroad-I3PHUGI6-ClUDB16r.js +0 -1
  86. package/dist/assets/swimlanesDiagram-OMPLPG4O-H4TUfVqQ.js +0 -8
  87. package/dist/assets/treeView-D4JQ5SDB-B8hGNKt3.js +0 -1
  88. package/dist/assets/treemap-SAJKECNS-Dc_GFtYJ.js +0 -1
  89. package/dist/assets/wardley-7MLQ67FV-BLhzebqd.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{C as t,S as n,a as r,b as i,d as a,h as o,m as s,n as c,o as l,p as u,s as d,v as f}from"./index-JhsLztky.js";import{C as p,S as m,T as h,_ as g,b as _,i as v,n as y,r as b,t as x,v as S,w as C,x as w,y as T}from"./src-C_gRsKqw.js";import{t as E}from"./value-CHmTzbgv.js";var D=e=>()=>e;function O(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}O.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function k(e){return!e.ctrlKey&&!e.button}function A(){return this.parentNode}function j(e,t){return t??{x:e.x,y:e.y}}function ee(){return navigator.maxTouchPoints||`ontouchstart`in this}function M(){var e=k,t=A,n=j,r=ee,i={},a=h(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,v).filter(r).on(`touchstart.drag`,x).on(`touchmove.drag`,E,_).on(`touchend.drag touchcancel.drag`,M).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function v(n,r){if(!u&&e.call(this,n,r)){var i=N(this,t.call(this,n,r),n,r,`mouse`);i&&(C(n.view).on(`mousemove.drag`,y,w).on(`mouseup.drag`,b,w),g(n.view),m(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function y(e){if(T(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function b(e){C(e.view).on(`mousemove.drag mouseup.drag`,null),S(e.view,l),T(e),i.mouse(`end`,e)}function x(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=N(this,a,n,r,i[s].identifier,i[s]))&&(m(n),c(`start`,n,i[s]))}function E(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(T(e),a(`drag`,e,t[r]))}function M(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(m(e),a(`end`,e,t[r]))}function N(e,t,r,s,c,l){var u=a.copy(),d=p(l||r,t),m,h,g;if((g=n.call(e,new O(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return m=g.x-d[0]||0,h=g.y-d[1]||0,function n(r,a,l){var _=d,v;switch(r){case`start`:i[c]=n,v=o++;break;case`end`:delete i[c],--o;case`drag`:d=p(l||a,t),v=o}u.call(r,e,new O(r,{sourceEvent:a,subject:g,target:f,identifier:c,active:v,x:d[0]+m,y:d[1]+h,dx:d[0]-_[0],dy:d[1]-_[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:D(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:D(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:D(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:D(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}var N=e(t(),1);function te(e){return e.kind===`group`}var P=/^capability\.[a-z0-9-]+(\.[a-z0-9-]+)+$/,ne=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,F=e=>typeof e==`string`,I=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,L=e=>I(e)&&e>0,re=e=>typeof e==`boolean`,R=e=>t=>F(t)&&e.test(t),z=(...e)=>t=>e.includes(t),ie=e=>t=>t===null||e(t),B=e=>t=>Array.isArray(t)&&t.every(e),V=e=>t=>{if(!t||typeof t!=`object`||Array.isArray(t))return!1;let n=t;return Object.keys(n).length===Object.keys(e).length&&Object.entries(e).every(([e,t])=>Object.hasOwn(n,e)&&t(n[e]))},ae=R(/^[0-9a-f]{64}$/),oe=R(ne),se=R(P),ce=e=>F(e)&&!e.startsWith(`/`)&&!/^[A-Za-z]:/.test(e)&&!/[\\\x00-\x1f\x7f]/.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),le=V({model_valid:z(`valid`,`invalid`,`unknown`),generated_summary:z(`fresh`,`stale`,`unknown`),section3:z(`present`,`pending`)}),ue=V({id:F,from:F,to:F,label:F,evidence:V({entrypointId:F,sourceSymbol:F,sinkId:F})}),de=e=>V({id:F,capabilityId:se,name:F,applicability:z(`not-applicable`),rationale:F})(e)||V({id:F,capabilityId:se,name:F,applicability:z(`required`),participants:B(V({id:F,nodeId:F})),steps:B(ue),outcomes:B(V({id:F,kind:z(`success`,`error`),label:F,steps:B(ue),terminal:V({participant:F,label:F})}))})(e),fe=e=>typeof e==`string`&&e.length>0&&e!==`group`,pe=V({include:B(F),exclude:B(F)}),me=e=>V({id:F,kind:fe,name:F,role:z(`center`,`child`,`caller`,`callee`)})(e)||V({id:F,kind:z(`group`),role:z(`caller`,`callee`),count:L,members:B(V({id:F,name:F}))})(e),he=V({schema_version:z(`repo-harness.architecture-modules.v1`),commit:oe,modules:B(V({id:se,domain:F,name:F,status:F,components:I,state:le}))}),ge=V({schema_version:z(`repo-harness.architecture-module.v1`),commit:oe,module:V({id:se,name:F,status:F,summary:F,responsibilities:B(F),notes:B(F),source:pe,verification:B(F),entrypoints:B(V({id:F,path:ce,symbols:B(V({name:F,sinks:B(V({id:F,path:ce,symbol:F}))}))})),components:B(V({id:F,kind:fe,name:F,summary:F,source:pe}))}),graph:V({center:se,nodes:B(me),edges:B(V({source:F,target:F,intent:F,relation_kind:F,direction:z(`directed`)}))}),flows:B(de),section3:ie(F),linked_docs:B(V({path:ce,kind:z(`contract`,`plan`),status:ie(F)})),state:le}),_e=V({schema_version:z(`repo-harness.module-review-prompt.v1`),prompt_version:F,package_version:F,repository_id:R(/^repo_[0-9a-f]{16}$/),capability_id:se,commit:oe,mode:z(`module`,`diff`),base:ie(oe),head:ie(oe),worktree_dirty_paths:B(ce),dirty_content_sha256:ie(ae),model_sha256:ae,doc_sha256:ie(ae),sources:B(V({path:ce,sha256:ae,bytes:I,class:z(`required`,`optional`),disposition:z(`included`,`omitted`,`chunked`)})),budget:V({input_cap_bytes:L,used_bytes:I,incomplete:re,omitted_sections:B(F)}),shard:V({index:L,count:L,bytes:I}),full_prompt_sha256:ae,prompt:F,digest:ae});function ve(e){if(!he(e))throw Error(`architecture_module_index_invalid`);return e}function ye(e){if(!ge(e))throw Error(`architecture_module_detail_invalid`);let t=e,n=new Set(t.graph.nodes.map(e=>e.id));if(t.graph.center!==t.module.id||!n.has(t.graph.center)||n.size!==t.graph.nodes.length||t.graph.edges.some(e=>!n.has(e.source)||!n.has(e.target))||t.graph.nodes.some(e=>te(e)&&e.count!==e.members.length))throw Error(`architecture_module_detail_invalid`);return t}function be(e){if(!_e(e))throw Error(`architecture_review_prompt_invalid`);let t=e;if(t.shard.index>t.shard.count||(t.mode===`module`?t.base!==null||t.head!==null:t.base===null||t.head===null)||t.worktree_dirty_paths.length===0!=(t.dirty_content_sha256===null))throw Error(`architecture_review_prompt_invalid`);return t}var H=i();function U(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=U(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var xe={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Se=[[-1/0,-1/0],[1/0,1/0]],Ce=[`Enter`,` `,`Escape`],we={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Te;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Te||={});var Ee;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Ee||={});var De;(function(e){e.Partial=`partial`,e.Full=`full`})(De||={});var Oe={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ke;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ke||={});var Ae;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ae||={});var W;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(W||={});var je={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},Me=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Ne=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Pe=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Fe=(e,t=[0,0])=>{let{width:n,height:r}=ht(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ie=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):Pe(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,Ye(e,$e(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ze(r):{x:0,y:0,width:0,height:0}},Le=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Ye(n,$e(e)),r=!0)}),r?Ze(n):{x:0,y:0,width:0,height:0}},Re=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=tt(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},ze=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Be(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=ht(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ve({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=ft(Le(Be(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function He({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,xe.error005());else{let{width:e,height:t}=ht(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&mt(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=mt(d)?Ge(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,xe.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Ue({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=ze(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var We=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ge=(e={x:0,y:0},t,n)=>({x:We(e.x,t[0][0],t[1][0]-(n?.width??0)),y:We(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ke(e,t,n){let{width:r,height:i}=ht(n),{x:a,y:o}=n.internals.positionAbsolute;return Ge(e,[[a,o],[a+r,o+i]],t)}var qe=(e,t,n)=>e<t?We(Math.abs(e-t),1,t)/t:e>n?-We(Math.abs(e-n),1,t)/t:0,Je=(e,t,n=15,r=40)=>[qe(e.x,r,t.width-r)*n,qe(e.y,r,t.height-r)*n],Ye=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Xe=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ze=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qe=(e,t=[0,0])=>{let{x:n,y:r}=Pe(e)?e.internals.positionAbsolute:Fe(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},$e=(e,t=[0,0])=>{let{x:n,y:r}=Pe(e)?e.internals.positionAbsolute:Fe(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},et=(e,t)=>Ze(Ye(Xe(e),Xe(t))),tt=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},nt=(e,t)=>tt(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),rt=e=>it(e.width)&&it(e.height)&&it(e.x)&&it(e.y),it=e=>!isNaN(e)&&isFinite(e),at=(e,t)=>(e,t)=>{},ot=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),st=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?ot(s,o):s},ct=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lt(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ut(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=lt(e,n),i=lt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=lt(e.top??e.y??0,n),i=lt(e.bottom??e.y??0,n),a=lt(e.left??e.x??0,t),o=lt(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dt(e,t,n,r,i,a){let{x:o,y:s}=ct(e,[t,n,r]),{x:c,y:l}=ct({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var ft=(e,t,n,r,i,a)=>{let o=ut(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=We(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=dt(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},pt=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function mt(e){return e!=null&&e!==`parent`}function ht(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function gt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function _t(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function vt(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function yt(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function bt(e){return{...we,...e||{}}}function xt(e){return e===null?null:e?`valid`:`invalid`}function St(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Ot(e),s=st({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?ot(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Ct=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=e=>e?.getRootNode?.()||window?.document,Tt=[`INPUT`,`SELECT`,`TEXTAREA`];function Et(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Tt.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Dt=e=>`clientX`in e,Ot=(e,t)=>{let n=Dt(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},kt=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Ct(t)}})};function At({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mt({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case W.Left:return[t-jt(t-r,a),n];case W.Right:return[t+jt(r-t,a),n];case W.Top:return[t,n-jt(n-i,a)];case W.Bottom:return[t,n+jt(i-n,a)]}}function Nt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:a=W.Top,curvature:o=.25}){let[s,c]=Mt({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Mt({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=At({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Pt({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Ft({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function It({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Ye($e(e),$e(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),nt({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Ze(a))>0}var Lt=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Rt=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),zt=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,xe.error006()),t;let r=n.getEdgeId||Lt,i;return i=Me(e)?{...e}:{...e,id:r(e)},Rt(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Bt({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Pt({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Vt={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Ht=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ut=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Wt=(e,t,n)=>e.x===t.x&&t.x===n.x&&(t.y-e.y)*(n.y-t.y)>=0||e.y===t.y&&t.y===n.y&&(t.x-e.x)*(n.x-t.x)>=0;function Gt({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:i,offset:a,stepPosition:o}){let s=Vt[t],c=Vt[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Ht({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Pt({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y},C=[];for(let t of[e,x,...m,S,n]){let[e,n]=C.slice(-2);n&&Wt(e,n,t)&&C.pop(),C.push(t)}return[C,h,g,y,b]}function Kt(e,t,n,r){let i=Math.min(Ut(e,t)/2,Ut(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function qt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:a=W.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Gt({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Kt(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Jt(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Yt(e){let{sourceNode:t,targetNode:n}=e;if(!Jt(t)||!Jt(n))return null;let r=t.internals.handleBounds||Xt(t.handles),i=n.internals.handleBounds||Xt(n.handles),a=Qt(r?.source??[],e.sourceHandle),o=Qt(e.connectionMode===Te.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,xe.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||W.Bottom,c=o?.position||W.Top,l=Zt(t,a,s),u=Zt(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Xt(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Zt(e,t,n=W.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??ht(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case W.Top:return{x:i+o/2,y:a};case W.Right:return{x:i+o,y:a+s/2};case W.Bottom:return{x:i+o/2,y:a+s};case W.Left:return{x:i,y:a+s/2}}}function Qt(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function $t(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function en(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=$t(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var tn=1e3,nn=10,rn={nodeOrigin:[0,0],nodeExtent:Se,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},an={...rn,checkEquality:!0};function on(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function sn(e,t,n){let r=on(rn,n);for(let n of e.values())if(n.parentId)fn(n,e,t,r);else{let e=Ge(Fe(n,r.nodeOrigin),mt(n.extent)?n.extent:r.nodeExtent,ht(n));n.internals.positionAbsolute=e}}function cn(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function ln(e){return e===`manual`}function un(e,t,n,r={}){let i=on(an,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!ln(i.zIndexMode)?tn:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Ge(Fe(u,i.nodeOrigin),mt(u.extent)?u.extent:i.nodeExtent,ht(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:cn(u,e),z:pn(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}e.measured!==void 0&&e.measured.width!==void 0&&e.measured.height!==void 0||e.hidden||(c=!1),u.parentId&&fn(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function dn(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function fn(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=on(rn,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dn(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*nn),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=mn(e,u,o,s,a&&!ln(c)?tn:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function pn(e,t,n){let r=it(e.zIndex)?e.zIndex:0;return ln(n)?r:r+(e.selected?t:0)}function mn(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=ht(e),l=Fe(e,n),u=mt(e.extent)?Ge(l,e.extent,c):l,d=Ge({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Ke(d,c,t));let f=pn(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function hn(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=et(a.get(n.parentId)?.expandedRect??Qe(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=ht(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function gn(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Ct(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=mt(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Ke(h,s,n))}else m&&(h=Ge(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:kt(`source`,r.nodeElement,p,d,e.id),target:kt(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&fn(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Qe(g,i)}))}}if(f.length>0){let e=hn(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function _n({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function vn(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function yn(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;vn(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),vn(`target`,s,c,e,i,o),t.set(r.id,r)}}function bn(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:bn(n,t):!1}function xn(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Sn(e,t,n,r,i){let a=new Map;for(let[o,s]of e)if((i?s.id===r:s.selected||s.id===r)&&(i||!s.parentId||!bn(s,e))&&(s.draggable||t&&s.draggable===void 0)){let t=e.get(o);t&&a.set(o,{id:o,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return a}function Cn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function wn({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=ot(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Tn({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=C(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Xe(Le(s)):null,x=v&&l?wn({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:ot(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=He({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Cn({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function w(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Je(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(w)}function T(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0;let v=!!b&&!o&&!i.get(b)?.selected;m&&y||o||!b||i.get(b)?.selected||_(),y&&m&&b&&e?.(b);let x=St(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=x,s=Sn(i,c,x,b,v),s.size>0&&(n||h||!b&&g)){let[e,t]=Cn({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let E=M().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&T(e),a=St(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Ot(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=St(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,w()),!d){let t=Ot(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&T(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Ot(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Cn({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!xn(t,`.${g}`,v))&&(!_||xn(t,_,v))});f.call(E)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function En(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())nt(i,Qe(e))>0&&r.push(e);return r}var Dn=250;function On(e,t,n,r){let i=[],a=1/0,o=En(e,n,t+Dn);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Zt(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function kn(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Zt(o,c,c.position,!0)}:c}function An(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function jn(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Mn=()=>!0;function Nn(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Mn,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=wt(e.target),E=0,D,{x:O,y:k}=Ot(e),A=An(a,w),j=s?.getBoundingClientRect(),ee=!1;if(!j||!A)return;let M=kn(i,A,r,c,t);if(!M)return;let N=Ot(e,j),te=!1,P=null,ne=!1,F=null;function I(){if(!u||!j)return;let[e,t]=Je(N,j,S);f({x:e,y:t}),E=requestAnimationFrame(I)}let L={...M,nodeId:i,type:A,position:M.position},re=c.get(i),R={inProgress:!0,isValid:null,from:Zt(re,L,W.Left,!0),fromHandle:L,fromPosition:L.position,fromNode:re,to:N,toHandle:null,toPosition:je[L.position],toNode:null,pointer:N};function z(){ee=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!ee){let{x:t,y:n}=Ot(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!L){B(e);return}let a=b();N=Ot(e,j),D=On(st(N,a,!1,[1,1]),n,c,L),te||=(I(),!0);let s=Pn(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});F=s.handleDomNode,P=s.connection,ne=jn(!!D,s.isValid);let u=c.get(i),f=u?Zt(u,L,W.Left,!0):R.from,p={...R,from:f,isValid:ne,to:s.toHandle&&ne?ct({x:s.toHandle.x,y:s.toHandle.y},a):N,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:je[L.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:N};y(p),R=p}function B(e){if(!(`touches`in e&&e.touches.length>0)){if(ee){(D||F)&&P&&ne&&h?.(P);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),te=!1,ne=!1,P=null,F=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,B),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,B)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,B),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,B)}function Pn(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Mn,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Ot(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=An(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Te.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=kn(t,e,a,u,n,!0)}return _}var Fn={onPointerDown:Nn,isValid:Pn};function In({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=C(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&pt()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=x().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:p}}var Ln=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>y.translate(e,t).scale(n),zn=(e,t)=>e.target.closest(`.${t}`),Bn=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vn=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hn=(e,t=0,n=Vn,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Un=e=>{let t=e.ctrlKey&&pt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Wn({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(zn(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=p(u),t=d*2**Un(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,m=i===Ee.Vertical?0:u.deltaX*f,h=i===Ee.Horizontal?0:u.deltaY*f;!pt()&&u.shiftKey&&i!==Ee.Vertical&&(m=u.deltaY*f,h=0),r.translateBy(n,-(m/d)*a,-(h/d)*a,{internal:!0});let g=Ln(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,g):(e.isPanScrolling=!0,s?.(u,g)),e.panScrollTimeout=setTimeout(()=>{l?.(u,g),e.isPanScrolling=!1},150)}}function Gn({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=zn(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Kn({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Ln(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function qn({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Bn(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Ln(a.transform))}}function Jn({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Bn(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Ln(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Yn({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(zn(f,`${u}-flow__node`)||zn(f,`${u}-flow__edge`)||zn(f,`${u}-flow__selection`)||zn(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||zn(f,c)&&h||zn(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function Xn({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]],f=typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t?.contentRect&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);let p=x().extent(()=>d).scaleExtent([t,n]).translateExtent(r),m=C(e).call(p);w({x:i.x,y:i.y,zoom:We(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let h=m.on(`wheel.zoom`),g=m.on(`dblclick.zoom`);p.wheelDelta(Un);async function _(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).transform(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function y({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:f,preventScrolling:_,zoomOnPinch:v,zoomOnScroll:y,zoomOnDoubleClick:b,panActivationKeyPressed:x=!1,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&p.on(`zoom`,null);let O=i&&!S&&!r;p.clickDistance(D?1/0:!it(E)||E<0?0:E);let k=O?Wn({zoomPanValues:l,noWheelClassName:e,d3Selection:m,d3Zoom:p,panOnScrollMode:d,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Gn({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:h});m.on(`wheel.zoom`,k,{passive:!1});let A=Kn({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});p.on(`start`,A);let j=qn({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});p.on(`zoom`,j);let ee=Jn({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});p.on(`end`,ee);let M=Yn({panActivationKeyPressed:x,zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:y,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});p.filter(M),b?m.on(`dblclick.zoom`,g):m.on(`dblclick.zoom`,null)}function S(){p.on(`zoom`,null),f?.disconnect()}async function w(e,t,n){let r=Rn(e),i=p?.constrain()(r,t,n);return i&&await _(i),i}async function T(e,t){let n=Rn(e);return await _(n,t),n}function D(e){if(m){let t=Rn(e),n=m.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&p?.transform(m,t,null,{sync:!0})}}function O(){let e=m?b(m.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function k(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).scaleTo(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function A(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).scaleBy(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function j(e){p?.scaleExtent(e)}function ee(e){p?.translateExtent(e)}function M(e){let t=!it(e)||e<0?0:e;p?.clickDistance(t)}return{update:y,destroy:S,setViewport:T,setViewportConstrained:w,getViewport:O,scaleTo:k,scaleBy:A,setScaleExtent:j,setTranslateExtent:ee,syncViewport:D,setClickDistance:M}}var Zn;(function(e){e.Line=`line`,e.Handle=`handle`})(Zn||={});function Qn({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function $n(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function er(e,t){return Math.max(0,t-e)}function tr(e,t){return Math.max(0,e-t)}function nr(e,t,n){return Math.max(0,t-e,e-n)}function rr(e,t){return e?!t:t}function ir(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=nr(E,h,g),j=nr(D,_,v);if(o){let e=0,t=0;c&&w<0?e=er(y+w+O,o[0][0]):!c&&w>0&&(e=tr(y+E+O,o[1][0])),l&&T<0?t=er(b+T+k,o[0][1]):!l&&T>0&&(t=tr(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=tr(y+w,s[0][0]):!c&&w<0&&(e=er(y+E,s[1][0])),l&&T>0?t=tr(b+T,s[0][1]):!l&&T<0&&(t=er(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=nr(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?tr(b+k+E/C,o[1][1])*C:er(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?er(b+E/C,s[1][1])*C:tr(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=nr(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?tr(y+D*C+O,o[1][0])/C:er(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?er(y+D*C,s[1][0])/C:tr(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(rr(c,l)?-w:w)/C:w=(rr(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let ee=c?y+w:y,M=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+ee,y:a[1]*T*(l?-1:1)+M}}var ar={width:0,height:0,x:0,y:0},or={...ar,pointerX:0,pointerY:0,aspectRatio:1};function sr(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function cr({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=C(e),o={controlDirection:$n(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...ar},h={...or};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:$n(e)};let g,_=null,v=[],y,b,x,S=M().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=St(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=mt(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=sr(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=St(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=ir(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,ee=O!==u&&A,M=k!==f&&j;if(!ee&&!M&&!A&&!j)return;let N={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((ee||M||T[0]===1||T[1]===1)&&(w.x=ee?O:m.x,w.y=M?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let te=Qn({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),P={...m,direction:te};p?.(e,P)===!1?(m=N.prevValues,h.x=N.startX,h.y=N.startY,v.forEach((e,t)=>{e.position=N.childNodes[t].position})):(d?.(e,P),r(w,l))}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var lr=e(f(),1),ur=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},dr=e=>e?ur(e):ur,{useDebugValue:fr}=N.default,{useSyncExternalStoreWithSelector:pr}=lr.default,mr=e=>e;function hr(e,t=mr,n){let r=pr(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fr(r),r}var gr=(e,t)=>{let n=dr(e),r=(e,r=t)=>hr(n,e,r);return Object.assign(r,n),r},_r=(e,t)=>e?gr(e,t):gr;function G(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var vr=(0,N.createContext)(null),yr=vr.Provider,br=xe.error001(`react`);function K(e,t){let n=(0,N.useContext)(vr);if(n===null)throw Error(br);return hr(n,e,t)}function q(){let e=(0,N.useContext)(vr);if(e===null)throw Error(br);return(0,N.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var xr={display:`none`},Sr={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Cr=`react-flow__node-desc`,wr=`react-flow__edge-desc`,Tr=`react-flow__aria-live`,Er=e=>e.ariaLiveMessage,Dr=e=>e.ariaLabelConfig;function Or({rfId:e}){let t=K(Er);return(0,H.jsx)(`div`,{id:`${Tr}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Sr,children:t})}function kr({rfId:e,disableKeyboardA11y:t}){let n=K(Dr);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{id:`${Cr}-${e}`,style:xr,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,H.jsx)(`div`,{id:`${wr}-${e}`,style:xr,children:n[`edge.a11yDescription.default`]}),!t&&(0,H.jsx)(Or,{rfId:e})]})}var Ar=(0,N.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,H.jsx)(`div`,{className:U([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ar.displayName=`Panel`;var jr=`https://reactflow.dev?utm_source=attribution`;function Mr({proOptions:e,position:t=`bottom-right`}){return(0,N.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,H.jsx)(Ar,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${jr}`,children:(0,H.jsx)(`a`,{href:jr,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Nr=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Pr=e=>e.id;function Fr(e,t){return G(e.selectedNodes.map(Pr),t.selectedNodes.map(Pr))&&G(e.selectedEdges.map(Pr),t.selectedEdges.map(Pr))}function Ir({onSelectionChange:e}){let t=q(),{selectedNodes:n,selectedEdges:r}=K(Nr,Fr);return(0,N.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Lr=e=>!!e.onSelectionChangeHandlers;function Rr({onSelectionChange:e}){let t=K(Lr);return e||t?(0,H.jsx)(Ir,{onSelectionChange:e}):null}var zr=[0,0],Br={x:0,y:0,zoom:1},Vr=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Hr=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Ur={translateExtent:Se,nodeOrigin:zr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Wr(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=K(Hr,G),l=q();(0,N.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Ur,s()}),[]);let u=(0,N.useRef)(Ur);return(0,N.useEffect)(()=>{for(let s of Vr){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:bt(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},Vr.map(t=>e[t])),null}function Gr(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Kr(e){let[t,n]=(0,N.useState)(e===`system`?null:e);return(0,N.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Gr(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Gr()?.matches?`dark`:`light`:t}var qr=typeof document<`u`?document:null;function Jr(e=null,t={target:qr,actInsideInputWithModifier:!0}){let[n,r]=(0,N.useState)(!1),i=(0,N.useRef)(!1),a=(0,N.useRef)(new Set([])),[o,s]=(0,N.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{C as t,S as n,a as r,b as i,d as a,h as o,m as s,n as c,o as l,p as u,s as d,v as f}from"./index-D2emB51Q.js";import{C as p,S as m,T as h,_ as g,b as _,i as v,n as y,r as b,t as x,v as S,w as C,x as w,y as T}from"./src-C_gRsKqw.js";import{t as E}from"./value-CHmTzbgv.js";var D=e=>()=>e;function O(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}O.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function k(e){return!e.ctrlKey&&!e.button}function A(){return this.parentNode}function j(e,t){return t??{x:e.x,y:e.y}}function ee(){return navigator.maxTouchPoints||`ontouchstart`in this}function M(){var e=k,t=A,n=j,r=ee,i={},a=h(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,v).filter(r).on(`touchstart.drag`,x).on(`touchmove.drag`,E,_).on(`touchend.drag touchcancel.drag`,M).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function v(n,r){if(!u&&e.call(this,n,r)){var i=N(this,t.call(this,n,r),n,r,`mouse`);i&&(C(n.view).on(`mousemove.drag`,y,w).on(`mouseup.drag`,b,w),g(n.view),m(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function y(e){if(T(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function b(e){C(e.view).on(`mousemove.drag mouseup.drag`,null),S(e.view,l),T(e),i.mouse(`end`,e)}function x(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=N(this,a,n,r,i[s].identifier,i[s]))&&(m(n),c(`start`,n,i[s]))}function E(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(T(e),a(`drag`,e,t[r]))}function M(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(m(e),a(`end`,e,t[r]))}function N(e,t,r,s,c,l){var u=a.copy(),d=p(l||r,t),m,h,g;if((g=n.call(e,new O(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return m=g.x-d[0]||0,h=g.y-d[1]||0,function n(r,a,l){var _=d,v;switch(r){case`start`:i[c]=n,v=o++;break;case`end`:delete i[c],--o;case`drag`:d=p(l||a,t),v=o}u.call(r,e,new O(r,{sourceEvent:a,subject:g,target:f,identifier:c,active:v,x:d[0]+m,y:d[1]+h,dx:d[0]-_[0],dy:d[1]-_[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:D(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:D(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:D(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:D(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}var N=e(t(),1);function te(e){return e.kind===`group`}var P=/^capability\.[a-z0-9-]+(\.[a-z0-9-]+)+$/,ne=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,F=e=>typeof e==`string`,I=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,L=e=>I(e)&&e>0,re=e=>typeof e==`boolean`,R=e=>t=>F(t)&&e.test(t),z=(...e)=>t=>e.includes(t),ie=e=>t=>t===null||e(t),B=e=>t=>Array.isArray(t)&&t.every(e),V=e=>t=>{if(!t||typeof t!=`object`||Array.isArray(t))return!1;let n=t;return Object.keys(n).length===Object.keys(e).length&&Object.entries(e).every(([e,t])=>Object.hasOwn(n,e)&&t(n[e]))},ae=R(/^[0-9a-f]{64}$/),oe=R(ne),se=R(P),ce=e=>F(e)&&!e.startsWith(`/`)&&!/^[A-Za-z]:/.test(e)&&!/[\\\x00-\x1f\x7f]/.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),le=V({model_valid:z(`valid`,`invalid`,`unknown`),generated_summary:z(`fresh`,`stale`,`unknown`),section3:z(`present`,`pending`)}),ue=V({id:F,from:F,to:F,label:F,evidence:V({entrypointId:F,sourceSymbol:F,sinkId:F})}),de=e=>V({id:F,capabilityId:se,name:F,applicability:z(`not-applicable`),rationale:F})(e)||V({id:F,capabilityId:se,name:F,applicability:z(`required`),participants:B(V({id:F,nodeId:F})),steps:B(ue),outcomes:B(V({id:F,kind:z(`success`,`error`),label:F,steps:B(ue),terminal:V({participant:F,label:F})}))})(e),fe=e=>typeof e==`string`&&e.length>0&&e!==`group`,pe=V({include:B(F),exclude:B(F)}),me=e=>V({id:F,kind:fe,name:F,role:z(`center`,`child`,`caller`,`callee`)})(e)||V({id:F,kind:z(`group`),role:z(`caller`,`callee`),count:L,members:B(V({id:F,name:F}))})(e),he=V({schema_version:z(`repo-harness.architecture-modules.v1`),commit:oe,modules:B(V({id:se,domain:F,name:F,status:F,components:I,state:le}))}),ge=V({schema_version:z(`repo-harness.architecture-module.v1`),commit:oe,module:V({id:se,name:F,status:F,summary:F,responsibilities:B(F),notes:B(F),source:pe,verification:B(F),entrypoints:B(V({id:F,path:ce,symbols:B(V({name:F,sinks:B(V({id:F,path:ce,symbol:F}))}))})),components:B(V({id:F,kind:fe,name:F,summary:F,source:pe}))}),graph:V({center:se,nodes:B(me),edges:B(V({source:F,target:F,intent:F,relation_kind:F,direction:z(`directed`)}))}),flows:B(de),section3:ie(F),linked_docs:B(V({path:ce,kind:z(`contract`,`plan`),status:ie(F)})),state:le}),_e=V({schema_version:z(`repo-harness.module-review-prompt.v1`),prompt_version:F,package_version:F,repository_id:R(/^repo_[0-9a-f]{16}$/),capability_id:se,commit:oe,mode:z(`module`,`diff`),base:ie(oe),head:ie(oe),worktree_dirty_paths:B(ce),dirty_content_sha256:ie(ae),model_sha256:ae,doc_sha256:ie(ae),sources:B(V({path:ce,sha256:ae,bytes:I,class:z(`required`,`optional`),disposition:z(`included`,`omitted`,`chunked`)})),budget:V({input_cap_bytes:L,used_bytes:I,incomplete:re,omitted_sections:B(F)}),shard:V({index:L,count:L,bytes:I}),full_prompt_sha256:ae,prompt:F,digest:ae});function ve(e){if(!he(e))throw Error(`architecture_module_index_invalid`);return e}function ye(e){if(!ge(e))throw Error(`architecture_module_detail_invalid`);let t=e,n=new Set(t.graph.nodes.map(e=>e.id));if(t.graph.center!==t.module.id||!n.has(t.graph.center)||n.size!==t.graph.nodes.length||t.graph.edges.some(e=>!n.has(e.source)||!n.has(e.target))||t.graph.nodes.some(e=>te(e)&&e.count!==e.members.length))throw Error(`architecture_module_detail_invalid`);return t}function be(e){if(!_e(e))throw Error(`architecture_review_prompt_invalid`);let t=e;if(t.shard.index>t.shard.count||(t.mode===`module`?t.base!==null||t.head!==null:t.base===null||t.head===null)||t.worktree_dirty_paths.length===0!=(t.dirty_content_sha256===null))throw Error(`architecture_review_prompt_invalid`);return t}var H=i();function U(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=U(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var xe={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Se=[[-1/0,-1/0],[1/0,1/0]],Ce=[`Enter`,` `,`Escape`],we={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Te;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Te||={});var Ee;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Ee||={});var De;(function(e){e.Partial=`partial`,e.Full=`full`})(De||={});var Oe={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ke;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ke||={});var Ae;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ae||={});var W;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(W||={});var je={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},Me=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Ne=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Pe=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Fe=(e,t=[0,0])=>{let{width:n,height:r}=ht(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ie=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):Pe(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,Ye(e,$e(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ze(r):{x:0,y:0,width:0,height:0}},Le=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Ye(n,$e(e)),r=!0)}),r?Ze(n):{x:0,y:0,width:0,height:0}},Re=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=tt(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},ze=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Be(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=ht(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ve({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=ft(Le(Be(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function He({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,xe.error005());else{let{width:e,height:t}=ht(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&mt(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=mt(d)?Ge(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,xe.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Ue({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=ze(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var We=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ge=(e={x:0,y:0},t,n)=>({x:We(e.x,t[0][0],t[1][0]-(n?.width??0)),y:We(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ke(e,t,n){let{width:r,height:i}=ht(n),{x:a,y:o}=n.internals.positionAbsolute;return Ge(e,[[a,o],[a+r,o+i]],t)}var qe=(e,t,n)=>e<t?We(Math.abs(e-t),1,t)/t:e>n?-We(Math.abs(e-n),1,t)/t:0,Je=(e,t,n=15,r=40)=>[qe(e.x,r,t.width-r)*n,qe(e.y,r,t.height-r)*n],Ye=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Xe=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ze=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qe=(e,t=[0,0])=>{let{x:n,y:r}=Pe(e)?e.internals.positionAbsolute:Fe(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},$e=(e,t=[0,0])=>{let{x:n,y:r}=Pe(e)?e.internals.positionAbsolute:Fe(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},et=(e,t)=>Ze(Ye(Xe(e),Xe(t))),tt=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},nt=(e,t)=>tt(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),rt=e=>it(e.width)&&it(e.height)&&it(e.x)&&it(e.y),it=e=>!isNaN(e)&&isFinite(e),at=(e,t)=>(e,t)=>{},ot=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),st=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?ot(s,o):s},ct=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lt(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ut(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=lt(e,n),i=lt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=lt(e.top??e.y??0,n),i=lt(e.bottom??e.y??0,n),a=lt(e.left??e.x??0,t),o=lt(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function dt(e,t,n,r,i,a){let{x:o,y:s}=ct(e,[t,n,r]),{x:c,y:l}=ct({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var ft=(e,t,n,r,i,a)=>{let o=ut(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=We(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=dt(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},pt=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function mt(e){return e!=null&&e!==`parent`}function ht(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function gt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function _t(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function vt(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function yt(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function bt(e){return{...we,...e||{}}}function xt(e){return e===null?null:e?`valid`:`invalid`}function St(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Ot(e),s=st({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?ot(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Ct=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=e=>e?.getRootNode?.()||window?.document,Tt=[`INPUT`,`SELECT`,`TEXTAREA`];function Et(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Tt.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Dt=e=>`clientX`in e,Ot=(e,t)=>{let n=Dt(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},kt=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Ct(t)}})};function At({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mt({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case W.Left:return[t-jt(t-r,a),n];case W.Right:return[t+jt(r-t,a),n];case W.Top:return[t,n-jt(n-i,a)];case W.Bottom:return[t,n+jt(i-n,a)]}}function Nt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:a=W.Top,curvature:o=.25}){let[s,c]=Mt({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Mt({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=At({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Pt({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Ft({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function It({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Ye($e(e),$e(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),nt({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Ze(a))>0}var Lt=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Rt=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),zt=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,xe.error006()),t;let r=n.getEdgeId||Lt,i;return i=Me(e)?{...e}:{...e,id:r(e)},Rt(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Bt({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Pt({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Vt={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Ht=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ut=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Wt=(e,t,n)=>e.x===t.x&&t.x===n.x&&(t.y-e.y)*(n.y-t.y)>=0||e.y===t.y&&t.y===n.y&&(t.x-e.x)*(n.x-t.x)>=0;function Gt({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:i,offset:a,stepPosition:o}){let s=Vt[t],c=Vt[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Ht({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Pt({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y},C=[];for(let t of[e,x,...m,S,n]){let[e,n]=C.slice(-2);n&&Wt(e,n,t)&&C.pop(),C.push(t)}return[C,h,g,y,b]}function Kt(e,t,n,r){let i=Math.min(Ut(e,t)/2,Ut(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function qt({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:a=W.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Gt({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Kt(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function Jt(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Yt(e){let{sourceNode:t,targetNode:n}=e;if(!Jt(t)||!Jt(n))return null;let r=t.internals.handleBounds||Xt(t.handles),i=n.internals.handleBounds||Xt(n.handles),a=Qt(r?.source??[],e.sourceHandle),o=Qt(e.connectionMode===Te.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,xe.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||W.Bottom,c=o?.position||W.Top,l=Zt(t,a,s),u=Zt(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Xt(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Zt(e,t,n=W.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??ht(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case W.Top:return{x:i+o/2,y:a};case W.Right:return{x:i+o,y:a+s/2};case W.Bottom:return{x:i+o/2,y:a+s};case W.Left:return{x:i,y:a+s/2}}}function Qt(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function $t(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function en(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=$t(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var tn=1e3,nn=10,rn={nodeOrigin:[0,0],nodeExtent:Se,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},an={...rn,checkEquality:!0};function on(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function sn(e,t,n){let r=on(rn,n);for(let n of e.values())if(n.parentId)fn(n,e,t,r);else{let e=Ge(Fe(n,r.nodeOrigin),mt(n.extent)?n.extent:r.nodeExtent,ht(n));n.internals.positionAbsolute=e}}function cn(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function ln(e){return e===`manual`}function un(e,t,n,r={}){let i=on(an,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!ln(i.zIndexMode)?tn:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Ge(Fe(u,i.nodeOrigin),mt(u.extent)?u.extent:i.nodeExtent,ht(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:cn(u,e),z:pn(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}e.measured!==void 0&&e.measured.width!==void 0&&e.measured.height!==void 0||e.hidden||(c=!1),u.parentId&&fn(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function dn(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function fn(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=on(rn,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dn(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*nn),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=mn(e,u,o,s,a&&!ln(c)?tn:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function pn(e,t,n){let r=it(e.zIndex)?e.zIndex:0;return ln(n)?r:r+(e.selected?t:0)}function mn(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=ht(e),l=Fe(e,n),u=mt(e.extent)?Ge(l,e.extent,c):l,d=Ge({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Ke(d,c,t));let f=pn(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function hn(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=et(a.get(n.parentId)?.expandedRect??Qe(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=ht(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function gn(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Ct(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=mt(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Ke(h,s,n))}else m&&(h=Ge(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:kt(`source`,r.nodeElement,p,d,e.id),target:kt(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&fn(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Qe(g,i)}))}}if(f.length>0){let e=hn(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function _n({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function vn(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function yn(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;vn(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),vn(`target`,s,c,e,i,o),t.set(r.id,r)}}function bn(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:bn(n,t):!1}function xn(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Sn(e,t,n,r,i){let a=new Map;for(let[o,s]of e)if((i?s.id===r:s.selected||s.id===r)&&(i||!s.parentId||!bn(s,e))&&(s.draggable||t&&s.draggable===void 0)){let t=e.get(o);t&&a.set(o,{id:o,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return a}function Cn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function wn({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=ot(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Tn({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=C(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Xe(Le(s)):null,x=v&&l?wn({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:ot(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=He({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Cn({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function w(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Je(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(w)}function T(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0;let v=!!b&&!o&&!i.get(b)?.selected;m&&y||o||!b||i.get(b)?.selected||_(),y&&m&&b&&e?.(b);let x=St(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=x,s=Sn(i,c,x,b,v),s.size>0&&(n||h||!b&&g)){let[e,t]=Cn({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let E=M().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&T(e),a=St(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Ot(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=St(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,w()),!d){let t=Ot(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&T(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Ot(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Cn({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!xn(t,`.${g}`,v))&&(!_||xn(t,_,v))});f.call(E)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function En(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())nt(i,Qe(e))>0&&r.push(e);return r}var Dn=250;function On(e,t,n,r){let i=[],a=1/0,o=En(e,n,t+Dn);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Zt(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function kn(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Zt(o,c,c.position,!0)}:c}function An(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function jn(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Mn=()=>!0;function Nn(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Mn,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=wt(e.target),E=0,D,{x:O,y:k}=Ot(e),A=An(a,w),j=s?.getBoundingClientRect(),ee=!1;if(!j||!A)return;let M=kn(i,A,r,c,t);if(!M)return;let N=Ot(e,j),te=!1,P=null,ne=!1,F=null;function I(){if(!u||!j)return;let[e,t]=Je(N,j,S);f({x:e,y:t}),E=requestAnimationFrame(I)}let L={...M,nodeId:i,type:A,position:M.position},re=c.get(i),R={inProgress:!0,isValid:null,from:Zt(re,L,W.Left,!0),fromHandle:L,fromPosition:L.position,fromNode:re,to:N,toHandle:null,toPosition:je[L.position],toNode:null,pointer:N};function z(){ee=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!ee){let{x:t,y:n}=Ot(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!L){B(e);return}let a=b();N=Ot(e,j),D=On(st(N,a,!1,[1,1]),n,c,L),te||=(I(),!0);let s=Pn(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});F=s.handleDomNode,P=s.connection,ne=jn(!!D,s.isValid);let u=c.get(i),f=u?Zt(u,L,W.Left,!0):R.from,p={...R,from:f,isValid:ne,to:s.toHandle&&ne?ct({x:s.toHandle.x,y:s.toHandle.y},a):N,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:je[L.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:N};y(p),R=p}function B(e){if(!(`touches`in e&&e.touches.length>0)){if(ee){(D||F)&&P&&ne&&h?.(P);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),te=!1,ne=!1,P=null,F=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,B),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,B)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,B),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,B)}function Pn(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Mn,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Ot(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=An(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Te.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=kn(t,e,a,u,n,!0)}return _}var Fn={onPointerDown:Nn,isValid:Pn};function In({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=C(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&pt()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=x().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:p}}var Ln=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>y.translate(e,t).scale(n),zn=(e,t)=>e.target.closest(`.${t}`),Bn=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vn=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hn=(e,t=0,n=Vn,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Un=e=>{let t=e.ctrlKey&&pt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Wn({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(zn(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=p(u),t=d*2**Un(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,m=i===Ee.Vertical?0:u.deltaX*f,h=i===Ee.Horizontal?0:u.deltaY*f;!pt()&&u.shiftKey&&i!==Ee.Vertical&&(m=u.deltaY*f,h=0),r.translateBy(n,-(m/d)*a,-(h/d)*a,{internal:!0});let g=Ln(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,g):(e.isPanScrolling=!0,s?.(u,g)),e.panScrollTimeout=setTimeout(()=>{l?.(u,g),e.isPanScrolling=!1},150)}}function Gn({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=zn(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Kn({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Ln(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function qn({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Bn(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Ln(a.transform))}}function Jn({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Bn(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Ln(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Yn({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(zn(f,`${u}-flow__node`)||zn(f,`${u}-flow__edge`)||zn(f,`${u}-flow__selection`)||zn(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||zn(f,c)&&h||zn(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function Xn({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]],f=typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t?.contentRect&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);let p=x().extent(()=>d).scaleExtent([t,n]).translateExtent(r),m=C(e).call(p);w({x:i.x,y:i.y,zoom:We(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let h=m.on(`wheel.zoom`),g=m.on(`dblclick.zoom`);p.wheelDelta(Un);async function _(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).transform(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function y({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:f,preventScrolling:_,zoomOnPinch:v,zoomOnScroll:y,zoomOnDoubleClick:b,panActivationKeyPressed:x=!1,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&p.on(`zoom`,null);let O=i&&!S&&!r;p.clickDistance(D?1/0:!it(E)||E<0?0:E);let k=O?Wn({zoomPanValues:l,noWheelClassName:e,d3Selection:m,d3Zoom:p,panOnScrollMode:d,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Gn({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:h});m.on(`wheel.zoom`,k,{passive:!1});let A=Kn({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});p.on(`start`,A);let j=qn({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});p.on(`zoom`,j);let ee=Jn({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});p.on(`end`,ee);let M=Yn({panActivationKeyPressed:x,zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:y,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});p.filter(M),b?m.on(`dblclick.zoom`,g):m.on(`dblclick.zoom`,null)}function S(){p.on(`zoom`,null),f?.disconnect()}async function w(e,t,n){let r=Rn(e),i=p?.constrain()(r,t,n);return i&&await _(i),i}async function T(e,t){let n=Rn(e);return await _(n,t),n}function D(e){if(m){let t=Rn(e),n=m.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&p?.transform(m,t,null,{sync:!0})}}function O(){let e=m?b(m.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function k(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).scaleTo(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function A(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?E:v).scaleBy(Hn(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function j(e){p?.scaleExtent(e)}function ee(e){p?.translateExtent(e)}function M(e){let t=!it(e)||e<0?0:e;p?.clickDistance(t)}return{update:y,destroy:S,setViewport:T,setViewportConstrained:w,getViewport:O,scaleTo:k,scaleBy:A,setScaleExtent:j,setTranslateExtent:ee,syncViewport:D,setClickDistance:M}}var Zn;(function(e){e.Line=`line`,e.Handle=`handle`})(Zn||={});function Qn({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function $n(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function er(e,t){return Math.max(0,t-e)}function tr(e,t){return Math.max(0,e-t)}function nr(e,t,n){return Math.max(0,t-e,e-n)}function rr(e,t){return e?!t:t}function ir(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=nr(E,h,g),j=nr(D,_,v);if(o){let e=0,t=0;c&&w<0?e=er(y+w+O,o[0][0]):!c&&w>0&&(e=tr(y+E+O,o[1][0])),l&&T<0?t=er(b+T+k,o[0][1]):!l&&T>0&&(t=tr(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=tr(y+w,s[0][0]):!c&&w<0&&(e=er(y+E,s[1][0])),l&&T>0?t=tr(b+T,s[0][1]):!l&&T<0&&(t=er(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=nr(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?tr(b+k+E/C,o[1][1])*C:er(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?er(b+E/C,s[1][1])*C:tr(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=nr(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?tr(y+D*C+O,o[1][0])/C:er(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?er(y+D*C,s[1][0])/C:tr(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(rr(c,l)?-w:w)/C:w=(rr(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let ee=c?y+w:y,M=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+ee,y:a[1]*T*(l?-1:1)+M}}var ar={width:0,height:0,x:0,y:0},or={...ar,pointerX:0,pointerY:0,aspectRatio:1};function sr(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function cr({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=C(e),o={controlDirection:$n(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...ar},h={...or};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:$n(e)};let g,_=null,v=[],y,b,x,S=M().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=St(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=mt(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=sr(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=St(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=ir(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,ee=O!==u&&A,M=k!==f&&j;if(!ee&&!M&&!A&&!j)return;let N={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((ee||M||T[0]===1||T[1]===1)&&(w.x=ee?O:m.x,w.y=M?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let te=Qn({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),P={...m,direction:te};p?.(e,P)===!1?(m=N.prevValues,h.x=N.startX,h.y=N.startY,v.forEach((e,t)=>{e.position=N.childNodes[t].position})):(d?.(e,P),r(w,l))}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var lr=e(f(),1),ur=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},dr=e=>e?ur(e):ur,{useDebugValue:fr}=N.default,{useSyncExternalStoreWithSelector:pr}=lr.default,mr=e=>e;function hr(e,t=mr,n){let r=pr(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fr(r),r}var gr=(e,t)=>{let n=dr(e),r=(e,r=t)=>hr(n,e,r);return Object.assign(r,n),r},_r=(e,t)=>e?gr(e,t):gr;function G(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}n();var vr=(0,N.createContext)(null),yr=vr.Provider,br=xe.error001(`react`);function K(e,t){let n=(0,N.useContext)(vr);if(n===null)throw Error(br);return hr(n,e,t)}function q(){let e=(0,N.useContext)(vr);if(e===null)throw Error(br);return(0,N.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var xr={display:`none`},Sr={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Cr=`react-flow__node-desc`,wr=`react-flow__edge-desc`,Tr=`react-flow__aria-live`,Er=e=>e.ariaLiveMessage,Dr=e=>e.ariaLabelConfig;function Or({rfId:e}){let t=K(Er);return(0,H.jsx)(`div`,{id:`${Tr}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Sr,children:t})}function kr({rfId:e,disableKeyboardA11y:t}){let n=K(Dr);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{id:`${Cr}-${e}`,style:xr,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,H.jsx)(`div`,{id:`${wr}-${e}`,style:xr,children:n[`edge.a11yDescription.default`]}),!t&&(0,H.jsx)(Or,{rfId:e})]})}var Ar=(0,N.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,H.jsx)(`div`,{className:U([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ar.displayName=`Panel`;var jr=`https://reactflow.dev?utm_source=attribution`;function Mr({proOptions:e,position:t=`bottom-right`}){return(0,N.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,H.jsx)(Ar,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${jr}`,children:(0,H.jsx)(`a`,{href:jr,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Nr=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Pr=e=>e.id;function Fr(e,t){return G(e.selectedNodes.map(Pr),t.selectedNodes.map(Pr))&&G(e.selectedEdges.map(Pr),t.selectedEdges.map(Pr))}function Ir({onSelectionChange:e}){let t=q(),{selectedNodes:n,selectedEdges:r}=K(Nr,Fr);return(0,N.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Lr=e=>!!e.onSelectionChangeHandlers;function Rr({onSelectionChange:e}){let t=K(Lr);return e||t?(0,H.jsx)(Ir,{onSelectionChange:e}):null}var zr=[0,0],Br={x:0,y:0,zoom:1},Vr=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Hr=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Ur={translateExtent:Se,nodeOrigin:zr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Wr(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=K(Hr,G),l=q();(0,N.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Ur,s()}),[]);let u=(0,N.useRef)(Ur);return(0,N.useEffect)(()=>{for(let s of Vr){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:bt(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},Vr.map(t=>e[t])),null}function Gr(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Kr(e){let[t,n]=(0,N.useState)(e===`system`?null:e);return(0,N.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Gr(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Gr()?.matches?`dark`:`light`:t}var qr=typeof document<`u`?document:null;function Jr(e=null,t={target:qr,actInsideInputWithModifier:!0}){let[n,r]=(0,N.useState)(!1),i=(0,N.useRef)(!1),a=(0,N.useRef)(new Set([])),[o,s]=(0,N.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
2
2
  `).replace(`
3
3
 
4
4
  `,`