@alepha/devtools 0.14.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/devtools/actions.html +37 -0
- package/assets/devtools/actions.html.br +0 -0
- package/assets/devtools/actions.html.gz +0 -0
- package/assets/devtools/asset.BZV40eAE.css.br +0 -0
- package/assets/devtools/asset.BZV40eAE.css.gz +0 -0
- package/assets/devtools/asset.CMFNRMve.css +1 -0
- package/assets/devtools/asset.CMFNRMve.css.br +0 -0
- package/assets/devtools/asset.CMFNRMve.css.gz +0 -0
- package/assets/devtools/atoms.html +37 -0
- package/assets/devtools/atoms.html.br +0 -0
- package/assets/devtools/atoms.html.gz +0 -0
- package/assets/devtools/caches.html +37 -0
- package/assets/devtools/caches.html.br +0 -0
- package/assets/devtools/caches.html.gz +0 -0
- package/assets/devtools/{chunk.DF8tZYh8.js → chunk.-1T4AUjH.js} +1 -1
- package/assets/devtools/chunk.-1T4AUjH.js.br +0 -0
- package/assets/devtools/chunk.-1T4AUjH.js.gz +0 -0
- package/assets/devtools/{chunk.CQ8PqHT0.js → chunk.01h1zGjv.js} +1 -1
- package/assets/devtools/chunk.01h1zGjv.js.br +0 -0
- package/assets/devtools/chunk.01h1zGjv.js.gz +0 -0
- package/assets/devtools/chunk.1JiUrdgo.js +1 -0
- package/assets/devtools/chunk.1JiUrdgo.js.br +1 -0
- package/assets/devtools/chunk.1JiUrdgo.js.gz +0 -0
- package/assets/devtools/chunk.42CgRmmy.js +1 -0
- package/assets/devtools/chunk.42CgRmmy.js.br +0 -0
- package/assets/devtools/chunk.42CgRmmy.js.gz +0 -0
- package/assets/devtools/{chunk.BjjA59Pf.js → chunk.6zj3eUIy.js} +1 -1
- package/assets/devtools/chunk.6zj3eUIy.js.br +0 -0
- package/assets/devtools/chunk.6zj3eUIy.js.gz +0 -0
- package/assets/devtools/{chunk.BeYM7pih.js → chunk.B1BX4OlP.js} +1 -1
- package/assets/devtools/chunk.B1BX4OlP.js.br +0 -0
- package/assets/devtools/chunk.B1BX4OlP.js.gz +0 -0
- package/assets/devtools/{chunk.I1TSx4X4.js → chunk.B6bX0XQI.js} +1 -1
- package/assets/devtools/chunk.B6bX0XQI.js.br +0 -0
- package/assets/devtools/chunk.B6bX0XQI.js.gz +0 -0
- package/assets/devtools/{chunk.DcaVw31J.js → chunk.BD3_boSH.js} +1 -1
- package/assets/devtools/chunk.BD3_boSH.js.br +0 -0
- package/assets/devtools/chunk.BD3_boSH.js.gz +0 -0
- package/assets/devtools/chunk.BZZjyIAY.js +2 -0
- package/assets/devtools/chunk.BZZjyIAY.js.br +0 -0
- package/assets/devtools/chunk.BZZjyIAY.js.gz +0 -0
- package/assets/devtools/{chunk.UAANdYnt.js → chunk.B_arS3yh.js} +1 -1
- package/assets/devtools/chunk.B_arS3yh.js.br +0 -0
- package/assets/devtools/chunk.B_arS3yh.js.gz +0 -0
- package/assets/devtools/chunk.BjFrJKj1.js.br +2 -0
- package/assets/devtools/chunk.BjFrJKj1.js.gz +0 -0
- package/assets/devtools/chunk.BlqFPyLh.js.br +0 -0
- package/assets/devtools/chunk.BlqFPyLh.js.gz +0 -0
- package/assets/devtools/{chunk.Dwv4A_H_.js → chunk.CC4zyxCR.js} +1 -1
- package/assets/devtools/chunk.CC4zyxCR.js.br +0 -0
- package/assets/devtools/chunk.CC4zyxCR.js.gz +0 -0
- package/assets/devtools/{chunk.CAWWjC4E.js → chunk.CQFdZ3hg.js} +1 -1
- package/assets/devtools/chunk.CQFdZ3hg.js.br +0 -0
- package/assets/devtools/chunk.CQFdZ3hg.js.gz +0 -0
- package/assets/devtools/{chunk.DLDchrhP.js → chunk.CXR8SXil.js} +1 -1
- package/assets/devtools/chunk.CXR8SXil.js.br +0 -0
- package/assets/devtools/chunk.CXR8SXil.js.gz +0 -0
- package/assets/devtools/{chunk.ByuRJbSC.js → chunk.C_WwXcGr.js} +1 -1
- package/assets/devtools/chunk.C_WwXcGr.js.br +0 -0
- package/assets/devtools/chunk.C_WwXcGr.js.gz +0 -0
- package/assets/devtools/chunk.Chph6jJx.js +1 -0
- package/assets/devtools/chunk.Chph6jJx.js.br +0 -0
- package/assets/devtools/chunk.Chph6jJx.js.gz +0 -0
- package/assets/devtools/{chunk.CYVZxO-p.js → chunk.D8mKET3e.js} +1 -1
- package/assets/devtools/chunk.D8mKET3e.js.br +0 -0
- package/assets/devtools/chunk.D8mKET3e.js.gz +0 -0
- package/assets/devtools/chunk.DP_hRYka.js +1 -0
- package/assets/devtools/chunk.DP_hRYka.js.br +0 -0
- package/assets/devtools/chunk.DP_hRYka.js.gz +0 -0
- package/assets/devtools/{chunk.BBrq-Wwo.js → chunk.D_B99PWK.js} +1 -1
- package/assets/devtools/chunk.D_B99PWK.js.br +0 -0
- package/assets/devtools/chunk.D_B99PWK.js.gz +0 -0
- package/assets/devtools/{chunk.mJxmm31y.js → chunk.Dwq9t2Dl.js} +1 -1
- package/assets/devtools/chunk.Dwq9t2Dl.js.br +0 -0
- package/assets/devtools/chunk.Dwq9t2Dl.js.gz +0 -0
- package/assets/devtools/{chunk.XsVAJU_N.js → chunk.DyNVihb8.js} +2 -2
- package/assets/devtools/chunk.DyNVihb8.js.br +0 -0
- package/assets/devtools/chunk.DyNVihb8.js.gz +0 -0
- package/assets/devtools/{chunk.BNC0DJB8.js → chunk.KNtbB1xL.js} +1 -1
- package/assets/devtools/chunk.KNtbB1xL.js.br +0 -0
- package/assets/devtools/chunk.KNtbB1xL.js.gz +0 -0
- package/assets/devtools/{chunk.C6NWzsJg.js → chunk.MMyHzoxt.js} +1 -1
- package/assets/devtools/chunk.MMyHzoxt.js.br +0 -0
- package/assets/devtools/chunk.MMyHzoxt.js.gz +0 -0
- package/assets/devtools/{chunk.Bdi_dTor.js → chunk.NIj8k4HU.js} +1 -1
- package/assets/devtools/chunk.NIj8k4HU.js.br +0 -0
- package/assets/devtools/chunk.NIj8k4HU.js.gz +0 -0
- package/assets/devtools/{chunk.BC4Lys4j.js → chunk.UjSU-RcH.js} +1 -1
- package/assets/devtools/chunk.UjSU-RcH.js.br +0 -0
- package/assets/devtools/chunk.UjSU-RcH.js.gz +0 -0
- package/assets/devtools/{chunk.DN-SKgAD.js → chunk.Vm7uQYEE.js} +1 -1
- package/assets/devtools/chunk.Vm7uQYEE.js.br +0 -0
- package/assets/devtools/chunk.Vm7uQYEE.js.gz +0 -0
- package/assets/devtools/{chunk.DI-f4xNk.js → chunk.WpBi-27p.js} +1 -1
- package/assets/devtools/chunk.WpBi-27p.js.br +0 -0
- package/assets/devtools/chunk.WpBi-27p.js.gz +0 -0
- package/assets/devtools/{chunk.ospt8-RN.js → chunk.X37zJjnv.js} +1 -1
- package/assets/devtools/chunk.X37zJjnv.js.br +0 -0
- package/assets/devtools/chunk.X37zJjnv.js.gz +0 -0
- package/assets/devtools/{chunk.INuuLdYd.js → chunk.Yc53VNO7.js} +1 -1
- package/assets/devtools/chunk.Yc53VNO7.js.br +0 -0
- package/assets/devtools/chunk.Yc53VNO7.js.gz +0 -0
- package/assets/devtools/{chunk.ChDpavl2.js → chunk.jP0GrcaU.js} +1 -1
- package/assets/devtools/chunk.jP0GrcaU.js.br +0 -0
- package/assets/devtools/chunk.jP0GrcaU.js.gz +0 -0
- package/assets/devtools/chunk.ovzUqJjU.js +1 -0
- package/assets/devtools/chunk.ovzUqJjU.js.br +0 -0
- package/assets/devtools/chunk.ovzUqJjU.js.gz +0 -0
- package/assets/devtools/{chunk.DxjqPOcc.js → chunk.uK7gG_4K.js} +1 -1
- package/assets/devtools/chunk.uK7gG_4K.js.br +0 -0
- package/assets/devtools/chunk.uK7gG_4K.js.gz +0 -0
- package/assets/devtools/chunk.uyVen0u2.js.br +0 -0
- package/assets/devtools/chunk.uyVen0u2.js.gz +0 -0
- package/assets/devtools/chunk.xP6lcP0O.js +2 -0
- package/assets/devtools/chunk.xP6lcP0O.js.br +0 -0
- package/assets/devtools/chunk.xP6lcP0O.js.gz +0 -0
- package/assets/devtools/{chunk.iyc5GsVj.js → chunk.yhAz0qwe.js} +1 -1
- package/assets/devtools/chunk.yhAz0qwe.js.br +0 -0
- package/assets/devtools/chunk.yhAz0qwe.js.gz +0 -0
- package/assets/devtools/db.html +34 -0
- package/assets/devtools/db.html.br +0 -0
- package/assets/devtools/db.html.gz +0 -0
- package/assets/devtools/entry.BdraBs_7.js +79 -0
- package/assets/devtools/entry.BdraBs_7.js.br +0 -0
- package/assets/devtools/entry.BdraBs_7.js.gz +0 -0
- package/assets/devtools/env.html +35 -0
- package/assets/devtools/env.html.br +0 -0
- package/assets/devtools/env.html.gz +0 -0
- package/assets/devtools/graph.html +38 -0
- package/assets/devtools/graph.html.br +0 -0
- package/assets/devtools/graph.html.gz +0 -0
- package/assets/devtools/index.html +28 -8
- package/assets/devtools/index.html.br +0 -0
- package/assets/devtools/index.html.gz +0 -0
- package/assets/devtools/logs.html +38 -0
- package/assets/devtools/logs.html.br +0 -0
- package/assets/devtools/logs.html.gz +0 -0
- package/assets/devtools/queues.html +30 -0
- package/assets/devtools/queues.html.br +0 -0
- package/assets/devtools/queues.html.gz +0 -0
- package/assets/devtools/topics.html +38 -0
- package/assets/devtools/topics.html.br +0 -0
- package/assets/devtools/topics.html.gz +0 -0
- package/dist/index.d.ts +336 -1604
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/api/DevToolsProvider.ts +3 -3
- package/src/api/providers/DevToolsDatabaseProvider.ts +1 -1
- package/src/api/providers/DevToolsMetadataProvider.ts +2 -2
- package/src/index.ts +0 -4
- package/assets/devtools/asset.DbJSgVPr.css +0 -1
- package/assets/devtools/chunk.B3_W5FaN.js +0 -1
- package/assets/devtools/chunk.BOc4btAA.js +0 -2
- package/assets/devtools/chunk.BPjMdorr.js +0 -1
- package/assets/devtools/chunk.C1yl87Yo.js +0 -1
- package/assets/devtools/chunk.C5K_AIru.js +0 -1
- package/assets/devtools/chunk.DAVfKvCa.js +0 -2
- package/assets/devtools/chunk.PWK2K2kI.js +0 -1
- package/assets/devtools/entry.DBfTnVUe.js +0 -75
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as Pe,a3 as Dr,ai as Ia,am as Tr,an as za,ao as Aa,r as D,j as x,F as ce,ae as ye,H as ve,af as $a,z as Pa,W as Hr,a5 as jn,aa as Ye,a8 as Da,B as Vt,T as se,ag as Ta,ad as Co,a4 as Ha,a7 as ja,ap as La}from"./entry.DBfTnVUe.js";import{d as Ra}from"./chunk.ChDpavl2.js";import{S as No}from"./chunk.DxjqPOcc.js";import{S as Oa,C as Va,I as Ba,a as Fa,b as Xa}from"./chunk.Dwv4A_H_.js";import{B as Ue,S as dt}from"./chunk.DLDchrhP.js";import{D as _n,u as Ya}from"./chunk.mJxmm31y.js";import{A as Wa}from"./chunk.iyc5GsVj.js";import{I as Za}from"./chunk.DF8tZYh8.js";import"./chunk.uyVen0u2.js";import"./chunk.BNC0DJB8.js";import"./chunk.BjFrJKj1.js";import"./chunk.CAWWjC4E.js";const qa=[["path",{d:"M7 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],Ga=Pe("outline","box-multiple","BoxMultiple",qa);const Ua=[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]],jr=Pe("outline","box","Box",Ua);const Ka=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],Qa=Pe("outline","download","Download",Ka);const Ja=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-1"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-3"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-4"}]],ec=Pe("outline","focus-centered","FocusCentered",Ja);const tc=[["path",{d:"M4 4l16 0",key:"svg-0"}],["path",{d:"M4 20l16 0",key:"svg-1"}],["path",{d:"M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2",key:"svg-2"}]],nc=Pe("outline","layout-distribute-horizontal","LayoutDistributeHorizontal",tc);const oc=[["path",{d:"M4 4l0 16",key:"svg-0"}],["path",{d:"M20 4l0 16",key:"svg-1"}],["path",{d:"M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8",key:"svg-2"}]],rc=Pe("outline","layout-distribute-vertical","LayoutDistributeVertical",oc);const ic=[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]],sc=Pe("outline","lock-open","LockOpen",ic);const ac=[["path",{d:"M5 12l14 0",key:"svg-0"}]],cc=Pe("outline","minus","Minus",ac),lc=()=>Dr(Ia);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var uc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Bt(n)}function Bt(e){this._=e}function dc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Bt.prototype=sn.prototype={constructor:Bt,on:function(e,t){var n=this._,o=dc(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=fc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=Mo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Mo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function fc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Mo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=uc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const ko={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ko.hasOwnProperty(t)?{space:ko[t],local:e}:e}function hc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function gc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lr(e){var t=an(e);return(t.local?gc:hc)(t)}function pc(){}function Qn(e){return e==null?pc:function(){return this.querySelector(e)}}function mc(e){typeof e!="function"&&(e=Qn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new de(o,this._parents)}function yc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xc(){return[]}function Rr(e){return e==null?xc:function(){return this.querySelectorAll(e)}}function wc(e){return function(){return yc(e.apply(this,arguments))}}function vc(e){typeof e=="function"?e=wc(e):e=Rr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new de(o,r)}function Or(e){return function(){return this.matches(e)}}function Vr(e){return function(t){return t.matches(e)}}var bc=Array.prototype.find;function _c(e){return function(){return bc.call(this.children,e)}}function Sc(){return this.firstElementChild}function Ec(e){return this.select(e==null?Sc:_c(typeof e=="function"?e:Vr(e)))}var Cc=Array.prototype.filter;function Nc(){return Array.from(this.children)}function Mc(e){return function(){return Cc.call(this.children,e)}}function kc(e){return this.selectAll(e==null?Nc:Mc(typeof e=="function"?e:Vr(e)))}function Ic(e){typeof e!="function"&&(e=Or(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new de(o,this._parents)}function Br(e){return new Array(e.length)}function zc(){return new de(this._enter||this._groups.map(Br),this._parents)}function Zt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Zt.prototype={constructor:Zt,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 Ac(e){return function(){return e}}function $c(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Zt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Pc(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=s.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=s.call(e,i[a],a,i)+"",(l=c.get(g))?(o[a]=l,l.__data__=i[a],c.delete(g)):n[a]=new Zt(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Dc(e){return e.__data__}function Tc(e,t){if(!arguments.length)return Array.from(this,Dc);var n=t?Pc:$c,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ac(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,g=Hc(e.call(u,u&&u.__data__,c,o)),p=g.length,m=a[c]=new Array(p),w=s[c]=new Array(p),y=l[c]=new Array(f);n(u,d,m,w,y,g,t);for(var _=0,h=0,v,C;_<p;++_)if(v=m[_]){for(_>=h&&(h=_+1);!(C=w[h])&&++h<p;);v._next=C||null}}return s=new de(s,o),s._enter=a,s._exit=l,s}function Hc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jc(){return new de(this._exit||this._groups.map(Br),this._parents)}function Lc(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Rc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,p=0;p<d;++p)(g=c[p]||u[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new de(a,this._parents)}function Oc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Vc(e){e||(e=Bc);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new de(r,this._parents).order()}function Bc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xc(){return Array.from(this)}function Yc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Wc(){let e=0;for(const t of this)++e;return e}function Zc(){return!this.node()}function qc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Gc(e){return function(){this.removeAttribute(e)}}function Uc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kc(e,t){return function(){this.setAttribute(e,t)}}function Qc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function el(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 tl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Uc:Gc:typeof t=="function"?n.local?el:Jc:n.local?Qc:Kc)(n,t))}function Fr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nl(e){return function(){this.style.removeProperty(e)}}function ol(e,t,n){return function(){this.style.setProperty(e,t,n)}}function rl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function il(e,t,n){return arguments.length>1?this.each((t==null?nl:typeof t=="function"?rl:ol)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||Fr(e).getComputedStyle(e,null).getPropertyValue(t)}function sl(e){return function(){delete this[e]}}function al(e,t){return function(){this[e]=t}}function cl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ll(e,t){return arguments.length>1?this.each((t==null?sl:typeof t=="function"?cl:al)(e,t)):this.node()[e]}function Xr(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yr(e)}function Yr(e){this._node=e,this._names=Xr(e.getAttribute("class")||"")}Yr.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 Wr(e,t){for(var n=Jn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Zr(e,t){for(var n=Jn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ul(e){return function(){Wr(this,e)}}function dl(e){return function(){Zr(this,e)}}function fl(e,t){return function(){(t.apply(this,arguments)?Wr:Zr)(this,e)}}function hl(e,t){var n=Xr(e+"");if(arguments.length<2){for(var o=Jn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?fl:t?ul:dl)(n,t))}function gl(){this.textContent=""}function pl(e){return function(){this.textContent=e}}function ml(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yl(e){return arguments.length?this.each(e==null?gl:(typeof e=="function"?ml:pl)(e)):this.node().textContent}function xl(){this.innerHTML=""}function wl(e){return function(){this.innerHTML=e}}function vl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function bl(e){return arguments.length?this.each(e==null?xl:(typeof e=="function"?vl:wl)(e)):this.node().innerHTML}function _l(){this.nextSibling&&this.parentNode.appendChild(this)}function Sl(){return this.each(_l)}function El(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cl(){return this.each(El)}function Nl(e){var t=typeof e=="function"?e:Lr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ml(){return null}function kl(e,t){var n=typeof e=="function"?e:Lr(e),o=t==null?Ml:typeof t=="function"?t:Qn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Il(){var e=this.parentNode;e&&e.removeChild(this)}function zl(){return this.each(Il)}function Al(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $l(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pl(e){return this.select(e?$l:Al)}function Dl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Tl(e){return function(t){e.call(this,t,this.__data__)}}function Hl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function jl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Ll(e,t,n){return function(){var o=this.__on,r,i=Tl(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Rl(e,t,n){var o=Hl(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Ll:jl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function qr(e,t,n){var o=Fr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Ol(e,t){return function(){return qr(this,e,t)}}function Vl(e,t){return function(){return qr(this,e,t.apply(this,arguments))}}function Bl(e,t){return this.each((typeof t=="function"?Vl:Ol)(e,t))}function*Fl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Gr=[null];function de(e,t){this._groups=e,this._parents=t}function Ct(){return new de([[document.documentElement]],Gr)}function Xl(){return this}de.prototype=Ct.prototype={constructor:de,select:mc,selectAll:vc,selectChild:Ec,selectChildren:kc,filter:Ic,data:Tc,enter:zc,exit:jc,join:Lc,merge:Rc,selection:Xl,order:Oc,sort:Vc,call:Fc,nodes:Xc,node:Yc,size:Wc,empty:Zc,each:qc,attr:tl,style:il,property:ll,classed:hl,text:yl,html:bl,raise:Sl,lower:Cl,append:Nl,insert:kl,remove:zl,clone:Pl,datum:Dl,on:Rl,dispatch:Bl,[Symbol.iterator]:Fl};function ue(e){return typeof e=="string"?new de([[document.querySelector(e)]],[document.documentElement]):new de([[e]],Gr)}function Yl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Yl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Wl={passive:!1},mt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ur(e){var t=e.document.documentElement,n=ue(e).on("dragstart.drag",qe,mt);"onselectstart"in t?n.on("selectstart.drag",qe,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Kr(e,t){var n=e.document.documentElement,o=ue(e).on("dragstart.drag",null);t&&(o.on("click.drag",qe,mt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const $t=e=>()=>e;function Rn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Rn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zl(e){return!e.ctrlKey&&!e.button}function ql(){return this.parentNode}function Gl(e,t){return t??{x:e.x,y:e.y}}function Ul(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qr(){var e=Zl,t=ql,n=Gl,o=Ul,r={},i=sn("start","drag","end"),s=0,a,l,c,u,d=0;function f(v){v.on("mousedown.drag",g).filter(o).on("touchstart.drag",w).on("touchmove.drag",y,Wl).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(v,C){if(!(u||!e.call(this,v,C))){var S=h(this,t.call(this,v,C),v,C,"mouse");S&&(ue(v.view).on("mousemove.drag",p,mt).on("mouseup.drag",m,mt),Ur(v.view),Sn(v),c=!1,a=v.clientX,l=v.clientY,S("start",v))}}function p(v){if(qe(v),!c){var C=v.clientX-a,S=v.clientY-l;c=C*C+S*S>d}r.mouse("drag",v)}function m(v){ue(v.view).on("mousemove.drag mouseup.drag",null),Kr(v.view,c),qe(v),r.mouse("end",v)}function w(v,C){if(e.call(this,v,C)){var S=v.changedTouches,E=t.call(this,v,C),k=S.length,z,O;for(z=0;z<k;++z)(O=h(this,E,v,C,S[z].identifier,S[z]))&&(Sn(v),O("start",v,S[z]))}}function y(v){var C=v.changedTouches,S=C.length,E,k;for(E=0;E<S;++E)(k=r[C[E].identifier])&&(qe(v),k("drag",v,C[E]))}function _(v){var C=v.changedTouches,S=C.length,E,k;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),E=0;E<S;++E)(k=r[C[E].identifier])&&(Sn(v),k("end",v,C[E]))}function h(v,C,S,E,k,z){var O=i.copy(),M=fe(z||S,C),T,j,b;if((b=n.call(v,new Rn("beforestart",{sourceEvent:S,target:f,identifier:k,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:O}),E))!=null)return T=b.x-M[0]||0,j=b.y-M[1]||0,function I(N,$,A){var P=M,H;switch(N){case"start":r[k]=I,H=s++;break;case"end":delete r[k],--s;case"drag":M=fe(A||$,C),H=s;break}O.call(N,v,new Rn(N,{sourceEvent:$,subject:b,target:f,identifier:k,active:H,x:M[0]+T,y:M[1]+j,dx:M[0]-P[0],dy:M[1]-P[1],dispatch:O}),E)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:$t(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:$t(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:$t(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(d=(v=+v)*v,f):Math.sqrt(d)},f}function eo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Jr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Nt(){}var yt=.7,qt=1/yt,Ge="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kl=/^#([0-9a-f]{3,8})$/,Ql=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),Jl=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),eu=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${xt}\\)$`),tu=new RegExp(`^rgba\\(${we},${we},${we},${xt}\\)$`),nu=new RegExp(`^hsl\\(${xt},${we},${we}\\)$`),ou=new RegExp(`^hsla\\(${xt},${we},${we},${xt}\\)$`),Io={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};eo(Nt,Re,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zo,formatHex:zo,formatHex8:ru,formatHsl:iu,formatRgb:Ao,toString:Ao});function zo(){return this.rgb().formatHex()}function ru(){return this.rgb().formatHex8()}function iu(){return ei(this).formatHsl()}function Ao(){return this.rgb().formatRgb()}function Re(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$o(t):n===3?new le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pt(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=Ql.exec(e))?new le(t[1],t[2],t[3],1):(t=Jl.exec(e))?new le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eu.exec(e))?Pt(t[1],t[2],t[3],t[4]):(t=tu.exec(e))?Pt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nu.exec(e))?To(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?To(t[1],t[2]/100,t[3]/100,t[4]):Io.hasOwnProperty(e)?$o(Io[e]):e==="transparent"?new le(NaN,NaN,NaN,0):null}function $o(e){return new le(e>>16&255,e>>8&255,e&255,1)}function Pt(e,t,n,o){return o<=0&&(e=t=n=NaN),new le(e,t,n,o)}function su(e){return e instanceof Nt||(e=Re(e)),e?(e=e.rgb(),new le(e.r,e.g,e.b,e.opacity)):new le}function On(e,t,n,o){return arguments.length===1?su(e):new le(e,t,n,o??1)}function le(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}eo(le,On,Jr(Nt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new le(je(this.r),je(this.g),je(this.b),Gt(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:Po,formatHex:Po,formatHex8:au,formatRgb:Do,toString:Do}));function Po(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function au(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function Do(){const e=Gt(this.opacity);return`${e===1?"rgb(":"rgba("}${je(this.r)}, ${je(this.g)}, ${je(this.b)}${e===1?")":`, ${e})`}`}function Gt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return e=je(e),(e<16?"0":"")+e.toString(16)}function To(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function ei(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=Re(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function cu(e,t,n,o){return arguments.length===1?ei(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}eo(he,cu,Jr(Nt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new he(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,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new le(En(e>=240?e-240:e+120,r,o),En(e,r,o),En(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(Ho(this.h),Dt(this.s),Dt(this.l),Gt(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=Gt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ho(this.h)}, ${Dt(this.s)*100}%, ${Dt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ho(e){return e=(e||0)%360,e<0?e+360:e}function Dt(e){return Math.max(0,Math.min(1,e||0))}function En(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 to=e=>()=>e;function lu(e,t){return function(n){return e+n*t}}function uu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function du(e){return(e=+e)==1?ti:function(t,n){return n-t?uu(t,n,e):to(isNaN(t)?n:t)}}function ti(e,t){var n=t-e;return n?lu(e,n):to(isNaN(e)?t:e)}const Ut=(function e(t){var n=du(t);function o(r,i){var s=n((r=On(r)).r,(i=On(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ti(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function fu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function hu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gu(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=gt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function pu(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function xe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mu(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=gt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cn=new RegExp(Vn.source,"g");function yu(e){return function(){return e}}function xu(e){return function(t){return e(t)+""}}function ni(e,t){var n=Vn.lastIndex=Cn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Vn.exec(e))&&(r=Cn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:xe(o,r)})),n=Cn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?xu(l[0].x):yu(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function gt(e,t){var n=typeof t,o;return t==null||n==="boolean"?to(t):(n==="number"?xe:n==="string"?(o=Re(t))?(t=o,Ut):ni:t instanceof Re?Ut:t instanceof Date?pu:hu(t)?fu:Array.isArray(t)?gu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mu:xe)(e,t)}var jo=180/Math.PI,Bn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oi(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*jo,skewX:Math.atan(l)*jo,scaleX:s,scaleY:a}}var Tt;function wu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Bn:oi(t.a,t.b,t.c,t.d,t.e,t.f)}function vu(e){return e==null||(Tt||(Tt=document.createElementNS("http://www.w3.org/2000/svg","g")),Tt.setAttribute("transform",e),!(e=Tt.transform.baseVal.consolidate()))?Bn:(e=e.matrix,oi(e.a,e.b,e.c,e.d,e.e,e.f))}function ri(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push("translate(",null,t,null,n);p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:xe(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:xe(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push(r(g)+"scale(",null,",",null,")");p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var p=-1,m=f.length,w;++p<m;)d[(w=f[p]).i]=w.x(g);return d.join("")}}}var bu=ri(wu,"px, ","px)","deg)"),_u=ri(vu,", ",")",")"),Su=1e-12;function Lo(e){return((e=Math.exp(e))+1/e)/2}function Eu(e){return((e=Math.exp(e))-1/e)/2}function Cu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ft=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],g=u-a,p=d-l,m=g*g+p*p,w,y;if(m<Su)y=Math.log(f/c)/t,w=function(E){return[a+E*g,l+E*p,c*Math.exp(t*E*y)]};else{var _=Math.sqrt(m),h=(f*f-c*c+o*m)/(2*c*n*_),v=(f*f-c*c-o*m)/(2*f*n*_),C=Math.log(Math.sqrt(h*h+1)-h),S=Math.log(Math.sqrt(v*v+1)-v);y=(S-C)/t,w=function(E){var k=E*y,z=Lo(C),O=c/(n*_)*(z*Cu(t*k+C)-Eu(C));return[a+O*g,l+O*p,c*z/Lo(t*k+C)]}}return w.duration=y*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Qe=0,ft=0,lt=0,ii=1e3,Kt,ht,Qt=0,Oe=0,cn=0,wt=typeof performance=="object"&&performance.now?performance:Date,si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function no(){return Oe||(si(Nu),Oe=wt.now()+cn)}function Nu(){Oe=0}function Jt(){this._call=this._time=this._next=null}Jt.prototype=ai.prototype={constructor:Jt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?no():+n)+(t==null?0:+t),!this._next&&ht!==this&&(ht?ht._next=this:Kt=this,ht=this),this._call=e,this._time=n,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};function ai(e,t,n){var o=new Jt;return o.restart(e,t,n),o}function Mu(){no(),++Qe;for(var e=Kt,t;e;)(t=Oe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Ro(){Oe=(Qt=wt.now())+cn,Qe=ft=0;try{Mu()}finally{Qe=0,Iu(),Oe=0}}function ku(){var e=wt.now(),t=e-Qt;t>ii&&(cn-=t,Qt=e)}function Iu(){for(var e,t=Kt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Kt=n);ht=e,Fn(o)}function Fn(e){if(!Qe){ft&&(ft=clearTimeout(ft));var t=e-Oe;t>24?(e<1/0&&(ft=setTimeout(Ro,e-wt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Qt=wt.now(),lt=setInterval(ku,ii)),Qe=1,si(Ro))}}function Oo(e,t,n){var o=new Jt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var zu=sn("start","end","cancel","interrupt"),Au=[],ci=0,Vo=1,Xn=2,Xt=3,Bo=4,Yn=5,Yt=6;function ln(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;$u(e,n,{name:t,index:o,group:r,on:zu,tween:Au,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ci})}function oo(e,t){var n=me(e,t);if(n.state>ci)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=me(e,t);if(n.state>Xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function $u(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ai(i,0,n.time);function i(c){n.state=Vo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,g;if(n.state!==Vo)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Xt)return Oo(s);g.state===Bo?(g.state=Yt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Yt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Oo(function(){n.state===Xt&&(n.state=Bo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Xn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xn){for(n.state=Xt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Yn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Yn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Yt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Wt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Xn&&o.state<Yn,o.state=Yt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Pu(e){return this.each(function(){Wt(this,e)})}function Du(e,t){var n,o;return function(){var r=_e(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Tu(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Hu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Du:Tu)(n,e,t))}function ro(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function li(e,t){var n;return(typeof t=="number"?xe:t instanceof Re?Ut:(n=Re(t))?(t=n,Ut):ni)(e,t)}function ju(e){return function(){this.removeAttribute(e)}}function Lu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ru(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Ou(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Vu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Bu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Fu(e,t){var n=an(e),o=n==="transform"?_u:li;return this.attrTween(e,typeof t=="function"?(n.local?Bu:Vu)(n,o,ro(this,"attr."+e,t)):t==null?(n.local?Lu:ju)(n):(n.local?Ou:Ru)(n,o,t))}function Xu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Yu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Yu(e,i)),n}return r._value=t,r}function Zu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Xu(e,i)),n}return r._value=t,r}function qu(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 o=an(e);return this.tween(n,(o.local?Wu:Zu)(o,t))}function Gu(e,t){return function(){oo(this,e).delay=+t.apply(this,arguments)}}function Uu(e,t){return t=+t,function(){oo(this,e).delay=t}}function Ku(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Gu:Uu)(t,e)):me(this.node(),t).delay}function Qu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Ju(e,t){return t=+t,function(){_e(this,e).duration=t}}function ed(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qu:Ju)(t,e)):me(this.node(),t).duration}function td(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function nd(e){var t=this._id;return arguments.length?this.each(td(t,e)):me(this.node(),t).ease}function od(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function rd(e){if(typeof e!="function")throw new Error;return this.each(od(this._id,e))}function id(e){typeof e!="function"&&(e=Or(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Me(o,this._parents,this._name,this._id)}function sd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)s[a]=t[a];return new Me(s,this._parents,this._name,this._id)}function ad(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 cd(e,t,n){var o,r,i=ad(t)?oo:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ld(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(cd(n,e,t))}function ud(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function dd(){return this.on("end.remove",ud(this._id))}function fd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new Me(i,this._parents,t,n)}function hd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,p=me(u,n),m=0,w=f.length;m<w;++m)(g=f[m])&&ln(g,t,n,m,f,p);i.push(f),s.push(u)}return new Me(i,s,t,n)}var gd=Ct.prototype.constructor;function pd(){return new gd(this._groups,this._parents)}function md(e,t){var n,o,r;return function(){var i=Ke(this,e),s=(this.style.removeProperty(e),Ke(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ui(e){return function(){this.style.removeProperty(e)}}function yd(e,t,n){var o,r=n+"",i;return function(){var s=Ke(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function xd(e,t,n){var o,r,i;return function(){var s=Ke(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ke(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function wd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),c=l.on,u=l.value[i]==null?a||(a=ui(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function vd(e,t,n){var o=(e+="")=="transform"?bu:li;return t==null?this.styleTween(e,md(e,o)).on("end.style."+e,ui(e)):typeof t=="function"?this.styleTween(e,xd(e,o,ro(this,"style."+e,t))).each(wd(this._id,e)):this.styleTween(e,yd(e,o,t),n).on("end.style."+e,null)}function bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function _d(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&bd(e,s,n)),o}return i._value=t,i}function Sd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,_d(e,t,n??""))}function Ed(e){return function(){this.textContent=e}}function Cd(e){return function(){var t=e(this);this.textContent=t??""}}function Nd(e){return this.tween("text",typeof e=="function"?Cd(ro(this,"text",e)):Ed(e==null?"":e+""))}function Md(e){return function(t){this.textContent=e.call(this,t)}}function kd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Md(r)),t}return o._value=e,o}function Id(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,kd(e))}function zd(){for(var e=this._name,t=this._id,n=di(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=me(l,t);ln(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Me(o,this._parents,e,n)}function Ad(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=_e(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var $d=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function di(){return++$d}var Ee=Ct.prototype;Me.prototype={constructor:Me,select:fd,selectAll:hd,selectChild:Ee.selectChild,selectChildren:Ee.selectChildren,filter:id,merge:sd,selection:pd,transition:zd,call:Ee.call,nodes:Ee.nodes,node:Ee.node,size:Ee.size,empty:Ee.empty,each:Ee.each,on:ld,attr:Fu,attrTween:qu,style:vd,styleTween:Sd,text:Nd,textTween:Id,remove:dd,tween:Hu,delay:Ku,duration:ed,ease:nd,easeVarying:rd,end:Ad,[Symbol.iterator]:Ee[Symbol.iterator]};function Pd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dd={time:null,delay:0,duration:250,ease:Pd};function Td(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 Hd(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=di(),(n=Dd).time=no(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&ln(l,e,t,c,s,n||Td(l,t));return new Me(o,this._parents,e,t)}Ct.prototype.interrupt=Pu;Ct.prototype.transition=Hd;const Ht=e=>()=>e;function jd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){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:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ce(e,t,n){this.k=e,this.x=t,this.y=n}Ce.prototype={constructor:Ce,scale:function(e){return e===1?this:new Ce(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ce(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 un=new Ce(1,0,0);fi.prototype=Ce.prototype;function fi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function Ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Rd(){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 Fo(){return this.__zoom||un}function Od(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function hi(){var e=Ld,t=Rd,n=Bd,o=Od,r=Vd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ft,c=sn("start","zoom","end"),u,d,f,g=500,p=150,m=0,w=10;function y(b){b.property("__zoom",Fo).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(b,I,N,$){var A=b.selection?b.selection():b;A.property("__zoom",Fo),b!==A?C(b,I,N,$):A.interrupt().each(function(){S(this,arguments).event($).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},y.scaleBy=function(b,I,N,$){y.scaleTo(b,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},N,$)},y.scaleTo=function(b,I,N,$){y.transform(b,function(){var A=t.apply(this,arguments),P=this.__zoom,H=N==null?v(A):typeof N=="function"?N.apply(this,arguments):N,R=P.invert(H),L=typeof I=="function"?I.apply(this,arguments):I;return n(h(_(P,L),H,R),A,s)},N,$)},y.translateBy=function(b,I,N,$){y.transform(b,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,$)},y.translateTo=function(b,I,N,$,A){y.transform(b,function(){var P=t.apply(this,arguments),H=this.__zoom,R=$==null?v(P):typeof $=="function"?$.apply(this,arguments):$;return n(un.translate(R[0],R[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),P,s)},$,A)};function _(b,I){return I=Math.max(i[0],Math.min(i[1],I)),I===b.k?b:new Ce(I,b.x,b.y)}function h(b,I,N){var $=I[0]-N[0]*b.k,A=I[1]-N[1]*b.k;return $===b.x&&A===b.y?b:new Ce(b.k,$,A)}function v(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function C(b,I,N,$){b.on("start.zoom",function(){S(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event($).end()}).tween("zoom",function(){var A=this,P=arguments,H=S(A,P).event($),R=t.apply(A,P),L=N==null?v(R):typeof N=="function"?N.apply(A,P):N,F=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=A.__zoom,Z=typeof I=="function"?I.apply(A,P):I,U=l(B.invert(L).concat(F/B.k),Z.invert(L).concat(F/Z.k));return function(W){if(W===1)W=Z;else{var V=U(W),Y=F/V[2];W=new Ce(Y,L[0]-V[0]*Y,L[1]-V[1]*Y)}H.zoom(null,W)}})}function S(b,I,N){return!N&&b.__zooming||new E(b,I)}function E(b,I){this.that=b,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,I),this.taps=0}E.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,I){return this.mouse&&b!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var I=ue(this.that).datum();c.call(b,this.that,new jd(b,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:c}),I)}};function k(b,...I){if(!e.apply(this,arguments))return;var N=S(this,I).event(b),$=this.__zoom,A=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,o.apply(this,arguments)))),P=fe(b);if(N.wheel)(N.mouse[0][0]!==P[0]||N.mouse[0][1]!==P[1])&&(N.mouse[1]=$.invert(N.mouse[0]=P)),clearTimeout(N.wheel);else{if($.k===A)return;N.mouse=[P,$.invert(P)],Wt(this),N.start()}ut(b),N.wheel=setTimeout(H,p),N.zoom("mouse",n(h(_($,A),N.mouse[0],N.mouse[1]),N.extent,s));function H(){N.wheel=null,N.end()}}function z(b,...I){if(f||!e.apply(this,arguments))return;var N=b.currentTarget,$=S(this,I,!0).event(b),A=ue(b.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),P=fe(b,N),H=b.clientX,R=b.clientY;Ur(b.view),Nn(b),$.mouse=[P,this.__zoom.invert(P)],Wt(this),$.start();function L(B){if(ut(B),!$.moved){var Z=B.clientX-H,U=B.clientY-R;$.moved=Z*Z+U*U>m}$.event(B).zoom("mouse",n(h($.that.__zoom,$.mouse[0]=fe(B,N),$.mouse[1]),$.extent,s))}function F(B){A.on("mousemove.zoom mouseup.zoom",null),Kr(B.view,$.moved),ut(B),$.event(B).end()}}function O(b,...I){if(e.apply(this,arguments)){var N=this.__zoom,$=fe(b.changedTouches?b.changedTouches[0]:b,this),A=N.invert($),P=N.k*(b.shiftKey?.5:2),H=n(h(_(N,P),$,A),t.apply(this,I),s);ut(b),a>0?ue(this).transition().duration(a).call(C,H,$,b):ue(this).call(y.transform,H,$,b)}}function M(b,...I){if(e.apply(this,arguments)){var N=b.touches,$=N.length,A=S(this,I,b.changedTouches.length===$).event(b),P,H,R,L;for(Nn(b),H=0;H<$;++H)R=N[H],L=fe(R,this),L=[L,this.__zoom.invert(L),R.identifier],A.touch0?!A.touch1&&A.touch0[2]!==L[2]&&(A.touch1=L,A.taps=0):(A.touch0=L,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(d=L[0],u=setTimeout(function(){u=null},g)),Wt(this),A.start())}}function T(b,...I){if(this.__zooming){var N=S(this,I).event(b),$=b.changedTouches,A=$.length,P,H,R,L;for(ut(b),P=0;P<A;++P)H=$[P],R=fe(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=R:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=R);if(H=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],Z=N.touch1[0],U=N.touch1[1],W=(W=Z[0]-F[0])*W+(W=Z[1]-F[1])*W,V=(V=U[0]-B[0])*V+(V=U[1]-B[1])*V;H=_(H,Math.sqrt(W/V)),R=[(F[0]+Z[0])/2,(F[1]+Z[1])/2],L=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(N.touch0)R=N.touch0[0],L=N.touch0[1];else return;N.zoom("touch",n(h(H,R,L),N.extent,s))}}function j(b,...I){if(this.__zooming){var N=S(this,I).event(b),$=b.changedTouches,A=$.length,P,H;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),P=0;P<A;++P)H=$[P],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=fe(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<w)){var R=ue(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return y.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Ht(+b),y):o},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ht(!!b),y):e},y.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Ht(!!b),y):r},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Ht([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],y):[i[0],i[1]]},y.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(a=+b,y):a},y.interpolate=function(b){return arguments.length?(l=b,y):l},y.on=function(){var b=c.on.apply(c,arguments);return b===c?y:b},y.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,y):Math.sqrt(m)},y.tapDistance=function(b){return arguments.length?(w=+b,y):w},y}const be={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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", 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."},vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gi=["Enter"," ","Escape"],pi={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Le;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Le||(Le={}));var bt;(function(e){e.Partial="partial",e.Full="full"})(bt||(bt={}));const mi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var $e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})($e||($e={}));var en;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(en||(en={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Xo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function yi(e){return e===null?null:e?"valid":"invalid"}const xi=e=>"id"in e&&"source"in e&&"target"in e,Fd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mt=(e,t=[0,0])=>{const{width:n,height:o}=ke(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Xd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=s?tn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},kt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,tn(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},so=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...zt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(s&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,p=u.height??c.height??c.initialHeight??null,m=_t(a,tt(c)),w=(g??0)*(p??0),y=i&&m>0;(!c.internals.handleBounds||y||m>=w||c.dragging)&&l.push(c)}return l},Yd=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Wd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Zd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Wd(e,s),l=kt(a),c=ao(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function wi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",be.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(d=[[l,c],[l+g,c+p]])}else a&&nt(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=nt(d)?Ve(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",be.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function qd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const g=i.has(f.id),p=!g&&f.parentId&&s.find(m=>m.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Yd(s,l);for(const f of l)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ve=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function vi(e,t,n){const{width:o,height:r}=ke(n),{x:i,y:s}=n.internals.positionAbsolute;return Ve(e,[[i,s],[i+o,s+r]],t)}const Yo=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,bi=(e,t,n=15,o=40)=>{const r=Yo(e.x,o,t.width-o)*n,i=Yo(e.y,o,t.height-o)*n;return[r,i]},dn=(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)}),Wn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},tn=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},_i=(e,t)=>fn(dn(Wn(e),Wn(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)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Wo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Gd=(e,t)=>{},It=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),zt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?It(a,s):a},nn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(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 Ud(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),i=Xe(e.left??e.x??0,t),s=Xe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Kd(e,t,n,o,r,i){const{x:s,y:a}=nn(e,[t,n,o]),{x:l,y:c}=nn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const ao=(e,t,n,o,r,i)=>{const s=Ud(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,p=n/2-f*u,m=Kd(e,g,p,u,t,n),w={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:g-w.left+w.right,y:p-w.top+w.bottom,zoom:u}},St=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function ke(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Si(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ei(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Zo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Qd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Jd(e){return{...pi,...e||{}}}function pt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=zt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?It(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const co=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ci=e=>e?.getRootNode?.()||window?.document,ef=["INPUT","SELECT","TEXTAREA"];function Ni(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ef.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Mi=e=>"clientX"in e,pe=(e,t)=>{const n=Mi(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...co(s)}})};function ki({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Go({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-jt(t-o,i),n];case X.Right:return[t+jt(o-t,i),n];case X.Top:return[t,n-jt(n-r,i)];case X.Bottom:return[t,n+jt(r-n,i)]}}function Ii({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Go({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=Go({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,g,p]=ki({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,p]}function zi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function tf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=dn(tn(e),tn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return _t(s,fn(i))>0}const of=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,rf=(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)),sf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||of;let r;return xi(e)?r={...e}:r={...e,id:o(e)},rf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Ai({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=zi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Uo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},af=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function cf({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Uo[t],l=Uo[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=af({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let p=[],m,w;const y={x:0,y:0},_={x:0,y:0},[,,h,v]=zi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(m=r.x??c.x+(u.x-c.x)*s,w=r.y??(c.y+u.y)/2):(m=r.x??(c.x+u.x)/2,w=r.y??c.y+(u.y-c.y)*s);const S=[{x:m,y:c.y},{x:m,y:u.y}],E=[{x:c.x,y:w},{x:u.x,y:w}];a[f]===g?p=f==="x"?S:E:p=f==="x"?E:S}else{const S=[{x:c.x,y:u.y}],E=[{x:u.x,y:c.y}];if(f==="x"?p=a.x===g?E:S:p=a.y===g?S:E,t===o){const T=Math.abs(e[f]-n[f]);if(T<=i){const j=Math.min(i-1,i-T);a[f]===g?y[f]=(c[f]>e[f]?-1:1)*j:_[f]=(u[f]>n[f]?-1:1)*j}}if(t!==o){const T=f==="x"?"y":"x",j=a[f]===l[T],b=c[T]>u[T],I=c[T]<u[T];(a[f]===1&&(!j&&b||j&&I)||a[f]!==1&&(!j&&I||j&&b))&&(p=f==="x"?S:E)}const k={x:c.x+y.x,y:c.y+y.y},z={x:u.x+_.x,y:u.y+_.y},O=Math.max(Math.abs(k.x-p[0].x),Math.abs(z.x-p[0].x)),M=Math.max(Math.abs(k.y-p[0].y),Math.abs(z.y-p[0].y));O>=M?(m=(k.x+z.x)/2,w=p[0].y):(m=p[0].x,w=(k.y+z.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...p,{x:u.x+_.x,y:u.y+_.y},n],m,w,h,v]}function lf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Zn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,p,m]=cf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((y,_,h)=>{let v="";return h>0&&h<d.length-1?v=lf(d[h-1],_,d[h+1],s):v=`${h===0?"M":"L"}${_.x} ${_.y}`,y+=v,y},""),f,g,p,m]}function Qo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function uf(e){const{sourceNode:t,targetNode:n}=e;if(!Qo(t)||!Qo(n))return null;const o=t.internals.handleBounds||Jo(t.handles),r=n.internals.handleBounds||Jo(n.handles),i=er(o?.source??[],e.sourceHandle),s=er(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",be.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,c=Be(t,i,a),u=Be(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Jo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Be(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??ke(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function er(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function qn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function df(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=qn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const $i=1e3,ff=10,lo={nodeOrigin:[0,0],nodeExtent:vt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hf={...lo,checkEquality:!0};function uo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gf(e,t,n){const o=uo(lo,n);for(const r of e.values())if(r.parentId)ho(r,e,t,o);else{const i=Mt(r,o.nodeOrigin),s=nt(r.extent)?r.extent:o.nodeExtent,a=Ve(i,s,ke(r));r.internals.positionAbsolute=a}}function pf(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function fo(e){return e==="manual"}function Gn(e,t,n,o={}){const r=uo(hf,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?$i:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Mt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Ve(d,f,ke(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:pf(c,u),z:Pi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&ho(u,t,n,o,i)}return l}function mf(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 ho(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=uo(lo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}mf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*ff),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!fo(l)?$i:0,{x:f,y:g,z:p}=yf(e,u,s,a,d,l),{positionAbsolute:m}=e.internals,w=f!==m.x||g!==m.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:g}:m,z:p}})}function Pi(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function yf(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=ke(e),c=Mt(e,n),u=nt(e.extent)?Ve(c,e.extent,l):c;let d=Ve({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=vi(d,l,t));const f=Pi(e,r,i),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??tt(a),c=_i(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=ke(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,g=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,p=Math.max(u.width,Math.round(s.width)),m=Math.max(u.height,Math.round(s.height)),w=(p-u.width)*d[0],y=(m-u.height)*d[1];(f>0||g>0||w||y)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+w,y:a.position.y-g+y}}),n.get(l)?.forEach(_=>{e.some(h=>h.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<s.width||u.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?d[0]*f-w:0),height:m+(g?d[1]*g-y:0)}})}),r}function xf(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),l=!0;continue}const m=co(g.nodeElement),w=p.measured.width!==m.width||p.measured.height!==m.height;if(!!(m.width&&m.height&&(w||!p.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),h=nt(p.extent)?p.extent:i;let{positionAbsolute:v}=p.internals;p.parentId&&p.extent==="parent"?v=vi(v,m,t.get(p.parentId)):h&&(v=Ve(v,h,m));const C={...p,measured:m,internals:{...p.internals,positionAbsolute:v,handleBounds:{source:qo("source",g.nodeElement,_,d,p.id),target:qo("target",g.nodeElement,_,d,p.id)}}};t.set(p.id,C),p.parentId&&ho(C,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,w&&(c.push({id:p.id,type:"dimensions",dimensions:m}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:tt(C,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function wf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){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],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function tr(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;tr("source",l,u,e,r,s),tr("target",l,c,e,i,a),t.set(o.id,o)}}function Ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ti(n,t):!1}function nr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function vf(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ti(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,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 r}function Mn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=It(i,t);return{x:s.x-i.x,y:s.y-i.y}}function _f({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,p=!1,m=null;function w({noDragClassName:_,handleSelector:h,domNode:v,isSelectable:C,nodeId:S,nodeClickDistance:E=0}){f=ue(v);function k({x:T,y:j}){const{nodeLookup:b,nodeExtent:I,snapGrid:N,snapToGrid:$,nodeOrigin:A,onNodeDrag:P,onSelectionDrag:H,onError:R,updateNodePositions:L}=t();i={x:T,y:j};let F=!1;const B=a.size>1,Z=B&&I?Wn(kt(a)):null,U=B&&$?bf({dragItems:a,snapGrid:N,x:T,y:j}):null;for(const[W,V]of a){if(!b.has(W))continue;let Y={x:T-V.distance.x,y:j-V.distance.y};$&&(Y=U?{x:Math.round(Y.x+U.x),y:Math.round(Y.y+U.y)}:It(Y,N));let Q=null;if(B&&I&&!V.extent&&Z){const{positionAbsolute:G}=V.internals,ee=G.x-Z.x+I[0][0],ne=G.x+V.measured.width-Z.x2+I[1][0],te=G.y-Z.y+I[0][1],ae=G.y+V.measured.height-Z.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:K,positionAbsolute:q}=wi({nodeId:W,nextPosition:Y,nodeLookup:b,nodeExtent:Q||I,nodeOrigin:A,onError:R});F=F||V.position.x!==K.x||V.position.y!==K.y,V.position=K,V.internals.positionAbsolute=q}if(p=p||F,!!F&&(L(a,!0),m&&(o||P||!S&&H))){const[W,V]=Mn({nodeId:S,dragItems:a,nodeLookup:b});o?.(m,a,W,V),P?.(m,W,V),S||H?.(m,V)}}async function z(){if(!u)return;const{transform:T,panBy:j,autoPanSpeed:b,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,$]=bi(c,u,b);(N!==0||$!==0)&&(i.x=(i.x??0)-N/T[2],i.y=(i.y??0)-$/T[2],await j({x:N,y:$})&&k(i)),s=requestAnimationFrame(z)}function O(T){const{nodeLookup:j,multiSelectionActive:b,nodesDraggable:I,transform:N,snapGrid:$,snapToGrid:A,selectNodesOnDrag:P,onNodeDragStart:H,onSelectionDragStart:R,unselectNodesAndEdges:L}=t();d=!0,(!P||!C)&&!b&&S&&(j.get(S)?.selected||L()),C&&P&&S&&e?.(S);const F=pt(T.sourceEvent,{transform:N,snapGrid:$,snapToGrid:A,containerBounds:u});if(i=F,a=vf(j,I,F,S),a.size>0&&(n||H||!S&&R)){const[B,Z]=Mn({nodeId:S,dragItems:a,nodeLookup:j});n?.(T.sourceEvent,a,B,Z),H?.(T.sourceEvent,B,Z),S||R?.(T.sourceEvent,Z)}}const M=Qr().clickDistance(E).on("start",T=>{const{domNode:j,nodeDragThreshold:b,transform:I,snapGrid:N,snapToGrid:$}=t();u=j?.getBoundingClientRect()||null,g=!1,p=!1,m=T.sourceEvent,b===0&&O(T),i=pt(T.sourceEvent,{transform:I,snapGrid:N,snapToGrid:$,containerBounds:u}),c=pe(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:j,transform:b,snapGrid:I,snapToGrid:N,nodeDragThreshold:$,nodeLookup:A}=t(),P=pt(T.sourceEvent,{transform:b,snapGrid:I,snapToGrid:N,containerBounds:u});if(m=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||S&&!A.has(S))&&(g=!0),!g){if(!l&&j&&d&&(l=!0,z()),!d){const H=pe(T.sourceEvent,u),R=H.x-c.x,L=H.y-c.y;Math.sqrt(R*R+L*L)>$&&O(T)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&d&&(c=pe(T.sourceEvent,u),k(P))}}).on("end",T=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:j,updateNodePositions:b,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(b(a,!1),p=!1),r||I||!S&&N){const[$,A]=Mn({nodeId:S,dragItems:a,nodeLookup:j,dragging:!1});r?.(T.sourceEvent,a,$,A),I?.(T.sourceEvent,$,A),S||N?.(T.sourceEvent,A)}}}).filter(T=>{const j=T.target;return!T.button&&(!_||!nr(j,`.${_}`,v))&&(!h||nr(j,h,v))});f.call(M)}function y(){f?.on(".drag",null)}return{update:w,destroy:y}}function Sf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())_t(r,tt(i))>0&&o.push(i);return o}const Ef=250;function Cf(e,t,n,o){let r=[],i=1/0;const s=Sf(e,n,t+Ef);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Be(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Hi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Be(s,l,l.position,!0)}:l}function ji(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Nf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Li=()=>!0;function Mf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:w,isValidConnection:y=Li,onReconnectEnd:_,updateConnection:h,getTransform:v,getFromHandle:C,autoPanSpeed:S,dragThreshold:E=1,handleDomNode:k}){const z=Ci(e.target);let O=0,M;const{x:T,y:j}=pe(e),b=ji(i,k),I=a?.getBoundingClientRect();let N=!1;if(!I||!b)return;const $=Hi(r,b,o,l,t);if(!$)return;let A=pe(e,I),P=!1,H=null,R=!1,L=null;function F(){if(!u||!I)return;const[K,q]=bi(A,I,S);f({x:K,y:q}),O=requestAnimationFrame(F)}const B={...$,nodeId:r,type:b,position:$.position},Z=l.get(r);let W={inProgress:!0,isValid:null,from:Be(Z,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Z,to:A,toHandle:null,toPosition:Xo[B.position],toNode:null,pointer:A};function V(){N=!0,h(W),p?.(e,{nodeId:r,handleId:o,handleType:b})}E===0&&V();function Y(K){if(!N){const{x:ae,y:Ie}=pe(K),Se=ae-T,De=Ie-j;if(!(Se*Se+De*De>E*E))return;V()}if(!C()||!B){Q(K);return}const q=v();A=pe(K,I),M=Cf(zt(A,q,!1,[1,1]),n,l,B),P||(F(),P=!0);const G=Ri(K,{handle:M,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:z,lib:c,flowId:d,nodeLookup:l});L=G.handleDomNode,H=G.connection,R=Nf(!!M,G.isValid);const ee=l.get(r),ne=ee?Be(ee,B,X.Left,!0):W.from,te={...W,from:ne,isValid:R,to:G.toHandle&&R?nn({x:G.toHandle.x,y:G.toHandle.y},q):A,toHandle:G.toHandle,toPosition:R&&G.toHandle?G.toHandle.position:Xo[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:A};h(te),W=te}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(N){(M||L)&&H&&R&&m?.(H);const{inProgress:q,...G}=W,ee={...G,toPosition:W.toHandle?W.toPosition:null};w?.(K,ee),i&&_?.(K,ee)}g(),cancelAnimationFrame(O),P=!1,R=!1,H=null,L=null,z.removeEventListener("mousemove",Y),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",Y),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",Y),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",Y),z.addEventListener("touchend",Q)}function Ri(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Li,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=pe(e),m=s.elementFromPoint(g,p),w=m?.classList.contains(`${a}-flow__handle`)?m:f,y={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const _=ji(void 0,w),h=w.getAttribute("data-nodeid"),v=w.getAttribute("data-handleid"),C=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!h||!_)return y;const E={source:d?h:o,sourceHandle:d?v:r,target:d?o:h,targetHandle:d?r:v};y.connection=E;const z=C&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":h!==o||v!==r);y.isValid=z&&c(E),y.toHandle=Hi(h,_,v,u,n,!0)}return y}const Un={onPointerDown:Mf,isValid:Ri};function kf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ue(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const v=n(),C=h.sourceEvent.ctrlKey&&St()?10:1,S=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,E=v[2]*Math.pow(2,S*C);t.scaleTo(E)};let m=[0,0];const w=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(m=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},y=h=>{const v=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const C=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],S=[C[0]-m[0],C[1]-m[1]];m=C;const E=o()*Math.max(v[2],Math.log(v[2]))*(g?-1:1),k={x:v[0]-S[0]*E,y:v[1]-S[1]*E},z=[[0,0],[l,c]];t.setViewportConstrained({x:k.x,y:k.y,zoom:v[2]},z,a)},_=hi().on("start",w).on("zoom",d?y:null).on("zoom.wheel",f?p:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),kn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),If=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,In=(e,t=0,n=If,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Vi=e=>{const t=e.ctrlKey&&St()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(We(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=fe(u),y=Vi(u),_=d*Math.pow(2,y);o.scaleTo(n,_,w,u);return}const f=u.deltaMode===1?20:1;let g=r===Le.Vertical?0:u.deltaX*f,p=r===Le.Horizontal?0:u.deltaY*f;!St()&&u.shiftKey&&r!==Le.Vertical&&(g=u.deltaY*f,p=0),o.translateBy(n,-(g/d)*i,-(p/d)*i,{internal:!0});const m=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,m),e.panScrollTimeout=setTimeout(()=>{c?.(u,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,m))}}function Af({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=We(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function $f({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Pf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Oi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,hn(i.transform))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Tf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,p=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(We(d,`${c}-flow__node`)||We(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!p||We(d,a)&&p||We(d,l)&&(!p||r&&p&&!e)||!n&&d.ctrlKey&&p)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||p)&&m}}function Hf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hi().scaleExtent([t,n]).translateExtent(o),f=ue(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");d.wheelDelta(Vi);function m(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).transform(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function w({noWheelClassName:M,noPanClassName:T,onPaneContextMenu:j,userSelectionActive:b,panOnScroll:I,panOnDrag:N,panOnScrollMode:$,panOnScrollSpeed:A,preventScrolling:P,zoomOnPinch:H,zoomOnScroll:R,zoomOnDoubleClick:L,zoomActivationKeyPressed:F,lib:B,onTransformChange:Z,connectionInProgress:U,paneClickDistance:W,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&y();const Y=I&&!F&&!b;d.clickDistance(V?1/0:!ge(W)||W<0?0:W);const Q=Y?zf({zoomPanValues:c,noWheelClassName:M,d3Selection:f,d3Zoom:d,panOnScrollMode:$,panOnScrollSpeed:A,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Af({noWheelClassName:M,preventScrolling:P,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const q=$f({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);const G=Pf({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!j,onPanZoom:i,onTransformChange:Z});d.on("zoom",G);const ee=Df({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:j,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const K=Tf({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:L,zoomOnPinch:H,userSelectionActive:b,noPanClassName:T,noWheelClassName:M,lib:B,connectionInProgress:U});d.filter(K),L?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function y(){d.on("zoom",null)}async function _(M,T,j){const b=kn(M),I=d?.constrain()(b,T,j);return I&&await m(I),new Promise(N=>N(I))}async function h(M,T){const j=kn(M);return await m(j,T),new Promise(b=>b(j))}function v(M){if(f){const T=kn(M),j=f.property("__zoom");(j.k!==M.zoom||j.x!==M.x||j.y!==M.y)&&d?.transform(f,T,null,{sync:!0})}}function C(){const M=f?fi(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function S(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).scaleTo(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function E(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).scaleBy(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function k(M){d?.scaleExtent(M)}function z(M){d?.translateExtent(M)}function O(M){const T=!ge(M)||M<0?0:M;d?.clickDistance(T)}return{update:w,destroy:y,setViewport:h,setViewportConstrained:_,getViewport:C,scaleTo:S,scaleBy:E,setScaleExtent:k,setTranslateExtent:z,syncViewport:v,setClickDistance:O}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function jf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function or(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function ze(e,t){return Math.max(0,t-e)}function Ae(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function rr(e,t){return e?!t:t}function Lf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:p}=n,{minWidth:m,maxWidth:w,minHeight:y,maxHeight:_}=o,{x:h,y:v,width:C,height:S,aspectRatio:E}=e;let k=Math.floor(u?g-e.pointerX:0),z=Math.floor(d?p-e.pointerY:0);const O=C+(l?-k:k),M=S+(c?-z:z),T=-i[0]*C,j=-i[1]*S;let b=Lt(O,m,w),I=Lt(M,y,_);if(s){let A=0,P=0;l&&k<0?A=ze(h+k+T,s[0][0]):!l&&k>0&&(A=Ae(h+O+T,s[1][0])),c&&z<0?P=ze(v+z+j,s[0][1]):!c&&z>0&&(P=Ae(v+M+j,s[1][1])),b=Math.max(b,A),I=Math.max(I,P)}if(a){let A=0,P=0;l&&k>0?A=Ae(h+k,a[0][0]):!l&&k<0&&(A=ze(h+O,a[1][0])),c&&z>0?P=Ae(v+z,a[0][1]):!c&&z<0&&(P=ze(v+M,a[1][1])),b=Math.max(b,A),I=Math.max(I,P)}if(r){if(u){const A=Lt(O/E,y,_)*E;if(b=Math.max(b,A),s){let P=0;!l&&!c||l&&!c&&f?P=Ae(v+j+O/E,s[1][1])*E:P=ze(v+j+(l?k:-k)/E,s[0][1])*E,b=Math.max(b,P)}if(a){let P=0;!l&&!c||l&&!c&&f?P=ze(v+O/E,a[1][1])*E:P=Ae(v+(l?k:-k)/E,a[0][1])*E,b=Math.max(b,P)}}if(d){const A=Lt(M*E,m,w)/E;if(I=Math.max(I,A),s){let P=0;!l&&!c||c&&!l&&f?P=Ae(h+M*E+T,s[1][0])/E:P=ze(h+(c?z:-z)*E+T,s[0][0])/E,I=Math.max(I,P)}if(a){let P=0;!l&&!c||c&&!l&&f?P=ze(h+M*E,a[1][0])/E:P=Ae(h+(c?z:-z)*E,a[0][0])/E,I=Math.max(I,P)}}}z=z+(z<0?I:-I),k=k+(k<0?b:-b),r&&(f?O>M*E?z=(rr(l,c)?-k:k)/E:k=(rr(l,c)?-z:z)*E:u?(z=k/E,c=l):(k=z*E,l=c));const N=l?h+k:h,$=c?v+z:v;return{width:C+(l?-k:k),height:S+(c?-z:z),x:i[0]*k*(l?-1:1)+N,y:i[1]*z*(c?-1:1)+$}}const Bi={width:0,height:0,x:0,y:0},Rf={...Bi,pointerX:0,pointerY:0,aspectRatio:1};function Of(e){return[[0,0],[e.measured.width,e.measured.height]]}function Vf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Bf({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ue(e);let s={controlDirection:or("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:m,shouldResize:w}){let y={...Bi},_={...Rf};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:or(c)};let h,v=null,C=[],S,E,k,z=!1;const O=Qr().on("start",M=>{const{nodeLookup:T,transform:j,snapGrid:b,snapToGrid:I,nodeOrigin:N,paneDomNode:$}=n();if(h=T.get(t),!h)return;v=$?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:P}=pt(M.sourceEvent,{transform:j,snapGrid:b,snapToGrid:I,containerBounds:v});y={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...y,pointerX:A,pointerY:P,aspectRatio:y.width/y.height},S=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(S=T.get(h.parentId),E=S&&h.extent==="parent"?Of(S):void 0),C=[],k=void 0;for(const[H,R]of T)if(R.parentId===t&&(C.push({id:H,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const L=Vf(R,h,R.origin??N);k?k=[[Math.min(L[0][0],k[0][0]),Math.min(L[0][1],k[0][1])],[Math.max(L[1][0],k[1][0]),Math.max(L[1][1],k[1][1])]]:k=L}g?.(M,{...y})}).on("drag",M=>{const{transform:T,snapGrid:j,snapToGrid:b,nodeOrigin:I}=n(),N=pt(M.sourceEvent,{transform:T,snapGrid:j,snapToGrid:b,containerBounds:v}),$=[];if(!h)return;const{x:A,y:P,width:H,height:R}=y,L={},F=h.origin??I,{width:B,height:Z,x:U,y:W}=Lf(_,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,E,k),V=B!==H,Y=Z!==R,Q=U!==A&&V,K=W!==P&&Y;if(!Q&&!K&&!V&&!Y)return;if((Q||K||F[0]===1||F[1]===1)&&(L.x=Q?U:y.x,L.y=K?W:y.y,y.x=L.x,y.y=L.y,C.length>0)){const ne=U-A,te=W-P;for(const ae of C)ae.position={x:ae.position.x-ne+F[0]*(B-H),y:ae.position.y-te+F[1]*(Z-R)},$.push(ae)}if((V||Y)&&(L.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:y.width,L.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?Z:y.height,y.width=L.width,y.height=L.height),S&&h.expandParent){const ne=F[0]*(L.width??0);L.x&&L.x<ne&&(y.x=ne,_.x=_.x-(L.x-ne));const te=F[1]*(L.height??0);L.y&&L.y<te&&(y.y=te,_.y=_.y-(L.y-te))}const q=jf({width:y.width,prevWidth:H,height:y.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...y,direction:q};w?.(M,G)!==!1&&(z=!0,p?.(M,G),o(L,$))}).on("end",M=>{z&&(m?.(M,{...y}),r?.({...y}),z=!1)});i.call(O)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var zn={exports:{}},An={},$n={exports:{}},Pn={};var ir;function Ff(){if(ir)return Pn;ir=1;var e=Tr();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,f){var g=f(),p=o({inst:{value:g,getSnapshot:f}}),m=p[0].inst,w=p[1];return i(function(){m.value=g,m.getSnapshot=f,l(m)&&w({inst:m})},[d,g,f]),r(function(){return l(m)&&w({inst:m}),d(function(){l(m)&&w({inst:m})})},[d]),s(g),g}function l(d){var f=d.getSnapshot;d=d.value;try{var g=f();return!n(d,g)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Pn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Pn}var sr;function Xf(){return sr||(sr=1,$n.exports=Ff()),$n.exports}var ar;function Yf(){if(ar)return An;ar=1;var e=Tr(),t=Xf();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return An.useSyncExternalStoreWithSelector=function(c,u,d,f,g){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(S){if(!_){if(_=!0,h=S,S=f(S),g!==void 0&&m.hasValue){var E=m.value;if(g(E,S))return v=E}return v=S}if(E=v,o(h,S))return E;var k=f(S);return g!==void 0&&g(E,k)?(h=S,E):(h=S,v=k)}var _=!1,h,v,C=d===void 0?null:d;return[function(){return y(u())},C===null?void 0:function(){return y(C())}]},[u,d,f,g]);var w=r(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=w},[w]),l(w),w},An}var cr;function Wf(){return cr||(cr=1,zn.exports=Yf()),zn.exports}var Zf=Wf();const qf=za(Zf),Gf={},lr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Gf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},Uf=e=>e?lr(e):lr,{useDebugValue:Kf}=Aa,{useSyncExternalStoreWithSelector:Qf}=qf,Jf=e=>e;function Fi(e,t=Jf,n){const o=Qf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Kf(o),o}const ur=(e,t)=>{const n=Uf(e),o=(r,i=t)=>Fi(n,r,i);return Object.assign(o,n),o},eh=(e,t)=>e?ur(e,t):ur;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const gn=D.createContext(null),th=gn.Provider,Xi=be.error001();function J(e,t){const n=D.useContext(gn);if(n===null)throw new Error(Xi);return Fi(n,e,t)}function re(){const e=D.useContext(gn);if(e===null)throw new Error(Xi);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dr={display:"none"},nh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Yi="react-flow__node-desc",Wi="react-flow__edge-desc",oh="react-flow__aria-live",rh=e=>e.ariaLiveMessage,ih=e=>e.ariaLabelConfig;function sh({rfId:e}){const t=J(rh);return x.jsx("div",{id:`${oh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nh,children:t})}function ah({rfId:e,disableKeyboardA11y:t}){const n=J(ih);return x.jsxs(x.Fragment,{children:[x.jsx("div",{id:`${Yi}-${e}`,style:dr,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),x.jsx("div",{id:`${Wi}-${e}`,style:dr,children:n["edge.a11yDescription.default"]}),!t&&x.jsx(sh,{rfId:e})]})}const pn=D.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return x.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});pn.displayName="Panel";function ch({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:x.jsx(pn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:x.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const lh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Rt=e=>e.id;function uh(e,t){return oe(e.selectedNodes.map(Rt),t.selectedNodes.map(Rt))&&oe(e.selectedEdges.map(Rt),t.selectedEdges.map(Rt))}function dh({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(lh,uh);return D.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const fh=e=>!!e.onSelectionChangeHandlers;function hh({onSelectionChange:e}){const t=J(fh);return e||t?x.jsx(dh,{onSelectionChange:e}):null}const Zi=[0,0],gh={x:0,y:0,zoom:1},ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],fr=[...ph,"rfId"],mh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hr={translateExtent:vt,nodeOrigin:Zi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yh(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(mh,oe),c=re();D.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=hr,a()}),[]);const u=D.useRef(hr);return D.useEffect(()=>{for(const d of fr){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:Jd(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},fr.map(d=>e[d])),null}function gr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function xh(e){const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=gr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:gr()?.matches?"dark":"light"}const pr=typeof document<"u"?document:null;function Et(e=null,t={target:pr,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
1
|
+
import{x as Pe,a3 as Dr,ai as Ia,am as Tr,an as za,ao as Aa,r as D,j as x,F as ce,ae as ye,J as ve,af as $a,A as Pa,X as Hr,a5 as jn,aa as Ye,a8 as Da,B as Vt,T as se,ag as Ta,ad as Co,a4 as Ha,a7 as ja,ap as La}from"./entry.BdraBs_7.js";import{d as Ra}from"./chunk.jP0GrcaU.js";import{S as No}from"./chunk.uK7gG_4K.js";import{S as Oa,C as Va,I as Ba,a as Fa,b as Xa}from"./chunk.CC4zyxCR.js";import{B as Ue,S as dt}from"./chunk.CXR8SXil.js";import{D as _n,u as Ya}from"./chunk.Dwq9t2Dl.js";import{A as Wa}from"./chunk.yhAz0qwe.js";import{I as Za}from"./chunk.-1T4AUjH.js";import"./chunk.uyVen0u2.js";import"./chunk.KNtbB1xL.js";import"./chunk.BjFrJKj1.js";import"./chunk.CQFdZ3hg.js";const qa=[["path",{d:"M7 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],Ga=Pe("outline","box-multiple","BoxMultiple",qa);const Ua=[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]],jr=Pe("outline","box","Box",Ua);const Ka=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],Qa=Pe("outline","download","Download",Ka);const Ja=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-1"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-3"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-4"}]],ec=Pe("outline","focus-centered","FocusCentered",Ja);const tc=[["path",{d:"M4 4l16 0",key:"svg-0"}],["path",{d:"M4 20l16 0",key:"svg-1"}],["path",{d:"M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2",key:"svg-2"}]],nc=Pe("outline","layout-distribute-horizontal","LayoutDistributeHorizontal",tc);const oc=[["path",{d:"M4 4l0 16",key:"svg-0"}],["path",{d:"M20 4l0 16",key:"svg-1"}],["path",{d:"M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8",key:"svg-2"}]],rc=Pe("outline","layout-distribute-vertical","LayoutDistributeVertical",oc);const ic=[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]],sc=Pe("outline","lock-open","LockOpen",ic);const ac=[["path",{d:"M5 12l14 0",key:"svg-0"}]],cc=Pe("outline","minus","Minus",ac),lc=()=>Dr(Ia);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var uc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Bt(n)}function Bt(e){this._=e}function dc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Bt.prototype=sn.prototype={constructor:Bt,on:function(e,t){var n=this._,o=dc(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=fc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=Mo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Mo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function fc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Mo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=uc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const ko={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ko.hasOwnProperty(t)?{space:ko[t],local:e}:e}function hc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function gc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lr(e){var t=an(e);return(t.local?gc:hc)(t)}function pc(){}function Qn(e){return e==null?pc:function(){return this.querySelector(e)}}function mc(e){typeof e!="function"&&(e=Qn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new de(o,this._parents)}function yc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xc(){return[]}function Rr(e){return e==null?xc:function(){return this.querySelectorAll(e)}}function wc(e){return function(){return yc(e.apply(this,arguments))}}function vc(e){typeof e=="function"?e=wc(e):e=Rr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new de(o,r)}function Or(e){return function(){return this.matches(e)}}function Vr(e){return function(t){return t.matches(e)}}var bc=Array.prototype.find;function _c(e){return function(){return bc.call(this.children,e)}}function Sc(){return this.firstElementChild}function Ec(e){return this.select(e==null?Sc:_c(typeof e=="function"?e:Vr(e)))}var Cc=Array.prototype.filter;function Nc(){return Array.from(this.children)}function Mc(e){return function(){return Cc.call(this.children,e)}}function kc(e){return this.selectAll(e==null?Nc:Mc(typeof e=="function"?e:Vr(e)))}function Ic(e){typeof e!="function"&&(e=Or(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new de(o,this._parents)}function Br(e){return new Array(e.length)}function zc(){return new de(this._enter||this._groups.map(Br),this._parents)}function Zt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Zt.prototype={constructor:Zt,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 Ac(e){return function(){return e}}function $c(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Zt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Pc(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=s.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=s.call(e,i[a],a,i)+"",(l=c.get(g))?(o[a]=l,l.__data__=i[a],c.delete(g)):n[a]=new Zt(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Dc(e){return e.__data__}function Tc(e,t){if(!arguments.length)return Array.from(this,Dc);var n=t?Pc:$c,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ac(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,g=Hc(e.call(u,u&&u.__data__,c,o)),p=g.length,m=a[c]=new Array(p),w=s[c]=new Array(p),y=l[c]=new Array(f);n(u,d,m,w,y,g,t);for(var _=0,h=0,v,C;_<p;++_)if(v=m[_]){for(_>=h&&(h=_+1);!(C=w[h])&&++h<p;);v._next=C||null}}return s=new de(s,o),s._enter=a,s._exit=l,s}function Hc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jc(){return new de(this._exit||this._groups.map(Br),this._parents)}function Lc(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Rc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,p=0;p<d;++p)(g=c[p]||u[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new de(a,this._parents)}function Oc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Vc(e){e||(e=Bc);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new de(r,this._parents).order()}function Bc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xc(){return Array.from(this)}function Yc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Wc(){let e=0;for(const t of this)++e;return e}function Zc(){return!this.node()}function qc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Gc(e){return function(){this.removeAttribute(e)}}function Uc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kc(e,t){return function(){this.setAttribute(e,t)}}function Qc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function el(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 tl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Uc:Gc:typeof t=="function"?n.local?el:Jc:n.local?Qc:Kc)(n,t))}function Fr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nl(e){return function(){this.style.removeProperty(e)}}function ol(e,t,n){return function(){this.style.setProperty(e,t,n)}}function rl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function il(e,t,n){return arguments.length>1?this.each((t==null?nl:typeof t=="function"?rl:ol)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||Fr(e).getComputedStyle(e,null).getPropertyValue(t)}function sl(e){return function(){delete this[e]}}function al(e,t){return function(){this[e]=t}}function cl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ll(e,t){return arguments.length>1?this.each((t==null?sl:typeof t=="function"?cl:al)(e,t)):this.node()[e]}function Xr(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yr(e)}function Yr(e){this._node=e,this._names=Xr(e.getAttribute("class")||"")}Yr.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 Wr(e,t){for(var n=Jn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Zr(e,t){for(var n=Jn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ul(e){return function(){Wr(this,e)}}function dl(e){return function(){Zr(this,e)}}function fl(e,t){return function(){(t.apply(this,arguments)?Wr:Zr)(this,e)}}function hl(e,t){var n=Xr(e+"");if(arguments.length<2){for(var o=Jn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?fl:t?ul:dl)(n,t))}function gl(){this.textContent=""}function pl(e){return function(){this.textContent=e}}function ml(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yl(e){return arguments.length?this.each(e==null?gl:(typeof e=="function"?ml:pl)(e)):this.node().textContent}function xl(){this.innerHTML=""}function wl(e){return function(){this.innerHTML=e}}function vl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function bl(e){return arguments.length?this.each(e==null?xl:(typeof e=="function"?vl:wl)(e)):this.node().innerHTML}function _l(){this.nextSibling&&this.parentNode.appendChild(this)}function Sl(){return this.each(_l)}function El(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cl(){return this.each(El)}function Nl(e){var t=typeof e=="function"?e:Lr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ml(){return null}function kl(e,t){var n=typeof e=="function"?e:Lr(e),o=t==null?Ml:typeof t=="function"?t:Qn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Il(){var e=this.parentNode;e&&e.removeChild(this)}function zl(){return this.each(Il)}function Al(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $l(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pl(e){return this.select(e?$l:Al)}function Dl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Tl(e){return function(t){e.call(this,t,this.__data__)}}function Hl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function jl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Ll(e,t,n){return function(){var o=this.__on,r,i=Tl(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Rl(e,t,n){var o=Hl(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Ll:jl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function qr(e,t,n){var o=Fr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Ol(e,t){return function(){return qr(this,e,t)}}function Vl(e,t){return function(){return qr(this,e,t.apply(this,arguments))}}function Bl(e,t){return this.each((typeof t=="function"?Vl:Ol)(e,t))}function*Fl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Gr=[null];function de(e,t){this._groups=e,this._parents=t}function Ct(){return new de([[document.documentElement]],Gr)}function Xl(){return this}de.prototype=Ct.prototype={constructor:de,select:mc,selectAll:vc,selectChild:Ec,selectChildren:kc,filter:Ic,data:Tc,enter:zc,exit:jc,join:Lc,merge:Rc,selection:Xl,order:Oc,sort:Vc,call:Fc,nodes:Xc,node:Yc,size:Wc,empty:Zc,each:qc,attr:tl,style:il,property:ll,classed:hl,text:yl,html:bl,raise:Sl,lower:Cl,append:Nl,insert:kl,remove:zl,clone:Pl,datum:Dl,on:Rl,dispatch:Bl,[Symbol.iterator]:Fl};function ue(e){return typeof e=="string"?new de([[document.querySelector(e)]],[document.documentElement]):new de([[e]],Gr)}function Yl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Yl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Wl={passive:!1},mt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ur(e){var t=e.document.documentElement,n=ue(e).on("dragstart.drag",qe,mt);"onselectstart"in t?n.on("selectstart.drag",qe,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Kr(e,t){var n=e.document.documentElement,o=ue(e).on("dragstart.drag",null);t&&(o.on("click.drag",qe,mt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const $t=e=>()=>e;function Rn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Rn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zl(e){return!e.ctrlKey&&!e.button}function ql(){return this.parentNode}function Gl(e,t){return t??{x:e.x,y:e.y}}function Ul(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qr(){var e=Zl,t=ql,n=Gl,o=Ul,r={},i=sn("start","drag","end"),s=0,a,l,c,u,d=0;function f(v){v.on("mousedown.drag",g).filter(o).on("touchstart.drag",w).on("touchmove.drag",y,Wl).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(v,C){if(!(u||!e.call(this,v,C))){var S=h(this,t.call(this,v,C),v,C,"mouse");S&&(ue(v.view).on("mousemove.drag",p,mt).on("mouseup.drag",m,mt),Ur(v.view),Sn(v),c=!1,a=v.clientX,l=v.clientY,S("start",v))}}function p(v){if(qe(v),!c){var C=v.clientX-a,S=v.clientY-l;c=C*C+S*S>d}r.mouse("drag",v)}function m(v){ue(v.view).on("mousemove.drag mouseup.drag",null),Kr(v.view,c),qe(v),r.mouse("end",v)}function w(v,C){if(e.call(this,v,C)){var S=v.changedTouches,E=t.call(this,v,C),k=S.length,z,O;for(z=0;z<k;++z)(O=h(this,E,v,C,S[z].identifier,S[z]))&&(Sn(v),O("start",v,S[z]))}}function y(v){var C=v.changedTouches,S=C.length,E,k;for(E=0;E<S;++E)(k=r[C[E].identifier])&&(qe(v),k("drag",v,C[E]))}function _(v){var C=v.changedTouches,S=C.length,E,k;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),E=0;E<S;++E)(k=r[C[E].identifier])&&(Sn(v),k("end",v,C[E]))}function h(v,C,S,E,k,z){var O=i.copy(),M=fe(z||S,C),T,j,b;if((b=n.call(v,new Rn("beforestart",{sourceEvent:S,target:f,identifier:k,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:O}),E))!=null)return T=b.x-M[0]||0,j=b.y-M[1]||0,function I(N,$,A){var P=M,H;switch(N){case"start":r[k]=I,H=s++;break;case"end":delete r[k],--s;case"drag":M=fe(A||$,C),H=s;break}O.call(N,v,new Rn(N,{sourceEvent:$,subject:b,target:f,identifier:k,active:H,x:M[0]+T,y:M[1]+j,dx:M[0]-P[0],dy:M[1]-P[1],dispatch:O}),E)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:$t(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:$t(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:$t(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(d=(v=+v)*v,f):Math.sqrt(d)},f}function eo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Jr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Nt(){}var yt=.7,qt=1/yt,Ge="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kl=/^#([0-9a-f]{3,8})$/,Ql=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),Jl=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),eu=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${xt}\\)$`),tu=new RegExp(`^rgba\\(${we},${we},${we},${xt}\\)$`),nu=new RegExp(`^hsl\\(${xt},${we},${we}\\)$`),ou=new RegExp(`^hsla\\(${xt},${we},${we},${xt}\\)$`),Io={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};eo(Nt,Re,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zo,formatHex:zo,formatHex8:ru,formatHsl:iu,formatRgb:Ao,toString:Ao});function zo(){return this.rgb().formatHex()}function ru(){return this.rgb().formatHex8()}function iu(){return ei(this).formatHsl()}function Ao(){return this.rgb().formatRgb()}function Re(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$o(t):n===3?new le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pt(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=Ql.exec(e))?new le(t[1],t[2],t[3],1):(t=Jl.exec(e))?new le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eu.exec(e))?Pt(t[1],t[2],t[3],t[4]):(t=tu.exec(e))?Pt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nu.exec(e))?To(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?To(t[1],t[2]/100,t[3]/100,t[4]):Io.hasOwnProperty(e)?$o(Io[e]):e==="transparent"?new le(NaN,NaN,NaN,0):null}function $o(e){return new le(e>>16&255,e>>8&255,e&255,1)}function Pt(e,t,n,o){return o<=0&&(e=t=n=NaN),new le(e,t,n,o)}function su(e){return e instanceof Nt||(e=Re(e)),e?(e=e.rgb(),new le(e.r,e.g,e.b,e.opacity)):new le}function On(e,t,n,o){return arguments.length===1?su(e):new le(e,t,n,o??1)}function le(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}eo(le,On,Jr(Nt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new le(je(this.r),je(this.g),je(this.b),Gt(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:Po,formatHex:Po,formatHex8:au,formatRgb:Do,toString:Do}));function Po(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function au(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function Do(){const e=Gt(this.opacity);return`${e===1?"rgb(":"rgba("}${je(this.r)}, ${je(this.g)}, ${je(this.b)}${e===1?")":`, ${e})`}`}function Gt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return e=je(e),(e<16?"0":"")+e.toString(16)}function To(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function ei(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=Re(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function cu(e,t,n,o){return arguments.length===1?ei(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}eo(he,cu,Jr(Nt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new he(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,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new le(En(e>=240?e-240:e+120,r,o),En(e,r,o),En(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(Ho(this.h),Dt(this.s),Dt(this.l),Gt(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=Gt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ho(this.h)}, ${Dt(this.s)*100}%, ${Dt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ho(e){return e=(e||0)%360,e<0?e+360:e}function Dt(e){return Math.max(0,Math.min(1,e||0))}function En(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 to=e=>()=>e;function lu(e,t){return function(n){return e+n*t}}function uu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function du(e){return(e=+e)==1?ti:function(t,n){return n-t?uu(t,n,e):to(isNaN(t)?n:t)}}function ti(e,t){var n=t-e;return n?lu(e,n):to(isNaN(e)?t:e)}const Ut=(function e(t){var n=du(t);function o(r,i){var s=n((r=On(r)).r,(i=On(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ti(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function fu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function hu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gu(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=gt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function pu(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function xe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mu(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=gt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cn=new RegExp(Vn.source,"g");function yu(e){return function(){return e}}function xu(e){return function(t){return e(t)+""}}function ni(e,t){var n=Vn.lastIndex=Cn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Vn.exec(e))&&(r=Cn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:xe(o,r)})),n=Cn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?xu(l[0].x):yu(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function gt(e,t){var n=typeof t,o;return t==null||n==="boolean"?to(t):(n==="number"?xe:n==="string"?(o=Re(t))?(t=o,Ut):ni:t instanceof Re?Ut:t instanceof Date?pu:hu(t)?fu:Array.isArray(t)?gu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mu:xe)(e,t)}var jo=180/Math.PI,Bn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oi(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*jo,skewX:Math.atan(l)*jo,scaleX:s,scaleY:a}}var Tt;function wu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Bn:oi(t.a,t.b,t.c,t.d,t.e,t.f)}function vu(e){return e==null||(Tt||(Tt=document.createElementNS("http://www.w3.org/2000/svg","g")),Tt.setAttribute("transform",e),!(e=Tt.transform.baseVal.consolidate()))?Bn:(e=e.matrix,oi(e.a,e.b,e.c,e.d,e.e,e.f))}function ri(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push("translate(",null,t,null,n);p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:xe(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:xe(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push(r(g)+"scale(",null,",",null,")");p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var p=-1,m=f.length,w;++p<m;)d[(w=f[p]).i]=w.x(g);return d.join("")}}}var bu=ri(wu,"px, ","px)","deg)"),_u=ri(vu,", ",")",")"),Su=1e-12;function Lo(e){return((e=Math.exp(e))+1/e)/2}function Eu(e){return((e=Math.exp(e))-1/e)/2}function Cu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ft=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],g=u-a,p=d-l,m=g*g+p*p,w,y;if(m<Su)y=Math.log(f/c)/t,w=function(E){return[a+E*g,l+E*p,c*Math.exp(t*E*y)]};else{var _=Math.sqrt(m),h=(f*f-c*c+o*m)/(2*c*n*_),v=(f*f-c*c-o*m)/(2*f*n*_),C=Math.log(Math.sqrt(h*h+1)-h),S=Math.log(Math.sqrt(v*v+1)-v);y=(S-C)/t,w=function(E){var k=E*y,z=Lo(C),O=c/(n*_)*(z*Cu(t*k+C)-Eu(C));return[a+O*g,l+O*p,c*z/Lo(t*k+C)]}}return w.duration=y*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Qe=0,ft=0,lt=0,ii=1e3,Kt,ht,Qt=0,Oe=0,cn=0,wt=typeof performance=="object"&&performance.now?performance:Date,si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function no(){return Oe||(si(Nu),Oe=wt.now()+cn)}function Nu(){Oe=0}function Jt(){this._call=this._time=this._next=null}Jt.prototype=ai.prototype={constructor:Jt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?no():+n)+(t==null?0:+t),!this._next&&ht!==this&&(ht?ht._next=this:Kt=this,ht=this),this._call=e,this._time=n,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};function ai(e,t,n){var o=new Jt;return o.restart(e,t,n),o}function Mu(){no(),++Qe;for(var e=Kt,t;e;)(t=Oe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Ro(){Oe=(Qt=wt.now())+cn,Qe=ft=0;try{Mu()}finally{Qe=0,Iu(),Oe=0}}function ku(){var e=wt.now(),t=e-Qt;t>ii&&(cn-=t,Qt=e)}function Iu(){for(var e,t=Kt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Kt=n);ht=e,Fn(o)}function Fn(e){if(!Qe){ft&&(ft=clearTimeout(ft));var t=e-Oe;t>24?(e<1/0&&(ft=setTimeout(Ro,e-wt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Qt=wt.now(),lt=setInterval(ku,ii)),Qe=1,si(Ro))}}function Oo(e,t,n){var o=new Jt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var zu=sn("start","end","cancel","interrupt"),Au=[],ci=0,Vo=1,Xn=2,Xt=3,Bo=4,Yn=5,Yt=6;function ln(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;$u(e,n,{name:t,index:o,group:r,on:zu,tween:Au,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ci})}function oo(e,t){var n=me(e,t);if(n.state>ci)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=me(e,t);if(n.state>Xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function $u(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ai(i,0,n.time);function i(c){n.state=Vo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,g;if(n.state!==Vo)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Xt)return Oo(s);g.state===Bo?(g.state=Yt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Yt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Oo(function(){n.state===Xt&&(n.state=Bo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Xn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xn){for(n.state=Xt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Yn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Yn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Yt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Wt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Xn&&o.state<Yn,o.state=Yt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Pu(e){return this.each(function(){Wt(this,e)})}function Du(e,t){var n,o;return function(){var r=_e(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Tu(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Hu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Du:Tu)(n,e,t))}function ro(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function li(e,t){var n;return(typeof t=="number"?xe:t instanceof Re?Ut:(n=Re(t))?(t=n,Ut):ni)(e,t)}function ju(e){return function(){this.removeAttribute(e)}}function Lu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ru(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Ou(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Vu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Bu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Fu(e,t){var n=an(e),o=n==="transform"?_u:li;return this.attrTween(e,typeof t=="function"?(n.local?Bu:Vu)(n,o,ro(this,"attr."+e,t)):t==null?(n.local?Lu:ju)(n):(n.local?Ou:Ru)(n,o,t))}function Xu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Yu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Yu(e,i)),n}return r._value=t,r}function Zu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Xu(e,i)),n}return r._value=t,r}function qu(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 o=an(e);return this.tween(n,(o.local?Wu:Zu)(o,t))}function Gu(e,t){return function(){oo(this,e).delay=+t.apply(this,arguments)}}function Uu(e,t){return t=+t,function(){oo(this,e).delay=t}}function Ku(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Gu:Uu)(t,e)):me(this.node(),t).delay}function Qu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Ju(e,t){return t=+t,function(){_e(this,e).duration=t}}function ed(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qu:Ju)(t,e)):me(this.node(),t).duration}function td(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function nd(e){var t=this._id;return arguments.length?this.each(td(t,e)):me(this.node(),t).ease}function od(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function rd(e){if(typeof e!="function")throw new Error;return this.each(od(this._id,e))}function id(e){typeof e!="function"&&(e=Or(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Me(o,this._parents,this._name,this._id)}function sd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)s[a]=t[a];return new Me(s,this._parents,this._name,this._id)}function ad(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 cd(e,t,n){var o,r,i=ad(t)?oo:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ld(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(cd(n,e,t))}function ud(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function dd(){return this.on("end.remove",ud(this._id))}function fd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new Me(i,this._parents,t,n)}function hd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,p=me(u,n),m=0,w=f.length;m<w;++m)(g=f[m])&&ln(g,t,n,m,f,p);i.push(f),s.push(u)}return new Me(i,s,t,n)}var gd=Ct.prototype.constructor;function pd(){return new gd(this._groups,this._parents)}function md(e,t){var n,o,r;return function(){var i=Ke(this,e),s=(this.style.removeProperty(e),Ke(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ui(e){return function(){this.style.removeProperty(e)}}function yd(e,t,n){var o,r=n+"",i;return function(){var s=Ke(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function xd(e,t,n){var o,r,i;return function(){var s=Ke(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ke(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function wd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),c=l.on,u=l.value[i]==null?a||(a=ui(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function vd(e,t,n){var o=(e+="")=="transform"?bu:li;return t==null?this.styleTween(e,md(e,o)).on("end.style."+e,ui(e)):typeof t=="function"?this.styleTween(e,xd(e,o,ro(this,"style."+e,t))).each(wd(this._id,e)):this.styleTween(e,yd(e,o,t),n).on("end.style."+e,null)}function bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function _d(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&bd(e,s,n)),o}return i._value=t,i}function Sd(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,_d(e,t,n??""))}function Ed(e){return function(){this.textContent=e}}function Cd(e){return function(){var t=e(this);this.textContent=t??""}}function Nd(e){return this.tween("text",typeof e=="function"?Cd(ro(this,"text",e)):Ed(e==null?"":e+""))}function Md(e){return function(t){this.textContent=e.call(this,t)}}function kd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Md(r)),t}return o._value=e,o}function Id(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,kd(e))}function zd(){for(var e=this._name,t=this._id,n=di(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=me(l,t);ln(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Me(o,this._parents,e,n)}function Ad(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=_e(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var $d=0;function Me(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function di(){return++$d}var Ee=Ct.prototype;Me.prototype={constructor:Me,select:fd,selectAll:hd,selectChild:Ee.selectChild,selectChildren:Ee.selectChildren,filter:id,merge:sd,selection:pd,transition:zd,call:Ee.call,nodes:Ee.nodes,node:Ee.node,size:Ee.size,empty:Ee.empty,each:Ee.each,on:ld,attr:Fu,attrTween:qu,style:vd,styleTween:Sd,text:Nd,textTween:Id,remove:dd,tween:Hu,delay:Ku,duration:ed,ease:nd,easeVarying:rd,end:Ad,[Symbol.iterator]:Ee[Symbol.iterator]};function Pd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dd={time:null,delay:0,duration:250,ease:Pd};function Td(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 Hd(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=di(),(n=Dd).time=no(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&ln(l,e,t,c,s,n||Td(l,t));return new Me(o,this._parents,e,t)}Ct.prototype.interrupt=Pu;Ct.prototype.transition=Hd;const Ht=e=>()=>e;function jd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){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:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ce(e,t,n){this.k=e,this.x=t,this.y=n}Ce.prototype={constructor:Ce,scale:function(e){return e===1?this:new Ce(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ce(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 un=new Ce(1,0,0);fi.prototype=Ce.prototype;function fi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function Ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Rd(){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 Fo(){return this.__zoom||un}function Od(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function hi(){var e=Ld,t=Rd,n=Bd,o=Od,r=Vd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ft,c=sn("start","zoom","end"),u,d,f,g=500,p=150,m=0,w=10;function y(b){b.property("__zoom",Fo).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(b,I,N,$){var A=b.selection?b.selection():b;A.property("__zoom",Fo),b!==A?C(b,I,N,$):A.interrupt().each(function(){S(this,arguments).event($).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},y.scaleBy=function(b,I,N,$){y.scaleTo(b,function(){var A=this.__zoom.k,P=typeof I=="function"?I.apply(this,arguments):I;return A*P},N,$)},y.scaleTo=function(b,I,N,$){y.transform(b,function(){var A=t.apply(this,arguments),P=this.__zoom,H=N==null?v(A):typeof N=="function"?N.apply(this,arguments):N,R=P.invert(H),L=typeof I=="function"?I.apply(this,arguments):I;return n(h(_(P,L),H,R),A,s)},N,$)},y.translateBy=function(b,I,N,$){y.transform(b,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,$)},y.translateTo=function(b,I,N,$,A){y.transform(b,function(){var P=t.apply(this,arguments),H=this.__zoom,R=$==null?v(P):typeof $=="function"?$.apply(this,arguments):$;return n(un.translate(R[0],R[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),P,s)},$,A)};function _(b,I){return I=Math.max(i[0],Math.min(i[1],I)),I===b.k?b:new Ce(I,b.x,b.y)}function h(b,I,N){var $=I[0]-N[0]*b.k,A=I[1]-N[1]*b.k;return $===b.x&&A===b.y?b:new Ce(b.k,$,A)}function v(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function C(b,I,N,$){b.on("start.zoom",function(){S(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event($).end()}).tween("zoom",function(){var A=this,P=arguments,H=S(A,P).event($),R=t.apply(A,P),L=N==null?v(R):typeof N=="function"?N.apply(A,P):N,F=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=A.__zoom,Z=typeof I=="function"?I.apply(A,P):I,U=l(B.invert(L).concat(F/B.k),Z.invert(L).concat(F/Z.k));return function(W){if(W===1)W=Z;else{var V=U(W),Y=F/V[2];W=new Ce(Y,L[0]-V[0]*Y,L[1]-V[1]*Y)}H.zoom(null,W)}})}function S(b,I,N){return!N&&b.__zooming||new E(b,I)}function E(b,I){this.that=b,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,I),this.taps=0}E.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,I){return this.mouse&&b!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var I=ue(this.that).datum();c.call(b,this.that,new jd(b,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:c}),I)}};function k(b,...I){if(!e.apply(this,arguments))return;var N=S(this,I).event(b),$=this.__zoom,A=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,o.apply(this,arguments)))),P=fe(b);if(N.wheel)(N.mouse[0][0]!==P[0]||N.mouse[0][1]!==P[1])&&(N.mouse[1]=$.invert(N.mouse[0]=P)),clearTimeout(N.wheel);else{if($.k===A)return;N.mouse=[P,$.invert(P)],Wt(this),N.start()}ut(b),N.wheel=setTimeout(H,p),N.zoom("mouse",n(h(_($,A),N.mouse[0],N.mouse[1]),N.extent,s));function H(){N.wheel=null,N.end()}}function z(b,...I){if(f||!e.apply(this,arguments))return;var N=b.currentTarget,$=S(this,I,!0).event(b),A=ue(b.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),P=fe(b,N),H=b.clientX,R=b.clientY;Ur(b.view),Nn(b),$.mouse=[P,this.__zoom.invert(P)],Wt(this),$.start();function L(B){if(ut(B),!$.moved){var Z=B.clientX-H,U=B.clientY-R;$.moved=Z*Z+U*U>m}$.event(B).zoom("mouse",n(h($.that.__zoom,$.mouse[0]=fe(B,N),$.mouse[1]),$.extent,s))}function F(B){A.on("mousemove.zoom mouseup.zoom",null),Kr(B.view,$.moved),ut(B),$.event(B).end()}}function O(b,...I){if(e.apply(this,arguments)){var N=this.__zoom,$=fe(b.changedTouches?b.changedTouches[0]:b,this),A=N.invert($),P=N.k*(b.shiftKey?.5:2),H=n(h(_(N,P),$,A),t.apply(this,I),s);ut(b),a>0?ue(this).transition().duration(a).call(C,H,$,b):ue(this).call(y.transform,H,$,b)}}function M(b,...I){if(e.apply(this,arguments)){var N=b.touches,$=N.length,A=S(this,I,b.changedTouches.length===$).event(b),P,H,R,L;for(Nn(b),H=0;H<$;++H)R=N[H],L=fe(R,this),L=[L,this.__zoom.invert(L),R.identifier],A.touch0?!A.touch1&&A.touch0[2]!==L[2]&&(A.touch1=L,A.taps=0):(A.touch0=L,P=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(A.taps<2&&(d=L[0],u=setTimeout(function(){u=null},g)),Wt(this),A.start())}}function T(b,...I){if(this.__zooming){var N=S(this,I).event(b),$=b.changedTouches,A=$.length,P,H,R,L;for(ut(b),P=0;P<A;++P)H=$[P],R=fe(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=R:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=R);if(H=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],Z=N.touch1[0],U=N.touch1[1],W=(W=Z[0]-F[0])*W+(W=Z[1]-F[1])*W,V=(V=U[0]-B[0])*V+(V=U[1]-B[1])*V;H=_(H,Math.sqrt(W/V)),R=[(F[0]+Z[0])/2,(F[1]+Z[1])/2],L=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(N.touch0)R=N.touch0[0],L=N.touch0[1];else return;N.zoom("touch",n(h(H,R,L),N.extent,s))}}function j(b,...I){if(this.__zooming){var N=S(this,I).event(b),$=b.changedTouches,A=$.length,P,H;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),P=0;P<A;++P)H=$[P],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=fe(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<w)){var R=ue(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return y.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Ht(+b),y):o},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ht(!!b),y):e},y.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Ht(!!b),y):r},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Ht([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],y):[i[0],i[1]]},y.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(a=+b,y):a},y.interpolate=function(b){return arguments.length?(l=b,y):l},y.on=function(){var b=c.on.apply(c,arguments);return b===c?y:b},y.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,y):Math.sqrt(m)},y.tapDistance=function(b){return arguments.length?(w=+b,y):w},y}const be={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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", 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."},vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gi=["Enter"," ","Escape"],pi={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Le;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Le||(Le={}));var bt;(function(e){e.Partial="partial",e.Full="full"})(bt||(bt={}));const mi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var $e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})($e||($e={}));var en;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(en||(en={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Xo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function yi(e){return e===null?null:e?"valid":"invalid"}const xi=e=>"id"in e&&"source"in e&&"target"in e,Fd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mt=(e,t=[0,0])=>{const{width:n,height:o}=ke(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Xd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=s?tn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},kt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,tn(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},so=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...zt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(s&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,p=u.height??c.height??c.initialHeight??null,m=_t(a,tt(c)),w=(g??0)*(p??0),y=i&&m>0;(!c.internals.handleBounds||y||m>=w||c.dragging)&&l.push(c)}return l},Yd=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Wd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Zd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Wd(e,s),l=kt(a),c=ao(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function wi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",be.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(d=[[l,c],[l+g,c+p]])}else a&&nt(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=nt(d)?Ve(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",be.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function qd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const g=i.has(f.id),p=!g&&f.parentId&&s.find(m=>m.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Yd(s,l);for(const f of l)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ve=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function vi(e,t,n){const{width:o,height:r}=ke(n),{x:i,y:s}=n.internals.positionAbsolute;return Ve(e,[[i,s],[i+o,s+r]],t)}const Yo=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,bi=(e,t,n=15,o=40)=>{const r=Yo(e.x,o,t.width-o)*n,i=Yo(e.y,o,t.height-o)*n;return[r,i]},dn=(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)}),Wn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},tn=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},_i=(e,t)=>fn(dn(Wn(e),Wn(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)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Wo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Gd=(e,t)=>{},It=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),zt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?It(a,s):a},nn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(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 Ud(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),i=Xe(e.left??e.x??0,t),s=Xe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Kd(e,t,n,o,r,i){const{x:s,y:a}=nn(e,[t,n,o]),{x:l,y:c}=nn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const ao=(e,t,n,o,r,i)=>{const s=Ud(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,p=n/2-f*u,m=Kd(e,g,p,u,t,n),w={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:g-w.left+w.right,y:p-w.top+w.bottom,zoom:u}},St=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function ke(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Si(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ei(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Zo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Qd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Jd(e){return{...pi,...e||{}}}function pt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=zt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?It(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const co=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ci=e=>e?.getRootNode?.()||window?.document,ef=["INPUT","SELECT","TEXTAREA"];function Ni(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ef.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Mi=e=>"clientX"in e,pe=(e,t)=>{const n=Mi(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...co(s)}})};function ki({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Go({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-jt(t-o,i),n];case X.Right:return[t+jt(o-t,i),n];case X.Top:return[t,n-jt(n-r,i)];case X.Bottom:return[t,n+jt(r-n,i)]}}function Ii({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Go({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=Go({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,g,p]=ki({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,p]}function zi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function tf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=dn(tn(e),tn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return _t(s,fn(i))>0}const of=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,rf=(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)),sf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||of;let r;return xi(e)?r={...e}:r={...e,id:o(e)},rf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Ai({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=zi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Uo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},af=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function cf({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Uo[t],l=Uo[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=af({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let p=[],m,w;const y={x:0,y:0},_={x:0,y:0},[,,h,v]=zi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(m=r.x??c.x+(u.x-c.x)*s,w=r.y??(c.y+u.y)/2):(m=r.x??(c.x+u.x)/2,w=r.y??c.y+(u.y-c.y)*s);const S=[{x:m,y:c.y},{x:m,y:u.y}],E=[{x:c.x,y:w},{x:u.x,y:w}];a[f]===g?p=f==="x"?S:E:p=f==="x"?E:S}else{const S=[{x:c.x,y:u.y}],E=[{x:u.x,y:c.y}];if(f==="x"?p=a.x===g?E:S:p=a.y===g?S:E,t===o){const T=Math.abs(e[f]-n[f]);if(T<=i){const j=Math.min(i-1,i-T);a[f]===g?y[f]=(c[f]>e[f]?-1:1)*j:_[f]=(u[f]>n[f]?-1:1)*j}}if(t!==o){const T=f==="x"?"y":"x",j=a[f]===l[T],b=c[T]>u[T],I=c[T]<u[T];(a[f]===1&&(!j&&b||j&&I)||a[f]!==1&&(!j&&I||j&&b))&&(p=f==="x"?S:E)}const k={x:c.x+y.x,y:c.y+y.y},z={x:u.x+_.x,y:u.y+_.y},O=Math.max(Math.abs(k.x-p[0].x),Math.abs(z.x-p[0].x)),M=Math.max(Math.abs(k.y-p[0].y),Math.abs(z.y-p[0].y));O>=M?(m=(k.x+z.x)/2,w=p[0].y):(m=p[0].x,w=(k.y+z.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...p,{x:u.x+_.x,y:u.y+_.y},n],m,w,h,v]}function lf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Zn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,p,m]=cf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((y,_,h)=>{let v="";return h>0&&h<d.length-1?v=lf(d[h-1],_,d[h+1],s):v=`${h===0?"M":"L"}${_.x} ${_.y}`,y+=v,y},""),f,g,p,m]}function Qo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function uf(e){const{sourceNode:t,targetNode:n}=e;if(!Qo(t)||!Qo(n))return null;const o=t.internals.handleBounds||Jo(t.handles),r=n.internals.handleBounds||Jo(n.handles),i=er(o?.source??[],e.sourceHandle),s=er(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",be.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,c=Be(t,i,a),u=Be(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Jo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Be(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??ke(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function er(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function qn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function df(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=qn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const $i=1e3,ff=10,lo={nodeOrigin:[0,0],nodeExtent:vt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hf={...lo,checkEquality:!0};function uo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gf(e,t,n){const o=uo(lo,n);for(const r of e.values())if(r.parentId)ho(r,e,t,o);else{const i=Mt(r,o.nodeOrigin),s=nt(r.extent)?r.extent:o.nodeExtent,a=Ve(i,s,ke(r));r.internals.positionAbsolute=a}}function pf(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function fo(e){return e==="manual"}function Gn(e,t,n,o={}){const r=uo(hf,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?$i:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Mt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Ve(d,f,ke(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:pf(c,u),z:Pi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&ho(u,t,n,o,i)}return l}function mf(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 ho(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=uo(lo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}mf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*ff),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!fo(l)?$i:0,{x:f,y:g,z:p}=yf(e,u,s,a,d,l),{positionAbsolute:m}=e.internals,w=f!==m.x||g!==m.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:g}:m,z:p}})}function Pi(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function yf(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=ke(e),c=Mt(e,n),u=nt(e.extent)?Ve(c,e.extent,l):c;let d=Ve({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=vi(d,l,t));const f=Pi(e,r,i),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??tt(a),c=_i(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=ke(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,g=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,p=Math.max(u.width,Math.round(s.width)),m=Math.max(u.height,Math.round(s.height)),w=(p-u.width)*d[0],y=(m-u.height)*d[1];(f>0||g>0||w||y)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+w,y:a.position.y-g+y}}),n.get(l)?.forEach(_=>{e.some(h=>h.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<s.width||u.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?d[0]*f-w:0),height:m+(g?d[1]*g-y:0)}})}),r}function xf(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),l=!0;continue}const m=co(g.nodeElement),w=p.measured.width!==m.width||p.measured.height!==m.height;if(!!(m.width&&m.height&&(w||!p.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),h=nt(p.extent)?p.extent:i;let{positionAbsolute:v}=p.internals;p.parentId&&p.extent==="parent"?v=vi(v,m,t.get(p.parentId)):h&&(v=Ve(v,h,m));const C={...p,measured:m,internals:{...p.internals,positionAbsolute:v,handleBounds:{source:qo("source",g.nodeElement,_,d,p.id),target:qo("target",g.nodeElement,_,d,p.id)}}};t.set(p.id,C),p.parentId&&ho(C,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,w&&(c.push({id:p.id,type:"dimensions",dimensions:m}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:tt(C,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function wf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){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],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function tr(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;tr("source",l,u,e,r,s),tr("target",l,c,e,i,a),t.set(o.id,o)}}function Ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ti(n,t):!1}function nr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function vf(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ti(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,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 r}function Mn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=It(i,t);return{x:s.x-i.x,y:s.y-i.y}}function _f({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,p=!1,m=null;function w({noDragClassName:_,handleSelector:h,domNode:v,isSelectable:C,nodeId:S,nodeClickDistance:E=0}){f=ue(v);function k({x:T,y:j}){const{nodeLookup:b,nodeExtent:I,snapGrid:N,snapToGrid:$,nodeOrigin:A,onNodeDrag:P,onSelectionDrag:H,onError:R,updateNodePositions:L}=t();i={x:T,y:j};let F=!1;const B=a.size>1,Z=B&&I?Wn(kt(a)):null,U=B&&$?bf({dragItems:a,snapGrid:N,x:T,y:j}):null;for(const[W,V]of a){if(!b.has(W))continue;let Y={x:T-V.distance.x,y:j-V.distance.y};$&&(Y=U?{x:Math.round(Y.x+U.x),y:Math.round(Y.y+U.y)}:It(Y,N));let Q=null;if(B&&I&&!V.extent&&Z){const{positionAbsolute:G}=V.internals,ee=G.x-Z.x+I[0][0],ne=G.x+V.measured.width-Z.x2+I[1][0],te=G.y-Z.y+I[0][1],ae=G.y+V.measured.height-Z.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:K,positionAbsolute:q}=wi({nodeId:W,nextPosition:Y,nodeLookup:b,nodeExtent:Q||I,nodeOrigin:A,onError:R});F=F||V.position.x!==K.x||V.position.y!==K.y,V.position=K,V.internals.positionAbsolute=q}if(p=p||F,!!F&&(L(a,!0),m&&(o||P||!S&&H))){const[W,V]=Mn({nodeId:S,dragItems:a,nodeLookup:b});o?.(m,a,W,V),P?.(m,W,V),S||H?.(m,V)}}async function z(){if(!u)return;const{transform:T,panBy:j,autoPanSpeed:b,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,$]=bi(c,u,b);(N!==0||$!==0)&&(i.x=(i.x??0)-N/T[2],i.y=(i.y??0)-$/T[2],await j({x:N,y:$})&&k(i)),s=requestAnimationFrame(z)}function O(T){const{nodeLookup:j,multiSelectionActive:b,nodesDraggable:I,transform:N,snapGrid:$,snapToGrid:A,selectNodesOnDrag:P,onNodeDragStart:H,onSelectionDragStart:R,unselectNodesAndEdges:L}=t();d=!0,(!P||!C)&&!b&&S&&(j.get(S)?.selected||L()),C&&P&&S&&e?.(S);const F=pt(T.sourceEvent,{transform:N,snapGrid:$,snapToGrid:A,containerBounds:u});if(i=F,a=vf(j,I,F,S),a.size>0&&(n||H||!S&&R)){const[B,Z]=Mn({nodeId:S,dragItems:a,nodeLookup:j});n?.(T.sourceEvent,a,B,Z),H?.(T.sourceEvent,B,Z),S||R?.(T.sourceEvent,Z)}}const M=Qr().clickDistance(E).on("start",T=>{const{domNode:j,nodeDragThreshold:b,transform:I,snapGrid:N,snapToGrid:$}=t();u=j?.getBoundingClientRect()||null,g=!1,p=!1,m=T.sourceEvent,b===0&&O(T),i=pt(T.sourceEvent,{transform:I,snapGrid:N,snapToGrid:$,containerBounds:u}),c=pe(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:j,transform:b,snapGrid:I,snapToGrid:N,nodeDragThreshold:$,nodeLookup:A}=t(),P=pt(T.sourceEvent,{transform:b,snapGrid:I,snapToGrid:N,containerBounds:u});if(m=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||S&&!A.has(S))&&(g=!0),!g){if(!l&&j&&d&&(l=!0,z()),!d){const H=pe(T.sourceEvent,u),R=H.x-c.x,L=H.y-c.y;Math.sqrt(R*R+L*L)>$&&O(T)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&d&&(c=pe(T.sourceEvent,u),k(P))}}).on("end",T=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:j,updateNodePositions:b,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(b(a,!1),p=!1),r||I||!S&&N){const[$,A]=Mn({nodeId:S,dragItems:a,nodeLookup:j,dragging:!1});r?.(T.sourceEvent,a,$,A),I?.(T.sourceEvent,$,A),S||N?.(T.sourceEvent,A)}}}).filter(T=>{const j=T.target;return!T.button&&(!_||!nr(j,`.${_}`,v))&&(!h||nr(j,h,v))});f.call(M)}function y(){f?.on(".drag",null)}return{update:w,destroy:y}}function Sf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())_t(r,tt(i))>0&&o.push(i);return o}const Ef=250;function Cf(e,t,n,o){let r=[],i=1/0;const s=Sf(e,n,t+Ef);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Be(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Hi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Be(s,l,l.position,!0)}:l}function ji(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Nf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Li=()=>!0;function Mf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:w,isValidConnection:y=Li,onReconnectEnd:_,updateConnection:h,getTransform:v,getFromHandle:C,autoPanSpeed:S,dragThreshold:E=1,handleDomNode:k}){const z=Ci(e.target);let O=0,M;const{x:T,y:j}=pe(e),b=ji(i,k),I=a?.getBoundingClientRect();let N=!1;if(!I||!b)return;const $=Hi(r,b,o,l,t);if(!$)return;let A=pe(e,I),P=!1,H=null,R=!1,L=null;function F(){if(!u||!I)return;const[K,q]=bi(A,I,S);f({x:K,y:q}),O=requestAnimationFrame(F)}const B={...$,nodeId:r,type:b,position:$.position},Z=l.get(r);let W={inProgress:!0,isValid:null,from:Be(Z,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Z,to:A,toHandle:null,toPosition:Xo[B.position],toNode:null,pointer:A};function V(){N=!0,h(W),p?.(e,{nodeId:r,handleId:o,handleType:b})}E===0&&V();function Y(K){if(!N){const{x:ae,y:Ie}=pe(K),Se=ae-T,De=Ie-j;if(!(Se*Se+De*De>E*E))return;V()}if(!C()||!B){Q(K);return}const q=v();A=pe(K,I),M=Cf(zt(A,q,!1,[1,1]),n,l,B),P||(F(),P=!0);const G=Ri(K,{handle:M,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:z,lib:c,flowId:d,nodeLookup:l});L=G.handleDomNode,H=G.connection,R=Nf(!!M,G.isValid);const ee=l.get(r),ne=ee?Be(ee,B,X.Left,!0):W.from,te={...W,from:ne,isValid:R,to:G.toHandle&&R?nn({x:G.toHandle.x,y:G.toHandle.y},q):A,toHandle:G.toHandle,toPosition:R&&G.toHandle?G.toHandle.position:Xo[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:A};h(te),W=te}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(N){(M||L)&&H&&R&&m?.(H);const{inProgress:q,...G}=W,ee={...G,toPosition:W.toHandle?W.toPosition:null};w?.(K,ee),i&&_?.(K,ee)}g(),cancelAnimationFrame(O),P=!1,R=!1,H=null,L=null,z.removeEventListener("mousemove",Y),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",Y),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",Y),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",Y),z.addEventListener("touchend",Q)}function Ri(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Li,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=pe(e),m=s.elementFromPoint(g,p),w=m?.classList.contains(`${a}-flow__handle`)?m:f,y={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const _=ji(void 0,w),h=w.getAttribute("data-nodeid"),v=w.getAttribute("data-handleid"),C=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!h||!_)return y;const E={source:d?h:o,sourceHandle:d?v:r,target:d?o:h,targetHandle:d?r:v};y.connection=E;const z=C&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":h!==o||v!==r);y.isValid=z&&c(E),y.toHandle=Hi(h,_,v,u,n,!0)}return y}const Un={onPointerDown:Mf,isValid:Ri};function kf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ue(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const v=n(),C=h.sourceEvent.ctrlKey&&St()?10:1,S=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,E=v[2]*Math.pow(2,S*C);t.scaleTo(E)};let m=[0,0];const w=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(m=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},y=h=>{const v=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const C=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],S=[C[0]-m[0],C[1]-m[1]];m=C;const E=o()*Math.max(v[2],Math.log(v[2]))*(g?-1:1),k={x:v[0]-S[0]*E,y:v[1]-S[1]*E},z=[[0,0],[l,c]];t.setViewportConstrained({x:k.x,y:k.y,zoom:v[2]},z,a)},_=hi().on("start",w).on("zoom",d?y:null).on("zoom.wheel",f?p:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),kn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),If=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,In=(e,t=0,n=If,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Vi=e=>{const t=e.ctrlKey&&St()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(We(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=fe(u),y=Vi(u),_=d*Math.pow(2,y);o.scaleTo(n,_,w,u);return}const f=u.deltaMode===1?20:1;let g=r===Le.Vertical?0:u.deltaX*f,p=r===Le.Horizontal?0:u.deltaY*f;!St()&&u.shiftKey&&r!==Le.Vertical&&(g=u.deltaY*f,p=0),o.translateBy(n,-(g/d)*i,-(p/d)*i,{internal:!0});const m=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,m),e.panScrollTimeout=setTimeout(()=>{c?.(u,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,m))}}function Af({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=We(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function $f({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Pf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Oi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,hn(i.transform))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Tf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,p=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(We(d,`${c}-flow__node`)||We(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!p||We(d,a)&&p||We(d,l)&&(!p||r&&p&&!e)||!n&&d.ctrlKey&&p)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||p)&&m}}function Hf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hi().scaleExtent([t,n]).translateExtent(o),f=ue(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");d.wheelDelta(Vi);function m(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).transform(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function w({noWheelClassName:M,noPanClassName:T,onPaneContextMenu:j,userSelectionActive:b,panOnScroll:I,panOnDrag:N,panOnScrollMode:$,panOnScrollSpeed:A,preventScrolling:P,zoomOnPinch:H,zoomOnScroll:R,zoomOnDoubleClick:L,zoomActivationKeyPressed:F,lib:B,onTransformChange:Z,connectionInProgress:U,paneClickDistance:W,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&y();const Y=I&&!F&&!b;d.clickDistance(V?1/0:!ge(W)||W<0?0:W);const Q=Y?zf({zoomPanValues:c,noWheelClassName:M,d3Selection:f,d3Zoom:d,panOnScrollMode:$,panOnScrollSpeed:A,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Af({noWheelClassName:M,preventScrolling:P,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const q=$f({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);const G=Pf({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!j,onPanZoom:i,onTransformChange:Z});d.on("zoom",G);const ee=Df({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:j,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const K=Tf({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:L,zoomOnPinch:H,userSelectionActive:b,noPanClassName:T,noWheelClassName:M,lib:B,connectionInProgress:U});d.filter(K),L?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function y(){d.on("zoom",null)}async function _(M,T,j){const b=kn(M),I=d?.constrain()(b,T,j);return I&&await m(I),new Promise(N=>N(I))}async function h(M,T){const j=kn(M);return await m(j,T),new Promise(b=>b(j))}function v(M){if(f){const T=kn(M),j=f.property("__zoom");(j.k!==M.zoom||j.x!==M.x||j.y!==M.y)&&d?.transform(f,T,null,{sync:!0})}}function C(){const M=f?fi(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function S(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).scaleTo(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function E(M,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?gt:Ft).scaleBy(In(f,T?.duration,T?.ease,()=>j(!0)),M)}):Promise.resolve(!1)}function k(M){d?.scaleExtent(M)}function z(M){d?.translateExtent(M)}function O(M){const T=!ge(M)||M<0?0:M;d?.clickDistance(T)}return{update:w,destroy:y,setViewport:h,setViewportConstrained:_,getViewport:C,scaleTo:S,scaleBy:E,setScaleExtent:k,setTranslateExtent:z,syncViewport:v,setClickDistance:O}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function jf({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function or(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function ze(e,t){return Math.max(0,t-e)}function Ae(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function rr(e,t){return e?!t:t}function Lf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:p}=n,{minWidth:m,maxWidth:w,minHeight:y,maxHeight:_}=o,{x:h,y:v,width:C,height:S,aspectRatio:E}=e;let k=Math.floor(u?g-e.pointerX:0),z=Math.floor(d?p-e.pointerY:0);const O=C+(l?-k:k),M=S+(c?-z:z),T=-i[0]*C,j=-i[1]*S;let b=Lt(O,m,w),I=Lt(M,y,_);if(s){let A=0,P=0;l&&k<0?A=ze(h+k+T,s[0][0]):!l&&k>0&&(A=Ae(h+O+T,s[1][0])),c&&z<0?P=ze(v+z+j,s[0][1]):!c&&z>0&&(P=Ae(v+M+j,s[1][1])),b=Math.max(b,A),I=Math.max(I,P)}if(a){let A=0,P=0;l&&k>0?A=Ae(h+k,a[0][0]):!l&&k<0&&(A=ze(h+O,a[1][0])),c&&z>0?P=Ae(v+z,a[0][1]):!c&&z<0&&(P=ze(v+M,a[1][1])),b=Math.max(b,A),I=Math.max(I,P)}if(r){if(u){const A=Lt(O/E,y,_)*E;if(b=Math.max(b,A),s){let P=0;!l&&!c||l&&!c&&f?P=Ae(v+j+O/E,s[1][1])*E:P=ze(v+j+(l?k:-k)/E,s[0][1])*E,b=Math.max(b,P)}if(a){let P=0;!l&&!c||l&&!c&&f?P=ze(v+O/E,a[1][1])*E:P=Ae(v+(l?k:-k)/E,a[0][1])*E,b=Math.max(b,P)}}if(d){const A=Lt(M*E,m,w)/E;if(I=Math.max(I,A),s){let P=0;!l&&!c||c&&!l&&f?P=Ae(h+M*E+T,s[1][0])/E:P=ze(h+(c?z:-z)*E+T,s[0][0])/E,I=Math.max(I,P)}if(a){let P=0;!l&&!c||c&&!l&&f?P=ze(h+M*E,a[1][0])/E:P=Ae(h+(c?z:-z)*E,a[0][0])/E,I=Math.max(I,P)}}}z=z+(z<0?I:-I),k=k+(k<0?b:-b),r&&(f?O>M*E?z=(rr(l,c)?-k:k)/E:k=(rr(l,c)?-z:z)*E:u?(z=k/E,c=l):(k=z*E,l=c));const N=l?h+k:h,$=c?v+z:v;return{width:C+(l?-k:k),height:S+(c?-z:z),x:i[0]*k*(l?-1:1)+N,y:i[1]*z*(c?-1:1)+$}}const Bi={width:0,height:0,x:0,y:0},Rf={...Bi,pointerX:0,pointerY:0,aspectRatio:1};function Of(e){return[[0,0],[e.measured.width,e.measured.height]]}function Vf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Bf({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ue(e);let s={controlDirection:or("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:m,shouldResize:w}){let y={...Bi},_={...Rf};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:or(c)};let h,v=null,C=[],S,E,k,z=!1;const O=Qr().on("start",M=>{const{nodeLookup:T,transform:j,snapGrid:b,snapToGrid:I,nodeOrigin:N,paneDomNode:$}=n();if(h=T.get(t),!h)return;v=$?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:P}=pt(M.sourceEvent,{transform:j,snapGrid:b,snapToGrid:I,containerBounds:v});y={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...y,pointerX:A,pointerY:P,aspectRatio:y.width/y.height},S=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(S=T.get(h.parentId),E=S&&h.extent==="parent"?Of(S):void 0),C=[],k=void 0;for(const[H,R]of T)if(R.parentId===t&&(C.push({id:H,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const L=Vf(R,h,R.origin??N);k?k=[[Math.min(L[0][0],k[0][0]),Math.min(L[0][1],k[0][1])],[Math.max(L[1][0],k[1][0]),Math.max(L[1][1],k[1][1])]]:k=L}g?.(M,{...y})}).on("drag",M=>{const{transform:T,snapGrid:j,snapToGrid:b,nodeOrigin:I}=n(),N=pt(M.sourceEvent,{transform:T,snapGrid:j,snapToGrid:b,containerBounds:v}),$=[];if(!h)return;const{x:A,y:P,width:H,height:R}=y,L={},F=h.origin??I,{width:B,height:Z,x:U,y:W}=Lf(_,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,E,k),V=B!==H,Y=Z!==R,Q=U!==A&&V,K=W!==P&&Y;if(!Q&&!K&&!V&&!Y)return;if((Q||K||F[0]===1||F[1]===1)&&(L.x=Q?U:y.x,L.y=K?W:y.y,y.x=L.x,y.y=L.y,C.length>0)){const ne=U-A,te=W-P;for(const ae of C)ae.position={x:ae.position.x-ne+F[0]*(B-H),y:ae.position.y-te+F[1]*(Z-R)},$.push(ae)}if((V||Y)&&(L.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:y.width,L.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?Z:y.height,y.width=L.width,y.height=L.height),S&&h.expandParent){const ne=F[0]*(L.width??0);L.x&&L.x<ne&&(y.x=ne,_.x=_.x-(L.x-ne));const te=F[1]*(L.height??0);L.y&&L.y<te&&(y.y=te,_.y=_.y-(L.y-te))}const q=jf({width:y.width,prevWidth:H,height:y.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...y,direction:q};w?.(M,G)!==!1&&(z=!0,p?.(M,G),o(L,$))}).on("end",M=>{z&&(m?.(M,{...y}),r?.({...y}),z=!1)});i.call(O)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var zn={exports:{}},An={},$n={exports:{}},Pn={};var ir;function Ff(){if(ir)return Pn;ir=1;var e=Tr();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,f){var g=f(),p=o({inst:{value:g,getSnapshot:f}}),m=p[0].inst,w=p[1];return i(function(){m.value=g,m.getSnapshot=f,l(m)&&w({inst:m})},[d,g,f]),r(function(){return l(m)&&w({inst:m}),d(function(){l(m)&&w({inst:m})})},[d]),s(g),g}function l(d){var f=d.getSnapshot;d=d.value;try{var g=f();return!n(d,g)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Pn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Pn}var sr;function Xf(){return sr||(sr=1,$n.exports=Ff()),$n.exports}var ar;function Yf(){if(ar)return An;ar=1;var e=Tr(),t=Xf();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return An.useSyncExternalStoreWithSelector=function(c,u,d,f,g){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(S){if(!_){if(_=!0,h=S,S=f(S),g!==void 0&&m.hasValue){var E=m.value;if(g(E,S))return v=E}return v=S}if(E=v,o(h,S))return E;var k=f(S);return g!==void 0&&g(E,k)?(h=S,E):(h=S,v=k)}var _=!1,h,v,C=d===void 0?null:d;return[function(){return y(u())},C===null?void 0:function(){return y(C())}]},[u,d,f,g]);var w=r(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=w},[w]),l(w),w},An}var cr;function Wf(){return cr||(cr=1,zn.exports=Yf()),zn.exports}var Zf=Wf();const qf=za(Zf),Gf={},lr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Gf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},Uf=e=>e?lr(e):lr,{useDebugValue:Kf}=Aa,{useSyncExternalStoreWithSelector:Qf}=qf,Jf=e=>e;function Fi(e,t=Jf,n){const o=Qf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Kf(o),o}const ur=(e,t)=>{const n=Uf(e),o=(r,i=t)=>Fi(n,r,i);return Object.assign(o,n),o},eh=(e,t)=>e?ur(e,t):ur;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const gn=D.createContext(null),th=gn.Provider,Xi=be.error001();function J(e,t){const n=D.useContext(gn);if(n===null)throw new Error(Xi);return Fi(n,e,t)}function re(){const e=D.useContext(gn);if(e===null)throw new Error(Xi);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dr={display:"none"},nh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Yi="react-flow__node-desc",Wi="react-flow__edge-desc",oh="react-flow__aria-live",rh=e=>e.ariaLiveMessage,ih=e=>e.ariaLabelConfig;function sh({rfId:e}){const t=J(rh);return x.jsx("div",{id:`${oh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nh,children:t})}function ah({rfId:e,disableKeyboardA11y:t}){const n=J(ih);return x.jsxs(x.Fragment,{children:[x.jsx("div",{id:`${Yi}-${e}`,style:dr,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),x.jsx("div",{id:`${Wi}-${e}`,style:dr,children:n["edge.a11yDescription.default"]}),!t&&x.jsx(sh,{rfId:e})]})}const pn=D.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return x.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});pn.displayName="Panel";function ch({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:x.jsx(pn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:x.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const lh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Rt=e=>e.id;function uh(e,t){return oe(e.selectedNodes.map(Rt),t.selectedNodes.map(Rt))&&oe(e.selectedEdges.map(Rt),t.selectedEdges.map(Rt))}function dh({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(lh,uh);return D.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const fh=e=>!!e.onSelectionChangeHandlers;function hh({onSelectionChange:e}){const t=J(fh);return e||t?x.jsx(dh,{onSelectionChange:e}):null}const Zi=[0,0],gh={x:0,y:0,zoom:1},ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],fr=[...ph,"rfId"],mh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hr={translateExtent:vt,nodeOrigin:Zi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yh(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(mh,oe),c=re();D.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=hr,a()}),[]);const u=D.useRef(hr);return D.useEffect(()=>{for(const d of fr){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:Jd(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},fr.map(d=>e[d])),null}function gr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function xh(e){const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=gr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:gr()?.matches?"dark":"light"}const pr=typeof document<"u"?document:null;function Et(e=null,t={target:pr,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
Binary file
|
|
Binary file
|