@decocms/mesh 2.32.0 → 2.33.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/dist/README.md +1 -0
- package/dist/client/assets/{AlertCircle-BC5XMJnh.js → AlertCircle-BUJ8IT58.js} +1 -1
- package/dist/client/assets/{ArrowLeft-YLXxN85l.js → ArrowLeft-Cgf-RjME.js} +1 -1
- package/dist/client/assets/{ArrowUp-B5D5I-e4.js → ArrowUp-6Vw9g-kK.js} +1 -1
- package/dist/client/assets/{Check-BJ8aD04h.js → Check-CSwEsqta.js} +1 -1
- package/dist/client/assets/{ChevronDown-Dwu65bm7.js → ChevronDown-DFQ7Wwuf.js} +1 -1
- package/dist/client/assets/{Code01-D5im63O6.js → Code01-BO10Af7Z.js} +1 -1
- package/dist/client/assets/{Copy01-CzCGcpFB.js → Copy01-D3IzDjkZ.js} +1 -1
- package/dist/client/assets/{CpuChip02-DL5MAhty.js → CpuChip02-BhwN5rbm.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-B8KoSTcW.js → DotsHorizontal-BDXVd4Qq.js} +1 -1
- package/dist/client/assets/{DotsVertical-Q4BfP_OZ.js → DotsVertical-D9Rul5KS.js} +1 -1
- package/dist/client/assets/{Download01-DdEO2Y20.js → Download01-BeKBUqUu.js} +1 -1
- package/dist/client/assets/{Edit01-BeUmNzHw.js → Edit01-lX0maYnd.js} +1 -1
- package/dist/client/assets/{File06-Dbh0s9nF.js → File06-BUqTeSo9.js} +1 -1
- package/dist/client/assets/{FilterLines-DOm0e2np.js → FilterLines-9uzI1ZUk.js} +1 -1
- package/dist/client/assets/{FlipBackward-B0YDj6U2.js → FlipBackward-CKjrTjy2.js} +1 -1
- package/dist/client/assets/{GitBranch01-7JSGEKWK.js → GitBranch01-DwH1AkJQ.js} +1 -1
- package/dist/client/assets/{Grid01-CxjwpfJx.js → Grid01-B6p7u4lV.js} +1 -1
- package/dist/client/assets/{Home02-Mi1g3zml.js → Home02-BghpVzd2.js} +1 -1
- package/dist/client/assets/{Image01-k29lIkxT.js → Image01-UhJxiWhu.js} +1 -1
- package/dist/client/assets/{Inbox01-C3SZugQ0.js → Inbox01-D2KzPm9_.js} +1 -1
- package/dist/client/assets/{InfoCircle-BpN5-782.js → InfoCircle-476KnZLd.js} +1 -1
- package/dist/client/assets/{Key01-CfBi5Z2i.js → Key01-iLYu5J4i.js} +1 -1
- package/dist/client/assets/{LinkExternal01-D9T5dDpq.js → LinkExternal01-hRmOt3fQ.js} +1 -1
- package/dist/client/assets/{List-BH4t2L38.js → List-BNtbfVCR.js} +1 -1
- package/dist/client/assets/{Loading01-Dk8ucN4u.js → Loading01-Bm4yV2Kc.js} +1 -1
- package/dist/client/assets/{Lock01-C_cIWOtW.js → Lock01-DW5Dv4uq.js} +1 -1
- package/dist/client/assets/{Play-CQprIR-2.js → Play-Bb62L2ZA.js} +1 -1
- package/dist/client/assets/{Plus-DsxxHM8H.js → Plus-DXX1AA4n.js} +1 -1
- package/dist/client/assets/{SearchMd-COziLDJJ.js → SearchMd-BHAg8E82.js} +1 -1
- package/dist/client/assets/{Terminal-onO5xBIt.js → Terminal-j-v4faZp.js} +1 -1
- package/dist/client/assets/{Trash01-Dz97bbYc.js → Trash01-CdrSpG7k.js} +1 -1
- package/dist/client/assets/{Upload01-BX6LCIgm.js → Upload01-BIrdmP3b.js} +1 -1
- package/dist/client/assets/{X-IKzqhWHn.js → X-B3J65QND.js} +1 -1
- package/dist/client/assets/{XClose-v1hlIgz0.js → XClose-IcohyJgY.js} +1 -1
- package/dist/client/assets/{agent-detail-DJ7sCPlX.js → agent-detail-CYjCyd9d.js} +1 -1
- package/dist/client/assets/{agents-B2w5ERo_.js → agents-CxMTqONq.js} +1 -1
- package/dist/client/assets/{alert-dialog-DrQP8AK1.js → alert-dialog-DS_IdQX7.js} +1 -1
- package/dist/client/assets/{auth-catchall-CMrAfdfW.js → auth-catchall-UglB1DuM.js} +1 -1
- package/dist/client/assets/{avatar-BJReLfGX.js → avatar-D8MYCeCO.js} +1 -1
- package/dist/client/assets/{badge-DbdCj_uM.js → badge-CKkYvVPh.js} +1 -1
- package/dist/client/assets/{binder-D69FJEqF.js → binder-DmV70Mg6.js} +1 -1
- package/dist/client/assets/{button-PodD5p0U.js → button-CX9BcGIk.js} +1 -1
- package/dist/client/assets/{card-D-ovGS63.js → card-BDtQbN4Z.js} +1 -1
- package/dist/client/assets/{checkbox-6AvRm83v.js → checkbox-DyCTDo5B.js} +1 -1
- package/dist/client/assets/{collection-detail-CQJDYkNb.js → collection-detail-BzGnhxXG.js} +1 -1
- package/dist/client/assets/{collection-display-button-Dh09Ilcf.js → collection-display-button-BqEBXGbV.js} +1 -1
- package/dist/client/assets/{collection-header-BmH5wfr6.js → collection-header-DdM-1rXZ.js} +1 -1
- package/dist/client/assets/{collection-page-DQfIdy6i.js → collection-page-Bhf_fPlN.js} +1 -1
- package/dist/client/assets/{collection-search-4ynn1TPY.js → collection-search-D2zepp45.js} +1 -1
- package/dist/client/assets/{collection-tab--D0SMzDr.js → collection-tab-Dx4a2de4.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DNSd3m2k.js → collection-table-wrapper-BRx1U1h_.js} +1 -1
- package/dist/client/assets/{connection-card-DnSsvBT0.js → connection-card-7axd0v5e.js} +1 -1
- package/dist/client/assets/{connection-detail-DHFifhwE.js → connection-detail-DiXv5jt2.js} +1 -1
- package/dist/client/assets/{connections-B9O8nDt9.js → connections-CmqWCHTI.js} +1 -1
- package/dist/client/assets/constants-B4VvhBhE.js +1 -0
- package/dist/client/assets/{constants-CmWKkXWd.js → constants-DZTKSPb5.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CEW5VGHH.js → create-organization-dialog-WqVFUH5x.js} +1 -1
- package/dist/client/assets/{dialog-CWaQrwji.js → dialog-CtieLp9D.js} +1 -1
- package/dist/client/assets/{dropdown-menu-D9Rmpcp9.js → dropdown-menu-BOgD5B6g.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CBpne9DX.js → dynamic-plugin-layout-Cir7_703.js} +1 -1
- package/dist/client/assets/{empty-state-DqNObyCj.js → empty-state-DUPw1fh0.js} +1 -1
- package/dist/client/assets/{empty-state-B-Xm_EaJ.js → empty-state-K3SjQCVt.js} +1 -1
- package/dist/client/assets/{env-vars-editor-CfgmDeU5.js → env-vars-editor-DgBscrAL.js} +1 -1
- package/dist/client/assets/{error-boundary-BjOv2UWq.js → error-boundary-DDz4G03r.js} +1 -1
- package/dist/client/assets/{extract-connection-data-0XBBnZdV.js → extract-connection-data-5AHzxrfF.js} +1 -1
- package/dist/client/assets/{file-browser-B9wkG-Sl.js → file-browser-oT6ix4zp.js} +2 -2
- package/dist/client/assets/{form-vSEoY8gy.js → form-lMcrl-dM.js} +1 -1
- package/dist/client/assets/{grid-view-DFrm-jAH.js → grid-view-CpwRqIn-.js} +1 -1
- package/dist/client/assets/{home-bVBdjE9M.js → home-B7Dgc3GO.js} +1 -1
- package/dist/client/assets/index-B0qsrDFa.css +1 -0
- package/dist/client/assets/{index-964bfDMw.js → index-B9g3IU58.js} +2 -2
- package/dist/client/assets/{index-EWMtHb8y.js → index-BC_LUGnz.js} +1 -1
- package/dist/client/assets/{index-B_Tj7K9k.js → index-CtjqtW4J.js} +1 -1
- package/dist/client/assets/{index-wKTAGmPb.js → index-DRDMCJOo.js} +1 -1
- package/dist/client/assets/{index-Cmw-k2HD.js → index-P3kNP-Ue.js} +1 -1
- package/dist/client/assets/{index-DuRBn85W.js → index-lzARP5Pm.js} +73 -73
- package/dist/client/assets/{infiniteQueryObserver-KoZoIabU.js → infiniteQueryObserver-CKJG_0Nf.js} +1 -1
- package/dist/client/assets/{input-Ej7Hdv-8.js → input-D7AeKLG6.js} +1 -1
- package/dist/client/assets/{layout-CXY5gq_4.js → layout-CXeFBy5y.js} +1 -1
- package/dist/client/assets/{localstorage-keys-D1mHOPHm.js → localstorage-keys-D1ttI_kB.js} +1 -1
- package/dist/client/assets/{login--5WB-nLi.js → login-aHF5mxsS.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BD4MGpFX.js → mcp-oauth-DEkeQYdq.js} +1 -1
- package/dist/client/assets/{mcp-server-card-DS0l3oak.js → mcp-server-card-B8_ilRqj.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-CJwkhfLJ.js → mcp-server-detail-2KEeU4st.js} +2 -2
- package/dist/client/assets/{members-BJW4tDMu.js → members-0oxL59m2.js} +1 -1
- package/dist/client/assets/{monaco-editor-3Me4XJ9I.js → monaco-editor-D26cmj67.js} +1 -1
- package/dist/client/assets/{monitoring-CR4-lnND.js → monitoring-BguR26SJ.js} +1 -1
- package/dist/client/assets/{oauth-callback-B8Ags9WE.js → oauth-callback-CoFJFyY2.js} +1 -1
- package/dist/client/assets/{page-CCwujlJd.js → page-BjhbwMHp.js} +1 -1
- package/dist/client/assets/{page-CN8DT11b.js → page-CRtItJfu.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-CYXcrmnE.js → pin-to-sidebar-button-C6dzy2Sp.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DJU_t0en.js → plugin-empty-state-DC-Bc-Hq.js} +1 -1
- package/dist/client/assets/{plugin-header-DXCUdn_T.js → plugin-header-ChOrvFfE.js} +1 -1
- package/dist/client/assets/{plugins-Bl59udAj.js → plugins-BgTbwOTC.js} +1 -1
- package/dist/client/assets/{popover-DBItUBYK.js → popover-D5eKc-lR.js} +1 -1
- package/dist/client/assets/{registry-utils-CPkD9bdu.js → registry-utils-ButNyWVv.js} +1 -1
- package/dist/client/assets/{resizable-ZQy6ZhoG.js → resizable-DXIy41ZI.js} +1 -1
- package/dist/client/assets/{resource-tabs-eTZinrmK.js → resource-tabs-D9U7wwIj.js} +1 -1
- package/dist/client/assets/{select-AaQnf6IX.js → select-DypP_ctF.js} +1 -1
- package/dist/client/assets/{settings-7r0XCBIy.js → settings-mRHoZXOZ.js} +1 -1
- package/dist/client/assets/{shell-layout-Bi9hmLN-.js → shell-layout-DOTt2kmG.js} +1 -1
- package/dist/client/assets/{spinner-C--oN2eV.js → spinner-y-sEdyFB.js} +1 -1
- package/dist/client/assets/{switch-uzDLGnXk.js → switch-SVkH95AH.js} +1 -1
- package/dist/client/assets/{textarea-E7VOwyYz.js → textarea-bmWEiN7l.js} +1 -1
- package/dist/client/assets/{tool-set-selector-CQhszaVY.js → tool-set-selector-DhQ3jxep.js} +1 -1
- package/dist/client/assets/{tools-list-BK4C4awn.js → tools-list-Ds7Jsail.js} +1 -1
- package/dist/client/assets/{tooltip-Bdoc9quu.js → tooltip-BQbbKnxv.js} +1 -1
- package/dist/client/assets/{typewriter-title-BlMj2uGN.js → typewriter-title-BiqUerVd.js} +1 -1
- package/dist/client/assets/{use-binding-DhM8knFB.js → use-binding-C219fPLm.js} +1 -1
- package/dist/client/assets/{use-collections-xUu5CPtF.js → use-collections-CvkTm_6U.js} +1 -1
- package/dist/client/assets/{use-connection-Bqsa8RaS.js → use-connection-D8u2E4QD.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CdxRkVjT.js → use-create-virtual-mcp-hwvm94Q5.js} +1 -1
- package/dist/client/assets/{use-list-state-BmjPeRyR.js → use-list-state-B9azqHgQ.js} +1 -1
- package/dist/client/assets/{use-members-B5HINX4i.js → use-members-BfTFBzTl.js} +1 -1
- package/dist/client/assets/{use-mobile-CH4OC_dx.js → use-mobile-RHn4NyjN.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BOpggtjG.js → use-organization-settings-AWdRXyNF.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-mbM9JS_c.js → use-virtual-mcp-D17yOOVF.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-system-prompt-BlXwuykx.js → use-virtual-mcp-system-prompt-CC3fRmBB.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-xJm-Bx7q.js +1 -0
- package/dist/client/assets/{useMutation-BABUvOV4.js → useMutation-ByLbENlF.js} +1 -1
- package/dist/client/assets/useQuery-DoX2gsGK.js +1 -0
- package/dist/client/assets/{value-D8ri8g3W.js → value-Bupbegsn.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C-30gO9H.js → view-mode-toggle-DgsbED3E.js} +1 -1
- package/dist/client/assets/{virtual-mcp-zquQbLgI.js → virtual-mcp-Mmz1T7Sl.js} +1 -1
- package/dist/client/assets/{workflow-Dka00GsI.js → workflow-BnYCXhHP.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-B4USxFBv.js +0 -1
- package/dist/client/assets/index-D86tzVve.css +0 -1
- package/dist/client/assets/useInfiniteQuery-Dmu_NRFV.js +0 -1
- package/dist/client/assets/useQuery-B2QbSzDL.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bz as Rs,br as js,r as $,j as _,c as ue,e as _n,d as Vs}from"./index-964bfDMw.js";import{C as se,a as Os,b as Bs}from"./index-DuRBn85W.js";import{t as Wo,T as Fs}from"./typewriter-title-BlMj2uGN.js";import{E as qo}from"./error-boundary-BjOv2UWq.js";import{u as Xs}from"./localstorage-keys-D1mHOPHm.js";import{u as bn}from"./virtual-mcp-zquQbLgI.js";import{c as Go,B as Ko}from"./button-PodD5p0U.js";import{V as Ys}from"./view-mode-toggle-C-30gO9H.js";import{i as Zs}from"./GitBranch01-7JSGEKWK.js";import{s as Ws}from"./Plus-DsxxHM8H.js";import{I as Uo,n as qs}from"./empty-state-B-Xm_EaJ.js";import{i as Gs}from"./CpuChip02-DL5MAhty.js";import{e as Ks}from"./use-collections-xUu5CPtF.js";import{a as Us}from"./use-connection-Bqsa8RaS.js";import{W as Qs,u as Js}from"./constants-CmWKkXWd.js";import{u as ea}from"./use-virtual-mcp-mbM9JS_c.js";import{i as ke,c as Gn,a as Kn,b as ta,d as Jt,T as en,e as na}from"./value-D8ri8g3W.js";import"./X-IKzqhWHn.js";import"./use-binding-DhM8knFB.js";import"./binder-D69FJEqF.js";import"./monaco-editor-3Me4XJ9I.js";import"./infiniteQueryObserver-KoZoIabU.js";import"./spinner-C--oN2eV.js";import"./use-virtual-mcp-system-prompt-BlXwuykx.js";import"./input-Ej7Hdv-8.js";import"./popover-DBItUBYK.js";import"./select-AaQnf6IX.js";import"./tooltip-Bdoc9quu.js";import"./Check-BJ8aD04h.js";import"./ChevronDown-Dwu65bm7.js";import"./File06-Dbh0s9nF.js";import"./Grid01-CxjwpfJx.js";import"./Image01-k29lIkxT.js";import"./SearchMd-COziLDJJ.js";import"./index-Cmw-k2HD.js";import"./useQuery-B2QbSzDL.js";import"./dialog-CWaQrwji.js";import"./form-vSEoY8gy.js";import"./AlertCircle-BC5XMJnh.js";import"./ArrowUp-B5D5I-e4.js";import"./Edit01-BeUmNzHw.js";import"./Copy01-CzCGcpFB.js";import"./Terminal-onO5xBIt.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-Dz97bbYc.js";import"./use-create-virtual-mcp-CdxRkVjT.js";import"./useMutation-BABUvOV4.js";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 oa={value:()=>{}};function Rt(){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 St(n)}function St(e){this._=e}function ra(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}})}St.prototype=Rt.prototype={constructor:St,on:function(e,t){var n=this._,o=ra(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ia(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]=Un(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Un(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 St(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 ia(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Un(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=oa,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 Qn={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 jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qn.hasOwnProperty(t)?{space:Qn[t],local:e}:e}function sa(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 aa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qo(e){var t=jt(e);return(t.local?aa:sa)(t)}function ca(){}function En(e){return e==null?ca:function(){return this.querySelector(e)}}function la(e){typeof e!="function"&&(e=En(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,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new le(o,this._parents)}function ua(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function da(){return[]}function Jo(e){return e==null?da:function(){return this.querySelectorAll(e)}}function fa(e){return function(){return ua(e.apply(this,arguments))}}function ha(e){typeof e=="function"?e=fa(e):e=Jo(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 le(o,r)}function er(e){return function(){return this.matches(e)}}function tr(e){return function(t){return t.matches(e)}}var ga=Array.prototype.find;function pa(e){return function(){return ga.call(this.children,e)}}function ma(){return this.firstElementChild}function ya(e){return this.select(e==null?ma:pa(typeof e=="function"?e:tr(e)))}var xa=Array.prototype.filter;function wa(){return Array.from(this.children)}function va(e){return function(){return xa.call(this.children,e)}}function _a(e){return this.selectAll(e==null?wa:va(typeof e=="function"?e:tr(e)))}function ba(e){typeof e!="function"&&(e=er(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 le(o,this._parents)}function nr(e){return new Array(e.length)}function Ea(){return new le(this._enter||this._groups.map(nr),this._parents)}function kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}kt.prototype={constructor:kt,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 Sa(e){return function(){return e}}function Na(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 kt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Ca(e,t,n,o,r,i,s){var a,l,c=new Map,d=t.length,u=i.length,f=new Array(d),g;for(a=0;a<d;++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<u;++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 kt(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Ma(e){return e.__data__}function Ia(e,t){if(!arguments.length)return Array.from(this,Ma);var n=t?Ca:Na,o=this._parents,r=this._groups;typeof e!="function"&&(e=Sa(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,g=ka(e.call(d,d&&d.__data__,c,o)),p=g.length,w=a[c]=new Array(p),v=s[c]=new Array(p),m=l[c]=new Array(f);n(d,u,w,v,m,g,t);for(var b=0,h=0,y,S;b<p;++b)if(y=w[b]){for(b>=h&&(h=b+1);!(S=v[h])&&++h<p;);y._next=S||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function ka(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Pa(){return new le(this._exit||this._groups.map(nr),this._parents)}function Aa(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 Ta(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],d=o[l],u=c.length,f=a[l]=new Array(u),g,p=0;p<u;++p)(g=c[p]||d[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Da(){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 za(e){e||(e=$a);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!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,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new le(r,this._parents).order()}function $a(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ha(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function La(){return Array.from(this)}function Ra(){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 ja(){let e=0;for(const t of this)++e;return e}function Va(){return!this.node()}function Oa(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 Ba(e){return function(){this.removeAttribute(e)}}function Fa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xa(e,t){return function(){this.setAttribute(e,t)}}function Ya(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Za(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Wa(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 qa(e,t){var n=jt(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?Fa:Ba:typeof t=="function"?n.local?Wa:Za:n.local?Ya:Xa)(n,t))}function or(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ga(e){return function(){this.style.removeProperty(e)}}function Ka(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ua(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Qa(e,t,n){return arguments.length>1?this.each((t==null?Ga:typeof t=="function"?Ua:Ka)(e,t,n??"")):Ve(this.node(),e)}function Ve(e,t){return e.style.getPropertyValue(t)||or(e).getComputedStyle(e,null).getPropertyValue(t)}function Ja(e){return function(){delete this[e]}}function ec(e,t){return function(){this[e]=t}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nc(e,t){return arguments.length>1?this.each((t==null?Ja:typeof t=="function"?tc:ec)(e,t)):this.node()[e]}function rr(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ir(e)}function ir(e){this._node=e,this._names=rr(e.getAttribute("class")||"")}ir.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 sr(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ar(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function oc(e){return function(){sr(this,e)}}function rc(e){return function(){ar(this,e)}}function ic(e,t){return function(){(t.apply(this,arguments)?sr:ar)(this,e)}}function sc(e,t){var n=rr(e+"");if(arguments.length<2){for(var o=Sn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?ic:t?oc:rc)(n,t))}function ac(){this.textContent=""}function cc(e){return function(){this.textContent=e}}function lc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function uc(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?lc:cc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function fc(e){return function(){this.innerHTML=e}}function hc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gc(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?hc:fc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function mc(){return this.each(pc)}function yc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xc(){return this.each(yc)}function wc(e){var t=typeof e=="function"?e:Qo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vc(){return null}function _c(e,t){var n=typeof e=="function"?e:Qo(e),o=t==null?vc:typeof t=="function"?t:En(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function bc(){var e=this.parentNode;e&&e.removeChild(this)}function Ec(){return this.each(bc)}function Sc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cc(e){return this.select(e?Nc:Sc)}function Mc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ic(e){return function(t){e.call(this,t,this.__data__)}}function kc(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 Pc(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 Ac(e,t,n){return function(){var o=this.__on,r,i=Ic(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 Tc(e,t,n){var o=kc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Ac:Pc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function cr(e,t,n){var o=or(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 Dc(e,t){return function(){return cr(this,e,t)}}function zc(e,t){return function(){return cr(this,e,t.apply(this,arguments))}}function $c(e,t){return this.each((typeof t=="function"?zc:Dc)(e,t))}function*Hc(){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 lr=[null];function le(e,t){this._groups=e,this._parents=t}function ut(){return new le([[document.documentElement]],lr)}function Lc(){return this}le.prototype=ut.prototype={constructor:le,select:la,selectAll:ha,selectChild:ya,selectChildren:_a,filter:ba,data:Ia,enter:Ea,exit:Pa,join:Aa,merge:Ta,selection:Lc,order:Da,sort:za,call:Ha,nodes:La,node:Ra,size:ja,empty:Va,each:Oa,attr:qa,style:Qa,property:nc,classed:sc,text:uc,html:gc,raise:mc,lower:xc,append:wc,insert:_c,remove:Ec,clone:Cc,datum:Mc,on:Tc,dispatch:$c,[Symbol.iterator]:Hc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],lr)}function Rc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Rc(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 jc={passive:!1},ot={capture:!0,passive:!1};function tn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function ur(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",je,ot);"onselectstart"in t?n.on("selectstart.drag",je,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,ot),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 mt=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){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:d}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Vc(e){return!e.ctrlKey&&!e.button}function Oc(){return this.parentNode}function Bc(e,t){return t??{x:e.x,y:e.y}}function Fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var e=Vc,t=Oc,n=Bc,o=Fc,r={},i=Rt("start","drag","end"),s=0,a,l,c,d,u=0;function f(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,jc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,S){if(!(d||!e.call(this,y,S))){var E=h(this,t.call(this,y,S),y,S,"mouse");E&&(ce(y.view).on("mousemove.drag",p,ot).on("mouseup.drag",w,ot),ur(y.view),tn(y),c=!1,a=y.clientX,l=y.clientY,E("start",y))}}function p(y){if(je(y),!c){var S=y.clientX-a,E=y.clientY-l;c=S*S+E*E>u}r.mouse("drag",y)}function w(y){ce(y.view).on("mousemove.drag mouseup.drag",null),dr(y.view,c),je(y),r.mouse("end",y)}function v(y,S){if(e.call(this,y,S)){var E=y.changedTouches,C=t.call(this,y,S),T=E.length,A,j;for(A=0;A<T;++A)(j=h(this,C,y,S,E[A].identifier,E[A]))&&(tn(y),j("start",y,E[A]))}}function m(y){var S=y.changedTouches,E=S.length,C,T;for(C=0;C<E;++C)(T=r[S[C].identifier])&&(je(y),T("drag",y,S[C]))}function b(y){var S=y.changedTouches,E=S.length,C,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<E;++C)(T=r[S[C].identifier])&&(tn(y),T("end",y,S[C]))}function h(y,S,E,C,T,A){var j=i.copy(),M=de(A||E,S),z,H,x;if((x=n.call(y,new un("beforestart",{sourceEvent:E,target:f,identifier:T,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:j}),C))!=null)return z=x.x-M[0]||0,H=x.y-M[1]||0,function I(N,P,k){var D=M,L;switch(N){case"start":r[T]=I,L=s++;break;case"end":delete r[T],--s;case"drag":M=de(k||P,S),L=s;break}j.call(N,y,new un(N,{sourceEvent:P,subject:x,target:f,identifier:T,active:L,x:M[0]+z,y:M[1]+H,dx:M[0]-D[0],dy:M[1]-D[1],dispatch:j}),C)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:mt(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:mt(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:mt(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:mt(!!y),f):o},f.on=function(){var y=i.on.apply(i,arguments);return y===i?f:y},f.clickDistance=function(y){return arguments.length?(u=(y=+y)*y,f):Math.sqrt(u)},f}var Jn=180/Math.PI,dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hr(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)*Jn,skewX:Math.atan(l)*Jn,scaleX:s,scaleY:a}}var yt;function Xc(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dn:hr(t.a,t.b,t.c,t.d,t.e,t.f)}function Yc(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?dn:(e=e.matrix,hr(e.a,e.b,e.c,e.d,e.e,e.f))}function gr(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push("translate(",null,t,null,n);p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u||f)&&g.push("translate("+u+t+f+n)}function s(c,d,u,f){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ke(c,d)})):d&&u.push(r(u)+"rotate("+d+o)}function a(c,d,u,f){c!==d?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ke(c,d)}):d&&u.push(r(u)+"skewX("+d+o)}function l(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push(r(g)+"scale(",null,",",null,")");p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u!==1||f!==1)&&g.push(r(g)+"scale("+u+","+f+")")}return function(c,d){var u=[],f=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,f),s(c.rotate,d.rotate,u,f),a(c.skewX,d.skewX,u,f),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,f),c=d=null,function(g){for(var p=-1,w=f.length,v;++p<w;)u[(v=f[p]).i]=v.x(g);return u.join("")}}}var Zc=gr(Xc,"px, ","px)","deg)"),Wc=gr(Yc,", ",")",")"),qc=1e-12;function eo(e){return((e=Math.exp(e))+1/e)/2}function Gc(e){return((e=Math.exp(e))-1/e)/2}function Kc(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],d=s[0],u=s[1],f=s[2],g=d-a,p=u-l,w=g*g+p*p,v,m;if(w<qc)m=Math.log(f/c)/t,v=function(C){return[a+C*g,l+C*p,c*Math.exp(t*C*m)]};else{var b=Math.sqrt(w),h=(f*f-c*c+o*w)/(2*c*n*b),y=(f*f-c*c-o*w)/(2*f*n*b),S=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(y*y+1)-y);m=(E-S)/t,v=function(C){var T=C*m,A=eo(S),j=c/(n*b)*(A*Kc(t*T+S)-Gc(S));return[a+j*g,l+j*p,c*A/eo(t*T+S)]}}return v.duration=m*1e3*t/Math.SQRT2,v}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 Oe=0,Je=0,Ue=0,pr=1e3,Pt,et,At=0,Te=0,Vt=0,rt=typeof performance=="object"&&performance.now?performance:Date,mr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nn(){return Te||(mr(Uc),Te=rt.now()+Vt)}function Uc(){Te=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=yr.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:Pt=this,et=this),this._call=e,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function yr(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function Qc(){Nn(),++Oe;for(var e=Pt,t;e;)(t=Te-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oe}function to(){Te=(At=rt.now())+Vt,Oe=Je=0;try{Qc()}finally{Oe=0,el(),Te=0}}function Jc(){var e=rt.now(),t=e-At;t>pr&&(Vt-=t,At=e)}function el(){for(var e,t=Pt,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:Pt=n);et=e,fn(o)}function fn(e){if(!Oe){Je&&(Je=clearTimeout(Je));var t=e-Te;t>24?(e<1/0&&(Je=setTimeout(to,e-rt.now()-Vt)),Ue&&(Ue=clearInterval(Ue))):(Ue||(At=rt.now(),Ue=setInterval(Jc,pr)),Oe=1,mr(to))}}function no(e,t,n){var o=new Tt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var tl=Rt("start","end","cancel","interrupt"),nl=[],xr=0,oo=1,hn=2,Ct=3,ro=4,gn=5,Mt=6;function Ot(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ol(e,n,{name:t,index:o,group:r,on:tl,tween:nl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xr})}function Cn(e,t){var n=ge(e,t);if(n.state>xr)throw new Error("too late; already scheduled");return n}function me(e,t){var n=ge(e,t);if(n.state>Ct)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ol(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=yr(i,0,n.time);function i(c){n.state=oo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var d,u,f,g;if(n.state!==oo)return l();for(d in o)if(g=o[d],g.name===n.name){if(g.state===Ct)return no(s);g.state===ro?(g.state=Mt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[d]):+d<t&&(g.state=Mt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[d])}if(no(function(){n.state===Ct&&(n.state=ro,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=hn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===hn){for(n.state=Ct,r=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=g);r.length=u+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=gn,1),u=-1,f=r.length;++u<f;)r[u].call(e,d);n.state===gn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Mt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function It(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>hn&&o.state<gn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function rl(e){return this.each(function(){It(this,e)})}function il(e,t){var n,o;return function(){var r=me(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 sl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=me(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 al(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(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?il:sl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=me(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function wr(e,t){var n;return(typeof t=="number"?ke:t instanceof Gn?Kn:(n=Gn(t))?(t=n,Kn):ta)(e,t)}function cl(e){return function(){this.removeAttribute(e)}}function ll(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ul(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 dl(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 fl(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 hl(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 gl(e,t){var n=jt(e),o=n==="transform"?Wc:wr;return this.attrTween(e,typeof t=="function"?(n.local?hl:fl)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?ll:cl)(n):(n.local?dl:ul)(n,o,t))}function pl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ml(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function yl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ml(e,i)),n}return r._value=t,r}function xl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pl(e,i)),n}return r._value=t,r}function wl(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=jt(e);return this.tween(n,(o.local?yl:xl)(o,t))}function vl(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function _l(e,t){return t=+t,function(){Cn(this,e).delay=t}}function bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vl:_l)(t,e)):ge(this.node(),t).delay}function El(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function Sl(e,t){return t=+t,function(){me(this,e).duration=t}}function Nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?El:Sl)(t,e)):ge(this.node(),t).duration}function Cl(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function Ml(e){var t=this._id;return arguments.length?this.each(Cl(t,e)):ge(this.node(),t).ease}function Il(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function kl(e){if(typeof e!="function")throw new Error;return this.each(Il(this._id,e))}function Pl(e){typeof e!="function"&&(e=er(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 ve(o,this._parents,this._name,this._id)}function Al(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],d=l.length,u=s[a]=new Array(d),f,g=0;g<d;++g)(f=l[g]||c[g])&&(u[g]=f);for(;a<o;++a)s[a]=t[a];return new ve(s,this._parents,this._name,this._id)}function Tl(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 Dl(e,t,n){var o,r,i=Tl(t)?Cn:me;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function zl(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Dl(n,e,t))}function $l(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Hl(){return this.on("end.remove",$l(this._id))}function Ll(e){var t=this._name,n=this._id;typeof e!="function"&&(e=En(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),d,u,f=0;f<l;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),c[f]=u,Ot(c[f],t,n,f,c,ge(d,n)));return new ve(i,this._parents,t,n)}function Rl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jo(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var f=e.call(d,d.__data__,u,l),g,p=ge(d,n),w=0,v=f.length;w<v;++w)(g=f[w])&&Ot(g,t,n,w,f,p);i.push(f),s.push(d)}return new ve(i,s,t,n)}var jl=ut.prototype.constructor;function Vl(){return new jl(this._groups,this._parents)}function Ol(e,t){var n,o,r;return function(){var i=Ve(this,e),s=(this.style.removeProperty(e),Ve(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function vr(e){return function(){this.style.removeProperty(e)}}function Bl(e,t,n){var o,r=n+"",i;return function(){var s=Ve(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fl(e,t,n){var o,r,i;return function(){var s=Ve(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ve(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Xl(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=me(this,e),c=l.on,d=l.value[i]==null?a||(a=vr(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(s,r=d),l.on=o}}function Yl(e,t,n){var o=(e+="")=="transform"?Zc:wr;return t==null?this.styleTween(e,Ol(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,Fl(e,o,Mn(this,"style."+e,t))).each(Xl(this._id,e)):this.styleTween(e,Bl(e,o,t),n).on("end.style."+e,null)}function Zl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wl(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Zl(e,s,n)),o}return i._value=t,i}function ql(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,Wl(e,t,n??""))}function Gl(e){return function(){this.textContent=e}}function Kl(e){return function(){var t=e(this);this.textContent=t??""}}function Ul(e){return this.tween("text",typeof e=="function"?Kl(Mn(this,"text",e)):Gl(e==null?"":e+""))}function Ql(e){return function(t){this.textContent=e.call(this,t)}}function Jl(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Ql(r)),t}return o._value=e,o}function eu(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,Jl(e))}function tu(){for(var e=this._name,t=this._id,n=_r(),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 d=ge(l,t);Ot(l,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ve(o,this._parents,e,n)}function nu(){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=me(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var ou=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++ou}var xe=ut.prototype;ve.prototype={constructor:ve,select:Ll,selectAll:Rl,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Pl,merge:Al,selection:Vl,transition:tu,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:zl,attr:gl,attrTween:wl,style:Yl,styleTween:ql,text:Ul,textTween:eu,remove:Hl,tween:al,delay:bl,duration:Nl,ease:Ml,easeVarying:kl,end:nu,[Symbol.iterator]:xe[Symbol.iterator]};function ru(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var iu={time:null,delay:0,duration:250,ease:ru};function su(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 au(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=_r(),(n=iu).time=Nn(),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])&&Ot(l,e,t,c,s,n||su(l,t));return new ve(o,this._parents,e,t)}ut.prototype.interrupt=rl;ut.prototype.transition=au;const xt=e=>()=>e;function cu(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 we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Bt=new we(1,0,0);br.prototype=we.prototype;function br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bt;return e.__zoom}function nn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function lu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function uu(){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 io(){return this.__zoom||Bt}function du(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fu(){return navigator.maxTouchPoints||"ontouchstart"in this}function hu(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 Er(){var e=lu,t=uu,n=hu,o=du,r=fu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Rt("start","zoom","end"),d,u,f,g=500,p=150,w=0,v=10;function m(x){x.property("__zoom",io).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",j).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,I,N,P){var k=x.selection?x.selection():x;k.property("__zoom",io),x!==k?S(x,I,N,P):k.interrupt().each(function(){E(this,arguments).event(P).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(x,I,N,P){m.scaleTo(x,function(){var k=this.__zoom.k,D=typeof I=="function"?I.apply(this,arguments):I;return k*D},N,P)},m.scaleTo=function(x,I,N,P){m.transform(x,function(){var k=t.apply(this,arguments),D=this.__zoom,L=N==null?y(k):typeof N=="function"?N.apply(this,arguments):N,V=D.invert(L),R=typeof I=="function"?I.apply(this,arguments):I;return n(h(b(D,R),L,V),k,s)},N,P)},m.translateBy=function(x,I,N,P){m.transform(x,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,P)},m.translateTo=function(x,I,N,P,k){m.transform(x,function(){var D=t.apply(this,arguments),L=this.__zoom,V=P==null?y(D):typeof P=="function"?P.apply(this,arguments):P;return n(Bt.translate(V[0],V[1]).scale(L.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),D,s)},P,k)};function b(x,I){return I=Math.max(i[0],Math.min(i[1],I)),I===x.k?x:new we(I,x.x,x.y)}function h(x,I,N){var P=I[0]-N[0]*x.k,k=I[1]-N[1]*x.k;return P===x.x&&k===x.y?x:new we(x.k,P,k)}function y(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function S(x,I,N,P){x.on("start.zoom",function(){E(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(P).end()}).tween("zoom",function(){var k=this,D=arguments,L=E(k,D).event(P),V=t.apply(k,D),R=N==null?y(V):typeof N=="function"?N.apply(k,D):N,F=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=k.__zoom,W=typeof I=="function"?I.apply(k,D):I,K=l(B.invert(R).concat(F/B.k),W.invert(R).concat(F/W.k));return function(Z){if(Z===1)Z=W;else{var O=K(Z),Y=F/O[2];Z=new we(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}L.zoom(null,Z)}})}function E(x,I,N){return!N&&x.__zooming||new C(x,I)}function C(x,I){this.that=x,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,I),this.taps=0}C.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,I){return this.mouse&&x!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&x!=="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(x){var I=ce(this.that).datum();c.call(x,this.that,new cu(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),I)}};function T(x,...I){if(!e.apply(this,arguments))return;var N=E(this,I).event(x),P=this.__zoom,k=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),D=de(x);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=P.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(P.k===k)return;N.mouse=[D,P.invert(D)],It(this),N.start()}Qe(x),N.wheel=setTimeout(L,p),N.zoom("mouse",n(h(b(P,k),N.mouse[0],N.mouse[1]),N.extent,s));function L(){N.wheel=null,N.end()}}function A(x,...I){if(f||!e.apply(this,arguments))return;var N=x.currentTarget,P=E(this,I,!0).event(x),k=ce(x.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=de(x,N),L=x.clientX,V=x.clientY;ur(x.view),nn(x),P.mouse=[D,this.__zoom.invert(D)],It(this),P.start();function R(B){if(Qe(B),!P.moved){var W=B.clientX-L,K=B.clientY-V;P.moved=W*W+K*K>w}P.event(B).zoom("mouse",n(h(P.that.__zoom,P.mouse[0]=de(B,N),P.mouse[1]),P.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),dr(B.view,P.moved),Qe(B),P.event(B).end()}}function j(x,...I){if(e.apply(this,arguments)){var N=this.__zoom,P=de(x.changedTouches?x.changedTouches[0]:x,this),k=N.invert(P),D=N.k*(x.shiftKey?.5:2),L=n(h(b(N,D),P,k),t.apply(this,I),s);Qe(x),a>0?ce(this).transition().duration(a).call(S,L,P,x):ce(this).call(m.transform,L,P,x)}}function M(x,...I){if(e.apply(this,arguments)){var N=x.touches,P=N.length,k=E(this,I,x.changedTouches.length===P).event(x),D,L,V,R;for(nn(x),L=0;L<P;++L)V=N[L],R=de(V,this),R=[R,this.__zoom.invert(R),V.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,D=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),D&&(k.taps<2&&(u=R[0],d=setTimeout(function(){d=null},g)),It(this),k.start())}}function z(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L,V,R;for(Qe(x),D=0;D<k;++D)L=P[D],V=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=V:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=V);if(L=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],W=N.touch1[0],K=N.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;L=b(L,Math.sqrt(Z/O)),V=[(F[0]+W[0])/2,(F[1]+W[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(N.touch0)V=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(L,V,R),N.extent,s))}}function H(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L;for(nn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),D=0;D<k;++D)L=P[D],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.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&&(L=de(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<v)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:xt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:xt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:xt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:xt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=c.on.apply(c,arguments);return x===c?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(v=+x,m):v},m}const pe={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."},it=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Nr={"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 Be;(function(e){e.Strict="strict",e.Loose="loose"})(Be||(Be={}));var Ae;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ae||(Ae={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Cr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ne;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ne||(Ne={}));var Dt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dt||(Dt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const so={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Mr(e){return e===null?null:e?"valid":"invalid"}const Ir=e=>"id"in e&&"source"in e&&"target"in e,gu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),In=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),dt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},pu=(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):In(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ft(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xt(n)},ft=(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=Ft(n,zt(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=c;if(s&&!u||f)continue;const g=d.width??c.width??c.initialWidth??null,p=d.height??c.height??c.initialHeight??null,w=at(a,Xe(c)),v=(g??0)*(p??0),m=i&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},mu=(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 yu(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 xu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=yu(e,s),l=ft(a),c=Pn(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 kr({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},d=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(u=[[l,c],[l+g,c+p]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=Ye(u)?De(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function wu({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(w=>w.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),d=mu(s,l);for(const f of l)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),De=(e={x:0,y:0},t,n)=>({x:Fe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Fe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Pr(e,t,n){const{width:o,height:r}=_e(n),{x:i,y:s}=n.internals.positionAbsolute;return De(e,[[i,s],[i+o,s+r]],t)}const ao=(e,t,n)=>e<t?Fe(Math.abs(e-t),1,t)/t:e>n?-Fe(Math.abs(e-n),1,t)/t:0,Ar=(e,t,n=15,o=40)=>{const r=ao(e.x,o,t.width-o)*n,i=ao(e.y,o,t.height-o)*n;return[r,i]},Ft=(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)}),pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Xt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Xe=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(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}},zt=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(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)}},Tr=(e,t)=>Xt(Ft(pn(e),pn(t))),at=(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)},co=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),vu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?ht(a,s):a},$t=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function He(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 _u(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=He(e,n),r=He(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=He(e.top??e.y??0,n),r=He(e.bottom??e.y??0,n),i=He(e.left??e.x??0,t),s=He(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 bu(e,t,n,o,r,i){const{x:s,y:a}=$t(e,[t,n,o]),{x:l,y:c}=$t({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Pn=(e,t,n,o,r,i)=>{const s=_u(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Fe(c,o,r),u=e.x+e.width/2,f=e.y+e.height/2,g=t/2-u*d,p=n/2-f*d,w=bu(e,g,p,d,t,n),v={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:g-v.left+v.right,y:p-v.top+v.bottom,zoom:d}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Dr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zr(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 lo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Eu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Su(e){return{...Nr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=he(e),a=gt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?ht(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const An=e=>({width:e.offsetWidth,height:e.offsetHeight}),$r=e=>e?.getRootNode?.()||window?.document,Nu=["INPUT","SELECT","TEXTAREA"];function Hr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Nu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Lr=e=>"clientX"in e,he=(e,t)=>{const n=Lr(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)}},uo=(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,...An(s)}})};function Rr({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,d=Math.abs(l-e),u=Math.abs(c-t);return[l,c,d,u]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function fo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-wt(t-o,i),n];case X.Right:return[t+wt(o-t,i),n];case X.Top:return[t,n-wt(n-r,i)];case X.Bottom:return[t,n+wt(r-n,i)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,g,p]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,g,p]}function Vr({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 Cu({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 Mu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Ft(zt(e),zt(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 at(s,Xt(i))>0}const Iu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,ku=(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)),Pu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Iu;let r;return Ir(e)?r={...e}:r={...e,id:o(e)},ku(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Or({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Vr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const ho={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Au=({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},go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Tu({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=ho[t],l=ho[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=Au({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",g=u[f];let p=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,h,y]=Vr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??c.x+(d.x-c.x)*s,v=r.y??(c.y+d.y)/2):(w=r.x??(c.x+d.x)/2,v=r.y??c.y+(d.y-c.y)*s);const E=[{x:w,y:c.y},{x:w,y:d.y}],C=[{x:c.x,y:v},{x:d.x,y:v}];a[f]===g?p=f==="x"?E:C:p=f==="x"?C:E}else{const E=[{x:c.x,y:d.y}],C=[{x:d.x,y:c.y}];if(f==="x"?p=a.x===g?C:E:p=a.y===g?E:C,t===o){const z=Math.abs(e[f]-n[f]);if(z<=i){const H=Math.min(i-1,i-z);a[f]===g?m[f]=(c[f]>e[f]?-1:1)*H:b[f]=(d[f]>n[f]?-1:1)*H}}if(t!==o){const z=f==="x"?"y":"x",H=a[f]===l[z],x=c[z]>d[z],I=c[z]<d[z];(a[f]===1&&(!H&&x||H&&I)||a[f]!==1&&(!H&&I||H&&x))&&(p=f==="x"?E:C)}const T={x:c.x+m.x,y:c.y+m.y},A={x:d.x+b.x,y:d.y+b.y},j=Math.max(Math.abs(T.x-p[0].x),Math.abs(A.x-p[0].x)),M=Math.max(Math.abs(T.y-p[0].y),Math.abs(A.y-p[0].y));j>=M?(w=(T.x+A.x)/2,v=p[0].y):(w=p[0].x,v=(T.y+A.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...p,{x:d.x+b.x,y:d.y+b.y},n],w,v,h,y]}function Du(e,t,n,o){const r=Math.min(go(e,t)/2,go(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,d=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}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 mn({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:d=.5}){const[u,f,g,p,w]=Tu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});return[u.reduce((m,b,h)=>{let y="";return h>0&&h<u.length-1?y=Du(u[h-1],b,u[h+1],s):y=`${h===0?"M":"L"}${b.x} ${b.y}`,m+=y,m},""),f,g,p,w]}function po(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function zu(e){const{sourceNode:t,targetNode:n}=e;if(!po(t)||!po(n))return null;const o=t.internals.handleBounds||mo(t.handles),r=n.internals.handleBounds||mo(n.handles),i=yo(o?.source??[],e.sourceHandle),s=yo(e.connectionMode===Be.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.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=ze(t,i,a),d=ze(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}function mo(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 ze(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??_e(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 yo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function yn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function $u(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=yn(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 Br=1e3,Hu=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Lu={...Tn,checkEquality:!0};function Dn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Ru(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)$n(r,e,t,o);else{const i=dt(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=De(i,s,_e(r));r.internals.positionAbsolute=a}}function ju(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 zn(e){return e==="manual"}function xn(e,t,n,o={}){const r=Dn(Lu,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!zn(r.zIndexMode)?Br:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let d=s.get(c.id);if(r.checkEquality&&c===d?.internals.userNode)t.set(c.id,d);else{const u=dt(c,r.nodeOrigin),f=Ye(c.extent)?c.extent:r.nodeExtent,g=De(u,f,_e(c));d={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:ju(c,d),z:Fr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(l=!1),c.parentId&&$n(d,t,n,o,i)}return l}function Vu(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 $n(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,d=t.get(c);if(!d){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}Vu(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Hu),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const u=i&&!zn(l)?Br:0,{x:f,y:g,z:p}=Ou(e,d,s,a,u,l),{positionAbsolute:w}=e.internals,v=f!==w.x||g!==w.y;(v||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:w,z:p}})}function Fr(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return zn(n)?o:o+(e.selected?t:0)}function Ou(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=_e(e),c=dt(e,n),d=Ye(e.extent)?De(c,e.extent,l):c;let u=De({x:s+d.x,y:a+d.y},o,l);e.extent==="parent"&&(u=Pr(u,l,t));const f=Fr(e,r,i),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=f?g+1:f}}function Hn(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??Xe(a),c=Tr(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,d=_e(a),u=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(d.width,Math.round(s.width)),w=Math.max(d.height,Math.round(s.height)),v=(p-d.width)*u[0],m=(w-d.height)*u[1];(f>0||g>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+m}}),n.get(l)?.forEach(b=>{e.some(h=>h.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+g}})})),(d.width<s.width||d.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?u[0]*f-v:0),height:w+(g?u[1]*g-m:0)}})}),r}function Bu(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.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 w=An(g.nodeElement),v=p.measured.width!==w.width||p.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!p.internals.handleBounds||g.force))){const b=g.nodeElement.getBoundingClientRect(),h=Ye(p.extent)?p.extent:i;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=Pr(y,w,t.get(p.parentId)):h&&(y=De(y,h,w));const S={...p,measured:w,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:uo("source",g.nodeElement,b,u,p.id),target:uo("target",g.nodeElement,b,u,p.id)}}};t.set(p.id,S),p.parentId&&$n(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,v&&(c.push({id:p.id,type:"dimensions",dimensions:w}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Xe(S,r)}))}}if(f.length>0){const g=Hn(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Fu({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 xo(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 Xr(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}`,d=`${i}-${a}--${r}-${s}`;xo("source",l,d,e,r,s),xo("target",l,c,e,i,a),t.set(o.id,o)}}function Yr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yr(n,t):!1}function wo(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 Xu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Yr(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 on({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 Yu({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=ht(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Zu({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},d=null,u=!1,f=null,g=!1,p=!1,w=null;function v({noDragClassName:b,handleSelector:h,domNode:y,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){f=ce(y);function T({x:z,y:H}){const{nodeLookup:x,nodeExtent:I,snapGrid:N,snapToGrid:P,nodeOrigin:k,onNodeDrag:D,onSelectionDrag:L,onError:V,updateNodePositions:R}=t();i={x:z,y:H};let F=!1;const B=a.size>1,W=B&&I?pn(ft(a)):null,K=B&&P?Yu({dragItems:a,snapGrid:N,x:z,y:H}):null;for(const[Z,O]of a){if(!x.has(Z))continue;let Y={x:z-O.distance.x,y:H-O.distance.y};P&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:ht(Y,N));let Q=null;if(B&&I&&!O.extent&&W){const{positionAbsolute:G}=O.internals,ee=G.x-W.x+I[0][0],ne=G.x+O.measured.width-W.x2+I[1][0],te=G.y-W.y+I[0][1],ae=G.y+O.measured.height-W.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:q}=kr({nodeId:Z,nextPosition:Y,nodeLookup:x,nodeExtent:Q||I,nodeOrigin:k,onError:V});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=q}if(p=p||F,!!F&&(R(a,!0),w&&(o||D||!E&&L))){const[Z,O]=on({nodeId:E,dragItems:a,nodeLookup:x});o?.(w,a,Z,O),D?.(w,Z,O),E||L?.(w,O)}}async function A(){if(!d)return;const{transform:z,panBy:H,autoPanSpeed:x,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,P]=Ar(c,d,x);(N!==0||P!==0)&&(i.x=(i.x??0)-N/z[2],i.y=(i.y??0)-P/z[2],await H({x:N,y:P})&&T(i)),s=requestAnimationFrame(A)}function j(z){const{nodeLookup:H,multiSelectionActive:x,nodesDraggable:I,transform:N,snapGrid:P,snapToGrid:k,selectNodesOnDrag:D,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();u=!0,(!D||!S)&&!x&&E&&(H.get(E)?.selected||R()),S&&D&&E&&e?.(E);const F=tt(z.sourceEvent,{transform:N,snapGrid:P,snapToGrid:k,containerBounds:d});if(i=F,a=Xu(H,I,F,E),a.size>0&&(n||L||!E&&V)){const[B,W]=on({nodeId:E,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,B,W),L?.(z.sourceEvent,B,W),E||V?.(z.sourceEvent,W)}}const M=fr().clickDistance(C).on("start",z=>{const{domNode:H,nodeDragThreshold:x,transform:I,snapGrid:N,snapToGrid:P}=t();d=H?.getBoundingClientRect()||null,g=!1,p=!1,w=z.sourceEvent,x===0&&j(z),i=tt(z.sourceEvent,{transform:I,snapGrid:N,snapToGrid:P,containerBounds:d}),c=he(z.sourceEvent,d)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:x,snapGrid:I,snapToGrid:N,nodeDragThreshold:P,nodeLookup:k}=t(),D=tt(z.sourceEvent,{transform:x,snapGrid:I,snapToGrid:N,containerBounds:d});if(w=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!k.has(E))&&(g=!0),!g){if(!l&&H&&u&&(l=!0,A()),!u){const L=he(z.sourceEvent,d),V=L.x-c.x,R=L.y-c.y;Math.sqrt(V*V+R*R)>P&&j(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&u&&(c=he(z.sourceEvent,d),T(D))}}).on("end",z=>{if(!(!u||g)&&(l=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:x,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(x(a,!1),p=!1),r||I||!E&&N){const[P,k]=on({nodeId:E,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,P,k),I?.(z.sourceEvent,P,k),E||N?.(z.sourceEvent,k)}}}).filter(z=>{const H=z.target;return!z.button&&(!b||!wo(H,`.${b}`,y))&&(!h||wo(H,h,y))});f.call(M)}function m(){f?.on(".drag",null)}return{update:v,destroy:m}}function Wu(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())at(r,Xe(i))>0&&o.push(i);return o}const qu=250;function Gu(e,t,n,o){let r=[],i=1/0;const s=Wu(e,n,t+qu);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:d,y:u}=ze(a,c,c.position,!0),f=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...c,x:d,y:u}],i=f):f===i&&r.push({...c,x:d,y:u}))}}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 Zr(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,...ze(s,l,l.position,!0)}:l}function Wr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ku(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qr=()=>!0;function Uu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:w,onConnectEnd:v,isValidConnection:m=qr,onReconnectEnd:b,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:T}){const A=$r(e.target);let j=0,M;const{x:z,y:H}=he(e),x=Wr(i,T),I=a?.getBoundingClientRect();let N=!1;if(!I||!x)return;const P=Zr(r,x,o,l,t);if(!P)return;let k=he(e,I),D=!1,L=null,V=!1,R=null;function F(){if(!d||!I)return;const[U,q]=Ar(k,I,E);f({x:U,y:q}),j=requestAnimationFrame(F)}const B={...P,nodeId:r,type:x,position:P.position},W=l.get(r);let Z={inProgress:!0,isValid:null,from:ze(W,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:W,to:k,toHandle:null,toPosition:so[B.position],toNode:null,pointer:k};function O(){N=!0,h(Z),p?.(e,{nodeId:r,handleId:o,handleType:x})}C===0&&O();function Y(U){if(!N){const{x:ae,y:be}=he(U),ye=ae-z,Ie=be-H;if(!(ye*ye+Ie*Ie>C*C))return;O()}if(!S()||!B){Q(U);return}const q=y();k=he(U,I),M=Gu(gt(k,q,!1,[1,1]),n,l,B),D||(F(),D=!0);const G=Gr(U,{handle:M,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:c,flowId:u,nodeLookup:l});R=G.handleDomNode,L=G.connection,V=Ku(!!M,G.isValid);const ee=l.get(r),ne=ee?ze(ee,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:V,to:G.toHandle&&V?$t({x:G.toHandle.x,y:G.toHandle.y},q):k,toHandle:G.toHandle,toPosition:V&&G.toHandle?G.toHandle.position:so[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:k};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(M||R)&&L&&V&&w?.(L);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};v?.(U,ee),i&&b?.(U,ee)}g(),cancelAnimationFrame(j),D=!1,V=!1,L=null,R=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",Q),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",Q)}}A.addEventListener("mousemove",Y),A.addEventListener("mouseup",Q),A.addEventListener("touchmove",Y),A.addEventListener("touchend",Q)}function Gr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=qr,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=he(e),w=s.elementFromPoint(g,p),v=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=Wr(void 0,v),h=v.getAttribute("data-nodeid"),y=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),E=v.classList.contains("connectableend");if(!h||!b)return m;const C={source:u?h:o,sourceHandle:u?y:r,target:u?o:h,targetHandle:u?r:y};m.connection=C;const A=S&&E&&(n===Be.Strict?u&&b==="source"||!u&&b==="target":h!==o||y!==r);m.isValid=A&&c(C),m.toHandle=Zr(h,b,y,d,n,!0)}return m}const wn={onPointerDown:Uu,isValid:Gr};function Qu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&ct()?10:1,E=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*d,C=y[2]*Math.pow(2,E*S);t.scaleTo(C)};let w=[0,0];const v=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],E=[S[0]-w[0],S[1]-w[1]];w=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),T={x:y[0]-E[0]*C,y:y[1]-E[1]*C},A=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:y[2]},A,a)},b=Er().on("start",v).on("zoom",u?m:null).on("zoom.wheel",f?p:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const Yt=e=>({x:e.x,y:e.y,zoom:e.k}),rn=({x:e,y:t,zoom:n})=>Bt.translate(e,t).scale(n),Le=(e,t)=>e.target.closest(`.${t}`),Kr=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ju=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sn=(e,t=0,n=Ju,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ur=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function ed({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Le(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const v=de(d),m=Ur(d),b=u*Math.pow(2,m);o.scaleTo(n,b,v,d);return}const f=d.deltaMode===1?20:1;let g=r===Ae.Vertical?0:d.deltaX*f,p=r===Ae.Horizontal?0:d.deltaY*f;!ct()&&d.shiftKey&&r!==Ae.Vertical&&(g=d.deltaY*f,p=0),o.translateBy(n,-(g/u)*i,-(p/u)*i,{internal:!0});const w=Yt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(d,w),e.panScrollTimeout=setTimeout(()=>{c?.(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(d,w))}}function td({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Le(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function nd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Yt(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 od({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Kr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Yt(i.transform))}}function rd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Kr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Yt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function id({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:d}){return u=>{const f=e||t,g=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Le(u,`${c}-flow__node`)||Le(u,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||d&&!p||Le(u,a)&&p||Le(u,l)&&(!p||r&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&w}}function sd({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},d=e.getBoundingClientRect(),u=Er().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(u);b({x:r.x,y:r.y,zoom:Fe(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(Ur);function w(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).transform(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function v({noWheelClassName:M,noPanClassName:z,onPaneContextMenu:H,userSelectionActive:x,panOnScroll:I,panOnDrag:N,panOnScrollMode:P,panOnScrollSpeed:k,preventScrolling:D,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){x&&!c.isZoomingOrPanning&&m();const Y=I&&!F&&!x;u.clickDistance(O?1/0:!fe(Z)||Z<0?0:Z);const Q=Y?ed({zoomPanValues:c,noWheelClassName:M,d3Selection:f,d3Zoom:u,panOnScrollMode:P,panOnScrollSpeed:k,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):td({noWheelClassName:M,preventScrolling:D,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!x){const q=nd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});u.on("start",q);const G=od({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});u.on("zoom",G);const ee=rd({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});u.on("end",ee)}const U=id({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:V,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:x,noPanClassName:z,noWheelClassName:M,lib:B,connectionInProgress:K});u.filter(U),R?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(M,z,H){const x=rn(M),I=u?.constrain()(x,z,H);return I&&await w(I),new Promise(N=>N(I))}async function h(M,z){const H=rn(M);return await w(H,z),new Promise(x=>x(H))}function y(M){if(f){const z=rn(M),H=f.property("__zoom");(H.k!==M.zoom||H.x!==M.x||H.y!==M.y)&&u?.transform(f,z,null,{sync:!0})}}function S(){const M=f?br(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function E(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleTo(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function C(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleBy(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function T(M){u?.scaleExtent(M)}function A(M){u?.translateExtent(M)}function j(M){const z=!fe(M)||M<0?0:M;u?.clickDistance(z)}return{update:v,destroy:m,setViewport:h,setViewportConstrained:b,getViewport:S,scaleTo:E,scaleBy:C,setScaleExtent:T,setTranslateExtent:A,syncViewport:y,setClickDistance:j}}var Ze;(function(e){e.Line="line",e.Handle="handle"})(Ze||(Ze={}));function ad({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 vo(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 Ee(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function _o(e,t){return e?!t:t}function cd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:g,ySnapped:p}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:h,y,width:S,height:E,aspectRatio:C}=e;let T=Math.floor(d?g-e.pointerX:0),A=Math.floor(u?p-e.pointerY:0);const j=S+(l?-T:T),M=E+(c?-A:A),z=-i[0]*S,H=-i[1]*E;let x=vt(j,w,v),I=vt(M,m,b);if(s){let k=0,D=0;l&&T<0?k=Ee(h+T+z,s[0][0]):!l&&T>0&&(k=Se(h+j+z,s[1][0])),c&&A<0?D=Ee(y+A+H,s[0][1]):!c&&A>0&&(D=Se(y+M+H,s[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(a){let k=0,D=0;l&&T>0?k=Se(h+T,a[0][0]):!l&&T<0&&(k=Ee(h+j,a[1][0])),c&&A>0?D=Se(y+A,a[0][1]):!c&&A<0&&(D=Ee(y+M,a[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(r){if(d){const k=vt(j/C,m,b)*C;if(x=Math.max(x,k),s){let D=0;!l&&!c||l&&!c&&f?D=Se(y+H+j/C,s[1][1])*C:D=Ee(y+H+(l?T:-T)/C,s[0][1])*C,x=Math.max(x,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=Ee(y+j/C,a[1][1])*C:D=Se(y+(l?T:-T)/C,a[0][1])*C,x=Math.max(x,D)}}if(u){const k=vt(M*C,w,v)/C;if(I=Math.max(I,k),s){let D=0;!l&&!c||c&&!l&&f?D=Se(h+M*C+z,s[1][0])/C:D=Ee(h+(c?A:-A)*C+z,s[0][0])/C,I=Math.max(I,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=Ee(h+M*C,a[1][0])/C:D=Se(h+(c?A:-A)*C,a[0][0])/C,I=Math.max(I,D)}}}A=A+(A<0?I:-I),T=T+(T<0?x:-x),r&&(f?j>M*C?A=(_o(l,c)?-T:T)/C:T=(_o(l,c)?-A:A)*C:d?(A=T/C,c=l):(T=A*C,l=c));const N=l?h+T:h,P=c?y+A:y;return{width:S+(l?-T:T),height:E+(c?-A:A),x:i[0]*T*(l?-1:1)+N,y:i[1]*A*(c?-1:1)+P}}const Qr={width:0,height:0,x:0,y:0},ld={...Qr,pointerX:0,pointerY:0,aspectRatio:1};function ud(e){return[[0,0],[e.measured.width,e.measured.height]]}function dd(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 fd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:vo("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:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:w,shouldResize:v}){let m={...Qr},b={...ld};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:vo(c)};let h,y=null,S=[],E,C,T,A=!1;const j=fr().on("start",M=>{const{nodeLookup:z,transform:H,snapGrid:x,snapToGrid:I,nodeOrigin:N,paneDomNode:P}=n();if(h=z.get(t),!h)return;y=P?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:D}=tt(M.sourceEvent,{transform:H,snapGrid:x,snapToGrid:I,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},b={...m,pointerX:k,pointerY:D,aspectRatio:m.width/m.height},E=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(E=z.get(h.parentId),C=E&&h.extent==="parent"?ud(E):void 0),S=[],T=void 0;for(const[L,V]of z)if(V.parentId===t&&(S.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=dd(V,h,V.origin??N);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}g?.(M,{...m})}).on("drag",M=>{const{transform:z,snapGrid:H,snapToGrid:x,nodeOrigin:I}=n(),N=tt(M.sourceEvent,{transform:z,snapGrid:H,snapToGrid:x,containerBounds:y}),P=[];if(!h)return;const{x:k,y:D,width:L,height:V}=m,R={},F=h.origin??I,{width:B,height:W,x:K,y:Z}=cd(b,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,C,T),O=B!==L,Y=W!==V,Q=K!==k&&O,U=Z!==D&&Y;if(!Q&&!U&&!O&&!Y)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?Z:m.y,m.x=R.x,m.y=R.y,S.length>0)){const ne=K-k,te=Z-D;for(const ae of S)ae.position={x:ae.position.x-ne+F[0]*(B-L),y:ae.position.y-te+F[1]*(W-V)},P.push(ae)}if((O||Y)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),E&&h.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(m.x=ne,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(m.y=te,b.y=b.y-(R.y-te))}const q=ad({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:q};v?.(M,G)!==!1&&(A=!0,p?.(M,G),o(R,P))}).on("end",M=>{A&&(w?.(M,{...m}),r?.({...m}),A=!1)});i.call(j)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const hd={},bo=e=>{let t;const n=new Set,o=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const g=t;t=u??(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:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(hd?"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},gd=e=>e?bo(e):bo,{useDebugValue:pd}=js,{useSyncExternalStoreWithSelector:md}=Rs,yd=e=>e;function Jr(e,t=yd,n){const o=md(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pd(o),o}const Eo=(e,t)=>{const n=gd(e),o=(r,i=t)=>Jr(n,r,i);return Object.assign(o,n),o},xd=(e,t)=>e?Eo(e,t):Eo;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 Zt=$.createContext(null),wd=Zt.Provider,ei=pe.error001();function J(e,t){const n=$.useContext(Zt);if(n===null)throw new Error(ei);return Jr(n,e,t)}function re(){const e=$.useContext(Zt);if(e===null)throw new Error(ei);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const So={display:"none"},vd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ti="react-flow__node-desc",ni="react-flow__edge-desc",_d="react-flow__aria-live",bd=e=>e.ariaLiveMessage,Ed=e=>e.ariaLabelConfig;function Sd({rfId:e}){const t=J(bd);return _.jsx("div",{id:`${_d}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:vd,children:t})}function Nd({rfId:e,disableKeyboardA11y:t}){const n=J(Ed);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ti}-${e}`,style:So,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${ni}-${e}`,style:So,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Sd,{rfId:e})]})}const Wt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return _.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Wt.displayName="Panel";function Cd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Wt,{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:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Md=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}},_t=e=>e.id;function Id(e,t){return oe(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&oe(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function kd({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Md,Id);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Pd=e=>!!e.onSelectionChangeHandlers;function Ad({onSelectionChange:e}){const t=J(Pd);return e||t?_.jsx(kd,{onSelectionChange:e}):null}const oi=[0,0],Td={x:0,y:0,zoom:1},Dd=["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"],No=[...Dd,"rfId"],zd=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}),Co={translateExtent:it,nodeOrigin:oi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function $d(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(zd,oe),c=re();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=Co,a()}),[]);const d=$.useRef(Co);return $.useEffect(()=>{for(const u of No){const f=e[u],g=d.current[u];f!==g&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:Su(f)}):u==="fitView"?c.setState({fitViewQueued:f}):u==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[u]:f})))}d.current=e},No.map(u=>e[u])),null}function Mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Hd(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=Mo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Mo()?.matches?"dark":"light"}const Io=typeof document<"u"?document:null;function lt(e=null,t={target:Io,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
1
|
+
import{bz as Rs,br as js,r as $,j as _,c as ue,e as _n,d as Vs}from"./index-B9g3IU58.js";import{C as se,a as Os,b as Bs}from"./index-lzARP5Pm.js";import{t as Wo,T as Fs}from"./typewriter-title-BiqUerVd.js";import{E as qo}from"./error-boundary-DDz4G03r.js";import{u as Xs}from"./localstorage-keys-D1ttI_kB.js";import{u as bn}from"./virtual-mcp-Mmz1T7Sl.js";import{c as Go,B as Ko}from"./button-CX9BcGIk.js";import{V as Ys}from"./view-mode-toggle-DgsbED3E.js";import{i as Zs}from"./GitBranch01-DwH1AkJQ.js";import{s as Ws}from"./Plus-DXX1AA4n.js";import{I as Uo,n as qs}from"./empty-state-K3SjQCVt.js";import{i as Gs}from"./CpuChip02-BhwN5rbm.js";import{e as Ks}from"./use-collections-CvkTm_6U.js";import{a as Us}from"./use-connection-D8u2E4QD.js";import{W as Qs,u as Js}from"./constants-DZTKSPb5.js";import{u as ea}from"./use-virtual-mcp-D17yOOVF.js";import{i as ke,c as Gn,a as Kn,b as ta,d as Jt,T as en,e as na}from"./value-Bupbegsn.js";import"./X-B3J65QND.js";import"./use-binding-C219fPLm.js";import"./binder-DmV70Mg6.js";import"./monaco-editor-D26cmj67.js";import"./infiniteQueryObserver-CKJG_0Nf.js";import"./spinner-y-sEdyFB.js";import"./use-virtual-mcp-system-prompt-CC3fRmBB.js";import"./input-D7AeKLG6.js";import"./popover-D5eKc-lR.js";import"./select-DypP_ctF.js";import"./tooltip-BQbbKnxv.js";import"./Check-CSwEsqta.js";import"./ChevronDown-DFQ7Wwuf.js";import"./File06-BUqTeSo9.js";import"./Grid01-B6p7u4lV.js";import"./Image01-UhJxiWhu.js";import"./SearchMd-BHAg8E82.js";import"./index-P3kNP-Ue.js";import"./useQuery-DoX2gsGK.js";import"./dialog-CtieLp9D.js";import"./form-lMcrl-dM.js";import"./AlertCircle-BUJ8IT58.js";import"./ArrowUp-6Vw9g-kK.js";import"./Edit01-lX0maYnd.js";import"./Copy01-D3IzDjkZ.js";import"./Terminal-j-v4faZp.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-CdrSpG7k.js";import"./use-create-virtual-mcp-hwvm94Q5.js";import"./useMutation-ByLbENlF.js";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 oa={value:()=>{}};function Rt(){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 St(n)}function St(e){this._=e}function ra(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}})}St.prototype=Rt.prototype={constructor:St,on:function(e,t){var n=this._,o=ra(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ia(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]=Un(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Un(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 St(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 ia(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Un(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=oa,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 Qn={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 jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qn.hasOwnProperty(t)?{space:Qn[t],local:e}:e}function sa(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 aa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qo(e){var t=jt(e);return(t.local?aa:sa)(t)}function ca(){}function En(e){return e==null?ca:function(){return this.querySelector(e)}}function la(e){typeof e!="function"&&(e=En(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,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new le(o,this._parents)}function ua(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function da(){return[]}function Jo(e){return e==null?da:function(){return this.querySelectorAll(e)}}function fa(e){return function(){return ua(e.apply(this,arguments))}}function ha(e){typeof e=="function"?e=fa(e):e=Jo(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 le(o,r)}function er(e){return function(){return this.matches(e)}}function tr(e){return function(t){return t.matches(e)}}var ga=Array.prototype.find;function pa(e){return function(){return ga.call(this.children,e)}}function ma(){return this.firstElementChild}function ya(e){return this.select(e==null?ma:pa(typeof e=="function"?e:tr(e)))}var xa=Array.prototype.filter;function wa(){return Array.from(this.children)}function va(e){return function(){return xa.call(this.children,e)}}function _a(e){return this.selectAll(e==null?wa:va(typeof e=="function"?e:tr(e)))}function ba(e){typeof e!="function"&&(e=er(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 le(o,this._parents)}function nr(e){return new Array(e.length)}function Ea(){return new le(this._enter||this._groups.map(nr),this._parents)}function kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}kt.prototype={constructor:kt,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 Sa(e){return function(){return e}}function Na(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 kt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Ca(e,t,n,o,r,i,s){var a,l,c=new Map,d=t.length,u=i.length,f=new Array(d),g;for(a=0;a<d;++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<u;++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 kt(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Ma(e){return e.__data__}function Ia(e,t){if(!arguments.length)return Array.from(this,Ma);var n=t?Ca:Na,o=this._parents,r=this._groups;typeof e!="function"&&(e=Sa(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,g=ka(e.call(d,d&&d.__data__,c,o)),p=g.length,w=a[c]=new Array(p),v=s[c]=new Array(p),m=l[c]=new Array(f);n(d,u,w,v,m,g,t);for(var b=0,h=0,y,S;b<p;++b)if(y=w[b]){for(b>=h&&(h=b+1);!(S=v[h])&&++h<p;);y._next=S||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function ka(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Pa(){return new le(this._exit||this._groups.map(nr),this._parents)}function Aa(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 Ta(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],d=o[l],u=c.length,f=a[l]=new Array(u),g,p=0;p<u;++p)(g=c[p]||d[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Da(){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 za(e){e||(e=$a);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!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,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new le(r,this._parents).order()}function $a(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ha(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function La(){return Array.from(this)}function Ra(){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 ja(){let e=0;for(const t of this)++e;return e}function Va(){return!this.node()}function Oa(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 Ba(e){return function(){this.removeAttribute(e)}}function Fa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xa(e,t){return function(){this.setAttribute(e,t)}}function Ya(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Za(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Wa(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 qa(e,t){var n=jt(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?Fa:Ba:typeof t=="function"?n.local?Wa:Za:n.local?Ya:Xa)(n,t))}function or(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ga(e){return function(){this.style.removeProperty(e)}}function Ka(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ua(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Qa(e,t,n){return arguments.length>1?this.each((t==null?Ga:typeof t=="function"?Ua:Ka)(e,t,n??"")):Ve(this.node(),e)}function Ve(e,t){return e.style.getPropertyValue(t)||or(e).getComputedStyle(e,null).getPropertyValue(t)}function Ja(e){return function(){delete this[e]}}function ec(e,t){return function(){this[e]=t}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nc(e,t){return arguments.length>1?this.each((t==null?Ja:typeof t=="function"?tc:ec)(e,t)):this.node()[e]}function rr(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ir(e)}function ir(e){this._node=e,this._names=rr(e.getAttribute("class")||"")}ir.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 sr(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ar(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function oc(e){return function(){sr(this,e)}}function rc(e){return function(){ar(this,e)}}function ic(e,t){return function(){(t.apply(this,arguments)?sr:ar)(this,e)}}function sc(e,t){var n=rr(e+"");if(arguments.length<2){for(var o=Sn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?ic:t?oc:rc)(n,t))}function ac(){this.textContent=""}function cc(e){return function(){this.textContent=e}}function lc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function uc(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?lc:cc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function fc(e){return function(){this.innerHTML=e}}function hc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gc(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?hc:fc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function mc(){return this.each(pc)}function yc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xc(){return this.each(yc)}function wc(e){var t=typeof e=="function"?e:Qo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vc(){return null}function _c(e,t){var n=typeof e=="function"?e:Qo(e),o=t==null?vc:typeof t=="function"?t:En(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function bc(){var e=this.parentNode;e&&e.removeChild(this)}function Ec(){return this.each(bc)}function Sc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cc(e){return this.select(e?Nc:Sc)}function Mc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ic(e){return function(t){e.call(this,t,this.__data__)}}function kc(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 Pc(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 Ac(e,t,n){return function(){var o=this.__on,r,i=Ic(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 Tc(e,t,n){var o=kc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Ac:Pc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function cr(e,t,n){var o=or(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 Dc(e,t){return function(){return cr(this,e,t)}}function zc(e,t){return function(){return cr(this,e,t.apply(this,arguments))}}function $c(e,t){return this.each((typeof t=="function"?zc:Dc)(e,t))}function*Hc(){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 lr=[null];function le(e,t){this._groups=e,this._parents=t}function ut(){return new le([[document.documentElement]],lr)}function Lc(){return this}le.prototype=ut.prototype={constructor:le,select:la,selectAll:ha,selectChild:ya,selectChildren:_a,filter:ba,data:Ia,enter:Ea,exit:Pa,join:Aa,merge:Ta,selection:Lc,order:Da,sort:za,call:Ha,nodes:La,node:Ra,size:ja,empty:Va,each:Oa,attr:qa,style:Qa,property:nc,classed:sc,text:uc,html:gc,raise:mc,lower:xc,append:wc,insert:_c,remove:Ec,clone:Cc,datum:Mc,on:Tc,dispatch:$c,[Symbol.iterator]:Hc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],lr)}function Rc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Rc(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 jc={passive:!1},ot={capture:!0,passive:!1};function tn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function ur(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",je,ot);"onselectstart"in t?n.on("selectstart.drag",je,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,ot),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 mt=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){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:d}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Vc(e){return!e.ctrlKey&&!e.button}function Oc(){return this.parentNode}function Bc(e,t){return t??{x:e.x,y:e.y}}function Fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var e=Vc,t=Oc,n=Bc,o=Fc,r={},i=Rt("start","drag","end"),s=0,a,l,c,d,u=0;function f(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,jc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,S){if(!(d||!e.call(this,y,S))){var E=h(this,t.call(this,y,S),y,S,"mouse");E&&(ce(y.view).on("mousemove.drag",p,ot).on("mouseup.drag",w,ot),ur(y.view),tn(y),c=!1,a=y.clientX,l=y.clientY,E("start",y))}}function p(y){if(je(y),!c){var S=y.clientX-a,E=y.clientY-l;c=S*S+E*E>u}r.mouse("drag",y)}function w(y){ce(y.view).on("mousemove.drag mouseup.drag",null),dr(y.view,c),je(y),r.mouse("end",y)}function v(y,S){if(e.call(this,y,S)){var E=y.changedTouches,C=t.call(this,y,S),T=E.length,A,j;for(A=0;A<T;++A)(j=h(this,C,y,S,E[A].identifier,E[A]))&&(tn(y),j("start",y,E[A]))}}function m(y){var S=y.changedTouches,E=S.length,C,T;for(C=0;C<E;++C)(T=r[S[C].identifier])&&(je(y),T("drag",y,S[C]))}function b(y){var S=y.changedTouches,E=S.length,C,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<E;++C)(T=r[S[C].identifier])&&(tn(y),T("end",y,S[C]))}function h(y,S,E,C,T,A){var j=i.copy(),M=de(A||E,S),z,H,x;if((x=n.call(y,new un("beforestart",{sourceEvent:E,target:f,identifier:T,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:j}),C))!=null)return z=x.x-M[0]||0,H=x.y-M[1]||0,function I(N,P,k){var D=M,L;switch(N){case"start":r[T]=I,L=s++;break;case"end":delete r[T],--s;case"drag":M=de(k||P,S),L=s;break}j.call(N,y,new un(N,{sourceEvent:P,subject:x,target:f,identifier:T,active:L,x:M[0]+z,y:M[1]+H,dx:M[0]-D[0],dy:M[1]-D[1],dispatch:j}),C)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:mt(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:mt(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:mt(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:mt(!!y),f):o},f.on=function(){var y=i.on.apply(i,arguments);return y===i?f:y},f.clickDistance=function(y){return arguments.length?(u=(y=+y)*y,f):Math.sqrt(u)},f}var Jn=180/Math.PI,dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hr(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)*Jn,skewX:Math.atan(l)*Jn,scaleX:s,scaleY:a}}var yt;function Xc(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dn:hr(t.a,t.b,t.c,t.d,t.e,t.f)}function Yc(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?dn:(e=e.matrix,hr(e.a,e.b,e.c,e.d,e.e,e.f))}function gr(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push("translate(",null,t,null,n);p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u||f)&&g.push("translate("+u+t+f+n)}function s(c,d,u,f){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ke(c,d)})):d&&u.push(r(u)+"rotate("+d+o)}function a(c,d,u,f){c!==d?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ke(c,d)}):d&&u.push(r(u)+"skewX("+d+o)}function l(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push(r(g)+"scale(",null,",",null,")");p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u!==1||f!==1)&&g.push(r(g)+"scale("+u+","+f+")")}return function(c,d){var u=[],f=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,f),s(c.rotate,d.rotate,u,f),a(c.skewX,d.skewX,u,f),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,f),c=d=null,function(g){for(var p=-1,w=f.length,v;++p<w;)u[(v=f[p]).i]=v.x(g);return u.join("")}}}var Zc=gr(Xc,"px, ","px)","deg)"),Wc=gr(Yc,", ",")",")"),qc=1e-12;function eo(e){return((e=Math.exp(e))+1/e)/2}function Gc(e){return((e=Math.exp(e))-1/e)/2}function Kc(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],d=s[0],u=s[1],f=s[2],g=d-a,p=u-l,w=g*g+p*p,v,m;if(w<qc)m=Math.log(f/c)/t,v=function(C){return[a+C*g,l+C*p,c*Math.exp(t*C*m)]};else{var b=Math.sqrt(w),h=(f*f-c*c+o*w)/(2*c*n*b),y=(f*f-c*c-o*w)/(2*f*n*b),S=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(y*y+1)-y);m=(E-S)/t,v=function(C){var T=C*m,A=eo(S),j=c/(n*b)*(A*Kc(t*T+S)-Gc(S));return[a+j*g,l+j*p,c*A/eo(t*T+S)]}}return v.duration=m*1e3*t/Math.SQRT2,v}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 Oe=0,Je=0,Ue=0,pr=1e3,Pt,et,At=0,Te=0,Vt=0,rt=typeof performance=="object"&&performance.now?performance:Date,mr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nn(){return Te||(mr(Uc),Te=rt.now()+Vt)}function Uc(){Te=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=yr.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:Pt=this,et=this),this._call=e,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function yr(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function Qc(){Nn(),++Oe;for(var e=Pt,t;e;)(t=Te-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oe}function to(){Te=(At=rt.now())+Vt,Oe=Je=0;try{Qc()}finally{Oe=0,el(),Te=0}}function Jc(){var e=rt.now(),t=e-At;t>pr&&(Vt-=t,At=e)}function el(){for(var e,t=Pt,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:Pt=n);et=e,fn(o)}function fn(e){if(!Oe){Je&&(Je=clearTimeout(Je));var t=e-Te;t>24?(e<1/0&&(Je=setTimeout(to,e-rt.now()-Vt)),Ue&&(Ue=clearInterval(Ue))):(Ue||(At=rt.now(),Ue=setInterval(Jc,pr)),Oe=1,mr(to))}}function no(e,t,n){var o=new Tt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var tl=Rt("start","end","cancel","interrupt"),nl=[],xr=0,oo=1,hn=2,Ct=3,ro=4,gn=5,Mt=6;function Ot(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ol(e,n,{name:t,index:o,group:r,on:tl,tween:nl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xr})}function Cn(e,t){var n=ge(e,t);if(n.state>xr)throw new Error("too late; already scheduled");return n}function me(e,t){var n=ge(e,t);if(n.state>Ct)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ol(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=yr(i,0,n.time);function i(c){n.state=oo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var d,u,f,g;if(n.state!==oo)return l();for(d in o)if(g=o[d],g.name===n.name){if(g.state===Ct)return no(s);g.state===ro?(g.state=Mt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[d]):+d<t&&(g.state=Mt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[d])}if(no(function(){n.state===Ct&&(n.state=ro,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=hn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===hn){for(n.state=Ct,r=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=g);r.length=u+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=gn,1),u=-1,f=r.length;++u<f;)r[u].call(e,d);n.state===gn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Mt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function It(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>hn&&o.state<gn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function rl(e){return this.each(function(){It(this,e)})}function il(e,t){var n,o;return function(){var r=me(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 sl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=me(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 al(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(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?il:sl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=me(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function wr(e,t){var n;return(typeof t=="number"?ke:t instanceof Gn?Kn:(n=Gn(t))?(t=n,Kn):ta)(e,t)}function cl(e){return function(){this.removeAttribute(e)}}function ll(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ul(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 dl(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 fl(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 hl(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 gl(e,t){var n=jt(e),o=n==="transform"?Wc:wr;return this.attrTween(e,typeof t=="function"?(n.local?hl:fl)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?ll:cl)(n):(n.local?dl:ul)(n,o,t))}function pl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ml(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function yl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ml(e,i)),n}return r._value=t,r}function xl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pl(e,i)),n}return r._value=t,r}function wl(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=jt(e);return this.tween(n,(o.local?yl:xl)(o,t))}function vl(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function _l(e,t){return t=+t,function(){Cn(this,e).delay=t}}function bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vl:_l)(t,e)):ge(this.node(),t).delay}function El(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function Sl(e,t){return t=+t,function(){me(this,e).duration=t}}function Nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?El:Sl)(t,e)):ge(this.node(),t).duration}function Cl(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function Ml(e){var t=this._id;return arguments.length?this.each(Cl(t,e)):ge(this.node(),t).ease}function Il(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function kl(e){if(typeof e!="function")throw new Error;return this.each(Il(this._id,e))}function Pl(e){typeof e!="function"&&(e=er(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 ve(o,this._parents,this._name,this._id)}function Al(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],d=l.length,u=s[a]=new Array(d),f,g=0;g<d;++g)(f=l[g]||c[g])&&(u[g]=f);for(;a<o;++a)s[a]=t[a];return new ve(s,this._parents,this._name,this._id)}function Tl(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 Dl(e,t,n){var o,r,i=Tl(t)?Cn:me;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function zl(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Dl(n,e,t))}function $l(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Hl(){return this.on("end.remove",$l(this._id))}function Ll(e){var t=this._name,n=this._id;typeof e!="function"&&(e=En(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),d,u,f=0;f<l;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),c[f]=u,Ot(c[f],t,n,f,c,ge(d,n)));return new ve(i,this._parents,t,n)}function Rl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jo(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var f=e.call(d,d.__data__,u,l),g,p=ge(d,n),w=0,v=f.length;w<v;++w)(g=f[w])&&Ot(g,t,n,w,f,p);i.push(f),s.push(d)}return new ve(i,s,t,n)}var jl=ut.prototype.constructor;function Vl(){return new jl(this._groups,this._parents)}function Ol(e,t){var n,o,r;return function(){var i=Ve(this,e),s=(this.style.removeProperty(e),Ve(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function vr(e){return function(){this.style.removeProperty(e)}}function Bl(e,t,n){var o,r=n+"",i;return function(){var s=Ve(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fl(e,t,n){var o,r,i;return function(){var s=Ve(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ve(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Xl(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=me(this,e),c=l.on,d=l.value[i]==null?a||(a=vr(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(s,r=d),l.on=o}}function Yl(e,t,n){var o=(e+="")=="transform"?Zc:wr;return t==null?this.styleTween(e,Ol(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,Fl(e,o,Mn(this,"style."+e,t))).each(Xl(this._id,e)):this.styleTween(e,Bl(e,o,t),n).on("end.style."+e,null)}function Zl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wl(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Zl(e,s,n)),o}return i._value=t,i}function ql(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,Wl(e,t,n??""))}function Gl(e){return function(){this.textContent=e}}function Kl(e){return function(){var t=e(this);this.textContent=t??""}}function Ul(e){return this.tween("text",typeof e=="function"?Kl(Mn(this,"text",e)):Gl(e==null?"":e+""))}function Ql(e){return function(t){this.textContent=e.call(this,t)}}function Jl(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Ql(r)),t}return o._value=e,o}function eu(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,Jl(e))}function tu(){for(var e=this._name,t=this._id,n=_r(),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 d=ge(l,t);Ot(l,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ve(o,this._parents,e,n)}function nu(){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=me(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var ou=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++ou}var xe=ut.prototype;ve.prototype={constructor:ve,select:Ll,selectAll:Rl,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Pl,merge:Al,selection:Vl,transition:tu,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:zl,attr:gl,attrTween:wl,style:Yl,styleTween:ql,text:Ul,textTween:eu,remove:Hl,tween:al,delay:bl,duration:Nl,ease:Ml,easeVarying:kl,end:nu,[Symbol.iterator]:xe[Symbol.iterator]};function ru(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var iu={time:null,delay:0,duration:250,ease:ru};function su(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 au(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=_r(),(n=iu).time=Nn(),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])&&Ot(l,e,t,c,s,n||su(l,t));return new ve(o,this._parents,e,t)}ut.prototype.interrupt=rl;ut.prototype.transition=au;const xt=e=>()=>e;function cu(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 we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Bt=new we(1,0,0);br.prototype=we.prototype;function br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bt;return e.__zoom}function nn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function lu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function uu(){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 io(){return this.__zoom||Bt}function du(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fu(){return navigator.maxTouchPoints||"ontouchstart"in this}function hu(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 Er(){var e=lu,t=uu,n=hu,o=du,r=fu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Rt("start","zoom","end"),d,u,f,g=500,p=150,w=0,v=10;function m(x){x.property("__zoom",io).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",j).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,I,N,P){var k=x.selection?x.selection():x;k.property("__zoom",io),x!==k?S(x,I,N,P):k.interrupt().each(function(){E(this,arguments).event(P).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(x,I,N,P){m.scaleTo(x,function(){var k=this.__zoom.k,D=typeof I=="function"?I.apply(this,arguments):I;return k*D},N,P)},m.scaleTo=function(x,I,N,P){m.transform(x,function(){var k=t.apply(this,arguments),D=this.__zoom,L=N==null?y(k):typeof N=="function"?N.apply(this,arguments):N,V=D.invert(L),R=typeof I=="function"?I.apply(this,arguments):I;return n(h(b(D,R),L,V),k,s)},N,P)},m.translateBy=function(x,I,N,P){m.transform(x,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,P)},m.translateTo=function(x,I,N,P,k){m.transform(x,function(){var D=t.apply(this,arguments),L=this.__zoom,V=P==null?y(D):typeof P=="function"?P.apply(this,arguments):P;return n(Bt.translate(V[0],V[1]).scale(L.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),D,s)},P,k)};function b(x,I){return I=Math.max(i[0],Math.min(i[1],I)),I===x.k?x:new we(I,x.x,x.y)}function h(x,I,N){var P=I[0]-N[0]*x.k,k=I[1]-N[1]*x.k;return P===x.x&&k===x.y?x:new we(x.k,P,k)}function y(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function S(x,I,N,P){x.on("start.zoom",function(){E(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(P).end()}).tween("zoom",function(){var k=this,D=arguments,L=E(k,D).event(P),V=t.apply(k,D),R=N==null?y(V):typeof N=="function"?N.apply(k,D):N,F=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=k.__zoom,W=typeof I=="function"?I.apply(k,D):I,K=l(B.invert(R).concat(F/B.k),W.invert(R).concat(F/W.k));return function(Z){if(Z===1)Z=W;else{var O=K(Z),Y=F/O[2];Z=new we(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}L.zoom(null,Z)}})}function E(x,I,N){return!N&&x.__zooming||new C(x,I)}function C(x,I){this.that=x,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,I),this.taps=0}C.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,I){return this.mouse&&x!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&x!=="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(x){var I=ce(this.that).datum();c.call(x,this.that,new cu(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),I)}};function T(x,...I){if(!e.apply(this,arguments))return;var N=E(this,I).event(x),P=this.__zoom,k=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),D=de(x);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=P.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(P.k===k)return;N.mouse=[D,P.invert(D)],It(this),N.start()}Qe(x),N.wheel=setTimeout(L,p),N.zoom("mouse",n(h(b(P,k),N.mouse[0],N.mouse[1]),N.extent,s));function L(){N.wheel=null,N.end()}}function A(x,...I){if(f||!e.apply(this,arguments))return;var N=x.currentTarget,P=E(this,I,!0).event(x),k=ce(x.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=de(x,N),L=x.clientX,V=x.clientY;ur(x.view),nn(x),P.mouse=[D,this.__zoom.invert(D)],It(this),P.start();function R(B){if(Qe(B),!P.moved){var W=B.clientX-L,K=B.clientY-V;P.moved=W*W+K*K>w}P.event(B).zoom("mouse",n(h(P.that.__zoom,P.mouse[0]=de(B,N),P.mouse[1]),P.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),dr(B.view,P.moved),Qe(B),P.event(B).end()}}function j(x,...I){if(e.apply(this,arguments)){var N=this.__zoom,P=de(x.changedTouches?x.changedTouches[0]:x,this),k=N.invert(P),D=N.k*(x.shiftKey?.5:2),L=n(h(b(N,D),P,k),t.apply(this,I),s);Qe(x),a>0?ce(this).transition().duration(a).call(S,L,P,x):ce(this).call(m.transform,L,P,x)}}function M(x,...I){if(e.apply(this,arguments)){var N=x.touches,P=N.length,k=E(this,I,x.changedTouches.length===P).event(x),D,L,V,R;for(nn(x),L=0;L<P;++L)V=N[L],R=de(V,this),R=[R,this.__zoom.invert(R),V.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,D=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),D&&(k.taps<2&&(u=R[0],d=setTimeout(function(){d=null},g)),It(this),k.start())}}function z(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L,V,R;for(Qe(x),D=0;D<k;++D)L=P[D],V=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=V:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=V);if(L=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],W=N.touch1[0],K=N.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;L=b(L,Math.sqrt(Z/O)),V=[(F[0]+W[0])/2,(F[1]+W[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(N.touch0)V=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(L,V,R),N.extent,s))}}function H(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L;for(nn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),D=0;D<k;++D)L=P[D],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.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&&(L=de(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<v)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:xt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:xt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:xt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:xt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=c.on.apply(c,arguments);return x===c?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(v=+x,m):v},m}const pe={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."},it=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Nr={"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 Be;(function(e){e.Strict="strict",e.Loose="loose"})(Be||(Be={}));var Ae;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ae||(Ae={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Cr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ne;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ne||(Ne={}));var Dt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dt||(Dt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const so={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Mr(e){return e===null?null:e?"valid":"invalid"}const Ir=e=>"id"in e&&"source"in e&&"target"in e,gu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),In=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),dt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},pu=(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):In(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ft(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xt(n)},ft=(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=Ft(n,zt(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=c;if(s&&!u||f)continue;const g=d.width??c.width??c.initialWidth??null,p=d.height??c.height??c.initialHeight??null,w=at(a,Xe(c)),v=(g??0)*(p??0),m=i&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},mu=(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 yu(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 xu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=yu(e,s),l=ft(a),c=Pn(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 kr({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},d=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(u=[[l,c],[l+g,c+p]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=Ye(u)?De(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function wu({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(w=>w.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),d=mu(s,l);for(const f of l)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),De=(e={x:0,y:0},t,n)=>({x:Fe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Fe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Pr(e,t,n){const{width:o,height:r}=_e(n),{x:i,y:s}=n.internals.positionAbsolute;return De(e,[[i,s],[i+o,s+r]],t)}const ao=(e,t,n)=>e<t?Fe(Math.abs(e-t),1,t)/t:e>n?-Fe(Math.abs(e-n),1,t)/t:0,Ar=(e,t,n=15,o=40)=>{const r=ao(e.x,o,t.width-o)*n,i=ao(e.y,o,t.height-o)*n;return[r,i]},Ft=(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)}),pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Xt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Xe=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(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}},zt=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(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)}},Tr=(e,t)=>Xt(Ft(pn(e),pn(t))),at=(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)},co=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),vu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?ht(a,s):a},$t=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function He(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 _u(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=He(e,n),r=He(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=He(e.top??e.y??0,n),r=He(e.bottom??e.y??0,n),i=He(e.left??e.x??0,t),s=He(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 bu(e,t,n,o,r,i){const{x:s,y:a}=$t(e,[t,n,o]),{x:l,y:c}=$t({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Pn=(e,t,n,o,r,i)=>{const s=_u(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Fe(c,o,r),u=e.x+e.width/2,f=e.y+e.height/2,g=t/2-u*d,p=n/2-f*d,w=bu(e,g,p,d,t,n),v={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:g-v.left+v.right,y:p-v.top+v.bottom,zoom:d}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Dr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zr(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 lo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Eu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Su(e){return{...Nr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=he(e),a=gt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?ht(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const An=e=>({width:e.offsetWidth,height:e.offsetHeight}),$r=e=>e?.getRootNode?.()||window?.document,Nu=["INPUT","SELECT","TEXTAREA"];function Hr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Nu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Lr=e=>"clientX"in e,he=(e,t)=>{const n=Lr(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)}},uo=(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,...An(s)}})};function Rr({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,d=Math.abs(l-e),u=Math.abs(c-t);return[l,c,d,u]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function fo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-wt(t-o,i),n];case X.Right:return[t+wt(o-t,i),n];case X.Top:return[t,n-wt(n-r,i)];case X.Bottom:return[t,n+wt(r-n,i)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,g,p]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,g,p]}function Vr({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 Cu({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 Mu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Ft(zt(e),zt(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 at(s,Xt(i))>0}const Iu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,ku=(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)),Pu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Iu;let r;return Ir(e)?r={...e}:r={...e,id:o(e)},ku(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Or({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Vr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const ho={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Au=({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},go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Tu({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=ho[t],l=ho[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=Au({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",g=u[f];let p=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,h,y]=Vr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??c.x+(d.x-c.x)*s,v=r.y??(c.y+d.y)/2):(w=r.x??(c.x+d.x)/2,v=r.y??c.y+(d.y-c.y)*s);const E=[{x:w,y:c.y},{x:w,y:d.y}],C=[{x:c.x,y:v},{x:d.x,y:v}];a[f]===g?p=f==="x"?E:C:p=f==="x"?C:E}else{const E=[{x:c.x,y:d.y}],C=[{x:d.x,y:c.y}];if(f==="x"?p=a.x===g?C:E:p=a.y===g?E:C,t===o){const z=Math.abs(e[f]-n[f]);if(z<=i){const H=Math.min(i-1,i-z);a[f]===g?m[f]=(c[f]>e[f]?-1:1)*H:b[f]=(d[f]>n[f]?-1:1)*H}}if(t!==o){const z=f==="x"?"y":"x",H=a[f]===l[z],x=c[z]>d[z],I=c[z]<d[z];(a[f]===1&&(!H&&x||H&&I)||a[f]!==1&&(!H&&I||H&&x))&&(p=f==="x"?E:C)}const T={x:c.x+m.x,y:c.y+m.y},A={x:d.x+b.x,y:d.y+b.y},j=Math.max(Math.abs(T.x-p[0].x),Math.abs(A.x-p[0].x)),M=Math.max(Math.abs(T.y-p[0].y),Math.abs(A.y-p[0].y));j>=M?(w=(T.x+A.x)/2,v=p[0].y):(w=p[0].x,v=(T.y+A.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...p,{x:d.x+b.x,y:d.y+b.y},n],w,v,h,y]}function Du(e,t,n,o){const r=Math.min(go(e,t)/2,go(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,d=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}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 mn({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:d=.5}){const[u,f,g,p,w]=Tu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});return[u.reduce((m,b,h)=>{let y="";return h>0&&h<u.length-1?y=Du(u[h-1],b,u[h+1],s):y=`${h===0?"M":"L"}${b.x} ${b.y}`,m+=y,m},""),f,g,p,w]}function po(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function zu(e){const{sourceNode:t,targetNode:n}=e;if(!po(t)||!po(n))return null;const o=t.internals.handleBounds||mo(t.handles),r=n.internals.handleBounds||mo(n.handles),i=yo(o?.source??[],e.sourceHandle),s=yo(e.connectionMode===Be.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.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=ze(t,i,a),d=ze(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}function mo(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 ze(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??_e(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 yo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function yn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function $u(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=yn(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 Br=1e3,Hu=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Lu={...Tn,checkEquality:!0};function Dn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Ru(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)$n(r,e,t,o);else{const i=dt(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=De(i,s,_e(r));r.internals.positionAbsolute=a}}function ju(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 zn(e){return e==="manual"}function xn(e,t,n,o={}){const r=Dn(Lu,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!zn(r.zIndexMode)?Br:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let d=s.get(c.id);if(r.checkEquality&&c===d?.internals.userNode)t.set(c.id,d);else{const u=dt(c,r.nodeOrigin),f=Ye(c.extent)?c.extent:r.nodeExtent,g=De(u,f,_e(c));d={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:ju(c,d),z:Fr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(l=!1),c.parentId&&$n(d,t,n,o,i)}return l}function Vu(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 $n(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,d=t.get(c);if(!d){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}Vu(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*Hu),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const u=i&&!zn(l)?Br:0,{x:f,y:g,z:p}=Ou(e,d,s,a,u,l),{positionAbsolute:w}=e.internals,v=f!==w.x||g!==w.y;(v||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:w,z:p}})}function Fr(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return zn(n)?o:o+(e.selected?t:0)}function Ou(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=_e(e),c=dt(e,n),d=Ye(e.extent)?De(c,e.extent,l):c;let u=De({x:s+d.x,y:a+d.y},o,l);e.extent==="parent"&&(u=Pr(u,l,t));const f=Fr(e,r,i),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=f?g+1:f}}function Hn(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??Xe(a),c=Tr(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,d=_e(a),u=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(d.width,Math.round(s.width)),w=Math.max(d.height,Math.round(s.height)),v=(p-d.width)*u[0],m=(w-d.height)*u[1];(f>0||g>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+m}}),n.get(l)?.forEach(b=>{e.some(h=>h.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+g}})})),(d.width<s.width||d.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?u[0]*f-v:0),height:w+(g?u[1]*g-m:0)}})}),r}function Bu(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.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 w=An(g.nodeElement),v=p.measured.width!==w.width||p.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!p.internals.handleBounds||g.force))){const b=g.nodeElement.getBoundingClientRect(),h=Ye(p.extent)?p.extent:i;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=Pr(y,w,t.get(p.parentId)):h&&(y=De(y,h,w));const S={...p,measured:w,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:uo("source",g.nodeElement,b,u,p.id),target:uo("target",g.nodeElement,b,u,p.id)}}};t.set(p.id,S),p.parentId&&$n(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,v&&(c.push({id:p.id,type:"dimensions",dimensions:w}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Xe(S,r)}))}}if(f.length>0){const g=Hn(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Fu({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 xo(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 Xr(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}`,d=`${i}-${a}--${r}-${s}`;xo("source",l,d,e,r,s),xo("target",l,c,e,i,a),t.set(o.id,o)}}function Yr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yr(n,t):!1}function wo(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 Xu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Yr(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 on({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 Yu({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=ht(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Zu({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},d=null,u=!1,f=null,g=!1,p=!1,w=null;function v({noDragClassName:b,handleSelector:h,domNode:y,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){f=ce(y);function T({x:z,y:H}){const{nodeLookup:x,nodeExtent:I,snapGrid:N,snapToGrid:P,nodeOrigin:k,onNodeDrag:D,onSelectionDrag:L,onError:V,updateNodePositions:R}=t();i={x:z,y:H};let F=!1;const B=a.size>1,W=B&&I?pn(ft(a)):null,K=B&&P?Yu({dragItems:a,snapGrid:N,x:z,y:H}):null;for(const[Z,O]of a){if(!x.has(Z))continue;let Y={x:z-O.distance.x,y:H-O.distance.y};P&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:ht(Y,N));let Q=null;if(B&&I&&!O.extent&&W){const{positionAbsolute:G}=O.internals,ee=G.x-W.x+I[0][0],ne=G.x+O.measured.width-W.x2+I[1][0],te=G.y-W.y+I[0][1],ae=G.y+O.measured.height-W.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:q}=kr({nodeId:Z,nextPosition:Y,nodeLookup:x,nodeExtent:Q||I,nodeOrigin:k,onError:V});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=q}if(p=p||F,!!F&&(R(a,!0),w&&(o||D||!E&&L))){const[Z,O]=on({nodeId:E,dragItems:a,nodeLookup:x});o?.(w,a,Z,O),D?.(w,Z,O),E||L?.(w,O)}}async function A(){if(!d)return;const{transform:z,panBy:H,autoPanSpeed:x,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,P]=Ar(c,d,x);(N!==0||P!==0)&&(i.x=(i.x??0)-N/z[2],i.y=(i.y??0)-P/z[2],await H({x:N,y:P})&&T(i)),s=requestAnimationFrame(A)}function j(z){const{nodeLookup:H,multiSelectionActive:x,nodesDraggable:I,transform:N,snapGrid:P,snapToGrid:k,selectNodesOnDrag:D,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();u=!0,(!D||!S)&&!x&&E&&(H.get(E)?.selected||R()),S&&D&&E&&e?.(E);const F=tt(z.sourceEvent,{transform:N,snapGrid:P,snapToGrid:k,containerBounds:d});if(i=F,a=Xu(H,I,F,E),a.size>0&&(n||L||!E&&V)){const[B,W]=on({nodeId:E,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,B,W),L?.(z.sourceEvent,B,W),E||V?.(z.sourceEvent,W)}}const M=fr().clickDistance(C).on("start",z=>{const{domNode:H,nodeDragThreshold:x,transform:I,snapGrid:N,snapToGrid:P}=t();d=H?.getBoundingClientRect()||null,g=!1,p=!1,w=z.sourceEvent,x===0&&j(z),i=tt(z.sourceEvent,{transform:I,snapGrid:N,snapToGrid:P,containerBounds:d}),c=he(z.sourceEvent,d)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:x,snapGrid:I,snapToGrid:N,nodeDragThreshold:P,nodeLookup:k}=t(),D=tt(z.sourceEvent,{transform:x,snapGrid:I,snapToGrid:N,containerBounds:d});if(w=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!k.has(E))&&(g=!0),!g){if(!l&&H&&u&&(l=!0,A()),!u){const L=he(z.sourceEvent,d),V=L.x-c.x,R=L.y-c.y;Math.sqrt(V*V+R*R)>P&&j(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&u&&(c=he(z.sourceEvent,d),T(D))}}).on("end",z=>{if(!(!u||g)&&(l=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:x,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(x(a,!1),p=!1),r||I||!E&&N){const[P,k]=on({nodeId:E,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,P,k),I?.(z.sourceEvent,P,k),E||N?.(z.sourceEvent,k)}}}).filter(z=>{const H=z.target;return!z.button&&(!b||!wo(H,`.${b}`,y))&&(!h||wo(H,h,y))});f.call(M)}function m(){f?.on(".drag",null)}return{update:v,destroy:m}}function Wu(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())at(r,Xe(i))>0&&o.push(i);return o}const qu=250;function Gu(e,t,n,o){let r=[],i=1/0;const s=Wu(e,n,t+qu);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:d,y:u}=ze(a,c,c.position,!0),f=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...c,x:d,y:u}],i=f):f===i&&r.push({...c,x:d,y:u}))}}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 Zr(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,...ze(s,l,l.position,!0)}:l}function Wr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ku(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qr=()=>!0;function Uu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:w,onConnectEnd:v,isValidConnection:m=qr,onReconnectEnd:b,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:T}){const A=$r(e.target);let j=0,M;const{x:z,y:H}=he(e),x=Wr(i,T),I=a?.getBoundingClientRect();let N=!1;if(!I||!x)return;const P=Zr(r,x,o,l,t);if(!P)return;let k=he(e,I),D=!1,L=null,V=!1,R=null;function F(){if(!d||!I)return;const[U,q]=Ar(k,I,E);f({x:U,y:q}),j=requestAnimationFrame(F)}const B={...P,nodeId:r,type:x,position:P.position},W=l.get(r);let Z={inProgress:!0,isValid:null,from:ze(W,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:W,to:k,toHandle:null,toPosition:so[B.position],toNode:null,pointer:k};function O(){N=!0,h(Z),p?.(e,{nodeId:r,handleId:o,handleType:x})}C===0&&O();function Y(U){if(!N){const{x:ae,y:be}=he(U),ye=ae-z,Ie=be-H;if(!(ye*ye+Ie*Ie>C*C))return;O()}if(!S()||!B){Q(U);return}const q=y();k=he(U,I),M=Gu(gt(k,q,!1,[1,1]),n,l,B),D||(F(),D=!0);const G=Gr(U,{handle:M,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:c,flowId:u,nodeLookup:l});R=G.handleDomNode,L=G.connection,V=Ku(!!M,G.isValid);const ee=l.get(r),ne=ee?ze(ee,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:V,to:G.toHandle&&V?$t({x:G.toHandle.x,y:G.toHandle.y},q):k,toHandle:G.toHandle,toPosition:V&&G.toHandle?G.toHandle.position:so[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:k};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(M||R)&&L&&V&&w?.(L);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};v?.(U,ee),i&&b?.(U,ee)}g(),cancelAnimationFrame(j),D=!1,V=!1,L=null,R=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",Q),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",Q)}}A.addEventListener("mousemove",Y),A.addEventListener("mouseup",Q),A.addEventListener("touchmove",Y),A.addEventListener("touchend",Q)}function Gr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=qr,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=he(e),w=s.elementFromPoint(g,p),v=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=Wr(void 0,v),h=v.getAttribute("data-nodeid"),y=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),E=v.classList.contains("connectableend");if(!h||!b)return m;const C={source:u?h:o,sourceHandle:u?y:r,target:u?o:h,targetHandle:u?r:y};m.connection=C;const A=S&&E&&(n===Be.Strict?u&&b==="source"||!u&&b==="target":h!==o||y!==r);m.isValid=A&&c(C),m.toHandle=Zr(h,b,y,d,n,!0)}return m}const wn={onPointerDown:Uu,isValid:Gr};function Qu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&ct()?10:1,E=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*d,C=y[2]*Math.pow(2,E*S);t.scaleTo(C)};let w=[0,0];const v=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],E=[S[0]-w[0],S[1]-w[1]];w=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),T={x:y[0]-E[0]*C,y:y[1]-E[1]*C},A=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:y[2]},A,a)},b=Er().on("start",v).on("zoom",u?m:null).on("zoom.wheel",f?p:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const Yt=e=>({x:e.x,y:e.y,zoom:e.k}),rn=({x:e,y:t,zoom:n})=>Bt.translate(e,t).scale(n),Le=(e,t)=>e.target.closest(`.${t}`),Kr=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ju=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sn=(e,t=0,n=Ju,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ur=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function ed({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Le(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const v=de(d),m=Ur(d),b=u*Math.pow(2,m);o.scaleTo(n,b,v,d);return}const f=d.deltaMode===1?20:1;let g=r===Ae.Vertical?0:d.deltaX*f,p=r===Ae.Horizontal?0:d.deltaY*f;!ct()&&d.shiftKey&&r!==Ae.Vertical&&(g=d.deltaY*f,p=0),o.translateBy(n,-(g/u)*i,-(p/u)*i,{internal:!0});const w=Yt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(d,w),e.panScrollTimeout=setTimeout(()=>{c?.(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(d,w))}}function td({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Le(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function nd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Yt(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 od({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Kr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Yt(i.transform))}}function rd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Kr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Yt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function id({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:d}){return u=>{const f=e||t,g=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Le(u,`${c}-flow__node`)||Le(u,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||d&&!p||Le(u,a)&&p||Le(u,l)&&(!p||r&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&w}}function sd({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},d=e.getBoundingClientRect(),u=Er().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(u);b({x:r.x,y:r.y,zoom:Fe(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(Ur);function w(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).transform(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function v({noWheelClassName:M,noPanClassName:z,onPaneContextMenu:H,userSelectionActive:x,panOnScroll:I,panOnDrag:N,panOnScrollMode:P,panOnScrollSpeed:k,preventScrolling:D,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){x&&!c.isZoomingOrPanning&&m();const Y=I&&!F&&!x;u.clickDistance(O?1/0:!fe(Z)||Z<0?0:Z);const Q=Y?ed({zoomPanValues:c,noWheelClassName:M,d3Selection:f,d3Zoom:u,panOnScrollMode:P,panOnScrollSpeed:k,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):td({noWheelClassName:M,preventScrolling:D,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!x){const q=nd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});u.on("start",q);const G=od({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});u.on("zoom",G);const ee=rd({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});u.on("end",ee)}const U=id({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:V,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:x,noPanClassName:z,noWheelClassName:M,lib:B,connectionInProgress:K});u.filter(U),R?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(M,z,H){const x=rn(M),I=u?.constrain()(x,z,H);return I&&await w(I),new Promise(N=>N(I))}async function h(M,z){const H=rn(M);return await w(H,z),new Promise(x=>x(H))}function y(M){if(f){const z=rn(M),H=f.property("__zoom");(H.k!==M.zoom||H.x!==M.x||H.y!==M.y)&&u?.transform(f,z,null,{sync:!0})}}function S(){const M=f?br(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function E(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleTo(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function C(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleBy(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function T(M){u?.scaleExtent(M)}function A(M){u?.translateExtent(M)}function j(M){const z=!fe(M)||M<0?0:M;u?.clickDistance(z)}return{update:v,destroy:m,setViewport:h,setViewportConstrained:b,getViewport:S,scaleTo:E,scaleBy:C,setScaleExtent:T,setTranslateExtent:A,syncViewport:y,setClickDistance:j}}var Ze;(function(e){e.Line="line",e.Handle="handle"})(Ze||(Ze={}));function ad({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 vo(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 Ee(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function _o(e,t){return e?!t:t}function cd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:g,ySnapped:p}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:h,y,width:S,height:E,aspectRatio:C}=e;let T=Math.floor(d?g-e.pointerX:0),A=Math.floor(u?p-e.pointerY:0);const j=S+(l?-T:T),M=E+(c?-A:A),z=-i[0]*S,H=-i[1]*E;let x=vt(j,w,v),I=vt(M,m,b);if(s){let k=0,D=0;l&&T<0?k=Ee(h+T+z,s[0][0]):!l&&T>0&&(k=Se(h+j+z,s[1][0])),c&&A<0?D=Ee(y+A+H,s[0][1]):!c&&A>0&&(D=Se(y+M+H,s[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(a){let k=0,D=0;l&&T>0?k=Se(h+T,a[0][0]):!l&&T<0&&(k=Ee(h+j,a[1][0])),c&&A>0?D=Se(y+A,a[0][1]):!c&&A<0&&(D=Ee(y+M,a[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(r){if(d){const k=vt(j/C,m,b)*C;if(x=Math.max(x,k),s){let D=0;!l&&!c||l&&!c&&f?D=Se(y+H+j/C,s[1][1])*C:D=Ee(y+H+(l?T:-T)/C,s[0][1])*C,x=Math.max(x,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=Ee(y+j/C,a[1][1])*C:D=Se(y+(l?T:-T)/C,a[0][1])*C,x=Math.max(x,D)}}if(u){const k=vt(M*C,w,v)/C;if(I=Math.max(I,k),s){let D=0;!l&&!c||c&&!l&&f?D=Se(h+M*C+z,s[1][0])/C:D=Ee(h+(c?A:-A)*C+z,s[0][0])/C,I=Math.max(I,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=Ee(h+M*C,a[1][0])/C:D=Se(h+(c?A:-A)*C,a[0][0])/C,I=Math.max(I,D)}}}A=A+(A<0?I:-I),T=T+(T<0?x:-x),r&&(f?j>M*C?A=(_o(l,c)?-T:T)/C:T=(_o(l,c)?-A:A)*C:d?(A=T/C,c=l):(T=A*C,l=c));const N=l?h+T:h,P=c?y+A:y;return{width:S+(l?-T:T),height:E+(c?-A:A),x:i[0]*T*(l?-1:1)+N,y:i[1]*A*(c?-1:1)+P}}const Qr={width:0,height:0,x:0,y:0},ld={...Qr,pointerX:0,pointerY:0,aspectRatio:1};function ud(e){return[[0,0],[e.measured.width,e.measured.height]]}function dd(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 fd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:vo("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:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:w,shouldResize:v}){let m={...Qr},b={...ld};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:vo(c)};let h,y=null,S=[],E,C,T,A=!1;const j=fr().on("start",M=>{const{nodeLookup:z,transform:H,snapGrid:x,snapToGrid:I,nodeOrigin:N,paneDomNode:P}=n();if(h=z.get(t),!h)return;y=P?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:D}=tt(M.sourceEvent,{transform:H,snapGrid:x,snapToGrid:I,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},b={...m,pointerX:k,pointerY:D,aspectRatio:m.width/m.height},E=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(E=z.get(h.parentId),C=E&&h.extent==="parent"?ud(E):void 0),S=[],T=void 0;for(const[L,V]of z)if(V.parentId===t&&(S.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=dd(V,h,V.origin??N);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}g?.(M,{...m})}).on("drag",M=>{const{transform:z,snapGrid:H,snapToGrid:x,nodeOrigin:I}=n(),N=tt(M.sourceEvent,{transform:z,snapGrid:H,snapToGrid:x,containerBounds:y}),P=[];if(!h)return;const{x:k,y:D,width:L,height:V}=m,R={},F=h.origin??I,{width:B,height:W,x:K,y:Z}=cd(b,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,C,T),O=B!==L,Y=W!==V,Q=K!==k&&O,U=Z!==D&&Y;if(!Q&&!U&&!O&&!Y)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?Z:m.y,m.x=R.x,m.y=R.y,S.length>0)){const ne=K-k,te=Z-D;for(const ae of S)ae.position={x:ae.position.x-ne+F[0]*(B-L),y:ae.position.y-te+F[1]*(W-V)},P.push(ae)}if((O||Y)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),E&&h.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(m.x=ne,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(m.y=te,b.y=b.y-(R.y-te))}const q=ad({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:q};v?.(M,G)!==!1&&(A=!0,p?.(M,G),o(R,P))}).on("end",M=>{A&&(w?.(M,{...m}),r?.({...m}),A=!1)});i.call(j)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const hd={},bo=e=>{let t;const n=new Set,o=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const g=t;t=u??(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:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(hd?"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},gd=e=>e?bo(e):bo,{useDebugValue:pd}=js,{useSyncExternalStoreWithSelector:md}=Rs,yd=e=>e;function Jr(e,t=yd,n){const o=md(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pd(o),o}const Eo=(e,t)=>{const n=gd(e),o=(r,i=t)=>Jr(n,r,i);return Object.assign(o,n),o},xd=(e,t)=>e?Eo(e,t):Eo;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 Zt=$.createContext(null),wd=Zt.Provider,ei=pe.error001();function J(e,t){const n=$.useContext(Zt);if(n===null)throw new Error(ei);return Jr(n,e,t)}function re(){const e=$.useContext(Zt);if(e===null)throw new Error(ei);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const So={display:"none"},vd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ti="react-flow__node-desc",ni="react-flow__edge-desc",_d="react-flow__aria-live",bd=e=>e.ariaLiveMessage,Ed=e=>e.ariaLabelConfig;function Sd({rfId:e}){const t=J(bd);return _.jsx("div",{id:`${_d}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:vd,children:t})}function Nd({rfId:e,disableKeyboardA11y:t}){const n=J(Ed);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ti}-${e}`,style:So,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${ni}-${e}`,style:So,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Sd,{rfId:e})]})}const Wt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return _.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Wt.displayName="Panel";function Cd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Wt,{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:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Md=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}},_t=e=>e.id;function Id(e,t){return oe(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&oe(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function kd({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Md,Id);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Pd=e=>!!e.onSelectionChangeHandlers;function Ad({onSelectionChange:e}){const t=J(Pd);return e||t?_.jsx(kd,{onSelectionChange:e}):null}const oi=[0,0],Td={x:0,y:0,zoom:1},Dd=["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"],No=[...Dd,"rfId"],zd=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}),Co={translateExtent:it,nodeOrigin:oi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function $d(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(zd,oe),c=re();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=Co,a()}),[]);const d=$.useRef(Co);return $.useEffect(()=>{for(const u of No){const f=e[u],g=d.current[u];f!==g&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:Su(f)}):u==="fitView"?c.setState({fitViewQueued:f}):u==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[u]:f})))}d.current=e},No.map(u=>e[u])),null}function Mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Hd(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=Mo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Mo()?.matches?"dark":"light"}const Io=typeof document<"u"?document:null;function lt(e=null,t={target:Io,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|