zigbee2mqtt-windfront 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/assets/{About-CcMd3AH7.js → About-NjZYVGGK.js} +1 -1
- package/dist/assets/About-NjZYVGGK.js.br +0 -0
- package/dist/assets/{Availability-C9haSc65.js → Availability-CRIDrhlB.js} +1 -1
- package/dist/assets/Availability-CRIDrhlB.js.br +5 -0
- package/dist/assets/{Bind-QWht9PxX.js → Bind-2EyqGKNk.js} +1 -1
- package/dist/assets/Bind-2EyqGKNk.js.br +0 -0
- package/dist/assets/{Bridge-BaVOrgia.js → Bridge-BxUlX1vE.js} +1 -1
- package/dist/assets/Bridge-BxUlX1vE.js.br +1 -0
- package/dist/assets/{CheckboxField-DLaKVdsu.js → CheckboxField-CanRey3x.js} +1 -1
- package/dist/assets/CheckboxField-CanRey3x.js.br +0 -0
- package/dist/assets/{ClusterSinglePicker-1p4AJLVf.js → ClusterSinglePicker-CpOqo3Ro.js} +1 -1
- package/dist/assets/ClusterSinglePicker-CpOqo3Ro.js.br +0 -0
- package/dist/assets/{Clusters-DLf-orBd.js → Clusters-CWxqlz_3.js} +1 -1
- package/dist/assets/Clusters-CWxqlz_3.js.br +0 -0
- package/dist/assets/{Dashboard-Z5xr3mcm.js → Dashboard-CZJkSLjr.js} +1 -1
- package/dist/assets/Dashboard-CZJkSLjr.js.br +0 -0
- package/dist/assets/{DashboardFeatureWrapper-PnES88Uy.js → DashboardFeatureWrapper-BPi5Syin.js} +1 -1
- package/dist/assets/DashboardFeatureWrapper-BPi5Syin.js.br +4 -0
- package/dist/assets/{DebouncedInput-Bmii6Ayp.js → DebouncedInput-suZwHdPO.js} +1 -1
- package/dist/assets/DebouncedInput-suZwHdPO.js.br +0 -0
- package/dist/assets/{DevConsole-7cju1CjR.js → DevConsole-BpLyFXQ6.js} +1 -1
- package/dist/assets/DevConsole-BpLyFXQ6.js.br +0 -0
- package/dist/assets/{DevConsole-Et6-aog1.js → DevConsole-HKbEkq5G.js} +1 -1
- package/dist/assets/DevConsole-HKbEkq5G.js.br +0 -0
- package/dist/assets/{DeviceCard-BwUN52M9.js → DeviceCard-C1UuNxRA.js} +1 -1
- package/dist/assets/DeviceCard-C1UuNxRA.js.br +0 -0
- package/dist/assets/{DeviceControlEditName-BzsMO3W6.js → DeviceControlEditName-DJowO9Oo.js} +1 -1
- package/dist/assets/DeviceControlEditName-DJowO9Oo.js.br +0 -0
- package/dist/assets/{DeviceImage-Dg1Ihl-B.js → DeviceImage-B6F8WQJo.js} +1 -1
- package/dist/assets/DeviceImage-B6F8WQJo.js.br +0 -0
- package/dist/assets/{DeviceInfo-AEJMMaXQ.js → DeviceInfo-YHgZjzBI.js} +1 -1
- package/dist/assets/DeviceInfo-YHgZjzBI.js.br +0 -0
- package/dist/assets/{DevicePage-CWSeFraV.js → DevicePage-uH6dGCsg.js} +2 -2
- package/dist/assets/DevicePage-uH6dGCsg.js.br +0 -0
- package/dist/assets/{DevicePicker-f_R57kdd.js → DevicePicker-DxCWDQnp.js} +1 -1
- package/dist/assets/DevicePicker-DxCWDQnp.js.br +0 -0
- package/dist/assets/{DeviceSettings-BRONiaNg.js → DeviceSettings-L5BnZTC6.js} +1 -1
- package/dist/assets/DeviceSettings-L5BnZTC6.js.br +0 -0
- package/dist/assets/{DeviceSpecificSettings-x-J4ToEN.js → DeviceSpecificSettings-BqkOD4QF.js} +1 -1
- package/dist/assets/DeviceSpecificSettings-BqkOD4QF.js.br +0 -0
- package/dist/assets/{Devices-CfRY6Ewt.js → Devices-97iPX55p.js} +1 -1
- package/dist/assets/Devices-97iPX55p.js.br +0 -0
- package/dist/assets/{DevicesPage-CL0xUJMK.js → DevicesPage-zt3K4Z20.js} +1 -1
- package/dist/assets/DevicesPage-zt3K4Z20.js.br +0 -0
- package/dist/assets/{DisplayValue-CBeHL9Ll.js → DisplayValue-CZpYmpLD.js} +1 -1
- package/dist/assets/DisplayValue-CZpYmpLD.js.br +0 -0
- package/dist/assets/Donate-aQHexwC0.js +1 -0
- package/dist/assets/Donate-aQHexwC0.js.br +0 -0
- package/dist/assets/{EndpointPicker-LFKxrEh9.js → EndpointPicker-VM2TEDAs.js} +1 -1
- package/dist/assets/EndpointPicker-VM2TEDAs.js.br +0 -0
- package/dist/assets/{Exposes-7GlsLrJX.js → Exposes-DusK4Z7N.js} +1 -1
- package/dist/assets/Exposes-DusK4Z7N.js.br +0 -0
- package/dist/assets/{Feature-D2uPEkUX.js → Feature-b5LHKHrY.js} +1 -1
- package/dist/assets/Feature-b5LHKHrY.js.br +0 -0
- package/dist/assets/{Frontend-DCcab0zi.js → Frontend-BQRD1FRb.js} +1 -1
- package/dist/assets/Frontend-BQRD1FRb.js.br +0 -0
- package/dist/assets/{GroupPage-BAAKgEDB.js → GroupPage-NYbFvZk4.js} +2 -2
- package/dist/assets/GroupPage-NYbFvZk4.js.br +0 -0
- package/dist/assets/{GroupSettings-Bm6lZ--r.js → GroupSettings-lZ4wrUYC.js} +1 -1
- package/dist/assets/GroupSettings-lZ4wrUYC.js.br +0 -0
- package/dist/assets/{Groups-BcnfSKsF.js → Groups-C2IY6j-8.js} +1 -1
- package/dist/assets/Groups-C2IY6j-8.js.br +0 -0
- package/dist/assets/{GroupsPage-CEWJy_a-.js → GroupsPage-Cl3obGrH.js} +1 -1
- package/dist/assets/GroupsPage-Cl3obGrH.js.br +0 -0
- package/dist/assets/{HomePage-DI-dB684.js → HomePage-Dt0sVTff.js} +1 -1
- package/dist/assets/HomePage-Dt0sVTff.js.br +0 -0
- package/dist/assets/{InputField-CiDxftEt.js → InputField-C_t5k0Dv.js} +1 -1
- package/dist/assets/InputField-C_t5k0Dv.js.br +0 -0
- package/dist/assets/{LastSeen-DQP5qZTT.js → LastSeen-CeDLL1-q.js} +1 -1
- package/dist/assets/LastSeen-CeDLL1-q.js.br +0 -0
- package/dist/assets/{LogsPage-C9_WtqUF.js → LogsPage-DV6f_rSq.js} +1 -1
- package/dist/assets/LogsPage-DV6f_rSq.js.br +0 -0
- package/dist/assets/{Lqi-DcPc55r4.js → Lqi-DBfyroIH.js} +1 -1
- package/dist/assets/Lqi-DBfyroIH.js.br +0 -0
- package/dist/assets/{NetworkPage-CaPQkFGO.js → NetworkPage-BU4JgKZc.js} +2 -2
- package/dist/assets/NetworkPage-BU4JgKZc.js.br +0 -0
- package/dist/assets/{OtaPage-DLGAq1H9.js → OtaPage-BZgdsTpp.js} +1 -1
- package/dist/assets/OtaPage-BZgdsTpp.js.br +0 -0
- package/dist/assets/{PowerSource-Do_AMydO.js → PowerSource-BF7Gul0J.js} +1 -1
- package/dist/assets/PowerSource-BF7Gul0J.js.br +0 -0
- package/dist/assets/{RawNetworkData-Dod9XYkB.js → RawNetworkData-DWbMOxjo.js} +1 -1
- package/dist/assets/RawNetworkData-DWbMOxjo.js.br +0 -0
- package/dist/assets/{RawNetworkMap-DQYtASpr.js → RawNetworkMap-C7ipJu2k.js} +1 -1
- package/dist/assets/RawNetworkMap-C7ipJu2k.js.br +0 -0
- package/dist/assets/{RecallRemove-BpIiOBsV.js → RecallRemove-Bt_mgpm8.js} +1 -1
- package/dist/assets/RecallRemove-Bt_mgpm8.js.br +0 -0
- package/dist/assets/{Reporting-C7ICrJmW.js → Reporting-Bjl0j1aN.js} +1 -1
- package/dist/assets/Reporting-Bjl0j1aN.js.br +0 -0
- package/dist/assets/Scene-DEvlYeva.js +1 -0
- package/dist/assets/Scene-DEvlYeva.js.br +0 -0
- package/dist/assets/{SelectField-DsW6CGZB.js → SelectField-pi0T7PIM.js} +1 -1
- package/dist/assets/SelectField-pi0T7PIM.js.br +1 -0
- package/dist/assets/{Settings-j-Qu32ok.js → Settings-hpQnUDbw.js} +1 -1
- package/dist/assets/Settings-hpQnUDbw.js.br +0 -0
- package/dist/assets/{SettingsList-kg9AVkQO.js → SettingsList-CoMEU_Fj.js} +1 -1
- package/dist/assets/SettingsList-CoMEU_Fj.js.br +0 -0
- package/dist/assets/{SettingsPage-ClmgBRGO.js → SettingsPage-DlrIVuyx.js} +2 -2
- package/dist/assets/SettingsPage-DlrIVuyx.js.br +0 -0
- package/dist/assets/{State-DwO5NWpi.js → State-DTwjupCm.js} +1 -1
- package/dist/assets/State-DTwjupCm.js.br +0 -0
- package/dist/assets/{Table-BzzHPQHt.js → Table-CNH7RvaJ.js} +1 -1
- package/dist/assets/Table-CNH7RvaJ.js.br +0 -0
- package/dist/assets/{TextareaField-bR1CLeha.js → TextareaField-B18rY5b7.js} +1 -1
- package/dist/assets/TextareaField-B18rY5b7.js.br +0 -0
- package/dist/assets/{Tools-BavvKF4S.js → Tools-_0AcB_CD.js} +1 -1
- package/dist/assets/Tools-_0AcB_CD.js.br +0 -0
- package/dist/assets/{TouchlinkPage-B7tLnS3m.js → TouchlinkPage-BkkAokwt.js} +1 -1
- package/dist/assets/TouchlinkPage-BkkAokwt.js.br +0 -0
- package/dist/assets/{VendorLink-C4yRCmCp.js → VendorLink-Bn8AGeqD.js} +1 -1
- package/dist/assets/VendorLink-Bn8AGeqD.js.br +0 -0
- package/dist/assets/{_createCompounder-B35o_eDD.js → _createCompounder-CG6wppeM.js} +1 -1
- package/dist/assets/_createCompounder-CG6wppeM.js.br +0 -0
- package/dist/assets/{capitalize-25MKEfyu.js → capitalize-fmjr8MXW.js} +1 -1
- package/dist/assets/capitalize-fmjr8MXW.js.br +0 -0
- package/dist/assets/{index-CflX8yCT.js → index-B5pN5VmG.js} +1 -1
- package/dist/assets/index-B5pN5VmG.js.br +0 -0
- package/dist/assets/index-BB8zE-tT.css +1 -0
- package/dist/assets/index-BB8zE-tT.css.br +0 -0
- package/dist/assets/{index-BXfBkE5R.js → index-CwJt2ZPU.js} +22 -22
- package/dist/assets/index-CwJt2ZPU.js.br +0 -0
- package/dist/assets/{jszip.min-C-j6N8_H.js → jszip.min-WnSa1ljR.js} +1 -1
- package/dist/assets/jszip.min-WnSa1ljR.js.br +0 -0
- package/dist/assets/snakeCase-E1FSY3OI.js +1 -0
- package/dist/assets/snakeCase-E1FSY3OI.js.br +0 -0
- package/dist/index.html +2 -2
- package/dist/index.html.br +0 -0
- package/package.json +4 -4
- package/dist/assets/About-CcMd3AH7.js.br +0 -0
- package/dist/assets/Availability-C9haSc65.js.br +0 -0
- package/dist/assets/Bind-QWht9PxX.js.br +0 -0
- package/dist/assets/Bridge-BaVOrgia.js.br +0 -0
- package/dist/assets/CheckboxField-DLaKVdsu.js.br +0 -1
- package/dist/assets/ClusterSinglePicker-1p4AJLVf.js.br +0 -0
- package/dist/assets/Clusters-DLf-orBd.js.br +0 -0
- package/dist/assets/Dashboard-Z5xr3mcm.js.br +0 -0
- package/dist/assets/DashboardFeatureWrapper-PnES88Uy.js.br +0 -0
- package/dist/assets/DebouncedInput-Bmii6Ayp.js.br +0 -0
- package/dist/assets/DevConsole-7cju1CjR.js.br +0 -0
- package/dist/assets/DevConsole-Et6-aog1.js.br +0 -0
- package/dist/assets/DeviceCard-BwUN52M9.js.br +0 -0
- package/dist/assets/DeviceControlEditName-BzsMO3W6.js.br +0 -0
- package/dist/assets/DeviceImage-Dg1Ihl-B.js.br +0 -0
- package/dist/assets/DeviceInfo-AEJMMaXQ.js.br +0 -0
- package/dist/assets/DevicePage-CWSeFraV.js.br +0 -0
- package/dist/assets/DevicePicker-f_R57kdd.js.br +0 -0
- package/dist/assets/DeviceSettings-BRONiaNg.js.br +0 -0
- package/dist/assets/DeviceSpecificSettings-x-J4ToEN.js.br +0 -0
- package/dist/assets/Devices-CfRY6Ewt.js.br +0 -0
- package/dist/assets/DevicesPage-CL0xUJMK.js.br +0 -0
- package/dist/assets/DisplayValue-CBeHL9Ll.js.br +0 -4
- package/dist/assets/Donate-DdYHmeAG.js +0 -1
- package/dist/assets/Donate-DdYHmeAG.js.br +0 -0
- package/dist/assets/EndpointPicker-LFKxrEh9.js.br +0 -0
- package/dist/assets/Exposes-7GlsLrJX.js.br +0 -0
- package/dist/assets/Feature-D2uPEkUX.js.br +0 -0
- package/dist/assets/Frontend-DCcab0zi.js.br +0 -0
- package/dist/assets/GroupPage-BAAKgEDB.js.br +0 -0
- package/dist/assets/GroupSettings-Bm6lZ--r.js.br +0 -0
- package/dist/assets/Groups-BcnfSKsF.js.br +0 -0
- package/dist/assets/GroupsPage-CEWJy_a-.js.br +0 -0
- package/dist/assets/HomePage-DI-dB684.js.br +0 -0
- package/dist/assets/InputField-CiDxftEt.js.br +0 -0
- package/dist/assets/LastSeen-DQP5qZTT.js.br +0 -0
- package/dist/assets/LogsPage-C9_WtqUF.js.br +0 -0
- package/dist/assets/Lqi-DcPc55r4.js.br +0 -0
- package/dist/assets/NetworkPage-CaPQkFGO.js.br +0 -0
- package/dist/assets/OtaPage-DLGAq1H9.js.br +0 -0
- package/dist/assets/PowerSource-Do_AMydO.js.br +0 -0
- package/dist/assets/RawNetworkData-Dod9XYkB.js.br +0 -0
- package/dist/assets/RawNetworkMap-DQYtASpr.js.br +0 -0
- package/dist/assets/RecallRemove-BpIiOBsV.js.br +0 -0
- package/dist/assets/Reporting-C7ICrJmW.js.br +0 -0
- package/dist/assets/Scene-ConFr5Sy.js +0 -1
- package/dist/assets/Scene-ConFr5Sy.js.br +0 -0
- package/dist/assets/SelectField-DsW6CGZB.js.br +0 -1
- package/dist/assets/Settings-j-Qu32ok.js.br +0 -0
- package/dist/assets/SettingsList-kg9AVkQO.js.br +0 -0
- package/dist/assets/SettingsPage-ClmgBRGO.js.br +0 -0
- package/dist/assets/State-DwO5NWpi.js.br +0 -0
- package/dist/assets/Table-BzzHPQHt.js.br +0 -0
- package/dist/assets/TextareaField-bR1CLeha.js.br +0 -0
- package/dist/assets/Tools-BavvKF4S.js.br +0 -0
- package/dist/assets/TouchlinkPage-B7tLnS3m.js.br +0 -0
- package/dist/assets/VendorLink-C4yRCmCp.js.br +0 -0
- package/dist/assets/_createCompounder-B35o_eDD.js.br +0 -0
- package/dist/assets/capitalize-25MKEfyu.js.br +0 -0
- package/dist/assets/index-BXfBkE5R.js.br +0 -0
- package/dist/assets/index-CflX8yCT.js.br +0 -0
- package/dist/assets/index-DzbKo1OE.css +0 -1
- package/dist/assets/index-DzbKo1OE.css.br +0 -0
- package/dist/assets/jszip.min-C-j6N8_H.js.br +0 -0
- package/dist/assets/snakeCase-CK3F3A-s.js +0 -1
- package/dist/assets/snakeCase-CK3F3A-s.js.br +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Dl=Object.defineProperty;var zl=(e,t,n)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>zl(e,typeof t!="symbol"?t+"":t,n);import{ac as Os,ar as Ds,as as Fl,at as Hl,r as z,j as E,b as sn,F as he,au as Vl,av as Bl,aw as ql,ax as Yl,ay as Gl,az as Wl,aA as Xl,aB as Ul,aC as Kl,aD as Zl,L as Qr,t as Jr,V as ei}from"./index-BXfBkE5R.js";import{a as Cn}from"./index-C2eewgcx.js";import{D as zs}from"./DeviceImage-Dg1Ihl-B.js";import"./index-CflX8yCT.js";var Mn,Ci;function ti(){if(Ci)return Mn;Ci=1;var e="\0",t="\0",n="";class r{constructor(l){oe(this,"_isDirected",!0);oe(this,"_isMultigraph",!1);oe(this,"_isCompound",!1);oe(this,"_label");oe(this,"_defaultNodeLabelFn",()=>{});oe(this,"_defaultEdgeLabelFn",()=>{});oe(this,"_nodes",{});oe(this,"_in",{});oe(this,"_preds",{});oe(this,"_out",{});oe(this,"_sucs",{});oe(this,"_edgeObjs",{});oe(this,"_edgeLabels",{});oe(this,"_nodeCount",0);oe(this,"_edgeCount",0);oe(this,"_parent");oe(this,"_children");l&&(this._isDirected=Object.hasOwn(l,"directed")?l.directed:!0,this._isMultigraph=Object.hasOwn(l,"multigraph")?l.multigraph:!1,this._isCompound=Object.hasOwn(l,"compound")?l.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(l){return this._label=l,this}graph(){return this._label}setDefaultNodeLabel(l){return this._defaultNodeLabelFn=l,typeof l!="function"&&(this._defaultNodeLabelFn=()=>l),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var l=this;return this.nodes().filter(u=>Object.keys(l._in[u]).length===0)}sinks(){var l=this;return this.nodes().filter(u=>Object.keys(l._out[u]).length===0)}setNodes(l,u){var f=arguments,h=this;return l.forEach(function(p){f.length>1?h.setNode(p,u):h.setNode(p)}),this}setNode(l,u){return Object.hasOwn(this._nodes,l)?(arguments.length>1&&(this._nodes[l]=u),this):(this._nodes[l]=arguments.length>1?u:this._defaultNodeLabelFn(l),this._isCompound&&(this._parent[l]=t,this._children[l]={},this._children[t][l]=!0),this._in[l]={},this._preds[l]={},this._out[l]={},this._sucs[l]={},++this._nodeCount,this)}node(l){return this._nodes[l]}hasNode(l){return Object.hasOwn(this._nodes,l)}removeNode(l){var u=this;if(Object.hasOwn(this._nodes,l)){var f=h=>u.removeEdge(u._edgeObjs[h]);delete this._nodes[l],this._isCompound&&(this._removeFromParentsChildList(l),delete this._parent[l],this.children(l).forEach(function(h){u.setParent(h)}),delete this._children[l]),Object.keys(this._in[l]).forEach(f),delete this._in[l],delete this._preds[l],Object.keys(this._out[l]).forEach(f),delete this._out[l],delete this._sucs[l],--this._nodeCount}return this}setParent(l,u){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(u===void 0)u=t;else{u+="";for(var f=u;f!==void 0;f=this.parent(f))if(f===l)throw new Error("Setting "+u+" as parent of "+l+" would create a cycle");this.setNode(u)}return this.setNode(l),this._removeFromParentsChildList(l),this._parent[l]=u,this._children[u][l]=!0,this}_removeFromParentsChildList(l){delete this._children[this._parent[l]][l]}parent(l){if(this._isCompound){var u=this._parent[l];if(u!==t)return u}}children(l=t){if(this._isCompound){var u=this._children[l];if(u)return Object.keys(u)}else{if(l===t)return this.nodes();if(this.hasNode(l))return[]}}predecessors(l){var u=this._preds[l];if(u)return Object.keys(u)}successors(l){var u=this._sucs[l];if(u)return Object.keys(u)}neighbors(l){var u=this.predecessors(l);if(u){const h=new Set(u);for(var f of this.successors(l))h.add(f);return Array.from(h.values())}}isLeaf(l){var u;return this.isDirected()?u=this.successors(l):u=this.neighbors(l),u.length===0}filterNodes(l){var u=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});u.setGraph(this.graph());var f=this;Object.entries(this._nodes).forEach(function([y,m]){l(y)&&u.setNode(y,m)}),Object.values(this._edgeObjs).forEach(function(y){u.hasNode(y.v)&&u.hasNode(y.w)&&u.setEdge(y,f.edge(y))});var h={};function p(y){var m=f.parent(y);return m===void 0||u.hasNode(m)?(h[y]=m,m):m in h?h[m]:p(m)}return this._isCompound&&u.nodes().forEach(y=>u.setParent(y,p(y))),u}setDefaultEdgeLabel(l){return this._defaultEdgeLabelFn=l,typeof l!="function"&&(this._defaultEdgeLabelFn=()=>l),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(l,u){var f=this,h=arguments;return l.reduce(function(p,y){return h.length>1?f.setEdge(p,y,u):f.setEdge(p,y),y}),this}setEdge(){var l,u,f,h,p=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(l=y.v,u=y.w,f=y.name,arguments.length===2&&(h=arguments[1],p=!0)):(l=y,u=arguments[1],f=arguments[3],arguments.length>2&&(h=arguments[2],p=!0)),l=""+l,u=""+u,f!==void 0&&(f=""+f);var m=s(this._isDirected,l,u,f);if(Object.hasOwn(this._edgeLabels,m))return p&&(this._edgeLabels[m]=h),this;if(f!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(u),this._edgeLabels[m]=p?h:this._defaultEdgeLabelFn(l,u,f);var w=a(this._isDirected,l,u,f);return l=w.v,u=w.w,Object.freeze(w),this._edgeObjs[m]=w,i(this._preds[u],l),i(this._sucs[l],u),this._in[u][m]=w,this._out[l][m]=w,this._edgeCount++,this}edge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f);return this._edgeLabels[h]}edgeAsObj(){const l=this.edge(...arguments);return typeof l!="object"?{label:l}:l}hasEdge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f);return Object.hasOwn(this._edgeLabels,h)}removeEdge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f),p=this._edgeObjs[h];return p&&(l=p.v,u=p.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[u],l),o(this._sucs[l],u),delete this._in[u][h],delete this._out[l][h],this._edgeCount--),this}inEdges(l,u){var f=this._in[l];if(f){var h=Object.values(f);return u?h.filter(p=>p.v===u):h}}outEdges(l,u){var f=this._out[l];if(f){var h=Object.values(f);return u?h.filter(p=>p.w===u):h}}nodeEdges(l,u){var f=this.inEdges(l,u);if(f)return f.concat(this.outEdges(l,u))}}function i(d,l){d[l]?d[l]++:d[l]=1}function o(d,l){--d[l]||delete d[l]}function s(d,l,u,f){var h=""+l,p=""+u;if(!d&&h>p){var y=h;h=p,p=y}return h+n+p+n+(f===void 0?e:f)}function a(d,l,u,f){var h=""+l,p=""+u;if(!d&&h>p){var y=h;h=p,p=y}var m={v:h,w:p};return f&&(m.name=f),m}function c(d,l){return s(d,l.v,l.w,l.name)}return Mn=r,Mn}var In,Mi;function Ql(){return Mi||(Mi=1,In="2.2.4"),In}var An,Ii;function Jl(){return Ii||(Ii=1,An={Graph:ti(),version:Ql()}),An}var $n,Ai;function eu(){if(Ai)return $n;Ai=1;var e=ti();$n={write:t,read:i};function t(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:r(o)};return o.graph()!==void 0&&(s.value=structuredClone(o.graph())),s}function n(o){return o.nodes().map(function(s){var a=o.node(s),c=o.parent(s),d={v:s};return a!==void 0&&(d.value=a),c!==void 0&&(d.parent=c),d})}function r(o){return o.edges().map(function(s){var a=o.edge(s),c={v:s.v,w:s.w};return s.name!==void 0&&(c.name=s.name),a!==void 0&&(c.value=a),c})}function i(o){var s=new e(o.options).setGraph(o.value);return o.nodes.forEach(function(a){s.setNode(a.v,a.value),a.parent&&s.setParent(a.v,a.parent)}),o.edges.forEach(function(a){s.setEdge({v:a.v,w:a.w,name:a.name},a.value)}),s}return $n}var Rn,$i;function tu(){if($i)return Rn;$i=1,Rn=e;function e(t){var n={},r=[],i;function o(s){Object.hasOwn(n,s)||(n[s]=!0,i.push(s),t.successors(s).forEach(o),t.predecessors(s).forEach(o))}return t.nodes().forEach(function(s){i=[],o(s),i.length&&r.push(i)}),r}return Rn}var Tn,Ri;function Fs(){if(Ri)return Tn;Ri=1;class e{constructor(){oe(this,"_arr",[]);oe(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,r){var i=this._keyIndices;if(n=String(n),!Object.hasOwn(i,n)){var o=this._arr,s=o.length;return i[n]=s,o.push({key:n,priority:r}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,r){var i=this._keyIndices[n];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)}_heapify(n){var r=this._arr,i=2*n,o=i+1,s=n;i<r.length&&(s=r[i].priority<r[s].priority?i:s,o<r.length&&(s=r[o].priority<r[s].priority?o:s),s!==n&&(this._swap(n,s),this._heapify(s)))}_decrease(n){for(var r=this._arr,i=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<i));)this._swap(n,o),n=o}_swap(n,r){var i=this._arr,o=this._keyIndices,s=i[n],a=i[r];i[n]=a,i[r]=s,o[a.key]=n,o[s.key]=r}}return Tn=e,Tn}var jn,Ti;function Hs(){if(Ti)return jn;Ti=1;var e=Fs();jn=n;var t=()=>1;function n(i,o,s,a){return r(i,String(o),s||t,a||function(c){return i.outEdges(c)})}function r(i,o,s,a){var c={},d=new e,l,u,f=function(h){var p=h.v!==l?h.v:h.w,y=c[p],m=s(h),w=u.distance+m;if(m<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+m);w<y.distance&&(y.distance=w,y.predecessor=l,d.decrease(p,w))};for(i.nodes().forEach(function(h){var p=h===o?0:Number.POSITIVE_INFINITY;c[h]={distance:p},d.add(h,p)});d.size()>0&&(l=d.removeMin(),u=c[l],u.distance!==Number.POSITIVE_INFINITY);)a(l).forEach(f);return c}return jn}var Pn,ji;function nu(){if(ji)return Pn;ji=1;var e=Hs();Pn=t;function t(n,r,i){return n.nodes().reduce(function(o,s){return o[s]=e(n,s,r,i),o},{})}return Pn}var Ln,Pi;function Vs(){if(Pi)return Ln;Pi=1,Ln=e;function e(t){var n=0,r=[],i={},o=[];function s(a){var c=i[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),t.successors(a).forEach(function(u){Object.hasOwn(i,u)?i[u].onStack&&(c.lowlink=Math.min(c.lowlink,i[u].index)):(s(u),c.lowlink=Math.min(c.lowlink,i[u].lowlink))}),c.lowlink===c.index){var d=[],l;do l=r.pop(),i[l].onStack=!1,d.push(l);while(a!==l);o.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(i,a)||s(a)}),o}return Ln}var On,Li;function ru(){if(Li)return On;Li=1;var e=Vs();On=t;function t(n){return e(n).filter(function(r){return r.length>1||r.length===1&&n.hasEdge(r[0],r[0])})}return On}var Dn,Oi;function iu(){if(Oi)return Dn;Oi=1,Dn=t;var e=()=>1;function t(r,i,o){return n(r,i||e,o||function(s){return r.outEdges(s)})}function n(r,i,o){var s={},a=r.nodes();return a.forEach(function(c){s[c]={},s[c][c]={distance:0},a.forEach(function(d){c!==d&&(s[c][d]={distance:Number.POSITIVE_INFINITY})}),o(c).forEach(function(d){var l=d.v===c?d.w:d.v,u=i(d);s[c][l]={distance:u,predecessor:c}})}),a.forEach(function(c){var d=s[c];a.forEach(function(l){var u=s[l];a.forEach(function(f){var h=u[c],p=d[f],y=u[f],m=h.distance+p.distance;m<y.distance&&(y.distance=m,y.predecessor=p.predecessor)})})}),s}return Dn}var zn,Di;function Bs(){if(Di)return zn;Di=1;function e(n){var r={},i={},o=[];function s(a){if(Object.hasOwn(i,a))throw new t;Object.hasOwn(r,a)||(i[a]=!0,r[a]=!0,n.predecessors(a).forEach(s),delete i[a],o.push(a))}if(n.sinks().forEach(s),Object.keys(r).length!==n.nodeCount())throw new t;return o}class t extends Error{constructor(){super(...arguments)}}return zn=e,e.CycleException=t,zn}var Fn,zi;function ou(){if(zi)return Fn;zi=1;var e=Bs();Fn=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Fn}var Hn,Fi;function qs(){if(Fi)return Hn;Fi=1,Hn=e;function e(i,o,s){Array.isArray(o)||(o=[o]);var a=i.isDirected()?u=>i.successors(u):u=>i.neighbors(u),c=s==="post"?t:n,d=[],l={};return o.forEach(u=>{if(!i.hasNode(u))throw new Error("Graph does not have node: "+u);c(u,a,l,d)}),d}function t(i,o,s,a){for(var c=[[i,!1]];c.length>0;){var d=c.pop();d[1]?a.push(d[0]):Object.hasOwn(s,d[0])||(s[d[0]]=!0,c.push([d[0],!0]),r(o(d[0]),l=>c.push([l,!1])))}}function n(i,o,s,a){for(var c=[i];c.length>0;){var d=c.pop();Object.hasOwn(s,d)||(s[d]=!0,a.push(d),r(o(d),l=>c.push(l)))}}function r(i,o){for(var s=i.length;s--;)o(i[s],s,i);return i}return Hn}var Vn,Hi;function su(){if(Hi)return Vn;Hi=1;var e=qs();Vn=t;function t(n,r){return e(n,r,"post")}return Vn}var Bn,Vi;function au(){if(Vi)return Bn;Vi=1;var e=qs();Bn=t;function t(n,r){return e(n,r,"pre")}return Bn}var qn,Bi;function cu(){if(Bi)return qn;Bi=1;var e=ti(),t=Fs();qn=n;function n(r,i){var o=new e,s={},a=new t,c;function d(u){var f=u.v===c?u.w:u.v,h=a.priority(f);if(h!==void 0){var p=i(u);p<h&&(s[f]=c,a.decrease(f,p))}}if(r.nodeCount()===0)return o;r.nodes().forEach(function(u){a.add(u,Number.POSITIVE_INFINITY),o.setNode(u)}),a.decrease(r.nodes()[0],0);for(var l=!1;a.size()>0;){if(c=a.removeMin(),Object.hasOwn(s,c))o.setEdge(c,s[c]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(c).forEach(d)}return o}return qn}var Yn,qi;function lu(){return qi||(qi=1,Yn={components:tu(),dijkstra:Hs(),dijkstraAll:nu(),findCycles:ru(),floydWarshall:iu(),isAcyclic:ou(),postorder:su(),preorder:au(),prim:cu(),tarjan:Vs(),topsort:Bs()}),Yn}var Gn,Yi;function xe(){if(Yi)return Gn;Yi=1;var e=Jl();return Gn={Graph:e.Graph,json:eu(),alg:lu(),version:e.version},Gn}var Wn,Gi;function uu(){if(Gi)return Wn;Gi=1;class e{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,o=i._prev;if(o!==i)return t(o),o}enqueue(i){let o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o}toString(){let i=[],o=this._sentinel,s=o._prev;for(;s!==o;)i.push(JSON.stringify(s,n)),s=s._prev;return"["+i.join(", ")+"]"}}function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,i){if(r!=="_next"&&r!=="_prev")return i}return Wn=e,Wn}var Xn,Wi;function du(){if(Wi)return Xn;Wi=1;let e=xe().Graph,t=uu();Xn=r;let n=()=>1;function r(d,l){if(d.nodeCount()<=1)return[];let u=s(d,l||n);return i(u.graph,u.buckets,u.zeroIdx).flatMap(h=>d.outEdges(h.v,h.w))}function i(d,l,u){let f=[],h=l[l.length-1],p=l[0],y;for(;d.nodeCount();){for(;y=p.dequeue();)o(d,l,u,y);for(;y=h.dequeue();)o(d,l,u,y);if(d.nodeCount()){for(let m=l.length-2;m>0;--m)if(y=l[m].dequeue(),y){f=f.concat(o(d,l,u,y,!0));break}}}return f}function o(d,l,u,f,h){let p=h?[]:void 0;return d.inEdges(f.v).forEach(y=>{let m=d.edge(y),w=d.node(y.v);h&&p.push({v:y.v,w:y.w}),w.out-=m,a(l,u,w)}),d.outEdges(f.v).forEach(y=>{let m=d.edge(y),w=y.w,b=d.node(w);b.in-=m,a(l,u,b)}),d.removeNode(f.v),p}function s(d,l){let u=new e,f=0,h=0;d.nodes().forEach(m=>{u.setNode(m,{v:m,in:0,out:0})}),d.edges().forEach(m=>{let w=u.edge(m.v,m.w)||0,b=l(m),g=w+b;u.setEdge(m.v,m.w,g),h=Math.max(h,u.node(m.v).out+=b),f=Math.max(f,u.node(m.w).in+=b)});let p=c(h+f+3).map(()=>new t),y=f+1;return u.nodes().forEach(m=>{a(p,y,u.node(m))}),{graph:u,buckets:p,zeroIdx:y}}function a(d,l,u){u.out?u.in?d[u.out-u.in+l].enqueue(u):d[d.length-1].enqueue(u):d[0].enqueue(u)}function c(d){const l=[];for(let u=0;u<d;u++)l.push(u);return l}return Xn}var Un,Xi;function se(){if(Xi)return Un;Xi=1;let e=xe().Graph;Un={addBorderNode:l,addDummyNode:t,applyWithChunking:h,asNonCompoundGraph:r,buildLayerMatrix:a,intersectRect:s,mapValues:S,maxRank:p,normalizeRanks:c,notime:w,partition:y,pick:N,predecessorWeights:o,range:x,removeEmptyRanks:d,simplify:n,successorWeights:i,time:m,uniqueId:g,zipObject:C};function t(_,k,M,I){let A;do A=g(I);while(_.hasNode(A));return M.dummy=k,_.setNode(A,M),A}function n(_){let k=new e().setGraph(_.graph());return _.nodes().forEach(M=>k.setNode(M,_.node(M))),_.edges().forEach(M=>{let I=k.edge(M.v,M.w)||{weight:0,minlen:1},A=_.edge(M);k.setEdge(M.v,M.w,{weight:I.weight+A.weight,minlen:Math.max(I.minlen,A.minlen)})}),k}function r(_){let k=new e({multigraph:_.isMultigraph()}).setGraph(_.graph());return _.nodes().forEach(M=>{_.children(M).length||k.setNode(M,_.node(M))}),_.edges().forEach(M=>{k.setEdge(M,_.edge(M))}),k}function i(_){let k=_.nodes().map(M=>{let I={};return _.outEdges(M).forEach(A=>{I[A.w]=(I[A.w]||0)+_.edge(A).weight}),I});return C(_.nodes(),k)}function o(_){let k=_.nodes().map(M=>{let I={};return _.inEdges(M).forEach(A=>{I[A.v]=(I[A.v]||0)+_.edge(A).weight}),I});return C(_.nodes(),k)}function s(_,k){let M=_.x,I=_.y,A=k.x-M,D=k.y-I,v=_.width/2,T=_.height/2;if(!A&&!D)throw new Error("Not possible to find intersection inside of the rectangle");let $,j;return Math.abs(D)*v>Math.abs(A)*T?(D<0&&(T=-T),$=T*A/D,j=T):(A<0&&(v=-v),$=v,j=v*D/A),{x:M+$,y:I+j}}function a(_){let k=x(p(_)+1).map(()=>[]);return _.nodes().forEach(M=>{let I=_.node(M),A=I.rank;A!==void 0&&(k[A][I.order]=M)}),k}function c(_){let k=_.nodes().map(I=>{let A=_.node(I).rank;return A===void 0?Number.MAX_VALUE:A}),M=h(Math.min,k);_.nodes().forEach(I=>{let A=_.node(I);Object.hasOwn(A,"rank")&&(A.rank-=M)})}function d(_){let k=_.nodes().map(v=>_.node(v).rank),M=h(Math.min,k),I=[];_.nodes().forEach(v=>{let T=_.node(v).rank-M;I[T]||(I[T]=[]),I[T].push(v)});let A=0,D=_.graph().nodeRankFactor;Array.from(I).forEach((v,T)=>{v===void 0&&T%D!==0?--A:v!==void 0&&A&&v.forEach($=>_.node($).rank+=A)})}function l(_,k,M,I){let A={width:0,height:0};return arguments.length>=4&&(A.rank=M,A.order=I),t(_,"border",A,k)}function u(_,k=f){const M=[];for(let I=0;I<_.length;I+=k){const A=_.slice(I,I+k);M.push(A)}return M}const f=65535;function h(_,k){if(k.length>f){const M=u(k);return _.apply(null,M.map(I=>_.apply(null,I)))}else return _.apply(null,k)}function p(_){const M=_.nodes().map(I=>{let A=_.node(I).rank;return A===void 0?Number.MIN_VALUE:A});return h(Math.max,M)}function y(_,k){let M={lhs:[],rhs:[]};return _.forEach(I=>{k(I)?M.lhs.push(I):M.rhs.push(I)}),M}function m(_,k){let M=Date.now();try{return k()}finally{console.log(_+" time: "+(Date.now()-M)+"ms")}}function w(_,k){return k()}let b=0;function g(_){var k=++b;return toString(_)+k}function x(_,k,M=1){k==null&&(k=_,_=0);let I=D=>D<k;M<0&&(I=D=>k<D);const A=[];for(let D=_;I(D);D+=M)A.push(D);return A}function N(_,k){const M={};for(const I of k)_[I]!==void 0&&(M[I]=_[I]);return M}function S(_,k){let M=k;return typeof k=="string"&&(M=I=>I[k]),Object.entries(_).reduce((I,[A,D])=>(I[A]=M(D,A),I),{})}function C(_,k){return _.reduce((M,I,A)=>(M[I]=k[A],M),{})}return Un}var Kn,Ui;function fu(){if(Ui)return Kn;Ui=1;let e=du(),t=se().uniqueId;Kn={run:n,undo:i};function n(o){(o.graph().acyclicer==="greedy"?e(o,a(o)):r(o)).forEach(c=>{let d=o.edge(c);o.removeEdge(c),d.forwardName=c.name,d.reversed=!0,o.setEdge(c.w,c.v,d,t("rev"))});function a(c){return d=>c.edge(d).weight}}function r(o){let s=[],a={},c={};function d(l){Object.hasOwn(c,l)||(c[l]=!0,a[l]=!0,o.outEdges(l).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):d(u.w)}),delete a[l])}return o.nodes().forEach(d),s}function i(o){o.edges().forEach(s=>{let a=o.edge(s);if(a.reversed){o.removeEdge(s);let c=a.forwardName;delete a.reversed,delete a.forwardName,o.setEdge(s.w,s.v,a,c)}})}return Kn}var Zn,Ki;function hu(){if(Ki)return Zn;Ki=1;let e=se();Zn={run:t,undo:r};function t(i){i.graph().dummyChains=[],i.edges().forEach(o=>n(i,o))}function n(i,o){let s=o.v,a=i.node(s).rank,c=o.w,d=i.node(c).rank,l=o.name,u=i.edge(o),f=u.labelRank;if(d===a+1)return;i.removeEdge(o);let h,p,y;for(y=0,++a;a<d;++y,++a)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:o,rank:a},h=e.addDummyNode(i,"edge",p,"_d"),a===f&&(p.width=u.width,p.height=u.height,p.dummy="edge-label",p.labelpos=u.labelpos),i.setEdge(s,h,{weight:u.weight},l),y===0&&i.graph().dummyChains.push(h),s=h;i.setEdge(s,c,{weight:u.weight},l)}function r(i){i.graph().dummyChains.forEach(o=>{let s=i.node(o),a=s.edgeLabel,c;for(i.setEdge(s.edgeObj,a);s.dummy;)c=i.successors(o)[0],i.removeNode(o),a.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(a.x=s.x,a.y=s.y,a.width=s.width,a.height=s.height),o=c,s=i.node(o)})}return Zn}var Qn,Zi;function Yt(){if(Zi)return Qn;Zi=1;const{applyWithChunking:e}=se();Qn={longestPath:t,slack:n};function t(r){var i={};function o(s){var a=r.node(s);if(Object.hasOwn(i,s))return a.rank;i[s]=!0;let c=r.outEdges(s).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-r.edge(l).minlen);var d=e(Math.min,c);return d===Number.POSITIVE_INFINITY&&(d=0),a.rank=d}r.sources().forEach(o)}function n(r,i){return r.node(i.w).rank-r.node(i.v).rank-r.edge(i).minlen}return Qn}var Jn,Qi;function Ys(){if(Qi)return Jn;Qi=1;var e=xe().Graph,t=Yt().slack;Jn=n;function n(s){var a=new e({directed:!1}),c=s.nodes()[0],d=s.nodeCount();a.setNode(c,{});for(var l,u;r(a,s)<d;)l=i(a,s),u=a.hasNode(l.v)?t(s,l):-t(s,l),o(a,s,u);return a}function r(s,a){function c(d){a.nodeEdges(d).forEach(l=>{var u=l.v,f=d===u?l.w:u;!s.hasNode(f)&&!t(a,l)&&(s.setNode(f,{}),s.setEdge(d,f,{}),c(f))})}return s.nodes().forEach(c),s.nodeCount()}function i(s,a){return a.edges().reduce((d,l)=>{let u=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(u=t(a,l)),u<d[0]?[u,l]:d},[Number.POSITIVE_INFINITY,null])[1]}function o(s,a,c){s.nodes().forEach(d=>a.node(d).rank+=c)}return Jn}var er,Ji;function gu(){if(Ji)return er;Ji=1;var e=Ys(),t=Yt().slack,n=Yt().longestPath,r=xe().alg.preorder,i=xe().alg.postorder,o=se().simplify;er=s,s.initLowLimValues=l,s.initCutValues=a,s.calcCutValue=d,s.leaveEdge=f,s.enterEdge=h,s.exchangeEdges=p;function s(b){b=o(b),n(b);var g=e(b);l(g),a(g,b);for(var x,N;x=f(g);)N=h(g,b,x),p(g,b,x,N)}function a(b,g){var x=i(b,b.nodes());x=x.slice(0,x.length-1),x.forEach(N=>c(b,g,N))}function c(b,g,x){var N=b.node(x),S=N.parent;b.edge(x,S).cutvalue=d(b,g,x)}function d(b,g,x){var N=b.node(x),S=N.parent,C=!0,_=g.edge(x,S),k=0;return _||(C=!1,_=g.edge(S,x)),k=_.weight,g.nodeEdges(x).forEach(M=>{var I=M.v===x,A=I?M.w:M.v;if(A!==S){var D=I===C,v=g.edge(M).weight;if(k+=D?v:-v,m(b,x,A)){var T=b.edge(x,A).cutvalue;k+=D?-T:T}}}),k}function l(b,g){arguments.length<2&&(g=b.nodes()[0]),u(b,{},1,g)}function u(b,g,x,N,S){var C=x,_=b.node(N);return g[N]=!0,b.neighbors(N).forEach(k=>{Object.hasOwn(g,k)||(x=u(b,g,x,k,N))}),_.low=C,_.lim=x++,S?_.parent=S:delete _.parent,x}function f(b){return b.edges().find(g=>b.edge(g).cutvalue<0)}function h(b,g,x){var N=x.v,S=x.w;g.hasEdge(N,S)||(N=x.w,S=x.v);var C=b.node(N),_=b.node(S),k=C,M=!1;C.lim>_.lim&&(k=_,M=!0);var I=g.edges().filter(A=>M===w(b,b.node(A.v),k)&&M!==w(b,b.node(A.w),k));return I.reduce((A,D)=>t(g,D)<t(g,A)?D:A)}function p(b,g,x,N){var S=x.v,C=x.w;b.removeEdge(S,C),b.setEdge(N.v,N.w,{}),l(b),a(b,g),y(b,g)}function y(b,g){var x=b.nodes().find(S=>!g.node(S).parent),N=r(b,x);N=N.slice(1),N.forEach(S=>{var C=b.node(S).parent,_=g.edge(S,C),k=!1;_||(_=g.edge(C,S),k=!0),g.node(S).rank=g.node(C).rank+(k?_.minlen:-_.minlen)})}function m(b,g,x){return b.hasEdge(g,x)}function w(b,g,x){return x.low<=g.lim&&g.lim<=x.lim}return er}var tr,eo;function pu(){if(eo)return tr;eo=1;var e=Yt(),t=e.longestPath,n=Ys(),r=gu();tr=i;function i(c){switch(c.graph().ranker){case"network-simplex":a(c);break;case"tight-tree":s(c);break;case"longest-path":o(c);break;default:a(c)}}var o=t;function s(c){t(c),n(c)}function a(c){r(c)}return tr}var nr,to;function mu(){if(to)return nr;to=1,nr=e;function e(r){let i=n(r);r.graph().dummyChains.forEach(o=>{let s=r.node(o),a=s.edgeObj,c=t(r,i,a.v,a.w),d=c.path,l=c.lca,u=0,f=d[u],h=!0;for(;o!==a.w;){if(s=r.node(o),h){for(;(f=d[u])!==l&&r.node(f).maxRank<s.rank;)u++;f===l&&(h=!1)}if(!h){for(;u<d.length-1&&r.node(f=d[u+1]).minRank<=s.rank;)u++;f=d[u]}r.setParent(o,f),o=r.successors(o)[0]}})}function t(r,i,o,s){let a=[],c=[],d=Math.min(i[o].low,i[s].low),l=Math.max(i[o].lim,i[s].lim),u,f;u=o;do u=r.parent(u),a.push(u);while(u&&(i[u].low>d||l>i[u].lim));for(f=u,u=s;(u=r.parent(u))!==f;)c.push(u);return{path:a.concat(c.reverse()),lca:f}}function n(r){let i={},o=0;function s(a){let c=o;r.children(a).forEach(s),i[a]={low:c,lim:o++}}return r.children().forEach(s),i}return nr}var rr,no;function yu(){if(no)return rr;no=1;let e=se();rr={run:t,cleanup:o};function t(s){let a=e.addDummyNode(s,"root",{},"_root"),c=r(s),d=Object.values(c),l=e.applyWithChunking(Math.max,d)-1,u=2*l+1;s.graph().nestingRoot=a,s.edges().forEach(h=>s.edge(h).minlen*=u);let f=i(s)+1;s.children().forEach(h=>n(s,a,u,f,l,c,h)),s.graph().nodeRankFactor=u}function n(s,a,c,d,l,u,f){let h=s.children(f);if(!h.length){f!==a&&s.setEdge(a,f,{weight:0,minlen:c});return}let p=e.addBorderNode(s,"_bt"),y=e.addBorderNode(s,"_bb"),m=s.node(f);s.setParent(p,f),m.borderTop=p,s.setParent(y,f),m.borderBottom=y,h.forEach(w=>{n(s,a,c,d,l,u,w);let b=s.node(w),g=b.borderTop?b.borderTop:w,x=b.borderBottom?b.borderBottom:w,N=b.borderTop?d:2*d,S=g!==x?1:l-u[f]+1;s.setEdge(p,g,{weight:N,minlen:S,nestingEdge:!0}),s.setEdge(x,y,{weight:N,minlen:S,nestingEdge:!0})}),s.parent(f)||s.setEdge(a,p,{weight:0,minlen:l+u[f]})}function r(s){var a={};function c(d,l){var u=s.children(d);u&&u.length&&u.forEach(f=>c(f,l+1)),a[d]=l}return s.children().forEach(d=>c(d,1)),a}function i(s){return s.edges().reduce((a,c)=>a+s.edge(c).weight,0)}function o(s){var a=s.graph();s.removeNode(a.nestingRoot),delete a.nestingRoot,s.edges().forEach(c=>{var d=s.edge(c);d.nestingEdge&&s.removeEdge(c)})}return rr}var ir,ro;function xu(){if(ro)return ir;ro=1;let e=se();ir=t;function t(r){function i(o){let s=r.children(o),a=r.node(o);if(s.length&&s.forEach(i),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let c=a.minRank,d=a.maxRank+1;c<d;++c)n(r,"borderLeft","_bl",o,a,c),n(r,"borderRight","_br",o,a,c)}}r.children().forEach(i)}function n(r,i,o,s,a,c){let d={width:0,height:0,rank:c,borderType:i},l=a[i][c-1],u=e.addDummyNode(r,"border",d,o);a[i][c]=u,r.setParent(u,s),l&&r.setEdge(l,u,{weight:1})}return ir}var or,io;function wu(){if(io)return or;io=1,or={adjust:e,undo:t};function e(c){let d=c.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&n(c)}function t(c){let d=c.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&i(c),(d==="lr"||d==="rl")&&(s(c),n(c))}function n(c){c.nodes().forEach(d=>r(c.node(d))),c.edges().forEach(d=>r(c.edge(d)))}function r(c){let d=c.width;c.width=c.height,c.height=d}function i(c){c.nodes().forEach(d=>o(c.node(d))),c.edges().forEach(d=>{let l=c.edge(d);l.points.forEach(o),Object.hasOwn(l,"y")&&o(l)})}function o(c){c.y=-c.y}function s(c){c.nodes().forEach(d=>a(c.node(d))),c.edges().forEach(d=>{let l=c.edge(d);l.points.forEach(a),Object.hasOwn(l,"x")&&a(l)})}function a(c){let d=c.x;c.x=c.y,c.y=d}return or}var sr,oo;function bu(){if(oo)return sr;oo=1;let e=se();sr=t;function t(n){let r={},i=n.nodes().filter(l=>!n.children(l).length),o=i.map(l=>n.node(l).rank),s=e.applyWithChunking(Math.max,o),a=e.range(s+1).map(()=>[]);function c(l){if(r[l])return;r[l]=!0;let u=n.node(l);a[u.rank].push(l),n.successors(l).forEach(c)}return i.sort((l,u)=>n.node(l).rank-n.node(u).rank).forEach(c),a}return sr}var ar,so;function vu(){if(so)return ar;so=1;let e=se().zipObject;ar=t;function t(r,i){let o=0;for(let s=1;s<i.length;++s)o+=n(r,i[s-1],i[s]);return o}function n(r,i,o){let s=e(o,o.map((f,h)=>h)),a=i.flatMap(f=>r.outEdges(f).map(h=>({pos:s[h.w],weight:r.edge(h).weight})).sort((h,p)=>h.pos-p.pos)),c=1;for(;c<o.length;)c<<=1;let d=2*c-1;c-=1;let l=new Array(d).fill(0),u=0;return a.forEach(f=>{let h=f.pos+c;l[h]+=f.weight;let p=0;for(;h>0;)h%2&&(p+=l[h+1]),h=h-1>>1,l[h]+=f.weight;u+=f.weight*p}),u}return ar}var cr,ao;function _u(){if(ao)return cr;ao=1,cr=e;function e(t,n=[]){return n.map(r=>{let i=t.inEdges(r);if(i.length){let o=i.reduce((s,a)=>{let c=t.edge(a),d=t.node(a.v);return{sum:s.sum+c.weight*d.order,weight:s.weight+c.weight}},{sum:0,weight:0});return{v:r,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:r}})}return cr}var lr,co;function Eu(){if(co)return lr;co=1;let e=se();lr=t;function t(i,o){let s={};i.forEach((c,d)=>{let l=s[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};c.barycenter!==void 0&&(l.barycenter=c.barycenter,l.weight=c.weight)}),o.edges().forEach(c=>{let d=s[c.v],l=s[c.w];d!==void 0&&l!==void 0&&(l.indegree++,d.out.push(s[c.w]))});let a=Object.values(s).filter(c=>!c.indegree);return n(a)}function n(i){let o=[];function s(c){return d=>{d.merged||(d.barycenter===void 0||c.barycenter===void 0||d.barycenter>=c.barycenter)&&r(c,d)}}function a(c){return d=>{d.in.push(c),--d.indegree===0&&i.push(d)}}for(;i.length;){let c=i.pop();o.push(c),c.in.reverse().forEach(s(c)),c.out.forEach(a(c))}return o.filter(c=>!c.merged).map(c=>e.pick(c,["vs","i","barycenter","weight"]))}function r(i,o){let s=0,a=0;i.weight&&(s+=i.barycenter*i.weight,a+=i.weight),o.weight&&(s+=o.barycenter*o.weight,a+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=s/a,i.weight=a,i.i=Math.min(o.i,i.i),o.merged=!0}return lr}var ur,lo;function Nu(){if(lo)return ur;lo=1;let e=se();ur=t;function t(i,o){let s=e.partition(i,p=>Object.hasOwn(p,"barycenter")),a=s.lhs,c=s.rhs.sort((p,y)=>y.i-p.i),d=[],l=0,u=0,f=0;a.sort(r(!!o)),f=n(d,c,f),a.forEach(p=>{f+=p.vs.length,d.push(p.vs),l+=p.barycenter*p.weight,u+=p.weight,f=n(d,c,f)});let h={vs:d.flat(!0)};return u&&(h.barycenter=l/u,h.weight=u),h}function n(i,o,s){let a;for(;o.length&&(a=o[o.length-1]).i<=s;)o.pop(),i.push(a.vs),s++;return s}function r(i){return(o,s)=>o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:i?s.i-o.i:o.i-s.i}return ur}var dr,uo;function ku(){if(uo)return dr;uo=1;let e=_u(),t=Eu(),n=Nu();dr=r;function r(s,a,c,d){let l=s.children(a),u=s.node(a),f=u?u.borderLeft:void 0,h=u?u.borderRight:void 0,p={};f&&(l=l.filter(b=>b!==f&&b!==h));let y=e(s,l);y.forEach(b=>{if(s.children(b.v).length){let g=r(s,b.v,c,d);p[b.v]=g,Object.hasOwn(g,"barycenter")&&o(b,g)}});let m=t(y,c);i(m,p);let w=n(m,d);if(f&&(w.vs=[f,w.vs,h].flat(!0),s.predecessors(f).length)){let b=s.node(s.predecessors(f)[0]),g=s.node(s.predecessors(h)[0]);Object.hasOwn(w,"barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+b.order+g.order)/(w.weight+2),w.weight+=2}return w}function i(s,a){s.forEach(c=>{c.vs=c.vs.flatMap(d=>a[d]?a[d].vs:d)})}function o(s,a){s.barycenter!==void 0?(s.barycenter=(s.barycenter*s.weight+a.barycenter*a.weight)/(s.weight+a.weight),s.weight+=a.weight):(s.barycenter=a.barycenter,s.weight=a.weight)}return dr}var fr,fo;function Su(){if(fo)return fr;fo=1;let e=xe().Graph,t=se();fr=n;function n(i,o,s){let a=r(i),c=new e({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(d=>i.node(d));return i.nodes().forEach(d=>{let l=i.node(d),u=i.parent(d);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(c.setNode(d),c.setParent(d,u||a),i[s](d).forEach(f=>{let h=f.v===d?f.w:f.v,p=c.edge(h,d),y=p!==void 0?p.weight:0;c.setEdge(h,d,{weight:i.edge(f).weight+y})}),Object.hasOwn(l,"minRank")&&c.setNode(d,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),c}function r(i){for(var o;i.hasNode(o=t.uniqueId("_root")););return o}return fr}var hr,ho;function Cu(){if(ho)return hr;ho=1,hr=e;function e(t,n,r){let i={},o;r.forEach(s=>{let a=t.parent(s),c,d;for(;a;){if(c=t.parent(a),c?(d=i[c],i[c]=a):(d=o,o=a),d&&d!==a){n.setEdge(d,a);return}a=c}})}return hr}var gr,go;function Mu(){if(go)return gr;go=1;let e=bu(),t=vu(),n=ku(),r=Su(),i=Cu(),o=xe().Graph,s=se();gr=a;function a(u,f){if(f&&typeof f.customOrder=="function"){f.customOrder(u,a);return}let h=s.maxRank(u),p=c(u,s.range(1,h+1),"inEdges"),y=c(u,s.range(h-1,-1,-1),"outEdges"),m=e(u);if(l(u,m),f&&f.disableOptimalOrderHeuristic)return;let w=Number.POSITIVE_INFINITY,b;for(let g=0,x=0;x<4;++g,++x){d(g%2?p:y,g%4>=2),m=s.buildLayerMatrix(u);let N=t(u,m);N<w&&(x=0,b=Object.assign({},m),w=N)}l(u,b)}function c(u,f,h){return f.map(function(p){return r(u,p,h)})}function d(u,f){let h=new o;u.forEach(function(p){let y=p.graph().root,m=n(p,y,h,f);m.vs.forEach((w,b)=>p.node(w).order=b),i(p,h,m.vs)})}function l(u,f){Object.values(f).forEach(h=>h.forEach((p,y)=>u.node(p).order=y))}return gr}var pr,po;function Iu(){if(po)return pr;po=1;let e=xe().Graph,t=se();pr={positionX:h,findType1Conflicts:n,findType2Conflicts:r,addConflict:o,hasConflict:s,verticalAlignment:a,horizontalCompaction:c,alignCoordinates:u,findSmallestWidthAlignment:l,balance:f};function n(m,w){let b={};function g(x,N){let S=0,C=0,_=x.length,k=N[N.length-1];return N.forEach((M,I)=>{let A=i(m,M),D=A?m.node(A).order:_;(A||M===k)&&(N.slice(C,I+1).forEach(v=>{m.predecessors(v).forEach(T=>{let $=m.node(T),j=$.order;(j<S||D<j)&&!($.dummy&&m.node(v).dummy)&&o(b,T,v)})}),C=I+1,S=D)}),N}return w.length&&w.reduce(g),b}function r(m,w){let b={};function g(N,S,C,_,k){let M;t.range(S,C).forEach(I=>{M=N[I],m.node(M).dummy&&m.predecessors(M).forEach(A=>{let D=m.node(A);D.dummy&&(D.order<_||D.order>k)&&o(b,A,M)})})}function x(N,S){let C=-1,_,k=0;return S.forEach((M,I)=>{if(m.node(M).dummy==="border"){let A=m.predecessors(M);A.length&&(_=m.node(A[0]).order,g(S,k,I,C,_),k=I,C=_)}g(S,k,S.length,_,N.length)}),S}return w.length&&w.reduce(x),b}function i(m,w){if(m.node(w).dummy)return m.predecessors(w).find(b=>m.node(b).dummy)}function o(m,w,b){if(w>b){let x=w;w=b,b=x}let g=m[w];g||(m[w]=g={}),g[b]=!0}function s(m,w,b){if(w>b){let g=w;w=b,b=g}return!!m[w]&&Object.hasOwn(m[w],b)}function a(m,w,b,g){let x={},N={},S={};return w.forEach(C=>{C.forEach((_,k)=>{x[_]=_,N[_]=_,S[_]=k})}),w.forEach(C=>{let _=-1;C.forEach(k=>{let M=g(k);if(M.length){M=M.sort((A,D)=>S[A]-S[D]);let I=(M.length-1)/2;for(let A=Math.floor(I),D=Math.ceil(I);A<=D;++A){let v=M[A];N[k]===k&&_<S[v]&&!s(b,k,v)&&(N[v]=k,N[k]=x[k]=x[v],_=S[v])}}})}),{root:x,align:N}}function c(m,w,b,g,x){let N={},S=d(m,w,b,x),C=x?"borderLeft":"borderRight";function _(I,A){let D=S.nodes(),v=D.pop(),T={};for(;v;)T[v]?I(v):(T[v]=!0,D.push(v),D=D.concat(A(v))),v=D.pop()}function k(I){N[I]=S.inEdges(I).reduce((A,D)=>Math.max(A,N[D.v]+S.edge(D)),0)}function M(I){let A=S.outEdges(I).reduce((v,T)=>Math.min(v,N[T.w]-S.edge(T)),Number.POSITIVE_INFINITY),D=m.node(I);A!==Number.POSITIVE_INFINITY&&D.borderType!==C&&(N[I]=Math.max(N[I],A))}return _(k,S.predecessors.bind(S)),_(M,S.successors.bind(S)),Object.keys(g).forEach(I=>N[I]=N[b[I]]),N}function d(m,w,b,g){let x=new e,N=m.graph(),S=p(N.nodesep,N.edgesep,g);return w.forEach(C=>{let _;C.forEach(k=>{let M=b[k];if(x.setNode(M),_){var I=b[_],A=x.edge(I,M);x.setEdge(I,M,Math.max(S(m,k,_),A||0))}_=k})}),x}function l(m,w){return Object.values(w).reduce((b,g)=>{let x=Number.NEGATIVE_INFINITY,N=Number.POSITIVE_INFINITY;Object.entries(g).forEach(([C,_])=>{let k=y(m,C)/2;x=Math.max(_+k,x),N=Math.min(_-k,N)});const S=x-N;return S<b[0]&&(b=[S,g]),b},[Number.POSITIVE_INFINITY,null])[1]}function u(m,w){let b=Object.values(w),g=t.applyWithChunking(Math.min,b),x=t.applyWithChunking(Math.max,b);["u","d"].forEach(N=>{["l","r"].forEach(S=>{let C=N+S,_=m[C];if(_===w)return;let k=Object.values(_),M=g-t.applyWithChunking(Math.min,k);S!=="l"&&(M=x-t.applyWithChunking(Math.max,k)),M&&(m[C]=t.mapValues(_,I=>I+M))})})}function f(m,w){return t.mapValues(m.ul,(b,g)=>{if(w)return m[w.toLowerCase()][g];{let x=Object.values(m).map(N=>N[g]).sort((N,S)=>N-S);return(x[1]+x[2])/2}})}function h(m){let w=t.buildLayerMatrix(m),b=Object.assign(n(m,w),r(m,w)),g={},x;["u","d"].forEach(S=>{x=S==="u"?w:Object.values(w).reverse(),["l","r"].forEach(C=>{C==="r"&&(x=x.map(I=>Object.values(I).reverse()));let _=(S==="u"?m.predecessors:m.successors).bind(m),k=a(m,x,b,_),M=c(m,x,k.root,k.align,C==="r");C==="r"&&(M=t.mapValues(M,I=>-I)),g[S+C]=M})});let N=l(m,g);return u(g,N),f(g,m.graph().align)}function p(m,w,b){return(g,x,N)=>{let S=g.node(x),C=g.node(N),_=0,k;if(_+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":k=-S.width/2;break;case"r":k=S.width/2;break}if(k&&(_+=b?k:-k),k=0,_+=(S.dummy?w:m)/2,_+=(C.dummy?w:m)/2,_+=C.width/2,Object.hasOwn(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":k=C.width/2;break;case"r":k=-C.width/2;break}return k&&(_+=b?k:-k),k=0,_}}function y(m,w){return m.node(w).width}return pr}var mr,mo;function Au(){if(mo)return mr;mo=1;let e=se(),t=Iu().positionX;mr=n;function n(i){i=e.asNonCompoundGraph(i),r(i),Object.entries(t(i)).forEach(([o,s])=>i.node(o).x=s)}function r(i){let o=e.buildLayerMatrix(i),s=i.graph().ranksep,a=0;o.forEach(c=>{const d=c.reduce((l,u)=>{const f=i.node(u).height;return l>f?l:f},0);c.forEach(l=>i.node(l).y=a+d/2),a+=d+s})}return mr}var yr,yo;function $u(){if(yo)return yr;yo=1;let e=fu(),t=hu(),n=pu(),r=se().normalizeRanks,i=mu(),o=se().removeEmptyRanks,s=yu(),a=xu(),c=wu(),d=Mu(),l=Au(),u=se(),f=xe().Graph;yr=h;function h(R,P){let O=P&&P.debugTiming?u.time:u.notime;O("layout",()=>{let H=O(" buildLayoutGraph",()=>_(R));O(" runLayout",()=>p(H,O,P)),O(" updateInputGraph",()=>y(R,H))})}function p(R,P,O){P(" makeSpaceForEdgeLabels",()=>k(R)),P(" removeSelfEdges",()=>F(R)),P(" acyclic",()=>e.run(R)),P(" nestingGraph.run",()=>s.run(R)),P(" rank",()=>n(u.asNonCompoundGraph(R))),P(" injectEdgeLabelProxies",()=>M(R)),P(" removeEmptyRanks",()=>o(R)),P(" nestingGraph.cleanup",()=>s.cleanup(R)),P(" normalizeRanks",()=>r(R)),P(" assignRankMinMax",()=>I(R)),P(" removeEdgeLabelProxies",()=>A(R)),P(" normalize.run",()=>t.run(R)),P(" parentDummyChains",()=>i(R)),P(" addBorderSegments",()=>a(R)),P(" order",()=>d(R,O)),P(" insertSelfEdges",()=>L(R)),P(" adjustCoordinateSystem",()=>c.adjust(R)),P(" position",()=>l(R)),P(" positionSelfEdges",()=>B(R)),P(" removeBorderNodes",()=>j(R)),P(" normalize.undo",()=>t.undo(R)),P(" fixupEdgeLabelCoords",()=>T(R)),P(" undoCoordinateSystem",()=>c.undo(R)),P(" translateGraph",()=>D(R)),P(" assignNodeIntersects",()=>v(R)),P(" reversePoints",()=>$(R)),P(" acyclic.undo",()=>e.undo(R))}function y(R,P){R.nodes().forEach(O=>{let H=R.node(O),q=P.node(O);H&&(H.x=q.x,H.y=q.y,H.rank=q.rank,P.children(O).length&&(H.width=q.width,H.height=q.height))}),R.edges().forEach(O=>{let H=R.edge(O),q=P.edge(O);H.points=q.points,Object.hasOwn(q,"x")&&(H.x=q.x,H.y=q.y)}),R.graph().width=P.graph().width,R.graph().height=P.graph().height}let m=["nodesep","edgesep","ranksep","marginx","marginy"],w={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],g=["width","height"],x={width:0,height:0},N=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},C=["labelpos"];function _(R){let P=new f({multigraph:!0,compound:!0}),O=Y(R.graph());return P.setGraph(Object.assign({},w,V(O,m),u.pick(O,b))),R.nodes().forEach(H=>{let q=Y(R.node(H));const G=V(q,g);Object.keys(x).forEach(U=>{G[U]===void 0&&(G[U]=x[U])}),P.setNode(H,G),P.setParent(H,R.parent(H))}),R.edges().forEach(H=>{let q=Y(R.edge(H));P.setEdge(H,Object.assign({},S,V(q,N),u.pick(q,C)))}),P}function k(R){let P=R.graph();P.ranksep/=2,R.edges().forEach(O=>{let H=R.edge(O);H.minlen*=2,H.labelpos.toLowerCase()!=="c"&&(P.rankdir==="TB"||P.rankdir==="BT"?H.width+=H.labeloffset:H.height+=H.labeloffset)})}function M(R){R.edges().forEach(P=>{let O=R.edge(P);if(O.width&&O.height){let H=R.node(P.v),G={rank:(R.node(P.w).rank-H.rank)/2+H.rank,e:P};u.addDummyNode(R,"edge-proxy",G,"_ep")}})}function I(R){let P=0;R.nodes().forEach(O=>{let H=R.node(O);H.borderTop&&(H.minRank=R.node(H.borderTop).rank,H.maxRank=R.node(H.borderBottom).rank,P=Math.max(P,H.maxRank))}),R.graph().maxRank=P}function A(R){R.nodes().forEach(P=>{let O=R.node(P);O.dummy==="edge-proxy"&&(R.edge(O.e).labelRank=O.rank,R.removeNode(P))})}function D(R){let P=Number.POSITIVE_INFINITY,O=0,H=Number.POSITIVE_INFINITY,q=0,G=R.graph(),U=G.marginx||0,Z=G.marginy||0;function K(X){let J=X.x,ee=X.y,re=X.width,ae=X.height;P=Math.min(P,J-re/2),O=Math.max(O,J+re/2),H=Math.min(H,ee-ae/2),q=Math.max(q,ee+ae/2)}R.nodes().forEach(X=>K(R.node(X))),R.edges().forEach(X=>{let J=R.edge(X);Object.hasOwn(J,"x")&&K(J)}),P-=U,H-=Z,R.nodes().forEach(X=>{let J=R.node(X);J.x-=P,J.y-=H}),R.edges().forEach(X=>{let J=R.edge(X);J.points.forEach(ee=>{ee.x-=P,ee.y-=H}),Object.hasOwn(J,"x")&&(J.x-=P),Object.hasOwn(J,"y")&&(J.y-=H)}),G.width=O-P+U,G.height=q-H+Z}function v(R){R.edges().forEach(P=>{let O=R.edge(P),H=R.node(P.v),q=R.node(P.w),G,U;O.points?(G=O.points[0],U=O.points[O.points.length-1]):(O.points=[],G=q,U=H),O.points.unshift(u.intersectRect(H,G)),O.points.push(u.intersectRect(q,U))})}function T(R){R.edges().forEach(P=>{let O=R.edge(P);if(Object.hasOwn(O,"x"))switch((O.labelpos==="l"||O.labelpos==="r")&&(O.width-=O.labeloffset),O.labelpos){case"l":O.x-=O.width/2+O.labeloffset;break;case"r":O.x+=O.width/2+O.labeloffset;break}})}function $(R){R.edges().forEach(P=>{let O=R.edge(P);O.reversed&&O.points.reverse()})}function j(R){R.nodes().forEach(P=>{if(R.children(P).length){let O=R.node(P),H=R.node(O.borderTop),q=R.node(O.borderBottom),G=R.node(O.borderLeft[O.borderLeft.length-1]),U=R.node(O.borderRight[O.borderRight.length-1]);O.width=Math.abs(U.x-G.x),O.height=Math.abs(q.y-H.y),O.x=G.x+O.width/2,O.y=H.y+O.height/2}}),R.nodes().forEach(P=>{R.node(P).dummy==="border"&&R.removeNode(P)})}function F(R){R.edges().forEach(P=>{if(P.v===P.w){var O=R.node(P.v);O.selfEdges||(O.selfEdges=[]),O.selfEdges.push({e:P,label:R.edge(P)}),R.removeEdge(P)}})}function L(R){var P=u.buildLayerMatrix(R);P.forEach(O=>{var H=0;O.forEach((q,G)=>{var U=R.node(q);U.order=G+H,(U.selfEdges||[]).forEach(Z=>{u.addDummyNode(R,"selfedge",{width:Z.label.width,height:Z.label.height,rank:U.rank,order:G+ ++H,e:Z.e,label:Z.label},"_se")}),delete U.selfEdges})})}function B(R){R.nodes().forEach(P=>{var O=R.node(P);if(O.dummy==="selfedge"){var H=R.node(O.e.v),q=H.x+H.width/2,G=H.y,U=O.x-q,Z=H.height/2;R.setEdge(O.e,O.label),R.removeNode(P),O.label.points=[{x:q+2*U/3,y:G-Z},{x:q+5*U/6,y:G-Z},{x:q+U,y:G},{x:q+5*U/6,y:G+Z},{x:q+2*U/3,y:G+Z}],O.label.x=O.x,O.label.y=O.y}})}function V(R,P){return u.mapValues(u.pick(R,P),Number)}function Y(R){var P={};return R&&Object.entries(R).forEach(([O,H])=>{typeof O=="string"&&(O=O.toLowerCase()),P[O]=H}),P}return yr}var xr,xo;function Ru(){if(xo)return xr;xo=1;let e=se(),t=xe().Graph;xr={debugOrdering:n};function n(r){let i=e.buildLayerMatrix(r),o=new t({compound:!0,multigraph:!0}).setGraph({});return r.nodes().forEach(s=>{o.setNode(s,{label:s}),o.setParent(s,"layer"+r.node(s).rank)}),r.edges().forEach(s=>o.setEdge(s.v,s.w,{},s.name)),i.forEach((s,a)=>{let c="layer"+a;o.setNode(c,{rank:"same"}),s.reduce((d,l)=>(o.setEdge(d,l,{style:"invis"}),l))}),o}return xr}var wr,wo;function Tu(){return wo||(wo=1,wr="1.1.4"),wr}var br,bo;function ju(){return bo||(bo=1,br={graphlib:xe(),layout:$u(),debug:Ru(),util:{time:se().time,notime:se().notime},version:Tu()}),br}var Pu=ju();const Gs=Os(Pu);function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Lu={value:()=>{}};function an(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Ht(n)}function Ht(e){this._=e}function Ou(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ht.prototype=an.prototype={constructor:Ht,on:function(e,t){var n=this._,r=Ou(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Du(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=vo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vo(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ht(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function Du(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function vo(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Lu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Or="http://www.w3.org/1999/xhtml";const _o={svg:"http://www.w3.org/2000/svg",xhtml:Or,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function cn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function zu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Or&&t.documentElement.namespaceURI===Or?t.createElement(e):t.createElementNS(n,e)}}function Fu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ws(e){var t=cn(e);return(t.local?Fu:zu)(t)}function Hu(){}function ni(e){return e==null?Hu:function(){return this.querySelector(e)}}function Vu(e){typeof e!="function"&&(e=ni(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,d,l=0;l<s;++l)(c=o[l])&&(d=e.call(c,c.__data__,l,o))&&("__data__"in c&&(d.__data__=c.__data__),a[l]=d);return new fe(r,this._parents)}function Bu(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qu(){return[]}function Xs(e){return e==null?qu:function(){return this.querySelectorAll(e)}}function Yu(e){return function(){return Bu(e.apply(this,arguments))}}function Gu(e){typeof e=="function"?e=Yu(e):e=Xs(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,d=0;d<a;++d)(c=s[d])&&(r.push(e.call(c,c.__data__,d,s)),i.push(c));return new fe(r,i)}function Us(e){return function(){return this.matches(e)}}function Ks(e){return function(t){return t.matches(e)}}var Wu=Array.prototype.find;function Xu(e){return function(){return Wu.call(this.children,e)}}function Uu(){return this.firstElementChild}function Ku(e){return this.select(e==null?Uu:Xu(typeof e=="function"?e:Ks(e)))}var Zu=Array.prototype.filter;function Qu(){return Array.from(this.children)}function Ju(e){return function(){return Zu.call(this.children,e)}}function ed(e){return this.selectAll(e==null?Qu:Ju(typeof e=="function"?e:Ks(e)))}function td(e){typeof e!="function"&&(e=Us(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,d=0;d<s;++d)(c=o[d])&&e.call(c,c.__data__,d,o)&&a.push(c);return new fe(r,this._parents)}function Zs(e){return new Array(e.length)}function nd(){return new fe(this._enter||this._groups.map(Zs),this._parents)}function Gt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Gt.prototype={constructor:Gt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function rd(e){return function(){return e}}function id(e,t,n,r,i,o){for(var s=0,a,c=t.length,d=o.length;s<d;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new Gt(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function od(e,t,n,r,i,o,s){var a,c,d=new Map,l=t.length,u=o.length,f=new Array(l),h;for(a=0;a<l;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",d.has(h)?i[a]=c:d.set(h,c));for(a=0;a<u;++a)h=s.call(e,o[a],a,o)+"",(c=d.get(h))?(r[a]=c,c.__data__=o[a],d.delete(h)):n[a]=new Gt(e,o[a]);for(a=0;a<l;++a)(c=t[a])&&d.get(f[a])===c&&(i[a]=c)}function sd(e){return e.__data__}function ad(e,t){if(!arguments.length)return Array.from(this,sd);var n=t?od:id,r=this._parents,i=this._groups;typeof e!="function"&&(e=rd(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),d=0;d<o;++d){var l=r[d],u=i[d],f=u.length,h=cd(e.call(l,l&&l.__data__,d,r)),p=h.length,y=a[d]=new Array(p),m=s[d]=new Array(p),w=c[d]=new Array(f);n(l,u,y,m,w,h,t);for(var b=0,g=0,x,N;b<p;++b)if(x=y[b]){for(b>=g&&(g=b+1);!(N=m[g])&&++g<p;);x._next=N||null}}return s=new fe(s,r),s._enter=a,s._exit=c,s}function cd(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ld(){return new fe(this._exit||this._groups.map(Zs),this._parents)}function ud(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function dd(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var d=n[c],l=r[c],u=d.length,f=a[c]=new Array(u),h,p=0;p<u;++p)(h=d[p]||l[p])&&(f[p]=h);for(;c<i;++c)a[c]=n[c];return new fe(a,this._parents)}function fd(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function hd(e){e||(e=gd);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),d,l=0;l<a;++l)(d=s[l])&&(c[l]=d);c.sort(t)}return new fe(i,this._parents).order()}function gd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pd(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function md(){return Array.from(this)}function yd(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function xd(){let e=0;for(const t of this)++e;return e}function wd(){return!this.node()}function bd(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function vd(e){return function(){this.removeAttribute(e)}}function _d(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ed(e,t){return function(){this.setAttribute(e,t)}}function Nd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Cd(e,t){var n=cn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?_d:vd:typeof t=="function"?n.local?Sd:kd:n.local?Nd:Ed)(n,t))}function Qs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Md(e){return function(){this.style.removeProperty(e)}}function Id(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ad(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function $d(e,t,n){return arguments.length>1?this.each((t==null?Md:typeof t=="function"?Ad:Id)(e,t,n??"")):Ze(this.node(),e)}function Ze(e,t){return e.style.getPropertyValue(t)||Qs(e).getComputedStyle(e,null).getPropertyValue(t)}function Rd(e){return function(){delete this[e]}}function Td(e,t){return function(){this[e]=t}}function jd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Pd(e,t){return arguments.length>1?this.each((t==null?Rd:typeof t=="function"?jd:Td)(e,t)):this.node()[e]}function Js(e){return e.trim().split(/^|\s+/)}function ri(e){return e.classList||new ea(e)}function ea(e){this._node=e,this._names=Js(e.getAttribute("class")||"")}ea.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ta(e,t){for(var n=ri(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function na(e,t){for(var n=ri(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Ld(e){return function(){ta(this,e)}}function Od(e){return function(){na(this,e)}}function Dd(e,t){return function(){(t.apply(this,arguments)?ta:na)(this,e)}}function zd(e,t){var n=Js(e+"");if(arguments.length<2){for(var r=ri(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Dd:t?Ld:Od)(n,t))}function Fd(){this.textContent=""}function Hd(e){return function(){this.textContent=e}}function Vd(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Bd(e){return arguments.length?this.each(e==null?Fd:(typeof e=="function"?Vd:Hd)(e)):this.node().textContent}function qd(){this.innerHTML=""}function Yd(e){return function(){this.innerHTML=e}}function Gd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Wd(e){return arguments.length?this.each(e==null?qd:(typeof e=="function"?Gd:Yd)(e)):this.node().innerHTML}function Xd(){this.nextSibling&&this.parentNode.appendChild(this)}function Ud(){return this.each(Xd)}function Kd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Zd(){return this.each(Kd)}function Qd(e){var t=typeof e=="function"?e:Ws(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Jd(){return null}function ef(e,t){var n=typeof e=="function"?e:Ws(e),r=t==null?Jd:typeof t=="function"?t:ni(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function tf(){var e=this.parentNode;e&&e.removeChild(this)}function nf(){return this.each(tf)}function rf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function of(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sf(e){return this.select(e?of:rf)}function af(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cf(e){return function(t){e.call(this,t,this.__data__)}}function lf(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function uf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function df(e,t,n){return function(){var r=this.__on,i,o=cf(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function ff(e,t,n){var r=lf(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,d=a.length,l;c<d;++c)for(i=0,l=a[c];i<o;++i)if((s=r[i]).type===l.type&&s.name===l.name)return l.value}return}for(a=t?df:uf,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function ra(e,t,n){var r=Qs(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function hf(e,t){return function(){return ra(this,e,t)}}function gf(e,t){return function(){return ra(this,e,t.apply(this,arguments))}}function pf(e,t){return this.each((typeof t=="function"?gf:hf)(e,t))}function*mf(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var ia=[null];function fe(e,t){this._groups=e,this._parents=t}function kt(){return new fe([[document.documentElement]],ia)}function yf(){return this}fe.prototype=kt.prototype={constructor:fe,select:Vu,selectAll:Gu,selectChild:Ku,selectChildren:ed,filter:td,data:ad,enter:nd,exit:ld,join:ud,merge:dd,selection:yf,order:fd,sort:hd,call:pd,nodes:md,node:yd,size:xd,empty:wd,each:bd,attr:Cd,style:$d,property:Pd,classed:zd,text:Bd,html:Wd,raise:Ud,lower:Zd,append:Qd,insert:ef,remove:nf,clone:sf,datum:af,on:ff,dispatch:pf,[Symbol.iterator]:mf};function de(e){return typeof e=="string"?new fe([[document.querySelector(e)]],[document.documentElement]):new fe([[e]],ia)}function xf(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=xf(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const wf={passive:!1},pt={capture:!0,passive:!1};function vr(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function oa(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Ue,pt);"onselectstart"in t?n.on("selectstart.drag",Ue,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function sa(e,t){var n=e.document.documentElement,r=de(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ue,pt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Rt=e=>()=>e;function Dr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:c,dy:d,dispatch:l}){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:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:l}})}Dr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bf(e){return!e.ctrlKey&&!e.button}function vf(){return this.parentNode}function _f(e,t){return t??{x:e.x,y:e.y}}function Ef(){return navigator.maxTouchPoints||"ontouchstart"in this}function aa(){var e=bf,t=vf,n=_f,r=Ef,i={},o=an("start","drag","end"),s=0,a,c,d,l,u=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",m).on("touchmove.drag",w,wf).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,N){if(!(l||!e.call(this,x,N))){var S=g(this,t.call(this,x,N),x,N,"mouse");S&&(de(x.view).on("mousemove.drag",p,pt).on("mouseup.drag",y,pt),oa(x.view),vr(x),d=!1,a=x.clientX,c=x.clientY,S("start",x))}}function p(x){if(Ue(x),!d){var N=x.clientX-a,S=x.clientY-c;d=N*N+S*S>u}i.mouse("drag",x)}function y(x){de(x.view).on("mousemove.drag mouseup.drag",null),sa(x.view,d),Ue(x),i.mouse("end",x)}function m(x,N){if(e.call(this,x,N)){var S=x.changedTouches,C=t.call(this,x,N),_=S.length,k,M;for(k=0;k<_;++k)(M=g(this,C,x,N,S[k].identifier,S[k]))&&(vr(x),M("start",x,S[k]))}}function w(x){var N=x.changedTouches,S=N.length,C,_;for(C=0;C<S;++C)(_=i[N[C].identifier])&&(Ue(x),_("drag",x,N[C]))}function b(x){var N=x.changedTouches,S=N.length,C,_;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),C=0;C<S;++C)(_=i[N[C].identifier])&&(vr(x),_("end",x,N[C]))}function g(x,N,S,C,_,k){var M=o.copy(),I=pe(k||S,N),A,D,v;if((v=n.call(x,new Dr("beforestart",{sourceEvent:S,target:f,identifier:_,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:M}),C))!=null)return A=v.x-I[0]||0,D=v.y-I[1]||0,function T($,j,F){var L=I,B;switch($){case"start":i[_]=T,B=s++;break;case"end":delete i[_],--s;case"drag":I=pe(F||j,N),B=s;break}M.call($,x,new Dr($,{sourceEvent:j,subject:v,target:f,identifier:_,active:B,x:I[0]+A,y:I[1]+D,dx:I[0]-L[0],dy:I[1]-L[1],dispatch:M}),C)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Rt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:Rt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Rt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:Rt(!!x),f):r},f.on=function(){var x=o.on.apply(o,arguments);return x===o?f:x},f.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,f):Math.sqrt(u)},f}function ii(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ca(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function St(){}var mt=.7,Wt=1/mt,Ke="\\s*([+-]?\\d+)\\s*",yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nf=/^#([0-9a-f]{3,8})$/,kf=new RegExp(`^rgb\\(${Ke},${Ke},${Ke}\\)$`),Sf=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Cf=new RegExp(`^rgba\\(${Ke},${Ke},${Ke},${yt}\\)$`),Mf=new RegExp(`^rgba\\(${be},${be},${be},${yt}\\)$`),If=new RegExp(`^hsl\\(${yt},${be},${be}\\)$`),Af=new RegExp(`^hsla\\(${yt},${be},${be},${yt}\\)$`),Eo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ii(St,xt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:No,formatHex:No,formatHex8:$f,formatHsl:Rf,formatRgb:ko,toString:ko});function No(){return this.rgb().formatHex()}function $f(){return this.rgb().formatHex8()}function Rf(){return la(this).formatHsl()}function ko(){return this.rgb().formatRgb()}function xt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Nf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?So(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=kf.exec(e))?new ce(t[1],t[2],t[3],1):(t=Sf.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cf.exec(e))?Tt(t[1],t[2],t[3],t[4]):(t=Mf.exec(e))?Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=If.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=Af.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?So(Eo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function So(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function Tt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ce(e,t,n,r)}function Tf(e){return e instanceof St||(e=xt(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function zr(e,t,n,r){return arguments.length===1?Tf(e):new ce(e,t,n,r??1)}function ce(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ii(ce,zr,ca(St,{brighter(e){return e=e==null?Wt:Math.pow(Wt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(Oe(this.r),Oe(this.g),Oe(this.b),Xt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Co,formatHex:Co,formatHex8:jf,formatRgb:Mo,toString:Mo}));function Co(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function jf(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mo(){const e=Xt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function Xt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Le(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function Io(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new me(e,t,n,r)}function la(e){if(e instanceof me)return new me(e.h,e.s,e.l,e.opacity);if(e instanceof St||(e=xt(e)),!e)return new me;if(e instanceof me)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new me(s,a,c,e.opacity)}function Pf(e,t,n,r){return arguments.length===1?la(e):new me(e,t,n,r??1)}function me(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ii(me,Pf,ca(St,{brighter(e){return e=e==null?Wt:Math.pow(Wt,e),new me(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new me(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ce(_r(e>=240?e-240:e+120,i,r),_r(e,i,r),_r(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new me(Ao(this.h),jt(this.s),jt(this.l),Xt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Xt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function jt(e){return Math.max(0,Math.min(1,e||0))}function _r(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ua=e=>()=>e;function Lf(e,t){return function(n){return e+n*t}}function Of(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Df(e){return(e=+e)==1?da:function(t,n){return n-t?Of(t,n,e):ua(isNaN(t)?n:t)}}function da(e,t){var n=t-e;return n?Lf(e,n):ua(isNaN(e)?t:e)}const $o=function e(t){var n=Df(t);function r(i,o){var s=n((i=zr(i)).r,(o=zr(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),d=da(i.opacity,o.opacity);return function(l){return i.r=s(l),i.g=a(l),i.b=c(l),i.opacity=d(l),i+""}}return r.gamma=e,r}(1);function je(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Fr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Er=new RegExp(Fr.source,"g");function zf(e){return function(){return e}}function Ff(e){return function(t){return e(t)+""}}function Hf(e,t){var n=Fr.lastIndex=Er.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Fr.exec(e))&&(i=Er.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:je(r,i)})),n=Er.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?Ff(c[0].x):zf(t):(t=c.length,function(d){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(d);return a.join("")})}var Ro=180/Math.PI,Hr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fa(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*Ro,skewX:Math.atan(c)*Ro,scaleX:s,scaleY:a}}var Pt;function Vf(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hr:fa(t.a,t.b,t.c,t.d,t.e,t.f)}function Bf(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?Hr:(e=e.matrix,fa(e.a,e.b,e.c,e.d,e.e,e.f))}function ha(e,t,n,r){function i(d){return d.length?d.pop()+" ":""}function o(d,l,u,f,h,p){if(d!==u||l!==f){var y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:je(d,u)},{i:y-2,x:je(l,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(d,l,u,f){d!==l?(d-l>180?l+=360:l-d>180&&(d+=360),f.push({i:u.push(i(u)+"rotate(",null,r)-2,x:je(d,l)})):l&&u.push(i(u)+"rotate("+l+r)}function a(d,l,u,f){d!==l?f.push({i:u.push(i(u)+"skewX(",null,r)-2,x:je(d,l)}):l&&u.push(i(u)+"skewX("+l+r)}function c(d,l,u,f,h,p){if(d!==u||l!==f){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:je(d,u)},{i:y-2,x:je(l,f)})}else(u!==1||f!==1)&&h.push(i(h)+"scale("+u+","+f+")")}return function(d,l){var u=[],f=[];return d=e(d),l=e(l),o(d.translateX,d.translateY,l.translateX,l.translateY,u,f),s(d.rotate,l.rotate,u,f),a(d.skewX,l.skewX,u,f),c(d.scaleX,d.scaleY,l.scaleX,l.scaleY,u,f),d=l=null,function(h){for(var p=-1,y=f.length,m;++p<y;)u[(m=f[p]).i]=m.x(h);return u.join("")}}}var qf=ha(Vf,"px, ","px)","deg)"),Yf=ha(Bf,", ",")",")"),Gf=1e-12;function To(e){return((e=Math.exp(e))+1/e)/2}function Wf(e){return((e=Math.exp(e))-1/e)/2}function Xf(e){return((e=Math.exp(2*e))-1)/(e+1)}const Uf=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],d=o[2],l=s[0],u=s[1],f=s[2],h=l-a,p=u-c,y=h*h+p*p,m,w;if(y<Gf)w=Math.log(f/d)/t,m=function(C){return[a+C*h,c+C*p,d*Math.exp(t*C*w)]};else{var b=Math.sqrt(y),g=(f*f-d*d+r*y)/(2*d*n*b),x=(f*f-d*d-r*y)/(2*f*n*b),N=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(x*x+1)-x);w=(S-N)/t,m=function(C){var _=C*w,k=To(N),M=d/(n*b)*(k*Xf(t*_+N)-Wf(N));return[a+M*h,c+M*p,d*k/To(t*_+N)]}}return m.duration=w*1e3*t/Math.SQRT2,m}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);var Qe=0,dt=0,ct=0,ga=1e3,Ut,ft,Kt=0,Fe=0,ln=0,wt=typeof performance=="object"&&performance.now?performance:Date,pa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oi(){return Fe||(pa(Kf),Fe=wt.now()+ln)}function Kf(){Fe=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=ma.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oi():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Ut=this,ft=this),this._call=e,this._time=n,Vr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vr())}};function ma(e,t,n){var r=new Zt;return r.restart(e,t,n),r}function Zf(){oi(),++Qe;for(var e=Ut,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function jo(){Fe=(Kt=wt.now())+ln,Qe=dt=0;try{Zf()}finally{Qe=0,Jf(),Fe=0}}function Qf(){var e=wt.now(),t=e-Kt;t>ga&&(ln-=t,Kt=e)}function Jf(){for(var e,t=Ut,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ut=n);ft=e,Vr(r)}function Vr(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Fe;t>24?(e<1/0&&(dt=setTimeout(jo,e-wt.now()-ln)),ct&&(ct=clearInterval(ct))):(ct||(Kt=wt.now(),ct=setInterval(Qf,ga)),Qe=1,pa(jo))}}function Po(e,t,n){var r=new Zt;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var eh=an("start","end","cancel","interrupt"),th=[],ya=0,Lo=1,Br=2,Vt=3,Oo=4,qr=5,Bt=6;function un(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;nh(e,n,{name:t,index:r,group:i,on:eh,tween:th,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ya})}function si(e,t){var n=we(e,t);if(n.state>ya)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Vt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function nh(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ma(o,0,n.time);function o(d){n.state=Lo,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var l,u,f,h;if(n.state!==Lo)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===Vt)return Po(s);h.state===Oo?(h.state=Bt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+l<t&&(h.state=Bt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[l])}if(Po(function(){n.state===Vt&&(n.state=Oo,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=Br,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Br){for(n.state=Vt,i=new Array(f=n.tween.length),l=0,u=-1;l<f;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=h);i.length=u+1}}function a(d){for(var l=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=qr,1),u=-1,f=i.length;++u<f;)i[u].call(e,l);n.state===qr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Bt,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>Br&&r.state<qr,r.state=Bt,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function rh(e){return this.each(function(){qt(this,e)})}function ih(e,t){var n,r;return function(){var i=Ee(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function oh(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Ee(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,d=i.length;c<d;++c)if(i[c].name===t){i[c]=a;break}c===d&&i.push(a)}o.tween=i}}function sh(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=we(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?ih:oh)(n,e,t))}function ai(e,t,n){var r=e._id;return e.each(function(){var i=Ee(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,r).value[t]}}function xa(e,t){var n;return(typeof t=="number"?je:t instanceof xt?$o:(n=xt(t))?(t=n,$o):Hf)(e,t)}function ah(e){return function(){this.removeAttribute(e)}}function ch(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lh(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function uh(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function dh(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function fh(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function hh(e,t){var n=cn(e),r=n==="transform"?Yf:xa;return this.attrTween(e,typeof t=="function"?(n.local?fh:dh)(n,r,ai(this,"attr."+e,t)):t==null?(n.local?ch:ah)(n):(n.local?uh:lh)(n,r,t))}function gh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ph(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mh(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&ph(e,o)),n}return i._value=t,i}function yh(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&gh(e,o)),n}return i._value=t,i}function xh(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=cn(e);return this.tween(n,(r.local?mh:yh)(r,t))}function wh(e,t){return function(){si(this,e).delay=+t.apply(this,arguments)}}function bh(e,t){return t=+t,function(){si(this,e).delay=t}}function vh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wh:bh)(t,e)):we(this.node(),t).delay}function _h(e,t){return function(){Ee(this,e).duration=+t.apply(this,arguments)}}function Eh(e,t){return t=+t,function(){Ee(this,e).duration=t}}function Nh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_h:Eh)(t,e)):we(this.node(),t).duration}function kh(e,t){if(typeof t!="function")throw new Error;return function(){Ee(this,e).ease=t}}function Sh(e){var t=this._id;return arguments.length?this.each(kh(t,e)):we(this.node(),t).ease}function Ch(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function Mh(e){if(typeof e!="function")throw new Error;return this.each(Ch(this._id,e))}function Ih(e){typeof e!="function"&&(e=Us(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,d=0;d<s;++d)(c=o[d])&&e.call(c,c.__data__,d,o)&&a.push(c);return new Ae(r,this._parents,this._name,this._id)}function Ah(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],d=n[a],l=c.length,u=s[a]=new Array(l),f,h=0;h<l;++h)(f=c[h]||d[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function $h(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Rh(e,t,n){var r,i,o=$h(t)?si:Ee;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Th(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Rh(n,e,t))}function jh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ph(){return this.on("end.remove",jh(this._id))}function Lh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ni(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,d=o[s]=new Array(c),l,u,f=0;f<c;++f)(l=a[f])&&(u=e.call(l,l.__data__,f,a))&&("__data__"in l&&(u.__data__=l.__data__),d[f]=u,un(d[f],t,n,f,d,we(l,n)));return new Ae(o,this._parents,t,n)}function Oh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xs(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],d=c.length,l,u=0;u<d;++u)if(l=c[u]){for(var f=e.call(l,l.__data__,u,c),h,p=we(l,n),y=0,m=f.length;y<m;++y)(h=f[y])&&un(h,t,n,y,f,p);o.push(f),s.push(l)}return new Ae(o,s,t,n)}var Dh=kt.prototype.constructor;function zh(){return new Dh(this._groups,this._parents)}function Fh(e,t){var n,r,i;return function(){var o=Ze(this,e),s=(this.style.removeProperty(e),Ze(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function wa(e){return function(){this.style.removeProperty(e)}}function Hh(e,t,n){var r,i=n+"",o;return function(){var s=Ze(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function Vh(e,t,n){var r,i,o;return function(){var s=Ze(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ze(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function Bh(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Ee(this,e),d=c.on,l=c.value[o]==null?a||(a=wa(t)):void 0;(d!==n||i!==l)&&(r=(n=d).copy()).on(s,i=l),c.on=r}}function qh(e,t,n){var r=(e+="")=="transform"?qf:xa;return t==null?this.styleTween(e,Fh(e,r)).on("end.style."+e,wa(e)):typeof t=="function"?this.styleTween(e,Vh(e,r,ai(this,"style."+e,t))).each(Bh(this._id,e)):this.styleTween(e,Hh(e,r,t),n).on("end.style."+e,null)}function Yh(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Gh(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&Yh(e,s,n)),r}return o._value=t,o}function Wh(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Gh(e,t,n??""))}function Xh(e){return function(){this.textContent=e}}function Uh(e){return function(){var t=e(this);this.textContent=t??""}}function Kh(e){return this.tween("text",typeof e=="function"?Uh(ai(this,"text",e)):Xh(e==null?"":e+""))}function Zh(e){return function(t){this.textContent=e.call(this,t)}}function Qh(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Zh(i)),t}return r._value=e,r}function Jh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Qh(e))}function eg(){for(var e=this._name,t=this._id,n=ba(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,d=0;d<a;++d)if(c=s[d]){var l=we(c,t);un(c,e,n,d,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Ae(r,this._parents,e,n)}function tg(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var d=Ee(this,r),l=d.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),d.on=t}),i===0&&o()})}var ng=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ba(){return++ng}var Ne=kt.prototype;Ae.prototype={constructor:Ae,select:Lh,selectAll:Oh,selectChild:Ne.selectChild,selectChildren:Ne.selectChildren,filter:Ih,merge:Ah,selection:zh,transition:eg,call:Ne.call,nodes:Ne.nodes,node:Ne.node,size:Ne.size,empty:Ne.empty,each:Ne.each,on:Th,attr:hh,attrTween:xh,style:qh,styleTween:Wh,text:Kh,textTween:Jh,remove:Ph,tween:sh,delay:vh,duration:Nh,ease:Sh,easeVarying:Mh,end:tg,[Symbol.iterator]:Ne[Symbol.iterator]};function rg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ig={time:null,delay:0,duration:250,ease:rg};function og(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function sg(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=ba(),(n=ig).time=oi(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,d=0;d<a;++d)(c=s[d])&&un(c,e,t,d,s,n||og(c,t));return new Ae(r,this._parents,e,t)}kt.prototype.interrupt=rh;kt.prototype.transition=sg;const Lt=e=>()=>e;function ag(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Se(e,t,n){this.k=e,this.x=t,this.y=n}Se.prototype={constructor:Se,scale:function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var dn=new Se(1,0,0);va.prototype=Se.prototype;function va(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dn;return e.__zoom}function Nr(e){e.stopImmediatePropagation()}function lt(e){e.preventDefault(),e.stopImmediatePropagation()}function cg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lg(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Do(){return this.__zoom||dn}function ug(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dg(){return navigator.maxTouchPoints||"ontouchstart"in this}function fg(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function _a(){var e=cg,t=lg,n=fg,r=ug,i=dg,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Uf,d=an("start","zoom","end"),l,u,f,h=500,p=150,y=0,m=10;function w(v){v.property("__zoom",Do).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",M).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(v,T,$,j){var F=v.selection?v.selection():v;F.property("__zoom",Do),v!==F?N(v,T,$,j):F.interrupt().each(function(){S(this,arguments).event(j).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},w.scaleBy=function(v,T,$,j){w.scaleTo(v,function(){var F=this.__zoom.k,L=typeof T=="function"?T.apply(this,arguments):T;return F*L},$,j)},w.scaleTo=function(v,T,$,j){w.transform(v,function(){var F=t.apply(this,arguments),L=this.__zoom,B=$==null?x(F):typeof $=="function"?$.apply(this,arguments):$,V=L.invert(B),Y=typeof T=="function"?T.apply(this,arguments):T;return n(g(b(L,Y),B,V),F,s)},$,j)},w.translateBy=function(v,T,$,j){w.transform(v,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),s)},null,j)},w.translateTo=function(v,T,$,j,F){w.transform(v,function(){var L=t.apply(this,arguments),B=this.__zoom,V=j==null?x(L):typeof j=="function"?j.apply(this,arguments):j;return n(dn.translate(V[0],V[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof $=="function"?-$.apply(this,arguments):-$),L,s)},j,F)};function b(v,T){return T=Math.max(o[0],Math.min(o[1],T)),T===v.k?v:new Se(T,v.x,v.y)}function g(v,T,$){var j=T[0]-$[0]*v.k,F=T[1]-$[1]*v.k;return j===v.x&&F===v.y?v:new Se(v.k,j,F)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,T,$,j){v.on("start.zoom",function(){S(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(j).end()}).tween("zoom",function(){var F=this,L=arguments,B=S(F,L).event(j),V=t.apply(F,L),Y=$==null?x(V):typeof $=="function"?$.apply(F,L):$,R=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),P=F.__zoom,O=typeof T=="function"?T.apply(F,L):T,H=c(P.invert(Y).concat(R/P.k),O.invert(Y).concat(R/O.k));return function(q){if(q===1)q=O;else{var G=H(q),U=R/G[2];q=new Se(U,Y[0]-G[0]*U,Y[1]-G[1]*U)}B.zoom(null,q)}})}function S(v,T,$){return!$&&v.__zooming||new C(v,T)}function C(v,T){this.that=v,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,T),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,T){return this.mouse&&v!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var T=de(this.that).datum();d.call(v,this.that,new ag(v,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:d}),T)}};function _(v,...T){if(!e.apply(this,arguments))return;var $=S(this,T).event(v),j=this.__zoom,F=Math.max(o[0],Math.min(o[1],j.k*Math.pow(2,r.apply(this,arguments)))),L=pe(v);if($.wheel)($.mouse[0][0]!==L[0]||$.mouse[0][1]!==L[1])&&($.mouse[1]=j.invert($.mouse[0]=L)),clearTimeout($.wheel);else{if(j.k===F)return;$.mouse=[L,j.invert(L)],qt(this),$.start()}lt(v),$.wheel=setTimeout(B,p),$.zoom("mouse",n(g(b(j,F),$.mouse[0],$.mouse[1]),$.extent,s));function B(){$.wheel=null,$.end()}}function k(v,...T){if(f||!e.apply(this,arguments))return;var $=v.currentTarget,j=S(this,T,!0).event(v),F=de(v.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",R,!0),L=pe(v,$),B=v.clientX,V=v.clientY;oa(v.view),Nr(v),j.mouse=[L,this.__zoom.invert(L)],qt(this),j.start();function Y(P){if(lt(P),!j.moved){var O=P.clientX-B,H=P.clientY-V;j.moved=O*O+H*H>y}j.event(P).zoom("mouse",n(g(j.that.__zoom,j.mouse[0]=pe(P,$),j.mouse[1]),j.extent,s))}function R(P){F.on("mousemove.zoom mouseup.zoom",null),sa(P.view,j.moved),lt(P),j.event(P).end()}}function M(v,...T){if(e.apply(this,arguments)){var $=this.__zoom,j=pe(v.changedTouches?v.changedTouches[0]:v,this),F=$.invert(j),L=$.k*(v.shiftKey?.5:2),B=n(g(b($,L),j,F),t.apply(this,T),s);lt(v),a>0?de(this).transition().duration(a).call(N,B,j,v):de(this).call(w.transform,B,j,v)}}function I(v,...T){if(e.apply(this,arguments)){var $=v.touches,j=$.length,F=S(this,T,v.changedTouches.length===j).event(v),L,B,V,Y;for(Nr(v),B=0;B<j;++B)V=$[B],Y=pe(V,this),Y=[Y,this.__zoom.invert(Y),V.identifier],F.touch0?!F.touch1&&F.touch0[2]!==Y[2]&&(F.touch1=Y,F.taps=0):(F.touch0=Y,L=!0,F.taps=1+!!l);l&&(l=clearTimeout(l)),L&&(F.taps<2&&(u=Y[0],l=setTimeout(function(){l=null},h)),qt(this),F.start())}}function A(v,...T){if(this.__zooming){var $=S(this,T).event(v),j=v.changedTouches,F=j.length,L,B,V,Y;for(lt(v),L=0;L<F;++L)B=j[L],V=pe(B,this),$.touch0&&$.touch0[2]===B.identifier?$.touch0[0]=V:$.touch1&&$.touch1[2]===B.identifier&&($.touch1[0]=V);if(B=$.that.__zoom,$.touch1){var R=$.touch0[0],P=$.touch0[1],O=$.touch1[0],H=$.touch1[1],q=(q=O[0]-R[0])*q+(q=O[1]-R[1])*q,G=(G=H[0]-P[0])*G+(G=H[1]-P[1])*G;B=b(B,Math.sqrt(q/G)),V=[(R[0]+O[0])/2,(R[1]+O[1])/2],Y=[(P[0]+H[0])/2,(P[1]+H[1])/2]}else if($.touch0)V=$.touch0[0],Y=$.touch0[1];else return;$.zoom("touch",n(g(B,V,Y),$.extent,s))}}function D(v,...T){if(this.__zooming){var $=S(this,T).event(v),j=v.changedTouches,F=j.length,L,B;for(Nr(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),L=0;L<F;++L)B=j[L],$.touch0&&$.touch0[2]===B.identifier?delete $.touch0:$.touch1&&$.touch1[2]===B.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(B=pe(B,this),Math.hypot(u[0]-B[0],u[1]-B[1])<m)){var V=de(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return w.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:Lt(+v),w):r},w.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Lt(!!v),w):e},w.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:Lt(!!v),w):i},w.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Lt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),w):t},w.scaleExtent=function(v){return arguments.length?(o[0]=+v[0],o[1]=+v[1],w):[o[0],o[1]]},w.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],w):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},w.constrain=function(v){return arguments.length?(n=v,w):n},w.duration=function(v){return arguments.length?(a=+v,w):a},w.interpolate=function(v){return arguments.length?(c=v,w):c},w.on=function(){var v=d.on.apply(d,arguments);return v===d?w:v},w.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,w):Math.sqrt(y)},w.tapDistance=function(v){return arguments.length?(m=+v,w):m},w}const ve={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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."},bt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ea=["Enter"," ","Escape"];var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var vt;(function(e){e.Partial="partial",e.Full="full"})(vt||(vt={}));const Na={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ke;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ke||(ke={}));var Qt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Qt||(Qt={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const zo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function ka(e){return e===null?null:e?"valid":"invalid"}const Sa=e=>"id"in e&&"source"in e&&"target"in e,hg=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),ci=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),i=e.origin??t,o=n*i[0],s=r*i[1];return{x:e.position.x-o,y:e.position.y-s}},Ca=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let s=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(s=o?t.nodeLookup.get(i):ci(i)?i:t.nodeLookup.get(i.id));const a=s?Jt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return fn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hn(n)},it=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const i=Jt(r);n=fn(n,i)}}),hn(n)},Ma=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1)=>{const a={...Mt(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const d of e.values()){const{measured:l,selectable:u=!0,hidden:f=!1}=d;if(s&&!u||f)continue;const h=l.width??d.width??d.initialWidth??null,p=l.height??d.height??d.initialHeight??null,y=_t(a,tt(d)),m=(h??0)*(p??0),w=o&&y>0;(!d.internals.handleBounds||w||y>=m||d.dragging)&&c.push(d)}return c},gg=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function pg(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function mg({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},s){if(e.size===0)return Promise.resolve(!0);const a=pg(e,s),c=it(a),d=pn(c,t,n,(s==null?void 0:s.minZoom)??i,(s==null?void 0:s.maxZoom)??o,(s==null?void 0:s.padding)??.1);return await r.setViewport(d,{duration:s==null?void 0:s.duration}),Promise.resolve(!0)}function Ia({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},l=s.origin??r;let u=i;if(s.extent==="parent"&&!s.expandParent)if(!a)o==null||o("005",ve.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(u=[[c,d],[c+h,d+p]])}else a&&nt(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+d],[s.extent[1][0]+c,s.extent[1][1]+d]]);const f=nt(u)?He(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(o==null||o("015",ve.error015())),{position:{x:f.x-c+(s.measured.width??0)*l[0],y:f.y-d+(s.measured.height??0)*l[1]},positionAbsolute:f}}async function yg({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=o.has(f.id),p=!h&&f.parentId&&s.find(y=>y.id===f.parentId);(h||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),l=gg(s,c);for(const f of c)a.has(f.id)&&!l.find(p=>p.id===f.id)&&l.push(f);if(!i)return{edges:l,nodes:s};const u=await i({nodes:s,edges:l});return typeof u=="boolean"?u?{edges:l,nodes:s}:{edges:[],nodes:[]}:u}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:et(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Aa(e,t,n){const{width:r,height:i}=$e(n),{x:o,y:s}=n.internals.positionAbsolute;return He(e,[[o,s],[o+r,s+i]],t)}const Fo=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,$a=(e,t,n=15,r=40)=>{const i=Fo(e.x,r,t.width-r)*n,o=Fo(e.y,r,t.height-r)*n;return[i,o]},fn=(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)}),Yr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),hn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tt=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=ci(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Jt=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=ci(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},Ra=(e,t)=>hn(fn(Yr(e),Yr(t))),_t=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Ho=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),xg=(e,t)=>{},gn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,r,i],o=!1,s=[1,1])=>{const a={x:(e-n)/i,y:(t-r)/i};return o?gn(a,s):a},en=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Ge(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wg(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ge(e,n),i=Ge(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Ge(e.top??e.y??0,n),i=Ge(e.bottom??e.y??0,n),o=Ge(e.left??e.x??0,t),s=Ge(e.right??e.x??0,t);return{top:r,right:s,bottom:i,left:o,x:o+s,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function bg(e,t,n,r,i,o){const{x:s,y:a}=en(e,[t,n,r]),{x:c,y:d}=en({x:e.x+e.width,y:e.y+e.height},[t,n,r]),l=i-c,u=o-d;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(l),bottom:Math.floor(u)}}const pn=(e,t,n,r,i,o)=>{const s=wg(o,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,d=Math.min(a,c),l=et(d,r,i),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*l,p=n/2-f*l,y=bg(e,h,p,l,t,n),m={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:l}},tn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function nt(e){return e!==void 0&&e!=="parent"}function $e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Ta(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ja(e,t={width:0,height:0},n,r,i){const o={...e},s=r.get(n);if(s){const a=s.origin||i;o.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],o.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return o}function Vo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function vg(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:s}=Ce(e),a=Mt({x:o-((i==null?void 0:i.left)??0),y:s-((i==null?void 0:i.top)??0)},r),{x:c,y:d}=n?gn(a,t):a;return{xSnapped:c,ySnapped:d,...a}}const li=e=>({width:e.offsetWidth,height:e.offsetHeight}),Pa=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_g=["INPUT","SELECT","TEXTAREA"];function La(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:_g.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Oa=e=>"clientX"in e,Ce=(e,t)=>{var o,s;const n=Oa(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Bo=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:i,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...li(s)}})};function Da({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:s,targetControlY:a}){const c=e*.125+i*.375+s*.375+n*.125,d=t*.125+o*.375+a*.375+r*.125,l=Math.abs(c-e),u=Math.abs(d-t);return[c,d,l,u]}function Ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qo({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case W.Left:return[t-Ot(t-r,o),n];case W.Right:return[t+Ot(r-t,o),n];case W.Top:return[t,n-Ot(n-i,o)];case W.Bottom:return[t,n+Ot(i-n,o)]}}function It({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:o=W.Top,curvature:s=.25}){const[a,c]=qo({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[d,l]=qo({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[u,f,h,p]=Da({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:c,targetControlX:d,targetControlY:l});return[`M${e},${t} C${a},${c} ${d},${l} ${r},${i}`,u,f,h,p]}function za({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[o,a,i,s]}function Eg({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1}){if(!i)return r;const o=n||t.selected||e.selected,s=Math.max(e.internals.z||0,t.internals.z||0,1e3);return r+(o?s:0)}function Ng({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=fn(Jt(e),Jt(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const s={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return _t(s,hn(o))>0}const kg=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Sg=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Cg=(e,t)=>{if(!e.source||!e.target)return t;let n;return Sa(e)?n={...e}:n={...e,id:kg(e)},Sg(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Fa({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=za({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const Yo={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Mg=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ig({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:i,offset:o}){const s=Yo[t],a=Yo[r],c={x:e.x+s.x*o,y:e.y+s.y*o},d={x:n.x+a.x*o,y:n.y+a.y*o},l=Mg({source:c,sourcePosition:t,target:d}),u=l.x!==0?"x":"y",f=l[u];let h=[],p,y;const m={x:0,y:0},w={x:0,y:0},[b,g,x,N]=za({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[u]*a[u]===-1){p=i.x??b,y=i.y??g;const C=[{x:p,y:c.y},{x:p,y:d.y}],_=[{x:c.x,y},{x:d.x,y}];s[u]===f?h=u==="x"?C:_:h=u==="x"?_:C}else{const C=[{x:c.x,y:d.y}],_=[{x:d.x,y:c.y}];if(u==="x"?h=s.x===f?_:C:h=s.y===f?C:_,t===r){const D=Math.abs(e[u]-n[u]);if(D<=o){const v=Math.min(o-1,o-D);s[u]===f?m[u]=(c[u]>e[u]?-1:1)*v:w[u]=(d[u]>n[u]?-1:1)*v}}if(t!==r){const D=u==="x"?"y":"x",v=s[u]===a[D],T=c[D]>d[D],$=c[D]<d[D];(s[u]===1&&(!v&&T||v&&$)||s[u]!==1&&(!v&&$||v&&T))&&(h=u==="x"?C:_)}const k={x:c.x+m.x,y:c.y+m.y},M={x:d.x+w.x,y:d.y+w.y},I=Math.max(Math.abs(k.x-h[0].x),Math.abs(M.x-h[0].x)),A=Math.max(Math.abs(k.y-h[0].y),Math.abs(M.y-h[0].y));I>=A?(p=(k.x+M.x)/2,y=h[0].y):(p=h[0].x,y=(k.y+M.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:d.x+w.x,y:d.y+w.y},n],p,y,x,N]}function Ag(e,t,n,r){const i=Math.min(Go(e,t)/2,Go(t,n)/2,r),{x:o,y:s}=t;if(e.x===o&&o===n.x||e.y===s&&s===n.y)return`L${o} ${s}`;if(e.y===s){const d=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${o+i*d},${s}Q ${o},${s} ${o},${s+i*l}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${s+i*c}Q ${o},${s} ${o+i*a},${s}`}function Gr({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:o=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:d=20}){const[l,u,f,h,p]=Ig({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:a,y:c},offset:d});return[l.reduce((m,w,b)=>{let g="";return b>0&&b<l.length-1?g=Ag(l[b-1],w,l[b+1],s):g=`${b===0?"M":"L"}${w.x} ${w.y}`,m+=g,m},""),u,f,h,p]}function Wo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function $g(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Wo(t)||!Wo(n))return null;const r=t.internals.handleBounds||Xo(t.handles),i=n.internals.handleBounds||Xo(n.handles),o=Uo((r==null?void 0:r.source)??[],e.sourceHandle),s=Uo(e.connectionMode===Je.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!o||!s)return(u=e.onError)==null||u.call(e,"008",ve.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(o==null?void 0:o.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,d=Et(t,o,a),l=Et(n,s,c);return{sourceX:d.x,sourceY:d.y,targetX:l.x,targetY:l.y,sourcePosition:a,targetPosition:c}}function Xo(e){if(!e)return null;const t=[],n=[];for(const 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 Et(e,t,n=W.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??$e(e);if(r)return{x:i+s/2,y:o+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:i+s/2,y:o};case W.Right:return{x:i+s,y:o+a/2};case W.Bottom:return{x:i+s/2,y:o+a};case W.Left:return{x:i,y:o+a/2}}}function Uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Wr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Rg(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=Wr(c,t);o.has(d)||(s.push({id:d,color:c.color||n,...c}),o.add(d))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}function Tg(e,t,n,r,i){let o=.5;i==="start"?o=0:i==="end"&&(o=1);let s=[(e.x+e.width*o)*t.zoom+t.x,e.y*t.zoom+t.y-r],a=[-100*o,-100];switch(n){case W.Right:s=[(e.x+e.width)*t.zoom+t.x+r,(e.y+e.height*o)*t.zoom+t.y],a=[0,-100*o];break;case W.Bottom:s[1]=(e.y+e.height)*t.zoom+t.y+r,a[1]=0;break;case W.Left:s=[e.x*t.zoom+t.x-r,(e.y+e.height*o)*t.zoom+t.y],a=[-100,-100*o];break}return`translate(${s[0]}px, ${s[1]}px) translate(${a[0]}%, ${a[1]}%)`}const ui={nodeOrigin:[0,0],nodeExtent:bt,elevateNodesOnSelect:!0,defaults:{}},jg={...ui,checkEquality:!0};function di(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Pg(e,t,n){const r=di(ui,n);for(const i of e.values())if(i.parentId)fi(i,e,t,r);else{const o=Ct(i,r.nodeOrigin),s=nt(i.extent)?i.extent:r.nodeExtent,a=He(o,s,$e(i));i.internals.positionAbsolute=a}}function Xr(e,t,n,r){var c,d;const i=di(jg,r);let o=e.length>0;const s=new Map(t),a=i!=null&&i.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(i.checkEquality&&l===(u==null?void 0:u.internals.userNode))t.set(l.id,u);else{const f=Ct(l,i.nodeOrigin),h=nt(l.extent)?l.extent:i.nodeExtent,p=He(f,h,$e(l));u={...i.defaults,...l,measured:{width:(c=l.measured)==null?void 0:c.width,height:(d=l.measured)==null?void 0:d.height},internals:{positionAbsolute:p,handleBounds:l.measured?u==null?void 0:u.internals.handleBounds:void 0,z:Ha(l,a),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(o=!1),l.parentId&&fi(u,t,n,r)}return o}function Lg(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function fi(e,t,n,r){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:s}=di(ui,r),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Lg(e,n);const d=i?1e3:0,{x:l,y:u,z:f}=Og(e,c,o,s,d),{positionAbsolute:h}=e.internals,p=l!==h.x||u!==h.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:l,y:u}:h,z:f}})}function Ha(e,t){return(ye(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Og(e,t,n,r,i){const{x:o,y:s}=t.internals.positionAbsolute,a=$e(e),c=Ct(e,n),d=nt(e.extent)?He(c,e.extent,a):c;let l=He({x:o+d.x,y:s+d.y},r,a);e.extent==="parent"&&(l=Aa(l,a,t));const u=Ha(e,i),f=t.internals.z??0;return{x:l.x,y:l.y,z:f>u?f:u}}function hi(e,t,n,r=[0,0]){var s;const i=[],o=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const d=((s=o.get(a.parentId))==null?void 0:s.expandedRect)??tt(c),l=Ra(d,a.rect);o.set(a.parentId,{expandedRect:l,parent:c})}return o.size>0&&o.forEach(({expandedRect:a,parent:c},d)=>{var g;const l=c.internals.positionAbsolute,u=$e(c),f=c.origin??r,h=a.x<l.x?Math.round(Math.abs(l.x-a.x)):0,p=a.y<l.y?Math.round(Math.abs(l.y-a.y)):0,y=Math.max(u.width,Math.round(a.width)),m=Math.max(u.height,Math.round(a.height)),w=(y-u.width)*f[0],b=(m-u.height)*f[1];(h>0||p>0||w||b)&&(i.push({id:d,type:"position",position:{x:c.position.x-h+w,y:c.position.y-p+b}}),(g=n.get(d))==null||g.forEach(x=>{e.some(N=>N.id===x.id)||i.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+p}})})),(u.width<a.width||u.height<a.height||h||p)&&i.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?f[0]*h-w:0),height:m+(p?f[1]*p-b:0)}})}),i}function Dg(e,t,n,r,i,o){const s=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],d=window.getComputedStyle(s),{m22:l}=new window.DOMMatrixReadOnly(d.transform),u=[];for(const f of e.values()){const h=t.get(f.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const p=li(f.nodeElement),y=h.measured.width!==p.width||h.measured.height!==p.height;if(!!(p.width&&p.height&&(y||!h.internals.handleBounds||f.force))){const w=f.nodeElement.getBoundingClientRect(),b=nt(h.extent)?h.extent:o;let{positionAbsolute:g}=h.internals;h.parentId&&h.extent==="parent"?g=Aa(g,p,t.get(h.parentId)):b&&(g=He(g,b,p));const x={...h,measured:p,internals:{...h.internals,positionAbsolute:g,handleBounds:{source:Bo("source",f.nodeElement,w,l,h.id),target:Bo("target",f.nodeElement,w,l,h.id)}}};t.set(h.id,x),h.parentId&&fi(x,t,n,{nodeOrigin:i}),a=!0,y&&(c.push({id:h.id,type:"dimensions",dimensions:p}),h.expandParent&&h.parentId&&u.push({id:h.id,parentId:h.parentId,rect:tt(x,i)}))}}if(u.length>0){const f=hi(u,t,n,i);c.push(...f)}return{changes:c,updatedInternals:a}}async function zg({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Ko(e,t,n,r,i,o){let s=i;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${i}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),o){s=`${i}-${e}-${o}`;const d=r.get(s)||new Map;r.set(s,d.set(n,t))}}function Va(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:s,targetHandle:a},d=`${i}-${s}--${o}-${a}`,l=`${o}-${a}--${i}-${s}`;Ko("source",c,l,e,i,s),Ko("target",c,d,e,o,a),t.set(r.id,r)}}function Ba(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ba(n,t):!1}function Zo(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Fg(e,t,n,r){const i=new Map;for(const[o,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Ba(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(o);a&&i.set(o,{id:o,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return i}function kr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const i=[];for(const[d,l]of t){const u=(s=n.get(d))==null?void 0:s.internals.userNode;u&&i.push({...u,position:l.position,dragging:r})}if(!e)return[i[0],i];const o=(a=n.get(e))==null?void 0:a.internals.userNode;return[o?{...o,position:((c=t.get(e))==null?void 0:c.position)||o.position,dragging:r}:i[0],i]}function Hg({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},s=0,a=new Map,c=!1,d={x:0,y:0},l=null,u=!1,f=null,h=!1;function p({noDragClassName:m,handleSelector:w,domNode:b,isSelectable:g,nodeId:x,nodeClickDistance:N=0}){f=de(b);function S({x:M,y:I},A){const{nodeLookup:D,nodeExtent:v,snapGrid:T,snapToGrid:$,nodeOrigin:j,onNodeDrag:F,onSelectionDrag:L,onError:B,updateNodePositions:V}=t();o={x:M,y:I};let Y=!1,R={x:0,y:0,x2:0,y2:0};if(a.size>1&&v){const P=it(a);R=Yr(P)}for(const[P,O]of a){if(!D.has(P))continue;let H={x:M-O.distance.x,y:I-O.distance.y};$&&(H=gn(H,T));let q=[[v[0][0],v[0][1]],[v[1][0],v[1][1]]];if(a.size>1&&v&&!O.extent){const{positionAbsolute:Z}=O.internals,K=Z.x-R.x+v[0][0],X=Z.x+O.measured.width-R.x2+v[1][0],J=Z.y-R.y+v[0][1],ee=Z.y+O.measured.height-R.y2+v[1][1];q=[[K,J],[X,ee]]}const{position:G,positionAbsolute:U}=Ia({nodeId:P,nextPosition:H,nodeLookup:D,nodeExtent:q,nodeOrigin:j,onError:B});Y=Y||O.position.x!==G.x||O.position.y!==G.y,O.position=G,O.internals.positionAbsolute=U}if(Y&&(V(a,!0),A&&(r||F||!x&&L))){const[P,O]=kr({nodeId:x,dragItems:a,nodeLookup:D});r==null||r(A,a,P,O),F==null||F(A,P,O),x||L==null||L(A,O)}}async function C(){if(!l)return;const{transform:M,panBy:I,autoPanSpeed:A,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(s);return}const[v,T]=$a(d,l,A);(v!==0||T!==0)&&(o.x=(o.x??0)-v/M[2],o.y=(o.y??0)-T/M[2],await I({x:v,y:T})&&S(o,null)),s=requestAnimationFrame(C)}function _(M){var Y;const{nodeLookup:I,multiSelectionActive:A,nodesDraggable:D,transform:v,snapGrid:T,snapToGrid:$,selectNodesOnDrag:j,onNodeDragStart:F,onSelectionDragStart:L,unselectNodesAndEdges:B}=t();u=!0,(!j||!g)&&!A&&x&&((Y=I.get(x))!=null&&Y.selected||B()),g&&j&&x&&(e==null||e(x));const V=ht(M.sourceEvent,{transform:v,snapGrid:T,snapToGrid:$,containerBounds:l});if(o=V,a=Fg(I,D,V,x),a.size>0&&(n||F||!x&&L)){const[R,P]=kr({nodeId:x,dragItems:a,nodeLookup:I});n==null||n(M.sourceEvent,a,R,P),F==null||F(M.sourceEvent,R,P),x||L==null||L(M.sourceEvent,P)}}const k=aa().clickDistance(N).on("start",M=>{const{domNode:I,nodeDragThreshold:A,transform:D,snapGrid:v,snapToGrid:T}=t();l=(I==null?void 0:I.getBoundingClientRect())||null,h=!1,A===0&&_(M),o=ht(M.sourceEvent,{transform:D,snapGrid:v,snapToGrid:T,containerBounds:l}),d=Ce(M.sourceEvent,l)}).on("drag",M=>{const{autoPanOnNodeDrag:I,transform:A,snapGrid:D,snapToGrid:v,nodeDragThreshold:T,nodeLookup:$}=t(),j=ht(M.sourceEvent,{transform:A,snapGrid:D,snapToGrid:v,containerBounds:l});if((M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||x&&!$.has(x))&&(h=!0),!h){if(!c&&I&&u&&(c=!0,C()),!u){const F=j.xSnapped-(o.x??0),L=j.ySnapped-(o.y??0);Math.sqrt(F*F+L*L)>T&&_(M)}(o.x!==j.xSnapped||o.y!==j.ySnapped)&&a&&u&&(d=Ce(M.sourceEvent,l),S(j,M.sourceEvent))}}).on("end",M=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:I,updateNodePositions:A,onNodeDragStop:D,onSelectionDragStop:v}=t();if(A(a,!1),i||D||!x&&v){const[T,$]=kr({nodeId:x,dragItems:a,nodeLookup:I,dragging:!1});i==null||i(M.sourceEvent,a,T,$),D==null||D(M.sourceEvent,T,$),x||v==null||v(M.sourceEvent,$)}}}).filter(M=>{const I=M.target;return!M.button&&(!m||!Zo(I,`.${m}`,b))&&(!w||Zo(I,w,b))});f.call(k)}function y(){f==null||f.on(".drag",null)}return{update:p,destroy:y}}function Vg(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())_t(i,tt(o))>0&&r.push(o);return r}const Bg=250;function qg(e,t,n,r){var a,c;let i=[],o=1/0;const s=Vg(e,n,t+Bg);for(const d of s){const l=[...((a=d.internals.handleBounds)==null?void 0:a.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of l){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=Et(d,u,u.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<o?(i=[{...u,x:f,y:h}],o=p):p===o&&i.push({...u,x:f,y:h}))}}if(!i.length)return null;if(i.length>1){const d=r.type==="source"?"target":"source";return i.find(l=>l.type===d)??i[0]}return i[0]}function qa(e,t,n,r,i,o=!1){var d,l,u;const s=r.get(e);if(!s)return null;const a=i==="strict"?(d=s.internals.handleBounds)==null?void 0:d[t]:[...((l=s.internals.handleBounds)==null?void 0:l.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&o?{...c,...Et(s,c,c.position,!0)}:c}function Ya(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Yg(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ga=()=>!0;function Gg(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:s,domNode:a,nodeLookup:c,lib:d,autoPanOnConnect:l,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:w=Ga,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:N,autoPanSpeed:S}){const C=Pa(e.target);let _=0,k;const{x:M,y:I}=Ce(e),A=C==null?void 0:C.elementFromPoint(M,I),D=Ya(o,A),v=a==null?void 0:a.getBoundingClientRect();if(!v||!D)return;const T=qa(i,D,r,c,t);if(!T)return;let $=Ce(e,v),j=!1,F=null,L=!1,B=null;function V(){if(!l||!v)return;const[U,Z]=$a($,v,S);f({x:U,y:Z}),_=requestAnimationFrame(V)}const Y={...T,nodeId:i,type:D,position:T.position},R=c.get(i),O={inProgress:!0,isValid:null,from:Et(R,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:R,to:$,toHandle:null,toPosition:zo[Y.position],toNode:null};g(O);let H=O;p==null||p(e,{nodeId:i,handleId:r,handleType:D});function q(U){if(!N()||!Y){G(U);return}const Z=x();$=Ce(U,v),k=qg(Mt($,Z,!1,[1,1]),n,c,Y),j||(V(),j=!0);const K=Wa(U,{handle:k,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:s?"target":"source",isValidConnection:w,doc:C,lib:d,flowId:u,nodeLookup:c});B=K.handleDomNode,F=K.connection,L=Yg(!!k,K.isValid);const X={...H,isValid:L,to:K.toHandle&&L?en({x:K.toHandle.x,y:K.toHandle.y},Z):$,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:zo[Y.position],toNode:K.toHandle?c.get(K.toHandle.nodeId):null};L&&k&&H.toHandle&&X.toHandle&&H.toHandle.type===X.toHandle.type&&H.toHandle.nodeId===X.toHandle.nodeId&&H.toHandle.id===X.toHandle.id&&H.to.x===X.to.x&&H.to.y===X.to.y||(g(X),H=X)}function G(U){(k||B)&&F&&L&&(y==null||y(F));const{inProgress:Z,...K}=H,X={...K,toPosition:H.toHandle?H.toPosition:null};m==null||m(U,X),o&&(b==null||b(U,X)),h(),cancelAnimationFrame(_),j=!1,L=!1,F=null,B=null,C.removeEventListener("mousemove",q),C.removeEventListener("mouseup",G),C.removeEventListener("touchmove",q),C.removeEventListener("touchend",G)}C.addEventListener("mousemove",q),C.addEventListener("mouseup",G),C.addEventListener("touchmove",q),C.addEventListener("touchend",G)}function Wa(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:s,lib:a,flowId:c,isValidConnection:d=Ga,nodeLookup:l}){const u=o==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Ce(e),y=s.elementFromPoint(h,p),m=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,w={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const b=Ya(void 0,m),g=m.getAttribute("data-nodeid"),x=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!g||!b)return w;const C={source:u?g:r,sourceHandle:u?x:i,target:u?r:g,targetHandle:u?i:x};w.connection=C;const k=N&&S&&(n===Je.Strict?u&&b==="source"||!u&&b==="target":g!==r||x!==i);w.isValid=k&&d(C),w.toHandle=qa(g,b,x,l,n,!0)}return w}const Ur={onPointerDown:Gg,isValid:Wa};function Wg({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=de(e);function o({translateExtent:a,width:c,height:d,zoomStep:l=10,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const p=g=>{const x=n();if(g.sourceEvent.type!=="wheel"||!t)return;const N=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*l,S=x[2]*Math.pow(2,N);t.scaleTo(S)};let y=[0,0];const m=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(y=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},w=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;const C=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),_={x:x[0]-S[0]*C,y:x[1]-S[1]*C},k=[[0,0],[c,d]];t.setViewportConstrained({x:_.x,y:_.y,zoom:x[2]},k,a)},b=_a().on("start",m).on("zoom",u?w:null).on("zoom.wheel",f?p:null);i.call(b,{})}function s(){i.on("zoom",null)}return{update:o,destroy:s,pointer:pe}}const Xg=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,mn=e=>({x:e.x,y:e.y,zoom:e.k}),Sr=({x:e,y:t,zoom:n})=>dn.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Xa=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Cr=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},Ua=e=>{const t=e.ctrlKey&&tn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ug({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:d}){return l=>{if(We(l,t))return!1;l.preventDefault(),l.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(l.ctrlKey&&s){const m=pe(l),w=Ua(l),b=u*Math.pow(2,w);r.scaleTo(n,b,m,l);return}const f=l.deltaMode===1?20:1;let h=i===De.Vertical?0:l.deltaX*f,p=i===De.Horizontal?0:l.deltaY*f;!tn()&&l.shiftKey&&i!==De.Vertical&&(h=l.deltaY*f,p=0),r.translateBy(n,-(h/u)*o,-(p/u)*o,{internal:!0});const y=mn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(l,y)),e.isPanScrolling&&(c==null||c(l,y),e.panScrollTimeout=setTimeout(()=>{d==null||d(l,y),e.isPanScrolling=!1},150))}}function Kg({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",s=!t&&o&&!r.ctrlKey,a=We(r,e);if(r.ctrlKey&&o&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,i)}}function Zg({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,s,a;if((o=r.sourceEvent)!=null&&o.internal)return;const i=mn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function Qg({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{var s,a;e.usedRightMouseButton=!!(n&&Xa(t,e.mouseButton??0)),(s=o.sourceEvent)!=null&&s.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!((a=o.sourceEvent)!=null&&a.internal)&&(i==null||i(o.sourceEvent,mn(o.transform)))}}function Jg({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,o&&Xa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&o(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),i&&Xg(e.prevViewport,s.transform))){const c=mn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(s.sourceEvent,c)},n?150:0)}}}function ep({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:d}){return l=>{var p;const u=e||t,f=n&&l.ctrlKey;if(l.button===1&&l.type==="mousedown"&&(We(l,`${d}-flow__node`)||We(l,`${d}-flow__edge`)))return!0;if(!r&&!u&&!i&&!o&&!n||s||We(l,a)&&l.type==="wheel"||We(l,c)&&(l.type!=="wheel"||i&&l.type==="wheel"&&!e)||!n&&l.ctrlKey&&l.type==="wheel")return!1;if(!n&&l.type==="touchstart"&&((p=l.touches)==null?void 0:p.length)>1)return l.preventDefault(),!1;if(!u&&!i&&!f&&l.type==="wheel"||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const h=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||l.type==="wheel")&&h}}function tp({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:i,viewport:o,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:d}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=_a().clickDistance(!ye(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(i),h=de(e).call(f);g({x:o.x,y:o.y,zoom:et(o.zoom,t,n)},[[0,0],[u.width,u.height]],i);const p=h.on("wheel.zoom"),y=h.on("dblclick.zoom");f.wheelDelta(Ua);function m(A,D){return h?new Promise(v=>{f==null||f.transform(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:D,onPaneContextMenu:v,userSelectionActive:T,panOnScroll:$,panOnDrag:j,panOnScrollMode:F,panOnScrollSpeed:L,preventScrolling:B,zoomOnPinch:V,zoomOnScroll:Y,zoomOnDoubleClick:R,zoomActivationKeyPressed:P,lib:O,onTransformChange:H}){T&&!l.isZoomingOrPanning&&b();const G=$&&!P&&!T?Ug({zoomPanValues:l,noWheelClassName:A,d3Selection:h,d3Zoom:f,panOnScrollMode:F,panOnScrollSpeed:L,zoomOnPinch:V,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Kg({noWheelClassName:A,preventScrolling:B,d3ZoomHandler:p});if(h.on("wheel.zoom",G,{passive:!1}),!T){const Z=Zg({zoomPanValues:l,onDraggingChange:d,onPanZoomStart:a});f.on("start",Z);const K=Qg({zoomPanValues:l,panOnDrag:j,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:H});f.on("zoom",K);const X=Jg({zoomPanValues:l,panOnDrag:j,panOnScroll:$,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:d});f.on("end",X)}const U=ep({zoomActivationKeyPressed:P,panOnDrag:j,zoomOnScroll:Y,panOnScroll:$,zoomOnDoubleClick:R,zoomOnPinch:V,userSelectionActive:T,noPanClassName:D,noWheelClassName:A,lib:O});f.filter(U),R?h.on("dblclick.zoom",y):h.on("dblclick.zoom",null)}function b(){f.on("zoom",null)}async function g(A,D,v){const T=Sr(A),$=f==null?void 0:f.constrain()(T,D,v);return $&&await m($),new Promise(j=>j($))}async function x(A,D){const v=Sr(A);return await m(v,D),new Promise(T=>T(v))}function N(A){if(h){const D=Sr(A),v=h.property("__zoom");(v.k!==A.zoom||v.x!==A.x||v.y!==A.y)&&(f==null||f.transform(h,D,null,{sync:!0}))}}function S(){const A=h?va(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function C(A,D){return h?new Promise(v=>{f==null||f.scaleTo(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function _(A,D){return h?new Promise(v=>{f==null||f.scaleBy(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function k(A){f==null||f.scaleExtent(A)}function M(A){f==null||f.translateExtent(A)}function I(A){const D=!ye(A)||A<0?0:A;f==null||f.clickDistance(D)}return{update:w,destroy:b,setViewport:x,setViewportConstrained:g,getViewport:S,scaleTo:C,scaleBy:_,setScaleExtent:k,setTranslateExtent:M,syncViewport:N,setClickDistance:I}}var gt;(function(e){e.Line="line",e.Handle="handle"})(gt||(gt={}));function np({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&i&&(c[0]=c[0]*-1),a&&o&&(c[1]=c[1]*-1),c}function rp(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Re(e,t){return Math.max(0,t-e)}function Te(e,t){return Math.max(0,e-t)}function Dt(e,t,n){return Math.max(0,t-e,e-n)}function Qo(e,t){return e?!t:t}function ip(e,t,n,r,i,o,s,a){let{affectsX:c,affectsY:d}=t;const{isHorizontal:l,isVertical:u}=t,f=l&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:w,maxHeight:b}=r,{x:g,y:x,width:N,height:S,aspectRatio:C}=e;let _=Math.floor(l?h-e.pointerX:0),k=Math.floor(u?p-e.pointerY:0);const M=N+(c?-_:_),I=S+(d?-k:k),A=-o[0]*N,D=-o[1]*S;let v=Dt(M,y,m),T=Dt(I,w,b);if(s){let F=0,L=0;c&&_<0?F=Re(g+_+A,s[0][0]):!c&&_>0&&(F=Te(g+M+A,s[1][0])),d&&k<0?L=Re(x+k+D,s[0][1]):!d&&k>0&&(L=Te(x+I+D,s[1][1])),v=Math.max(v,F),T=Math.max(T,L)}if(a){let F=0,L=0;c&&_>0?F=Te(g+_,a[0][0]):!c&&_<0&&(F=Re(g+M,a[1][0])),d&&k>0?L=Te(x+k,a[0][1]):!d&&k<0&&(L=Re(x+I,a[1][1])),v=Math.max(v,F),T=Math.max(T,L)}if(i){if(l){const F=Dt(M/C,w,b)*C;if(v=Math.max(v,F),s){let L=0;!c&&!d||c&&!d&&f?L=Te(x+D+M/C,s[1][1])*C:L=Re(x+D+(c?_:-_)/C,s[0][1])*C,v=Math.max(v,L)}if(a){let L=0;!c&&!d||c&&!d&&f?L=Re(x+M/C,a[1][1])*C:L=Te(x+(c?_:-_)/C,a[0][1])*C,v=Math.max(v,L)}}if(u){const F=Dt(I*C,y,m)/C;if(T=Math.max(T,F),s){let L=0;!c&&!d||d&&!c&&f?L=Te(g+I*C+A,s[1][0])/C:L=Re(g+(d?k:-k)*C+A,s[0][0])/C,T=Math.max(T,L)}if(a){let L=0;!c&&!d||d&&!c&&f?L=Re(g+I*C,a[1][0])/C:L=Te(g+(d?k:-k)*C,a[0][0])/C,T=Math.max(T,L)}}}k=k+(k<0?T:-T),_=_+(_<0?v:-v),i&&(f?M>I*C?k=(Qo(c,d)?-_:_)/C:_=(Qo(c,d)?-k:k)*C:l?(k=_/C,d=c):(_=k*C,c=d));const $=c?g+_:g,j=d?x+k:x;return{width:N+(c?-_:_),height:S+(d?-k:k),x:o[0]*_*(c?-1:1)+$,y:o[1]*k*(d?-1:1)+j}}const Ka={width:0,height:0,x:0,y:0},op={...Ka,pointerX:0,pointerY:0,aspectRatio:1};function sp(e){return[[0,0],[e.measured.width,e.measured.height]]}function ap(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,s=e.measured.height??0,a=n[0]*o,c=n[1]*s;return[[r-a,i-c],[r+o-a,i+s-c]]}function cp({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=de(e);function s({controlPosition:c,boundaries:d,keepAspectRatio:l,resizeDirection:u,onResizeStart:f,onResize:h,onResizeEnd:p,shouldResize:y}){let m={...Ka},w={...op};const b=rp(c);let g,x=null,N=[],S,C,_;const k=aa().on("start",M=>{const{nodeLookup:I,transform:A,snapGrid:D,snapToGrid:v,nodeOrigin:T,paneDomNode:$}=n();if(g=I.get(t),!g)return;x=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:F}=ht(M.sourceEvent,{transform:A,snapGrid:D,snapToGrid:v,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},w={...m,pointerX:j,pointerY:F,aspectRatio:m.width/m.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=I.get(g.parentId),C=S&&g.extent==="parent"?sp(S):void 0),N=[],_=void 0;for(const[L,B]of I)if(B.parentId===t&&(N.push({id:L,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const V=ap(B,g,B.origin??T);_?_=[[Math.min(V[0][0],_[0][0]),Math.min(V[0][1],_[0][1])],[Math.max(V[1][0],_[1][0]),Math.max(V[1][1],_[1][1])]]:_=V}f==null||f(M,{...m})}).on("drag",M=>{const{transform:I,snapGrid:A,snapToGrid:D,nodeOrigin:v}=n(),T=ht(M.sourceEvent,{transform:I,snapGrid:A,snapToGrid:D,containerBounds:x}),$=[];if(!g)return;const{x:j,y:F,width:L,height:B}=m,V={},Y=g.origin??v,{width:R,height:P,x:O,y:H}=ip(w,b,T,d,l,Y,C,_),q=R!==L,G=P!==B,U=O!==j&&q,Z=H!==F&&G;if(!U&&!Z&&!q&&!G)return;if((U||Z||Y[0]===1||Y[1]===1)&&(V.x=U?O:m.x,V.y=Z?H:m.y,m.x=V.x,m.y=V.y,N.length>0)){const ee=O-j,re=H-F;for(const ae of N)ae.position={x:ae.position.x-ee+Y[0]*(R-L),y:ae.position.y-re+Y[1]*(P-B)},$.push(ae)}if((q||G)&&(V.width=q&&(!u||u==="horizontal")?R:m.width,V.height=G&&(!u||u==="vertical")?P:m.height,m.width=V.width,m.height=V.height),S&&g.expandParent){const ee=Y[0]*(V.width??0);V.x&&V.x<ee&&(m.x=ee,w.x=w.x-(V.x-ee));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(m.y=re,w.y=w.y-(V.y-re))}const K=np({width:m.width,prevWidth:L,height:m.height,prevHeight:B,affectsX:b.affectsX,affectsY:b.affectsY}),X={...m,direction:K};(y==null?void 0:y(M,X))!==!1&&(h==null||h(M,X),r(V,$))}).on("end",M=>{p==null||p(M,{...m}),i==null||i({...m})});o.call(k)}function a(){o.on(".drag",null)}return{update:s,destroy:a}}var Mr={exports:{}},Ir={},Ar={exports:{}},$r={};/**
|
|
1
|
+
var Dl=Object.defineProperty;var zl=(e,t,n)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>zl(e,typeof t!="symbol"?t+"":t,n);import{ac as Os,ar as Ds,as as Fl,at as Hl,r as z,j as E,b as sn,F as he,au as Vl,av as Bl,aw as ql,ax as Yl,ay as Gl,az as Wl,aA as Xl,aB as Ul,aC as Kl,aD as Zl,L as Qr,t as Jr,V as ei}from"./index-CwJt2ZPU.js";import{a as Cn}from"./index-C2eewgcx.js";import{D as zs}from"./DeviceImage-B6F8WQJo.js";import"./index-B5pN5VmG.js";var Mn,Ci;function ti(){if(Ci)return Mn;Ci=1;var e="\0",t="\0",n="";class r{constructor(l){oe(this,"_isDirected",!0);oe(this,"_isMultigraph",!1);oe(this,"_isCompound",!1);oe(this,"_label");oe(this,"_defaultNodeLabelFn",()=>{});oe(this,"_defaultEdgeLabelFn",()=>{});oe(this,"_nodes",{});oe(this,"_in",{});oe(this,"_preds",{});oe(this,"_out",{});oe(this,"_sucs",{});oe(this,"_edgeObjs",{});oe(this,"_edgeLabels",{});oe(this,"_nodeCount",0);oe(this,"_edgeCount",0);oe(this,"_parent");oe(this,"_children");l&&(this._isDirected=Object.hasOwn(l,"directed")?l.directed:!0,this._isMultigraph=Object.hasOwn(l,"multigraph")?l.multigraph:!1,this._isCompound=Object.hasOwn(l,"compound")?l.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(l){return this._label=l,this}graph(){return this._label}setDefaultNodeLabel(l){return this._defaultNodeLabelFn=l,typeof l!="function"&&(this._defaultNodeLabelFn=()=>l),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var l=this;return this.nodes().filter(u=>Object.keys(l._in[u]).length===0)}sinks(){var l=this;return this.nodes().filter(u=>Object.keys(l._out[u]).length===0)}setNodes(l,u){var f=arguments,h=this;return l.forEach(function(p){f.length>1?h.setNode(p,u):h.setNode(p)}),this}setNode(l,u){return Object.hasOwn(this._nodes,l)?(arguments.length>1&&(this._nodes[l]=u),this):(this._nodes[l]=arguments.length>1?u:this._defaultNodeLabelFn(l),this._isCompound&&(this._parent[l]=t,this._children[l]={},this._children[t][l]=!0),this._in[l]={},this._preds[l]={},this._out[l]={},this._sucs[l]={},++this._nodeCount,this)}node(l){return this._nodes[l]}hasNode(l){return Object.hasOwn(this._nodes,l)}removeNode(l){var u=this;if(Object.hasOwn(this._nodes,l)){var f=h=>u.removeEdge(u._edgeObjs[h]);delete this._nodes[l],this._isCompound&&(this._removeFromParentsChildList(l),delete this._parent[l],this.children(l).forEach(function(h){u.setParent(h)}),delete this._children[l]),Object.keys(this._in[l]).forEach(f),delete this._in[l],delete this._preds[l],Object.keys(this._out[l]).forEach(f),delete this._out[l],delete this._sucs[l],--this._nodeCount}return this}setParent(l,u){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(u===void 0)u=t;else{u+="";for(var f=u;f!==void 0;f=this.parent(f))if(f===l)throw new Error("Setting "+u+" as parent of "+l+" would create a cycle");this.setNode(u)}return this.setNode(l),this._removeFromParentsChildList(l),this._parent[l]=u,this._children[u][l]=!0,this}_removeFromParentsChildList(l){delete this._children[this._parent[l]][l]}parent(l){if(this._isCompound){var u=this._parent[l];if(u!==t)return u}}children(l=t){if(this._isCompound){var u=this._children[l];if(u)return Object.keys(u)}else{if(l===t)return this.nodes();if(this.hasNode(l))return[]}}predecessors(l){var u=this._preds[l];if(u)return Object.keys(u)}successors(l){var u=this._sucs[l];if(u)return Object.keys(u)}neighbors(l){var u=this.predecessors(l);if(u){const h=new Set(u);for(var f of this.successors(l))h.add(f);return Array.from(h.values())}}isLeaf(l){var u;return this.isDirected()?u=this.successors(l):u=this.neighbors(l),u.length===0}filterNodes(l){var u=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});u.setGraph(this.graph());var f=this;Object.entries(this._nodes).forEach(function([y,m]){l(y)&&u.setNode(y,m)}),Object.values(this._edgeObjs).forEach(function(y){u.hasNode(y.v)&&u.hasNode(y.w)&&u.setEdge(y,f.edge(y))});var h={};function p(y){var m=f.parent(y);return m===void 0||u.hasNode(m)?(h[y]=m,m):m in h?h[m]:p(m)}return this._isCompound&&u.nodes().forEach(y=>u.setParent(y,p(y))),u}setDefaultEdgeLabel(l){return this._defaultEdgeLabelFn=l,typeof l!="function"&&(this._defaultEdgeLabelFn=()=>l),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(l,u){var f=this,h=arguments;return l.reduce(function(p,y){return h.length>1?f.setEdge(p,y,u):f.setEdge(p,y),y}),this}setEdge(){var l,u,f,h,p=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(l=y.v,u=y.w,f=y.name,arguments.length===2&&(h=arguments[1],p=!0)):(l=y,u=arguments[1],f=arguments[3],arguments.length>2&&(h=arguments[2],p=!0)),l=""+l,u=""+u,f!==void 0&&(f=""+f);var m=s(this._isDirected,l,u,f);if(Object.hasOwn(this._edgeLabels,m))return p&&(this._edgeLabels[m]=h),this;if(f!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(u),this._edgeLabels[m]=p?h:this._defaultEdgeLabelFn(l,u,f);var w=a(this._isDirected,l,u,f);return l=w.v,u=w.w,Object.freeze(w),this._edgeObjs[m]=w,i(this._preds[u],l),i(this._sucs[l],u),this._in[u][m]=w,this._out[l][m]=w,this._edgeCount++,this}edge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f);return this._edgeLabels[h]}edgeAsObj(){const l=this.edge(...arguments);return typeof l!="object"?{label:l}:l}hasEdge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f);return Object.hasOwn(this._edgeLabels,h)}removeEdge(l,u,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,l,u,f),p=this._edgeObjs[h];return p&&(l=p.v,u=p.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[u],l),o(this._sucs[l],u),delete this._in[u][h],delete this._out[l][h],this._edgeCount--),this}inEdges(l,u){var f=this._in[l];if(f){var h=Object.values(f);return u?h.filter(p=>p.v===u):h}}outEdges(l,u){var f=this._out[l];if(f){var h=Object.values(f);return u?h.filter(p=>p.w===u):h}}nodeEdges(l,u){var f=this.inEdges(l,u);if(f)return f.concat(this.outEdges(l,u))}}function i(d,l){d[l]?d[l]++:d[l]=1}function o(d,l){--d[l]||delete d[l]}function s(d,l,u,f){var h=""+l,p=""+u;if(!d&&h>p){var y=h;h=p,p=y}return h+n+p+n+(f===void 0?e:f)}function a(d,l,u,f){var h=""+l,p=""+u;if(!d&&h>p){var y=h;h=p,p=y}var m={v:h,w:p};return f&&(m.name=f),m}function c(d,l){return s(d,l.v,l.w,l.name)}return Mn=r,Mn}var In,Mi;function Ql(){return Mi||(Mi=1,In="2.2.4"),In}var An,Ii;function Jl(){return Ii||(Ii=1,An={Graph:ti(),version:Ql()}),An}var $n,Ai;function eu(){if(Ai)return $n;Ai=1;var e=ti();$n={write:t,read:i};function t(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:r(o)};return o.graph()!==void 0&&(s.value=structuredClone(o.graph())),s}function n(o){return o.nodes().map(function(s){var a=o.node(s),c=o.parent(s),d={v:s};return a!==void 0&&(d.value=a),c!==void 0&&(d.parent=c),d})}function r(o){return o.edges().map(function(s){var a=o.edge(s),c={v:s.v,w:s.w};return s.name!==void 0&&(c.name=s.name),a!==void 0&&(c.value=a),c})}function i(o){var s=new e(o.options).setGraph(o.value);return o.nodes.forEach(function(a){s.setNode(a.v,a.value),a.parent&&s.setParent(a.v,a.parent)}),o.edges.forEach(function(a){s.setEdge({v:a.v,w:a.w,name:a.name},a.value)}),s}return $n}var Rn,$i;function tu(){if($i)return Rn;$i=1,Rn=e;function e(t){var n={},r=[],i;function o(s){Object.hasOwn(n,s)||(n[s]=!0,i.push(s),t.successors(s).forEach(o),t.predecessors(s).forEach(o))}return t.nodes().forEach(function(s){i=[],o(s),i.length&&r.push(i)}),r}return Rn}var Tn,Ri;function Fs(){if(Ri)return Tn;Ri=1;class e{constructor(){oe(this,"_arr",[]);oe(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,r){var i=this._keyIndices;if(n=String(n),!Object.hasOwn(i,n)){var o=this._arr,s=o.length;return i[n]=s,o.push({key:n,priority:r}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,r){var i=this._keyIndices[n];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)}_heapify(n){var r=this._arr,i=2*n,o=i+1,s=n;i<r.length&&(s=r[i].priority<r[s].priority?i:s,o<r.length&&(s=r[o].priority<r[s].priority?o:s),s!==n&&(this._swap(n,s),this._heapify(s)))}_decrease(n){for(var r=this._arr,i=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<i));)this._swap(n,o),n=o}_swap(n,r){var i=this._arr,o=this._keyIndices,s=i[n],a=i[r];i[n]=a,i[r]=s,o[a.key]=n,o[s.key]=r}}return Tn=e,Tn}var jn,Ti;function Hs(){if(Ti)return jn;Ti=1;var e=Fs();jn=n;var t=()=>1;function n(i,o,s,a){return r(i,String(o),s||t,a||function(c){return i.outEdges(c)})}function r(i,o,s,a){var c={},d=new e,l,u,f=function(h){var p=h.v!==l?h.v:h.w,y=c[p],m=s(h),w=u.distance+m;if(m<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+m);w<y.distance&&(y.distance=w,y.predecessor=l,d.decrease(p,w))};for(i.nodes().forEach(function(h){var p=h===o?0:Number.POSITIVE_INFINITY;c[h]={distance:p},d.add(h,p)});d.size()>0&&(l=d.removeMin(),u=c[l],u.distance!==Number.POSITIVE_INFINITY);)a(l).forEach(f);return c}return jn}var Pn,ji;function nu(){if(ji)return Pn;ji=1;var e=Hs();Pn=t;function t(n,r,i){return n.nodes().reduce(function(o,s){return o[s]=e(n,s,r,i),o},{})}return Pn}var Ln,Pi;function Vs(){if(Pi)return Ln;Pi=1,Ln=e;function e(t){var n=0,r=[],i={},o=[];function s(a){var c=i[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),t.successors(a).forEach(function(u){Object.hasOwn(i,u)?i[u].onStack&&(c.lowlink=Math.min(c.lowlink,i[u].index)):(s(u),c.lowlink=Math.min(c.lowlink,i[u].lowlink))}),c.lowlink===c.index){var d=[],l;do l=r.pop(),i[l].onStack=!1,d.push(l);while(a!==l);o.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(i,a)||s(a)}),o}return Ln}var On,Li;function ru(){if(Li)return On;Li=1;var e=Vs();On=t;function t(n){return e(n).filter(function(r){return r.length>1||r.length===1&&n.hasEdge(r[0],r[0])})}return On}var Dn,Oi;function iu(){if(Oi)return Dn;Oi=1,Dn=t;var e=()=>1;function t(r,i,o){return n(r,i||e,o||function(s){return r.outEdges(s)})}function n(r,i,o){var s={},a=r.nodes();return a.forEach(function(c){s[c]={},s[c][c]={distance:0},a.forEach(function(d){c!==d&&(s[c][d]={distance:Number.POSITIVE_INFINITY})}),o(c).forEach(function(d){var l=d.v===c?d.w:d.v,u=i(d);s[c][l]={distance:u,predecessor:c}})}),a.forEach(function(c){var d=s[c];a.forEach(function(l){var u=s[l];a.forEach(function(f){var h=u[c],p=d[f],y=u[f],m=h.distance+p.distance;m<y.distance&&(y.distance=m,y.predecessor=p.predecessor)})})}),s}return Dn}var zn,Di;function Bs(){if(Di)return zn;Di=1;function e(n){var r={},i={},o=[];function s(a){if(Object.hasOwn(i,a))throw new t;Object.hasOwn(r,a)||(i[a]=!0,r[a]=!0,n.predecessors(a).forEach(s),delete i[a],o.push(a))}if(n.sinks().forEach(s),Object.keys(r).length!==n.nodeCount())throw new t;return o}class t extends Error{constructor(){super(...arguments)}}return zn=e,e.CycleException=t,zn}var Fn,zi;function ou(){if(zi)return Fn;zi=1;var e=Bs();Fn=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Fn}var Hn,Fi;function qs(){if(Fi)return Hn;Fi=1,Hn=e;function e(i,o,s){Array.isArray(o)||(o=[o]);var a=i.isDirected()?u=>i.successors(u):u=>i.neighbors(u),c=s==="post"?t:n,d=[],l={};return o.forEach(u=>{if(!i.hasNode(u))throw new Error("Graph does not have node: "+u);c(u,a,l,d)}),d}function t(i,o,s,a){for(var c=[[i,!1]];c.length>0;){var d=c.pop();d[1]?a.push(d[0]):Object.hasOwn(s,d[0])||(s[d[0]]=!0,c.push([d[0],!0]),r(o(d[0]),l=>c.push([l,!1])))}}function n(i,o,s,a){for(var c=[i];c.length>0;){var d=c.pop();Object.hasOwn(s,d)||(s[d]=!0,a.push(d),r(o(d),l=>c.push(l)))}}function r(i,o){for(var s=i.length;s--;)o(i[s],s,i);return i}return Hn}var Vn,Hi;function su(){if(Hi)return Vn;Hi=1;var e=qs();Vn=t;function t(n,r){return e(n,r,"post")}return Vn}var Bn,Vi;function au(){if(Vi)return Bn;Vi=1;var e=qs();Bn=t;function t(n,r){return e(n,r,"pre")}return Bn}var qn,Bi;function cu(){if(Bi)return qn;Bi=1;var e=ti(),t=Fs();qn=n;function n(r,i){var o=new e,s={},a=new t,c;function d(u){var f=u.v===c?u.w:u.v,h=a.priority(f);if(h!==void 0){var p=i(u);p<h&&(s[f]=c,a.decrease(f,p))}}if(r.nodeCount()===0)return o;r.nodes().forEach(function(u){a.add(u,Number.POSITIVE_INFINITY),o.setNode(u)}),a.decrease(r.nodes()[0],0);for(var l=!1;a.size()>0;){if(c=a.removeMin(),Object.hasOwn(s,c))o.setEdge(c,s[c]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(c).forEach(d)}return o}return qn}var Yn,qi;function lu(){return qi||(qi=1,Yn={components:tu(),dijkstra:Hs(),dijkstraAll:nu(),findCycles:ru(),floydWarshall:iu(),isAcyclic:ou(),postorder:su(),preorder:au(),prim:cu(),tarjan:Vs(),topsort:Bs()}),Yn}var Gn,Yi;function xe(){if(Yi)return Gn;Yi=1;var e=Jl();return Gn={Graph:e.Graph,json:eu(),alg:lu(),version:e.version},Gn}var Wn,Gi;function uu(){if(Gi)return Wn;Gi=1;class e{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,o=i._prev;if(o!==i)return t(o),o}enqueue(i){let o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o}toString(){let i=[],o=this._sentinel,s=o._prev;for(;s!==o;)i.push(JSON.stringify(s,n)),s=s._prev;return"["+i.join(", ")+"]"}}function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,i){if(r!=="_next"&&r!=="_prev")return i}return Wn=e,Wn}var Xn,Wi;function du(){if(Wi)return Xn;Wi=1;let e=xe().Graph,t=uu();Xn=r;let n=()=>1;function r(d,l){if(d.nodeCount()<=1)return[];let u=s(d,l||n);return i(u.graph,u.buckets,u.zeroIdx).flatMap(h=>d.outEdges(h.v,h.w))}function i(d,l,u){let f=[],h=l[l.length-1],p=l[0],y;for(;d.nodeCount();){for(;y=p.dequeue();)o(d,l,u,y);for(;y=h.dequeue();)o(d,l,u,y);if(d.nodeCount()){for(let m=l.length-2;m>0;--m)if(y=l[m].dequeue(),y){f=f.concat(o(d,l,u,y,!0));break}}}return f}function o(d,l,u,f,h){let p=h?[]:void 0;return d.inEdges(f.v).forEach(y=>{let m=d.edge(y),w=d.node(y.v);h&&p.push({v:y.v,w:y.w}),w.out-=m,a(l,u,w)}),d.outEdges(f.v).forEach(y=>{let m=d.edge(y),w=y.w,b=d.node(w);b.in-=m,a(l,u,b)}),d.removeNode(f.v),p}function s(d,l){let u=new e,f=0,h=0;d.nodes().forEach(m=>{u.setNode(m,{v:m,in:0,out:0})}),d.edges().forEach(m=>{let w=u.edge(m.v,m.w)||0,b=l(m),g=w+b;u.setEdge(m.v,m.w,g),h=Math.max(h,u.node(m.v).out+=b),f=Math.max(f,u.node(m.w).in+=b)});let p=c(h+f+3).map(()=>new t),y=f+1;return u.nodes().forEach(m=>{a(p,y,u.node(m))}),{graph:u,buckets:p,zeroIdx:y}}function a(d,l,u){u.out?u.in?d[u.out-u.in+l].enqueue(u):d[d.length-1].enqueue(u):d[0].enqueue(u)}function c(d){const l=[];for(let u=0;u<d;u++)l.push(u);return l}return Xn}var Un,Xi;function se(){if(Xi)return Un;Xi=1;let e=xe().Graph;Un={addBorderNode:l,addDummyNode:t,applyWithChunking:h,asNonCompoundGraph:r,buildLayerMatrix:a,intersectRect:s,mapValues:S,maxRank:p,normalizeRanks:c,notime:w,partition:y,pick:N,predecessorWeights:o,range:x,removeEmptyRanks:d,simplify:n,successorWeights:i,time:m,uniqueId:g,zipObject:C};function t(_,k,M,I){let A;do A=g(I);while(_.hasNode(A));return M.dummy=k,_.setNode(A,M),A}function n(_){let k=new e().setGraph(_.graph());return _.nodes().forEach(M=>k.setNode(M,_.node(M))),_.edges().forEach(M=>{let I=k.edge(M.v,M.w)||{weight:0,minlen:1},A=_.edge(M);k.setEdge(M.v,M.w,{weight:I.weight+A.weight,minlen:Math.max(I.minlen,A.minlen)})}),k}function r(_){let k=new e({multigraph:_.isMultigraph()}).setGraph(_.graph());return _.nodes().forEach(M=>{_.children(M).length||k.setNode(M,_.node(M))}),_.edges().forEach(M=>{k.setEdge(M,_.edge(M))}),k}function i(_){let k=_.nodes().map(M=>{let I={};return _.outEdges(M).forEach(A=>{I[A.w]=(I[A.w]||0)+_.edge(A).weight}),I});return C(_.nodes(),k)}function o(_){let k=_.nodes().map(M=>{let I={};return _.inEdges(M).forEach(A=>{I[A.v]=(I[A.v]||0)+_.edge(A).weight}),I});return C(_.nodes(),k)}function s(_,k){let M=_.x,I=_.y,A=k.x-M,D=k.y-I,v=_.width/2,T=_.height/2;if(!A&&!D)throw new Error("Not possible to find intersection inside of the rectangle");let $,j;return Math.abs(D)*v>Math.abs(A)*T?(D<0&&(T=-T),$=T*A/D,j=T):(A<0&&(v=-v),$=v,j=v*D/A),{x:M+$,y:I+j}}function a(_){let k=x(p(_)+1).map(()=>[]);return _.nodes().forEach(M=>{let I=_.node(M),A=I.rank;A!==void 0&&(k[A][I.order]=M)}),k}function c(_){let k=_.nodes().map(I=>{let A=_.node(I).rank;return A===void 0?Number.MAX_VALUE:A}),M=h(Math.min,k);_.nodes().forEach(I=>{let A=_.node(I);Object.hasOwn(A,"rank")&&(A.rank-=M)})}function d(_){let k=_.nodes().map(v=>_.node(v).rank),M=h(Math.min,k),I=[];_.nodes().forEach(v=>{let T=_.node(v).rank-M;I[T]||(I[T]=[]),I[T].push(v)});let A=0,D=_.graph().nodeRankFactor;Array.from(I).forEach((v,T)=>{v===void 0&&T%D!==0?--A:v!==void 0&&A&&v.forEach($=>_.node($).rank+=A)})}function l(_,k,M,I){let A={width:0,height:0};return arguments.length>=4&&(A.rank=M,A.order=I),t(_,"border",A,k)}function u(_,k=f){const M=[];for(let I=0;I<_.length;I+=k){const A=_.slice(I,I+k);M.push(A)}return M}const f=65535;function h(_,k){if(k.length>f){const M=u(k);return _.apply(null,M.map(I=>_.apply(null,I)))}else return _.apply(null,k)}function p(_){const M=_.nodes().map(I=>{let A=_.node(I).rank;return A===void 0?Number.MIN_VALUE:A});return h(Math.max,M)}function y(_,k){let M={lhs:[],rhs:[]};return _.forEach(I=>{k(I)?M.lhs.push(I):M.rhs.push(I)}),M}function m(_,k){let M=Date.now();try{return k()}finally{console.log(_+" time: "+(Date.now()-M)+"ms")}}function w(_,k){return k()}let b=0;function g(_){var k=++b;return toString(_)+k}function x(_,k,M=1){k==null&&(k=_,_=0);let I=D=>D<k;M<0&&(I=D=>k<D);const A=[];for(let D=_;I(D);D+=M)A.push(D);return A}function N(_,k){const M={};for(const I of k)_[I]!==void 0&&(M[I]=_[I]);return M}function S(_,k){let M=k;return typeof k=="string"&&(M=I=>I[k]),Object.entries(_).reduce((I,[A,D])=>(I[A]=M(D,A),I),{})}function C(_,k){return _.reduce((M,I,A)=>(M[I]=k[A],M),{})}return Un}var Kn,Ui;function fu(){if(Ui)return Kn;Ui=1;let e=du(),t=se().uniqueId;Kn={run:n,undo:i};function n(o){(o.graph().acyclicer==="greedy"?e(o,a(o)):r(o)).forEach(c=>{let d=o.edge(c);o.removeEdge(c),d.forwardName=c.name,d.reversed=!0,o.setEdge(c.w,c.v,d,t("rev"))});function a(c){return d=>c.edge(d).weight}}function r(o){let s=[],a={},c={};function d(l){Object.hasOwn(c,l)||(c[l]=!0,a[l]=!0,o.outEdges(l).forEach(u=>{Object.hasOwn(a,u.w)?s.push(u):d(u.w)}),delete a[l])}return o.nodes().forEach(d),s}function i(o){o.edges().forEach(s=>{let a=o.edge(s);if(a.reversed){o.removeEdge(s);let c=a.forwardName;delete a.reversed,delete a.forwardName,o.setEdge(s.w,s.v,a,c)}})}return Kn}var Zn,Ki;function hu(){if(Ki)return Zn;Ki=1;let e=se();Zn={run:t,undo:r};function t(i){i.graph().dummyChains=[],i.edges().forEach(o=>n(i,o))}function n(i,o){let s=o.v,a=i.node(s).rank,c=o.w,d=i.node(c).rank,l=o.name,u=i.edge(o),f=u.labelRank;if(d===a+1)return;i.removeEdge(o);let h,p,y;for(y=0,++a;a<d;++y,++a)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:o,rank:a},h=e.addDummyNode(i,"edge",p,"_d"),a===f&&(p.width=u.width,p.height=u.height,p.dummy="edge-label",p.labelpos=u.labelpos),i.setEdge(s,h,{weight:u.weight},l),y===0&&i.graph().dummyChains.push(h),s=h;i.setEdge(s,c,{weight:u.weight},l)}function r(i){i.graph().dummyChains.forEach(o=>{let s=i.node(o),a=s.edgeLabel,c;for(i.setEdge(s.edgeObj,a);s.dummy;)c=i.successors(o)[0],i.removeNode(o),a.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(a.x=s.x,a.y=s.y,a.width=s.width,a.height=s.height),o=c,s=i.node(o)})}return Zn}var Qn,Zi;function Yt(){if(Zi)return Qn;Zi=1;const{applyWithChunking:e}=se();Qn={longestPath:t,slack:n};function t(r){var i={};function o(s){var a=r.node(s);if(Object.hasOwn(i,s))return a.rank;i[s]=!0;let c=r.outEdges(s).map(l=>l==null?Number.POSITIVE_INFINITY:o(l.w)-r.edge(l).minlen);var d=e(Math.min,c);return d===Number.POSITIVE_INFINITY&&(d=0),a.rank=d}r.sources().forEach(o)}function n(r,i){return r.node(i.w).rank-r.node(i.v).rank-r.edge(i).minlen}return Qn}var Jn,Qi;function Ys(){if(Qi)return Jn;Qi=1;var e=xe().Graph,t=Yt().slack;Jn=n;function n(s){var a=new e({directed:!1}),c=s.nodes()[0],d=s.nodeCount();a.setNode(c,{});for(var l,u;r(a,s)<d;)l=i(a,s),u=a.hasNode(l.v)?t(s,l):-t(s,l),o(a,s,u);return a}function r(s,a){function c(d){a.nodeEdges(d).forEach(l=>{var u=l.v,f=d===u?l.w:u;!s.hasNode(f)&&!t(a,l)&&(s.setNode(f,{}),s.setEdge(d,f,{}),c(f))})}return s.nodes().forEach(c),s.nodeCount()}function i(s,a){return a.edges().reduce((d,l)=>{let u=Number.POSITIVE_INFINITY;return s.hasNode(l.v)!==s.hasNode(l.w)&&(u=t(a,l)),u<d[0]?[u,l]:d},[Number.POSITIVE_INFINITY,null])[1]}function o(s,a,c){s.nodes().forEach(d=>a.node(d).rank+=c)}return Jn}var er,Ji;function gu(){if(Ji)return er;Ji=1;var e=Ys(),t=Yt().slack,n=Yt().longestPath,r=xe().alg.preorder,i=xe().alg.postorder,o=se().simplify;er=s,s.initLowLimValues=l,s.initCutValues=a,s.calcCutValue=d,s.leaveEdge=f,s.enterEdge=h,s.exchangeEdges=p;function s(b){b=o(b),n(b);var g=e(b);l(g),a(g,b);for(var x,N;x=f(g);)N=h(g,b,x),p(g,b,x,N)}function a(b,g){var x=i(b,b.nodes());x=x.slice(0,x.length-1),x.forEach(N=>c(b,g,N))}function c(b,g,x){var N=b.node(x),S=N.parent;b.edge(x,S).cutvalue=d(b,g,x)}function d(b,g,x){var N=b.node(x),S=N.parent,C=!0,_=g.edge(x,S),k=0;return _||(C=!1,_=g.edge(S,x)),k=_.weight,g.nodeEdges(x).forEach(M=>{var I=M.v===x,A=I?M.w:M.v;if(A!==S){var D=I===C,v=g.edge(M).weight;if(k+=D?v:-v,m(b,x,A)){var T=b.edge(x,A).cutvalue;k+=D?-T:T}}}),k}function l(b,g){arguments.length<2&&(g=b.nodes()[0]),u(b,{},1,g)}function u(b,g,x,N,S){var C=x,_=b.node(N);return g[N]=!0,b.neighbors(N).forEach(k=>{Object.hasOwn(g,k)||(x=u(b,g,x,k,N))}),_.low=C,_.lim=x++,S?_.parent=S:delete _.parent,x}function f(b){return b.edges().find(g=>b.edge(g).cutvalue<0)}function h(b,g,x){var N=x.v,S=x.w;g.hasEdge(N,S)||(N=x.w,S=x.v);var C=b.node(N),_=b.node(S),k=C,M=!1;C.lim>_.lim&&(k=_,M=!0);var I=g.edges().filter(A=>M===w(b,b.node(A.v),k)&&M!==w(b,b.node(A.w),k));return I.reduce((A,D)=>t(g,D)<t(g,A)?D:A)}function p(b,g,x,N){var S=x.v,C=x.w;b.removeEdge(S,C),b.setEdge(N.v,N.w,{}),l(b),a(b,g),y(b,g)}function y(b,g){var x=b.nodes().find(S=>!g.node(S).parent),N=r(b,x);N=N.slice(1),N.forEach(S=>{var C=b.node(S).parent,_=g.edge(S,C),k=!1;_||(_=g.edge(C,S),k=!0),g.node(S).rank=g.node(C).rank+(k?_.minlen:-_.minlen)})}function m(b,g,x){return b.hasEdge(g,x)}function w(b,g,x){return x.low<=g.lim&&g.lim<=x.lim}return er}var tr,eo;function pu(){if(eo)return tr;eo=1;var e=Yt(),t=e.longestPath,n=Ys(),r=gu();tr=i;function i(c){switch(c.graph().ranker){case"network-simplex":a(c);break;case"tight-tree":s(c);break;case"longest-path":o(c);break;default:a(c)}}var o=t;function s(c){t(c),n(c)}function a(c){r(c)}return tr}var nr,to;function mu(){if(to)return nr;to=1,nr=e;function e(r){let i=n(r);r.graph().dummyChains.forEach(o=>{let s=r.node(o),a=s.edgeObj,c=t(r,i,a.v,a.w),d=c.path,l=c.lca,u=0,f=d[u],h=!0;for(;o!==a.w;){if(s=r.node(o),h){for(;(f=d[u])!==l&&r.node(f).maxRank<s.rank;)u++;f===l&&(h=!1)}if(!h){for(;u<d.length-1&&r.node(f=d[u+1]).minRank<=s.rank;)u++;f=d[u]}r.setParent(o,f),o=r.successors(o)[0]}})}function t(r,i,o,s){let a=[],c=[],d=Math.min(i[o].low,i[s].low),l=Math.max(i[o].lim,i[s].lim),u,f;u=o;do u=r.parent(u),a.push(u);while(u&&(i[u].low>d||l>i[u].lim));for(f=u,u=s;(u=r.parent(u))!==f;)c.push(u);return{path:a.concat(c.reverse()),lca:f}}function n(r){let i={},o=0;function s(a){let c=o;r.children(a).forEach(s),i[a]={low:c,lim:o++}}return r.children().forEach(s),i}return nr}var rr,no;function yu(){if(no)return rr;no=1;let e=se();rr={run:t,cleanup:o};function t(s){let a=e.addDummyNode(s,"root",{},"_root"),c=r(s),d=Object.values(c),l=e.applyWithChunking(Math.max,d)-1,u=2*l+1;s.graph().nestingRoot=a,s.edges().forEach(h=>s.edge(h).minlen*=u);let f=i(s)+1;s.children().forEach(h=>n(s,a,u,f,l,c,h)),s.graph().nodeRankFactor=u}function n(s,a,c,d,l,u,f){let h=s.children(f);if(!h.length){f!==a&&s.setEdge(a,f,{weight:0,minlen:c});return}let p=e.addBorderNode(s,"_bt"),y=e.addBorderNode(s,"_bb"),m=s.node(f);s.setParent(p,f),m.borderTop=p,s.setParent(y,f),m.borderBottom=y,h.forEach(w=>{n(s,a,c,d,l,u,w);let b=s.node(w),g=b.borderTop?b.borderTop:w,x=b.borderBottom?b.borderBottom:w,N=b.borderTop?d:2*d,S=g!==x?1:l-u[f]+1;s.setEdge(p,g,{weight:N,minlen:S,nestingEdge:!0}),s.setEdge(x,y,{weight:N,minlen:S,nestingEdge:!0})}),s.parent(f)||s.setEdge(a,p,{weight:0,minlen:l+u[f]})}function r(s){var a={};function c(d,l){var u=s.children(d);u&&u.length&&u.forEach(f=>c(f,l+1)),a[d]=l}return s.children().forEach(d=>c(d,1)),a}function i(s){return s.edges().reduce((a,c)=>a+s.edge(c).weight,0)}function o(s){var a=s.graph();s.removeNode(a.nestingRoot),delete a.nestingRoot,s.edges().forEach(c=>{var d=s.edge(c);d.nestingEdge&&s.removeEdge(c)})}return rr}var ir,ro;function xu(){if(ro)return ir;ro=1;let e=se();ir=t;function t(r){function i(o){let s=r.children(o),a=r.node(o);if(s.length&&s.forEach(i),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let c=a.minRank,d=a.maxRank+1;c<d;++c)n(r,"borderLeft","_bl",o,a,c),n(r,"borderRight","_br",o,a,c)}}r.children().forEach(i)}function n(r,i,o,s,a,c){let d={width:0,height:0,rank:c,borderType:i},l=a[i][c-1],u=e.addDummyNode(r,"border",d,o);a[i][c]=u,r.setParent(u,s),l&&r.setEdge(l,u,{weight:1})}return ir}var or,io;function wu(){if(io)return or;io=1,or={adjust:e,undo:t};function e(c){let d=c.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&n(c)}function t(c){let d=c.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&i(c),(d==="lr"||d==="rl")&&(s(c),n(c))}function n(c){c.nodes().forEach(d=>r(c.node(d))),c.edges().forEach(d=>r(c.edge(d)))}function r(c){let d=c.width;c.width=c.height,c.height=d}function i(c){c.nodes().forEach(d=>o(c.node(d))),c.edges().forEach(d=>{let l=c.edge(d);l.points.forEach(o),Object.hasOwn(l,"y")&&o(l)})}function o(c){c.y=-c.y}function s(c){c.nodes().forEach(d=>a(c.node(d))),c.edges().forEach(d=>{let l=c.edge(d);l.points.forEach(a),Object.hasOwn(l,"x")&&a(l)})}function a(c){let d=c.x;c.x=c.y,c.y=d}return or}var sr,oo;function bu(){if(oo)return sr;oo=1;let e=se();sr=t;function t(n){let r={},i=n.nodes().filter(l=>!n.children(l).length),o=i.map(l=>n.node(l).rank),s=e.applyWithChunking(Math.max,o),a=e.range(s+1).map(()=>[]);function c(l){if(r[l])return;r[l]=!0;let u=n.node(l);a[u.rank].push(l),n.successors(l).forEach(c)}return i.sort((l,u)=>n.node(l).rank-n.node(u).rank).forEach(c),a}return sr}var ar,so;function vu(){if(so)return ar;so=1;let e=se().zipObject;ar=t;function t(r,i){let o=0;for(let s=1;s<i.length;++s)o+=n(r,i[s-1],i[s]);return o}function n(r,i,o){let s=e(o,o.map((f,h)=>h)),a=i.flatMap(f=>r.outEdges(f).map(h=>({pos:s[h.w],weight:r.edge(h).weight})).sort((h,p)=>h.pos-p.pos)),c=1;for(;c<o.length;)c<<=1;let d=2*c-1;c-=1;let l=new Array(d).fill(0),u=0;return a.forEach(f=>{let h=f.pos+c;l[h]+=f.weight;let p=0;for(;h>0;)h%2&&(p+=l[h+1]),h=h-1>>1,l[h]+=f.weight;u+=f.weight*p}),u}return ar}var cr,ao;function _u(){if(ao)return cr;ao=1,cr=e;function e(t,n=[]){return n.map(r=>{let i=t.inEdges(r);if(i.length){let o=i.reduce((s,a)=>{let c=t.edge(a),d=t.node(a.v);return{sum:s.sum+c.weight*d.order,weight:s.weight+c.weight}},{sum:0,weight:0});return{v:r,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:r}})}return cr}var lr,co;function Eu(){if(co)return lr;co=1;let e=se();lr=t;function t(i,o){let s={};i.forEach((c,d)=>{let l=s[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};c.barycenter!==void 0&&(l.barycenter=c.barycenter,l.weight=c.weight)}),o.edges().forEach(c=>{let d=s[c.v],l=s[c.w];d!==void 0&&l!==void 0&&(l.indegree++,d.out.push(s[c.w]))});let a=Object.values(s).filter(c=>!c.indegree);return n(a)}function n(i){let o=[];function s(c){return d=>{d.merged||(d.barycenter===void 0||c.barycenter===void 0||d.barycenter>=c.barycenter)&&r(c,d)}}function a(c){return d=>{d.in.push(c),--d.indegree===0&&i.push(d)}}for(;i.length;){let c=i.pop();o.push(c),c.in.reverse().forEach(s(c)),c.out.forEach(a(c))}return o.filter(c=>!c.merged).map(c=>e.pick(c,["vs","i","barycenter","weight"]))}function r(i,o){let s=0,a=0;i.weight&&(s+=i.barycenter*i.weight,a+=i.weight),o.weight&&(s+=o.barycenter*o.weight,a+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=s/a,i.weight=a,i.i=Math.min(o.i,i.i),o.merged=!0}return lr}var ur,lo;function Nu(){if(lo)return ur;lo=1;let e=se();ur=t;function t(i,o){let s=e.partition(i,p=>Object.hasOwn(p,"barycenter")),a=s.lhs,c=s.rhs.sort((p,y)=>y.i-p.i),d=[],l=0,u=0,f=0;a.sort(r(!!o)),f=n(d,c,f),a.forEach(p=>{f+=p.vs.length,d.push(p.vs),l+=p.barycenter*p.weight,u+=p.weight,f=n(d,c,f)});let h={vs:d.flat(!0)};return u&&(h.barycenter=l/u,h.weight=u),h}function n(i,o,s){let a;for(;o.length&&(a=o[o.length-1]).i<=s;)o.pop(),i.push(a.vs),s++;return s}function r(i){return(o,s)=>o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:i?s.i-o.i:o.i-s.i}return ur}var dr,uo;function ku(){if(uo)return dr;uo=1;let e=_u(),t=Eu(),n=Nu();dr=r;function r(s,a,c,d){let l=s.children(a),u=s.node(a),f=u?u.borderLeft:void 0,h=u?u.borderRight:void 0,p={};f&&(l=l.filter(b=>b!==f&&b!==h));let y=e(s,l);y.forEach(b=>{if(s.children(b.v).length){let g=r(s,b.v,c,d);p[b.v]=g,Object.hasOwn(g,"barycenter")&&o(b,g)}});let m=t(y,c);i(m,p);let w=n(m,d);if(f&&(w.vs=[f,w.vs,h].flat(!0),s.predecessors(f).length)){let b=s.node(s.predecessors(f)[0]),g=s.node(s.predecessors(h)[0]);Object.hasOwn(w,"barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+b.order+g.order)/(w.weight+2),w.weight+=2}return w}function i(s,a){s.forEach(c=>{c.vs=c.vs.flatMap(d=>a[d]?a[d].vs:d)})}function o(s,a){s.barycenter!==void 0?(s.barycenter=(s.barycenter*s.weight+a.barycenter*a.weight)/(s.weight+a.weight),s.weight+=a.weight):(s.barycenter=a.barycenter,s.weight=a.weight)}return dr}var fr,fo;function Su(){if(fo)return fr;fo=1;let e=xe().Graph,t=se();fr=n;function n(i,o,s){let a=r(i),c=new e({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(d=>i.node(d));return i.nodes().forEach(d=>{let l=i.node(d),u=i.parent(d);(l.rank===o||l.minRank<=o&&o<=l.maxRank)&&(c.setNode(d),c.setParent(d,u||a),i[s](d).forEach(f=>{let h=f.v===d?f.w:f.v,p=c.edge(h,d),y=p!==void 0?p.weight:0;c.setEdge(h,d,{weight:i.edge(f).weight+y})}),Object.hasOwn(l,"minRank")&&c.setNode(d,{borderLeft:l.borderLeft[o],borderRight:l.borderRight[o]}))}),c}function r(i){for(var o;i.hasNode(o=t.uniqueId("_root")););return o}return fr}var hr,ho;function Cu(){if(ho)return hr;ho=1,hr=e;function e(t,n,r){let i={},o;r.forEach(s=>{let a=t.parent(s),c,d;for(;a;){if(c=t.parent(a),c?(d=i[c],i[c]=a):(d=o,o=a),d&&d!==a){n.setEdge(d,a);return}a=c}})}return hr}var gr,go;function Mu(){if(go)return gr;go=1;let e=bu(),t=vu(),n=ku(),r=Su(),i=Cu(),o=xe().Graph,s=se();gr=a;function a(u,f){if(f&&typeof f.customOrder=="function"){f.customOrder(u,a);return}let h=s.maxRank(u),p=c(u,s.range(1,h+1),"inEdges"),y=c(u,s.range(h-1,-1,-1),"outEdges"),m=e(u);if(l(u,m),f&&f.disableOptimalOrderHeuristic)return;let w=Number.POSITIVE_INFINITY,b;for(let g=0,x=0;x<4;++g,++x){d(g%2?p:y,g%4>=2),m=s.buildLayerMatrix(u);let N=t(u,m);N<w&&(x=0,b=Object.assign({},m),w=N)}l(u,b)}function c(u,f,h){return f.map(function(p){return r(u,p,h)})}function d(u,f){let h=new o;u.forEach(function(p){let y=p.graph().root,m=n(p,y,h,f);m.vs.forEach((w,b)=>p.node(w).order=b),i(p,h,m.vs)})}function l(u,f){Object.values(f).forEach(h=>h.forEach((p,y)=>u.node(p).order=y))}return gr}var pr,po;function Iu(){if(po)return pr;po=1;let e=xe().Graph,t=se();pr={positionX:h,findType1Conflicts:n,findType2Conflicts:r,addConflict:o,hasConflict:s,verticalAlignment:a,horizontalCompaction:c,alignCoordinates:u,findSmallestWidthAlignment:l,balance:f};function n(m,w){let b={};function g(x,N){let S=0,C=0,_=x.length,k=N[N.length-1];return N.forEach((M,I)=>{let A=i(m,M),D=A?m.node(A).order:_;(A||M===k)&&(N.slice(C,I+1).forEach(v=>{m.predecessors(v).forEach(T=>{let $=m.node(T),j=$.order;(j<S||D<j)&&!($.dummy&&m.node(v).dummy)&&o(b,T,v)})}),C=I+1,S=D)}),N}return w.length&&w.reduce(g),b}function r(m,w){let b={};function g(N,S,C,_,k){let M;t.range(S,C).forEach(I=>{M=N[I],m.node(M).dummy&&m.predecessors(M).forEach(A=>{let D=m.node(A);D.dummy&&(D.order<_||D.order>k)&&o(b,A,M)})})}function x(N,S){let C=-1,_,k=0;return S.forEach((M,I)=>{if(m.node(M).dummy==="border"){let A=m.predecessors(M);A.length&&(_=m.node(A[0]).order,g(S,k,I,C,_),k=I,C=_)}g(S,k,S.length,_,N.length)}),S}return w.length&&w.reduce(x),b}function i(m,w){if(m.node(w).dummy)return m.predecessors(w).find(b=>m.node(b).dummy)}function o(m,w,b){if(w>b){let x=w;w=b,b=x}let g=m[w];g||(m[w]=g={}),g[b]=!0}function s(m,w,b){if(w>b){let g=w;w=b,b=g}return!!m[w]&&Object.hasOwn(m[w],b)}function a(m,w,b,g){let x={},N={},S={};return w.forEach(C=>{C.forEach((_,k)=>{x[_]=_,N[_]=_,S[_]=k})}),w.forEach(C=>{let _=-1;C.forEach(k=>{let M=g(k);if(M.length){M=M.sort((A,D)=>S[A]-S[D]);let I=(M.length-1)/2;for(let A=Math.floor(I),D=Math.ceil(I);A<=D;++A){let v=M[A];N[k]===k&&_<S[v]&&!s(b,k,v)&&(N[v]=k,N[k]=x[k]=x[v],_=S[v])}}})}),{root:x,align:N}}function c(m,w,b,g,x){let N={},S=d(m,w,b,x),C=x?"borderLeft":"borderRight";function _(I,A){let D=S.nodes(),v=D.pop(),T={};for(;v;)T[v]?I(v):(T[v]=!0,D.push(v),D=D.concat(A(v))),v=D.pop()}function k(I){N[I]=S.inEdges(I).reduce((A,D)=>Math.max(A,N[D.v]+S.edge(D)),0)}function M(I){let A=S.outEdges(I).reduce((v,T)=>Math.min(v,N[T.w]-S.edge(T)),Number.POSITIVE_INFINITY),D=m.node(I);A!==Number.POSITIVE_INFINITY&&D.borderType!==C&&(N[I]=Math.max(N[I],A))}return _(k,S.predecessors.bind(S)),_(M,S.successors.bind(S)),Object.keys(g).forEach(I=>N[I]=N[b[I]]),N}function d(m,w,b,g){let x=new e,N=m.graph(),S=p(N.nodesep,N.edgesep,g);return w.forEach(C=>{let _;C.forEach(k=>{let M=b[k];if(x.setNode(M),_){var I=b[_],A=x.edge(I,M);x.setEdge(I,M,Math.max(S(m,k,_),A||0))}_=k})}),x}function l(m,w){return Object.values(w).reduce((b,g)=>{let x=Number.NEGATIVE_INFINITY,N=Number.POSITIVE_INFINITY;Object.entries(g).forEach(([C,_])=>{let k=y(m,C)/2;x=Math.max(_+k,x),N=Math.min(_-k,N)});const S=x-N;return S<b[0]&&(b=[S,g]),b},[Number.POSITIVE_INFINITY,null])[1]}function u(m,w){let b=Object.values(w),g=t.applyWithChunking(Math.min,b),x=t.applyWithChunking(Math.max,b);["u","d"].forEach(N=>{["l","r"].forEach(S=>{let C=N+S,_=m[C];if(_===w)return;let k=Object.values(_),M=g-t.applyWithChunking(Math.min,k);S!=="l"&&(M=x-t.applyWithChunking(Math.max,k)),M&&(m[C]=t.mapValues(_,I=>I+M))})})}function f(m,w){return t.mapValues(m.ul,(b,g)=>{if(w)return m[w.toLowerCase()][g];{let x=Object.values(m).map(N=>N[g]).sort((N,S)=>N-S);return(x[1]+x[2])/2}})}function h(m){let w=t.buildLayerMatrix(m),b=Object.assign(n(m,w),r(m,w)),g={},x;["u","d"].forEach(S=>{x=S==="u"?w:Object.values(w).reverse(),["l","r"].forEach(C=>{C==="r"&&(x=x.map(I=>Object.values(I).reverse()));let _=(S==="u"?m.predecessors:m.successors).bind(m),k=a(m,x,b,_),M=c(m,x,k.root,k.align,C==="r");C==="r"&&(M=t.mapValues(M,I=>-I)),g[S+C]=M})});let N=l(m,g);return u(g,N),f(g,m.graph().align)}function p(m,w,b){return(g,x,N)=>{let S=g.node(x),C=g.node(N),_=0,k;if(_+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":k=-S.width/2;break;case"r":k=S.width/2;break}if(k&&(_+=b?k:-k),k=0,_+=(S.dummy?w:m)/2,_+=(C.dummy?w:m)/2,_+=C.width/2,Object.hasOwn(C,"labelpos"))switch(C.labelpos.toLowerCase()){case"l":k=C.width/2;break;case"r":k=-C.width/2;break}return k&&(_+=b?k:-k),k=0,_}}function y(m,w){return m.node(w).width}return pr}var mr,mo;function Au(){if(mo)return mr;mo=1;let e=se(),t=Iu().positionX;mr=n;function n(i){i=e.asNonCompoundGraph(i),r(i),Object.entries(t(i)).forEach(([o,s])=>i.node(o).x=s)}function r(i){let o=e.buildLayerMatrix(i),s=i.graph().ranksep,a=0;o.forEach(c=>{const d=c.reduce((l,u)=>{const f=i.node(u).height;return l>f?l:f},0);c.forEach(l=>i.node(l).y=a+d/2),a+=d+s})}return mr}var yr,yo;function $u(){if(yo)return yr;yo=1;let e=fu(),t=hu(),n=pu(),r=se().normalizeRanks,i=mu(),o=se().removeEmptyRanks,s=yu(),a=xu(),c=wu(),d=Mu(),l=Au(),u=se(),f=xe().Graph;yr=h;function h(R,P){let O=P&&P.debugTiming?u.time:u.notime;O("layout",()=>{let H=O(" buildLayoutGraph",()=>_(R));O(" runLayout",()=>p(H,O,P)),O(" updateInputGraph",()=>y(R,H))})}function p(R,P,O){P(" makeSpaceForEdgeLabels",()=>k(R)),P(" removeSelfEdges",()=>F(R)),P(" acyclic",()=>e.run(R)),P(" nestingGraph.run",()=>s.run(R)),P(" rank",()=>n(u.asNonCompoundGraph(R))),P(" injectEdgeLabelProxies",()=>M(R)),P(" removeEmptyRanks",()=>o(R)),P(" nestingGraph.cleanup",()=>s.cleanup(R)),P(" normalizeRanks",()=>r(R)),P(" assignRankMinMax",()=>I(R)),P(" removeEdgeLabelProxies",()=>A(R)),P(" normalize.run",()=>t.run(R)),P(" parentDummyChains",()=>i(R)),P(" addBorderSegments",()=>a(R)),P(" order",()=>d(R,O)),P(" insertSelfEdges",()=>L(R)),P(" adjustCoordinateSystem",()=>c.adjust(R)),P(" position",()=>l(R)),P(" positionSelfEdges",()=>B(R)),P(" removeBorderNodes",()=>j(R)),P(" normalize.undo",()=>t.undo(R)),P(" fixupEdgeLabelCoords",()=>T(R)),P(" undoCoordinateSystem",()=>c.undo(R)),P(" translateGraph",()=>D(R)),P(" assignNodeIntersects",()=>v(R)),P(" reversePoints",()=>$(R)),P(" acyclic.undo",()=>e.undo(R))}function y(R,P){R.nodes().forEach(O=>{let H=R.node(O),q=P.node(O);H&&(H.x=q.x,H.y=q.y,H.rank=q.rank,P.children(O).length&&(H.width=q.width,H.height=q.height))}),R.edges().forEach(O=>{let H=R.edge(O),q=P.edge(O);H.points=q.points,Object.hasOwn(q,"x")&&(H.x=q.x,H.y=q.y)}),R.graph().width=P.graph().width,R.graph().height=P.graph().height}let m=["nodesep","edgesep","ranksep","marginx","marginy"],w={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],g=["width","height"],x={width:0,height:0},N=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},C=["labelpos"];function _(R){let P=new f({multigraph:!0,compound:!0}),O=Y(R.graph());return P.setGraph(Object.assign({},w,V(O,m),u.pick(O,b))),R.nodes().forEach(H=>{let q=Y(R.node(H));const G=V(q,g);Object.keys(x).forEach(U=>{G[U]===void 0&&(G[U]=x[U])}),P.setNode(H,G),P.setParent(H,R.parent(H))}),R.edges().forEach(H=>{let q=Y(R.edge(H));P.setEdge(H,Object.assign({},S,V(q,N),u.pick(q,C)))}),P}function k(R){let P=R.graph();P.ranksep/=2,R.edges().forEach(O=>{let H=R.edge(O);H.minlen*=2,H.labelpos.toLowerCase()!=="c"&&(P.rankdir==="TB"||P.rankdir==="BT"?H.width+=H.labeloffset:H.height+=H.labeloffset)})}function M(R){R.edges().forEach(P=>{let O=R.edge(P);if(O.width&&O.height){let H=R.node(P.v),G={rank:(R.node(P.w).rank-H.rank)/2+H.rank,e:P};u.addDummyNode(R,"edge-proxy",G,"_ep")}})}function I(R){let P=0;R.nodes().forEach(O=>{let H=R.node(O);H.borderTop&&(H.minRank=R.node(H.borderTop).rank,H.maxRank=R.node(H.borderBottom).rank,P=Math.max(P,H.maxRank))}),R.graph().maxRank=P}function A(R){R.nodes().forEach(P=>{let O=R.node(P);O.dummy==="edge-proxy"&&(R.edge(O.e).labelRank=O.rank,R.removeNode(P))})}function D(R){let P=Number.POSITIVE_INFINITY,O=0,H=Number.POSITIVE_INFINITY,q=0,G=R.graph(),U=G.marginx||0,Z=G.marginy||0;function K(X){let J=X.x,ee=X.y,re=X.width,ae=X.height;P=Math.min(P,J-re/2),O=Math.max(O,J+re/2),H=Math.min(H,ee-ae/2),q=Math.max(q,ee+ae/2)}R.nodes().forEach(X=>K(R.node(X))),R.edges().forEach(X=>{let J=R.edge(X);Object.hasOwn(J,"x")&&K(J)}),P-=U,H-=Z,R.nodes().forEach(X=>{let J=R.node(X);J.x-=P,J.y-=H}),R.edges().forEach(X=>{let J=R.edge(X);J.points.forEach(ee=>{ee.x-=P,ee.y-=H}),Object.hasOwn(J,"x")&&(J.x-=P),Object.hasOwn(J,"y")&&(J.y-=H)}),G.width=O-P+U,G.height=q-H+Z}function v(R){R.edges().forEach(P=>{let O=R.edge(P),H=R.node(P.v),q=R.node(P.w),G,U;O.points?(G=O.points[0],U=O.points[O.points.length-1]):(O.points=[],G=q,U=H),O.points.unshift(u.intersectRect(H,G)),O.points.push(u.intersectRect(q,U))})}function T(R){R.edges().forEach(P=>{let O=R.edge(P);if(Object.hasOwn(O,"x"))switch((O.labelpos==="l"||O.labelpos==="r")&&(O.width-=O.labeloffset),O.labelpos){case"l":O.x-=O.width/2+O.labeloffset;break;case"r":O.x+=O.width/2+O.labeloffset;break}})}function $(R){R.edges().forEach(P=>{let O=R.edge(P);O.reversed&&O.points.reverse()})}function j(R){R.nodes().forEach(P=>{if(R.children(P).length){let O=R.node(P),H=R.node(O.borderTop),q=R.node(O.borderBottom),G=R.node(O.borderLeft[O.borderLeft.length-1]),U=R.node(O.borderRight[O.borderRight.length-1]);O.width=Math.abs(U.x-G.x),O.height=Math.abs(q.y-H.y),O.x=G.x+O.width/2,O.y=H.y+O.height/2}}),R.nodes().forEach(P=>{R.node(P).dummy==="border"&&R.removeNode(P)})}function F(R){R.edges().forEach(P=>{if(P.v===P.w){var O=R.node(P.v);O.selfEdges||(O.selfEdges=[]),O.selfEdges.push({e:P,label:R.edge(P)}),R.removeEdge(P)}})}function L(R){var P=u.buildLayerMatrix(R);P.forEach(O=>{var H=0;O.forEach((q,G)=>{var U=R.node(q);U.order=G+H,(U.selfEdges||[]).forEach(Z=>{u.addDummyNode(R,"selfedge",{width:Z.label.width,height:Z.label.height,rank:U.rank,order:G+ ++H,e:Z.e,label:Z.label},"_se")}),delete U.selfEdges})})}function B(R){R.nodes().forEach(P=>{var O=R.node(P);if(O.dummy==="selfedge"){var H=R.node(O.e.v),q=H.x+H.width/2,G=H.y,U=O.x-q,Z=H.height/2;R.setEdge(O.e,O.label),R.removeNode(P),O.label.points=[{x:q+2*U/3,y:G-Z},{x:q+5*U/6,y:G-Z},{x:q+U,y:G},{x:q+5*U/6,y:G+Z},{x:q+2*U/3,y:G+Z}],O.label.x=O.x,O.label.y=O.y}})}function V(R,P){return u.mapValues(u.pick(R,P),Number)}function Y(R){var P={};return R&&Object.entries(R).forEach(([O,H])=>{typeof O=="string"&&(O=O.toLowerCase()),P[O]=H}),P}return yr}var xr,xo;function Ru(){if(xo)return xr;xo=1;let e=se(),t=xe().Graph;xr={debugOrdering:n};function n(r){let i=e.buildLayerMatrix(r),o=new t({compound:!0,multigraph:!0}).setGraph({});return r.nodes().forEach(s=>{o.setNode(s,{label:s}),o.setParent(s,"layer"+r.node(s).rank)}),r.edges().forEach(s=>o.setEdge(s.v,s.w,{},s.name)),i.forEach((s,a)=>{let c="layer"+a;o.setNode(c,{rank:"same"}),s.reduce((d,l)=>(o.setEdge(d,l,{style:"invis"}),l))}),o}return xr}var wr,wo;function Tu(){return wo||(wo=1,wr="1.1.4"),wr}var br,bo;function ju(){return bo||(bo=1,br={graphlib:xe(),layout:$u(),debug:Ru(),util:{time:se().time,notime:se().notime},version:Tu()}),br}var Pu=ju();const Gs=Os(Pu);function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Lu={value:()=>{}};function an(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Ht(n)}function Ht(e){this._=e}function Ou(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ht.prototype=an.prototype={constructor:Ht,on:function(e,t){var n=this._,r=Ou(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Du(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=vo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vo(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ht(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function Du(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function vo(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Lu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Or="http://www.w3.org/1999/xhtml";const _o={svg:"http://www.w3.org/2000/svg",xhtml:Or,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function cn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function zu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Or&&t.documentElement.namespaceURI===Or?t.createElement(e):t.createElementNS(n,e)}}function Fu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ws(e){var t=cn(e);return(t.local?Fu:zu)(t)}function Hu(){}function ni(e){return e==null?Hu:function(){return this.querySelector(e)}}function Vu(e){typeof e!="function"&&(e=ni(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,d,l=0;l<s;++l)(c=o[l])&&(d=e.call(c,c.__data__,l,o))&&("__data__"in c&&(d.__data__=c.__data__),a[l]=d);return new fe(r,this._parents)}function Bu(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qu(){return[]}function Xs(e){return e==null?qu:function(){return this.querySelectorAll(e)}}function Yu(e){return function(){return Bu(e.apply(this,arguments))}}function Gu(e){typeof e=="function"?e=Yu(e):e=Xs(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,d=0;d<a;++d)(c=s[d])&&(r.push(e.call(c,c.__data__,d,s)),i.push(c));return new fe(r,i)}function Us(e){return function(){return this.matches(e)}}function Ks(e){return function(t){return t.matches(e)}}var Wu=Array.prototype.find;function Xu(e){return function(){return Wu.call(this.children,e)}}function Uu(){return this.firstElementChild}function Ku(e){return this.select(e==null?Uu:Xu(typeof e=="function"?e:Ks(e)))}var Zu=Array.prototype.filter;function Qu(){return Array.from(this.children)}function Ju(e){return function(){return Zu.call(this.children,e)}}function ed(e){return this.selectAll(e==null?Qu:Ju(typeof e=="function"?e:Ks(e)))}function td(e){typeof e!="function"&&(e=Us(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,d=0;d<s;++d)(c=o[d])&&e.call(c,c.__data__,d,o)&&a.push(c);return new fe(r,this._parents)}function Zs(e){return new Array(e.length)}function nd(){return new fe(this._enter||this._groups.map(Zs),this._parents)}function Gt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Gt.prototype={constructor:Gt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function rd(e){return function(){return e}}function id(e,t,n,r,i,o){for(var s=0,a,c=t.length,d=o.length;s<d;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new Gt(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function od(e,t,n,r,i,o,s){var a,c,d=new Map,l=t.length,u=o.length,f=new Array(l),h;for(a=0;a<l;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",d.has(h)?i[a]=c:d.set(h,c));for(a=0;a<u;++a)h=s.call(e,o[a],a,o)+"",(c=d.get(h))?(r[a]=c,c.__data__=o[a],d.delete(h)):n[a]=new Gt(e,o[a]);for(a=0;a<l;++a)(c=t[a])&&d.get(f[a])===c&&(i[a]=c)}function sd(e){return e.__data__}function ad(e,t){if(!arguments.length)return Array.from(this,sd);var n=t?od:id,r=this._parents,i=this._groups;typeof e!="function"&&(e=rd(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),d=0;d<o;++d){var l=r[d],u=i[d],f=u.length,h=cd(e.call(l,l&&l.__data__,d,r)),p=h.length,y=a[d]=new Array(p),m=s[d]=new Array(p),w=c[d]=new Array(f);n(l,u,y,m,w,h,t);for(var b=0,g=0,x,N;b<p;++b)if(x=y[b]){for(b>=g&&(g=b+1);!(N=m[g])&&++g<p;);x._next=N||null}}return s=new fe(s,r),s._enter=a,s._exit=c,s}function cd(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ld(){return new fe(this._exit||this._groups.map(Zs),this._parents)}function ud(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function dd(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var d=n[c],l=r[c],u=d.length,f=a[c]=new Array(u),h,p=0;p<u;++p)(h=d[p]||l[p])&&(f[p]=h);for(;c<i;++c)a[c]=n[c];return new fe(a,this._parents)}function fd(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function hd(e){e||(e=gd);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),d,l=0;l<a;++l)(d=s[l])&&(c[l]=d);c.sort(t)}return new fe(i,this._parents).order()}function gd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pd(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function md(){return Array.from(this)}function yd(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function xd(){let e=0;for(const t of this)++e;return e}function wd(){return!this.node()}function bd(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function vd(e){return function(){this.removeAttribute(e)}}function _d(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ed(e,t){return function(){this.setAttribute(e,t)}}function Nd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Cd(e,t){var n=cn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?_d:vd:typeof t=="function"?n.local?Sd:kd:n.local?Nd:Ed)(n,t))}function Qs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Md(e){return function(){this.style.removeProperty(e)}}function Id(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ad(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function $d(e,t,n){return arguments.length>1?this.each((t==null?Md:typeof t=="function"?Ad:Id)(e,t,n??"")):Ze(this.node(),e)}function Ze(e,t){return e.style.getPropertyValue(t)||Qs(e).getComputedStyle(e,null).getPropertyValue(t)}function Rd(e){return function(){delete this[e]}}function Td(e,t){return function(){this[e]=t}}function jd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Pd(e,t){return arguments.length>1?this.each((t==null?Rd:typeof t=="function"?jd:Td)(e,t)):this.node()[e]}function Js(e){return e.trim().split(/^|\s+/)}function ri(e){return e.classList||new ea(e)}function ea(e){this._node=e,this._names=Js(e.getAttribute("class")||"")}ea.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ta(e,t){for(var n=ri(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function na(e,t){for(var n=ri(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Ld(e){return function(){ta(this,e)}}function Od(e){return function(){na(this,e)}}function Dd(e,t){return function(){(t.apply(this,arguments)?ta:na)(this,e)}}function zd(e,t){var n=Js(e+"");if(arguments.length<2){for(var r=ri(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Dd:t?Ld:Od)(n,t))}function Fd(){this.textContent=""}function Hd(e){return function(){this.textContent=e}}function Vd(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Bd(e){return arguments.length?this.each(e==null?Fd:(typeof e=="function"?Vd:Hd)(e)):this.node().textContent}function qd(){this.innerHTML=""}function Yd(e){return function(){this.innerHTML=e}}function Gd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Wd(e){return arguments.length?this.each(e==null?qd:(typeof e=="function"?Gd:Yd)(e)):this.node().innerHTML}function Xd(){this.nextSibling&&this.parentNode.appendChild(this)}function Ud(){return this.each(Xd)}function Kd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Zd(){return this.each(Kd)}function Qd(e){var t=typeof e=="function"?e:Ws(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Jd(){return null}function ef(e,t){var n=typeof e=="function"?e:Ws(e),r=t==null?Jd:typeof t=="function"?t:ni(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function tf(){var e=this.parentNode;e&&e.removeChild(this)}function nf(){return this.each(tf)}function rf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function of(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sf(e){return this.select(e?of:rf)}function af(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cf(e){return function(t){e.call(this,t,this.__data__)}}function lf(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function uf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function df(e,t,n){return function(){var r=this.__on,i,o=cf(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function ff(e,t,n){var r=lf(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,d=a.length,l;c<d;++c)for(i=0,l=a[c];i<o;++i)if((s=r[i]).type===l.type&&s.name===l.name)return l.value}return}for(a=t?df:uf,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function ra(e,t,n){var r=Qs(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function hf(e,t){return function(){return ra(this,e,t)}}function gf(e,t){return function(){return ra(this,e,t.apply(this,arguments))}}function pf(e,t){return this.each((typeof t=="function"?gf:hf)(e,t))}function*mf(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var ia=[null];function fe(e,t){this._groups=e,this._parents=t}function kt(){return new fe([[document.documentElement]],ia)}function yf(){return this}fe.prototype=kt.prototype={constructor:fe,select:Vu,selectAll:Gu,selectChild:Ku,selectChildren:ed,filter:td,data:ad,enter:nd,exit:ld,join:ud,merge:dd,selection:yf,order:fd,sort:hd,call:pd,nodes:md,node:yd,size:xd,empty:wd,each:bd,attr:Cd,style:$d,property:Pd,classed:zd,text:Bd,html:Wd,raise:Ud,lower:Zd,append:Qd,insert:ef,remove:nf,clone:sf,datum:af,on:ff,dispatch:pf,[Symbol.iterator]:mf};function de(e){return typeof e=="string"?new fe([[document.querySelector(e)]],[document.documentElement]):new fe([[e]],ia)}function xf(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=xf(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const wf={passive:!1},pt={capture:!0,passive:!1};function vr(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function oa(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Ue,pt);"onselectstart"in t?n.on("selectstart.drag",Ue,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function sa(e,t){var n=e.document.documentElement,r=de(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ue,pt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Rt=e=>()=>e;function Dr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:c,dy:d,dispatch:l}){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:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:l}})}Dr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function bf(e){return!e.ctrlKey&&!e.button}function vf(){return this.parentNode}function _f(e,t){return t??{x:e.x,y:e.y}}function Ef(){return navigator.maxTouchPoints||"ontouchstart"in this}function aa(){var e=bf,t=vf,n=_f,r=Ef,i={},o=an("start","drag","end"),s=0,a,c,d,l,u=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",m).on("touchmove.drag",w,wf).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,N){if(!(l||!e.call(this,x,N))){var S=g(this,t.call(this,x,N),x,N,"mouse");S&&(de(x.view).on("mousemove.drag",p,pt).on("mouseup.drag",y,pt),oa(x.view),vr(x),d=!1,a=x.clientX,c=x.clientY,S("start",x))}}function p(x){if(Ue(x),!d){var N=x.clientX-a,S=x.clientY-c;d=N*N+S*S>u}i.mouse("drag",x)}function y(x){de(x.view).on("mousemove.drag mouseup.drag",null),sa(x.view,d),Ue(x),i.mouse("end",x)}function m(x,N){if(e.call(this,x,N)){var S=x.changedTouches,C=t.call(this,x,N),_=S.length,k,M;for(k=0;k<_;++k)(M=g(this,C,x,N,S[k].identifier,S[k]))&&(vr(x),M("start",x,S[k]))}}function w(x){var N=x.changedTouches,S=N.length,C,_;for(C=0;C<S;++C)(_=i[N[C].identifier])&&(Ue(x),_("drag",x,N[C]))}function b(x){var N=x.changedTouches,S=N.length,C,_;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),C=0;C<S;++C)(_=i[N[C].identifier])&&(vr(x),_("end",x,N[C]))}function g(x,N,S,C,_,k){var M=o.copy(),I=pe(k||S,N),A,D,v;if((v=n.call(x,new Dr("beforestart",{sourceEvent:S,target:f,identifier:_,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:M}),C))!=null)return A=v.x-I[0]||0,D=v.y-I[1]||0,function T($,j,F){var L=I,B;switch($){case"start":i[_]=T,B=s++;break;case"end":delete i[_],--s;case"drag":I=pe(F||j,N),B=s;break}M.call($,x,new Dr($,{sourceEvent:j,subject:v,target:f,identifier:_,active:B,x:I[0]+A,y:I[1]+D,dx:I[0]-L[0],dy:I[1]-L[1],dispatch:M}),C)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Rt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:Rt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Rt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:Rt(!!x),f):r},f.on=function(){var x=o.on.apply(o,arguments);return x===o?f:x},f.clickDistance=function(x){return arguments.length?(u=(x=+x)*x,f):Math.sqrt(u)},f}function ii(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ca(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function St(){}var mt=.7,Wt=1/mt,Ke="\\s*([+-]?\\d+)\\s*",yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nf=/^#([0-9a-f]{3,8})$/,kf=new RegExp(`^rgb\\(${Ke},${Ke},${Ke}\\)$`),Sf=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Cf=new RegExp(`^rgba\\(${Ke},${Ke},${Ke},${yt}\\)$`),Mf=new RegExp(`^rgba\\(${be},${be},${be},${yt}\\)$`),If=new RegExp(`^hsl\\(${yt},${be},${be}\\)$`),Af=new RegExp(`^hsla\\(${yt},${be},${be},${yt}\\)$`),Eo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ii(St,xt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:No,formatHex:No,formatHex8:$f,formatHsl:Rf,formatRgb:ko,toString:ko});function No(){return this.rgb().formatHex()}function $f(){return this.rgb().formatHex8()}function Rf(){return la(this).formatHsl()}function ko(){return this.rgb().formatRgb()}function xt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Nf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?So(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=kf.exec(e))?new ce(t[1],t[2],t[3],1):(t=Sf.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cf.exec(e))?Tt(t[1],t[2],t[3],t[4]):(t=Mf.exec(e))?Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=If.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=Af.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?So(Eo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function So(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function Tt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ce(e,t,n,r)}function Tf(e){return e instanceof St||(e=xt(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function zr(e,t,n,r){return arguments.length===1?Tf(e):new ce(e,t,n,r??1)}function ce(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ii(ce,zr,ca(St,{brighter(e){return e=e==null?Wt:Math.pow(Wt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(Oe(this.r),Oe(this.g),Oe(this.b),Xt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Co,formatHex:Co,formatHex8:jf,formatRgb:Mo,toString:Mo}));function Co(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function jf(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mo(){const e=Xt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function Xt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Le(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function Io(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new me(e,t,n,r)}function la(e){if(e instanceof me)return new me(e.h,e.s,e.l,e.opacity);if(e instanceof St||(e=xt(e)),!e)return new me;if(e instanceof me)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new me(s,a,c,e.opacity)}function Pf(e,t,n,r){return arguments.length===1?la(e):new me(e,t,n,r??1)}function me(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ii(me,Pf,ca(St,{brighter(e){return e=e==null?Wt:Math.pow(Wt,e),new me(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mt:Math.pow(mt,e),new me(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ce(_r(e>=240?e-240:e+120,i,r),_r(e,i,r),_r(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new me(Ao(this.h),jt(this.s),jt(this.l),Xt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Xt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function jt(e){return Math.max(0,Math.min(1,e||0))}function _r(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ua=e=>()=>e;function Lf(e,t){return function(n){return e+n*t}}function Of(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Df(e){return(e=+e)==1?da:function(t,n){return n-t?Of(t,n,e):ua(isNaN(t)?n:t)}}function da(e,t){var n=t-e;return n?Lf(e,n):ua(isNaN(e)?t:e)}const $o=function e(t){var n=Df(t);function r(i,o){var s=n((i=zr(i)).r,(o=zr(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),d=da(i.opacity,o.opacity);return function(l){return i.r=s(l),i.g=a(l),i.b=c(l),i.opacity=d(l),i+""}}return r.gamma=e,r}(1);function je(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Fr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Er=new RegExp(Fr.source,"g");function zf(e){return function(){return e}}function Ff(e){return function(t){return e(t)+""}}function Hf(e,t){var n=Fr.lastIndex=Er.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Fr.exec(e))&&(i=Er.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:je(r,i)})),n=Er.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?Ff(c[0].x):zf(t):(t=c.length,function(d){for(var l=0,u;l<t;++l)a[(u=c[l]).i]=u.x(d);return a.join("")})}var Ro=180/Math.PI,Hr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fa(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*Ro,skewX:Math.atan(c)*Ro,scaleX:s,scaleY:a}}var Pt;function Vf(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hr:fa(t.a,t.b,t.c,t.d,t.e,t.f)}function Bf(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?Hr:(e=e.matrix,fa(e.a,e.b,e.c,e.d,e.e,e.f))}function ha(e,t,n,r){function i(d){return d.length?d.pop()+" ":""}function o(d,l,u,f,h,p){if(d!==u||l!==f){var y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:je(d,u)},{i:y-2,x:je(l,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(d,l,u,f){d!==l?(d-l>180?l+=360:l-d>180&&(d+=360),f.push({i:u.push(i(u)+"rotate(",null,r)-2,x:je(d,l)})):l&&u.push(i(u)+"rotate("+l+r)}function a(d,l,u,f){d!==l?f.push({i:u.push(i(u)+"skewX(",null,r)-2,x:je(d,l)}):l&&u.push(i(u)+"skewX("+l+r)}function c(d,l,u,f,h,p){if(d!==u||l!==f){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:je(d,u)},{i:y-2,x:je(l,f)})}else(u!==1||f!==1)&&h.push(i(h)+"scale("+u+","+f+")")}return function(d,l){var u=[],f=[];return d=e(d),l=e(l),o(d.translateX,d.translateY,l.translateX,l.translateY,u,f),s(d.rotate,l.rotate,u,f),a(d.skewX,l.skewX,u,f),c(d.scaleX,d.scaleY,l.scaleX,l.scaleY,u,f),d=l=null,function(h){for(var p=-1,y=f.length,m;++p<y;)u[(m=f[p]).i]=m.x(h);return u.join("")}}}var qf=ha(Vf,"px, ","px)","deg)"),Yf=ha(Bf,", ",")",")"),Gf=1e-12;function To(e){return((e=Math.exp(e))+1/e)/2}function Wf(e){return((e=Math.exp(e))-1/e)/2}function Xf(e){return((e=Math.exp(2*e))-1)/(e+1)}const Uf=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],d=o[2],l=s[0],u=s[1],f=s[2],h=l-a,p=u-c,y=h*h+p*p,m,w;if(y<Gf)w=Math.log(f/d)/t,m=function(C){return[a+C*h,c+C*p,d*Math.exp(t*C*w)]};else{var b=Math.sqrt(y),g=(f*f-d*d+r*y)/(2*d*n*b),x=(f*f-d*d-r*y)/(2*f*n*b),N=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(x*x+1)-x);w=(S-N)/t,m=function(C){var _=C*w,k=To(N),M=d/(n*b)*(k*Xf(t*_+N)-Wf(N));return[a+M*h,c+M*p,d*k/To(t*_+N)]}}return m.duration=w*1e3*t/Math.SQRT2,m}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);var Qe=0,dt=0,ct=0,ga=1e3,Ut,ft,Kt=0,Fe=0,ln=0,wt=typeof performance=="object"&&performance.now?performance:Date,pa=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oi(){return Fe||(pa(Kf),Fe=wt.now()+ln)}function Kf(){Fe=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=ma.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oi():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Ut=this,ft=this),this._call=e,this._time=n,Vr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vr())}};function ma(e,t,n){var r=new Zt;return r.restart(e,t,n),r}function Zf(){oi(),++Qe;for(var e=Ut,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function jo(){Fe=(Kt=wt.now())+ln,Qe=dt=0;try{Zf()}finally{Qe=0,Jf(),Fe=0}}function Qf(){var e=wt.now(),t=e-Kt;t>ga&&(ln-=t,Kt=e)}function Jf(){for(var e,t=Ut,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ut=n);ft=e,Vr(r)}function Vr(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Fe;t>24?(e<1/0&&(dt=setTimeout(jo,e-wt.now()-ln)),ct&&(ct=clearInterval(ct))):(ct||(Kt=wt.now(),ct=setInterval(Qf,ga)),Qe=1,pa(jo))}}function Po(e,t,n){var r=new Zt;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var eh=an("start","end","cancel","interrupt"),th=[],ya=0,Lo=1,Br=2,Vt=3,Oo=4,qr=5,Bt=6;function un(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;nh(e,n,{name:t,index:r,group:i,on:eh,tween:th,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ya})}function si(e,t){var n=we(e,t);if(n.state>ya)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Vt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function nh(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ma(o,0,n.time);function o(d){n.state=Lo,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var l,u,f,h;if(n.state!==Lo)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===Vt)return Po(s);h.state===Oo?(h.state=Bt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+l<t&&(h.state=Bt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[l])}if(Po(function(){n.state===Vt&&(n.state=Oo,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=Br,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Br){for(n.state=Vt,i=new Array(f=n.tween.length),l=0,u=-1;l<f;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=h);i.length=u+1}}function a(d){for(var l=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=qr,1),u=-1,f=i.length;++u<f;)i[u].call(e,l);n.state===qr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Bt,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>Br&&r.state<qr,r.state=Bt,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function rh(e){return this.each(function(){qt(this,e)})}function ih(e,t){var n,r;return function(){var i=Ee(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function oh(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Ee(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,d=i.length;c<d;++c)if(i[c].name===t){i[c]=a;break}c===d&&i.push(a)}o.tween=i}}function sh(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=we(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?ih:oh)(n,e,t))}function ai(e,t,n){var r=e._id;return e.each(function(){var i=Ee(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,r).value[t]}}function xa(e,t){var n;return(typeof t=="number"?je:t instanceof xt?$o:(n=xt(t))?(t=n,$o):Hf)(e,t)}function ah(e){return function(){this.removeAttribute(e)}}function ch(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lh(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function uh(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function dh(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function fh(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function hh(e,t){var n=cn(e),r=n==="transform"?Yf:xa;return this.attrTween(e,typeof t=="function"?(n.local?fh:dh)(n,r,ai(this,"attr."+e,t)):t==null?(n.local?ch:ah)(n):(n.local?uh:lh)(n,r,t))}function gh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ph(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mh(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&ph(e,o)),n}return i._value=t,i}function yh(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&gh(e,o)),n}return i._value=t,i}function xh(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=cn(e);return this.tween(n,(r.local?mh:yh)(r,t))}function wh(e,t){return function(){si(this,e).delay=+t.apply(this,arguments)}}function bh(e,t){return t=+t,function(){si(this,e).delay=t}}function vh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wh:bh)(t,e)):we(this.node(),t).delay}function _h(e,t){return function(){Ee(this,e).duration=+t.apply(this,arguments)}}function Eh(e,t){return t=+t,function(){Ee(this,e).duration=t}}function Nh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_h:Eh)(t,e)):we(this.node(),t).duration}function kh(e,t){if(typeof t!="function")throw new Error;return function(){Ee(this,e).ease=t}}function Sh(e){var t=this._id;return arguments.length?this.each(kh(t,e)):we(this.node(),t).ease}function Ch(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function Mh(e){if(typeof e!="function")throw new Error;return this.each(Ch(this._id,e))}function Ih(e){typeof e!="function"&&(e=Us(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,d=0;d<s;++d)(c=o[d])&&e.call(c,c.__data__,d,o)&&a.push(c);return new Ae(r,this._parents,this._name,this._id)}function Ah(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],d=n[a],l=c.length,u=s[a]=new Array(l),f,h=0;h<l;++h)(f=c[h]||d[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function $h(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Rh(e,t,n){var r,i,o=$h(t)?si:Ee;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Th(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Rh(n,e,t))}function jh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ph(){return this.on("end.remove",jh(this._id))}function Lh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ni(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,d=o[s]=new Array(c),l,u,f=0;f<c;++f)(l=a[f])&&(u=e.call(l,l.__data__,f,a))&&("__data__"in l&&(u.__data__=l.__data__),d[f]=u,un(d[f],t,n,f,d,we(l,n)));return new Ae(o,this._parents,t,n)}function Oh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xs(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],d=c.length,l,u=0;u<d;++u)if(l=c[u]){for(var f=e.call(l,l.__data__,u,c),h,p=we(l,n),y=0,m=f.length;y<m;++y)(h=f[y])&&un(h,t,n,y,f,p);o.push(f),s.push(l)}return new Ae(o,s,t,n)}var Dh=kt.prototype.constructor;function zh(){return new Dh(this._groups,this._parents)}function Fh(e,t){var n,r,i;return function(){var o=Ze(this,e),s=(this.style.removeProperty(e),Ze(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function wa(e){return function(){this.style.removeProperty(e)}}function Hh(e,t,n){var r,i=n+"",o;return function(){var s=Ze(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function Vh(e,t,n){var r,i,o;return function(){var s=Ze(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ze(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function Bh(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Ee(this,e),d=c.on,l=c.value[o]==null?a||(a=wa(t)):void 0;(d!==n||i!==l)&&(r=(n=d).copy()).on(s,i=l),c.on=r}}function qh(e,t,n){var r=(e+="")=="transform"?qf:xa;return t==null?this.styleTween(e,Fh(e,r)).on("end.style."+e,wa(e)):typeof t=="function"?this.styleTween(e,Vh(e,r,ai(this,"style."+e,t))).each(Bh(this._id,e)):this.styleTween(e,Hh(e,r,t),n).on("end.style."+e,null)}function Yh(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Gh(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&Yh(e,s,n)),r}return o._value=t,o}function Wh(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Gh(e,t,n??""))}function Xh(e){return function(){this.textContent=e}}function Uh(e){return function(){var t=e(this);this.textContent=t??""}}function Kh(e){return this.tween("text",typeof e=="function"?Uh(ai(this,"text",e)):Xh(e==null?"":e+""))}function Zh(e){return function(t){this.textContent=e.call(this,t)}}function Qh(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Zh(i)),t}return r._value=e,r}function Jh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Qh(e))}function eg(){for(var e=this._name,t=this._id,n=ba(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,d=0;d<a;++d)if(c=s[d]){var l=we(c,t);un(c,e,n,d,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Ae(r,this._parents,e,n)}function tg(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var d=Ee(this,r),l=d.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),d.on=t}),i===0&&o()})}var ng=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ba(){return++ng}var Ne=kt.prototype;Ae.prototype={constructor:Ae,select:Lh,selectAll:Oh,selectChild:Ne.selectChild,selectChildren:Ne.selectChildren,filter:Ih,merge:Ah,selection:zh,transition:eg,call:Ne.call,nodes:Ne.nodes,node:Ne.node,size:Ne.size,empty:Ne.empty,each:Ne.each,on:Th,attr:hh,attrTween:xh,style:qh,styleTween:Wh,text:Kh,textTween:Jh,remove:Ph,tween:sh,delay:vh,duration:Nh,ease:Sh,easeVarying:Mh,end:tg,[Symbol.iterator]:Ne[Symbol.iterator]};function rg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ig={time:null,delay:0,duration:250,ease:rg};function og(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function sg(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=ba(),(n=ig).time=oi(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,d=0;d<a;++d)(c=s[d])&&un(c,e,t,d,s,n||og(c,t));return new Ae(r,this._parents,e,t)}kt.prototype.interrupt=rh;kt.prototype.transition=sg;const Lt=e=>()=>e;function ag(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Se(e,t,n){this.k=e,this.x=t,this.y=n}Se.prototype={constructor:Se,scale:function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var dn=new Se(1,0,0);va.prototype=Se.prototype;function va(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dn;return e.__zoom}function Nr(e){e.stopImmediatePropagation()}function lt(e){e.preventDefault(),e.stopImmediatePropagation()}function cg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lg(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Do(){return this.__zoom||dn}function ug(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dg(){return navigator.maxTouchPoints||"ontouchstart"in this}function fg(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function _a(){var e=cg,t=lg,n=fg,r=ug,i=dg,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Uf,d=an("start","zoom","end"),l,u,f,h=500,p=150,y=0,m=10;function w(v){v.property("__zoom",Do).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",M).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(v,T,$,j){var F=v.selection?v.selection():v;F.property("__zoom",Do),v!==F?N(v,T,$,j):F.interrupt().each(function(){S(this,arguments).event(j).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},w.scaleBy=function(v,T,$,j){w.scaleTo(v,function(){var F=this.__zoom.k,L=typeof T=="function"?T.apply(this,arguments):T;return F*L},$,j)},w.scaleTo=function(v,T,$,j){w.transform(v,function(){var F=t.apply(this,arguments),L=this.__zoom,B=$==null?x(F):typeof $=="function"?$.apply(this,arguments):$,V=L.invert(B),Y=typeof T=="function"?T.apply(this,arguments):T;return n(g(b(L,Y),B,V),F,s)},$,j)},w.translateBy=function(v,T,$,j){w.transform(v,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),s)},null,j)},w.translateTo=function(v,T,$,j,F){w.transform(v,function(){var L=t.apply(this,arguments),B=this.__zoom,V=j==null?x(L):typeof j=="function"?j.apply(this,arguments):j;return n(dn.translate(V[0],V[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof $=="function"?-$.apply(this,arguments):-$),L,s)},j,F)};function b(v,T){return T=Math.max(o[0],Math.min(o[1],T)),T===v.k?v:new Se(T,v.x,v.y)}function g(v,T,$){var j=T[0]-$[0]*v.k,F=T[1]-$[1]*v.k;return j===v.x&&F===v.y?v:new Se(v.k,j,F)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,T,$,j){v.on("start.zoom",function(){S(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(j).end()}).tween("zoom",function(){var F=this,L=arguments,B=S(F,L).event(j),V=t.apply(F,L),Y=$==null?x(V):typeof $=="function"?$.apply(F,L):$,R=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),P=F.__zoom,O=typeof T=="function"?T.apply(F,L):T,H=c(P.invert(Y).concat(R/P.k),O.invert(Y).concat(R/O.k));return function(q){if(q===1)q=O;else{var G=H(q),U=R/G[2];q=new Se(U,Y[0]-G[0]*U,Y[1]-G[1]*U)}B.zoom(null,q)}})}function S(v,T,$){return!$&&v.__zooming||new C(v,T)}function C(v,T){this.that=v,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,T),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,T){return this.mouse&&v!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var T=de(this.that).datum();d.call(v,this.that,new ag(v,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:d}),T)}};function _(v,...T){if(!e.apply(this,arguments))return;var $=S(this,T).event(v),j=this.__zoom,F=Math.max(o[0],Math.min(o[1],j.k*Math.pow(2,r.apply(this,arguments)))),L=pe(v);if($.wheel)($.mouse[0][0]!==L[0]||$.mouse[0][1]!==L[1])&&($.mouse[1]=j.invert($.mouse[0]=L)),clearTimeout($.wheel);else{if(j.k===F)return;$.mouse=[L,j.invert(L)],qt(this),$.start()}lt(v),$.wheel=setTimeout(B,p),$.zoom("mouse",n(g(b(j,F),$.mouse[0],$.mouse[1]),$.extent,s));function B(){$.wheel=null,$.end()}}function k(v,...T){if(f||!e.apply(this,arguments))return;var $=v.currentTarget,j=S(this,T,!0).event(v),F=de(v.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",R,!0),L=pe(v,$),B=v.clientX,V=v.clientY;oa(v.view),Nr(v),j.mouse=[L,this.__zoom.invert(L)],qt(this),j.start();function Y(P){if(lt(P),!j.moved){var O=P.clientX-B,H=P.clientY-V;j.moved=O*O+H*H>y}j.event(P).zoom("mouse",n(g(j.that.__zoom,j.mouse[0]=pe(P,$),j.mouse[1]),j.extent,s))}function R(P){F.on("mousemove.zoom mouseup.zoom",null),sa(P.view,j.moved),lt(P),j.event(P).end()}}function M(v,...T){if(e.apply(this,arguments)){var $=this.__zoom,j=pe(v.changedTouches?v.changedTouches[0]:v,this),F=$.invert(j),L=$.k*(v.shiftKey?.5:2),B=n(g(b($,L),j,F),t.apply(this,T),s);lt(v),a>0?de(this).transition().duration(a).call(N,B,j,v):de(this).call(w.transform,B,j,v)}}function I(v,...T){if(e.apply(this,arguments)){var $=v.touches,j=$.length,F=S(this,T,v.changedTouches.length===j).event(v),L,B,V,Y;for(Nr(v),B=0;B<j;++B)V=$[B],Y=pe(V,this),Y=[Y,this.__zoom.invert(Y),V.identifier],F.touch0?!F.touch1&&F.touch0[2]!==Y[2]&&(F.touch1=Y,F.taps=0):(F.touch0=Y,L=!0,F.taps=1+!!l);l&&(l=clearTimeout(l)),L&&(F.taps<2&&(u=Y[0],l=setTimeout(function(){l=null},h)),qt(this),F.start())}}function A(v,...T){if(this.__zooming){var $=S(this,T).event(v),j=v.changedTouches,F=j.length,L,B,V,Y;for(lt(v),L=0;L<F;++L)B=j[L],V=pe(B,this),$.touch0&&$.touch0[2]===B.identifier?$.touch0[0]=V:$.touch1&&$.touch1[2]===B.identifier&&($.touch1[0]=V);if(B=$.that.__zoom,$.touch1){var R=$.touch0[0],P=$.touch0[1],O=$.touch1[0],H=$.touch1[1],q=(q=O[0]-R[0])*q+(q=O[1]-R[1])*q,G=(G=H[0]-P[0])*G+(G=H[1]-P[1])*G;B=b(B,Math.sqrt(q/G)),V=[(R[0]+O[0])/2,(R[1]+O[1])/2],Y=[(P[0]+H[0])/2,(P[1]+H[1])/2]}else if($.touch0)V=$.touch0[0],Y=$.touch0[1];else return;$.zoom("touch",n(g(B,V,Y),$.extent,s))}}function D(v,...T){if(this.__zooming){var $=S(this,T).event(v),j=v.changedTouches,F=j.length,L,B;for(Nr(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),L=0;L<F;++L)B=j[L],$.touch0&&$.touch0[2]===B.identifier?delete $.touch0:$.touch1&&$.touch1[2]===B.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(B=pe(B,this),Math.hypot(u[0]-B[0],u[1]-B[1])<m)){var V=de(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return w.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:Lt(+v),w):r},w.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Lt(!!v),w):e},w.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:Lt(!!v),w):i},w.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Lt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),w):t},w.scaleExtent=function(v){return arguments.length?(o[0]=+v[0],o[1]=+v[1],w):[o[0],o[1]]},w.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],w):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},w.constrain=function(v){return arguments.length?(n=v,w):n},w.duration=function(v){return arguments.length?(a=+v,w):a},w.interpolate=function(v){return arguments.length?(c=v,w):c},w.on=function(){var v=d.on.apply(d,arguments);return v===d?w:v},w.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,w):Math.sqrt(y)},w.tapDistance=function(v){return arguments.length?(m=+v,w):m},w}const ve={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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."},bt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ea=["Enter"," ","Escape"];var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var vt;(function(e){e.Partial="partial",e.Full="full"})(vt||(vt={}));const Na={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ke;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ke||(ke={}));var Qt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Qt||(Qt={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const zo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function ka(e){return e===null?null:e?"valid":"invalid"}const Sa=e=>"id"in e&&"source"in e&&"target"in e,hg=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),ci=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),i=e.origin??t,o=n*i[0],s=r*i[1];return{x:e.position.x-o,y:e.position.y-s}},Ca=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let s=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(s=o?t.nodeLookup.get(i):ci(i)?i:t.nodeLookup.get(i.id));const a=s?Jt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return fn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hn(n)},it=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const i=Jt(r);n=fn(n,i)}}),hn(n)},Ma=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1)=>{const a={...Mt(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const d of e.values()){const{measured:l,selectable:u=!0,hidden:f=!1}=d;if(s&&!u||f)continue;const h=l.width??d.width??d.initialWidth??null,p=l.height??d.height??d.initialHeight??null,y=_t(a,tt(d)),m=(h??0)*(p??0),w=o&&y>0;(!d.internals.handleBounds||w||y>=m||d.dragging)&&c.push(d)}return c},gg=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function pg(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function mg({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},s){if(e.size===0)return Promise.resolve(!0);const a=pg(e,s),c=it(a),d=pn(c,t,n,(s==null?void 0:s.minZoom)??i,(s==null?void 0:s.maxZoom)??o,(s==null?void 0:s.padding)??.1);return await r.setViewport(d,{duration:s==null?void 0:s.duration}),Promise.resolve(!0)}function Ia({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},l=s.origin??r;let u=i;if(s.extent==="parent"&&!s.expandParent)if(!a)o==null||o("005",ve.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(u=[[c,d],[c+h,d+p]])}else a&&nt(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+d],[s.extent[1][0]+c,s.extent[1][1]+d]]);const f=nt(u)?He(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(o==null||o("015",ve.error015())),{position:{x:f.x-c+(s.measured.width??0)*l[0],y:f.y-d+(s.measured.height??0)*l[1]},positionAbsolute:f}}async function yg({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=o.has(f.id),p=!h&&f.parentId&&s.find(y=>y.id===f.parentId);(h||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),l=gg(s,c);for(const f of c)a.has(f.id)&&!l.find(p=>p.id===f.id)&&l.push(f);if(!i)return{edges:l,nodes:s};const u=await i({nodes:s,edges:l});return typeof u=="boolean"?u?{edges:l,nodes:s}:{edges:[],nodes:[]}:u}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:et(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Aa(e,t,n){const{width:r,height:i}=$e(n),{x:o,y:s}=n.internals.positionAbsolute;return He(e,[[o,s],[o+r,s+i]],t)}const Fo=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,$a=(e,t,n=15,r=40)=>{const i=Fo(e.x,r,t.width-r)*n,o=Fo(e.y,r,t.height-r)*n;return[i,o]},fn=(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)}),Yr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),hn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tt=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=ci(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Jt=(e,t=[0,0])=>{var i,o;const{x:n,y:r}=ci(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},Ra=(e,t)=>hn(fn(Yr(e),Yr(t))),_t=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Ho=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),xg=(e,t)=>{},gn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,r,i],o=!1,s=[1,1])=>{const a={x:(e-n)/i,y:(t-r)/i};return o?gn(a,s):a},en=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Ge(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wg(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ge(e,n),i=Ge(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Ge(e.top??e.y??0,n),i=Ge(e.bottom??e.y??0,n),o=Ge(e.left??e.x??0,t),s=Ge(e.right??e.x??0,t);return{top:r,right:s,bottom:i,left:o,x:o+s,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function bg(e,t,n,r,i,o){const{x:s,y:a}=en(e,[t,n,r]),{x:c,y:d}=en({x:e.x+e.width,y:e.y+e.height},[t,n,r]),l=i-c,u=o-d;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(l),bottom:Math.floor(u)}}const pn=(e,t,n,r,i,o)=>{const s=wg(o,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,d=Math.min(a,c),l=et(d,r,i),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*l,p=n/2-f*l,y=bg(e,h,p,l,t,n),m={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:l}},tn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function nt(e){return e!==void 0&&e!=="parent"}function $e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Ta(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ja(e,t={width:0,height:0},n,r,i){const o={...e},s=r.get(n);if(s){const a=s.origin||i;o.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],o.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return o}function Vo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function vg(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:s}=Ce(e),a=Mt({x:o-((i==null?void 0:i.left)??0),y:s-((i==null?void 0:i.top)??0)},r),{x:c,y:d}=n?gn(a,t):a;return{xSnapped:c,ySnapped:d,...a}}const li=e=>({width:e.offsetWidth,height:e.offsetHeight}),Pa=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_g=["INPUT","SELECT","TEXTAREA"];function La(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:_g.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Oa=e=>"clientX"in e,Ce=(e,t)=>{var o,s;const n=Oa(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Bo=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:i,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...li(s)}})};function Da({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:s,targetControlY:a}){const c=e*.125+i*.375+s*.375+n*.125,d=t*.125+o*.375+a*.375+r*.125,l=Math.abs(c-e),u=Math.abs(d-t);return[c,d,l,u]}function Ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qo({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case W.Left:return[t-Ot(t-r,o),n];case W.Right:return[t+Ot(r-t,o),n];case W.Top:return[t,n-Ot(n-i,o)];case W.Bottom:return[t,n+Ot(i-n,o)]}}function It({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:o=W.Top,curvature:s=.25}){const[a,c]=qo({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[d,l]=qo({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[u,f,h,p]=Da({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:c,targetControlX:d,targetControlY:l});return[`M${e},${t} C${a},${c} ${d},${l} ${r},${i}`,u,f,h,p]}function za({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[o,a,i,s]}function Eg({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1}){if(!i)return r;const o=n||t.selected||e.selected,s=Math.max(e.internals.z||0,t.internals.z||0,1e3);return r+(o?s:0)}function Ng({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=fn(Jt(e),Jt(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const s={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return _t(s,hn(o))>0}const kg=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Sg=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Cg=(e,t)=>{if(!e.source||!e.target)return t;let n;return Sa(e)?n={...e}:n={...e,id:kg(e)},Sg(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Fa({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=za({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const Yo={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Mg=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ig({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:i,offset:o}){const s=Yo[t],a=Yo[r],c={x:e.x+s.x*o,y:e.y+s.y*o},d={x:n.x+a.x*o,y:n.y+a.y*o},l=Mg({source:c,sourcePosition:t,target:d}),u=l.x!==0?"x":"y",f=l[u];let h=[],p,y;const m={x:0,y:0},w={x:0,y:0},[b,g,x,N]=za({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[u]*a[u]===-1){p=i.x??b,y=i.y??g;const C=[{x:p,y:c.y},{x:p,y:d.y}],_=[{x:c.x,y},{x:d.x,y}];s[u]===f?h=u==="x"?C:_:h=u==="x"?_:C}else{const C=[{x:c.x,y:d.y}],_=[{x:d.x,y:c.y}];if(u==="x"?h=s.x===f?_:C:h=s.y===f?C:_,t===r){const D=Math.abs(e[u]-n[u]);if(D<=o){const v=Math.min(o-1,o-D);s[u]===f?m[u]=(c[u]>e[u]?-1:1)*v:w[u]=(d[u]>n[u]?-1:1)*v}}if(t!==r){const D=u==="x"?"y":"x",v=s[u]===a[D],T=c[D]>d[D],$=c[D]<d[D];(s[u]===1&&(!v&&T||v&&$)||s[u]!==1&&(!v&&$||v&&T))&&(h=u==="x"?C:_)}const k={x:c.x+m.x,y:c.y+m.y},M={x:d.x+w.x,y:d.y+w.y},I=Math.max(Math.abs(k.x-h[0].x),Math.abs(M.x-h[0].x)),A=Math.max(Math.abs(k.y-h[0].y),Math.abs(M.y-h[0].y));I>=A?(p=(k.x+M.x)/2,y=h[0].y):(p=h[0].x,y=(k.y+M.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:d.x+w.x,y:d.y+w.y},n],p,y,x,N]}function Ag(e,t,n,r){const i=Math.min(Go(e,t)/2,Go(t,n)/2,r),{x:o,y:s}=t;if(e.x===o&&o===n.x||e.y===s&&s===n.y)return`L${o} ${s}`;if(e.y===s){const d=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${o+i*d},${s}Q ${o},${s} ${o},${s+i*l}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${s+i*c}Q ${o},${s} ${o+i*a},${s}`}function Gr({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:i,targetPosition:o=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:d=20}){const[l,u,f,h,p]=Ig({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:a,y:c},offset:d});return[l.reduce((m,w,b)=>{let g="";return b>0&&b<l.length-1?g=Ag(l[b-1],w,l[b+1],s):g=`${b===0?"M":"L"}${w.x} ${w.y}`,m+=g,m},""),u,f,h,p]}function Wo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function $g(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Wo(t)||!Wo(n))return null;const r=t.internals.handleBounds||Xo(t.handles),i=n.internals.handleBounds||Xo(n.handles),o=Uo((r==null?void 0:r.source)??[],e.sourceHandle),s=Uo(e.connectionMode===Je.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!o||!s)return(u=e.onError)==null||u.call(e,"008",ve.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(o==null?void 0:o.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,d=Et(t,o,a),l=Et(n,s,c);return{sourceX:d.x,sourceY:d.y,targetX:l.x,targetY:l.y,sourcePosition:a,targetPosition:c}}function Xo(e){if(!e)return null;const t=[],n=[];for(const 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 Et(e,t,n=W.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??$e(e);if(r)return{x:i+s/2,y:o+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:i+s/2,y:o};case W.Right:return{x:i+s,y:o+a/2};case W.Bottom:return{x:i+s/2,y:o+a};case W.Left:return{x:i,y:o+a/2}}}function Uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Wr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Rg(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=Wr(c,t);o.has(d)||(s.push({id:d,color:c.color||n,...c}),o.add(d))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}function Tg(e,t,n,r,i){let o=.5;i==="start"?o=0:i==="end"&&(o=1);let s=[(e.x+e.width*o)*t.zoom+t.x,e.y*t.zoom+t.y-r],a=[-100*o,-100];switch(n){case W.Right:s=[(e.x+e.width)*t.zoom+t.x+r,(e.y+e.height*o)*t.zoom+t.y],a=[0,-100*o];break;case W.Bottom:s[1]=(e.y+e.height)*t.zoom+t.y+r,a[1]=0;break;case W.Left:s=[e.x*t.zoom+t.x-r,(e.y+e.height*o)*t.zoom+t.y],a=[-100,-100*o];break}return`translate(${s[0]}px, ${s[1]}px) translate(${a[0]}%, ${a[1]}%)`}const ui={nodeOrigin:[0,0],nodeExtent:bt,elevateNodesOnSelect:!0,defaults:{}},jg={...ui,checkEquality:!0};function di(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Pg(e,t,n){const r=di(ui,n);for(const i of e.values())if(i.parentId)fi(i,e,t,r);else{const o=Ct(i,r.nodeOrigin),s=nt(i.extent)?i.extent:r.nodeExtent,a=He(o,s,$e(i));i.internals.positionAbsolute=a}}function Xr(e,t,n,r){var c,d;const i=di(jg,r);let o=e.length>0;const s=new Map(t),a=i!=null&&i.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(i.checkEquality&&l===(u==null?void 0:u.internals.userNode))t.set(l.id,u);else{const f=Ct(l,i.nodeOrigin),h=nt(l.extent)?l.extent:i.nodeExtent,p=He(f,h,$e(l));u={...i.defaults,...l,measured:{width:(c=l.measured)==null?void 0:c.width,height:(d=l.measured)==null?void 0:d.height},internals:{positionAbsolute:p,handleBounds:l.measured?u==null?void 0:u.internals.handleBounds:void 0,z:Ha(l,a),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(o=!1),l.parentId&&fi(u,t,n,r)}return o}function Lg(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function fi(e,t,n,r){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:s}=di(ui,r),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Lg(e,n);const d=i?1e3:0,{x:l,y:u,z:f}=Og(e,c,o,s,d),{positionAbsolute:h}=e.internals,p=l!==h.x||u!==h.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:l,y:u}:h,z:f}})}function Ha(e,t){return(ye(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Og(e,t,n,r,i){const{x:o,y:s}=t.internals.positionAbsolute,a=$e(e),c=Ct(e,n),d=nt(e.extent)?He(c,e.extent,a):c;let l=He({x:o+d.x,y:s+d.y},r,a);e.extent==="parent"&&(l=Aa(l,a,t));const u=Ha(e,i),f=t.internals.z??0;return{x:l.x,y:l.y,z:f>u?f:u}}function hi(e,t,n,r=[0,0]){var s;const i=[],o=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const d=((s=o.get(a.parentId))==null?void 0:s.expandedRect)??tt(c),l=Ra(d,a.rect);o.set(a.parentId,{expandedRect:l,parent:c})}return o.size>0&&o.forEach(({expandedRect:a,parent:c},d)=>{var g;const l=c.internals.positionAbsolute,u=$e(c),f=c.origin??r,h=a.x<l.x?Math.round(Math.abs(l.x-a.x)):0,p=a.y<l.y?Math.round(Math.abs(l.y-a.y)):0,y=Math.max(u.width,Math.round(a.width)),m=Math.max(u.height,Math.round(a.height)),w=(y-u.width)*f[0],b=(m-u.height)*f[1];(h>0||p>0||w||b)&&(i.push({id:d,type:"position",position:{x:c.position.x-h+w,y:c.position.y-p+b}}),(g=n.get(d))==null||g.forEach(x=>{e.some(N=>N.id===x.id)||i.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+p}})})),(u.width<a.width||u.height<a.height||h||p)&&i.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?f[0]*h-w:0),height:m+(p?f[1]*p-b:0)}})}),i}function Dg(e,t,n,r,i,o){const s=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],d=window.getComputedStyle(s),{m22:l}=new window.DOMMatrixReadOnly(d.transform),u=[];for(const f of e.values()){const h=t.get(f.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const p=li(f.nodeElement),y=h.measured.width!==p.width||h.measured.height!==p.height;if(!!(p.width&&p.height&&(y||!h.internals.handleBounds||f.force))){const w=f.nodeElement.getBoundingClientRect(),b=nt(h.extent)?h.extent:o;let{positionAbsolute:g}=h.internals;h.parentId&&h.extent==="parent"?g=Aa(g,p,t.get(h.parentId)):b&&(g=He(g,b,p));const x={...h,measured:p,internals:{...h.internals,positionAbsolute:g,handleBounds:{source:Bo("source",f.nodeElement,w,l,h.id),target:Bo("target",f.nodeElement,w,l,h.id)}}};t.set(h.id,x),h.parentId&&fi(x,t,n,{nodeOrigin:i}),a=!0,y&&(c.push({id:h.id,type:"dimensions",dimensions:p}),h.expandParent&&h.parentId&&u.push({id:h.id,parentId:h.parentId,rect:tt(x,i)}))}}if(u.length>0){const f=hi(u,t,n,i);c.push(...f)}return{changes:c,updatedInternals:a}}async function zg({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Ko(e,t,n,r,i,o){let s=i;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${i}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),o){s=`${i}-${e}-${o}`;const d=r.get(s)||new Map;r.set(s,d.set(n,t))}}function Va(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:s,targetHandle:a},d=`${i}-${s}--${o}-${a}`,l=`${o}-${a}--${i}-${s}`;Ko("source",c,l,e,i,s),Ko("target",c,d,e,o,a),t.set(r.id,r)}}function Ba(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ba(n,t):!1}function Zo(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Fg(e,t,n,r){const i=new Map;for(const[o,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Ba(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(o);a&&i.set(o,{id:o,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return i}function kr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const i=[];for(const[d,l]of t){const u=(s=n.get(d))==null?void 0:s.internals.userNode;u&&i.push({...u,position:l.position,dragging:r})}if(!e)return[i[0],i];const o=(a=n.get(e))==null?void 0:a.internals.userNode;return[o?{...o,position:((c=t.get(e))==null?void 0:c.position)||o.position,dragging:r}:i[0],i]}function Hg({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},s=0,a=new Map,c=!1,d={x:0,y:0},l=null,u=!1,f=null,h=!1;function p({noDragClassName:m,handleSelector:w,domNode:b,isSelectable:g,nodeId:x,nodeClickDistance:N=0}){f=de(b);function S({x:M,y:I},A){const{nodeLookup:D,nodeExtent:v,snapGrid:T,snapToGrid:$,nodeOrigin:j,onNodeDrag:F,onSelectionDrag:L,onError:B,updateNodePositions:V}=t();o={x:M,y:I};let Y=!1,R={x:0,y:0,x2:0,y2:0};if(a.size>1&&v){const P=it(a);R=Yr(P)}for(const[P,O]of a){if(!D.has(P))continue;let H={x:M-O.distance.x,y:I-O.distance.y};$&&(H=gn(H,T));let q=[[v[0][0],v[0][1]],[v[1][0],v[1][1]]];if(a.size>1&&v&&!O.extent){const{positionAbsolute:Z}=O.internals,K=Z.x-R.x+v[0][0],X=Z.x+O.measured.width-R.x2+v[1][0],J=Z.y-R.y+v[0][1],ee=Z.y+O.measured.height-R.y2+v[1][1];q=[[K,J],[X,ee]]}const{position:G,positionAbsolute:U}=Ia({nodeId:P,nextPosition:H,nodeLookup:D,nodeExtent:q,nodeOrigin:j,onError:B});Y=Y||O.position.x!==G.x||O.position.y!==G.y,O.position=G,O.internals.positionAbsolute=U}if(Y&&(V(a,!0),A&&(r||F||!x&&L))){const[P,O]=kr({nodeId:x,dragItems:a,nodeLookup:D});r==null||r(A,a,P,O),F==null||F(A,P,O),x||L==null||L(A,O)}}async function C(){if(!l)return;const{transform:M,panBy:I,autoPanSpeed:A,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(s);return}const[v,T]=$a(d,l,A);(v!==0||T!==0)&&(o.x=(o.x??0)-v/M[2],o.y=(o.y??0)-T/M[2],await I({x:v,y:T})&&S(o,null)),s=requestAnimationFrame(C)}function _(M){var Y;const{nodeLookup:I,multiSelectionActive:A,nodesDraggable:D,transform:v,snapGrid:T,snapToGrid:$,selectNodesOnDrag:j,onNodeDragStart:F,onSelectionDragStart:L,unselectNodesAndEdges:B}=t();u=!0,(!j||!g)&&!A&&x&&((Y=I.get(x))!=null&&Y.selected||B()),g&&j&&x&&(e==null||e(x));const V=ht(M.sourceEvent,{transform:v,snapGrid:T,snapToGrid:$,containerBounds:l});if(o=V,a=Fg(I,D,V,x),a.size>0&&(n||F||!x&&L)){const[R,P]=kr({nodeId:x,dragItems:a,nodeLookup:I});n==null||n(M.sourceEvent,a,R,P),F==null||F(M.sourceEvent,R,P),x||L==null||L(M.sourceEvent,P)}}const k=aa().clickDistance(N).on("start",M=>{const{domNode:I,nodeDragThreshold:A,transform:D,snapGrid:v,snapToGrid:T}=t();l=(I==null?void 0:I.getBoundingClientRect())||null,h=!1,A===0&&_(M),o=ht(M.sourceEvent,{transform:D,snapGrid:v,snapToGrid:T,containerBounds:l}),d=Ce(M.sourceEvent,l)}).on("drag",M=>{const{autoPanOnNodeDrag:I,transform:A,snapGrid:D,snapToGrid:v,nodeDragThreshold:T,nodeLookup:$}=t(),j=ht(M.sourceEvent,{transform:A,snapGrid:D,snapToGrid:v,containerBounds:l});if((M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||x&&!$.has(x))&&(h=!0),!h){if(!c&&I&&u&&(c=!0,C()),!u){const F=j.xSnapped-(o.x??0),L=j.ySnapped-(o.y??0);Math.sqrt(F*F+L*L)>T&&_(M)}(o.x!==j.xSnapped||o.y!==j.ySnapped)&&a&&u&&(d=Ce(M.sourceEvent,l),S(j,M.sourceEvent))}}).on("end",M=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:I,updateNodePositions:A,onNodeDragStop:D,onSelectionDragStop:v}=t();if(A(a,!1),i||D||!x&&v){const[T,$]=kr({nodeId:x,dragItems:a,nodeLookup:I,dragging:!1});i==null||i(M.sourceEvent,a,T,$),D==null||D(M.sourceEvent,T,$),x||v==null||v(M.sourceEvent,$)}}}).filter(M=>{const I=M.target;return!M.button&&(!m||!Zo(I,`.${m}`,b))&&(!w||Zo(I,w,b))});f.call(k)}function y(){f==null||f.on(".drag",null)}return{update:p,destroy:y}}function Vg(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())_t(i,tt(o))>0&&r.push(o);return r}const Bg=250;function qg(e,t,n,r){var a,c;let i=[],o=1/0;const s=Vg(e,n,t+Bg);for(const d of s){const l=[...((a=d.internals.handleBounds)==null?void 0:a.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of l){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=Et(d,u,u.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<o?(i=[{...u,x:f,y:h}],o=p):p===o&&i.push({...u,x:f,y:h}))}}if(!i.length)return null;if(i.length>1){const d=r.type==="source"?"target":"source";return i.find(l=>l.type===d)??i[0]}return i[0]}function qa(e,t,n,r,i,o=!1){var d,l,u;const s=r.get(e);if(!s)return null;const a=i==="strict"?(d=s.internals.handleBounds)==null?void 0:d[t]:[...((l=s.internals.handleBounds)==null?void 0:l.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&o?{...c,...Et(s,c,c.position,!0)}:c}function Ya(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Yg(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ga=()=>!0;function Gg(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:s,domNode:a,nodeLookup:c,lib:d,autoPanOnConnect:l,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:w=Ga,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:N,autoPanSpeed:S}){const C=Pa(e.target);let _=0,k;const{x:M,y:I}=Ce(e),A=C==null?void 0:C.elementFromPoint(M,I),D=Ya(o,A),v=a==null?void 0:a.getBoundingClientRect();if(!v||!D)return;const T=qa(i,D,r,c,t);if(!T)return;let $=Ce(e,v),j=!1,F=null,L=!1,B=null;function V(){if(!l||!v)return;const[U,Z]=$a($,v,S);f({x:U,y:Z}),_=requestAnimationFrame(V)}const Y={...T,nodeId:i,type:D,position:T.position},R=c.get(i),O={inProgress:!0,isValid:null,from:Et(R,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:R,to:$,toHandle:null,toPosition:zo[Y.position],toNode:null};g(O);let H=O;p==null||p(e,{nodeId:i,handleId:r,handleType:D});function q(U){if(!N()||!Y){G(U);return}const Z=x();$=Ce(U,v),k=qg(Mt($,Z,!1,[1,1]),n,c,Y),j||(V(),j=!0);const K=Wa(U,{handle:k,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:s?"target":"source",isValidConnection:w,doc:C,lib:d,flowId:u,nodeLookup:c});B=K.handleDomNode,F=K.connection,L=Yg(!!k,K.isValid);const X={...H,isValid:L,to:K.toHandle&&L?en({x:K.toHandle.x,y:K.toHandle.y},Z):$,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:zo[Y.position],toNode:K.toHandle?c.get(K.toHandle.nodeId):null};L&&k&&H.toHandle&&X.toHandle&&H.toHandle.type===X.toHandle.type&&H.toHandle.nodeId===X.toHandle.nodeId&&H.toHandle.id===X.toHandle.id&&H.to.x===X.to.x&&H.to.y===X.to.y||(g(X),H=X)}function G(U){(k||B)&&F&&L&&(y==null||y(F));const{inProgress:Z,...K}=H,X={...K,toPosition:H.toHandle?H.toPosition:null};m==null||m(U,X),o&&(b==null||b(U,X)),h(),cancelAnimationFrame(_),j=!1,L=!1,F=null,B=null,C.removeEventListener("mousemove",q),C.removeEventListener("mouseup",G),C.removeEventListener("touchmove",q),C.removeEventListener("touchend",G)}C.addEventListener("mousemove",q),C.addEventListener("mouseup",G),C.addEventListener("touchmove",q),C.addEventListener("touchend",G)}function Wa(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:s,lib:a,flowId:c,isValidConnection:d=Ga,nodeLookup:l}){const u=o==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Ce(e),y=s.elementFromPoint(h,p),m=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,w={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const b=Ya(void 0,m),g=m.getAttribute("data-nodeid"),x=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!g||!b)return w;const C={source:u?g:r,sourceHandle:u?x:i,target:u?r:g,targetHandle:u?i:x};w.connection=C;const k=N&&S&&(n===Je.Strict?u&&b==="source"||!u&&b==="target":g!==r||x!==i);w.isValid=k&&d(C),w.toHandle=qa(g,b,x,l,n,!0)}return w}const Ur={onPointerDown:Gg,isValid:Wa};function Wg({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=de(e);function o({translateExtent:a,width:c,height:d,zoomStep:l=10,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const p=g=>{const x=n();if(g.sourceEvent.type!=="wheel"||!t)return;const N=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*l,S=x[2]*Math.pow(2,N);t.scaleTo(S)};let y=[0,0];const m=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(y=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},w=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;const C=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),_={x:x[0]-S[0]*C,y:x[1]-S[1]*C},k=[[0,0],[c,d]];t.setViewportConstrained({x:_.x,y:_.y,zoom:x[2]},k,a)},b=_a().on("start",m).on("zoom",u?w:null).on("zoom.wheel",f?p:null);i.call(b,{})}function s(){i.on("zoom",null)}return{update:o,destroy:s,pointer:pe}}const Xg=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,mn=e=>({x:e.x,y:e.y,zoom:e.k}),Sr=({x:e,y:t,zoom:n})=>dn.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Xa=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Cr=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},Ua=e=>{const t=e.ctrlKey&&tn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ug({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:d}){return l=>{if(We(l,t))return!1;l.preventDefault(),l.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(l.ctrlKey&&s){const m=pe(l),w=Ua(l),b=u*Math.pow(2,w);r.scaleTo(n,b,m,l);return}const f=l.deltaMode===1?20:1;let h=i===De.Vertical?0:l.deltaX*f,p=i===De.Horizontal?0:l.deltaY*f;!tn()&&l.shiftKey&&i!==De.Vertical&&(h=l.deltaY*f,p=0),r.translateBy(n,-(h/u)*o,-(p/u)*o,{internal:!0});const y=mn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(l,y)),e.isPanScrolling&&(c==null||c(l,y),e.panScrollTimeout=setTimeout(()=>{d==null||d(l,y),e.isPanScrolling=!1},150))}}function Kg({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",s=!t&&o&&!r.ctrlKey,a=We(r,e);if(r.ctrlKey&&o&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,i)}}function Zg({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,s,a;if((o=r.sourceEvent)!=null&&o.internal)return;const i=mn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function Qg({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{var s,a;e.usedRightMouseButton=!!(n&&Xa(t,e.mouseButton??0)),(s=o.sourceEvent)!=null&&s.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!((a=o.sourceEvent)!=null&&a.internal)&&(i==null||i(o.sourceEvent,mn(o.transform)))}}function Jg({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,o&&Xa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&o(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),i&&Xg(e.prevViewport,s.transform))){const c=mn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(s.sourceEvent,c)},n?150:0)}}}function ep({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:d}){return l=>{var p;const u=e||t,f=n&&l.ctrlKey;if(l.button===1&&l.type==="mousedown"&&(We(l,`${d}-flow__node`)||We(l,`${d}-flow__edge`)))return!0;if(!r&&!u&&!i&&!o&&!n||s||We(l,a)&&l.type==="wheel"||We(l,c)&&(l.type!=="wheel"||i&&l.type==="wheel"&&!e)||!n&&l.ctrlKey&&l.type==="wheel")return!1;if(!n&&l.type==="touchstart"&&((p=l.touches)==null?void 0:p.length)>1)return l.preventDefault(),!1;if(!u&&!i&&!f&&l.type==="wheel"||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const h=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||l.type==="wheel")&&h}}function tp({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:i,viewport:o,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:d}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=_a().clickDistance(!ye(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(i),h=de(e).call(f);g({x:o.x,y:o.y,zoom:et(o.zoom,t,n)},[[0,0],[u.width,u.height]],i);const p=h.on("wheel.zoom"),y=h.on("dblclick.zoom");f.wheelDelta(Ua);function m(A,D){return h?new Promise(v=>{f==null||f.transform(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:D,onPaneContextMenu:v,userSelectionActive:T,panOnScroll:$,panOnDrag:j,panOnScrollMode:F,panOnScrollSpeed:L,preventScrolling:B,zoomOnPinch:V,zoomOnScroll:Y,zoomOnDoubleClick:R,zoomActivationKeyPressed:P,lib:O,onTransformChange:H}){T&&!l.isZoomingOrPanning&&b();const G=$&&!P&&!T?Ug({zoomPanValues:l,noWheelClassName:A,d3Selection:h,d3Zoom:f,panOnScrollMode:F,panOnScrollSpeed:L,zoomOnPinch:V,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Kg({noWheelClassName:A,preventScrolling:B,d3ZoomHandler:p});if(h.on("wheel.zoom",G,{passive:!1}),!T){const Z=Zg({zoomPanValues:l,onDraggingChange:d,onPanZoomStart:a});f.on("start",Z);const K=Qg({zoomPanValues:l,panOnDrag:j,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:H});f.on("zoom",K);const X=Jg({zoomPanValues:l,panOnDrag:j,panOnScroll:$,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:d});f.on("end",X)}const U=ep({zoomActivationKeyPressed:P,panOnDrag:j,zoomOnScroll:Y,panOnScroll:$,zoomOnDoubleClick:R,zoomOnPinch:V,userSelectionActive:T,noPanClassName:D,noWheelClassName:A,lib:O});f.filter(U),R?h.on("dblclick.zoom",y):h.on("dblclick.zoom",null)}function b(){f.on("zoom",null)}async function g(A,D,v){const T=Sr(A),$=f==null?void 0:f.constrain()(T,D,v);return $&&await m($),new Promise(j=>j($))}async function x(A,D){const v=Sr(A);return await m(v,D),new Promise(T=>T(v))}function N(A){if(h){const D=Sr(A),v=h.property("__zoom");(v.k!==A.zoom||v.x!==A.x||v.y!==A.y)&&(f==null||f.transform(h,D,null,{sync:!0}))}}function S(){const A=h?va(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function C(A,D){return h?new Promise(v=>{f==null||f.scaleTo(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function _(A,D){return h?new Promise(v=>{f==null||f.scaleBy(Cr(h,D==null?void 0:D.duration,()=>v(!0)),A)}):Promise.resolve(!1)}function k(A){f==null||f.scaleExtent(A)}function M(A){f==null||f.translateExtent(A)}function I(A){const D=!ye(A)||A<0?0:A;f==null||f.clickDistance(D)}return{update:w,destroy:b,setViewport:x,setViewportConstrained:g,getViewport:S,scaleTo:C,scaleBy:_,setScaleExtent:k,setTranslateExtent:M,syncViewport:N,setClickDistance:I}}var gt;(function(e){e.Line="line",e.Handle="handle"})(gt||(gt={}));function np({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&i&&(c[0]=c[0]*-1),a&&o&&(c[1]=c[1]*-1),c}function rp(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Re(e,t){return Math.max(0,t-e)}function Te(e,t){return Math.max(0,e-t)}function Dt(e,t,n){return Math.max(0,t-e,e-n)}function Qo(e,t){return e?!t:t}function ip(e,t,n,r,i,o,s,a){let{affectsX:c,affectsY:d}=t;const{isHorizontal:l,isVertical:u}=t,f=l&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:w,maxHeight:b}=r,{x:g,y:x,width:N,height:S,aspectRatio:C}=e;let _=Math.floor(l?h-e.pointerX:0),k=Math.floor(u?p-e.pointerY:0);const M=N+(c?-_:_),I=S+(d?-k:k),A=-o[0]*N,D=-o[1]*S;let v=Dt(M,y,m),T=Dt(I,w,b);if(s){let F=0,L=0;c&&_<0?F=Re(g+_+A,s[0][0]):!c&&_>0&&(F=Te(g+M+A,s[1][0])),d&&k<0?L=Re(x+k+D,s[0][1]):!d&&k>0&&(L=Te(x+I+D,s[1][1])),v=Math.max(v,F),T=Math.max(T,L)}if(a){let F=0,L=0;c&&_>0?F=Te(g+_,a[0][0]):!c&&_<0&&(F=Re(g+M,a[1][0])),d&&k>0?L=Te(x+k,a[0][1]):!d&&k<0&&(L=Re(x+I,a[1][1])),v=Math.max(v,F),T=Math.max(T,L)}if(i){if(l){const F=Dt(M/C,w,b)*C;if(v=Math.max(v,F),s){let L=0;!c&&!d||c&&!d&&f?L=Te(x+D+M/C,s[1][1])*C:L=Re(x+D+(c?_:-_)/C,s[0][1])*C,v=Math.max(v,L)}if(a){let L=0;!c&&!d||c&&!d&&f?L=Re(x+M/C,a[1][1])*C:L=Te(x+(c?_:-_)/C,a[0][1])*C,v=Math.max(v,L)}}if(u){const F=Dt(I*C,y,m)/C;if(T=Math.max(T,F),s){let L=0;!c&&!d||d&&!c&&f?L=Te(g+I*C+A,s[1][0])/C:L=Re(g+(d?k:-k)*C+A,s[0][0])/C,T=Math.max(T,L)}if(a){let L=0;!c&&!d||d&&!c&&f?L=Re(g+I*C,a[1][0])/C:L=Te(g+(d?k:-k)*C,a[0][0])/C,T=Math.max(T,L)}}}k=k+(k<0?T:-T),_=_+(_<0?v:-v),i&&(f?M>I*C?k=(Qo(c,d)?-_:_)/C:_=(Qo(c,d)?-k:k)*C:l?(k=_/C,d=c):(_=k*C,c=d));const $=c?g+_:g,j=d?x+k:x;return{width:N+(c?-_:_),height:S+(d?-k:k),x:o[0]*_*(c?-1:1)+$,y:o[1]*k*(d?-1:1)+j}}const Ka={width:0,height:0,x:0,y:0},op={...Ka,pointerX:0,pointerY:0,aspectRatio:1};function sp(e){return[[0,0],[e.measured.width,e.measured.height]]}function ap(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,s=e.measured.height??0,a=n[0]*o,c=n[1]*s;return[[r-a,i-c],[r+o-a,i+s-c]]}function cp({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=de(e);function s({controlPosition:c,boundaries:d,keepAspectRatio:l,resizeDirection:u,onResizeStart:f,onResize:h,onResizeEnd:p,shouldResize:y}){let m={...Ka},w={...op};const b=rp(c);let g,x=null,N=[],S,C,_;const k=aa().on("start",M=>{const{nodeLookup:I,transform:A,snapGrid:D,snapToGrid:v,nodeOrigin:T,paneDomNode:$}=n();if(g=I.get(t),!g)return;x=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:F}=ht(M.sourceEvent,{transform:A,snapGrid:D,snapToGrid:v,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},w={...m,pointerX:j,pointerY:F,aspectRatio:m.width/m.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=I.get(g.parentId),C=S&&g.extent==="parent"?sp(S):void 0),N=[],_=void 0;for(const[L,B]of I)if(B.parentId===t&&(N.push({id:L,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const V=ap(B,g,B.origin??T);_?_=[[Math.min(V[0][0],_[0][0]),Math.min(V[0][1],_[0][1])],[Math.max(V[1][0],_[1][0]),Math.max(V[1][1],_[1][1])]]:_=V}f==null||f(M,{...m})}).on("drag",M=>{const{transform:I,snapGrid:A,snapToGrid:D,nodeOrigin:v}=n(),T=ht(M.sourceEvent,{transform:I,snapGrid:A,snapToGrid:D,containerBounds:x}),$=[];if(!g)return;const{x:j,y:F,width:L,height:B}=m,V={},Y=g.origin??v,{width:R,height:P,x:O,y:H}=ip(w,b,T,d,l,Y,C,_),q=R!==L,G=P!==B,U=O!==j&&q,Z=H!==F&&G;if(!U&&!Z&&!q&&!G)return;if((U||Z||Y[0]===1||Y[1]===1)&&(V.x=U?O:m.x,V.y=Z?H:m.y,m.x=V.x,m.y=V.y,N.length>0)){const ee=O-j,re=H-F;for(const ae of N)ae.position={x:ae.position.x-ee+Y[0]*(R-L),y:ae.position.y-re+Y[1]*(P-B)},$.push(ae)}if((q||G)&&(V.width=q&&(!u||u==="horizontal")?R:m.width,V.height=G&&(!u||u==="vertical")?P:m.height,m.width=V.width,m.height=V.height),S&&g.expandParent){const ee=Y[0]*(V.width??0);V.x&&V.x<ee&&(m.x=ee,w.x=w.x-(V.x-ee));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(m.y=re,w.y=w.y-(V.y-re))}const K=np({width:m.width,prevWidth:L,height:m.height,prevHeight:B,affectsX:b.affectsX,affectsY:b.affectsY}),X={...m,direction:K};(y==null?void 0:y(M,X))!==!1&&(h==null||h(M,X),r(V,$))}).on("end",M=>{p==null||p(M,{...m}),i==null||i({...m})});o.call(k)}function a(){o.on(".drag",null)}return{update:s,destroy:a}}var Mr={exports:{}},Ir={},Ar={exports:{}},$r={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|