repo-harness-operator-web 0.35.0 → 0.35.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 (92) hide show
  1. package/dist/assets/{ArchitectureWorkspace-C1fmnmJJ.js → ArchitectureWorkspace-rm1mmcTU.js} +1 -1
  2. package/dist/assets/{DocsPage-CLjrIEe4.js → DocsPage-BmyoqELW.js} +3 -3
  3. package/dist/assets/{abnfDiagram-S7VZAUFO-BxnOH29G.js → abnfDiagram-S7VZAUFO-daVegEzi.js} +1 -1
  4. package/dist/assets/{architecture-WOLXFQ4H-CKfMlNg0.js → architecture-WOLXFQ4H-Dv6EEp_c.js} +1 -1
  5. package/dist/assets/{architectureDiagram-YGSQEFNW-kJRhe8j3.js → architectureDiagram-YGSQEFNW-ChTnK3F8.js} +1 -1
  6. package/dist/assets/{blockDiagram-APKKGZFW-ByjsLetR.js → blockDiagram-APKKGZFW-CH6dJtZX.js} +1 -1
  7. package/dist/assets/{c4Diagram-KJ2TOQU5-CCuT-mL7.js → c4Diagram-KJ2TOQU5-xkR06Z1t.js} +1 -1
  8. package/dist/assets/{chunk-6MUBBAK2-C28GKkJe.js → chunk-6MUBBAK2-VKmtcUd4.js} +1 -1
  9. package/dist/assets/{chunk-AXFCVDMN-IDAwssSm.js → chunk-AXFCVDMN-p_c6XsbV.js} +1 -1
  10. package/dist/assets/{chunk-BG4553SI-h07DEHz3.js → chunk-BG4553SI-Dg-b9yt5.js} +1 -1
  11. package/dist/assets/{chunk-DQASFODM-Dlp3uhT8.js → chunk-DQASFODM-DyCehH4u.js} +1 -1
  12. package/dist/assets/{chunk-HFQBQIA3-CyVOphwN.js → chunk-HFQBQIA3-ef5v67Dw.js} +1 -1
  13. package/dist/assets/{chunk-KQLB2F66-zIsbeQgI.js → chunk-KQLB2F66-5OAL3m5G.js} +1 -1
  14. package/dist/assets/{chunk-KS47KZWR-C-Jj6mw6.js → chunk-KS47KZWR-CyxqzJWl.js} +1 -1
  15. package/dist/assets/{chunk-LEVMRMFU-CIEidtJ_.js → chunk-LEVMRMFU-CGPyL9IN.js} +1 -1
  16. package/dist/assets/{chunk-M57EVK23-WnAChGjF.js → chunk-M57EVK23-CNMx5yGf.js} +1 -1
  17. package/dist/assets/{chunk-OY52VR5R-CxmwodVc.js → chunk-OY52VR5R-B5nOKBb8.js} +1 -1
  18. package/dist/assets/{chunk-QB3YPZ4I-m7GDJln3.js → chunk-QB3YPZ4I-C9SSMslD.js} +1 -1
  19. package/dist/assets/{chunk-R3KSYZAL-a0yOsRBm.js → chunk-R3KSYZAL-D3DNIEqT.js} +1 -1
  20. package/dist/assets/{chunk-STOXU5M4-DQ1_j-AS.js → chunk-STOXU5M4-DvOOu2ib.js} +1 -1
  21. package/dist/assets/{chunk-TU62E6Q5-B_lddzri.js → chunk-TU62E6Q5-DfkYDldR.js} +1 -1
  22. package/dist/assets/{chunk-X4PVCEUW-BceDd3xC.js → chunk-X4PVCEUW-CpaRG3mP.js} +1 -1
  23. package/dist/assets/{classDiagram-v2-L25IHNXF-B7Sj0ZHb.js → classDiagram-v2-L25IHNXF-BSgeZzVN.js} +1 -1
  24. package/dist/assets/cynefin-EF2NZ3EQ-B9AbLs7o.js +1 -0
  25. package/dist/assets/{cynefinDiagram-L36ESFBY-cZrir7-r.js → cynefinDiagram-L36ESFBY-BTX3jxig.js} +1 -1
  26. package/dist/assets/{dagre-SPEB5RXH-CR_FaofP.js → dagre-SPEB5RXH-CMTsNC-S.js} +1 -1
  27. package/dist/assets/{diagram-3B7GL73J-BUd5Uy7U.js → diagram-3B7GL73J-CBGJwJVn.js} +1 -1
  28. package/dist/assets/{diagram-DNEMPZML-no7sS563.js → diagram-DNEMPZML-DSBMN685.js} +1 -1
  29. package/dist/assets/{diagram-L3MUGCDN-DrwiG_fu.js → diagram-L3MUGCDN-Bcc-Q_Y2.js} +1 -1
  30. package/dist/assets/{diagram-LA4NIPWU-CSGYH5jO.js → diagram-LA4NIPWU-iRH9bPMy.js} +1 -1
  31. package/dist/assets/{diagram-MHCOC4E2-Fff9xvtO.js → diagram-MHCOC4E2-DaYmYaiY.js} +1 -1
  32. package/dist/assets/{diagram-XPFHEONP-qck0oiZK.js → diagram-XPFHEONP-CV8NmpJV.js} +1 -1
  33. package/dist/assets/{ebnfDiagram-UZSYDL2S-Ce_GX4Z9.js → ebnfDiagram-UZSYDL2S-ByMtA5hw.js} +1 -1
  34. package/dist/assets/{elk-XV6XMXQE-DtmN_FKV.js → elk-XV6XMXQE-D1OnVFIp.js} +1 -1
  35. package/dist/assets/{erDiagram-EYBAPDEH-CDM73vUl.js → erDiagram-EYBAPDEH-CblrHP6K.js} +1 -1
  36. package/dist/assets/{eventmodeling-K75KTNOO-DvtlF6fx.js → eventmodeling-K75KTNOO-5K4Gz6tQ.js} +1 -1
  37. package/dist/assets/flowDiagram-MALGAFMO-B8YxvBzd.js +1 -0
  38. package/dist/assets/{ganttDiagram-23REXITY-CD21ObEG.js → ganttDiagram-23REXITY-QuWkeD_u.js} +1 -1
  39. package/dist/assets/gitGraph-VSP46ZUC-DWB2-IZJ.js +1 -0
  40. package/dist/assets/{gitGraphDiagram-STJD7YCW-Db5QOwUI.js → gitGraphDiagram-STJD7YCW-lQz2Alxv.js} +1 -1
  41. package/dist/assets/index-DU_E6SAm.js +39 -0
  42. package/dist/assets/index-OZZ8YggF.css +1 -0
  43. package/dist/assets/info-OHQRW6UA-B3wHAo6U.js +1 -0
  44. package/dist/assets/{infoDiagram-KBXO4MBG-41IAflTM.js → infoDiagram-KBXO4MBG-xIu8anUn.js} +1 -1
  45. package/dist/assets/{ishikawaDiagram-M35NCXHK-LmPoJ7lX.js → ishikawaDiagram-M35NCXHK-DudcFAXg.js} +1 -1
  46. package/dist/assets/{journeyDiagram-OPLOXDXO-B6PpDpGn.js → journeyDiagram-OPLOXDXO-_X1WRoyX.js} +1 -1
  47. package/dist/assets/{kanban-definition-BZKZHSQY-CzZaFOrW.js → kanban-definition-BZKZHSQY-uPvDbiMZ.js} +1 -1
  48. package/dist/assets/{line-qUkMscFu.js → line-CapXLbGF.js} +1 -1
  49. package/dist/assets/{mermaid-parser.core-DQaNxkDY.js → mermaid-parser.core-D9e1phYl.js} +3 -3
  50. package/dist/assets/{mermaid.core-Bh7l7CI_.js → mermaid.core-l0yvu9lG.js} +4 -4
  51. package/dist/assets/{mindmap-definition-I2QAS2VK-BN3FRd3Y.js → mindmap-definition-I2QAS2VK-B6R4O8FA.js} +1 -1
  52. package/dist/assets/packet-JDAUHWVQ-DQuqrwNp.js +1 -0
  53. package/dist/assets/{pegDiagram-FD4XPPHP-DZEsy8Qt.js → pegDiagram-FD4XPPHP-DQxplWVL.js} +1 -1
  54. package/dist/assets/pie-XZMESJXO-CoPOqVt7.js +1 -0
  55. package/dist/assets/{pieDiagram-J4AKIIQI-LwUEJla0.js → pieDiagram-J4AKIIQI-CGBxobJS.js} +1 -1
  56. package/dist/assets/{quadrantDiagram-XTYBLID2-ODEK2dW4.js → quadrantDiagram-XTYBLID2-B36ni2IU.js} +1 -1
  57. package/dist/assets/radar-ABXABTNO-Qidu-hBH.js +1 -0
  58. package/dist/assets/railroad-I3PHUGI6-DFUShKgq.js +1 -0
  59. package/dist/assets/{railroad-abnf-LNEFI6M7-CgzHlvxq.js → railroad-abnf-LNEFI6M7-BxnSaQ61.js} +1 -1
  60. package/dist/assets/{railroad-ebnf-DWYD2UWJ-DHtC3aY3.js → railroad-ebnf-DWYD2UWJ-D1xQPoj4.js} +1 -1
  61. package/dist/assets/{railroad-peg-JR7BVNR7-CPhT3rx0.js → railroad-peg-JR7BVNR7-BJWUximd.js} +1 -1
  62. package/dist/assets/{railroadDiagram-MRQ6NCDL-ClIY_ygQ.js → railroadDiagram-MRQ6NCDL-B1PSaV_O.js} +1 -1
  63. package/dist/assets/{requirementDiagram-Y7LWUY3S-BOG6IjfD.js → requirementDiagram-Y7LWUY3S-CYnjDtnp.js} +1 -1
  64. package/dist/assets/{sankeyDiagram-WGJFYUXA-DijzcxBa.js → sankeyDiagram-WGJFYUXA-D6ZB31w-.js} +1 -1
  65. package/dist/assets/{sequenceDiagram-5NDRBG5M-CJwAAB9W.js → sequenceDiagram-5NDRBG5M-eqcNMzis.js} +1 -1
  66. package/dist/assets/{stateDiagram-v2-FJ4FJNEA-Dcbf_4yf.js → stateDiagram-v2-FJ4FJNEA-BNWx_dOp.js} +1 -1
  67. package/dist/assets/{swimlanes-UMQ2AFYF-DUe2Veea.js → swimlanes-UMQ2AFYF-DHSQ0XMz.js} +1 -1
  68. package/dist/assets/swimlanesDiagram-OMPLPG4O-Dls16ez4.js +8 -0
  69. package/dist/assets/{timeline-definition-SEUHKTQE-CpMkNtOZ.js → timeline-definition-SEUHKTQE-x9rsFUdJ.js} +1 -1
  70. package/dist/assets/treeView-D4JQ5SDB-aLezOs8X.js +1 -0
  71. package/dist/assets/treemap-SAJKECNS-Bq5gzPC4.js +1 -0
  72. package/dist/assets/{usecaseDiagram-AFA6YXN4-BIcEh5Ao.js → usecaseDiagram-AFA6YXN4-DaC3Unk1.js} +1 -1
  73. package/dist/assets/{vennDiagram-NNMJR3RB-KgO7UqDh.js → vennDiagram-NNMJR3RB-DQsS-5iH.js} +1 -1
  74. package/dist/assets/wardley-7MLQ67FV-BHsLNV3g.js +1 -0
  75. package/dist/assets/{wardleyDiagram-S7YFUSEH-BYNlfdAx.js → wardleyDiagram-S7YFUSEH-DYZBo28D.js} +1 -1
  76. package/dist/assets/{xychartDiagram-GGNKY7IX-CzoKHLv2.js → xychartDiagram-GGNKY7IX-DUh74GrE.js} +1 -1
  77. package/dist/index.html +2 -2
  78. package/package.json +1 -1
  79. package/dist/assets/cynefin-EF2NZ3EQ-MXbh4LMj.js +0 -1
  80. package/dist/assets/flowDiagram-MALGAFMO-CInmZBHb.js +0 -1
  81. package/dist/assets/gitGraph-VSP46ZUC-DA9OV5wY.js +0 -1
  82. package/dist/assets/index-CAoE02p_.js +0 -39
  83. package/dist/assets/index-CI7xAfcZ.css +0 -1
  84. package/dist/assets/info-OHQRW6UA-BUR4FGom.js +0 -1
  85. package/dist/assets/packet-JDAUHWVQ-CQDDsB4_.js +0 -1
  86. package/dist/assets/pie-XZMESJXO-BDceMJUu.js +0 -1
  87. package/dist/assets/radar-ABXABTNO-Byt5es7M.js +0 -1
  88. package/dist/assets/railroad-I3PHUGI6-BFR5xhz8.js +0 -1
  89. package/dist/assets/swimlanesDiagram-OMPLPG4O-BTkJgEqs.js +0 -8
  90. package/dist/assets/treeView-D4JQ5SDB-CdEP3mQU.js +0 -1
  91. package/dist/assets/treemap-SAJKECNS-py6PClRO.js +0 -1
  92. package/dist/assets/wardley-7MLQ67FV-B0XIZf3b.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{C as t,D as n,O as r,T as i,_ as a,b as o,c as s,g as c,h as l,l as u,n as d,o as f,p,v as m,y as h}from"./index-CAoE02p_.js";import{C as g,S as _,T as v,_ as y,b,i as x,n as S,r as C,t as w,v as T,w as E,x as D,y as O}from"./src-C_gRsKqw.js";import{t as k}from"./value-CHmTzbgv.js";var A=e=>()=>e;function j(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}})}j.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function M(e){return!e.ctrlKey&&!e.button}function N(){return this.parentNode}function P(e,t){return t??{x:e.x,y:e.y}}function F(){return navigator.maxTouchPoints||`ontouchstart`in this}function ee(){var e=M,t=N,n=P,r=F,i={},a=v(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,x).on(`touchmove.drag`,S,b).on(`touchend.drag touchcancel.drag`,C).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=w(this,t.call(this,n,r),n,r,`mouse`);i&&(E(n.view).on(`mousemove.drag`,m,D).on(`mouseup.drag`,h,D),y(n.view),_(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(O(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){E(e.view).on(`mousemove.drag mouseup.drag`,null),T(e.view,l),O(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=w(this,a,n,r,i[s].identifier,i[s]))&&(_(n),c(`start`,n,i[s]))}function S(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(O(e),a(`drag`,e,t[r]))}function C(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])&&(_(e),a(`end`,e,t[r]))}function w(e,t,r,s,c,l){var u=a.copy(),d=g(l||r,t),p,m,h;if((h=n.call(e,new j(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.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=g(l||a,t),v=o}u.call(r,e,new j(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:v,x:d[0]+p,y:d[1]+m,dx:d[0]-_[0],dy:d[1]-_[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:A(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:A(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:A(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:A(!!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 I=e(r(),1);function te(e){return e.kind===`group`}var L=/^capability\.[a-z0-9-]+(\.[a-z0-9-]+)+$/,R=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,z=e=>typeof e==`string`,B=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,ne=e=>B(e)&&e>0,re=e=>typeof e==`boolean`,ie=e=>t=>z(t)&&e.test(t),V=(...e)=>t=>e.includes(t),ae=e=>t=>t===null||e(t),H=e=>t=>Array.isArray(t)&&t.every(e),U=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]))},oe=ie(/^[0-9a-f]{64}$/),se=ie(R),ce=ie(L),le=e=>z(e)&&!e.startsWith(`/`)&&!/^[A-Za-z]:/.test(e)&&!/[\\\x00-\x1f\x7f]/.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),ue=U({model_valid:V(`valid`,`invalid`,`unknown`),generated_summary:V(`fresh`,`stale`,`unknown`),section3:V(`present`,`pending`)}),de=U({id:z,from:z,to:z,label:z,evidence:U({entrypointId:z,sourceSymbol:z,sinkId:z})}),fe=e=>U({id:z,capabilityId:ce,name:z,applicability:V(`not-applicable`),rationale:z})(e)||U({id:z,capabilityId:ce,name:z,applicability:V(`required`),participants:H(U({id:z,nodeId:z})),steps:H(de),outcomes:H(U({id:z,kind:V(`success`,`error`),label:z,steps:H(de),terminal:U({participant:z,label:z})}))})(e),pe=e=>typeof e==`string`&&e.length>0&&e!==`group`,me=U({include:H(z),exclude:H(z)}),he=e=>U({id:z,kind:pe,name:z,role:V(`center`,`child`,`caller`,`callee`)})(e)||U({id:z,kind:V(`group`),role:V(`caller`,`callee`),count:ne,members:H(U({id:z,name:z}))})(e),ge=U({schema_version:V(`repo-harness.architecture-modules.v1`),commit:se,modules:H(U({id:ce,domain:z,name:z,status:z,components:B,state:ue}))}),_e=U({schema_version:V(`repo-harness.architecture-module.v1`),commit:se,module:U({id:ce,name:z,status:z,summary:z,responsibilities:H(z),notes:H(z),source:me,verification:H(z),entrypoints:H(U({id:z,path:le,symbols:H(U({name:z,sinks:H(U({id:z,path:le,symbol:z}))}))})),components:H(U({id:z,kind:pe,name:z,summary:z,source:me}))}),graph:U({center:ce,nodes:H(he),edges:H(U({source:z,target:z,intent:z,relation_kind:z,direction:V(`directed`)}))}),flows:H(fe),section3:ae(z),linked_docs:H(U({path:le,kind:V(`contract`,`plan`),status:ae(z)})),state:ue}),ve=U({schema_version:V(`repo-harness.module-review-prompt.v1`),prompt_version:z,package_version:z,repository_id:ie(/^repo_[0-9a-f]{16}$/),capability_id:ce,commit:se,mode:V(`module`,`diff`),base:ae(se),head:ae(se),worktree_dirty_paths:H(le),dirty_content_sha256:ae(oe),model_sha256:oe,doc_sha256:ae(oe),sources:H(U({path:le,sha256:oe,bytes:B,class:V(`required`,`optional`),disposition:V(`included`,`omitted`,`chunked`)})),budget:U({input_cap_bytes:ne,used_bytes:B,incomplete:re,omitted_sections:H(z)}),shard:U({index:ne,count:ne,bytes:B}),full_prompt_sha256:oe,prompt:z,digest:oe});function ye(e){if(!ge(e))throw Error(`architecture_module_index_invalid`);return e}function be(e){if(!_e(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 xe(e){if(!ve(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 Se=Object.defineProperty,Ce=(e,t,n)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,we=(e,t)=>{for(var n in t)Se(e,n,{get:t[n],enumerable:!0})},Te=(e,t,n)=>Ce(e,typeof t==`symbol`?t:t+``,n),Ee={};we(Ee,{Graph:()=>dt,alg:()=>ze});var De=Object.defineProperty,Oe=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})},ke=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=Me(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=Ne(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,Ae(this._preds[a],i),Ae(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],je(this._preds[t],e),je(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Ae(e,t){e[t]?e[t]++:e[t]=1}function je(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Me(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function Ne(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function Pe(e,t){return Me(e,t.v,t.w,t.name)}Oe({},{read:()=>Re,write:()=>Fe});function Fe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Ie(e),edges:Le(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Ie(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Le(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Re(e){let t=new ke(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var ze={};Oe(ze,{CycleException:()=>et,bellmanFord:()=>Ve,components:()=>Ue,dijkstra:()=>Ke,dijkstraAll:()=>Je,findCycles:()=>Xe,floydWarshall:()=>Qe,isAcyclic:()=>nt,postorder:()=>ot,preorder:()=>st,prim:()=>ct,shortestPaths:()=>lt,tarjan:()=>Ye,topsort:()=>tt});var Be=()=>1;function Ve(e,t,n,r){return He(e,String(t),n||Be,r||function(t){return e.outEdges(t)??[]})}function He(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function Ue(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var We=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},Ge=()=>1;function Ke(e,t,n,r){return qe(e,String(t),n||Ge,r||function(t){return e.outEdges(t)??[]})}function qe(e,t,n,r){let i={},a=new We,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function Je(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Ke(e,i,t,n),r},{})}function Ye(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function Xe(e){return Ye(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var Ze=()=>1;function Qe(e,t,n){return $e(e,t||Ze,n||function(t){return e.outEdges(t)??[]})}function $e(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var et=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function tt(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new et;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new et;return r}function nt(e){try{tt(e)}catch(e){if(e instanceof et)return!1;throw e}return!0}function rt(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=it(e,t,n===`post`,o,a,r,i)}),i}function it(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=it(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function at(e,t,n){return rt(e,t,n,function(e,t){return e.push(t),e},[])}function ot(e,t){return at(e,t,`post`)}function st(e,t){return at(e,t,`pre`)}function ct(e,t){var n;let r=new ke,i={},a=new We,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function lt(e,t,n,r){return ut(e,t,n,r??(t=>e.outEdges(t)??[]))}function ut(e,t,n,r){if(n===void 0)return Ke(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return Ve(e,t,n,r)}return Ke(e,t,n,r)}var dt=ke;function ft(e,t,n,r){let i=r;for(;e.hasNode(i);)i=Dt(r);return n.dummy=t,e.setNode(i,n),i}function pt(e){let t=new dt().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function mt(e){let t=new dt({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ht(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return i===0||Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function gt(e){let t=Ot(Ct(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function _t(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=St(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function vt(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=St(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function yt(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),ft(e,`border`,i,t)}function bt(e,t=xt){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var xt=65535;function St(e,t){return t.length>xt?e(...bt(t).map(t=>e(...t))):e(...t)}function Ct(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return St(Math.max,t)}function wt(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Tt(e,t){return t()}var Et=0;function Dt(e){return e+(``+ ++Et)}function Ot(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function kt(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function At(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function jt(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Mt=`\0`;function Nt(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var Pt=class{constructor(){Te(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Ft(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Ft(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,It)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Ft(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function It(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Lt=Pt,Rt=()=>1;function zt(e,t){if(e.nodeCount()<=1)return[];let n=Ht(e,t||Rt);return Bt(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Bt(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Vt(e,t,n,o);for(;o=i.dequeue();)Vt(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Vt(e,t,n,o,!0)||[]);break}}}return r}function Vt(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Ut(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Ut(t,n,o)}),e.removeNode(r.v),o}function Ht(e,t){let n=new dt,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Wt(i+r+3).map(()=>new Lt),o=r+1;return n.nodes().forEach(e=>{Ut(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Ut(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Wt(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Gt(e,t){(e.graph().acyclicer===`greedy`?zt(e,n(e)):Kt(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Dt(`rev`))});function n(e){return t=>e.edge(t).weight}}function Kt(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Jt(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function qt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Jt(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Yt(e){e.graph().dummyChains=[],e.edges().forEach(t=>Xt(e,t))}function Xt(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=ft(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function Zt(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function Qt(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=St(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function $t(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var en=tn;function tn(e){let t=new dt({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;nn(t,e)<i&&(a=rn(t,e),a);)o=t.hasNode(a.v)?$t(e,a):-$t(e,a),an(t,e,o);return t}function nn(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!$t(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function rn(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=$t(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function an(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:on,postorder:sn}=ze,cn=ln;ln.initLowLimValues=pn,ln.initCutValues=un,ln.calcCutValue=fn,ln.leaveEdge=hn,ln.enterEdge=gn,ln.exchangeEdges=_n;function ln(e){e=pt(e),Qt(e);let t=en(e);pn(t),un(t,e);let n,r;for(;n=hn(t);)r=gn(t,e,n),_n(t,e,n,r)}function un(e,t){let n=sn(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>dn(e,t,n))}function dn(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=fn(e,t,n)}function fn(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,yn(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function pn(e,t){arguments.length<2&&(t=e.nodes()[0]),mn(e,{},1,t)}function mn(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=mn(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function hn(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function gn(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===bn(e,e.node(t.v),s)&&c!==bn(e,e.node(t.w),s)).reduce((e,n)=>$t(t,n)<$t(t,e)?n:e)}function _n(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),pn(e),un(e,t),vn(e,t)}function vn(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=on(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function yn(e,t,n){return e.hasEdge(t,n)}function bn(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var xn=Sn;function Sn(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:Tn(e);break;case`tight-tree`:wn(e);break;case`longest-path`:Cn(e);break;case`none`:break;default:Tn(e)}}var Cn=Qt;function wn(e){Qt(e),en(e)}function Tn(e){cn(e)}var En=Dn;function Dn(e){let t=kn(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=On(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function On(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function kn(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Mt).forEach(r),t}function An(e){let t=ft(e,`root`,{},`_root`),n=Mn(e),r=Object.values(n),i=St(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=Nn(e)+1;e.children(Mt).forEach(r=>{jn(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function jn(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=yt(e,`_bt`),l=yt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{jn(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Mn(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Mt).forEach(e=>n(e,1)),t}function Nn(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Pn(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Fn=In;function In(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Ln(e,`borderLeft`,`_bl`,n,i,t),Ln(e,`borderRight`,`_br`,n,i,t)}}e.children(Mt).forEach(t)}function Ln(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=ft(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Rn(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Bn(e)}function zn(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Hn(e),(t===`lr`||t===`rl`)&&(Wn(e),Bn(e))}function Bn(e){e.nodes().forEach(t=>Vn(e.node(t))),e.edges().forEach(t=>Vn(e.edge(t)))}function Vn(e){let t=e.width;e.width=e.height,e.height=t}function Hn(e){e.nodes().forEach(t=>Un(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Un),Object.hasOwn(r,`y`)&&Un(r)})}function Un(e){e.y=-e.y}function Wn(e){e.nodes().forEach(t=>Gn(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Gn),Object.hasOwn(r,`x`)&&Gn(r)})}function Gn(e){let t=e.x;e.x=e.y,e.y=t}function Kn(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=Ot(St(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return Nt(t,e.node(n),e.node(r))}return a}function qn(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Jn(e,t[r-1],t[r]);return n}function Jn(e,t,n){let r=jt(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Yn(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Xn(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Zn(Object.values(n).filter(e=>!e.indegree))}function Zn(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Qn(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>kt(e,[`vs`,`i`,`barycenter`,`weight`]))}function Qn(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function $n(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=wt(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(tr(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=er(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=er(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function er(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function tr(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=Nt(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function nr(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=Yn(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=nr(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&ir(t,r)}});let h=Xn(m,n);rr(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(h[t]&&h[n]&&(a=h[t])!=null&&a.barycenter&&(o=h[n])!=null&&o.barycenter&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]||(g[r]=h[n],h.splice(n,1),n--)}else _=!0}let v=$n(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function rr(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function ir(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ar(e,t,n,r){r||=e.nodes();let i=or(e),a=new dt({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function or(e){let t;for(;e.hasNode(t=Dt(`_root`)););return t}function sr(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function cr(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,cr);return}let r=Ct(e),i=lr(e,Ot(1,r+1),`inEdges`),a=lr(e,Ot(r-1,-1,-1),`outEdges`),o=Kn(e,n);if(dr(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){ur(t%2?i:a,t%4>=2,l,n),o=gt(e);let u=qn(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}dr(e,c)}function lr(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return ar(e,t,n,r.get(t)||[])})}function ur(e,t,n,r){let i=!0,a=new dt;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=nr(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),sr(e,a,s.vs)})}function dr(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function fr(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=mr(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&hr(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function pr(e,t){let n={};function r(t){return e.node(t)?.dummy===`border`}if(!e.nodes().some(r))return n;function i(t,r,i,a,o){Ot(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&hr(n,t,i)})}})}function a(t,n){let a=-1,o=-1,s=0;return n.forEach((c,l)=>{if(r(c)){let t=e.predecessors(c);if(t&&t.length){let r=t[0];if(r===void 0)return;o=e.node(r).order,i(n,s,l,a,o),s=l,a=o}}i(n,s,n.length,o,t.length)}),n}return t.length&&t.reduce(a),n}function mr(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function hr(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function gr(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function _r(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||Er(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>Er(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!gr(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function vr(e,t,n,r,i=!1){let a={},o=yr(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function yr(e,t,n,r){let i=new dt,a=e.graph(),o=wr(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function br(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Tr(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function xr(e,t){let n=Object.values(t),r=St(Math.min,n),i=St(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-St(Math.min,c);a!==`l`&&(l=i-St(Math.max,c)),l&&(e[o]=At(s,e=>e+l))})})}function Sr(e,t=void 0){let n=e.ul;return n?At(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function Cr(e,t){let n=gt(e),r=Object.assign(fr(e,n),pr(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=_r(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=vr(e,a,s.root,s.align,n===`r`);n===`r`&&(c=At(c,e=>-e)),i[o+n]=c})}),xr(i,br(e,i)),Sr(i,e.graph().align)}function wr(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function Tr(e,t){return e.node(t).width}function Er(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function Dr(e,t){e=mt(e),Or(e),Object.entries(Cr(e,t)).forEach(([t,n])=>e.node(t).x=n)}function Or(e){let t=gt(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var kr=new WeakMap;function Ar(e,t={}){return Mr(e,Tt,t),e}function jr(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function Mr(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new dt({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=jr(e,t.v,r),i=jr(e,t.w,r);if(n===t.v&&i===t.w)o.setEdge(t,{...e.edge(t)});else if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),Mr(o,t,n);let l=Wr(o);Pr(l,t,n,null),Fr(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),isFinite(u)&&isFinite(d)&&isFinite(f)&&isFinite(p)||(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=Wr(e),g=Pr(h,t,n,kr.get(e)??null);kr.set(e,g),Fr(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),Nr(e,n,s-l,c-u),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),Nr(e,i,a-s,o-c),delete n._dagreClusterSubgraph}})}function Nr(e,t,n,r){t.edges().forEach(i=>{if(!e.hasEdge(i))return;let a=t.edge(i),o=e.edge(i);o.points=a.points.map(e=>({x:e.x+n,y:e.y+r})),Object.hasOwn(a,`x`)&&(o.x=a.x+n,o.y=a.y+r)})}function Pr(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>Gr(e)),t(` removeSelfEdges`,()=>ei(e)),t(` acyclic`,()=>Gt(e,s)),t(` nestingGraph.run`,()=>An(e)),t(` rank`,()=>xn(mt(e))),t(` injectEdgeLabelProxies`,()=>Kr(e)),t(` removeEmptyRanks`,()=>vt(e)),t(` nestingGraph.cleanup`,()=>Pn(e)),t(` normalizeRanks`,()=>_t(e)),t(` assignRankMinMax`,()=>qr(e)),t(` removeEdgeLabelProxies`,()=>Jr(e)),t(` normalize.run`,()=>Yt(e)),t(` parentDummyChains`,()=>En(e)),t(` addBorderSegments`,()=>Fn(e)),t(` order`,()=>cr(e,n,c)),t(` insertSelfEdges`,()=>ti(e)),t(` adjustCoordinateSystem`,()=>Rn(e)),t(` position`,()=>Dr(e,n.corePath)),t(` positionSelfEdges`,()=>ni(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>$r(e)),t(` normalize.undo`,()=>Zt(e)),t(` fixupEdgeLabelCoords`,()=>Zr(e)),t(` undoCoordinateSystem`,()=>zn(e)),t(` translateGraph`,()=>Yr(e)),t(` assignNodeIntersects`,()=>Xr(e)),t(` reversePoints`,()=>Qr(e)),t(` acyclic.undo`,()=>qt(e)),{graph:e,rawNodes:l}}function Fr(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ir=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Lr={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},Rr=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],zr=[`width`,`height`,`rank`],Br={width:0,height:0},Vr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Hr={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ur=[`labelpos`];function Wr(e){let t=new dt({multigraph:!0,compound:!0}),n=ii(e.graph());return t.setGraph(Object.assign({},Lr,ri(n,Ir),kt(n,Rr))),e.nodes().forEach(n=>{let r=ri(ii(e.node(n)),zr);Object.keys(Br).forEach(e=>{r[e]===void 0&&(r[e]=Br[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=ii(e.edge(n));t.setEdge(n,Object.assign({},Hr,ri(r,Vr),kt(r,Ur)))}),t}function Gr(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Kr(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);ft(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function qr(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Jr(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Yr(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Xr(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ht(r,a)),n.points.push(ht(i,o))})}function Zr(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Qr(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function $r(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function ei(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function ti(e){gt(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{ft(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),Array.isArray(t.label.points)&&t.label.points.length===7||(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function ni(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function ri(e,t){return At(kt(e,t),Number)}function ii(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}var ai=7,oi=16,si=1.5,ci=new Set([`M`,`W`,`m`,`w`,`@`,`%`]);function li(e,t){let n=0;for(let r of e)n+=r.charCodeAt(0)>=128||t===`title`&&ci.has(r)?2:1;return Math.ceil(n*ai*(t===`title`?si:1))}var ui=12,di=e=>Math.round(e*10)/10,fi=e=>Math.round(e*100)/100,pi=(e,t)=>[fi((e[0]+t[0])/2),fi((e[1]+t[1])/2)],mi=([e,t])=>`${e} ${t}`;function hi(e){let t=e.length-1;if(t===1)return`M${mi(e[0])} L${mi(e[1])}`;let n=[`M${mi(e[0])}`,`L${mi(pi(e[0],e[1]))}`];for(let r=1;r<t;r++)n.push(`Q${mi(e[r])} ${mi(pi(e[r],e[r+1]))}`);return n.push(`L${mi(e[t])}`),n.join(` `)}var gi=16;function _i(e,t,n){return Array.from({length:gi},(r,i)=>{let a=(i+1)/gi,o=1-a;return[o*o*e[0]+2*o*a*t[0]+a*a*n[0],o*o*e[1]+2*o*a*t[1]+a*a*n[1]]})}var vi=e=>e.slice(1).map((t,n)=>[e[n],t]);function yi(e,t,n){let r=li(e,`label`);return{text:e,x:di(t[0]-r/2),y:di(t[1]-oi/2),width:r,height:oi,route:n}}function bi(e){let t=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1])),n=t.reduce((e,t)=>e+t,0)/2;for(let[r,i]of t.entries()){if(n<=i&&i>0){let[t,a]=[e[r],e[r+1]];return[di(t[0]+(a[0]-t[0])*n/i),di(t[1]+(a[1]-t[1])*n/i)]}n-=i}return e[e.length-1]}function xi(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t[0]-n,a=t[1]-r;if(i===0&&a===0)return[di(n),di(e.y)];let o=Math.min(i===0?1/0:e.width/2/Math.abs(i),a===0?1/0:e.height/2/Math.abs(a));return[di(n+i*o),di(r+a*o)]}function Si(e,t,n,r){let i=t[0]-e[0],a=t[1]-e[1],o=0,s=1,c=[[-i,e[0]-(n.x-r)],[i,n.x+n.width+r-e[0]],[-a,e[1]-(n.y-r)],[a,n.y+n.height+r-e[1]]];for(let[e,t]of c){if(e===0){if(t<0)return null;continue}let n=t/e;if(e<0?o=Math.max(o,n):s=Math.min(s,n),o>s)return null}return[o,s]}function Ci(e,t,n){let r=Si(e,t,n,-.5);return r!==null&&(r[1]-r[0])*Math.hypot(t[0]-e[0],t[1]-e[1])>.01}var wi=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Ti=e=>[[e.x-ui,e.y-ui],[e.x+e.width+ui,e.y-ui],[e.x-ui,e.y+e.height+ui],[e.x+e.width+ui,e.y+e.height+ui]],Ei=(e,t)=>e[0]>t.x+.5&&e[0]<t.x+t.width-.5&&e[1]>t.y+.5&&e[1]<t.y+t.height-.5;function Di(e,t,n){let r=[e,t,...n.flatMap(Ti).filter(e=>!n.some(t=>Ei(e,t)))],i=r.map(()=>1/0),a=r.map(()=>-1),o=r.map(()=>!1);for(i[0]=0;;){let e=-1;for(let[t,n]of i.entries())!o[t]&&n<1/0&&(e<0||n<i[e])&&(e=t);if(e<0)return null;if(e===1)break;o[e]=!0;for(let[t,s]of r.entries()){let c=i[e]+wi(r[e],s);!o[t]&&c<i[t]&&!n.some(t=>Ci(r[e],s,t))&&(i[t]=c,a[t]=e)}}let s=[];for(let e=1;e>=0;e=a[e])s.unshift(r[e]);return s}function Oi(e,t){return e.flatMap((n,r)=>{let i=e[r+1];return i===void 0||!t.some(e=>Ci(n,i,e))?[n]:(Di(n,i,t)??[n,i]).slice(0,-1)})}function ki(e){let t=[];for(let n of e){let e=t.findIndex(e=>e[0]===n[0]&&e[1]===n[1]);e>=0&&(t.length=e),t.push(n)}return t}function Ai(e,t,n){let r=Math.min(n/Math.max(wi(e,t),.01),.25);return[di(e[0]+(t[0]-e[0])*r),di(e[1]+(t[1]-e[1])*r)]}function ji(e,t){let n=[...e];for(let e=0,r=8;e<6;e++,r/=2){let e=e=>e>0&&e<n.length-1&&vi([pi(n[e-1],n[e]),..._i(pi(n[e-1],n[e]),n[e],pi(n[e],n[e+1]))]).some(([e,n])=>t.some(t=>Ci(e,n,t)));if(!n.some((t,n)=>e(n)))break;n=n.flatMap((t,i)=>e(i)?[Ai(t,n[i-1],r),t,Ai(t,n[i+1],r)]:[t])}return n}function Mi(e,t){return ki(ji(Oi(e,t),t))}function Ni(e){let t=[...e.boxes,...e.labels,...e.routes.flatMap(e=>e.points.map(([e,t])=>({x:e,y:t,width:0,height:0})))];if(t.length===0)return{x:0,y:0,width:0,height:0};let n=Math.min(...t.map(e=>e.x)),r=Math.min(...t.map(e=>e.y));return{x:n,y:r,width:Math.max(...t.map(e=>e.x+e.width))-n,height:Math.max(...t.map(e=>e.y+e.height))-r}}function Pi(e,t,n,r=[]){let i=Ni({boxes:e,routes:t,labels:r});return{width:Math.max(0,i.x+i.width)+n,height:Math.max(0,i.y+i.height)+n}}function Fi(e,t=!0){let n=new Ee.Graph({multigraph:!0});n.setGraph({rankdir:`TB`,nodesep:e.nodesep,ranksep:e.ranksep,marginx:e.margin,marginy:e.margin});for(let t of e.nodes)n.setNode(t.id,{width:t.width,height:t.height});for(let t of e.edges)n.setEdge(t.source,t.target,{weight:t.weight},t.id);Ar(n);let r=e.nodes.map(e=>{let{x:t,y:r}=n.node(e.id);return{id:e.id,parent:null,x:di(t-e.width/2),y:di(r-e.height/2),width:e.width,height:e.height,kind:e.kind}}),i=e.edges.map(({weight:e,...i})=>{let a=n.edge(i.source,i.target,i.id).points.map(({x:e,y:t})=>[di(e),di(t)]),o=r.filter(e=>e.id!==i.source&&e.id!==i.target);return{...i,points:t?Mi(a,o):a}});return{boxes:r,routes:i,labels:[],extent:Pi(r,i,e.margin)}}var Ii=`text{font-family:system-ui,sans-serif;font-size:12px;fill:#1F2328}.box{fill:#F2F4F7;stroke:#D3D9E0}.frame{fill:#FFFFFF;stroke:#D3D9E0}.external{fill:#FFFFFF;stroke:#D3D9E0;stroke-dasharray:6 4}.member{fill:#FFFFFF;stroke:#D3D9E0}.writer{fill:#E4F2EA;stroke:#1F8A5B}.reader{fill:#FFFFFF;stroke:#8C96A3;stroke-dasharray:4 3}.point{fill:#E8EFFB;stroke:#2D5BB8}.title{font-size:13px;font-weight:600}.detail{fill:#5B6573}.route{fill:none;stroke:#5B6573}.route.dashed{stroke-dasharray:6 4}.label-box{fill:#FFFFFF}.label{font-family:ui-monospace,monospace;font-size:11px;fill:#1F2328}`,Li={band:`.band{fill:none;stroke:none}`,selected:`.selected{stroke:#F08A3C;stroke-width:2}`,lifeline:`.lifeline{fill:#8C96A3;stroke:none}`,fragment:`.fragment{stroke-dasharray:5 4}`,terminal:`.terminal{fill:#FFFFFF}`,success:`.fragment.success{fill:#EDF7F0;stroke:#2C6A3D}.terminal.success{stroke:#2C6A3D}`,error:`.fragment.error{fill:#FBEFEF;stroke:#B42318}.terminal.error{stroke:#B42318}`},Ri=e=>e.replace(/[&<>"]/gu,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e]);function zi(e,t){return e.height<32?t.length===0?``:`<text class="title" x="${e.x+8}" y="${e.y+e.height/2+4}">${Ri(t[0])}</text>`:t.map((t,n)=>`<text class="${n===0?`title`:`detail`}" x="${e.x+12}" y="${e.y+20+n*16}">${Ri(t)}</text>`).join(``)}function Bi(e,t){let{width:n,height:r}=e.extent,i=[];for(let[n,r]of e.boxes.entries())i.push(`<clipPath id="clip-${n}"><rect x="${r.x}" y="${r.y}" width="${r.width}" height="${r.height}" rx="10"/></clipPath>`,`<rect class="${r.kind}" x="${r.x}" y="${r.y}" width="${r.width}" height="${r.height}" rx="10"/>`,`<g clip-path="url(#clip-${n})">${zi(r,t(r))}</g>`);for(let t of e.routes){let e=`${t.arrows.start?` marker-start="url(#arrow)"`:``}${t.arrows.end?` marker-end="url(#arrow)"`:``}`;i.push(`<path class="route${t.dashed?` dashed`:``}" stroke-width="${t.width}" d="${hi(t.points)}"${e}/>`)}for(let t of e.labels)i.push(`<rect class="label-box" x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" rx="3"/>`,`<text class="label" x="${t.x+t.width/2}" y="${t.y+12}" text-anchor="middle">${Ri(t.text)}</text>`);let a=new Set(e.boxes.flatMap(e=>e.kind.split(` `))),o=Object.entries(Li).filter(([e])=>a.has(e)).map(([,e])=>e).join(``);return[`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}">`,`<style>${Ii}${o}</style>`,`<defs><marker id="arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0 0L8 4L0 8z" fill="#5B6573"/></marker></defs>`,`<rect width="${n}" height="${r}" fill="#FFFFFF"/>`,...i,`</svg>`].join(`
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{C as t,D as n,O as r,T as i,_ as a,b as o,c as s,g as c,h as l,l as u,n as d,o as f,p,v as m,y as h}from"./index-DU_E6SAm.js";import{C as g,S as _,T as v,_ as y,b,i as x,n as S,r as C,t as w,v as T,w as E,x as D,y as O}from"./src-C_gRsKqw.js";import{t as k}from"./value-CHmTzbgv.js";var A=e=>()=>e;function j(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}})}j.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function M(e){return!e.ctrlKey&&!e.button}function N(){return this.parentNode}function P(e,t){return t??{x:e.x,y:e.y}}function F(){return navigator.maxTouchPoints||`ontouchstart`in this}function ee(){var e=M,t=N,n=P,r=F,i={},a=v(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,x).on(`touchmove.drag`,S,b).on(`touchend.drag touchcancel.drag`,C).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=w(this,t.call(this,n,r),n,r,`mouse`);i&&(E(n.view).on(`mousemove.drag`,m,D).on(`mouseup.drag`,h,D),y(n.view),_(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(O(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){E(e.view).on(`mousemove.drag mouseup.drag`,null),T(e.view,l),O(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=w(this,a,n,r,i[s].identifier,i[s]))&&(_(n),c(`start`,n,i[s]))}function S(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(O(e),a(`drag`,e,t[r]))}function C(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])&&(_(e),a(`end`,e,t[r]))}function w(e,t,r,s,c,l){var u=a.copy(),d=g(l||r,t),p,m,h;if((h=n.call(e,new j(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.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=g(l||a,t),v=o}u.call(r,e,new j(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:v,x:d[0]+p,y:d[1]+m,dx:d[0]-_[0],dy:d[1]-_[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:A(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:A(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:A(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:A(!!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 I=e(r(),1);function te(e){return e.kind===`group`}var L=/^capability\.[a-z0-9-]+(\.[a-z0-9-]+)+$/,R=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,z=e=>typeof e==`string`,B=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,ne=e=>B(e)&&e>0,re=e=>typeof e==`boolean`,ie=e=>t=>z(t)&&e.test(t),V=(...e)=>t=>e.includes(t),ae=e=>t=>t===null||e(t),H=e=>t=>Array.isArray(t)&&t.every(e),U=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]))},oe=ie(/^[0-9a-f]{64}$/),se=ie(R),ce=ie(L),le=e=>z(e)&&!e.startsWith(`/`)&&!/^[A-Za-z]:/.test(e)&&!/[\\\x00-\x1f\x7f]/.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),ue=U({model_valid:V(`valid`,`invalid`,`unknown`),generated_summary:V(`fresh`,`stale`,`unknown`),section3:V(`present`,`pending`)}),de=U({id:z,from:z,to:z,label:z,evidence:U({entrypointId:z,sourceSymbol:z,sinkId:z})}),fe=e=>U({id:z,capabilityId:ce,name:z,applicability:V(`not-applicable`),rationale:z})(e)||U({id:z,capabilityId:ce,name:z,applicability:V(`required`),participants:H(U({id:z,nodeId:z})),steps:H(de),outcomes:H(U({id:z,kind:V(`success`,`error`),label:z,steps:H(de),terminal:U({participant:z,label:z})}))})(e),pe=e=>typeof e==`string`&&e.length>0&&e!==`group`,me=U({include:H(z),exclude:H(z)}),he=e=>U({id:z,kind:pe,name:z,role:V(`center`,`child`,`caller`,`callee`)})(e)||U({id:z,kind:V(`group`),role:V(`caller`,`callee`),count:ne,members:H(U({id:z,name:z}))})(e),ge=U({schema_version:V(`repo-harness.architecture-modules.v1`),commit:se,modules:H(U({id:ce,domain:z,name:z,status:z,components:B,state:ue}))}),_e=U({schema_version:V(`repo-harness.architecture-module.v1`),commit:se,module:U({id:ce,name:z,status:z,summary:z,responsibilities:H(z),notes:H(z),source:me,verification:H(z),entrypoints:H(U({id:z,path:le,symbols:H(U({name:z,sinks:H(U({id:z,path:le,symbol:z}))}))})),components:H(U({id:z,kind:pe,name:z,summary:z,source:me}))}),graph:U({center:ce,nodes:H(he),edges:H(U({source:z,target:z,intent:z,relation_kind:z,direction:V(`directed`)}))}),flows:H(fe),section3:ae(z),linked_docs:H(U({path:le,kind:V(`contract`,`plan`),status:ae(z)})),state:ue}),ve=U({schema_version:V(`repo-harness.module-review-prompt.v1`),prompt_version:z,package_version:z,repository_id:ie(/^repo_[0-9a-f]{16}$/),capability_id:ce,commit:se,mode:V(`module`,`diff`),base:ae(se),head:ae(se),worktree_dirty_paths:H(le),dirty_content_sha256:ae(oe),model_sha256:oe,doc_sha256:ae(oe),sources:H(U({path:le,sha256:oe,bytes:B,class:V(`required`,`optional`),disposition:V(`included`,`omitted`,`chunked`)})),budget:U({input_cap_bytes:ne,used_bytes:B,incomplete:re,omitted_sections:H(z)}),shard:U({index:ne,count:ne,bytes:B}),full_prompt_sha256:oe,prompt:z,digest:oe});function ye(e){if(!ge(e))throw Error(`architecture_module_index_invalid`);return e}function be(e){if(!_e(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 xe(e){if(!ve(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 Se=Object.defineProperty,Ce=(e,t,n)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,we=(e,t)=>{for(var n in t)Se(e,n,{get:t[n],enumerable:!0})},Te=(e,t,n)=>Ce(e,typeof t==`symbol`?t:t+``,n),Ee={};we(Ee,{Graph:()=>dt,alg:()=>ze});var De=Object.defineProperty,Oe=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})},ke=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=Me(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=Ne(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,Ae(this._preds[a],i),Ae(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Pe(this._isDirected,e):Me(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],je(this._preds[t],e),je(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Ae(e,t){e[t]?e[t]++:e[t]=1}function je(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Me(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function Ne(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function Pe(e,t){return Me(e,t.v,t.w,t.name)}Oe({},{read:()=>Re,write:()=>Fe});function Fe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Ie(e),edges:Le(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Ie(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Le(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Re(e){let t=new ke(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var ze={};Oe(ze,{CycleException:()=>et,bellmanFord:()=>Ve,components:()=>Ue,dijkstra:()=>Ke,dijkstraAll:()=>Je,findCycles:()=>Xe,floydWarshall:()=>Qe,isAcyclic:()=>nt,postorder:()=>ot,preorder:()=>st,prim:()=>ct,shortestPaths:()=>lt,tarjan:()=>Ye,topsort:()=>tt});var Be=()=>1;function Ve(e,t,n,r){return He(e,String(t),n||Be,r||function(t){return e.outEdges(t)??[]})}function He(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function Ue(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var We=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},Ge=()=>1;function Ke(e,t,n,r){return qe(e,String(t),n||Ge,r||function(t){return e.outEdges(t)??[]})}function qe(e,t,n,r){let i={},a=new We,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function Je(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Ke(e,i,t,n),r},{})}function Ye(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function Xe(e){return Ye(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var Ze=()=>1;function Qe(e,t,n){return $e(e,t||Ze,n||function(t){return e.outEdges(t)??[]})}function $e(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var et=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function tt(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new et;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new et;return r}function nt(e){try{tt(e)}catch(e){if(e instanceof et)return!1;throw e}return!0}function rt(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=it(e,t,n===`post`,o,a,r,i)}),i}function it(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=it(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function at(e,t,n){return rt(e,t,n,function(e,t){return e.push(t),e},[])}function ot(e,t){return at(e,t,`post`)}function st(e,t){return at(e,t,`pre`)}function ct(e,t){var n;let r=new ke,i={},a=new We,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function lt(e,t,n,r){return ut(e,t,n,r??(t=>e.outEdges(t)??[]))}function ut(e,t,n,r){if(n===void 0)return Ke(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return Ve(e,t,n,r)}return Ke(e,t,n,r)}var dt=ke;function ft(e,t,n,r){let i=r;for(;e.hasNode(i);)i=Dt(r);return n.dummy=t,e.setNode(i,n),i}function pt(e){let t=new dt().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function mt(e){let t=new dt({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ht(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return i===0||Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function gt(e){let t=Ot(Ct(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function _t(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=St(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function vt(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=St(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function yt(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),ft(e,`border`,i,t)}function bt(e,t=xt){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var xt=65535;function St(e,t){return t.length>xt?e(...bt(t).map(t=>e(...t))):e(...t)}function Ct(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return St(Math.max,t)}function wt(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Tt(e,t){return t()}var Et=0;function Dt(e){return e+(``+ ++Et)}function Ot(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function kt(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function At(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function jt(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Mt=`\0`;function Nt(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var Pt=class{constructor(){Te(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Ft(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Ft(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,It)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Ft(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function It(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Lt=Pt,Rt=()=>1;function zt(e,t){if(e.nodeCount()<=1)return[];let n=Ht(e,t||Rt);return Bt(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Bt(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Vt(e,t,n,o);for(;o=i.dequeue();)Vt(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Vt(e,t,n,o,!0)||[]);break}}}return r}function Vt(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Ut(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Ut(t,n,o)}),e.removeNode(r.v),o}function Ht(e,t){let n=new dt,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Wt(i+r+3).map(()=>new Lt),o=r+1;return n.nodes().forEach(e=>{Ut(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Ut(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Wt(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Gt(e,t){(e.graph().acyclicer===`greedy`?zt(e,n(e)):Kt(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Dt(`rev`))});function n(e){return t=>e.edge(t).weight}}function Kt(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Jt(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function qt(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Jt(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Yt(e){e.graph().dummyChains=[],e.edges().forEach(t=>Xt(e,t))}function Xt(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=ft(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function Zt(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function Qt(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=St(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function $t(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var en=tn;function tn(e){let t=new dt({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;nn(t,e)<i&&(a=rn(t,e),a);)o=t.hasNode(a.v)?$t(e,a):-$t(e,a),an(t,e,o);return t}function nn(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!$t(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function rn(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=$t(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function an(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:on,postorder:sn}=ze,cn=ln;ln.initLowLimValues=pn,ln.initCutValues=un,ln.calcCutValue=fn,ln.leaveEdge=hn,ln.enterEdge=gn,ln.exchangeEdges=_n;function ln(e){e=pt(e),Qt(e);let t=en(e);pn(t),un(t,e);let n,r;for(;n=hn(t);)r=gn(t,e,n),_n(t,e,n,r)}function un(e,t){let n=sn(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>dn(e,t,n))}function dn(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=fn(e,t,n)}function fn(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,yn(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function pn(e,t){arguments.length<2&&(t=e.nodes()[0]),mn(e,{},1,t)}function mn(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=mn(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function hn(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function gn(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===bn(e,e.node(t.v),s)&&c!==bn(e,e.node(t.w),s)).reduce((e,n)=>$t(t,n)<$t(t,e)?n:e)}function _n(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),pn(e),un(e,t),vn(e,t)}function vn(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=on(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function yn(e,t,n){return e.hasEdge(t,n)}function bn(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var xn=Sn;function Sn(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:Tn(e);break;case`tight-tree`:wn(e);break;case`longest-path`:Cn(e);break;case`none`:break;default:Tn(e)}}var Cn=Qt;function wn(e){Qt(e),en(e)}function Tn(e){cn(e)}var En=Dn;function Dn(e){let t=kn(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=On(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function On(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function kn(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Mt).forEach(r),t}function An(e){let t=ft(e,`root`,{},`_root`),n=Mn(e),r=Object.values(n),i=St(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=Nn(e)+1;e.children(Mt).forEach(r=>{jn(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function jn(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=yt(e,`_bt`),l=yt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{jn(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Mn(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Mt).forEach(e=>n(e,1)),t}function Nn(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Pn(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Fn=In;function In(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Ln(e,`borderLeft`,`_bl`,n,i,t),Ln(e,`borderRight`,`_br`,n,i,t)}}e.children(Mt).forEach(t)}function Ln(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=ft(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Rn(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Bn(e)}function zn(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Hn(e),(t===`lr`||t===`rl`)&&(Wn(e),Bn(e))}function Bn(e){e.nodes().forEach(t=>Vn(e.node(t))),e.edges().forEach(t=>Vn(e.edge(t)))}function Vn(e){let t=e.width;e.width=e.height,e.height=t}function Hn(e){e.nodes().forEach(t=>Un(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Un),Object.hasOwn(r,`y`)&&Un(r)})}function Un(e){e.y=-e.y}function Wn(e){e.nodes().forEach(t=>Gn(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Gn),Object.hasOwn(r,`x`)&&Gn(r)})}function Gn(e){let t=e.x;e.x=e.y,e.y=t}function Kn(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=Ot(St(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return Nt(t,e.node(n),e.node(r))}return a}function qn(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Jn(e,t[r-1],t[r]);return n}function Jn(e,t,n){let r=jt(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Yn(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Xn(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Zn(Object.values(n).filter(e=>!e.indegree))}function Zn(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Qn(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>kt(e,[`vs`,`i`,`barycenter`,`weight`]))}function Qn(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function $n(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=wt(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(tr(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=er(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=er(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function er(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function tr(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=Nt(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function nr(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=Yn(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=nr(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&ir(t,r)}});let h=Xn(m,n);rr(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(h[t]&&h[n]&&(a=h[t])!=null&&a.barycenter&&(o=h[n])!=null&&o.barycenter&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]||(g[r]=h[n],h.splice(n,1),n--)}else _=!0}let v=$n(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function rr(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function ir(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ar(e,t,n,r){r||=e.nodes();let i=or(e),a=new dt({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function or(e){let t;for(;e.hasNode(t=Dt(`_root`)););return t}function sr(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function cr(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,cr);return}let r=Ct(e),i=lr(e,Ot(1,r+1),`inEdges`),a=lr(e,Ot(r-1,-1,-1),`outEdges`),o=Kn(e,n);if(dr(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){ur(t%2?i:a,t%4>=2,l,n),o=gt(e);let u=qn(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}dr(e,c)}function lr(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return ar(e,t,n,r.get(t)||[])})}function ur(e,t,n,r){let i=!0,a=new dt;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=nr(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),sr(e,a,s.vs)})}function dr(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function fr(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=mr(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&hr(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function pr(e,t){let n={};function r(t){return e.node(t)?.dummy===`border`}if(!e.nodes().some(r))return n;function i(t,r,i,a,o){Ot(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&hr(n,t,i)})}})}function a(t,n){let a=-1,o=-1,s=0;return n.forEach((c,l)=>{if(r(c)){let t=e.predecessors(c);if(t&&t.length){let r=t[0];if(r===void 0)return;o=e.node(r).order,i(n,s,l,a,o),s=l,a=o}}i(n,s,n.length,o,t.length)}),n}return t.length&&t.reduce(a),n}function mr(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function hr(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function gr(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function _r(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||Er(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>Er(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!gr(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function vr(e,t,n,r,i=!1){let a={},o=yr(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function yr(e,t,n,r){let i=new dt,a=e.graph(),o=wr(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function br(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Tr(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function xr(e,t){let n=Object.values(t),r=St(Math.min,n),i=St(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-St(Math.min,c);a!==`l`&&(l=i-St(Math.max,c)),l&&(e[o]=At(s,e=>e+l))})})}function Sr(e,t=void 0){let n=e.ul;return n?At(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function Cr(e,t){let n=gt(e),r=Object.assign(fr(e,n),pr(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=_r(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=vr(e,a,s.root,s.align,n===`r`);n===`r`&&(c=At(c,e=>-e)),i[o+n]=c})}),xr(i,br(e,i)),Sr(i,e.graph().align)}function wr(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function Tr(e,t){return e.node(t).width}function Er(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function Dr(e,t){e=mt(e),Or(e),Object.entries(Cr(e,t)).forEach(([t,n])=>e.node(t).x=n)}function Or(e){let t=gt(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var kr=new WeakMap;function Ar(e,t={}){return Mr(e,Tt,t),e}function jr(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function Mr(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new dt({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=jr(e,t.v,r),i=jr(e,t.w,r);if(n===t.v&&i===t.w)o.setEdge(t,{...e.edge(t)});else if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),Mr(o,t,n);let l=Wr(o);Pr(l,t,n,null),Fr(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),isFinite(u)&&isFinite(d)&&isFinite(f)&&isFinite(p)||(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=Wr(e),g=Pr(h,t,n,kr.get(e)??null);kr.set(e,g),Fr(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),Nr(e,n,s-l,c-u),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),Nr(e,i,a-s,o-c),delete n._dagreClusterSubgraph}})}function Nr(e,t,n,r){t.edges().forEach(i=>{if(!e.hasEdge(i))return;let a=t.edge(i),o=e.edge(i);o.points=a.points.map(e=>({x:e.x+n,y:e.y+r})),Object.hasOwn(a,`x`)&&(o.x=a.x+n,o.y=a.y+r)})}function Pr(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>Gr(e)),t(` removeSelfEdges`,()=>ei(e)),t(` acyclic`,()=>Gt(e,s)),t(` nestingGraph.run`,()=>An(e)),t(` rank`,()=>xn(mt(e))),t(` injectEdgeLabelProxies`,()=>Kr(e)),t(` removeEmptyRanks`,()=>vt(e)),t(` nestingGraph.cleanup`,()=>Pn(e)),t(` normalizeRanks`,()=>_t(e)),t(` assignRankMinMax`,()=>qr(e)),t(` removeEdgeLabelProxies`,()=>Jr(e)),t(` normalize.run`,()=>Yt(e)),t(` parentDummyChains`,()=>En(e)),t(` addBorderSegments`,()=>Fn(e)),t(` order`,()=>cr(e,n,c)),t(` insertSelfEdges`,()=>ti(e)),t(` adjustCoordinateSystem`,()=>Rn(e)),t(` position`,()=>Dr(e,n.corePath)),t(` positionSelfEdges`,()=>ni(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>$r(e)),t(` normalize.undo`,()=>Zt(e)),t(` fixupEdgeLabelCoords`,()=>Zr(e)),t(` undoCoordinateSystem`,()=>zn(e)),t(` translateGraph`,()=>Yr(e)),t(` assignNodeIntersects`,()=>Xr(e)),t(` reversePoints`,()=>Qr(e)),t(` acyclic.undo`,()=>qt(e)),{graph:e,rawNodes:l}}function Fr(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ir=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Lr={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},Rr=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],zr=[`width`,`height`,`rank`],Br={width:0,height:0},Vr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Hr={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ur=[`labelpos`];function Wr(e){let t=new dt({multigraph:!0,compound:!0}),n=ii(e.graph());return t.setGraph(Object.assign({},Lr,ri(n,Ir),kt(n,Rr))),e.nodes().forEach(n=>{let r=ri(ii(e.node(n)),zr);Object.keys(Br).forEach(e=>{r[e]===void 0&&(r[e]=Br[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=ii(e.edge(n));t.setEdge(n,Object.assign({},Hr,ri(r,Vr),kt(r,Ur)))}),t}function Gr(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Kr(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);ft(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function qr(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Jr(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Yr(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Xr(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ht(r,a)),n.points.push(ht(i,o))})}function Zr(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Qr(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function $r(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function ei(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function ti(e){gt(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{ft(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),Array.isArray(t.label.points)&&t.label.points.length===7||(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function ni(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function ri(e,t){return At(kt(e,t),Number)}function ii(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}var ai=7,oi=16,si=1.5,ci=new Set([`M`,`W`,`m`,`w`,`@`,`%`]);function li(e,t){let n=0;for(let r of e)n+=r.charCodeAt(0)>=128||t===`title`&&ci.has(r)?2:1;return Math.ceil(n*ai*(t===`title`?si:1))}var ui=12,di=e=>Math.round(e*10)/10,fi=e=>Math.round(e*100)/100,pi=(e,t)=>[fi((e[0]+t[0])/2),fi((e[1]+t[1])/2)],mi=([e,t])=>`${e} ${t}`;function hi(e){let t=e.length-1;if(t===1)return`M${mi(e[0])} L${mi(e[1])}`;let n=[`M${mi(e[0])}`,`L${mi(pi(e[0],e[1]))}`];for(let r=1;r<t;r++)n.push(`Q${mi(e[r])} ${mi(pi(e[r],e[r+1]))}`);return n.push(`L${mi(e[t])}`),n.join(` `)}var gi=16;function _i(e,t,n){return Array.from({length:gi},(r,i)=>{let a=(i+1)/gi,o=1-a;return[o*o*e[0]+2*o*a*t[0]+a*a*n[0],o*o*e[1]+2*o*a*t[1]+a*a*n[1]]})}var vi=e=>e.slice(1).map((t,n)=>[e[n],t]);function yi(e,t,n){let r=li(e,`label`);return{text:e,x:di(t[0]-r/2),y:di(t[1]-oi/2),width:r,height:oi,route:n}}function bi(e){let t=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1])),n=t.reduce((e,t)=>e+t,0)/2;for(let[r,i]of t.entries()){if(n<=i&&i>0){let[t,a]=[e[r],e[r+1]];return[di(t[0]+(a[0]-t[0])*n/i),di(t[1]+(a[1]-t[1])*n/i)]}n-=i}return e[e.length-1]}function xi(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t[0]-n,a=t[1]-r;if(i===0&&a===0)return[di(n),di(e.y)];let o=Math.min(i===0?1/0:e.width/2/Math.abs(i),a===0?1/0:e.height/2/Math.abs(a));return[di(n+i*o),di(r+a*o)]}function Si(e,t,n,r){let i=t[0]-e[0],a=t[1]-e[1],o=0,s=1,c=[[-i,e[0]-(n.x-r)],[i,n.x+n.width+r-e[0]],[-a,e[1]-(n.y-r)],[a,n.y+n.height+r-e[1]]];for(let[e,t]of c){if(e===0){if(t<0)return null;continue}let n=t/e;if(e<0?o=Math.max(o,n):s=Math.min(s,n),o>s)return null}return[o,s]}function Ci(e,t,n){let r=Si(e,t,n,-.5);return r!==null&&(r[1]-r[0])*Math.hypot(t[0]-e[0],t[1]-e[1])>.01}var wi=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Ti=e=>[[e.x-ui,e.y-ui],[e.x+e.width+ui,e.y-ui],[e.x-ui,e.y+e.height+ui],[e.x+e.width+ui,e.y+e.height+ui]],Ei=(e,t)=>e[0]>t.x+.5&&e[0]<t.x+t.width-.5&&e[1]>t.y+.5&&e[1]<t.y+t.height-.5;function Di(e,t,n){let r=[e,t,...n.flatMap(Ti).filter(e=>!n.some(t=>Ei(e,t)))],i=r.map(()=>1/0),a=r.map(()=>-1),o=r.map(()=>!1);for(i[0]=0;;){let e=-1;for(let[t,n]of i.entries())!o[t]&&n<1/0&&(e<0||n<i[e])&&(e=t);if(e<0)return null;if(e===1)break;o[e]=!0;for(let[t,s]of r.entries()){let c=i[e]+wi(r[e],s);!o[t]&&c<i[t]&&!n.some(t=>Ci(r[e],s,t))&&(i[t]=c,a[t]=e)}}let s=[];for(let e=1;e>=0;e=a[e])s.unshift(r[e]);return s}function Oi(e,t){return e.flatMap((n,r)=>{let i=e[r+1];return i===void 0||!t.some(e=>Ci(n,i,e))?[n]:(Di(n,i,t)??[n,i]).slice(0,-1)})}function ki(e){let t=[];for(let n of e){let e=t.findIndex(e=>e[0]===n[0]&&e[1]===n[1]);e>=0&&(t.length=e),t.push(n)}return t}function Ai(e,t,n){let r=Math.min(n/Math.max(wi(e,t),.01),.25);return[di(e[0]+(t[0]-e[0])*r),di(e[1]+(t[1]-e[1])*r)]}function ji(e,t){let n=[...e];for(let e=0,r=8;e<6;e++,r/=2){let e=e=>e>0&&e<n.length-1&&vi([pi(n[e-1],n[e]),..._i(pi(n[e-1],n[e]),n[e],pi(n[e],n[e+1]))]).some(([e,n])=>t.some(t=>Ci(e,n,t)));if(!n.some((t,n)=>e(n)))break;n=n.flatMap((t,i)=>e(i)?[Ai(t,n[i-1],r),t,Ai(t,n[i+1],r)]:[t])}return n}function Mi(e,t){return ki(ji(Oi(e,t),t))}function Ni(e){let t=[...e.boxes,...e.labels,...e.routes.flatMap(e=>e.points.map(([e,t])=>({x:e,y:t,width:0,height:0})))];if(t.length===0)return{x:0,y:0,width:0,height:0};let n=Math.min(...t.map(e=>e.x)),r=Math.min(...t.map(e=>e.y));return{x:n,y:r,width:Math.max(...t.map(e=>e.x+e.width))-n,height:Math.max(...t.map(e=>e.y+e.height))-r}}function Pi(e,t,n,r=[]){let i=Ni({boxes:e,routes:t,labels:r});return{width:Math.max(0,i.x+i.width)+n,height:Math.max(0,i.y+i.height)+n}}function Fi(e,t=!0){let n=new Ee.Graph({multigraph:!0});n.setGraph({rankdir:`TB`,nodesep:e.nodesep,ranksep:e.ranksep,marginx:e.margin,marginy:e.margin});for(let t of e.nodes)n.setNode(t.id,{width:t.width,height:t.height});for(let t of e.edges)n.setEdge(t.source,t.target,{weight:t.weight},t.id);Ar(n);let r=e.nodes.map(e=>{let{x:t,y:r}=n.node(e.id);return{id:e.id,parent:null,x:di(t-e.width/2),y:di(r-e.height/2),width:e.width,height:e.height,kind:e.kind}}),i=e.edges.map(({weight:e,...i})=>{let a=n.edge(i.source,i.target,i.id).points.map(({x:e,y:t})=>[di(e),di(t)]),o=r.filter(e=>e.id!==i.source&&e.id!==i.target);return{...i,points:t?Mi(a,o):a}});return{boxes:r,routes:i,labels:[],extent:Pi(r,i,e.margin)}}var Ii=`text{font-family:system-ui,sans-serif;font-size:12px;fill:#1F2328}.box{fill:#F2F4F7;stroke:#D3D9E0}.frame{fill:#FFFFFF;stroke:#D3D9E0}.external{fill:#FFFFFF;stroke:#D3D9E0;stroke-dasharray:6 4}.member{fill:#FFFFFF;stroke:#D3D9E0}.writer{fill:#E4F2EA;stroke:#1F8A5B}.reader{fill:#FFFFFF;stroke:#8C96A3;stroke-dasharray:4 3}.point{fill:#E8EFFB;stroke:#2D5BB8}.title{font-size:13px;font-weight:600}.detail{fill:#5B6573}.route{fill:none;stroke:#5B6573}.route.dashed{stroke-dasharray:6 4}.label-box{fill:#FFFFFF}.label{font-family:ui-monospace,monospace;font-size:11px;fill:#1F2328}`,Li={band:`.band{fill:none;stroke:none}`,selected:`.selected{stroke:#F08A3C;stroke-width:2}`,lifeline:`.lifeline{fill:#8C96A3;stroke:none}`,fragment:`.fragment{stroke-dasharray:5 4}`,terminal:`.terminal{fill:#FFFFFF}`,success:`.fragment.success{fill:#EDF7F0;stroke:#2C6A3D}.terminal.success{stroke:#2C6A3D}`,error:`.fragment.error{fill:#FBEFEF;stroke:#B42318}.terminal.error{stroke:#B42318}`},Ri=e=>e.replace(/[&<>"]/gu,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e]);function zi(e,t){return e.height<32?t.length===0?``:`<text class="title" x="${e.x+8}" y="${e.y+e.height/2+4}">${Ri(t[0])}</text>`:t.map((t,n)=>`<text class="${n===0?`title`:`detail`}" x="${e.x+12}" y="${e.y+20+n*16}">${Ri(t)}</text>`).join(``)}function Bi(e,t){let{width:n,height:r}=e.extent,i=[];for(let[n,r]of e.boxes.entries())i.push(`<clipPath id="clip-${n}"><rect x="${r.x}" y="${r.y}" width="${r.width}" height="${r.height}" rx="10"/></clipPath>`,`<rect class="${r.kind}" x="${r.x}" y="${r.y}" width="${r.width}" height="${r.height}" rx="10"/>`,`<g clip-path="url(#clip-${n})">${zi(r,t(r))}</g>`);for(let t of e.routes){let e=`${t.arrows.start?` marker-start="url(#arrow)"`:``}${t.arrows.end?` marker-end="url(#arrow)"`:``}`;i.push(`<path class="route${t.dashed?` dashed`:``}" stroke-width="${t.width}" d="${hi(t.points)}"${e}/>`)}for(let t of e.labels)i.push(`<rect class="label-box" x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" rx="3"/>`,`<text class="label" x="${t.x+t.width/2}" y="${t.y+12}" text-anchor="middle">${Ri(t.text)}</text>`);let a=new Set(e.boxes.flatMap(e=>e.kind.split(` `))),o=Object.entries(Li).filter(([e])=>a.has(e)).map(([,e])=>e).join(``);return[`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}">`,`<style>${Ii}${o}</style>`,`<defs><marker id="arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0 0L8 4L0 8z" fill="#5B6573"/></marker></defs>`,`<rect width="${n}" height="${r}" fill="#FFFFFF"/>`,...i,`</svg>`].join(`
2
2
  `)}var Vi=12,Hi=12,Ui=24,Wi=64,Gi=24,Ki=`removed`,qi=new Set([`spawns`,`runs-in`,`deployed-on`,`mounts`,`reads`,`writes`,`publishes`,`subscribes`]);function Ji(e,t){let n=Math.ceil(Math.sqrt(e.length)),r=Math.ceil(e.length/n),i=Array.from({length:n},(t,r)=>Math.max(0,...e.filter((e,t)=>t%n===r).map(e=>e.width))),a=Array.from({length:r},(t,r)=>Math.max(0,...e.slice(r*n,(r+1)*n).map(e=>e.height))),o=(e,n)=>e.slice(0,n).reduce((e,n)=>e+n+t,0);return{cells:e.map((e,t)=>({x:o(i,t%n),y:o(a,Math.floor(t/n))})),width:i.reduce((e,t)=>e+t,0)+(n-1)*t,height:a.reduce((e,t)=>e+t,0)+(r-1)*t}}function Yi(e){let t=new Map;for(let n of e.nodes)n.parent!==null&&t.set(n.parent,[...t.get(n.parent)??[],n]);let n=new Map,r=new Map,i=e=>{let a=r.get(e);if(a)return a;let o=t.get(e),s={width:160,height:48};if(o){let e=Ji(o.map(e=>i(e.id)),Hi);o.forEach((t,r)=>n.set(t.id,{x:Vi+e.cells[r].x,y:36+e.cells[r].y})),s={width:Math.max(160,e.width)+24,height:36+e.height+Vi}}return r.set(e,s),s},a=new Map(e.nodes.map(e=>[e.id,e.parent])),o=e=>{let t=e;for(;a.get(t);)t=a.get(t);return t},s=new Map;for(let t of e.relations){let[e,n]=[o(t.source),o(t.target)];if(e===n)continue;let r=`${t.kind}:${e}->${n}`;s.has(r)||s.set(r,{source:e,target:n,kind:t.kind,relations:[]}),s.get(r).relations.push(t.id)}let c=e.nodes.filter(e=>e.parent===null),l=new Set([...s.values()].flatMap(e=>[e.source,e.target])),u=e=>t.has(e)?`frame`:`box`,d=Fi({nodes:c.filter(e=>l.has(e.id)).map(e=>({id:e.id,kind:u(e.id),...i(e.id)})),edges:[...s].map(([e,t])=>({id:e,source:t.source,target:t.target,kind:t.kind,arrows:{start:!1,end:!0},dashed:t.kind===Ki,width:t.kind===`relation`?1.5:2,weight:t.relations.length})),nodesep:Ui,ranksep:Wi,margin:Gi}),f=c.filter(e=>!l.has(e.id)),p=d.boxes.length===0?Gi:Math.max(...d.boxes.map(e=>e.y+e.height))+Wi,m=f.map(e=>i(e.id)),h=Ji(m,Ui).cells.map((e,t)=>({id:f[t].id,parent:null,x:Gi+e.x,y:p+e.y,...m[t],kind:u(f[t].id)})),g=new Map([...d.boxes,...h].map(e=>[e.id,e])),_=[],v=(e,r)=>{let a=n.get(e.id),o=r===null?g.get(e.id):{id:e.id,parent:r.id,x:r.x+a.x,y:r.y+a.y,...i(e.id),kind:u(e.id)};_.push(o);for(let n of t.get(e.id)??[])v(n,o)};for(let e of c)v(e,null);let y=d.routes;return{scene:{boxes:_,routes:y,labels:[],extent:Pi(_,y,Gi)},relations:new Map([...s].map(([e,t])=>[e,t.relations]))}}var W=i();function Xi(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=Xi(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var Zi={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.`},Qi=[[-1/0,-1/0],[1/0,1/0]],$i=[`Enter`,` `,`Escape`],ea={"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`},ta;(function(e){e.Strict=`strict`,e.Loose=`loose`})(ta||={});var na;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(na||={});var ra;(function(e){e.Partial=`partial`,e.Full=`full`})(ra||={});var ia={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},aa;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(aa||={});var oa;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(oa||={});var G;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(G||={});var sa={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top},ca=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,la=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),ua=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),da=(e,t=[0,0])=>{let{width:n,height:r}=Ga(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},fa=(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):ua(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,Ta(e,ka(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Da(r):{x:0,y:0,width:0,height:0}},pa=(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=Ta(n,ka(e)),r=!0)}),r?Da(n):{x:0,y:0,width:0,height:0}},ma=(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=ja(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},ha=(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 ga(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}=Ga(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 _a({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Ha(pa(ga(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 va({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`,Zi.error005());else{let{width:e,height:t}=Ga(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Wa(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=Wa(d)?xa(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Zi.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 ya({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=ha(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 ba=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xa=(e={x:0,y:0},t,n)=>({x:ba(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ba(e.y,t[0][1],t[1][1]-(n?.height??0))});function Sa(e,t,n){let{width:r,height:i}=Ga(n),{x:a,y:o}=n.internals.positionAbsolute;return xa(e,[[a,o],[a+r,o+i]],t)}var Ca=(e,t,n)=>e<t?ba(Math.abs(e-t),1,t)/t:e>n?-ba(Math.abs(e-n),1,t)/t:0,wa=(e,t,n=15,r=40)=>[Ca(e.x,r,t.width-r)*n,Ca(e.y,r,t.height-r)*n],Ta=(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)}),Ea=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Da=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Oa=(e,t=[0,0])=>{let{x:n,y:r}=ua(e)?e.internals.positionAbsolute:da(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}},ka=(e,t=[0,0])=>{let{x:n,y:r}=ua(e)?e.internals.positionAbsolute:da(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)}},Aa=(e,t)=>Da(Ta(Ea(e),Ea(t))),ja=(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)},Ma=(e,t)=>ja(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Na=e=>Pa(e.width)&&Pa(e.height)&&Pa(e.x)&&Pa(e.y),Pa=e=>!isNaN(e)&&isFinite(e),Fa=(e,t)=>(e,t)=>{},Ia=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),La=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?Ia(s,o):s},Ra=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function za(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 Ba(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=za(e,n),i=za(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=za(e.top??e.y??0,n),i=za(e.bottom??e.y??0,n),a=za(e.left??e.x??0,t),o=za(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 Va(e,t,n,r,i,a){let{x:o,y:s}=Ra(e,[t,n,r]),{x:c,y:l}=Ra({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 Ha=(e,t,n,r,i,a)=>{let o=Ba(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=ba(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=Va(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}},Ua=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Wa(e){return e!=null&&e!==`parent`}function Ga(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ka(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qa(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 Ja(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ya(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Xa(e){return{...ea,...e||{}}}function Za(e){return e===null?null:e?`valid`:`invalid`}function Qa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=io(e),s=La({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?Ia(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var $a=e=>({width:e.offsetWidth,height:e.offsetHeight}),eo=e=>e?.getRootNode?.()||window?.document,to=[`INPUT`,`SELECT`,`TEXTAREA`];function no(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?to.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var ro=e=>`clientX`in e,io=(e,t)=>{let n=ro(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)}},ao=(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,...$a(t)}})};function oo({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 so(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function co({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case G.Left:return[t-so(t-r,a),n];case G.Right:return[t+so(r-t,a),n];case G.Top:return[t,n-so(n-i,a)];case G.Bottom:return[t,n+so(i-n,a)]}}function lo({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:i,targetPosition:a=G.Top,curvature:o=.25}){let[s,c]=co({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=co({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=oo({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 uo({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 fo({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 po({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Ta(ka(e),ka(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),Ma({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Da(a))>0}var mo=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,ho=(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)),go=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Zi.error006()),t;let r=n.getEdgeId||mo,i;return i=ca(e)?{...e}:{...e,id:r(e)},ho(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function _o({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=uo({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var vo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},yo=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.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},bo=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),xo=(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 So({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:i,offset:a,stepPosition:o}){let s=vo[t],c=vo[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=yo({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]=uo({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&&xo(e,n,t)&&C.pop(),C.push(t)}return[C,h,g,y,b]}function Co(e,t,n,r){let i=Math.min(bo(e,t)/2,bo(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 wo({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:i,targetPosition:a=G.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=So({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+=Co(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 To(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Eo(e){let{sourceNode:t,targetNode:n}=e;if(!To(t)||!To(n))return null;let r=t.internals.handleBounds||Do(t.handles),i=n.internals.handleBounds||Do(n.handles),a=ko(r?.source??[],e.sourceHandle),o=ko(e.connectionMode===ta.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,Zi.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||G.Bottom,c=o?.position||G.Top,l=Oo(t,a,s),u=Oo(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Do(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 Oo(e,t,n=G.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??Ga(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case G.Top:return{x:i+o/2,y:a};case G.Right:return{x:i+o,y:a+s/2};case G.Bottom:return{x:i+o/2,y:a+s};case G.Left:return{x:i,y:a+s/2}}}function ko(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Ao(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function jo(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=Ao(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 Mo=1e3,No=10,Po={nodeOrigin:[0,0],nodeExtent:Qi,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Fo={...Po,checkEquality:!0};function Io(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Lo(e,t,n){let r=Io(Po,n);for(let n of e.values())if(n.parentId)Ho(n,e,t,r);else{let e=xa(da(n,r.nodeOrigin),Wa(n.extent)?n.extent:r.nodeExtent,Ga(n));n.internals.positionAbsolute=e}}function Ro(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 zo(e){return e===`manual`}function Bo(e,t,n,r={}){let i=Io(Fo,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!zo(i.zIndexMode)?Mo: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=xa(da(u,i.nodeOrigin),Wa(u.extent)?u.extent:i.nodeExtent,Ga(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Ro(u,e),z:Uo(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&&Ho(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Vo(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 Ho(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Io(Po,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}Vo(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*No),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Wo(e,u,o,s,a&&!zo(c)?Mo: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 Uo(e,t,n){let r=Pa(e.zIndex)?e.zIndex:0;return zo(n)?r:r+(e.selected?t:0)}function Wo(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Ga(e),l=da(e,n),u=Wa(e.extent)?xa(l,e.extent,c):l,d=xa({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Sa(d,c,t));let f=Uo(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Go(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=Aa(a.get(n.parentId)?.expandedRect??Oa(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=Ga(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 Ko(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=$a(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=Wa(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=Sa(h,s,n))}else m&&(h=xa(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:ao(`source`,r.nodeElement,p,d,e.id),target:ao(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&Ho(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:Oa(g,i)}))}}if(f.length>0){let e=Go(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function qo({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 Jo(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 Yo(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}`;Jo(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Jo(`target`,s,c,e,i,o),t.set(r.id,r)}}function Xo(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Xo(n,t):!1}function Zo(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 Qo(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||!Xo(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 $o({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 es({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=Ia(a,t);return{x:o.x-a.x,y:o.y-a.y}}function ts({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=E(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?Ea(pa(s)):null,x=v&&l?es({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)}:Ia(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}=va({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]=$o({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=wa(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(C)}function w(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=Qa(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=x,s=Qo(i,c,x,b,v),s.size>0&&(n||h||!b&&g)){let[e,t]=$o({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=ee().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&&w(e),a=Qa(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=io(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Qa(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,C()),!d){let t=io(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=io(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]=$o({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||!Zo(t,`.${g}`,v))&&(!_||Zo(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function ns(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())Ma(i,Oa(e))>0&&r.push(e);return r}var rs=250;function is(e,t,n,r){let i=[],a=1/0,o=ns(e,n,t+rs);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}=Oo(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 as(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,...Oo(o,c,c.position,!0)}:c}function os(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ss(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var cs=()=>!0;function ls(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:_=cs,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=eo(e.target),E=0,D,{x:O,y:k}=io(e),A=os(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=as(i,A,r,c,t);if(!N)return;let P=io(e,j),F=!1,ee=null,I=!1,te=null;function L(){if(!u||!j)return;let[e,t]=wa(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(L)}let R={...N,nodeId:i,type:A,position:N.position},z=c.get(i),B={inProgress:!0,isValid:null,from:Oo(z,R,G.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:z,to:P,toHandle:null,toPosition:sa[R.position],toNode:null,pointer:P};function ne(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ne();function re(e){if(!M){let{x:t,y:n}=io(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ne()}if(!x()||!R){ie(e);return}let a=b();P=io(e,j),D=is(La(P,a,!1,[1,1]),n,c,R),F||=(L(),!0);let s=us(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});te=s.handleDomNode,ee=s.connection,I=ss(!!D,s.isValid);let u=c.get(i),f=u?Oo(u,R,G.Left,!0):B.from,p={...B,from:f,isValid:I,to:s.toHandle&&I?Ra({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:sa[R.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),B=p}function ie(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||te)&&ee&&I&&h?.(ee);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,I=!1,ee=null,te=null,T.removeEventListener(`mousemove`,re),T.removeEventListener(`mouseup`,ie),T.removeEventListener(`touchmove`,re),T.removeEventListener(`touchend`,ie)}}T.addEventListener(`mousemove`,re),T.addEventListener(`mouseup`,ie),T.addEventListener(`touchmove`,re),T.addEventListener(`touchend`,ie)}function us(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=cs,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}=io(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=os(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===ta.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=as(t,e,a,u,n,!0)}return _}var ds={onPointerDown:ls,isValid:us};function fs({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=E(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&&Ua()?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=w().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:g}}var ps=e=>({x:e.x,y:e.y,zoom:e.k}),ms=({x:e,y:t,zoom:n})=>S.translate(e,t).scale(n),hs=(e,t)=>e.target.closest(`.${t}`),gs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),_s=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,vs=(e,t=0,n=_s,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},ys=e=>{let t=e.ctrlKey&&Ua()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function bs({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(hs(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=g(u),t=d*2**ys(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===na.Vertical?0:u.deltaX*f,m=i===na.Horizontal?0:u.deltaY*f;!Ua()&&u.shiftKey&&i!==na.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=ps(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function xs({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=hs(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Ss({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=ps(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 Cs({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&gs(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ps(a.transform))}}function ws({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&gs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=ps(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Ts({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`&&(hs(f,`${u}-flow__node`)||hs(f,`${u}-flow__edge`)||hs(f,`${u}-flow__selection`)||hs(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||hs(f,c)&&h||hs(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 Es({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=w().extent(()=>d).scaleExtent([t,n]).translateExtent(r),m=E(e).call(p);b({x:i.x,y:i.y,zoom:ba(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let h=m.on(`wheel.zoom`),g=m.on(`dblclick.zoom`);p.wheelDelta(ys);async function _(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?k:x).transform(vs(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function v({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:!Pa(E)||E<0?0:E);let k=O?bs({zoomPanValues:l,noWheelClassName:e,d3Selection:m,d3Zoom:p,panOnScrollMode:d,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):xs({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:h});m.on(`wheel.zoom`,k,{passive:!1});let A=Ss({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});p.on(`start`,A);let j=Cs({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});p.on(`zoom`,j);let M=ws({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});p.on(`end`,M);let N=Ts({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(N),b?m.on(`dblclick.zoom`,g):m.on(`dblclick.zoom`,null)}function y(){p.on(`zoom`,null),f?.disconnect()}async function b(e,t,n){let r=ms(e),i=p?.constrain()(r,t,n);return i&&await _(i),i}async function S(e,t){let n=ms(e);return await _(n,t),n}function T(e){if(m){let t=ms(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 D(){let e=m?C(m.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function O(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?k:x).scaleTo(vs(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function A(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?k:x).scaleBy(vs(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function j(e){p?.scaleExtent(e)}function M(e){p?.translateExtent(e)}function N(e){let t=!Pa(e)||e<0?0:e;p?.clickDistance(t)}return{update:v,destroy:y,setViewport:S,setViewportConstrained:b,getViewport:D,scaleTo:O,scaleBy:A,setScaleExtent:j,setTranslateExtent:M,syncViewport:T,setClickDistance:N}}var Ds;(function(e){e.Line=`line`,e.Handle=`handle`})(Ds||={});function Os({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 ks(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 As(e,t){return Math.max(0,t-e)}function js(e,t){return Math.max(0,e-t)}function Ms(e,t,n){return Math.max(0,t-e,e-n)}function Ns(e,t){return e?!t:t}function Ps(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=Ms(E,h,g),j=Ms(D,_,v);if(o){let e=0,t=0;c&&w<0?e=As(y+w+O,o[0][0]):!c&&w>0&&(e=js(y+E+O,o[1][0])),l&&T<0?t=As(b+T+k,o[0][1]):!l&&T>0&&(t=js(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=js(y+w,s[0][0]):!c&&w<0&&(e=As(y+E,s[1][0])),l&&T>0?t=js(b+T,s[0][1]):!l&&T<0&&(t=As(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Ms(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?js(b+k+E/C,o[1][1])*C:As(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?As(b+E/C,s[1][1])*C:js(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Ms(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?js(y+D*C+O,o[1][0])/C:As(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?As(y+D*C,s[1][0])/C:js(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=(Ns(c,l)?-w:w)/C:w=(Ns(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Fs={width:0,height:0,x:0,y:0},Is={...Fs,pointerX:0,pointerY:0,aspectRatio:1};function Ls(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 Rs({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=E(e),o={controlDirection:ks(`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={...Fs},h={...Is};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:ks(e)};let g,_=null,v=[],y,b,x,S=ee().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}=Qa(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=Wa(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=Ls(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=Qa(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}=Ps(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?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 F=Os({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ee={...m,direction:F};p?.(e,ee)===!1?(m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position})):(d?.(e,ee),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 zs=e(t(),1),Bs=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},Vs=e=>e?Bs(e):Bs,{useDebugValue:Hs}=I.default,{useSyncExternalStoreWithSelector:Us}=zs.default,Ws=e=>e;function Gs(e,t=Ws,n){let r=Us(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Hs(r),r}var Ks=(e,t)=>{let n=Vs(e),r=(e,r=t)=>Gs(n,e,r);return Object.assign(r,n),r},qs=(e,t)=>e?Ks(e,t):Ks;function K(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 Js=(0,I.createContext)(null),Ys=Js.Provider,Xs=Zi.error001(`react`);function q(e,t){let n=(0,I.useContext)(Js);if(n===null)throw Error(Xs);return Gs(n,e,t)}function J(){let e=(0,I.useContext)(Js);if(e===null)throw Error(Xs);return(0,I.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Zs={display:`none`},Qs={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},$s=`react-flow__node-desc`,ec=`react-flow__edge-desc`,tc=`react-flow__aria-live`,nc=e=>e.ariaLiveMessage,rc=e=>e.ariaLabelConfig;function ic({rfId:e}){let t=q(nc);return(0,W.jsx)(`div`,{id:`${tc}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Qs,children:t})}function ac({rfId:e,disableKeyboardA11y:t}){let n=q(rc);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{id:`${$s}-${e}`,style:Zs,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,W.jsx)(`div`,{id:`${ec}-${e}`,style:Zs,children:n[`edge.a11yDescription.default`]}),!t&&(0,W.jsx)(ic,{rfId:e})]})}var oc=(0,I.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,W.jsx)(`div`,{className:Xi([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});oc.displayName=`Panel`;var sc=`https://reactflow.dev?utm_source=attribution`;function cc({proOptions:e,position:t=`bottom-right`}){return(0,I.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,W.jsx)(oc,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${sc}`,children:(0,W.jsx)(`a`,{href:sc,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var lc=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}},uc=e=>e.id;function dc(e,t){return K(e.selectedNodes.map(uc),t.selectedNodes.map(uc))&&K(e.selectedEdges.map(uc),t.selectedEdges.map(uc))}function fc({onSelectionChange:e}){let t=J(),{selectedNodes:n,selectedEdges:r}=q(lc,dc);return(0,I.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var pc=e=>!!e.onSelectionChangeHandlers;function mc({onSelectionChange:e}){let t=q(pc);return e||t?(0,W.jsx)(fc,{onSelectionChange:e}):null}var hc=[0,0],gc={x:0,y:0,zoom:1},_c=[...`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`],vc=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}),yc={translateExtent:Qi,nodeOrigin:hc,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function bc(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=q(vc,K),l=J();(0,I.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=yc,s()}),[]);let u=(0,I.useRef)(yc);return(0,I.useEffect)(()=>{for(let s of _c){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:Xa(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},_c.map(t=>e[t])),null}function xc(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Sc(e){let[t,n]=(0,I.useState)(e===`system`?null:e);return(0,I.useEffect)(()=>{if(e!==`system`){n(e);return}let t=xc(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?xc()?.matches?`dark`:`light`:t}var Cc=typeof document<`u`?document:null;function wc(e=null,t={target:Cc,actInsideInputWithModifier:!0}){let[n,r]=(0,I.useState)(!1),i=(0,I.useRef)(!1),a=(0,I.useRef)(new Set([])),[o,s]=(0,I.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
3
3
  `).replace(`
4
4