@decocms/mesh 2.0.0 → 2.1.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/client/assets/{AlertCircle-BnQOnIUK.js → AlertCircle-CnILn3jx.js} +1 -1
- package/dist/client/assets/{ArrowLeft-s2LVd4Jh.js → ArrowLeft-B6wScdzP.js} +1 -1
- package/dist/client/assets/{ChevronDown-DLHFQDss.js → ChevronDown-DTD8t00o.js} +1 -1
- package/dist/client/assets/{ChevronRight-Df7vxLuO.js → ChevronRight-1OHI0CBI.js} +1 -1
- package/dist/client/assets/{Copy01-Cg-zZNgL.js → Copy01-Uwb56ntU.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-S6AK1qMQ.js → DotsHorizontal-B5ryaglt.js} +1 -1
- package/dist/client/assets/{DotsVertical-DL1BOVox.js → DotsVertical-B-5TnXsG.js} +1 -1
- package/dist/client/assets/{File06-BXoByNkx.js → File06-DExBhm42.js} +1 -1
- package/dist/client/assets/{FilterLines-D-86Z5xi.js → FilterLines-aAu13BQ5.js} +1 -1
- package/dist/client/assets/{FlipBackward-ZBsKqLYA.js → FlipBackward-DWy5EIwt.js} +1 -1
- package/dist/client/assets/{GitBranch01-BU4xfNWf.js → GitBranch01-Dq29bc0o.js} +1 -1
- package/dist/client/assets/{Grid01-DTA7Ao9S.js → Grid01-Bdi_lD58.js} +1 -1
- package/dist/client/assets/{Inbox01-BMVbBJQA.js → Inbox01-DMQr1yW_.js} +1 -1
- package/dist/client/assets/{InfoCircle-DrzBjG0U.js → InfoCircle-BTGq_g6o.js} +1 -1
- package/dist/client/assets/{Key01-DHDQn1LD.js → Key01-BM7IeiIC.js} +1 -1
- package/dist/client/assets/{LinkExternal01-cG3zQluY.js → LinkExternal01-BbRknnAT.js} +1 -1
- package/dist/client/assets/{Loading01-ev_d5Ul8.js → Loading01-BhwGtEie.js} +1 -1
- package/dist/client/assets/{Lock01-SYpb-IcY.js → Lock01-BjwJTO1K.js} +1 -1
- package/dist/client/assets/{Play-vz5syF_s.js → Play-B_M1eygK.js} +1 -1
- package/dist/client/assets/{Plus-CoA7veNR.js → Plus-CUt-llJ2.js} +1 -1
- package/dist/client/assets/{Terminal-DmwCXCux.js → Terminal-OwfTXSIc.js} +1 -1
- package/dist/client/assets/{Trash01-D5qtjx0n.js → Trash01-DvwxBHIe.js} +1 -1
- package/dist/client/assets/{X-ucqgpLkV.js → X-DmB-XP-B.js} +1 -1
- package/dist/client/assets/{XClose-DDYQu1Ds.js → XClose-BfRKR4QX.js} +1 -1
- package/dist/client/assets/{alert-dialog-IBFLzL1S.js → alert-dialog-CPgX_DbI.js} +1 -1
- package/dist/client/assets/{auth-ClQTpskF.js → auth-C_7jwlCE.js} +1 -1
- package/dist/client/assets/{auth-catchall-C5Hc-_dX.js → auth-catchall-BsWBBbjQ.js} +1 -1
- package/dist/client/assets/{avatar-DyfHzlT3.js → avatar-BfkYZ3Uk.js} +1 -1
- package/dist/client/assets/{badge-CU1xq8P4.js → badge-pmm0Bb0n.js} +1 -1
- package/dist/client/assets/{card-A0j-GQek.js → card-DX0N7QQe.js} +1 -1
- package/dist/client/assets/{checkbox-CKmzIgh_.js → checkbox-CT0tct0O.js} +1 -1
- package/dist/client/assets/{collection-detail-DfA_YTCa.js → collection-detail-BB6Q1vQA.js} +1 -1
- package/dist/client/assets/{collection-display-button-CWAu-kzM.js → collection-display-button-C6mkNMSZ.js} +1 -1
- package/dist/client/assets/{collection-header-BwSc-_Kq.js → collection-header-B-OH92G_.js} +1 -1
- package/dist/client/assets/{collection-page-DtIcDiZ6.js → collection-page-BMM6TZo-.js} +1 -1
- package/dist/client/assets/{collection-search-B9hWcULz.js → collection-search-Dspxl3Yz.js} +1 -1
- package/dist/client/assets/{collection-tab-B_R97p8f.js → collection-tab-CZVDVMRh.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DQxK8uYh.js → collection-table-wrapper-QnkBhjXh.js} +1 -1
- package/dist/client/assets/{connection-card-sB7DQoNm.js → connection-card-D80SBKTI.js} +1 -1
- package/dist/client/assets/{connection-detail-YVncur0H.js → connection-detail-CQgpZSSc.js} +1 -1
- package/dist/client/assets/{connections-BXFZ3wvT.js → connections-D1odZRUO.js} +1 -1
- package/dist/client/assets/constants-BvQJIhjO.js +1 -0
- package/dist/client/assets/{create-organization-dialog-Ekn1e0rk.js → create-organization-dialog-Cz1rNGDv.js} +1 -1
- package/dist/client/assets/{dialog-BfmlLeqD.js → dialog-CC31EL0X.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B32DxAz8.js → dropdown-menu-zbRnijT0.js} +1 -1
- package/dist/client/assets/{empty-state-B95c-kPA.js → empty-state-B5WHq2Wp.js} +1 -1
- package/dist/client/assets/{env-vars-editor-DWx6qXJH.js → env-vars-editor-BZ0EKsNv.js} +1 -1
- package/dist/client/assets/{error-boundary-CeUty1fN.js → error-boundary-iei4NFmK.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BVC8xFla.js → extract-connection-data-RbshSMFT.js} +1 -1
- package/dist/client/assets/{form-JhtOrW0K.js → form-B4rbGxTC.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-Dn3t8R_C.js → formatDistanceToNow-B3eT5t4e.js} +1 -1
- package/dist/client/assets/{gateway-detail-CFSYfSyg.js → gateway-detail-Cel29Jq6.js} +1 -1
- package/dist/client/assets/{gateway-selector-Dbt9ey6W.js → gateway-selector-DrcyKhYX.js} +1 -1
- package/dist/client/assets/{gateways-DHNzyrkl.js → gateways-BCUxb6V6.js} +1 -1
- package/dist/client/assets/{home-WYDr7ETr.js → home-DjjIziN3.js} +1 -1
- package/dist/client/assets/{index-C1mekZiH.js → index-Be5s3BTd.js} +2 -2
- package/dist/client/assets/{index-D34hcbGg.js → index-CJUkmkVw.js} +1 -1
- package/dist/client/assets/{index-DfTxjkaX.js → index-DhProoia.js} +1 -1
- package/dist/client/assets/{input-DaU0Ki86.js → input-D5VmXtXA.js} +1 -1
- package/dist/client/assets/{layout-BExJva29.js → layout-BtPLf8h9.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-DaSVftiO.js → lazy-highlighter-CKguQGTj.js} +1 -1
- package/dist/client/assets/{localstorage-keys-D0etzHKS.js → localstorage-keys-Cgns4y6c.js} +1 -1
- package/dist/client/assets/{login-CxcGRpej.js → login-BY9zzeLF.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BIn8BXP3.js → mcp-oauth-JrBnP9ka.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-D6DvDFSK.js → mcp-server-detail-D1UUYOFR.js} +1 -1
- package/dist/client/assets/{members-D37gJv0X.js → members-BLsbQRx4.js} +1 -1
- package/dist/client/assets/{monaco-editor-Y-NWUHaI.js → monaco-editor-BbkOCnUd.js} +1 -1
- package/dist/client/assets/{monitoring-DlVue9UD.js → monitoring-DQGgnd4W.js} +1 -1
- package/dist/client/assets/{oauth-callback-WdcYmBNI.js → oauth-callback-CEdwKynD.js} +1 -1
- package/dist/client/assets/{page-BJvhqDxS.js → page-BXDOiUca.js} +4 -4
- package/dist/client/assets/{page-CHJwayw7.js → page-CjfeHs2p.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-byXh4q4H.js → pin-to-sidebar-button-Dw4GdfbU.js} +1 -1
- package/dist/client/assets/{popover-DBs4BqBC.js → popover-t9-OkADH.js} +1 -1
- package/dist/client/assets/{project-context-provider-CNg0H4Fo.js → project-context-provider-BS8o541A.js} +1 -1
- package/dist/client/assets/{resizable-CTcl5OQf.js → resizable-QJ-R9KRQ.js} +1 -1
- package/dist/client/assets/{resource-tabs-Bo8pm6CQ.js → resource-tabs-B-4VA98W.js} +1 -1
- package/dist/client/assets/{select-DbMbYBva.js → select-e4C4SmKq.js} +1 -1
- package/dist/client/assets/{settings-7IN1gw1l.js → settings-Dnv8fDox.js} +1 -1
- package/dist/client/assets/{shell-layout-nmRRj6_B.js → shell-layout-BlrxsMrN.js} +1 -1
- package/dist/client/assets/{spinner-BGNFnmXu.js → spinner-BFS4gVsU.js} +1 -1
- package/dist/client/assets/{switch-CmxXnJyM.js → switch-CLvPCUaJ.js} +1 -1
- package/dist/client/assets/{textarea-DAtAmtc7.js → textarea-4b5OG-tc.js} +1 -1
- package/dist/client/assets/{thread-history-popover-zKy_UgQq.js → thread-history-popover-CdgY8TVV.js} +33 -33
- package/dist/client/assets/{tools-list-DN6AGQNR.js → tools-list-DYFK0YJ7.js} +1 -1
- package/dist/client/assets/{use-binding-DgpwpEbl.js → use-binding-4jFDqim2.js} +1 -1
- package/dist/client/assets/{use-connection-CqruT03A.js → use-connection-BV17GXlx.js} +1 -1
- package/dist/client/assets/{use-connection-resources-CkpuXaD-.js → use-connection-resources-CaFhYy-Y.js} +1 -1
- package/dist/client/assets/{use-gateway-B1dIUnIy.js → use-gateway-B7sk5BUf.js} +1 -1
- package/dist/client/assets/{use-list-state-JWYeEYSc.js → use-list-state-ClKTIM8C.js} +1 -1
- package/dist/client/assets/{use-mcp-JvlAYa3Y.js → use-mcp-BnUTTtgf.js} +1 -1
- package/dist/client/assets/{use-members-Do0dz7W-.js → use-members-Duard-8M.js} +1 -1
- package/dist/client/assets/{use-mobile-BtDidYAZ.js → use-mobile-D6agNekL.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BptZoa_W.js → use-organization-settings-BBRsFqJO.js} +1 -1
- package/dist/client/assets/{use-tool-call-C_3QXJhb.js → use-tool-call-CM2oq0rB.js} +1 -1
- package/dist/client/assets/useQuery-DdiguCvR.js +1 -0
- package/dist/client/assets/{value-Dr4SJDBJ.js → value-8MKGBmon.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-D5v_tsuM.js → view-mode-toggle-BTD72CUu.js} +1 -1
- package/dist/client/assets/{workflow-D697ZMd-.js → workflow-6yVvsMos.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-C6wB7wau.js +0 -1
- package/dist/client/assets/useQuery-BDFKN3rX.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{r as z,y as Xs,z as Zs,j as _,c as he,h as Rt,i as Gs,a as Ws,t as qn}from"./index-C1mekZiH.js";import{e as qs,D as Ks,u as Kn,a as Us,b as Qs,c as Js,d as ea,N as ta,C as _e,M as Un,U as na,G as oa,f as ra,T as ia}from"./thread-history-popover-zKy_UgQq.js";import{E as Qn}from"./error-boundary-CeUty1fN.js";import{u as Jo,c as sa,I as er,n as aa}from"./use-connection-CqruT03A.js";import{u as tr,i as ca}from"./use-gateway-B1dIUnIy.js";import{u as la}from"./use-binding-DgpwpEbl.js";import{u as nr,L as ua}from"./localstorage-keys-D0etzHKS.js";import{u as bn}from"./project-context-provider-CNg0H4Fo.js";import{c as or,B as da}from"./input-DaU0Ki86.js";import{V as fa}from"./view-mode-toggle-D5v_tsuM.js";import{i as ha}from"./GitBranch01-BU4xfNWf.js";import{i as ga}from"./Loading01-ev_d5Ul8.js";import{s as pa}from"./Plus-CoA7veNR.js";import{u as ma}from"./use-tool-call-C_3QXJhb.js";import{i as Ae,a as Jn,b as ya,c as eo,d as en,T as tn,e as xa}from"./value-Dr4SJDBJ.js";import{G as to}from"./gateway-selector-Dbt9ey6W.js";import"./popover-DBs4BqBC.js";import"./AlertCircle-BnQOnIUK.js";import"./X-ucqgpLkV.js";import"./Grid01-DTA7Ao9S.js";import"./textarea-DAtAmtc7.js";import"./ChevronRight-Df7vxLuO.js";import"./Copy01-Cg-zZNgL.js";import"./Terminal-DmwCXCux.js";import"./monaco-editor-Y-NWUHaI.js";import"./spinner-BGNFnmXu.js";import"./alert-dialog-IBFLzL1S.js";import"./File06-BXoByNkx.js";import"./InfoCircle-DrzBjG0U.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-D5qtjx0n.js";import"./auth-ClQTpskF.js";import"./useQuery-BDFKN3rX.js";import"./select-DbMbYBva.js";import"./ChevronDown-DLHFQDss.js";import"./use-mobile-BtDidYAZ.js";const rr=({size:e=24,color:t="currentColor",...n})=>z.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},z.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));rr.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var wa={value:()=>{}};function jt(){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 Et(n)}function Et(e){this._=e}function va(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}})}Et.prototype=jt.prototype={constructor:Et,on:function(e,t){var n=this._,o=va(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=_a(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=no(n[r],e.name,t);else if(t==null)for(r in n)n[r]=no(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 Et(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[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,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function _a(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function no(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=wa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var un="http://www.w3.org/1999/xhtml";const oo={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oo.hasOwnProperty(t)?{space:oo[t],local:e}:e}function ba(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===un&&t.documentElement.namespaceURI===un?t.createElement(e):t.createElementNS(n,e)}}function Sa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Vt(e);return(t.local?Sa:ba)(t)}function Ea(){}function Sn(e){return e==null?Ea:function(){return this.querySelector(e)}}function Ca(e){typeof e!="function"&&(e=Sn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new de(o,this._parents)}function Na(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ma(){return[]}function sr(e){return e==null?Ma:function(){return this.querySelectorAll(e)}}function Ia(e){return function(){return Na(e.apply(this,arguments))}}function ka(e){typeof e=="function"?e=Ia(e):e=sr(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new de(o,r)}function ar(e){return function(){return this.matches(e)}}function cr(e){return function(t){return t.matches(e)}}var Pa=Array.prototype.find;function Aa(e){return function(){return Pa.call(this.children,e)}}function Ta(){return this.firstElementChild}function Da(e){return this.select(e==null?Ta:Aa(typeof e=="function"?e:cr(e)))}var $a=Array.prototype.filter;function za(){return Array.from(this.children)}function La(e){return function(){return $a.call(this.children,e)}}function Ha(e){return this.selectAll(e==null?za:La(typeof e=="function"?e:cr(e)))}function Ra(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new de(o,this._parents)}function lr(e){return new Array(e.length)}function ja(){return new de(this._enter||this._groups.map(lr),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 Va(e){return function(){return e}}function Oa(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function Ba(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,f=s.length,d=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(d[a]=p=i.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<f;++a)p=i.call(e,s[a],a,s)+"",(l=c.get(p))?(o[a]=l,l.__data__=s[a],c.delete(p)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Fa(e){return e.__data__}function Ya(e,t){if(!arguments.length)return Array.from(this,Fa);var n=t?Ba:Oa,o=this._parents,r=this._groups;typeof e!="function"&&(e=Va(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],f=r[c],d=f.length,p=Xa(e.call(u,u&&u.__data__,c,o)),h=p.length,w=a[c]=new Array(h),v=i[c]=new Array(h),m=l[c]=new Array(d);n(u,f,w,v,m,p,t);for(var b=0,g=0,x,N;b<h;++b)if(x=w[b]){for(b>=g&&(g=b+1);!(N=v[g])&&++g<h;);x._next=N||null}}return i=new de(i,o),i._enter=a,i._exit=l,i}function Xa(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Za(){return new de(this._exit||this._groups.map(lr),this._parents)}function Ga(e,t,n){var o=this.enter(),r=this,s=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?s.remove():n(s),o&&r?o.merge(r).order():r}function Wa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||u[h])&&(d[h]=p);for(;l<r;++l)a[l]=n[l];return new de(a,this._parents)}function qa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ka(e){e||(e=Ua);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new de(r,this._parents).order()}function Ua(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ja(){return Array.from(this)}function ec(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function tc(){let e=0;for(const t of this)++e;return e}function nc(){return!this.node()}function oc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function rc(e){return function(){this.removeAttribute(e)}}function ic(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sc(e,t){return function(){this.setAttribute(e,t)}}function ac(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lc(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 uc(e,t){var n=Vt(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?ic:rc:typeof t=="function"?n.local?lc:cc:n.local?ac:sc)(n,t))}function ur(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function dc(e){return function(){this.style.removeProperty(e)}}function fc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function hc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function gc(e,t,n){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?hc:fc)(e,t,n??"")):Be(this.node(),e)}function Be(e,t){return e.style.getPropertyValue(t)||ur(e).getComputedStyle(e,null).getPropertyValue(t)}function pc(e){return function(){delete this[e]}}function mc(e,t){return function(){this[e]=t}}function yc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xc(e,t){return arguments.length>1?this.each((t==null?pc:typeof t=="function"?yc:mc)(e,t)):this.node()[e]}function dr(e){return e.trim().split(/^|\s+/)}function En(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=dr(e.getAttribute("class")||"")}fr.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 hr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function gr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function wc(e){return function(){hr(this,e)}}function vc(e){return function(){gr(this,e)}}function _c(e,t){return function(){(t.apply(this,arguments)?hr:gr)(this,e)}}function bc(e,t){var n=dr(e+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?_c:t?wc:vc)(n,t))}function Sc(){this.textContent=""}function Ec(e){return function(){this.textContent=e}}function Cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Nc(e){return arguments.length?this.each(e==null?Sc:(typeof e=="function"?Cc:Ec)(e)):this.node().textContent}function Mc(){this.innerHTML=""}function Ic(e){return function(){this.innerHTML=e}}function kc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pc(e){return arguments.length?this.each(e==null?Mc:(typeof e=="function"?kc:Ic)(e)):this.node().innerHTML}function Ac(){this.nextSibling&&this.parentNode.appendChild(this)}function Tc(){return this.each(Ac)}function Dc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(Dc)}function zc(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lc(){return null}function Hc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?Lc:typeof t=="function"?t:Sn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Rc(){var e=this.parentNode;e&&e.removeChild(this)}function jc(){return this.each(Rc)}function Vc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(e){return this.select(e?Oc:Vc)}function Fc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(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 Zc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Gc(e,t,n){return function(){var o=this.__on,r,s=Yc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Wc(e,t,n){var o=Xc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Gc:Zc,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function pr(e,t,n){var o=ur(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 qc(e,t){return function(){return pr(this,e,t)}}function Kc(e,t){return function(){return pr(this,e,t.apply(this,arguments))}}function Uc(e,t){return this.each((typeof t=="function"?Kc:qc)(e,t))}function*Qc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var mr=[null];function de(e,t){this._groups=e,this._parents=t}function ut(){return new de([[document.documentElement]],mr)}function Jc(){return this}de.prototype=ut.prototype={constructor:de,select:Ca,selectAll:ka,selectChild:Da,selectChildren:Ha,filter:Ra,data:Ya,enter:ja,exit:Za,join:Ga,merge:Wa,selection:Jc,order:qa,sort:Ka,call:Qa,nodes:Ja,node:ec,size:tc,empty:nc,each:oc,attr:uc,style:gc,property:xc,classed:bc,text:Nc,html:Pc,raise:Tc,lower:$c,append:zc,insert:Hc,remove:jc,clone:Bc,datum:Fc,on:Wc,dispatch:Uc,[Symbol.iterator]:Qc};function ue(e){return typeof e=="string"?new de([[document.querySelector(e)]],[document.documentElement]):new de([[e]],mr)}function el(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ge(e,t){if(e=el(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 tl={passive:!1},ot={capture:!0,passive:!1};function nn(e){e.stopImmediatePropagation()}function Oe(e){e.preventDefault(),e.stopImmediatePropagation()}function yr(e){var t=e.document.documentElement,n=ue(e).on("dragstart.drag",Oe,ot);"onselectstart"in t?n.on("selectstart.drag",Oe,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xr(e,t){var n=e.document.documentElement,o=ue(e).on("dragstart.drag",null);t&&(o.on("click.drag",Oe,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 dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function nl(e){return!e.ctrlKey&&!e.button}function ol(){return this.parentNode}function rl(e,t){return t??{x:e.x,y:e.y}}function il(){return navigator.maxTouchPoints||"ontouchstart"in this}function wr(){var e=nl,t=ol,n=rl,o=il,r={},s=jt("start","drag","end"),i=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,tl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,N){if(!(u||!e.call(this,x,N))){var E=g(this,t.call(this,x,N),x,N,"mouse");E&&(ue(x.view).on("mousemove.drag",h,ot).on("mouseup.drag",w,ot),yr(x.view),nn(x),c=!1,a=x.clientX,l=x.clientY,E("start",x))}}function h(x){if(Oe(x),!c){var N=x.clientX-a,E=x.clientY-l;c=N*N+E*E>f}r.mouse("drag",x)}function w(x){ue(x.view).on("mousemove.drag mouseup.drag",null),xr(x.view,c),Oe(x),r.mouse("end",x)}function v(x,N){if(e.call(this,x,N)){var E=x.changedTouches,C=t.call(this,x,N),D=E.length,k,V;for(k=0;k<D;++k)(V=g(this,C,x,N,E[k].identifier,E[k]))&&(nn(x),V("start",x,E[k]))}}function m(x){var N=x.changedTouches,E=N.length,C,D;for(C=0;C<E;++C)(D=r[N[C].identifier])&&(Oe(x),D("drag",x,N[C]))}function b(x){var N=x.changedTouches,E=N.length,C,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<E;++C)(D=r[N[C].identifier])&&(nn(x),D("end",x,N[C]))}function g(x,N,E,C,D,k){var V=s.copy(),P=ge(k||E,N),$,L,y;if((y=n.call(x,new dn("beforestart",{sourceEvent:E,target:d,identifier:D,active:i,x:P[0],y:P[1],dx:0,dy:0,dispatch:V}),C))!=null)return $=y.x-P[0]||0,L=y.y-P[1]||0,function I(S,A,M){var T=P,H;switch(S){case"start":r[D]=I,H=i++;break;case"end":delete r[D],--i;case"drag":P=ge(M||A,N),H=i;break}V.call(S,x,new dn(S,{sourceEvent:A,subject:y,target:d,identifier:D,active:H,x:P[0]+$,y:P[1]+L,dx:P[0]-T[0],dy:P[1]-T[1],dispatch:V}),C)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:mt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:mt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:mt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:mt(!!x),d):o},d.on=function(){var x=s.on.apply(s,arguments);return x===s?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var ro=180/Math.PI,fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(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,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(l)*ro,scaleX:i,scaleY:a}}var yt;function sl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fn:vr(t.a,t.b,t.c,t.d,t.e,t.f)}function al(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?fn:(e=e.matrix,vr(e.a,e.b,e.c,e.d,e.e,e.f))}function _r(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push("translate(",null,t,null,n);h.push({i:w-4,x:Ae(c,f)},{i:w-2,x:Ae(u,d)})}else(f||d)&&p.push("translate("+f+t+d+n)}function i(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Ae(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Ae(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push(r(p)+"scale(",null,",",null,")");h.push({i:w-4,x:Ae(c,f)},{i:w-2,x:Ae(u,d)})}else(f!==1||d!==1)&&p.push(r(p)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,d),i(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(p){for(var h=-1,w=d.length,v;++h<w;)f[(v=d[h]).i]=v.x(p);return f.join("")}}}var cl=_r(sl,"px, ","px)","deg)"),ll=_r(al,", ",")",")"),ul=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function dl(e){return((e=Math.exp(e))-1/e)/2}function fl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ct=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],f=i[1],d=i[2],p=u-a,h=f-l,w=p*p+h*h,v,m;if(w<ul)m=Math.log(d/c)/t,v=function(C){return[a+C*p,l+C*h,c*Math.exp(t*C*m)]};else{var b=Math.sqrt(w),g=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),N=Math.log(Math.sqrt(g*g+1)-g),E=Math.log(Math.sqrt(x*x+1)-x);m=(E-N)/t,v=function(C){var D=C*m,k=io(N),V=c/(n*b)*(k*fl(t*D+N)-dl(N));return[a+V*p,l+V*h,c*k/io(t*D+N)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Fe=0,Je=0,Ue=0,br=1e3,Pt,et,At=0,$e=0,Ot=0,rt=typeof performance=="object"&&performance.now?performance:Date,Sr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cn(){return $e||(Sr(hl),$e=rt.now()+Ot)}function hl(){$e=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=Er.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:Pt=this,et=this),this._call=e,this._time=n,hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,hn())}};function Er(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function gl(){Cn(),++Fe;for(var e=Pt,t;e;)(t=$e-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fe}function so(){$e=(At=rt.now())+Ot,Fe=Je=0;try{gl()}finally{Fe=0,ml(),$e=0}}function pl(){var e=rt.now(),t=e-At;t>br&&(Ot-=t,At=e)}function ml(){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,hn(o)}function hn(e){if(!Fe){Je&&(Je=clearTimeout(Je));var t=e-$e;t>24?(e<1/0&&(Je=setTimeout(so,e-rt.now()-Ot)),Ue&&(Ue=clearInterval(Ue))):(Ue||(At=rt.now(),Ue=setInterval(pl,br)),Fe=1,Sr(so))}}function ao(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 yl=jt("start","end","cancel","interrupt"),xl=[],Cr=0,co=1,gn=2,Nt=3,lo=4,pn=5,Mt=6;function Bt(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;wl(e,n,{name:t,index:o,group:r,on:yl,tween:xl,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Cr})}function Nn(e,t){var n=ye(e,t);if(n.state>Cr)throw new Error("too late; already scheduled");return n}function ve(e,t){var n=ye(e,t);if(n.state>Nt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function wl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(s,0,n.time);function s(c){n.state=co,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,f,d,p;if(n.state!==co)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Nt)return ao(i);p.state===lo?(p.state=Mt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=Mt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(ao(function(){n.state===Nt&&(n.state=lo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=gn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===gn){for(n.state=Nt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=pn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===pn&&(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,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>gn&&o.state<pn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function vl(e){return this.each(function(){It(this,e)})}function _l(e,t){var n,o;return function(){var r=ve(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function bl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=ve(this,e),i=s.tween;if(i!==o){r=(o=i).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)}s.tween=r}}function Sl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?_l:bl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=ve(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function Nr(e,t){var n;return(typeof t=="number"?Ae:t instanceof eo?Jn:(n=eo(t))?(t=n,Jn):ya)(e,t)}function El(e){return function(){this.removeAttribute(e)}}function Cl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Nl(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function Ml(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function Il(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function kl(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Pl(e,t){var n=Vt(e),o=n==="transform"?ll:Nr;return this.attrTween(e,typeof t=="function"?(n.local?kl:Il)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?Cl:El)(n):(n.local?Ml:Nl)(n,o,t))}function Al(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Tl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Dl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Tl(e,s)),n}return r._value=t,r}function $l(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Al(e,s)),n}return r._value=t,r}function zl(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=Vt(e);return this.tween(n,(o.local?Dl:$l)(o,t))}function Ll(e,t){return function(){Nn(this,e).delay=+t.apply(this,arguments)}}function Hl(e,t){return t=+t,function(){Nn(this,e).delay=t}}function Rl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ll:Hl)(t,e)):ye(this.node(),t).delay}function jl(e,t){return function(){ve(this,e).duration=+t.apply(this,arguments)}}function Vl(e,t){return t=+t,function(){ve(this,e).duration=t}}function Ol(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jl:Vl)(t,e)):ye(this.node(),t).duration}function Bl(e,t){if(typeof t!="function")throw new Error;return function(){ve(this,e).ease=t}}function Fl(e){var t=this._id;return arguments.length?this.each(Bl(t,e)):ye(this.node(),t).ease}function Yl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ve(this,e).ease=n}}function Xl(e){if(typeof e!="function")throw new Error;return this.each(Yl(this._id,e))}function Zl(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Ee(o,this._parents,this._name,this._id)}function Gl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,f=i[a]=new Array(u),d,p=0;p<u;++p)(d=l[p]||c[p])&&(f[p]=d);for(;a<o;++a)i[a]=t[a];return new Ee(i,this._parents,this._name,this._id)}function Wl(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 ql(e,t,n){var o,r,s=Wl(t)?Nn:ve;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Kl(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(ql(n,e,t))}function Ul(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ql(){return this.on("end.remove",Ul(this._id))}function Jl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sn(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Bt(c[d],t,n,d,c,ye(u,n)));return new Ee(s,this._parents,t,n)}function eu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sr(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),p,h=ye(u,n),w=0,v=d.length;w<v;++w)(p=d[w])&&Bt(p,t,n,w,d,h);s.push(d),i.push(u)}return new Ee(s,i,t,n)}var tu=ut.prototype.constructor;function nu(){return new tu(this._groups,this._parents)}function ou(e,t){var n,o,r;return function(){var s=Be(this,e),i=(this.style.removeProperty(e),Be(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Mr(e){return function(){this.style.removeProperty(e)}}function ru(e,t,n){var o,r=n+"",s;return function(){var i=Be(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function iu(e,t,n){var o,r,s;return function(){var i=Be(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Be(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function su(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=ve(this,e),c=l.on,u=l.value[s]==null?a||(a=Mr(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function au(e,t,n){var o=(e+="")=="transform"?cl:Nr;return t==null?this.styleTween(e,ou(e,o)).on("end.style."+e,Mr(e)):typeof t=="function"?this.styleTween(e,iu(e,o,Mn(this,"style."+e,t))).each(su(this._id,e)):this.styleTween(e,ru(e,o,t),n).on("end.style."+e,null)}function cu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function lu(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&cu(e,i,n)),o}return s._value=t,s}function uu(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,lu(e,t,n??""))}function du(e){return function(){this.textContent=e}}function fu(e){return function(){var t=e(this);this.textContent=t??""}}function hu(e){return this.tween("text",typeof e=="function"?fu(Mn(this,"text",e)):du(e==null?"":e+""))}function gu(e){return function(t){this.textContent=e.call(this,t)}}function pu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&gu(r)),t}return o._value=e,o}function mu(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,pu(e))}function yu(){for(var e=this._name,t=this._id,n=Ir(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=ye(l,t);Bt(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ee(o,this._parents,e,n)}function xu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=ve(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var wu=0;function Ee(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ir(){return++wu}var be=ut.prototype;Ee.prototype={constructor:Ee,select:Jl,selectAll:eu,selectChild:be.selectChild,selectChildren:be.selectChildren,filter:Zl,merge:Gl,selection:nu,transition:yu,call:be.call,nodes:be.nodes,node:be.node,size:be.size,empty:be.empty,each:be.each,on:Kl,attr:Pl,attrTween:zl,style:au,styleTween:uu,text:hu,textTween:mu,remove:Ql,tween:Sl,delay:Rl,duration:Ol,ease:Fl,easeVarying:Xl,end:xu,[Symbol.iterator]:be[Symbol.iterator]};function vu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _u={time:null,delay:0,duration:250,ease:vu};function bu(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 Su(e){var t,n;e instanceof Ee?(t=e._id,e=e._name):(t=Ir(),(n=_u).time=Cn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Bt(l,e,t,c,i,n||bu(l,t));return new Ee(o,this._parents,e,t)}ut.prototype.interrupt=vl;ut.prototype.transition=Su;const xt=e=>()=>e;function Eu(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 Se(e,t,n){this.k=e,this.x=t,this.y=n}Se.prototype={constructor:Se,scale:function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ft=new Se(1,0,0);kr.prototype=Se.prototype;function kr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ft;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Cu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Nu(){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 uo(){return this.__zoom||Ft}function Mu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Iu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ku(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Pr(){var e=Cu,t=Nu,n=ku,o=Mu,r=Iu,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ct,c=jt("start","zoom","end"),u,f,d,p=500,h=150,w=0,v=10;function m(y){y.property("__zoom",uo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,I,S,A){var M=y.selection?y.selection():y;M.property("__zoom",uo),y!==M?N(y,I,S,A):M.interrupt().each(function(){E(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(y,I,S,A){m.scaleTo(y,function(){var M=this.__zoom.k,T=typeof I=="function"?I.apply(this,arguments):I;return M*T},S,A)},m.scaleTo=function(y,I,S,A){m.transform(y,function(){var M=t.apply(this,arguments),T=this.__zoom,H=S==null?x(M):typeof S=="function"?S.apply(this,arguments):S,j=T.invert(H),R=typeof I=="function"?I.apply(this,arguments):I;return n(g(b(T,R),H,j),M,i)},S,A)},m.translateBy=function(y,I,S,A){m.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),i)},null,A)},m.translateTo=function(y,I,S,A,M){m.transform(y,function(){var T=t.apply(this,arguments),H=this.__zoom,j=A==null?x(T):typeof A=="function"?A.apply(this,arguments):A;return n(Ft.translate(j[0],j[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof S=="function"?-S.apply(this,arguments):-S),T,i)},A,M)};function b(y,I){return I=Math.max(s[0],Math.min(s[1],I)),I===y.k?y:new Se(I,y.x,y.y)}function g(y,I,S){var A=I[0]-S[0]*y.k,M=I[1]-S[1]*y.k;return A===y.x&&M===y.y?y:new Se(y.k,A,M)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,S,A){y.on("start.zoom",function(){E(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(A).end()}).tween("zoom",function(){var M=this,T=arguments,H=E(M,T).event(A),j=t.apply(M,T),R=S==null?x(j):typeof S=="function"?S.apply(M,T):S,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=M.__zoom,G=typeof I=="function"?I.apply(M,T):I,Q=l(B.invert(R).concat(F/B.k),G.invert(R).concat(F/G.k));return function(Z){if(Z===1)Z=G;else{var O=Q(Z),Y=F/O[2];Z=new Se(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}H.zoom(null,Z)}})}function E(y,I,S){return!S&&y.__zooming||new C(y,I)}function C(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="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(y){var I=ue(this.that).datum();c.call(y,this.that,new Eu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),I)}};function D(y,...I){if(!e.apply(this,arguments))return;var S=E(this,I).event(y),A=this.__zoom,M=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=ge(y);if(S.wheel)(S.mouse[0][0]!==T[0]||S.mouse[0][1]!==T[1])&&(S.mouse[1]=A.invert(S.mouse[0]=T)),clearTimeout(S.wheel);else{if(A.k===M)return;S.mouse=[T,A.invert(T)],It(this),S.start()}Qe(y),S.wheel=setTimeout(H,h),S.zoom("mouse",n(g(b(A,M),S.mouse[0],S.mouse[1]),S.extent,i));function H(){S.wheel=null,S.end()}}function k(y,...I){if(d||!e.apply(this,arguments))return;var S=y.currentTarget,A=E(this,I,!0).event(y),M=ue(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=ge(y,S),H=y.clientX,j=y.clientY;yr(y.view),on(y),A.mouse=[T,this.__zoom.invert(T)],It(this),A.start();function R(B){if(Qe(B),!A.moved){var G=B.clientX-H,Q=B.clientY-j;A.moved=G*G+Q*Q>w}A.event(B).zoom("mouse",n(g(A.that.__zoom,A.mouse[0]=ge(B,S),A.mouse[1]),A.extent,i))}function F(B){M.on("mousemove.zoom mouseup.zoom",null),xr(B.view,A.moved),Qe(B),A.event(B).end()}}function V(y,...I){if(e.apply(this,arguments)){var S=this.__zoom,A=ge(y.changedTouches?y.changedTouches[0]:y,this),M=S.invert(A),T=S.k*(y.shiftKey?.5:2),H=n(g(b(S,T),A,M),t.apply(this,I),i);Qe(y),a>0?ue(this).transition().duration(a).call(N,H,A,y):ue(this).call(m.transform,H,A,y)}}function P(y,...I){if(e.apply(this,arguments)){var S=y.touches,A=S.length,M=E(this,I,y.changedTouches.length===A).event(y),T,H,j,R;for(on(y),H=0;H<A;++H)j=S[H],R=ge(j,this),R=[R,this.__zoom.invert(R),j.identifier],M.touch0?!M.touch1&&M.touch0[2]!==R[2]&&(M.touch1=R,M.taps=0):(M.touch0=R,T=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(M.taps<2&&(f=R[0],u=setTimeout(function(){u=null},p)),It(this),M.start())}}function $(y,...I){if(this.__zooming){var S=E(this,I).event(y),A=y.changedTouches,M=A.length,T,H,j,R;for(Qe(y),T=0;T<M;++T)H=A[T],j=ge(H,this),S.touch0&&S.touch0[2]===H.identifier?S.touch0[0]=j:S.touch1&&S.touch1[2]===H.identifier&&(S.touch1[0]=j);if(H=S.that.__zoom,S.touch1){var F=S.touch0[0],B=S.touch0[1],G=S.touch1[0],Q=S.touch1[1],Z=(Z=G[0]-F[0])*Z+(Z=G[1]-F[1])*Z,O=(O=Q[0]-B[0])*O+(O=Q[1]-B[1])*O;H=b(H,Math.sqrt(Z/O)),j=[(F[0]+G[0])/2,(F[1]+G[1])/2],R=[(B[0]+Q[0])/2,(B[1]+Q[1])/2]}else if(S.touch0)j=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(g(H,j,R),S.extent,i))}}function L(y,...I){if(this.__zooming){var S=E(this,I).event(y),A=y.changedTouches,M=A.length,T,H;for(on(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),T=0;T<M;++T)H=A[T],S.touch0&&S.touch0[2]===H.identifier?delete S.touch0:S.touch1&&S.touch1[2]===H.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(H=ge(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<v)){var j=ue(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:xt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:xt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:xt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:xt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],m):[s[0],s[1]]},m.translateExtent=function(y){return arguments.length?(i[0][0]=+y[0][0],i[1][0]=+y[1][0],i[0][1]=+y[0][1],i[1][1]=+y[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(l=y,m):l},m.on=function(){var y=c.on.apply(c,arguments);return y===c?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(v=+y,m):v},m}const we={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]],Ar=["Enter"," ","Escape"],Tr={"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 Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));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 fo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function $r(e){return e===null?null:e?"valid":"invalid"}const zr=e=>"id"in e&&"source"in e&&"target"in e,Pu=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}=Ce(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Au=(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 s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?$t(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yt(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=Yt(n,$t(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!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:u,selectable:f=!0,hidden:d=!1}=c;if(i&&!f||d)continue;const p=u.width??c.width??c.initialWidth??null,h=u.height??c.height??c.initialHeight??null,w=at(a,Ze(c)),v=(p??0)*(h??0),m=s&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},Tu=(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 Du(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 $u({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Du(e,i),l=ft(a),c=Pn(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",we.error005());else{const p=a.measured.width,h=a.measured.height;p&&h&&(f=[[l,c],[l+p,c+h]])}else a&&Ge(i.extent)&&(f=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const d=Ge(f)?ze(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",we.error015()),{position:{x:d.x-l+(i.measured.width??0)*u[0],y:d.y-c+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function zu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const p=s.has(d.id),h=!p&&d.parentId&&i.find(w=>w.id===d.parentId);(p||h)&&i.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Tu(i,l);for(const d of l)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Xe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ze=(e={x:0,y:0},t,n)=>({x:Xe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Xe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hr(e,t,n){const{width:o,height:r}=Ce(n),{x:s,y:i}=n.internals.positionAbsolute;return ze(e,[[s,i],[s+o,i+r]],t)}const ho=(e,t,n)=>e<t?Xe(Math.abs(e-t),1,t)/t:e>n?-Xe(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>{const r=ho(e.x,o,t.width-o)*n,s=ho(e.y,o,t.height-o)*n;return[r,s]},Yt=(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)}),mn=({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}),Ze=(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}},$t=(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)}},jr=(e,t)=>Xt(Yt(mn(e),mn(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)},go=e=>pe(e.width)&&pe(e.height)&&pe(e.x)&&pe(e.y),pe=e=>!isNaN(e)&&isFinite(e),Lu=(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],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},zt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Re(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 Hu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Re(e,n),r=Re(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Re(e.top??e.y??0,n),r=Re(e.bottom??e.y??0,n),s=Re(e.left??e.x??0,t),i=Re(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ru(e,t,n,o,r,s){const{x:i,y:a}=zt(e,[t,n,o]),{x:l,y:c}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Pn=(e,t,n,o,r,s)=>{const i=Hu(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=Xe(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=Ru(e,p,h,u,t,n),v={left:Math.min(w.left-i.left,0),top:Math.min(w.top-i.top,0),right:Math.min(w.right-i.right,0),bottom:Math.min(w.bottom-i.bottom,0)};return{x:p-v.left+v.right,y:h-v.top+v.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ge(e){return e!=null&&e!=="parent"}function Ce(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Vr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Or(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ju(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Vu(e){return{...Tr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=me(e),a=gt({x:s-(r?.left??0),y:i-(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}),Br=e=>e?.getRootNode?.()||window?.document,Ou=["INPUT","SELECT","TEXTAREA"];function Fr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ou.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Yr=e=>"clientX"in e,me=(e,t)=>{const n=Yr(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)}},mo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...An(i)}})};function Xr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case X.Left:return[t-wt(t-o,s),n];case X.Right:return[t+wt(o-t,s),n];case X.Top:return[t,n-wt(n-r,s)];case X.Bottom:return[t,n+wt(r-n,s)]}}function Zr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,curvature:i=.25}){const[a,l]=yo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=yo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,p,h]=Xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,p,h]}function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Bu({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=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 i+a}function Fu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Yt($t(e),$t(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Xt(s))>0}const Yu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Xu=(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)),Zu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Yu;let r;return zr(e)?r={...e}:r={...e,id:o(e)},Xu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Wr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Gr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const xo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Gu=({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},wo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wu({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:s,stepPosition:i}){const a=xo[t],l=xo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},f=Gu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d];let h=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,g,x]=Gr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const E=[{x:w,y:c.y},{x:w,y:u.y}],C=[{x:c.x,y:v},{x:u.x,y:v}];a[d]===p?h=d==="x"?E:C:h=d==="x"?C:E}else{const E=[{x:c.x,y:u.y}],C=[{x:u.x,y:c.y}];if(d==="x"?h=a.x===p?C:E:h=a.y===p?E:C,t===o){const $=Math.abs(e[d]-n[d]);if($<=s){const L=Math.min(s-1,s-$);a[d]===p?m[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const $=d==="x"?"y":"x",L=a[d]===l[$],y=c[$]>u[$],I=c[$]<u[$];(a[d]===1&&(!L&&y||L&&I)||a[d]!==1&&(!L&&I||L&&y))&&(h=d==="x"?E:C)}const D={x:c.x+m.x,y:c.y+m.y},k={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(D.x-h[0].x),Math.abs(k.x-h[0].x)),P=Math.max(Math.abs(D.y-h[0].y),Math.abs(k.y-h[0].y));V>=P?(w=(D.x+k.x)/2,v=h[0].y):(w=h[0].x,v=(D.y+k.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:u.x+b.x,y:u.y+b.y},n],w,v,g,x]}function qu(e,t,n,o){const r=Math.min(wo(e,t)/2,wo(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function yn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,p,h,w]=Wu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((m,b,g)=>{let x="";return g>0&&g<f.length-1?x=qu(f[g-1],b,f[g+1],i):x=`${g===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),d,p,h,w]}function vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ku(e){const{sourceNode:t,targetNode:n}=e;if(!vo(t)||!vo(n))return null;const o=t.internals.handleBounds||_o(t.handles),r=n.internals.handleBounds||_o(n.handles),s=bo(o?.source??[],e.sourceHandle),i=bo(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",we.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||X.Bottom,l=i?.position||X.Top,c=Le(t,s,a),u=Le(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function _o(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 Le(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ce(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case X.Top:return{x:r+i/2,y:s};case X.Right:return{x:r+i,y:s+a/2};case X.Bottom:return{x:r+i/2,y:s+a};case X.Left:return{x:r,y:s+a/2}}}function bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function xn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Uu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=xn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const qr=1e3,Qu=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ju={...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 ed(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)zn(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=Ge(r.extent)?r.extent:o.nodeExtent,a=ze(s,i,Ce(r));r.internals.positionAbsolute=a}}function td(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={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(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function $n(e){return e==="manual"}function wn(e,t,n,o={}){const r=Dn(Ju,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!$n(r.zIndexMode)?qr:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=dt(c,r.nodeOrigin),d=Ge(c.extent)?c.extent:r.nodeExtent,p=ze(f,d,Ce(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:p,handleBounds:td(c,u),z:Kr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&zn(u,t,n,o,s)}return l}function nd(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 zn(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}nd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Qu),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!$n(l)?qr:0,{x:d,y:p,z:h}=od(e,u,i,a,f,l),{positionAbsolute:w}=e.internals,v=d!==w.x||p!==w.y;(v||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:p}:w,z:h}})}function Kr(e,t,n){const o=pe(e.zIndex)?e.zIndex:0;return $n(n)?o:o+(e.selected?t:0)}function od(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ce(e),c=dt(e,n),u=Ge(e.extent)?ze(c,e.extent,l):c;let f=ze({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Hr(f,l,t));const d=Kr(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function Ln(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??Ze(a),c=jr(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ce(a),f=a.origin??o,d=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,p=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,h=Math.max(u.width,Math.round(i.width)),w=Math.max(u.height,Math.round(i.height)),v=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+v,y:a.position.y-p+m}}),n.get(l)?.forEach(b=>{e.some(g=>g.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+p}})})),(u.width<i.width||u.height<i.height||d||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-v:0),height:w+(p?f[1]*p-m:0)}})}),r}function rd(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const p of e.values()){const h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const w=An(p.nodeElement),v=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!h.internals.handleBounds||p.force))){const b=p.nodeElement.getBoundingClientRect(),g=Ge(h.extent)?h.extent:s;let{positionAbsolute:x}=h.internals;h.parentId&&h.extent==="parent"?x=Hr(x,w,t.get(h.parentId)):g&&(x=ze(x,g,w));const N={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:mo("source",p.nodeElement,b,f,h.id),target:mo("target",p.nodeElement,b,f,h.id)}}};t.set(h.id,N),h.parentId&&zn(N,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Ze(N,r)}))}}if(d.length>0){const p=Ln(d,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function id({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function So(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function Ur(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;So("source",l,u,e,r,i),So("target",l,c,e,s,a),t.set(o.id,o)}}function Qr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Qr(n,t):!1}function Eo(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 sd(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Qr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,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 rn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function ad({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function cd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function v({noDragClassName:b,handleSelector:g,domNode:x,isSelectable:N,nodeId:E,nodeClickDistance:C=0}){d=ue(x);function D({x:$,y:L}){const{nodeLookup:y,nodeExtent:I,snapGrid:S,snapToGrid:A,nodeOrigin:M,onNodeDrag:T,onSelectionDrag:H,onError:j,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,G=B&&I?mn(ft(a)):null,Q=B&&A?ad({dragItems:a,snapGrid:S,x:$,y:L}):null;for(const[Z,O]of a){if(!y.has(Z))continue;let Y={x:$-O.distance.x,y:L-O.distance.y};A&&(Y=Q?{x:Math.round(Y.x+Q.x),y:Math.round(Y.y+Q.y)}:ht(Y,S));let U=null;if(B&&I&&!O.extent&&G){const{positionAbsolute:q}=O.internals,J=q.x-G.x+I[0][0],ne=q.x+O.measured.width-G.x2+I[1][0],te=q.y-G.y+I[0][1],se=q.y+O.measured.height-G.y2+I[1][1];U=[[J,te],[ne,se]]}const{position:K,positionAbsolute:W}=Lr({nodeId:Z,nextPosition:Y,nodeLookup:y,nodeExtent:U||I,nodeOrigin:M,onError:j});F=F||O.position.x!==K.x||O.position.y!==K.y,O.position=K,O.internals.positionAbsolute=W}if(h=h||F,!!F&&(R(a,!0),w&&(o||T||!E&&H))){const[Z,O]=rn({nodeId:E,dragItems:a,nodeLookup:y});o?.(w,a,Z,O),T?.(w,Z,O),E||H?.(w,O)}}async function k(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(i);return}const[S,A]=Rr(c,u,y);(S!==0||A!==0)&&(s.x=(s.x??0)-S/$[2],s.y=(s.y??0)-A/$[2],await L({x:S,y:A})&&D(s)),i=requestAnimationFrame(k)}function V($){const{nodeLookup:L,multiSelectionActive:y,nodesDraggable:I,transform:S,snapGrid:A,snapToGrid:M,selectNodesOnDrag:T,onNodeDragStart:H,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!T||!N)&&!y&&E&&(L.get(E)?.selected||R()),N&&T&&E&&e?.(E);const F=tt($.sourceEvent,{transform:S,snapGrid:A,snapToGrid:M,containerBounds:u});if(s=F,a=sd(L,I,F,E),a.size>0&&(n||H||!E&&j)){const[B,G]=rn({nodeId:E,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,G),H?.($.sourceEvent,B,G),E||j?.($.sourceEvent,G)}}const P=wr().clickDistance(C).on("start",$=>{const{domNode:L,nodeDragThreshold:y,transform:I,snapGrid:S,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,p=!1,h=!1,w=$.sourceEvent,y===0&&V($),s=tt($.sourceEvent,{transform:I,snapGrid:S,snapToGrid:A,containerBounds:u}),c=me($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:y,snapGrid:I,snapToGrid:S,nodeDragThreshold:A,nodeLookup:M}=t(),T=tt($.sourceEvent,{transform:y,snapGrid:I,snapToGrid:S,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!M.has(E))&&(p=!0),!p){if(!l&&L&&f&&(l=!0,k()),!f){const H=me($.sourceEvent,u),j=H.x-c.x,R=H.y-c.y;Math.sqrt(j*j+R*R)>A&&V($)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&f&&(c=me($.sourceEvent,u),D(T))}}).on("end",$=>{if(!(!f||p)&&(l=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:S}=t();if(h&&(y(a,!1),h=!1),r||I||!E&&S){const[A,M]=rn({nodeId:E,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,A,M),I?.($.sourceEvent,A,M),E||S?.($.sourceEvent,M)}}}).filter($=>{const L=$.target;return!$.button&&(!b||!Eo(L,`.${b}`,x))&&(!g||Eo(L,g,x))});d.call(P)}function m(){d?.on(".drag",null)}return{update:v,destroy:m}}function ld(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,Ze(s))>0&&o.push(s);return o}const ud=250;function dd(e,t,n,o){let r=[],s=1/0;const i=ld(e,n,t+ud);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:f}=Le(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...c,x:u,y:f}],s=d):d===s&&r.push({...c,x:u,y:f}))}}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 Jr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Le(i,l,l.position,!0)}:l}function ei(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function fd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ti=()=>!0;function hd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:v,isValidConnection:m=ti,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:N,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:D}){const k=Br(e.target);let V=0,P;const{x:$,y:L}=me(e),y=ei(s,D),I=a?.getBoundingClientRect();let S=!1;if(!I||!y)return;const A=Jr(r,y,o,l,t);if(!A)return;let M=me(e,I),T=!1,H=null,j=!1,R=null;function F(){if(!u||!I)return;const[K,W]=Rr(M,I,E);d({x:K,y:W}),V=requestAnimationFrame(F)}const B={...A,nodeId:r,type:y,position:A.position},G=l.get(r);let Z={inProgress:!0,isValid:null,from:Le(G,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:M,toHandle:null,toPosition:fo[B.position],toNode:null,pointer:M};function O(){S=!0,g(Z),h?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&O();function Y(K){if(!S){const{x:se,y:le}=me(K),oe=se-$,ce=le-L;if(!(oe*oe+ce*ce>C*C))return;O()}if(!N()||!B){U(K);return}const W=x();M=me(K,I),P=dd(gt(M,W,!1,[1,1]),n,l,B),T||(F(),T=!0);const q=ni(K,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:k,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,H=q.connection,j=fd(!!P,q.isValid);const J=l.get(r),ne=J?Le(J,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:j,to:q.toHandle&&j?zt({x:q.toHandle.x,y:q.toHandle.y},W):M,toHandle:q.toHandle,toPosition:j&&q.toHandle?q.toHandle.position:fo[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:M};g(te),Z=te}function U(K){if(!("touches"in K&&K.touches.length>0)){if(S){(P||R)&&H&&j&&w?.(H);const{inProgress:W,...q}=Z,J={...q,toPosition:Z.toHandle?Z.toPosition:null};v?.(K,J),s&&b?.(K,J)}p(),cancelAnimationFrame(V),T=!1,j=!1,H=null,R=null,k.removeEventListener("mousemove",Y),k.removeEventListener("mouseup",U),k.removeEventListener("touchmove",Y),k.removeEventListener("touchend",U)}}k.addEventListener("mousemove",Y),k.addEventListener("mouseup",U),k.addEventListener("touchmove",Y),k.addEventListener("touchend",U)}function ni(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ti,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=me(e),w=i.elementFromPoint(p,h),v=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ei(void 0,v),g=v.getAttribute("data-nodeid"),x=v.getAttribute("data-handleid"),N=v.classList.contains("connectable"),E=v.classList.contains("connectableend");if(!g||!b)return m;const C={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=C;const k=N&&E&&(n===Ye.Strict?f&&b==="source"||!f&&b==="target":g!==o||x!==r);m.isValid=k&&c(C),m.toHandle=Jr(g,b,x,u,n,!0)}return m}const vn={onPointerDown:hd,isValid:ni};function gd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ue(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){const h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),N=g.sourceEvent.ctrlKey&&ct()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,C=x[2]*Math.pow(2,E*N);t.scaleTo(C)};let w=[0,0];const v=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[N[0]-w[0],N[1]-w[1]];w=N;const C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),D={x:x[0]-E[0]*C,y:x[1]-E[1]*C},k=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},k,a)},b=Pr().on("start",v).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:ge}}const Zt=e=>({x:e.x,y:e.y,zoom:e.k}),sn=({x:e,y:t,zoom:n})=>Ft.translate(e,t).scale(n),je=(e,t)=>e.target.closest(`.${t}`),oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,an=(e,t=0,n=pd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ri=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function md({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(je(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=ge(u),m=ri(u),b=f*Math.pow(2,m);o.scaleTo(n,b,v,u);return}const d=u.deltaMode===1?20:1;let p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*s,-(h/f)*s,{internal:!0});const w=Zt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function yd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=je(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function xd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zt(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 wd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&oi(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Zt(s.transform))}}function vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Zt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function _d({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,p=n&&f.ctrlKey,h=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(je(f,`${c}-flow__node`)||je(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!h||je(f,a)&&h||je(f,l)&&(!h||r&&h&&!e)||!n&&f.ctrlKey&&h)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!p&&h||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h)&&w}}function bd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Pr().scaleExtent([t,n]).translateExtent(o),d=ue(e).call(f);b({x:r.x,y:r.y,zoom:Xe(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const p=d.on("wheel.zoom"),h=d.on("dblclick.zoom");f.wheelDelta(ri);function w(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).transform(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function v({noWheelClassName:P,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:y,panOnScroll:I,panOnDrag:S,panOnScrollMode:A,panOnScrollSpeed:M,preventScrolling:T,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:Q,paneClickDistance:Z,selectionOnDrag:O}){y&&!c.isZoomingOrPanning&&m();const Y=I&&!F&&!y;f.clickDistance(O?1/0:!pe(Z)||Z<0?0:Z);const U=Y?md({zoomPanValues:c,noWheelClassName:P,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:M,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):yd({noWheelClassName:P,preventScrolling:T,d3ZoomHandler:p});if(d.on("wheel.zoom",U,{passive:!1}),!y){const W=xd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});f.on("start",W);const q=wd({zoomPanValues:c,panOnDrag:S,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:G});f.on("zoom",q);const J=vd({zoomPanValues:c,panOnDrag:S,panOnScroll:I,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",J)}const K=_d({zoomActivationKeyPressed:F,panOnDrag:S,zoomOnScroll:j,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:y,noPanClassName:$,noWheelClassName:P,lib:B,connectionInProgress:Q});f.filter(K),R?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(P,$,L){const y=sn(P),I=f?.constrain()(y,$,L);return I&&await w(I),new Promise(S=>S(I))}async function g(P,$){const L=sn(P);return await w(L,$),new Promise(y=>y(L))}function x(P){if(d){const $=sn(P),L=d.property("__zoom");(L.k!==P.zoom||L.x!==P.x||L.y!==P.y)&&f?.transform(d,$,null,{sync:!0})}}function N(){const P=d?kr(d.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}function E(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleTo(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function C(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleBy(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function D(P){f?.scaleExtent(P)}function k(P){f?.translateExtent(P)}function V(P){const $=!pe(P)||P<0?0:P;f?.clickDistance($)}return{update:v,destroy:m,setViewport:g,setViewportConstrained:b,getViewport:N,scaleTo:E,scaleBy:C,setScaleExtent:D,setTranslateExtent:k,syncViewport:x,setClickDistance:V}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function Sd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function Co(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 Ne(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function No(e,t){return e?!t:t}function Ed(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:g,y:x,width:N,height:E,aspectRatio:C}=e;let D=Math.floor(u?p-e.pointerX:0),k=Math.floor(f?h-e.pointerY:0);const V=N+(l?-D:D),P=E+(c?-k:k),$=-s[0]*N,L=-s[1]*E;let y=vt(V,w,v),I=vt(P,m,b);if(i){let M=0,T=0;l&&D<0?M=Ne(g+D+$,i[0][0]):!l&&D>0&&(M=Me(g+V+$,i[1][0])),c&&k<0?T=Ne(x+k+L,i[0][1]):!c&&k>0&&(T=Me(x+P+L,i[1][1])),y=Math.max(y,M),I=Math.max(I,T)}if(a){let M=0,T=0;l&&D>0?M=Me(g+D,a[0][0]):!l&&D<0&&(M=Ne(g+V,a[1][0])),c&&k>0?T=Me(x+k,a[0][1]):!c&&k<0&&(T=Ne(x+P,a[1][1])),y=Math.max(y,M),I=Math.max(I,T)}if(r){if(u){const M=vt(V/C,m,b)*C;if(y=Math.max(y,M),i){let T=0;!l&&!c||l&&!c&&d?T=Me(x+L+V/C,i[1][1])*C:T=Ne(x+L+(l?D:-D)/C,i[0][1])*C,y=Math.max(y,T)}if(a){let T=0;!l&&!c||l&&!c&&d?T=Ne(x+V/C,a[1][1])*C:T=Me(x+(l?D:-D)/C,a[0][1])*C,y=Math.max(y,T)}}if(f){const M=vt(P*C,w,v)/C;if(I=Math.max(I,M),i){let T=0;!l&&!c||c&&!l&&d?T=Me(g+P*C+$,i[1][0])/C:T=Ne(g+(c?k:-k)*C+$,i[0][0])/C,I=Math.max(I,T)}if(a){let T=0;!l&&!c||c&&!l&&d?T=Ne(g+P*C,a[1][0])/C:T=Me(g+(c?k:-k)*C,a[0][0])/C,I=Math.max(I,T)}}}k=k+(k<0?I:-I),D=D+(D<0?y:-y),r&&(d?V>P*C?k=(No(l,c)?-D:D)/C:D=(No(l,c)?-k:k)*C:u?(k=D/C,c=l):(D=k*C,l=c));const S=l?g+D:g,A=c?x+k:x;return{width:N+(l?-D:D),height:E+(c?-k:k),x:s[0]*D*(l?-1:1)+S,y:s[1]*k*(c?-1:1)+A}}const ii={width:0,height:0,x:0,y:0},Cd={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Nd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Md(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function Id({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ue(e);let i={controlDirection:Co("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:v}){let m={...ii},b={...Cd};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Co(c)};let g,x=null,N=[],E,C,D,k=!1;const V=wr().on("start",P=>{const{nodeLookup:$,transform:L,snapGrid:y,snapToGrid:I,nodeOrigin:S,paneDomNode:A}=n();if(g=$.get(t),!g)return;x=A?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:T}=tt(P.sourceEvent,{transform:L,snapGrid:y,snapToGrid:I,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},b={...m,pointerX:M,pointerY:T,aspectRatio:m.width/m.height},E=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=$.get(g.parentId),C=E&&g.extent==="parent"?Nd(E):void 0),N=[],D=void 0;for(const[H,j]of $)if(j.parentId===t&&(N.push({id:H,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Md(j,g,j.origin??S);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}p?.(P,{...m})}).on("drag",P=>{const{transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I}=n(),S=tt(P.sourceEvent,{transform:$,snapGrid:L,snapToGrid:y,containerBounds:x}),A=[];if(!g)return;const{x:M,y:T,width:H,height:j}=m,R={},F=g.origin??I,{width:B,height:G,x:Q,y:Z}=Ed(b,i.controlDirection,S,i.boundaries,i.keepAspectRatio,F,C,D),O=B!==H,Y=G!==j,U=Q!==M&&O,K=Z!==T&&Y;if(!U&&!K&&!O&&!Y)return;if((U||K||F[0]===1||F[1]===1)&&(R.x=U?Q:m.x,R.y=K?Z:m.y,m.x=R.x,m.y=R.y,N.length>0)){const ne=Q-M,te=Z-T;for(const se of N)se.position={x:se.position.x-ne+F[0]*(B-H),y:se.position.y-te+F[1]*(G-j)},A.push(se)}if((O||Y)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!i.resizeDirection||i.resizeDirection==="vertical")?G:m.height,m.width=R.width,m.height=R.height),E&&g.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 W=Sd({width:m.width,prevWidth:H,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...m,direction:W};v?.(P,q)!==!1&&(k=!0,h?.(P,q),o(R,A))}).on("end",P=>{k&&(w?.(P,{...m}),r?.({...m}),k=!1)});s.call(V)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const kd={},Mo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(kd?"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},Pd=e=>e?Mo(e):Mo,{useDebugValue:Ad}=Zs,{useSyncExternalStoreWithSelector:Td}=Xs,Dd=e=>e;function si(e,t=Dd,n){const o=Td(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ad(o),o}const Io=(e,t)=>{const n=Pd(e),o=(r,s=t)=>si(n,r,s);return Object.assign(o,n),o},$d=(e,t)=>e?Io(e,t):Io;function re(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 Gt=z.createContext(null),zd=Gt.Provider,ai=we.error001();function ee(e,t){const n=z.useContext(Gt);if(n===null)throw new Error(ai);return si(n,e,t)}function ie(){const e=z.useContext(Gt);if(e===null)throw new Error(ai);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ko={display:"none"},Ld={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ci="react-flow__node-desc",li="react-flow__edge-desc",Hd="react-flow__aria-live",Rd=e=>e.ariaLiveMessage,jd=e=>e.ariaLabelConfig;function Vd({rfId:e}){const t=ee(Rd);return _.jsx("div",{id:`${Hd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ld,children:t})}function Od({rfId:e,disableKeyboardA11y:t}){const n=ee(jd);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ci}-${e}`,style:ko,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${li}-${e}`,style:ko,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Vd,{rfId:e})]})}const Wt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Wt.displayName="Panel";function Bd({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 Fd=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 Yd(e,t){return re(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&re(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Xd({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=ee(Fd,Yd);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Zd=e=>!!e.onSelectionChangeHandlers;function Gd({onSelectionChange:e}){const t=ee(Zd);return e||t?_.jsx(Xd,{onSelectionChange:e}):null}const ui=[0,0],Wd={x:0,y:0,zoom:1},qd=["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"],Po=[...qd,"rfId"],Kd=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}),Ao={translateExtent:it,nodeOrigin:ui,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ud(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=ee(Kd,re),c=ie();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Ao,a()}),[]);const u=z.useRef(Ao);return z.useEffect(()=>{for(const f of Po){const d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:Vu(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Po.map(f=>e[f])),null}function To(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Qd(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=To(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:To()?.matches?"dark":"light"}const Do=typeof document<"u"?document:null;function lt(e=null,t={target:Do,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),s=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
1
|
+
import{r as z,y as Xs,z as Zs,j as _,c as he,h as Rt,i as Ws,a as Gs,t as qn}from"./index-Be5s3BTd.js";import{e as qs,D as Ks,u as Kn,a as Us,b as Qs,c as Js,d as ea,N as ta,C as ge,M as Un,U as na,G as oa,f as ra,T as ia}from"./thread-history-popover-CdgY8TVV.js";import{E as Qn}from"./error-boundary-iei4NFmK.js";import{u as Jo,c as sa,I as er,n as aa}from"./use-connection-BV17GXlx.js";import{u as tr,i as ca}from"./use-gateway-B7sk5BUf.js";import{u as la}from"./use-binding-4jFDqim2.js";import{u as nr,L as ua}from"./localstorage-keys-Cgns4y6c.js";import{u as bn}from"./project-context-provider-BS8o541A.js";import{c as or,B as da}from"./input-D5VmXtXA.js";import{V as fa}from"./view-mode-toggle-BTD72CUu.js";import{i as ha}from"./GitBranch01-Dq29bc0o.js";import{i as ga}from"./Loading01-BhwGtEie.js";import{s as pa}from"./Plus-CUt-llJ2.js";import{u as ma}from"./use-tool-call-CM2oq0rB.js";import{i as Ae,a as Jn,b as ya,c as eo,d as en,T as tn,e as xa}from"./value-8MKGBmon.js";import{G as to}from"./gateway-selector-DrcyKhYX.js";import"./popover-t9-OkADH.js";import"./AlertCircle-CnILn3jx.js";import"./X-DmB-XP-B.js";import"./Grid01-Bdi_lD58.js";import"./textarea-4b5OG-tc.js";import"./ChevronRight-1OHI0CBI.js";import"./Copy01-Uwb56ntU.js";import"./Terminal-OwfTXSIc.js";import"./monaco-editor-BbkOCnUd.js";import"./spinner-BFS4gVsU.js";import"./alert-dialog-CPgX_DbI.js";import"./File06-DExBhm42.js";import"./InfoCircle-BTGq_g6o.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-DvwxBHIe.js";import"./auth-C_7jwlCE.js";import"./useQuery-DdiguCvR.js";import"./select-e4C4SmKq.js";import"./ChevronDown-DTD8t00o.js";import"./use-mobile-D6agNekL.js";const rr=({size:e=24,color:t="currentColor",...n})=>z.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},z.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));rr.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var wa={value:()=>{}};function jt(){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 Et(n)}function Et(e){this._=e}function va(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}})}Et.prototype=jt.prototype={constructor:Et,on:function(e,t){var n=this._,o=va(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=_a(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=no(n[r],e.name,t);else if(t==null)for(r in n)n[r]=no(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 Et(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[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,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function _a(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function no(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=wa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var un="http://www.w3.org/1999/xhtml";const oo={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oo.hasOwnProperty(t)?{space:oo[t],local:e}:e}function ba(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===un&&t.documentElement.namespaceURI===un?t.createElement(e):t.createElementNS(n,e)}}function Sa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Vt(e);return(t.local?Sa:ba)(t)}function Ea(){}function Sn(e){return e==null?Ea:function(){return this.querySelector(e)}}function Ca(e){typeof e!="function"&&(e=Sn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new de(o,this._parents)}function Na(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ma(){return[]}function sr(e){return e==null?Ma:function(){return this.querySelectorAll(e)}}function Ia(e){return function(){return Na(e.apply(this,arguments))}}function ka(e){typeof e=="function"?e=Ia(e):e=sr(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new de(o,r)}function ar(e){return function(){return this.matches(e)}}function cr(e){return function(t){return t.matches(e)}}var Pa=Array.prototype.find;function Aa(e){return function(){return Pa.call(this.children,e)}}function Ta(){return this.firstElementChild}function Da(e){return this.select(e==null?Ta:Aa(typeof e=="function"?e:cr(e)))}var $a=Array.prototype.filter;function za(){return Array.from(this.children)}function La(e){return function(){return $a.call(this.children,e)}}function Ha(e){return this.selectAll(e==null?za:La(typeof e=="function"?e:cr(e)))}function Ra(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new de(o,this._parents)}function lr(e){return new Array(e.length)}function ja(){return new de(this._enter||this._groups.map(lr),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 Va(e){return function(){return e}}function Oa(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function Ba(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,f=s.length,d=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(d[a]=p=i.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<f;++a)p=i.call(e,s[a],a,s)+"",(l=c.get(p))?(o[a]=l,l.__data__=s[a],c.delete(p)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Fa(e){return e.__data__}function Ya(e,t){if(!arguments.length)return Array.from(this,Fa);var n=t?Ba:Oa,o=this._parents,r=this._groups;typeof e!="function"&&(e=Va(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],f=r[c],d=f.length,p=Xa(e.call(u,u&&u.__data__,c,o)),h=p.length,w=a[c]=new Array(h),v=i[c]=new Array(h),m=l[c]=new Array(d);n(u,f,w,v,m,p,t);for(var b=0,g=0,x,M;b<h;++b)if(x=w[b]){for(b>=g&&(g=b+1);!(M=v[g])&&++g<h;);x._next=M||null}}return i=new de(i,o),i._enter=a,i._exit=l,i}function Xa(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Za(){return new de(this._exit||this._groups.map(lr),this._parents)}function Wa(e,t,n){var o=this.enter(),r=this,s=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?s.remove():n(s),o&&r?o.merge(r).order():r}function Ga(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||u[h])&&(d[h]=p);for(;l<r;++l)a[l]=n[l];return new de(a,this._parents)}function qa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ka(e){e||(e=Ua);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new de(r,this._parents).order()}function Ua(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ja(){return Array.from(this)}function ec(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function tc(){let e=0;for(const t of this)++e;return e}function nc(){return!this.node()}function oc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function rc(e){return function(){this.removeAttribute(e)}}function ic(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sc(e,t){return function(){this.setAttribute(e,t)}}function ac(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lc(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 uc(e,t){var n=Vt(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?ic:rc:typeof t=="function"?n.local?lc:cc:n.local?ac:sc)(n,t))}function ur(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function dc(e){return function(){this.style.removeProperty(e)}}function fc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function hc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function gc(e,t,n){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?hc:fc)(e,t,n??"")):Be(this.node(),e)}function Be(e,t){return e.style.getPropertyValue(t)||ur(e).getComputedStyle(e,null).getPropertyValue(t)}function pc(e){return function(){delete this[e]}}function mc(e,t){return function(){this[e]=t}}function yc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xc(e,t){return arguments.length>1?this.each((t==null?pc:typeof t=="function"?yc:mc)(e,t)):this.node()[e]}function dr(e){return e.trim().split(/^|\s+/)}function En(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=dr(e.getAttribute("class")||"")}fr.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 hr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function gr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function wc(e){return function(){hr(this,e)}}function vc(e){return function(){gr(this,e)}}function _c(e,t){return function(){(t.apply(this,arguments)?hr:gr)(this,e)}}function bc(e,t){var n=dr(e+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?_c:t?wc:vc)(n,t))}function Sc(){this.textContent=""}function Ec(e){return function(){this.textContent=e}}function Cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Nc(e){return arguments.length?this.each(e==null?Sc:(typeof e=="function"?Cc:Ec)(e)):this.node().textContent}function Mc(){this.innerHTML=""}function Ic(e){return function(){this.innerHTML=e}}function kc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pc(e){return arguments.length?this.each(e==null?Mc:(typeof e=="function"?kc:Ic)(e)):this.node().innerHTML}function Ac(){this.nextSibling&&this.parentNode.appendChild(this)}function Tc(){return this.each(Ac)}function Dc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(Dc)}function zc(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lc(){return null}function Hc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?Lc:typeof t=="function"?t:Sn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Rc(){var e=this.parentNode;e&&e.removeChild(this)}function jc(){return this.each(Rc)}function Vc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(e){return this.select(e?Oc:Vc)}function Fc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(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 Zc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Wc(e,t,n){return function(){var o=this.__on,r,s=Yc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Gc(e,t,n){var o=Xc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Wc:Zc,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function pr(e,t,n){var o=ur(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 qc(e,t){return function(){return pr(this,e,t)}}function Kc(e,t){return function(){return pr(this,e,t.apply(this,arguments))}}function Uc(e,t){return this.each((typeof t=="function"?Kc:qc)(e,t))}function*Qc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var mr=[null];function de(e,t){this._groups=e,this._parents=t}function ut(){return new de([[document.documentElement]],mr)}function Jc(){return this}de.prototype=ut.prototype={constructor:de,select:Ca,selectAll:ka,selectChild:Da,selectChildren:Ha,filter:Ra,data:Ya,enter:ja,exit:Za,join:Wa,merge:Ga,selection:Jc,order:qa,sort:Ka,call:Qa,nodes:Ja,node:ec,size:tc,empty:nc,each:oc,attr:uc,style:gc,property:xc,classed:bc,text:Nc,html:Pc,raise:Tc,lower:$c,append:zc,insert:Hc,remove:jc,clone:Bc,datum:Fc,on:Gc,dispatch:Uc,[Symbol.iterator]:Qc};function ue(e){return typeof e=="string"?new de([[document.querySelector(e)]],[document.documentElement]):new de([[e]],mr)}function el(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=el(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 tl={passive:!1},ot={capture:!0,passive:!1};function nn(e){e.stopImmediatePropagation()}function Oe(e){e.preventDefault(),e.stopImmediatePropagation()}function yr(e){var t=e.document.documentElement,n=ue(e).on("dragstart.drag",Oe,ot);"onselectstart"in t?n.on("selectstart.drag",Oe,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xr(e,t){var n=e.document.documentElement,o=ue(e).on("dragstart.drag",null);t&&(o.on("click.drag",Oe,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 dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function nl(e){return!e.ctrlKey&&!e.button}function ol(){return this.parentNode}function rl(e,t){return t??{x:e.x,y:e.y}}function il(){return navigator.maxTouchPoints||"ontouchstart"in this}function wr(){var e=nl,t=ol,n=rl,o=il,r={},s=jt("start","drag","end"),i=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,tl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,M){if(!(u||!e.call(this,x,M))){var E=g(this,t.call(this,x,M),x,M,"mouse");E&&(ue(x.view).on("mousemove.drag",h,ot).on("mouseup.drag",w,ot),yr(x.view),nn(x),c=!1,a=x.clientX,l=x.clientY,E("start",x))}}function h(x){if(Oe(x),!c){var M=x.clientX-a,E=x.clientY-l;c=M*M+E*E>f}r.mouse("drag",x)}function w(x){ue(x.view).on("mousemove.drag mouseup.drag",null),xr(x.view,c),Oe(x),r.mouse("end",x)}function v(x,M){if(e.call(this,x,M)){var E=x.changedTouches,C=t.call(this,x,M),D=E.length,k,V;for(k=0;k<D;++k)(V=g(this,C,x,M,E[k].identifier,E[k]))&&(nn(x),V("start",x,E[k]))}}function m(x){var M=x.changedTouches,E=M.length,C,D;for(C=0;C<E;++C)(D=r[M[C].identifier])&&(Oe(x),D("drag",x,M[C]))}function b(x){var M=x.changedTouches,E=M.length,C,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<E;++C)(D=r[M[C].identifier])&&(nn(x),D("end",x,M[C]))}function g(x,M,E,C,D,k){var V=s.copy(),P=pe(k||E,M),$,L,y;if((y=n.call(x,new dn("beforestart",{sourceEvent:E,target:d,identifier:D,active:i,x:P[0],y:P[1],dx:0,dy:0,dispatch:V}),C))!=null)return $=y.x-P[0]||0,L=y.y-P[1]||0,function I(S,A,N){var T=P,H;switch(S){case"start":r[D]=I,H=i++;break;case"end":delete r[D],--i;case"drag":P=pe(N||A,M),H=i;break}V.call(S,x,new dn(S,{sourceEvent:A,subject:y,target:d,identifier:D,active:H,x:P[0]+$,y:P[1]+L,dx:P[0]-T[0],dy:P[1]-T[1],dispatch:V}),C)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:mt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:mt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:mt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:mt(!!x),d):o},d.on=function(){var x=s.on.apply(s,arguments);return x===s?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var ro=180/Math.PI,fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(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,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(l)*ro,scaleX:i,scaleY:a}}var yt;function sl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fn:vr(t.a,t.b,t.c,t.d,t.e,t.f)}function al(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?fn:(e=e.matrix,vr(e.a,e.b,e.c,e.d,e.e,e.f))}function _r(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push("translate(",null,t,null,n);h.push({i:w-4,x:Ae(c,f)},{i:w-2,x:Ae(u,d)})}else(f||d)&&p.push("translate("+f+t+d+n)}function i(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Ae(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Ae(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push(r(p)+"scale(",null,",",null,")");h.push({i:w-4,x:Ae(c,f)},{i:w-2,x:Ae(u,d)})}else(f!==1||d!==1)&&p.push(r(p)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,d),i(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(p){for(var h=-1,w=d.length,v;++h<w;)f[(v=d[h]).i]=v.x(p);return f.join("")}}}var cl=_r(sl,"px, ","px)","deg)"),ll=_r(al,", ",")",")"),ul=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function dl(e){return((e=Math.exp(e))-1/e)/2}function fl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ct=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],f=i[1],d=i[2],p=u-a,h=f-l,w=p*p+h*h,v,m;if(w<ul)m=Math.log(d/c)/t,v=function(C){return[a+C*p,l+C*h,c*Math.exp(t*C*m)]};else{var b=Math.sqrt(w),g=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),M=Math.log(Math.sqrt(g*g+1)-g),E=Math.log(Math.sqrt(x*x+1)-x);m=(E-M)/t,v=function(C){var D=C*m,k=io(M),V=c/(n*b)*(k*fl(t*D+M)-dl(M));return[a+V*p,l+V*h,c*k/io(t*D+M)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Fe=0,Je=0,Ue=0,br=1e3,Pt,et,At=0,$e=0,Ot=0,rt=typeof performance=="object"&&performance.now?performance:Date,Sr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cn(){return $e||(Sr(hl),$e=rt.now()+Ot)}function hl(){$e=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=Er.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:Pt=this,et=this),this._call=e,this._time=n,hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,hn())}};function Er(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function gl(){Cn(),++Fe;for(var e=Pt,t;e;)(t=$e-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fe}function so(){$e=(At=rt.now())+Ot,Fe=Je=0;try{gl()}finally{Fe=0,ml(),$e=0}}function pl(){var e=rt.now(),t=e-At;t>br&&(Ot-=t,At=e)}function ml(){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,hn(o)}function hn(e){if(!Fe){Je&&(Je=clearTimeout(Je));var t=e-$e;t>24?(e<1/0&&(Je=setTimeout(so,e-rt.now()-Ot)),Ue&&(Ue=clearInterval(Ue))):(Ue||(At=rt.now(),Ue=setInterval(pl,br)),Fe=1,Sr(so))}}function ao(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 yl=jt("start","end","cancel","interrupt"),xl=[],Cr=0,co=1,gn=2,Nt=3,lo=4,pn=5,Mt=6;function Bt(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;wl(e,n,{name:t,index:o,group:r,on:yl,tween:xl,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Cr})}function Nn(e,t){var n=xe(e,t);if(n.state>Cr)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=xe(e,t);if(n.state>Nt)throw new Error("too late; already running");return n}function xe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function wl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(s,0,n.time);function s(c){n.state=co,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,f,d,p;if(n.state!==co)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Nt)return ao(i);p.state===lo?(p.state=Mt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=Mt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(ao(function(){n.state===Nt&&(n.state=lo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=gn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===gn){for(n.state=Nt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=pn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===pn&&(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,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>gn&&o.state<pn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function vl(e){return this.each(function(){It(this,e)})}function _l(e,t){var n,o;return function(){var r=_e(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function bl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=_e(this,e),i=s.tween;if(i!==o){r=(o=i).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)}s.tween=r}}function Sl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=xe(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?_l:bl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return xe(r,o).value[t]}}function Nr(e,t){var n;return(typeof t=="number"?Ae:t instanceof eo?Jn:(n=eo(t))?(t=n,Jn):ya)(e,t)}function El(e){return function(){this.removeAttribute(e)}}function Cl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Nl(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function Ml(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function Il(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function kl(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Pl(e,t){var n=Vt(e),o=n==="transform"?ll:Nr;return this.attrTween(e,typeof t=="function"?(n.local?kl:Il)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?Cl:El)(n):(n.local?Ml:Nl)(n,o,t))}function Al(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Tl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Dl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Tl(e,s)),n}return r._value=t,r}function $l(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Al(e,s)),n}return r._value=t,r}function zl(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=Vt(e);return this.tween(n,(o.local?Dl:$l)(o,t))}function Ll(e,t){return function(){Nn(this,e).delay=+t.apply(this,arguments)}}function Hl(e,t){return t=+t,function(){Nn(this,e).delay=t}}function Rl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ll:Hl)(t,e)):xe(this.node(),t).delay}function jl(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Vl(e,t){return t=+t,function(){_e(this,e).duration=t}}function Ol(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jl:Vl)(t,e)):xe(this.node(),t).duration}function Bl(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Fl(e){var t=this._id;return arguments.length?this.each(Bl(t,e)):xe(this.node(),t).ease}function Yl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function Xl(e){if(typeof e!="function")throw new Error;return this.each(Yl(this._id,e))}function Zl(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Ee(o,this._parents,this._name,this._id)}function Wl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,f=i[a]=new Array(u),d,p=0;p<u;++p)(d=l[p]||c[p])&&(f[p]=d);for(;a<o;++a)i[a]=t[a];return new Ee(i,this._parents,this._name,this._id)}function Gl(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 ql(e,t,n){var o,r,s=Gl(t)?Nn:_e;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Kl(e,t){var n=this._id;return arguments.length<2?xe(this.node(),n).on.on(e):this.each(ql(n,e,t))}function Ul(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ql(){return this.on("end.remove",Ul(this._id))}function Jl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sn(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Bt(c[d],t,n,d,c,xe(u,n)));return new Ee(s,this._parents,t,n)}function eu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sr(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),p,h=xe(u,n),w=0,v=d.length;w<v;++w)(p=d[w])&&Bt(p,t,n,w,d,h);s.push(d),i.push(u)}return new Ee(s,i,t,n)}var tu=ut.prototype.constructor;function nu(){return new tu(this._groups,this._parents)}function ou(e,t){var n,o,r;return function(){var s=Be(this,e),i=(this.style.removeProperty(e),Be(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Mr(e){return function(){this.style.removeProperty(e)}}function ru(e,t,n){var o,r=n+"",s;return function(){var i=Be(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function iu(e,t,n){var o,r,s;return function(){var i=Be(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Be(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function su(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=_e(this,e),c=l.on,u=l.value[s]==null?a||(a=Mr(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function au(e,t,n){var o=(e+="")=="transform"?cl:Nr;return t==null?this.styleTween(e,ou(e,o)).on("end.style."+e,Mr(e)):typeof t=="function"?this.styleTween(e,iu(e,o,Mn(this,"style."+e,t))).each(su(this._id,e)):this.styleTween(e,ru(e,o,t),n).on("end.style."+e,null)}function cu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function lu(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&cu(e,i,n)),o}return s._value=t,s}function uu(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,lu(e,t,n??""))}function du(e){return function(){this.textContent=e}}function fu(e){return function(){var t=e(this);this.textContent=t??""}}function hu(e){return this.tween("text",typeof e=="function"?fu(Mn(this,"text",e)):du(e==null?"":e+""))}function gu(e){return function(t){this.textContent=e.call(this,t)}}function pu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&gu(r)),t}return o._value=e,o}function mu(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,pu(e))}function yu(){for(var e=this._name,t=this._id,n=Ir(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=xe(l,t);Bt(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ee(o,this._parents,e,n)}function xu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=_e(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var wu=0;function Ee(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ir(){return++wu}var be=ut.prototype;Ee.prototype={constructor:Ee,select:Jl,selectAll:eu,selectChild:be.selectChild,selectChildren:be.selectChildren,filter:Zl,merge:Wl,selection:nu,transition:yu,call:be.call,nodes:be.nodes,node:be.node,size:be.size,empty:be.empty,each:be.each,on:Kl,attr:Pl,attrTween:zl,style:au,styleTween:uu,text:hu,textTween:mu,remove:Ql,tween:Sl,delay:Rl,duration:Ol,ease:Fl,easeVarying:Xl,end:xu,[Symbol.iterator]:be[Symbol.iterator]};function vu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _u={time:null,delay:0,duration:250,ease:vu};function bu(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 Su(e){var t,n;e instanceof Ee?(t=e._id,e=e._name):(t=Ir(),(n=_u).time=Cn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Bt(l,e,t,c,i,n||bu(l,t));return new Ee(o,this._parents,e,t)}ut.prototype.interrupt=vl;ut.prototype.transition=Su;const xt=e=>()=>e;function Eu(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 Se(e,t,n){this.k=e,this.x=t,this.y=n}Se.prototype={constructor:Se,scale:function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ft=new Se(1,0,0);kr.prototype=Se.prototype;function kr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ft;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Cu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Nu(){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 uo(){return this.__zoom||Ft}function Mu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Iu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ku(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Pr(){var e=Cu,t=Nu,n=ku,o=Mu,r=Iu,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ct,c=jt("start","zoom","end"),u,f,d,p=500,h=150,w=0,v=10;function m(y){y.property("__zoom",uo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,I,S,A){var N=y.selection?y.selection():y;N.property("__zoom",uo),y!==N?M(y,I,S,A):N.interrupt().each(function(){E(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(y,I,S,A){m.scaleTo(y,function(){var N=this.__zoom.k,T=typeof I=="function"?I.apply(this,arguments):I;return N*T},S,A)},m.scaleTo=function(y,I,S,A){m.transform(y,function(){var N=t.apply(this,arguments),T=this.__zoom,H=S==null?x(N):typeof S=="function"?S.apply(this,arguments):S,j=T.invert(H),R=typeof I=="function"?I.apply(this,arguments):I;return n(g(b(T,R),H,j),N,i)},S,A)},m.translateBy=function(y,I,S,A){m.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),i)},null,A)},m.translateTo=function(y,I,S,A,N){m.transform(y,function(){var T=t.apply(this,arguments),H=this.__zoom,j=A==null?x(T):typeof A=="function"?A.apply(this,arguments):A;return n(Ft.translate(j[0],j[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof S=="function"?-S.apply(this,arguments):-S),T,i)},A,N)};function b(y,I){return I=Math.max(s[0],Math.min(s[1],I)),I===y.k?y:new Se(I,y.x,y.y)}function g(y,I,S){var A=I[0]-S[0]*y.k,N=I[1]-S[1]*y.k;return A===y.x&&N===y.y?y:new Se(y.k,A,N)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function M(y,I,S,A){y.on("start.zoom",function(){E(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(A).end()}).tween("zoom",function(){var N=this,T=arguments,H=E(N,T).event(A),j=t.apply(N,T),R=S==null?x(j):typeof S=="function"?S.apply(N,T):S,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=N.__zoom,W=typeof I=="function"?I.apply(N,T):I,Q=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=Q(Z),Y=F/O[2];Z=new Se(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}H.zoom(null,Z)}})}function E(y,I,S){return!S&&y.__zooming||new C(y,I)}function C(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="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(y){var I=ue(this.that).datum();c.call(y,this.that,new Eu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),I)}};function D(y,...I){if(!e.apply(this,arguments))return;var S=E(this,I).event(y),A=this.__zoom,N=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=pe(y);if(S.wheel)(S.mouse[0][0]!==T[0]||S.mouse[0][1]!==T[1])&&(S.mouse[1]=A.invert(S.mouse[0]=T)),clearTimeout(S.wheel);else{if(A.k===N)return;S.mouse=[T,A.invert(T)],It(this),S.start()}Qe(y),S.wheel=setTimeout(H,h),S.zoom("mouse",n(g(b(A,N),S.mouse[0],S.mouse[1]),S.extent,i));function H(){S.wheel=null,S.end()}}function k(y,...I){if(d||!e.apply(this,arguments))return;var S=y.currentTarget,A=E(this,I,!0).event(y),N=ue(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=pe(y,S),H=y.clientX,j=y.clientY;yr(y.view),on(y),A.mouse=[T,this.__zoom.invert(T)],It(this),A.start();function R(B){if(Qe(B),!A.moved){var W=B.clientX-H,Q=B.clientY-j;A.moved=W*W+Q*Q>w}A.event(B).zoom("mouse",n(g(A.that.__zoom,A.mouse[0]=pe(B,S),A.mouse[1]),A.extent,i))}function F(B){N.on("mousemove.zoom mouseup.zoom",null),xr(B.view,A.moved),Qe(B),A.event(B).end()}}function V(y,...I){if(e.apply(this,arguments)){var S=this.__zoom,A=pe(y.changedTouches?y.changedTouches[0]:y,this),N=S.invert(A),T=S.k*(y.shiftKey?.5:2),H=n(g(b(S,T),A,N),t.apply(this,I),i);Qe(y),a>0?ue(this).transition().duration(a).call(M,H,A,y):ue(this).call(m.transform,H,A,y)}}function P(y,...I){if(e.apply(this,arguments)){var S=y.touches,A=S.length,N=E(this,I,y.changedTouches.length===A).event(y),T,H,j,R;for(on(y),H=0;H<A;++H)j=S[H],R=pe(j,this),R=[R,this.__zoom.invert(R),j.identifier],N.touch0?!N.touch1&&N.touch0[2]!==R[2]&&(N.touch1=R,N.taps=0):(N.touch0=R,T=!0,N.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(N.taps<2&&(f=R[0],u=setTimeout(function(){u=null},p)),It(this),N.start())}}function $(y,...I){if(this.__zooming){var S=E(this,I).event(y),A=y.changedTouches,N=A.length,T,H,j,R;for(Qe(y),T=0;T<N;++T)H=A[T],j=pe(H,this),S.touch0&&S.touch0[2]===H.identifier?S.touch0[0]=j:S.touch1&&S.touch1[2]===H.identifier&&(S.touch1[0]=j);if(H=S.that.__zoom,S.touch1){var F=S.touch0[0],B=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,O=(O=Q[0]-B[0])*O+(O=Q[1]-B[1])*O;H=b(H,Math.sqrt(Z/O)),j=[(F[0]+W[0])/2,(F[1]+W[1])/2],R=[(B[0]+Q[0])/2,(B[1]+Q[1])/2]}else if(S.touch0)j=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(g(H,j,R),S.extent,i))}}function L(y,...I){if(this.__zooming){var S=E(this,I).event(y),A=y.changedTouches,N=A.length,T,H;for(on(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),T=0;T<N;++T)H=A[T],S.touch0&&S.touch0[2]===H.identifier?delete S.touch0:S.touch1&&S.touch1[2]===H.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(H=pe(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<v)){var j=ue(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:xt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:xt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:xt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:xt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],m):[s[0],s[1]]},m.translateExtent=function(y){return arguments.length?(i[0][0]=+y[0][0],i[1][0]=+y[1][0],i[0][1]=+y[0][1],i[1][1]=+y[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(l=y,m):l},m.on=function(){var y=c.on.apply(c,arguments);return y===c?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(v=+y,m):v},m}const ve={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle: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]],Ar=["Enter"," ","Escape"],Tr={"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 Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));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 fo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function $r(e){return e===null?null:e?"valid":"invalid"}const zr=e=>"id"in e&&"source"in e&&"target"in e,Pu=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}=Ce(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Au=(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 s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?$t(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yt(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=Yt(n,$t(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!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:u,selectable:f=!0,hidden:d=!1}=c;if(i&&!f||d)continue;const p=u.width??c.width??c.initialWidth??null,h=u.height??c.height??c.initialHeight??null,w=at(a,Ze(c)),v=(p??0)*(h??0),m=s&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},Tu=(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 Du(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 $u({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Du(e,i),l=ft(a),c=Pn(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ve.error005());else{const p=a.measured.width,h=a.measured.height;p&&h&&(f=[[l,c],[l+p,c+h]])}else a&&We(i.extent)&&(f=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const d=We(f)?ze(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ve.error015()),{position:{x:d.x-l+(i.measured.width??0)*u[0],y:d.y-c+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function zu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const p=s.has(d.id),h=!p&&d.parentId&&i.find(w=>w.id===d.parentId);(p||h)&&i.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Tu(i,l);for(const d of l)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Xe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ze=(e={x:0,y:0},t,n)=>({x:Xe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Xe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hr(e,t,n){const{width:o,height:r}=Ce(n),{x:s,y:i}=n.internals.positionAbsolute;return ze(e,[[s,i],[s+o,i+r]],t)}const ho=(e,t,n)=>e<t?Xe(Math.abs(e-t),1,t)/t:e>n?-Xe(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>{const r=ho(e.x,o,t.width-o)*n,s=ho(e.y,o,t.height-o)*n;return[r,s]},Yt=(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)}),mn=({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}),Ze=(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}},$t=(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)}},jr=(e,t)=>Xt(Yt(mn(e),mn(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)},go=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),Lu=(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],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},zt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Re(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 Hu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Re(e,n),r=Re(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Re(e.top??e.y??0,n),r=Re(e.bottom??e.y??0,n),s=Re(e.left??e.x??0,t),i=Re(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ru(e,t,n,o,r,s){const{x:i,y:a}=zt(e,[t,n,o]),{x:l,y:c}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Pn=(e,t,n,o,r,s)=>{const i=Hu(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=Xe(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=Ru(e,p,h,u,t,n),v={left:Math.min(w.left-i.left,0),top:Math.min(w.top-i.top,0),right:Math.min(w.right-i.right,0),bottom:Math.min(w.bottom-i.bottom,0)};return{x:p-v.left+v.right,y:h-v.top+v.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function We(e){return e!=null&&e!=="parent"}function Ce(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Vr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Or(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ju(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Vu(e){return{...Tr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=ye(e),a=gt({x:s-(r?.left??0),y:i-(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}),Br=e=>e?.getRootNode?.()||window?.document,Ou=["INPUT","SELECT","TEXTAREA"];function Fr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ou.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Yr=e=>"clientX"in e,ye=(e,t)=>{const n=Yr(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)}},mo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...An(i)}})};function Xr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case X.Left:return[t-wt(t-o,s),n];case X.Right:return[t+wt(o-t,s),n];case X.Top:return[t,n-wt(n-r,s)];case X.Bottom:return[t,n+wt(r-n,s)]}}function Zr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,curvature:i=.25}){const[a,l]=yo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=yo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,p,h]=Xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,p,h]}function Wr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Bu({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=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 i+a}function Fu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Yt($t(e),$t(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Xt(s))>0}const Yu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Xu=(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)),Zu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Yu;let r;return zr(e)?r={...e}:r={...e,id:o(e)},Xu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Wr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const xo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Wu=({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},wo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Gu({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:s,stepPosition:i}){const a=xo[t],l=xo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},f=Wu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d];let h=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,g,x]=Wr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const E=[{x:w,y:c.y},{x:w,y:u.y}],C=[{x:c.x,y:v},{x:u.x,y:v}];a[d]===p?h=d==="x"?E:C:h=d==="x"?C:E}else{const E=[{x:c.x,y:u.y}],C=[{x:u.x,y:c.y}];if(d==="x"?h=a.x===p?C:E:h=a.y===p?E:C,t===o){const $=Math.abs(e[d]-n[d]);if($<=s){const L=Math.min(s-1,s-$);a[d]===p?m[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const $=d==="x"?"y":"x",L=a[d]===l[$],y=c[$]>u[$],I=c[$]<u[$];(a[d]===1&&(!L&&y||L&&I)||a[d]!==1&&(!L&&I||L&&y))&&(h=d==="x"?E:C)}const D={x:c.x+m.x,y:c.y+m.y},k={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(D.x-h[0].x),Math.abs(k.x-h[0].x)),P=Math.max(Math.abs(D.y-h[0].y),Math.abs(k.y-h[0].y));V>=P?(w=(D.x+k.x)/2,v=h[0].y):(w=h[0].x,v=(D.y+k.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:u.x+b.x,y:u.y+b.y},n],w,v,g,x]}function qu(e,t,n,o){const r=Math.min(wo(e,t)/2,wo(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function yn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,p,h,w]=Gu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((m,b,g)=>{let x="";return g>0&&g<f.length-1?x=qu(f[g-1],b,f[g+1],i):x=`${g===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),d,p,h,w]}function vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ku(e){const{sourceNode:t,targetNode:n}=e;if(!vo(t)||!vo(n))return null;const o=t.internals.handleBounds||_o(t.handles),r=n.internals.handleBounds||_o(n.handles),s=bo(o?.source??[],e.sourceHandle),i=bo(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ve.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||X.Bottom,l=i?.position||X.Top,c=Le(t,s,a),u=Le(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function _o(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 Le(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ce(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case X.Top:return{x:r+i/2,y:s};case X.Right:return{x:r+i,y:s+a/2};case X.Bottom:return{x:r+i/2,y:s+a};case X.Left:return{x:r,y:s+a/2}}}function bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function xn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Uu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=xn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const qr=1e3,Qu=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ju={...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 ed(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)zn(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=We(r.extent)?r.extent:o.nodeExtent,a=ze(s,i,Ce(r));r.internals.positionAbsolute=a}}function td(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={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(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function $n(e){return e==="manual"}function wn(e,t,n,o={}){const r=Dn(Ju,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!$n(r.zIndexMode)?qr:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=dt(c,r.nodeOrigin),d=We(c.extent)?c.extent:r.nodeExtent,p=ze(f,d,Ce(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:p,handleBounds:td(c,u),z:Kr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&zn(u,t,n,o,s)}return l}function nd(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 zn(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}nd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Qu),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!$n(l)?qr:0,{x:d,y:p,z:h}=od(e,u,i,a,f,l),{positionAbsolute:w}=e.internals,v=d!==w.x||p!==w.y;(v||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:p}:w,z:h}})}function Kr(e,t,n){const o=me(e.zIndex)?e.zIndex:0;return $n(n)?o:o+(e.selected?t:0)}function od(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ce(e),c=dt(e,n),u=We(e.extent)?ze(c,e.extent,l):c;let f=ze({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Hr(f,l,t));const d=Kr(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function Ln(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??Ze(a),c=jr(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ce(a),f=a.origin??o,d=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,p=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,h=Math.max(u.width,Math.round(i.width)),w=Math.max(u.height,Math.round(i.height)),v=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+v,y:a.position.y-p+m}}),n.get(l)?.forEach(b=>{e.some(g=>g.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+p}})})),(u.width<i.width||u.height<i.height||d||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-v:0),height:w+(p?f[1]*p-m:0)}})}),r}function rd(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const p of e.values()){const h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const w=An(p.nodeElement),v=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!h.internals.handleBounds||p.force))){const b=p.nodeElement.getBoundingClientRect(),g=We(h.extent)?h.extent:s;let{positionAbsolute:x}=h.internals;h.parentId&&h.extent==="parent"?x=Hr(x,w,t.get(h.parentId)):g&&(x=ze(x,g,w));const M={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:mo("source",p.nodeElement,b,f,h.id),target:mo("target",p.nodeElement,b,f,h.id)}}};t.set(h.id,M),h.parentId&&zn(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Ze(M,r)}))}}if(d.length>0){const p=Ln(d,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function id({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function So(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function Ur(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;So("source",l,u,e,r,i),So("target",l,c,e,s,a),t.set(o.id,o)}}function Qr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Qr(n,t):!1}function Eo(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 sd(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Qr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,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 rn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function ad({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function cd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function v({noDragClassName:b,handleSelector:g,domNode:x,isSelectable:M,nodeId:E,nodeClickDistance:C=0}){d=ue(x);function D({x:$,y:L}){const{nodeLookup:y,nodeExtent:I,snapGrid:S,snapToGrid:A,nodeOrigin:N,onNodeDrag:T,onSelectionDrag:H,onError:j,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,W=B&&I?mn(ft(a)):null,Q=B&&A?ad({dragItems:a,snapGrid:S,x:$,y:L}):null;for(const[Z,O]of a){if(!y.has(Z))continue;let Y={x:$-O.distance.x,y:L-O.distance.y};A&&(Y=Q?{x:Math.round(Y.x+Q.x),y:Math.round(Y.y+Q.y)}:ht(Y,S));let U=null;if(B&&I&&!O.extent&&W){const{positionAbsolute:q}=O.internals,J=q.x-W.x+I[0][0],ne=q.x+O.measured.width-W.x2+I[1][0],te=q.y-W.y+I[0][1],se=q.y+O.measured.height-W.y2+I[1][1];U=[[J,te],[ne,se]]}const{position:K,positionAbsolute:G}=Lr({nodeId:Z,nextPosition:Y,nodeLookup:y,nodeExtent:U||I,nodeOrigin:N,onError:j});F=F||O.position.x!==K.x||O.position.y!==K.y,O.position=K,O.internals.positionAbsolute=G}if(h=h||F,!!F&&(R(a,!0),w&&(o||T||!E&&H))){const[Z,O]=rn({nodeId:E,dragItems:a,nodeLookup:y});o?.(w,a,Z,O),T?.(w,Z,O),E||H?.(w,O)}}async function k(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(i);return}const[S,A]=Rr(c,u,y);(S!==0||A!==0)&&(s.x=(s.x??0)-S/$[2],s.y=(s.y??0)-A/$[2],await L({x:S,y:A})&&D(s)),i=requestAnimationFrame(k)}function V($){const{nodeLookup:L,multiSelectionActive:y,nodesDraggable:I,transform:S,snapGrid:A,snapToGrid:N,selectNodesOnDrag:T,onNodeDragStart:H,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!T||!M)&&!y&&E&&(L.get(E)?.selected||R()),M&&T&&E&&e?.(E);const F=tt($.sourceEvent,{transform:S,snapGrid:A,snapToGrid:N,containerBounds:u});if(s=F,a=sd(L,I,F,E),a.size>0&&(n||H||!E&&j)){const[B,W]=rn({nodeId:E,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,W),H?.($.sourceEvent,B,W),E||j?.($.sourceEvent,W)}}const P=wr().clickDistance(C).on("start",$=>{const{domNode:L,nodeDragThreshold:y,transform:I,snapGrid:S,snapToGrid:A}=t();u=L?.getBoundingClientRect()||null,p=!1,h=!1,w=$.sourceEvent,y===0&&V($),s=tt($.sourceEvent,{transform:I,snapGrid:S,snapToGrid:A,containerBounds:u}),c=ye($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:y,snapGrid:I,snapToGrid:S,nodeDragThreshold:A,nodeLookup:N}=t(),T=tt($.sourceEvent,{transform:y,snapGrid:I,snapToGrid:S,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!N.has(E))&&(p=!0),!p){if(!l&&L&&f&&(l=!0,k()),!f){const H=ye($.sourceEvent,u),j=H.x-c.x,R=H.y-c.y;Math.sqrt(j*j+R*R)>A&&V($)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&f&&(c=ye($.sourceEvent,u),D(T))}}).on("end",$=>{if(!(!f||p)&&(l=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:S}=t();if(h&&(y(a,!1),h=!1),r||I||!E&&S){const[A,N]=rn({nodeId:E,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,A,N),I?.($.sourceEvent,A,N),E||S?.($.sourceEvent,N)}}}).filter($=>{const L=$.target;return!$.button&&(!b||!Eo(L,`.${b}`,x))&&(!g||Eo(L,g,x))});d.call(P)}function m(){d?.on(".drag",null)}return{update:v,destroy:m}}function ld(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,Ze(s))>0&&o.push(s);return o}const ud=250;function dd(e,t,n,o){let r=[],s=1/0;const i=ld(e,n,t+ud);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:f}=Le(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...c,x:u,y:f}],s=d):d===s&&r.push({...c,x:u,y:f}))}}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 Jr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Le(i,l,l.position,!0)}:l}function ei(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function fd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ti=()=>!0;function hd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:v,isValidConnection:m=ti,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:M,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:D}){const k=Br(e.target);let V=0,P;const{x:$,y:L}=ye(e),y=ei(s,D),I=a?.getBoundingClientRect();let S=!1;if(!I||!y)return;const A=Jr(r,y,o,l,t);if(!A)return;let N=ye(e,I),T=!1,H=null,j=!1,R=null;function F(){if(!u||!I)return;const[K,G]=Rr(N,I,E);d({x:K,y:G}),V=requestAnimationFrame(F)}const B={...A,nodeId:r,type:y,position:A.position},W=l.get(r);let Z={inProgress:!0,isValid:null,from:Le(W,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:W,to:N,toHandle:null,toPosition:fo[B.position],toNode:null,pointer:N};function O(){S=!0,g(Z),h?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&O();function Y(K){if(!S){const{x:se,y:le}=ye(K),oe=se-$,ce=le-L;if(!(oe*oe+ce*ce>C*C))return;O()}if(!M()||!B){U(K);return}const G=x();N=ye(K,I),P=dd(gt(N,G,!1,[1,1]),n,l,B),T||(F(),T=!0);const q=ni(K,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:k,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,H=q.connection,j=fd(!!P,q.isValid);const J=l.get(r),ne=J?Le(J,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:j,to:q.toHandle&&j?zt({x:q.toHandle.x,y:q.toHandle.y},G):N,toHandle:q.toHandle,toPosition:j&&q.toHandle?q.toHandle.position:fo[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:N};g(te),Z=te}function U(K){if(!("touches"in K&&K.touches.length>0)){if(S){(P||R)&&H&&j&&w?.(H);const{inProgress:G,...q}=Z,J={...q,toPosition:Z.toHandle?Z.toPosition:null};v?.(K,J),s&&b?.(K,J)}p(),cancelAnimationFrame(V),T=!1,j=!1,H=null,R=null,k.removeEventListener("mousemove",Y),k.removeEventListener("mouseup",U),k.removeEventListener("touchmove",Y),k.removeEventListener("touchend",U)}}k.addEventListener("mousemove",Y),k.addEventListener("mouseup",U),k.addEventListener("touchmove",Y),k.addEventListener("touchend",U)}function ni(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ti,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=ye(e),w=i.elementFromPoint(p,h),v=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ei(void 0,v),g=v.getAttribute("data-nodeid"),x=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),E=v.classList.contains("connectableend");if(!g||!b)return m;const C={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=C;const k=M&&E&&(n===Ye.Strict?f&&b==="source"||!f&&b==="target":g!==o||x!==r);m.isValid=k&&c(C),m.toHandle=Jr(g,b,x,u,n,!0)}return m}const vn={onPointerDown:hd,isValid:ni};function gd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ue(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){const h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),M=g.sourceEvent.ctrlKey&&ct()?10:1,E=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,C=x[2]*Math.pow(2,E*M);t.scaleTo(C)};let w=[0,0];const v=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const M=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[M[0]-w[0],M[1]-w[1]];w=M;const C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),D={x:x[0]-E[0]*C,y:x[1]-E[1]*C},k=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},k,a)},b=Pr().on("start",v).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:pe}}const Zt=e=>({x:e.x,y:e.y,zoom:e.k}),sn=({x:e,y:t,zoom:n})=>Ft.translate(e,t).scale(n),je=(e,t)=>e.target.closest(`.${t}`),oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,an=(e,t=0,n=pd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ri=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function md({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(je(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=pe(u),m=ri(u),b=f*Math.pow(2,m);o.scaleTo(n,b,v,u);return}const d=u.deltaMode===1?20:1;let p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*s,-(h/f)*s,{internal:!0});const w=Zt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function yd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=je(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function xd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zt(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 wd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&oi(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Zt(s.transform))}}function vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Zt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function _d({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,p=n&&f.ctrlKey,h=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(je(f,`${c}-flow__node`)||je(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!h||je(f,a)&&h||je(f,l)&&(!h||r&&h&&!e)||!n&&f.ctrlKey&&h)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!p&&h||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h)&&w}}function bd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Pr().scaleExtent([t,n]).translateExtent(o),d=ue(e).call(f);b({x:r.x,y:r.y,zoom:Xe(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const p=d.on("wheel.zoom"),h=d.on("dblclick.zoom");f.wheelDelta(ri);function w(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).transform(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function v({noWheelClassName:P,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:y,panOnScroll:I,panOnDrag:S,panOnScrollMode:A,panOnScrollSpeed:N,preventScrolling:T,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:Q,paneClickDistance:Z,selectionOnDrag:O}){y&&!c.isZoomingOrPanning&&m();const Y=I&&!F&&!y;f.clickDistance(O?1/0:!me(Z)||Z<0?0:Z);const U=Y?md({zoomPanValues:c,noWheelClassName:P,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:N,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):yd({noWheelClassName:P,preventScrolling:T,d3ZoomHandler:p});if(d.on("wheel.zoom",U,{passive:!1}),!y){const G=xd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});f.on("start",G);const q=wd({zoomPanValues:c,panOnDrag:S,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:W});f.on("zoom",q);const J=vd({zoomPanValues:c,panOnDrag:S,panOnScroll:I,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",J)}const K=_d({zoomActivationKeyPressed:F,panOnDrag:S,zoomOnScroll:j,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:y,noPanClassName:$,noWheelClassName:P,lib:B,connectionInProgress:Q});f.filter(K),R?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(P,$,L){const y=sn(P),I=f?.constrain()(y,$,L);return I&&await w(I),new Promise(S=>S(I))}async function g(P,$){const L=sn(P);return await w(L,$),new Promise(y=>y(L))}function x(P){if(d){const $=sn(P),L=d.property("__zoom");(L.k!==P.zoom||L.x!==P.x||L.y!==P.y)&&f?.transform(d,$,null,{sync:!0})}}function M(){const P=d?kr(d.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}function E(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleTo(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function C(P,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleBy(an(d,$?.duration,$?.ease,()=>L(!0)),P)}):Promise.resolve(!1)}function D(P){f?.scaleExtent(P)}function k(P){f?.translateExtent(P)}function V(P){const $=!me(P)||P<0?0:P;f?.clickDistance($)}return{update:v,destroy:m,setViewport:g,setViewportConstrained:b,getViewport:M,scaleTo:E,scaleBy:C,setScaleExtent:D,setTranslateExtent:k,syncViewport:x,setClickDistance:V}}var Ge;(function(e){e.Line="line",e.Handle="handle"})(Ge||(Ge={}));function Sd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function Co(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 Ne(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function No(e,t){return e?!t:t}function Ed(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:g,y:x,width:M,height:E,aspectRatio:C}=e;let D=Math.floor(u?p-e.pointerX:0),k=Math.floor(f?h-e.pointerY:0);const V=M+(l?-D:D),P=E+(c?-k:k),$=-s[0]*M,L=-s[1]*E;let y=vt(V,w,v),I=vt(P,m,b);if(i){let N=0,T=0;l&&D<0?N=Ne(g+D+$,i[0][0]):!l&&D>0&&(N=Me(g+V+$,i[1][0])),c&&k<0?T=Ne(x+k+L,i[0][1]):!c&&k>0&&(T=Me(x+P+L,i[1][1])),y=Math.max(y,N),I=Math.max(I,T)}if(a){let N=0,T=0;l&&D>0?N=Me(g+D,a[0][0]):!l&&D<0&&(N=Ne(g+V,a[1][0])),c&&k>0?T=Me(x+k,a[0][1]):!c&&k<0&&(T=Ne(x+P,a[1][1])),y=Math.max(y,N),I=Math.max(I,T)}if(r){if(u){const N=vt(V/C,m,b)*C;if(y=Math.max(y,N),i){let T=0;!l&&!c||l&&!c&&d?T=Me(x+L+V/C,i[1][1])*C:T=Ne(x+L+(l?D:-D)/C,i[0][1])*C,y=Math.max(y,T)}if(a){let T=0;!l&&!c||l&&!c&&d?T=Ne(x+V/C,a[1][1])*C:T=Me(x+(l?D:-D)/C,a[0][1])*C,y=Math.max(y,T)}}if(f){const N=vt(P*C,w,v)/C;if(I=Math.max(I,N),i){let T=0;!l&&!c||c&&!l&&d?T=Me(g+P*C+$,i[1][0])/C:T=Ne(g+(c?k:-k)*C+$,i[0][0])/C,I=Math.max(I,T)}if(a){let T=0;!l&&!c||c&&!l&&d?T=Ne(g+P*C,a[1][0])/C:T=Me(g+(c?k:-k)*C,a[0][0])/C,I=Math.max(I,T)}}}k=k+(k<0?I:-I),D=D+(D<0?y:-y),r&&(d?V>P*C?k=(No(l,c)?-D:D)/C:D=(No(l,c)?-k:k)*C:u?(k=D/C,c=l):(D=k*C,l=c));const S=l?g+D:g,A=c?x+k:x;return{width:M+(l?-D:D),height:E+(c?-k:k),x:s[0]*D*(l?-1:1)+S,y:s[1]*k*(c?-1:1)+A}}const ii={width:0,height:0,x:0,y:0},Cd={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Nd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Md(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function Id({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ue(e);let i={controlDirection:Co("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:v}){let m={...ii},b={...Cd};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Co(c)};let g,x=null,M=[],E,C,D,k=!1;const V=wr().on("start",P=>{const{nodeLookup:$,transform:L,snapGrid:y,snapToGrid:I,nodeOrigin:S,paneDomNode:A}=n();if(g=$.get(t),!g)return;x=A?.getBoundingClientRect()??null;const{xSnapped:N,ySnapped:T}=tt(P.sourceEvent,{transform:L,snapGrid:y,snapToGrid:I,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},b={...m,pointerX:N,pointerY:T,aspectRatio:m.width/m.height},E=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=$.get(g.parentId),C=E&&g.extent==="parent"?Nd(E):void 0),M=[],D=void 0;for(const[H,j]of $)if(j.parentId===t&&(M.push({id:H,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Md(j,g,j.origin??S);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}p?.(P,{...m})}).on("drag",P=>{const{transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I}=n(),S=tt(P.sourceEvent,{transform:$,snapGrid:L,snapToGrid:y,containerBounds:x}),A=[];if(!g)return;const{x:N,y:T,width:H,height:j}=m,R={},F=g.origin??I,{width:B,height:W,x:Q,y:Z}=Ed(b,i.controlDirection,S,i.boundaries,i.keepAspectRatio,F,C,D),O=B!==H,Y=W!==j,U=Q!==N&&O,K=Z!==T&&Y;if(!U&&!K&&!O&&!Y)return;if((U||K||F[0]===1||F[1]===1)&&(R.x=U?Q:m.x,R.y=K?Z:m.y,m.x=R.x,m.y=R.y,M.length>0)){const ne=Q-N,te=Z-T;for(const se of M)se.position={x:se.position.x-ne+F[0]*(B-H),y:se.position.y-te+F[1]*(W-j)},A.push(se)}if((O||Y)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!i.resizeDirection||i.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),E&&g.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 G=Sd({width:m.width,prevWidth:H,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...m,direction:G};v?.(P,q)!==!1&&(k=!0,h?.(P,q),o(R,A))}).on("end",P=>{k&&(w?.(P,{...m}),r?.({...m}),k=!1)});s.call(V)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const kd={},Mo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(kd?"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},Pd=e=>e?Mo(e):Mo,{useDebugValue:Ad}=Zs,{useSyncExternalStoreWithSelector:Td}=Xs,Dd=e=>e;function si(e,t=Dd,n){const o=Td(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ad(o),o}const Io=(e,t)=>{const n=Pd(e),o=(r,s=t)=>si(n,r,s);return Object.assign(o,n),o},$d=(e,t)=>e?Io(e,t):Io;function re(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 Wt=z.createContext(null),zd=Wt.Provider,ai=ve.error001();function ee(e,t){const n=z.useContext(Wt);if(n===null)throw new Error(ai);return si(n,e,t)}function ie(){const e=z.useContext(Wt);if(e===null)throw new Error(ai);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ko={display:"none"},Ld={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ci="react-flow__node-desc",li="react-flow__edge-desc",Hd="react-flow__aria-live",Rd=e=>e.ariaLiveMessage,jd=e=>e.ariaLabelConfig;function Vd({rfId:e}){const t=ee(Rd);return _.jsx("div",{id:`${Hd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ld,children:t})}function Od({rfId:e,disableKeyboardA11y:t}){const n=ee(jd);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ci}-${e}`,style:ko,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${li}-${e}`,style:ko,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Vd,{rfId:e})]})}const Gt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Gt.displayName="Panel";function Bd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Gt,{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 Fd=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 Yd(e,t){return re(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&re(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Xd({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=ee(Fd,Yd);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Zd=e=>!!e.onSelectionChangeHandlers;function Wd({onSelectionChange:e}){const t=ee(Zd);return e||t?_.jsx(Xd,{onSelectionChange:e}):null}const ui=[0,0],Gd={x:0,y:0,zoom:1},qd=["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"],Po=[...qd,"rfId"],Kd=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}),Ao={translateExtent:it,nodeOrigin:ui,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ud(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=ee(Kd,re),c=ie();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Ao,a()}),[]);const u=z.useRef(Ao);return z.useEffect(()=>{for(const f of Po){const d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:Vu(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Po.map(f=>e[f])),null}function To(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Qd(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=To(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:To()?.matches?"dark":"light"}const Do=typeof document<"u"?document:null;function lt(e=null,t={target:Do,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),s=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
5
5
|
+`).split(`
|
|
6
|
-
`)),u=c.reduce((f,d)=>f.concat(...d),[]);return[c,u]}return[[],[]]},[e]);return z.useEffect(()=>{const l=t?.target??Do,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!c)&&Fr(p))return!1;const w=zo(p.code,a);if(s.current.add(p[w]),$o(i,s.current,!1)){const v=p.composedPath?.()?.[0]||p.target,m=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&p.preventDefault(),o(!0)}},f=p=>{const h=zo(p.code,a);$o(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[h]),p.key==="Meta"&&s.current.clear(),r.current=!1},d=()=>{s.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function $o(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function zo(e,t){return t.includes(e)?"code":"key"}const Jd=()=>{const e=ie();return z.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),l=Pn(t,o,r,s,i,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,f=n.snapToGrid??s;return gt(c,o,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:s}=o.getBoundingClientRect(),i=zt(t,n);return{x:i.x+r,y:i.y+s}}}),[])};function di(e,t){const n=[],o=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const i=o.get(s.id);i?i.push(s):o.set(s.id,[s])}for(const s of t){const i=o.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const l of i)ef(l,a);n.push(a)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function ef(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function tf(e,t){return di(e,t)}function nf(e,t){return di(e,t)}function Te(e,t){return{id:e,type:"select",selected:t}}function Ve(e,t=new Set,n=!1){const o=[];for(const[r,s]of e){const i=t.has(r);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),o.push(Te(s.id,i)))}return o}function Lo({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,s]of e.entries()){const i=t.get(s.id),a=i?.internals?.userNode??i;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function Ho(e){return{id:e.id,type:"remove"}}const Ro=e=>Pu(e),of=e=>zr(e);function fi(e){return z.forwardRef(e)}const rf=typeof window<"u"?z.useLayoutEffect:z.useEffect;function jo(e){const[t,n]=z.useState(BigInt(0)),[o]=z.useState(()=>sf(()=>n(r=>r+BigInt(1))));return rf(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function sf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const hi=z.createContext(null);function af({children:e}){const t=ie(),n=z.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:f,nodeLookup:d,fitViewQueued:p,onNodesChangeMiddlewareMap:h}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;let v=Lo({items:w,lookup:d});for(const m of h.values())v=m(v);u&&c(w),v.length>0?f?.(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:g}=t.getState();m&&g(b)})},[]),o=jo(n),r=z.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:d}=t.getState();let p=l;for(const h of a)p=typeof h=="function"?h(p):h;u?c(p):f&&f(Lo({items:p,lookup:d}))},[]),s=jo(r),i=z.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return _.jsx(hi.Provider,{value:i,children:e})}function cf(){const e=z.useContext(hi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const lf=e=>!!e.panZoom;function Hn(){const e=Jd(),t=ie(),n=cf(),o=ee(lf),r=z.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),i=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},l=f=>{const{nodeLookup:d,nodeOrigin:p}=t.getState(),h=Ro(f)?f:d.get(f.id),w=h.parentId?Or(h.position,h.measured,h.parentId,d,p):h.position,v={...h,position:w,width:h.measured?.width??h.width,height:h.measured?.height??h.height};return Ze(v)},c=(f,d,p={replace:!1})=>{i(h=>h.map(w=>{if(w.id===f){const v=typeof d=="function"?d(w):d;return p.replace&&Ro(v)?v:{...w,...v}}return w}))},u=(f,d,p={replace:!1})=>{a(h=>h.map(w=>{if(w.id===f){const v=typeof d=="function"?d(w):d;return p.replace&&of(v)?v:{...w,...v}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>s(f)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:i,setEdges:a,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:p}=t.getState(),[h,w,v]=p;return{nodes:f.map(m=>({...m})),edges:d.map(m=>({...m})),viewport:{x:h,y:w,zoom:v}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:p,edges:h,onNodesDelete:w,onEdgesDelete:v,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:g,onBeforeDelete:x}=t.getState(),{nodes:N,edges:E}=await zu({nodesToRemove:f,edgesToRemove:d,nodes:p,edges:h,onBeforeDelete:x}),C=E.length>0,D=N.length>0;if(C){const k=E.map(Ho);v?.(E),b(k)}if(D){const k=N.map(Ho);w?.(N),m(k)}return(D||C)&&g?.({nodes:N,edges:E}),{deletedNodes:N,deletedEdges:E}},getIntersectingNodes:(f,d=!0,p)=>{const h=go(f),w=h?f:l(f),v=p!==void 0;return w?(p||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!h&&(m.id===f.id||!b.internals.positionAbsolute))return!1;const g=Ze(v?m:b),x=at(g,w);return d&&x>0||x>=g.width*g.height||x>=w.width*w.height}):[]},isNodeIntersecting:(f,d,p=!0)=>{const w=go(f)?f:l(f);if(!w)return!1;const v=at(w,d);return p&&v>0||v>=d.width*d.height||v>=w.width*w.height},updateNode:c,updateNodeData:(f,d,p={replace:!1})=>{c(f,h=>{const w=typeof d=="function"?d(h):d;return p.replace?{...h,data:w}:{...h,data:{...h.data,...w}}},p)},updateEdge:u,updateEdgeData:(f,d,p={replace:!1})=>{u(f,h=>{const w=typeof d=="function"?d(h):d;return p.replace?{...h,data:w}:{...h,data:{...h.data,...w}}},p)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:p}=t.getState();return Au(f,{nodeLookup:d,nodeOrigin:p})},getHandleConnections:({type:f,id:d,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}-${f}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:d,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}${f?d?`-${f}-${d}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const d=t.getState().fitViewResolver??ju();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(p=>[...p]),d.promise}}},[]);return z.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Vo=e=>e.selected,uf=typeof window<"u"?window:void 0;function df({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ie(),{deleteElements:o}=Hn(),r=lt(e,{actInsideInputWithModifier:!1}),s=lt(t,{target:uf});z.useEffect(()=>{if(r){const{edges:i,nodes:a}=n.getState();o({nodes:a.filter(Vo),edges:i.filter(Vo)}),n.setState({nodesSelectionActive:!1})}},[r]),z.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function ff(e){const t=ie();z.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=An(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",we.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const qt={position:"absolute",width:"100%",height:"100%",top:0,left:0},hf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function gf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=De.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:p=!0,children:h,noWheelClassName:w,noPanClassName:v,onViewportChange:m,isControlledViewport:b,paneClickDistance:g,selectionOnDrag:x}){const N=ie(),E=z.useRef(null),{userSelectionActive:C,lib:D,connectionInProgress:k}=ee(hf,re),V=lt(d),P=z.useRef();ff(E);const $=z.useCallback(L=>{m?.({x:L[0],y:L[1],zoom:L[2]}),b||N.setState({transform:L})},[m,b]);return z.useEffect(()=>{if(E.current){P.current=bd({domNode:E.current,minZoom:u,maxZoom:f,translateExtent:c,viewport:l,onDraggingChange:S=>N.setState({paneDragging:S}),onPanZoomStart:(S,A)=>{const{onViewportChangeStart:M,onMoveStart:T}=N.getState();T?.(S,A),M?.(A)},onPanZoom:(S,A)=>{const{onViewportChange:M,onMove:T}=N.getState();T?.(S,A),M?.(A)},onPanZoomEnd:(S,A)=>{const{onViewportChangeEnd:M,onMoveEnd:T}=N.getState();T?.(S,A),M?.(A)}});const{x:L,y,zoom:I}=P.current.getViewport();return N.setState({panZoom:P.current,transform:[L,y,I],domNode:E.current.closest(".react-flow")}),()=>{P.current?.destroy()}}},[]),z.useEffect(()=>{P.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:V,preventScrolling:p,noPanClassName:v,userSelectionActive:C,noWheelClassName:w,lib:D,onTransformChange:$,connectionInProgress:k,selectionOnDrag:x,paneClickDistance:g})},[e,t,n,o,r,s,i,a,V,p,v,C,w,D,$,k,x,g]),_.jsx("div",{className:"react-flow__renderer",ref:E,style:qt,children:h})}const pf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function mf(){const{userSelectionActive:e,userSelectionRect:t}=ee(pf,re);return e&&t?_.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const cn=(e,t)=>n=>{n.target===t.current&&e?.(n)},yf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function xf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=st.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:p,children:h}){const w=ie(),{userSelectionActive:v,elementsSelectable:m,dragging:b,connectionInProgress:g}=ee(yf,re),x=m&&(e||v),N=z.useRef(null),E=z.useRef(),C=z.useRef(new Set),D=z.useRef(new Set),k=z.useRef(!1),V=M=>{if(k.current||g){k.current=!1;return}l?.(M),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=M=>{if(Array.isArray(o)&&o?.includes(2)){M.preventDefault();return}c?.(M)},$=u?M=>u(M):void 0,L=M=>{k.current&&(M.stopPropagation(),k.current=!1)},y=M=>{const{domNode:T}=w.getState();if(E.current=T?.getBoundingClientRect(),!E.current)return;const H=M.target===N.current;if(!H&&!!M.target.closest(".nokey")||!e||!(s&&H||t)||M.button!==0||!M.isPrimary)return;M.target?.setPointerCapture?.(M.pointerId),k.current=!1;const{x:F,y:B}=me(M.nativeEvent,E.current);w.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),H||(M.stopPropagation(),M.preventDefault())},I=M=>{const{userSelectionRect:T,transform:H,nodeLookup:j,edgeLookup:R,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:G,defaultEdgeOptions:Q,resetSelectedElements:Z}=w.getState();if(!E.current||!T)return;const{x:O,y:Y}=me(M.nativeEvent,E.current),{startX:U,startY:K}=T;if(!k.current){const te=t?0:r;if(Math.hypot(O-U,Y-K)<=te)return;Z(),i?.(M)}k.current=!0;const W={startX:U,startY:K,x:O<U?O:U,y:Y<K?Y:K,width:Math.abs(O-U),height:Math.abs(Y-K)},q=C.current,J=D.current;C.current=new Set(kn(j,W,H,n===st.Partial,!0).map(te=>te.id)),D.current=new Set;const ne=Q?.selectable??!0;for(const te of C.current){const se=F.get(te);if(se)for(const{edgeId:le}of se.values()){const oe=R.get(le);oe&&(oe.selectable??ne)&&D.current.add(le)}}if(!po(q,C.current)){const te=Ve(j,C.current,!0);B(te)}if(!po(J,D.current)){const te=Ve(R,D.current);G(te)}w.setState({userSelectionRect:W,userSelectionActive:!0,nodesSelectionActive:!1})},S=M=>{M.button===0&&(M.target?.releasePointerCapture?.(M.pointerId),!v&&M.target===N.current&&w.getState().userSelectionRect&&V?.(M),w.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(a?.(M),w.setState({nodesSelectionActive:C.current.size>0})))},A=o===!0||Array.isArray(o)&&o.includes(0);return _.jsxs("div",{className:ae(["react-flow__pane",{draggable:A,dragging:b,selection:e}]),onClick:x?void 0:cn(V,N),onContextMenu:cn(P,N),onWheel:cn($,N),onPointerEnter:x?void 0:f,onPointerMove:x?I:d,onPointerUp:x?S:void 0,onPointerDownCapture:x?y:void 0,onClickCapture:x?L:void 0,onPointerLeave:p,ref:N,style:qt,children:[h,_.jsx(mf,{})]})}function _n({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",we.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function gi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,nodeClickDistance:i}){const a=ie(),[l,c]=z.useState(!1),u=z.useRef();return z.useEffect(()=>{u.current=cd({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{_n({id:f,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),z.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:i}),()=>{u.current?.destroy()}},[n,o,t,s,e,r]),l}const wf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function pi(){const e=ie();return z.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),f=new Map,d=wf(i),p=r?s[0]:5,h=r?s[1]:5,w=n.direction.x*p*n.factor,v=n.direction.y*h*n.factor;for(const[,m]of c){if(!d(m))continue;let b={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+v};r&&(b=ht(b,s));const{position:g,positionAbsolute:x}=Lr({nodeId:m.id,nextPosition:b,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});m.position=g,m.internals.positionAbsolute=x,f.set(m.id,m)}l(f)},[])}const Rn=z.createContext(null),vf=Rn.Provider;Rn.Consumer;const mi=()=>z.useContext(Rn),_f=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),bf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:s,connection:i}=o,{fromHandle:a,toHandle:l,isValid:c}=i,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:s===Ye.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Sf({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:f,...d},p){const h=i||null,w=e==="target",v=ie(),m=mi(),{connectOnClick:b,noPanClassName:g,rfId:x}=ee(_f,re),{connectingFrom:N,connectingTo:E,clickConnecting:C,isPossibleEndHandle:D,connectionInProcess:k,clickConnectionInProcess:V,valid:P}=ee(bf(m,h,e),re);m||v.getState().onError?.("010",we.error010());const $=I=>{const{defaultEdgeOptions:S,onConnect:A,hasDefaultEdges:M}=v.getState(),T={...S,...I};if(M){const{edges:H,setEdges:j}=v.getState();j(Zu(T,H))}A?.(T),a?.(T)},L=I=>{if(!m)return;const S=Yr(I.nativeEvent);if(r&&(S&&I.button===0||!S)){const A=v.getState();vn.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:w,handleId:h,nodeId:m,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:$,isValidConnection:n||A.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}S?u?.(I):f?.(I)},y=I=>{const{onClickConnectStart:S,onClickConnectEnd:A,connectionClickStartHandle:M,connectionMode:T,isValidConnection:H,lib:j,rfId:R,nodeLookup:F,connection:B}=v.getState();if(!m||!M&&!r)return;if(!M){S?.(I.nativeEvent,{nodeId:m,handleId:h,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:m,type:e,id:h}});return}const G=Br(I.target),Q=n||H,{connection:Z,isValid:O}=vn.isValid(I.nativeEvent,{handle:{nodeId:m,id:h,type:e},connectionMode:T,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:Q,flowId:R,doc:G,lib:j,nodeLookup:F});O&&Z&&$(Z);const Y=structuredClone(B);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,A?.(I,Y),v.setState({connectionClickStartHandle:null})};return _.jsx("div",{"data-handleid":h,"data-nodeid":m,"data-handlepos":t,"data-id":`${x}-${m}-${h}-${e}`,className:ae(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,c,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:s,clickconnecting:C,connectingfrom:N,connectingto:E,valid:P,connectionindicator:o&&(!k||D)&&(k||V?s:r)}]),onMouseDown:L,onTouchStart:L,onClick:b?y:void 0,ref:p,...d,children:l})}const Pe=z.memo(fi(Sf));function Ef({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return _.jsxs(_.Fragment,{children:[e?.label,_.jsx(Pe,{type:"source",position:n,isConnectable:t})]})}function Cf({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return _.jsxs(_.Fragment,{children:[_.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label,_.jsx(Pe,{type:"source",position:o,isConnectable:t})]})}function Nf(){return null}function Mf({data:e,isConnectable:t,targetPosition:n=X.Top}){return _.jsxs(_.Fragment,{children:[_.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label]})}const Lt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Oo={input:Ef,default:Cf,output:Mf,group:Nf};function If(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const kf=e=>{const{width:t,height:n,x:o,y:r}=ft(e.nodeLookup,{filter:s=>!!s.selected});return{width:pe(t)?t:null,height:pe(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Pf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ie(),{width:r,height:s,transformString:i,userSelectionActive:a}=ee(kf,re),l=pi(),c=z.useRef(null);if(z.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),gi({nodeRef:c}),a||!r||!s)return null;const u=e?d=>{const p=o.getState().nodes.filter(h=>h.selected);e(d,p)}:void 0,f=d=>{Object.prototype.hasOwnProperty.call(Lt,d.key)&&(d.preventDefault(),l({direction:Lt[d.key],factor:d.shiftKey?4:1}))};return _.jsx("div",{className:ae(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:_.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:s}})})}const Bo=typeof window<"u"?window:void 0,Af=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:f,onSelectionStart:d,onSelectionEnd:p,multiSelectionKeyCode:h,panActivationKeyCode:w,zoomActivationKeyCode:v,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:g,panOnScroll:x,panOnScrollSpeed:N,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:D,defaultViewport:k,translateExtent:V,minZoom:P,maxZoom:$,preventScrolling:L,onSelectionContextMenu:y,noWheelClassName:I,noPanClassName:S,disableKeyboardA11y:A,onViewportChange:M,isControlledViewport:T}){const{nodesSelectionActive:H,userSelectionActive:j}=ee(Af,re),R=lt(c,{target:Bo}),F=lt(w,{target:Bo}),B=F||D,G=F||x,Q=u&&B!==!0,Z=R||j||Q;return df({deleteKeyCode:l,multiSelectionKeyCode:h}),_.jsx(gf,{onPaneContextMenu:s,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:g,panOnScroll:G,panOnScrollSpeed:N,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:k,translateExtent:V,minZoom:P,maxZoom:$,zoomActivationKeyCode:v,preventScrolling:L,noWheelClassName:I,noPanClassName:S,onViewportChange:M,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:Q,children:_.jsxs(xf,{onSelectionStart:d,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:B,isSelecting:!!Z,selectionMode:f,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:Q,children:[e,H&&_.jsx(Pf,{onSelectionContextMenu:y,noPanClassName:S,disableKeyboardA11y:A})]})})}yi.displayName="FlowRenderer";const Tf=z.memo(yi),Df=e=>t=>e?kn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function $f(e){return ee(z.useCallback(Df(e),[e]),re)}const zf=e=>e.updateNodeInternals;function Lf(){const e=ee(zf),[t]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:r.target,force:!0})}),e(o)}));return z.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Hf({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ie(),s=z.useRef(null),i=z.useRef(null),a=z.useRef(e.sourcePosition),l=z.useRef(e.targetPosition),c=z.useRef(t),u=n&&!!e.internals.handleBounds;return z.useEffect(()=>{s.current&&!e.hidden&&(!u||i.current!==s.current)&&(i.current&&o?.unobserve(i.current),o?.observe(s.current),i.current=s.current)},[u,e.hidden]),z.useEffect(()=>()=>{i.current&&(o?.unobserve(i.current),i.current=null)},[]),z.useEffect(()=>{if(s.current){const f=c.current!==t,d=a.current!==e.sourcePosition,p=l.current!==e.targetPosition;(f||d||p)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function Rf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:f,noDragClassName:d,noPanClassName:p,disableKeyboardA11y:h,rfId:w,nodeTypes:v,nodeClickDistance:m,onError:b}){const{node:g,internals:x,isParent:N}=ee(O=>{const Y=O.nodeLookup.get(e),U=O.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:U}},re);let E=g.type||"default",C=v?.[E]||Oo[E];C===void 0&&(b?.("003",we.error003(E)),E="default",C=v?.default||Oo.default);const D=!!(g.draggable||a&&typeof g.draggable>"u"),k=!!(g.selectable||l&&typeof g.selectable>"u"),V=!!(g.connectable||c&&typeof g.connectable>"u"),P=!!(g.focusable||u&&typeof g.focusable>"u"),$=ie(),L=Vr(g),y=Hf({node:g,nodeType:E,hasDimensions:L,resizeObserver:f}),I=gi({nodeRef:y,disabled:g.hidden||!D,noDragClassName:d,handleSelector:g.dragHandle,nodeId:e,isSelectable:k,nodeClickDistance:m}),S=pi();if(g.hidden)return null;const A=Ce(g),M=If(g),T=k||D||t||n||o||r,H=n?O=>n(O,{...x.userNode}):void 0,j=o?O=>o(O,{...x.userNode}):void 0,R=r?O=>r(O,{...x.userNode}):void 0,F=s?O=>s(O,{...x.userNode}):void 0,B=i?O=>i(O,{...x.userNode}):void 0,G=O=>{const{selectNodesOnDrag:Y,nodeDragThreshold:U}=$.getState();k&&(!Y||!D||U>0)&&_n({id:e,store:$,nodeRef:y}),t&&t(O,{...x.userNode})},Q=O=>{if(!(Fr(O.nativeEvent)||h)){if(Ar.includes(O.key)&&k){const Y=O.key==="Escape";_n({id:e,store:$,unselect:Y,nodeRef:y})}else if(D&&g.selected&&Object.prototype.hasOwnProperty.call(Lt,O.key)){O.preventDefault();const{ariaLabelConfig:Y}=$.getState();$.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:O.key.replace("Arrow","").toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),S({direction:Lt[O.key],factor:O.shiftKey?4:1})}}},Z=()=>{if(h||!y.current?.matches(":focus-visible"))return;const{transform:O,width:Y,height:U,autoPanOnNodeFocus:K,setCenter:W}=$.getState();if(!K)return;kn(new Map([[e,g]]),{x:0,y:0,width:Y,height:U},O,!0).length>0||W(g.position.x+A.width/2,g.position.y+A.height/2,{zoom:O[2]})};return _.jsx("div",{className:ae(["react-flow__node",`react-flow__node-${E}`,{[p]:D},g.className,{selected:g.selected,selectable:k,parent:N,draggable:D,dragging:I}]),ref:y,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:L?"visible":"hidden",...g.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:j,onMouseLeave:R,onContextMenu:F,onClick:G,onDoubleClick:B,onKeyDown:P?Q:void 0,tabIndex:P?0:void 0,onFocus:P?Z:void 0,role:g.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":h?void 0:`${ci}-${w}`,"aria-label":g.ariaLabel,...g.domAttributes,children:_.jsx(vf,{value:e,children:_.jsx(C,{id:e,data:g.data,type:E,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:g.selected??!1,selectable:k,draggable:D,deletable:g.deletable??!0,isConnectable:V,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:I,dragHandle:g.dragHandle,zIndex:x.z,parentId:g.parentId,...A})})})}var jf=z.memo(Rf);const Vf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function xi(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:s}=ee(Vf,re),i=$f(e.onlyRenderVisibleElements),a=Lf();return _.jsx("div",{className:"react-flow__nodes",style:qt,children:i.map(l=>_.jsx(jf,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}xi.displayName="NodeRenderer";const Of=z.memo(xi);function Bf(e){return ee(z.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),i=n.nodeLookup.get(r.target);s&&i&&Fu({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}const Ff=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return _.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Yf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return _.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Fo={[Dt.Arrow]:Ff,[Dt.ArrowClosed]:Yf};function Xf(e){const t=ie();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(Fo,e)?Fo[e]:(t.getState().onError?.("009",we.error009(e)),null),[e])}const Zf=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Xf(t);return l?_.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:_.jsx(l,{color:n,strokeWidth:i})}):null},wi=({defaultColor:e,rfId:t})=>{const n=ee(s=>s.edges),o=ee(s=>s.defaultEdgeOptions),r=z.useMemo(()=>Uu(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?_.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:_.jsx("defs",{children:r.map(s=>_.jsx(Zf,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};wi.displayName="MarkerDefinitions";var Gf=z.memo(wi);function vi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[f,d]=z.useState({x:1,y:0,width:0,height:0}),p=ae(["react-flow__edge-textwrapper",c]),h=z.useRef(null);return z.useEffect(()=>{if(h.current){const w=h.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?_.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...u,children:[r&&_.jsx("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),_.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o,children:n}),l]}):null}vi.displayName="EdgeText";const Wf=z.memo(vi);function Kt({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return _.jsxs(_.Fragment,{children:[_.jsx("path",{...u,d:e,fill:"none",className:ae(["react-flow__edge-path",u.className])}),c?_.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&pe(t)&&pe(n)?_.jsx(Wf,{x:t,y:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Yo({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function _i({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top}){const[i,a]=Yo({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Yo({pos:s,x1:o,y1:r,x2:e,y2:t}),[u,f,d,p]=Xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${a} ${l},${c} ${o},${r}`,u,f,d,p]}function bi(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:m})=>{const[b,g,x]=_i({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a}),N=e.isInternal?void 0:t;return _.jsx(Kt,{id:N,path:b,labelX:g,labelY:x,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:m})})}const qf=bi({isInternal:!1}),Si=bi({isInternal:!0});qf.displayName="SimpleBezierEdge";Si.displayName="SimpleBezierEdgeInternal";function Ei(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,sourcePosition:p=X.Bottom,targetPosition:h=X.Top,markerEnd:w,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[g,x,N]=yn({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:s,targetPosition:h,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),E=e.isInternal?void 0:t;return _.jsx(Kt,{id:E,path:g,labelX:x,labelY:N,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:w,markerStart:v,interactionWidth:b})})}const Ci=Ei({isInternal:!1}),Ni=Ei({isInternal:!0});Ci.displayName="SmoothStepEdge";Ni.displayName="SmoothStepEdgeInternal";function Mi(e){return z.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return _.jsx(Ci,{...n,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Kf=Mi({isInternal:!1}),Ii=Mi({isInternal:!0});Kf.displayName="StepEdge";Ii.displayName="StepEdgeInternal";function ki(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:p,markerStart:h,interactionWidth:w})=>{const[v,m,b]=Wr({sourceX:n,sourceY:o,targetX:r,targetY:s}),g=e.isInternal?void 0:t;return _.jsx(Kt,{id:g,path:v,labelX:m,labelY:b,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:p,markerStart:h,interactionWidth:w})})}const Uf=ki({isInternal:!1}),Pi=ki({isInternal:!0});Uf.displayName="StraightEdge";Pi.displayName="StraightEdgeInternal";function Ai(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[g,x,N]=Zr({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:m?.curvature}),E=e.isInternal?void 0:t;return _.jsx(Kt,{id:E,path:g,labelX:x,labelY:N,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:b})})}const Qf=Ai({isInternal:!1}),Ti=Ai({isInternal:!0});Qf.displayName="BezierEdge";Ti.displayName="BezierEdgeInternal";const Xo={default:Ti,straight:Pi,step:Ii,smoothstep:Ni,simplebezier:Si},Zo={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Jf=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,eh=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,Go="react-flow__edgeupdater";function Wo({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a}){return _.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ae([Go,`${Go}-${a}`]),cx:Jf(t,o,e),cy:eh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function th({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:f,setReconnecting:d,setUpdateHover:p}){const h=ie(),w=(x,N)=>{if(x.button!==0)return;const{autoPanOnConnect:E,domNode:C,isValidConnection:D,connectionMode:k,connectionRadius:V,lib:P,onConnectStart:$,onConnectEnd:L,cancelConnection:y,nodeLookup:I,rfId:S,panBy:A,updateConnection:M}=h.getState(),T=N.type==="target",H=(F,B)=>{d(!1),f?.(F,n,N.type,B)},j=F=>c?.(n,F),R=(F,B)=>{d(!0),u?.(x,n,N.type),$?.(F,B)};vn.onPointerDown(x.nativeEvent,{autoPanOnConnect:E,connectionMode:k,connectionRadius:V,domNode:C,handleId:N.id,nodeId:N.nodeId,nodeLookup:I,isTarget:T,edgeUpdaterType:N.type,lib:P,flowId:S,cancelConnection:y,panBy:A,isValidConnection:D,onConnect:j,onConnectStart:R,onConnectEnd:L,onReconnectEnd:H,updateConnection:M,getTransform:()=>h.getState().transform,getFromHandle:()=>h.getState().connection.fromHandle,dragThreshold:h.getState().connectionDragThreshold,handleDomNode:x.currentTarget})},v=x=>w(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=x=>w(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>p(!0),g=()=>p(!1);return _.jsxs(_.Fragment,{children:[(e===!0||e==="source")&&_.jsx(Wo,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&_.jsx(Wo,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:g,type:"target"})]})}function nh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,rfId:h,edgeTypes:w,noPanClassName:v,onError:m,disableKeyboardA11y:b}){let g=ee(W=>W.edgeLookup.get(e));const x=ee(W=>W.defaultEdgeOptions);g=x?{...x,...g}:g;let N=g.type||"default",E=w?.[N]||Xo[N];E===void 0&&(m?.("011",we.error011(N)),N="default",E=w?.default||Xo.default);const C=!!(g.focusable||t&&typeof g.focusable>"u"),D=typeof f<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),k=!!(g.selectable||o&&typeof g.selectable>"u"),V=z.useRef(null),[P,$]=z.useState(!1),[L,y]=z.useState(!1),I=ie(),{zIndex:S,sourceX:A,sourceY:M,targetX:T,targetY:H,sourcePosition:j,targetPosition:R}=ee(z.useCallback(W=>{const q=W.nodeLookup.get(g.source),J=W.nodeLookup.get(g.target);if(!q||!J)return{zIndex:g.zIndex,...Zo};const ne=Ku({id:e,sourceNode:q,targetNode:J,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:W.connectionMode,onError:m});return{zIndex:Bu({selected:g.selected,zIndex:g.zIndex,sourceNode:q,targetNode:J,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode}),...ne||Zo}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),re),F=z.useMemo(()=>g.markerStart?`url('#${xn(g.markerStart,h)}')`:void 0,[g.markerStart,h]),B=z.useMemo(()=>g.markerEnd?`url('#${xn(g.markerEnd,h)}')`:void 0,[g.markerEnd,h]);if(g.hidden||A===null||M===null||T===null||H===null)return null;const G=W=>{const{addSelectedEdges:q,unselectNodesAndEdges:J,multiSelectionActive:ne}=I.getState();k&&(I.setState({nodesSelectionActive:!1}),g.selected&&ne?(J({nodes:[],edges:[g]}),V.current?.blur()):q([e])),r&&r(W,g)},Q=s?W=>{s(W,{...g})}:void 0,Z=i?W=>{i(W,{...g})}:void 0,O=a?W=>{a(W,{...g})}:void 0,Y=l?W=>{l(W,{...g})}:void 0,U=c?W=>{c(W,{...g})}:void 0,K=W=>{if(!b&&Ar.includes(W.key)&&k){const{unselectNodesAndEdges:q,addSelectedEdges:J}=I.getState();W.key==="Escape"?(V.current?.blur(),q({edges:[g]})):J([e])}};return _.jsx("svg",{style:{zIndex:S},children:_.jsxs("g",{className:ae(["react-flow__edge",`react-flow__edge-${N}`,g.className,v,{selected:g.selected,animated:g.animated,inactive:!k&&!r,updating:P,selectable:k}]),onClick:G,onDoubleClick:Q,onContextMenu:Z,onMouseEnter:O,onMouseMove:Y,onMouseLeave:U,onKeyDown:C?K:void 0,tabIndex:C?0:void 0,role:g.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":C?`${li}-${h}`:void 0,ref:V,...g.domAttributes,children:[!L&&_.jsx(E,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:k,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:A,sourceY:M,targetX:T,targetY:H,sourcePosition:j,targetPosition:R,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),D&&_.jsx(th,{edge:g,isReconnectable:D,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,sourceX:A,sourceY:M,targetX:T,targetY:H,sourcePosition:j,targetPosition:R,setUpdateHover:$,setReconnecting:y})]})})}var oh=z.memo(nh);const rh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Di({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:p,onReconnectEnd:h,disableKeyboardA11y:w}){const{edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,onError:g}=ee(rh,re),x=Bf(t);return _.jsxs("div",{className:"react-flow__edges",children:[_.jsx(Gf,{defaultColor:e,rfId:n}),x.map(N=>_.jsx(oh,{id:N,edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,noPanClassName:r,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:f,onDoubleClick:d,onReconnectStart:p,onReconnectEnd:h,rfId:n,onError:g,edgeTypes:o,disableKeyboardA11y:w},N))]})}Di.displayName="EdgeRenderer";const ih=z.memo(Di),sh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ah({children:e}){const t=ee(sh);return _.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function ch(e){const t=Hn(),n=z.useRef(!1);z.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const lh=e=>e.panZoom?.syncViewport;function uh(e){const t=ee(lh),n=ie();return z.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function dh(e){return e.connection.inProgress?{...e.connection,to:gt(e.connection.to,e.transform)}:{...e.connection}}function fh(e){return dh}function hh(e){const t=fh();return ee(t,re)}const gh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ph({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:s,height:i,isValid:a,inProgress:l}=ee(gh,re);return!(s&&r&&l)?null:_.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:_.jsx("g",{className:ae(["react-flow__connection",$r(a)]),children:_.jsx($i,{style:t,type:n,CustomComponent:o,isValid:a})})})}const $i=({style:e,type:t=Ie.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:s,fromNode:i,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:f,toPosition:d,pointer:p}=hh();if(!r)return;if(n)return _.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:d,connectionStatus:$r(o),toNode:u,toHandle:f,pointer:p});let h="";const w={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:d};switch(t){case Ie.Bezier:[h]=Zr(w);break;case Ie.SimpleBezier:[h]=_i(w);break;case Ie.Step:[h]=yn({...w,borderRadius:0});break;case Ie.SmoothStep:[h]=yn(w);break;default:[h]=Wr(w)}return _.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};$i.displayName="ConnectionLine";const mh={};function qo(e=mh){z.useRef(e),ie(),z.useEffect(()=>{},[e])}function yh(){ie(),z.useRef(!1),z.useEffect(()=>{},[])}function zi({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:p,connectionLineType:h,connectionLineStyle:w,connectionLineComponent:v,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:g,selectionMode:x,multiSelectionKeyCode:N,panActivationKeyCode:E,zoomActivationKeyCode:C,deleteKeyCode:D,onlyRenderVisibleElements:k,elementsSelectable:V,defaultViewport:P,translateExtent:$,minZoom:L,maxZoom:y,preventScrolling:I,defaultMarkerColor:S,zoomOnScroll:A,zoomOnPinch:M,panOnScroll:T,panOnScrollSpeed:H,panOnScrollMode:j,zoomOnDoubleClick:R,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:Z,onPaneScroll:O,onPaneContextMenu:Y,paneClickDistance:U,nodeClickDistance:K,onEdgeContextMenu:W,onEdgeMouseEnter:q,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:se,onReconnectStart:le,onReconnectEnd:oe,noDragClassName:ce,noWheelClassName:fe,noPanClassName:xe,disableKeyboardA11y:qe,nodeExtent:Ut,rfId:pt,viewport:He,onViewportChange:Ke}){return qo(e),qo(t),yh(),ch(n),uh(He),_.jsx(Tf,{onPaneClick:B,onPaneMouseEnter:G,onPaneMouseMove:Q,onPaneMouseLeave:Z,onPaneContextMenu:Y,onPaneScroll:O,paneClickDistance:U,deleteKeyCode:D,selectionKeyCode:b,selectionOnDrag:g,selectionMode:x,onSelectionStart:d,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:E,zoomActivationKeyCode:C,elementsSelectable:V,zoomOnScroll:A,zoomOnPinch:M,zoomOnDoubleClick:R,panOnScroll:T,panOnScrollSpeed:H,panOnScrollMode:j,panOnDrag:F,defaultViewport:P,translateExtent:$,minZoom:L,maxZoom:y,onSelectionContextMenu:f,preventScrolling:I,noDragClassName:ce,noWheelClassName:fe,noPanClassName:xe,disableKeyboardA11y:qe,onViewportChange:Ke,isControlledViewport:!!He,children:_.jsxs(ah,{children:[_.jsx(ih,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:i,onReconnect:se,onReconnectStart:le,onReconnectEnd:oe,onlyRenderVisibleElements:k,onEdgeContextMenu:W,onEdgeMouseEnter:q,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:S,noPanClassName:xe,disableKeyboardA11y:qe,rfId:pt}),_.jsx(ph,{style:w,type:h,component:v,containerStyle:m}),_.jsx("div",{className:"react-flow__edgelabel-renderer"}),_.jsx(Of,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:K,onlyRenderVisibleElements:k,noPanClassName:xe,noDragClassName:ce,disableKeyboardA11y:qe,nodeExtent:Ut,rfId:pt}),_.jsx("div",{className:"react-flow__viewport-portal"})]})})}zi.displayName="GraphView";const xh=z.memo(zi),Ko=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:f,zIndexMode:d="basic"}={})=>{const p=new Map,h=new Map,w=new Map,v=new Map,m=o??t??[],b=n??e??[],g=u??[0,0],x=f??it;Ur(w,v,m);const N=wn(b,p,h,{nodeOrigin:g,nodeExtent:x,zIndexMode:d});let E=[0,0,1];if(i&&r&&s){const C=ft(p,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:D,y:k,zoom:V}=Pn(C,r,s,l,c,a?.padding??.1);E=[D,k,V]}return{rfId:"1",width:r??0,height:s??0,transform:E,nodes:b,nodesInitialized:N,nodeLookup:p,parentLookup:h,edges:m,edgeLookup:v,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:it,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ye.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:g,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Dr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Lu,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Tr,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},wh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d})=>$d((p,h)=>{async function w(){const{nodeLookup:v,panZoom:m,fitViewOptions:b,fitViewResolver:g,width:x,height:N,minZoom:E,maxZoom:C}=h();m&&(await $u({nodes:v,width:x,height:N,panZoom:m,minZoom:E,maxZoom:C},b),g?.resolve(!0),p({fitViewResolver:null}))}return{...Ko({nodes:e,edges:t,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:o,zIndexMode:d}),setNodes:v=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:g,elevateNodesOnSelect:x,fitViewQueued:N,zIndexMode:E}=h(),C=wn(v,m,b,{nodeOrigin:g,nodeExtent:f,elevateNodesOnSelect:x,checkEquality:!0,zIndexMode:E});N&&C?(w(),p({nodes:v,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:v,nodesInitialized:C})},setEdges:v=>{const{connectionLookup:m,edgeLookup:b}=h();Ur(m,b,v),p({edges:v})},setDefaultNodesAndEdges:(v,m)=>{if(v){const{setNodes:b}=h();b(v),p({hasDefaultNodes:!0})}if(m){const{setEdges:b}=h();b(m),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:g,domNode:x,nodeOrigin:N,nodeExtent:E,debug:C,fitViewQueued:D,zIndexMode:k}=h(),{changes:V,updatedInternals:P}=rd(v,b,g,x,N,E,k);P&&(ed(b,g,{nodeOrigin:N,nodeExtent:E,zIndexMode:k}),D?(w(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),V?.length>0&&(C&&console.log("React Flow: trigger node changes",V),m?.(V)))},updateNodePositions:(v,m=!1)=>{const b=[];let g=[];const{nodeLookup:x,triggerNodeChanges:N,connection:E,updateConnection:C,onNodesChangeMiddlewareMap:D}=h();for(const[k,V]of v){const P=x.get(k),$=!!(P?.expandParent&&P?.parentId&&V?.position),L={id:k,type:"position",position:$?{x:Math.max(0,V.position.x),y:Math.max(0,V.position.y)}:V.position,dragging:m};if(P&&E.inProgress&&E.fromNode.id===P.id){const y=Le(P,E.fromHandle,X.Left,!0);C({...E,from:y})}$&&P.parentId&&b.push({id:k,parentId:P.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),g.push(L)}if(b.length>0){const{parentLookup:k,nodeOrigin:V}=h(),P=Ln(b,x,k,V);g.push(...P)}for(const k of D.values())g=k(g);N(g)},triggerNodeChanges:v=>{const{onNodesChange:m,setNodes:b,nodes:g,hasDefaultNodes:x,debug:N}=h();if(v?.length){if(x){const E=tf(v,g);b(E)}N&&console.log("React Flow: trigger node changes",v),m?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:m,setEdges:b,edges:g,hasDefaultEdges:x,debug:N}=h();if(v?.length){if(x){const E=nf(v,g);b(E)}N&&console.log("React Flow: trigger edge changes",v),m?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:N}=h();if(m){const E=v.map(C=>Te(C,!0));x(E);return}x(Ve(g,new Set([...v]),!0)),N(Ve(b))},addSelectedEdges:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:N}=h();if(m){const E=v.map(C=>Te(C,!0));N(E);return}N(Ve(b,new Set([...v]))),x(Ve(g,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:m}={})=>{const{edges:b,nodes:g,nodeLookup:x,triggerNodeChanges:N,triggerEdgeChanges:E}=h(),C=v||g,D=m||b,k=C.map(P=>{const $=x.get(P.id);return $&&($.selected=!1),Te(P.id,!1)}),V=D.map(P=>Te(P.id,!1));N(k),E(V)},setMinZoom:v=>{const{panZoom:m,maxZoom:b}=h();m?.setScaleExtent([v,b]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:m,minZoom:b}=h();m?.setScaleExtent([b,v]),p({maxZoom:v})},setTranslateExtent:v=>{h().panZoom?.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:g,elementsSelectable:x}=h();if(!x)return;const N=m.reduce((C,D)=>D.selected?[...C,Te(D.id,!1)]:C,[]),E=v.reduce((C,D)=>D.selected?[...C,Te(D.id,!1)]:C,[]);b(N),g(E)},setNodeExtent:v=>{const{nodes:m,nodeLookup:b,parentLookup:g,nodeOrigin:x,elevateNodesOnSelect:N,nodeExtent:E,zIndexMode:C}=h();v[0][0]===E[0][0]&&v[0][1]===E[0][1]&&v[1][0]===E[1][0]&&v[1][1]===E[1][1]||(wn(m,b,g,{nodeOrigin:x,nodeExtent:v,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:C}),p({nodeExtent:v}))},panBy:v=>{const{transform:m,width:b,height:g,panZoom:x,translateExtent:N}=h();return id({delta:v,panZoom:x,transform:m,translateExtent:N,width:b,height:g})},setCenter:async(v,m,b)=>{const{width:g,height:x,maxZoom:N,panZoom:E}=h();if(!E)return Promise.resolve(!1);const C=typeof b?.zoom<"u"?b.zoom:N;return await E.setViewport({x:g/2-v*C,y:x/2-m*C,zoom:C},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Dr}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...Ko()})}},Object.is);function vh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d,children:p}){const[h]=z.useState(()=>wh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:c,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:f,zIndexMode:d}));return _.jsx(zd,{value:h,children:_.jsx(af,{children:p})})}function _h({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p}){return z.useContext(Gt)?_.jsx(_.Fragment,{children:e}):_.jsx(vh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p,children:e})}const bh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Sh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:f,onMoveEnd:d,onConnect:p,onConnectStart:h,onConnectEnd:w,onClickConnectStart:v,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:N,onNodeDoubleClick:E,onNodeDragStart:C,onNodeDrag:D,onNodeDragStop:k,onNodesDelete:V,onEdgesDelete:P,onDelete:$,onSelectionChange:L,onSelectionDragStart:y,onSelectionDrag:I,onSelectionDragStop:S,onSelectionContextMenu:A,onSelectionStart:M,onSelectionEnd:T,onBeforeDelete:H,connectionMode:j,connectionLineType:R=Ie.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:G,deleteKeyCode:Q="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:O=!1,selectionMode:Y=st.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:K=ct()?"Meta":"Control",zoomActivationKeyCode:W=ct()?"Meta":"Control",snapToGrid:q,snapGrid:J,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:oe,nodesFocusable:ce,nodeOrigin:fe=ui,edgesFocusable:xe,edgesReconnectable:qe,elementsSelectable:Ut=!0,defaultViewport:pt=Wd,minZoom:He=.5,maxZoom:Ke=2,translateExtent:Vn=it,preventScrolling:Bi=!0,nodeExtent:Qt,defaultMarkerColor:Fi="#b1b1b7",zoomOnScroll:Yi=!0,zoomOnPinch:Xi=!0,panOnScroll:Zi=!1,panOnScrollSpeed:Gi=.5,panOnScrollMode:Wi=De.Free,zoomOnDoubleClick:qi=!0,panOnDrag:Ki=!0,onPaneClick:Ui,onPaneMouseEnter:Qi,onPaneMouseMove:Ji,onPaneMouseLeave:es,onPaneScroll:ts,onPaneContextMenu:ns,paneClickDistance:os=1,nodeClickDistance:rs=0,children:is,onReconnect:ss,onReconnectStart:as,onReconnectEnd:cs,onEdgeContextMenu:ls,onEdgeDoubleClick:us,onEdgeMouseEnter:ds,onEdgeMouseMove:fs,onEdgeMouseLeave:hs,reconnectRadius:gs=10,onNodesChange:ps,onEdgesChange:ms,noDragClassName:ys="nodrag",noWheelClassName:xs="nowheel",noPanClassName:On="nopan",fitView:Bn,fitViewOptions:Fn,connectOnClick:ws,attributionPosition:vs,proOptions:_s,defaultEdgeOptions:bs,elevateNodesOnSelect:Ss=!0,elevateEdgesOnSelect:Es=!1,disableKeyboardA11y:Yn=!1,autoPanOnConnect:Cs,autoPanOnNodeDrag:Ns,autoPanSpeed:Ms,connectionRadius:Is,isValidConnection:ks,onError:Ps,style:As,id:Xn,nodeDragThreshold:Ts,connectionDragThreshold:Ds,viewport:$s,onViewportChange:zs,width:Ls,height:Hs,colorMode:Rs="light",debug:js,onScroll:Zn,ariaLabelConfig:Vs,zIndexMode:Gn="basic",...Os},Bs){const Jt=Xn||"1",Fs=Qd(Rs),Ys=z.useCallback(Wn=>{Wn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Zn?.(Wn)},[Zn]);return _.jsx("div",{"data-testid":"rf__wrapper",...Os,onScroll:Ys,style:{...As,...bh},ref:Bs,className:ae(["react-flow",r,Fs]),id:Xn,role:"application",children:_.jsxs(_h,{nodes:e,edges:t,width:Ls,height:Hs,fitView:Bn,fitViewOptions:Fn,minZoom:He,maxZoom:Ke,nodeOrigin:fe,nodeExtent:Qt,zIndexMode:Gn,children:[_.jsx(xh,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:N,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:i,connectionLineType:R,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:G,selectionKeyCode:Z,selectionOnDrag:O,selectionMode:Y,deleteKeyCode:Q,multiSelectionKeyCode:K,panActivationKeyCode:U,zoomActivationKeyCode:W,onlyRenderVisibleElements:ne,defaultViewport:pt,translateExtent:Vn,minZoom:He,maxZoom:Ke,preventScrolling:Bi,zoomOnScroll:Yi,zoomOnPinch:Xi,zoomOnDoubleClick:qi,panOnScroll:Zi,panOnScrollSpeed:Gi,panOnScrollMode:Wi,panOnDrag:Ki,onPaneClick:Ui,onPaneMouseEnter:Qi,onPaneMouseMove:Ji,onPaneMouseLeave:es,onPaneScroll:ts,onPaneContextMenu:ns,paneClickDistance:os,nodeClickDistance:rs,onSelectionContextMenu:A,onSelectionStart:M,onSelectionEnd:T,onReconnect:ss,onReconnectStart:as,onReconnectEnd:cs,onEdgeContextMenu:ls,onEdgeDoubleClick:us,onEdgeMouseEnter:ds,onEdgeMouseMove:fs,onEdgeMouseLeave:hs,reconnectRadius:gs,defaultMarkerColor:Fi,noDragClassName:ys,noWheelClassName:xs,noPanClassName:On,rfId:Jt,disableKeyboardA11y:Yn,nodeExtent:Qt,viewport:$s,onViewportChange:zs}),_.jsx(Ud,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:h,onConnectEnd:w,onClickConnectStart:v,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:oe,nodesFocusable:ce,edgesFocusable:xe,edgesReconnectable:qe,elementsSelectable:Ut,elevateNodesOnSelect:Ss,elevateEdgesOnSelect:Es,minZoom:He,maxZoom:Ke,nodeExtent:Qt,onNodesChange:ps,onEdgesChange:ms,snapToGrid:q,snapGrid:J,connectionMode:j,translateExtent:Vn,connectOnClick:ws,defaultEdgeOptions:bs,fitView:Bn,fitViewOptions:Fn,onNodesDelete:V,onEdgesDelete:P,onDelete:$,onNodeDragStart:C,onNodeDrag:D,onNodeDragStop:k,onSelectionDrag:I,onSelectionDragStart:y,onSelectionDragStop:S,onMove:u,onMoveStart:f,onMoveEnd:d,noPanClassName:On,nodeOrigin:fe,rfId:Jt,autoPanOnConnect:Cs,autoPanOnNodeDrag:Ns,autoPanSpeed:Ms,onError:Ps,connectionRadius:Is,isValidConnection:ks,selectNodesOnDrag:te,nodeDragThreshold:Ts,connectionDragThreshold:Ds,onBeforeDelete:H,debug:js,ariaLabelConfig:Vs,zIndexMode:Gn}),_.jsx(Gd,{onSelectionChange:L}),is,_.jsx(Bd,{proOptions:_s,position:vs}),_.jsx(Od,{rfId:Jt,disableKeyboardA11y:Yn})]})})}var Eh=fi(Sh);function Ch({dimensions:e,lineWidth:t,variant:n,className:o}){return _.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ae(["react-flow__background-pattern",n,o])})}function Nh({radius:e,className:t}){return _.jsx("circle",{cx:e,cy:e,r:e,className:ae(["react-flow__background-pattern","dots",t])})}var ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ke||(ke={}));const Mh={[ke.Dots]:1,[ke.Lines]:1,[ke.Cross]:6},Ih=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Li({id:e,variant:t=ke.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=0,color:i,bgColor:a,style:l,className:c,patternClassName:u}){const f=z.useRef(null),{transform:d,patternId:p}=ee(Ih,re),h=o||Mh[t],w=t===ke.Dots,v=t===ke.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],g=h*d[2],x=Array.isArray(s)?s:[s,s],N=v?[g,g]:b,E=[x[0]*d[2]||1+N[0]/2,x[1]*d[2]||1+N[1]/2],C=`${p}${e||""}`;return _.jsxs("svg",{className:ae(["react-flow__background",c]),style:{...l,...qt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:f,"data-testid":"rf__background",children:[_.jsx("pattern",{id:C,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:w?_.jsx(Nh,{radius:g/2,className:u}):_.jsx(Ch,{dimensions:N,lineWidth:r,variant:t,className:u})}),_.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}Li.displayName="Background";z.memo(Li);function kh(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:_.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Ph(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Ah(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:_.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Th(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Dh(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function bt({children:e,className:t,...n}){return _.jsx("button",{type:"button",className:ae(["react-flow__controls-button",t]),...n,children:e})}const $h=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Hi({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:u,position:f="bottom-left",orientation:d="vertical","aria-label":p}){const h=ie(),{isInteractive:w,minZoomReached:v,maxZoomReached:m,ariaLabelConfig:b}=ee($h,re),{zoomIn:g,zoomOut:x,fitView:N}=Hn(),E=()=>{g(),s?.()},C=()=>{x(),i?.()},D=()=>{N(r),a?.()},k=()=>{h.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)},V=d==="horizontal"?"horizontal":"vertical";return _.jsxs(Wt,{className:ae(["react-flow__controls",V,c]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??b["controls.ariaLabel"],children:[t&&_.jsxs(_.Fragment,{children:[_.jsx(bt,{onClick:E,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:_.jsx(kh,{})}),_.jsx(bt,{onClick:C,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:v,children:_.jsx(Ph,{})})]}),n&&_.jsx(bt,{className:"react-flow__controls-fitview",onClick:D,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:_.jsx(Ah,{})}),o&&_.jsx(bt,{className:"react-flow__controls-interactive",onClick:k,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?_.jsx(Dh,{}):_.jsx(Th,{})}),u]})}Hi.displayName="Controls";z.memo(Hi);function zh({id:e,x:t,y:n,width:o,height:r,style:s,color:i,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:f,selected:d,onClick:p}){const{background:h,backgroundColor:w}=s||{},v=i||h||w;return _.jsx("rect",{className:ae(["react-flow__minimap-node",{selected:d},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:v,stroke:a,strokeWidth:l},shapeRendering:f,onClick:p?m=>p(m,e):void 0})}const Lh=z.memo(zh),Hh=e=>e.nodes.map(t=>t.id),ln=e=>e instanceof Function?e:()=>e;function Rh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:s=Lh,onClick:i}){const a=ee(Hh,re),l=ln(t),c=ln(e),u=ln(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return _.jsx(_.Fragment,{children:a.map(d=>_.jsx(Vh,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:s,onClick:i,shapeRendering:f},d))})}function jh({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:c,x:u,y:f,width:d,height:p}=ee(h=>{const{internals:w}=h.nodeLookup.get(e),v=w.userNode,{x:m,y:b}=w.positionAbsolute,{width:g,height:x}=Ce(v);return{node:v,x:m,y:b,width:g,height:x}},re);return!c||c.hidden||!Vr(c)?null:_.jsx(a,{x:u,y:f,width:d,height:p,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:s,shapeRendering:i,onClick:l,id:c.id})}const Vh=z.memo(jh);var Oh=z.memo(Rh);const Bh=200,Fh=150,Yh=e=>!e.hidden,Xh=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?jr(ft(e.nodeLookup,{filter:Yh}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Zh="react-flow__minimap-desc";function Ri({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:f,position:d="bottom-right",onClick:p,onNodeClick:h,pannable:w=!1,zoomable:v=!1,ariaLabel:m,inversePan:b,zoomStep:g=1,offsetScale:x=5}){const N=ie(),E=z.useRef(null),{boundingRect:C,viewBB:D,rfId:k,panZoom:V,translateExtent:P,flowWidth:$,flowHeight:L,ariaLabelConfig:y}=ee(Xh,re),I=e?.width??Bh,S=e?.height??Fh,A=C.width/I,M=C.height/S,T=Math.max(A,M),H=T*I,j=T*S,R=x*T,F=C.x-(H-C.width)/2-R,B=C.y-(j-C.height)/2-R,G=H+R*2,Q=j+R*2,Z=`${Zh}-${k}`,O=z.useRef(0),Y=z.useRef();O.current=T,z.useEffect(()=>{if(E.current&&V)return Y.current=gd({domNode:E.current,panZoom:V,getTransform:()=>N.getState().transform,getViewScale:()=>O.current}),()=>{Y.current?.destroy()}},[V]),z.useEffect(()=>{Y.current?.update({translateExtent:P,width:$,height:L,inversePan:b,pannable:w,zoomStep:g,zoomable:v})},[w,v,b,g,P,$,L]);const U=p?q=>{const[J,ne]=Y.current?.pointer(q)||[0,0];p(q,{x:J,y:ne})}:void 0,K=h?z.useCallback((q,J)=>{const ne=N.getState().nodeLookup.get(J).internals.userNode;h(q,ne)},[]):void 0,W=m??y["minimap.ariaLabel"];return _.jsx(Wt,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*T:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:ae(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:_.jsxs("svg",{width:I,height:S,viewBox:`${F} ${B} ${G} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:E,onClick:U,children:[W&&_.jsx("title",{id:Z,children:W}),_.jsx(Oh,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:i,nodeComponent:a}),_.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-R},${B-R}h${G+R*2}v${Q+R*2}h${-G-R*2}z
|
|
7
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ri.displayName="MiniMap";z.memo(Ri);const Gh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Wh={[We.Line]:"right",[We.Handle]:"bottom-right"};function qh({nodeId:e,position:t,variant:n=We.Handle,className:o,style:r=void 0,children:s,color:i,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:p=!0,shouldResize:h,onResizeStart:w,onResize:v,onResizeEnd:m}){const b=mi(),g=typeof e=="string"?e:b,x=ie(),N=z.useRef(null),E=n===We.Handle,C=ee(z.useCallback(Gh(E&&p),[E,p]),re),D=z.useRef(null),k=t??Wh[n];z.useEffect(()=>{if(!(!N.current||!g))return D.current||(D.current=Id({domNode:N.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:P,transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I,domNode:S}=x.getState();return{nodeLookup:P,transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I,paneDomNode:S}},onChange:(P,$)=>{const{triggerNodeChanges:L,nodeLookup:y,parentLookup:I,nodeOrigin:S}=x.getState(),A=[],M={x:P.x,y:P.y},T=y.get(g);if(T&&T.expandParent&&T.parentId){const H=T.origin??S,j=P.width??T.measured.width??0,R=P.height??T.measured.height??0,F={id:T.id,parentId:T.parentId,rect:{width:j,height:R,...Or({x:P.x??T.position.x,y:P.y??T.position.y},{width:j,height:R},T.parentId,y,H)}},B=Ln([F],y,I,S);A.push(...B),M.x=P.x?Math.max(H[0]*j,P.x):void 0,M.y=P.y?Math.max(H[1]*R,P.y):void 0}if(M.x!==void 0&&M.y!==void 0){const H={id:g,type:"position",position:{...M}};A.push(H)}if(P.width!==void 0&&P.height!==void 0){const j={id:g,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};A.push(j)}for(const H of $){const j={...H,type:"position"};A.push(j)}L(A)},onEnd:({width:P,height:$})=>{const L={id:g,type:"dimensions",resizing:!1,dimensions:{width:P,height:$}};x.getState().triggerNodeChanges([L])}})),D.current.update({controlPosition:k,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:f,resizeDirection:d,onResizeStart:w,onResize:v,onResizeEnd:m,shouldResize:h}),()=>{D.current?.destroy()}},[k,a,l,c,u,f,w,v,m,h]);const V=k.split("-");return _.jsx("div",{className:ae(["react-flow__resize-control","nodrag",...V,n,o]),ref:N,style:{...r,scale:C,...i&&{[E?"backgroundColor":"borderColor"]:i}},children:s})}z.memo(qh);const ji=z.createContext(void 0);function Vi(){const e=z.useContext(ji);if(!e)throw new Error("useMetricsMode must be used within MetricsModeProvider");return e}function Kh(e){const t=he.c(5),{children:n}=e,[o,r]=z.useState("requests");let s;t[0]!==o?(s={metricsMode:o,setMetricsMode:r},t[0]=o,t[1]=s):s=t[1];let i;return t[2]!==n||t[3]!==s?(i=_.jsx(ji.Provider,{value:s,children:n}),t[2]=n,t[3]=s,t[4]=i):i=t[4],i}const Uo=10,Ht=56,jn=220,nt=56,Uh={requests:{edgeColor:"var(--chart-1)",textClass:"text-chart-1"},errors:{edgeColor:"var(--chart-3)",textClass:"text-chart-3"},latency:{edgeColor:"var(--chart-4)",textClass:"text-chart-4"}};function Qh(){const e=Date.now(),t=300*1e3,n=Math.floor(e/t)*t,o=new Date(n);return{startDate:new Date(n-1440*60*1e3).toISOString(),endDate:o.toISOString()}}function Jh(e){const t=new Map,n=new Map;for(const s of e){const i=s.connectionId;if(i){const l=n.get(i)??{requests:0,errors:0,totalLatency:0};n.set(i,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}const a=s.gatewayId;if(a){const l=t.get(a)??{requests:0,errors:0,totalLatency:0};t.set(a,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}}const o=new Map;for(const[s,i]of t)o.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});const r=new Map;for(const[s,i]of n)r.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});return{gateways:o,connections:r}}function Oi(e,t){if(!e)return"—";switch(t){case"requests":return e.requests===0?"—":e.requests.toLocaleString();case"errors":return e.errorRate===0?"—":`${e.errorRate.toFixed(1)}%`;case"latency":return e.avgLatencyMs===0?"—":`${Math.round(e.avgLatencyMs)}ms`}}function St(e,t){if(!e)return 0;switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function eg(){const e=he.c(9),{locator:t}=bn();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=sa(),e[0]=n):n=e[0];const o=n;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=Qh(),e[1]=r):r=e[1];const s=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={...s,limit:1e3,offset:0},e[2]=i):i=e[2];let a;e[3]!==t?(a={toolCaller:o,toolName:"MONITORING_LOGS_LIST",toolInputParams:i,scope:t,staleTime:3e4},e[3]=t,e[4]=a):a=e[4];const{data:l}=ma(a);let c;e[5]!==l?.logs?(c=l?.logs??[],e[5]=l?.logs,e[6]=c):c=e[6];const u=c;let f;return e[7]!==u?(f=Jh(u),e[7]=u,e[8]=f):f=e[8],f}function tg(e){const t=he.c(29),{data:n}=e,o=Rt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Oi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.gateway.id||t[4]!==n.org||t[5]!==o?(i=()=>{o({to:"/$org/gateways/$gatewayId",params:{org:n.org,gatewayId:n.gateway.id}})},t[3]=n.gateway.id,t[4]=n.org,t[5]=o,t[6]=i):i=t[6];const a=i;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Ht,width:jn},t[7]=l):l=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=_.jsx(ca,{}),t[8]=c):c=t[8];let u;t[9]!==n.gateway.icon||t[10]!==n.gateway.title?(u=_.jsx(er,{icon:n.gateway.icon,name:n.gateway.title,size:"md",fallbackIcon:c,className:"relative z-10"}),t[9]=n.gateway.icon,t[10]=n.gateway.title,t[11]=u):u=t[11];let f;t[12]!==n.gateway.title?(f=_.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.gateway.title}),t[12]=n.gateway.title,t[13]=f):f=t[13];let d;t[14]!==n.colorScheme.textClass?(d=or("text-base leading-none font-semibold tabular-nums",n.colorScheme.textClass),t[14]=n.colorScheme.textClass,t[15]=d):d=t[15];let p;t[16]!==s||t[17]!==d?(p=_.jsx("span",{className:d,children:s}),t[16]=s,t[17]=d,t[18]=p):p=t[18];let h;t[19]!==f||t[20]!==p?(h=_.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[f,p]}),t[19]=f,t[20]=p,t[21]=h):h=t[21];let w;t[22]!==n.colorScheme.edgeColor?(w=_.jsx(Pe,{type:"source",position:X.Right,style:{width:"8px",height:"8px",background:n.colorScheme.edgeColor,border:"none"}}),t[22]=n.colorScheme.edgeColor,t[23]=w):w=t[23];let v;return t[24]!==a||t[25]!==w||t[26]!==u||t[27]!==h?(v=_.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,h,w]}),t[24]=a,t[25]=w,t[26]=u,t[27]=h,t[28]=v):v=t[28],v}function ng(e){const t=he.c(29),{data:n}=e,o=Rt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Oi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.connection.id||t[4]!==n.org||t[5]!==o?(i=()=>{o({to:"/$org/mcps/$connectionId",params:{org:n.org,connectionId:n.connection.id}})},t[3]=n.connection.id,t[4]=n.org,t[5]=o,t[6]=i):i=t[6];const a=i;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Ht,width:jn},t[7]=l):l=t[7];const c=`1px solid ${n.colorScheme.edgeColor}`;let u;t[8]!==c?(u=_.jsx(Pe,{type:"target",position:X.Left,style:{width:"8px",height:"8px",background:"var(--background)",border:c,pointerEvents:"none",cursor:"default"}}),t[8]=c,t[9]=u):u=t[9];let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f=_.jsx(aa,{}),t[10]=f):f=t[10];let d;t[11]!==n.connection.icon||t[12]!==n.connection.title?(d=_.jsx(er,{icon:n.connection.icon,name:n.connection.title,size:"md",fallbackIcon:f,className:"relative z-10"}),t[11]=n.connection.icon,t[12]=n.connection.title,t[13]=d):d=t[13];let p;t[14]!==n.connection.title?(p=_.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.connection.title}),t[14]=n.connection.title,t[15]=p):p=t[15];let h;t[16]!==n.colorScheme.textClass?(h=or("text-base leading-[1.35] font-semibold tabular-nums",n.colorScheme.textClass),t[16]=n.colorScheme.textClass,t[17]=h):h=t[17];let w;t[18]!==s||t[19]!==h?(w=_.jsx("span",{className:h,children:s}),t[18]=s,t[19]=h,t[20]=w):w=t[20];let v;t[21]!==w||t[22]!==p?(v=_.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[p,w]}),t[21]=w,t[22]=p,t[23]=v):v=t[23];let m;return t[24]!==a||t[25]!==v||t[26]!==u||t[27]!==d?(m=_.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,d,v]}),t[24]=a,t[25]=v,t[26]=u,t[27]=d,t[28]=m):m=t[28],m}function og(e){const t=he.c(9),{data:n}=e,o=Rt();let r;t[0]!==n.org||t[1]!==o?(r=()=>{o({to:"/$org/store",params:{org:n.org}})},t[0]=n.org,t[1]=o,t[2]=r):r=t[2];const s=r;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={height:nt,width:nt},t[3]=i):i=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=_.jsx(Pe,{type:"target",position:X.Left,style:{opacity:0,pointerEvents:"none"}}),l=_.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-8 w-8"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=_.jsx(Pe,{type:"source",position:X.Right,style:{opacity:0,pointerEvents:"none"}}),t[6]=c):c=t[6];let u;return t[7]!==s?(u=_.jsxs("div",{className:"flex items-center justify-center p-2 bg-primary border border-primary-foreground/50 rounded-lg shadow-sm cursor-pointer pointer-events-auto",style:i,onClick:s,children:[a,l,c]}),t[7]=s,t[8]=u):u=t[8],u}const rg={gateway:tg,server:ng,mesh:og};function ig(){const e=he.c(8),{metricsMode:t,setMetricsMode:n}=Vi();let o;e[0]!==n?(o=l=>l&&n(l),e[0]=n,e[1]=o):o=e[1];let r,s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=_.jsx(tn,{value:"requests",className:"text-xs px-3 cursor-pointer",children:"Tool Calls"}),s=_.jsx(tn,{value:"errors",className:"text-xs px-3 cursor-pointer",children:"Errors"}),i=_.jsx(tn,{value:"latency",className:"text-xs px-3 cursor-pointer",children:"Latency"}),e[2]=r,e[3]=s,e[4]=i):(r=e[2],s=e[3],i=e[4]);let a;return e[5]!==t||e[6]!==o?(a=_.jsxs(xa,{type:"single",value:t,onValueChange:o,variant:"outline",size:"sm",className:"bg-background/80 backdrop-blur-sm",children:[r,s,i]}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function sg(){const e=he.c(36),{metricsMode:t}=Vi(),{org:n}=bn();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:Uo},e[0]=o):o=e[0];const r=tr(o);let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s={pageSize:Uo},e[1]=s):s=e[1];const i=Jo(s),a=eg();let l,c,u,f,d;if(e[2]!==t||e[3]!==a||e[4]!==i||e[5]!==r){let P;e[11]!==t||e[12]!==a?(P=(L,y)=>St(a.gateways.get(y.id),t)-St(a.gateways.get(L.id),t),e[11]=t,e[12]=a,e[13]=P):P=e[13],d=[...r].sort(P);let $;e[14]!==t||e[15]!==a?($=(L,y)=>St(a.connections.get(y.id),t)-St(a.connections.get(L.id),t),e[14]=t,e[15]=a,e[16]=$):$=e[16],f=[...i].sort($),l=Uh[t],u=new Map,d.forEach((L,y)=>u.set(L.id,y)),c=new Map,f.forEach((L,y)=>c.set(L.id,y)),e[2]=t,e[3]=a,e[4]=i,e[5]=r,e[6]=l,e[7]=c,e[8]=u,e[9]=f,e[10]=d}else l=e[6],c=e[7],u=e[8],f=e[9],d=e[10];const p=-nt/2,h=nt/2,w=p-100-jn,v=h+100,m=d.length,b=f.length;let g,x;if(e[17]!==l||e[18]!==c||e[19]!==u||e[20]!==m||e[21]!==t||e[22]!==a||e[23]!==n.slug||e[24]!==i||e[25]!==r||e[26]!==b){const P={stroke:l.edgeColor,strokeWidth:1.25,strokeDasharray:"8 6",strokeLinecap:"square"};x=[],g=[],x.push({id:"mesh",type:"mesh",position:{x:p,y:-nt/2},data:{org:n.slug,colorScheme:l},draggable:!1,selectable:!1}),[...r].sort(cg).forEach(y=>{const A=((u.get(y.id)??0)-(m-1)/2)*70-Ht/2;x.push({id:`gateway-${y.id}`,type:"gateway",position:{x:w,y:A},data:{gateway:y,metricsMode:t,metric:a.gateways.get(y.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),g.push({id:`e-gw-${y.id}`,source:`gateway-${y.id}`,target:"mesh",type:"smoothstep",animated:!0,style:P})}),[...i].sort(ag).forEach(y=>{const A=((c.get(y.id)??0)-(b-1)/2)*70-Ht/2;x.push({id:`server-${y.id}`,type:"server",position:{x:v,y:A},data:{connection:y,metricsMode:t,metric:a.connections.get(y.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),g.push({id:`e-srv-${y.id}`,source:"mesh",target:`server-${y.id}`,type:"smoothstep",animated:!0,style:P})}),e[17]=l,e[18]=c,e[19]=u,e[20]=m,e[21]=t,e[22]=a,e[23]=n.slug,e[24]=i,e[25]=r,e[26]=b,e[27]=g,e[28]=x}else g=e[27],x=e[28];let N;e[29]===Symbol.for("react.memo_cache_sentinel")?(N={backgroundImage:"radial-gradient(circle, var(--border) 1px, transparent 1.5px)",backgroundSize:"32px 32px"},e[29]=N):N=e[29];const E=N;let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=_.jsx("style",{children:`
|
|
6
|
+
`)),u=c.reduce((f,d)=>f.concat(...d),[]);return[c,u]}return[[],[]]},[e]);return z.useEffect(()=>{const l=t?.target??Do,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!c)&&Fr(p))return!1;const w=zo(p.code,a);if(s.current.add(p[w]),$o(i,s.current,!1)){const v=p.composedPath?.()?.[0]||p.target,m=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&p.preventDefault(),o(!0)}},f=p=>{const h=zo(p.code,a);$o(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(p[h]),p.key==="Meta"&&s.current.clear(),r.current=!1},d=()=>{s.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function $o(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function zo(e,t){return t.includes(e)?"code":"key"}const Jd=()=>{const e=ie();return z.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),l=Pn(t,o,r,s,i,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,f=n.snapToGrid??s;return gt(c,o,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:s}=o.getBoundingClientRect(),i=zt(t,n);return{x:i.x+r,y:i.y+s}}}),[])};function di(e,t){const n=[],o=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const i=o.get(s.id);i?i.push(s):o.set(s.id,[s])}for(const s of t){const i=o.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const l of i)ef(l,a);n.push(a)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function ef(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function tf(e,t){return di(e,t)}function nf(e,t){return di(e,t)}function Te(e,t){return{id:e,type:"select",selected:t}}function Ve(e,t=new Set,n=!1){const o=[];for(const[r,s]of e){const i=t.has(r);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),o.push(Te(s.id,i)))}return o}function Lo({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,s]of e.entries()){const i=t.get(s.id),a=i?.internals?.userNode??i;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function Ho(e){return{id:e.id,type:"remove"}}const Ro=e=>Pu(e),of=e=>zr(e);function fi(e){return z.forwardRef(e)}const rf=typeof window<"u"?z.useLayoutEffect:z.useEffect;function jo(e){const[t,n]=z.useState(BigInt(0)),[o]=z.useState(()=>sf(()=>n(r=>r+BigInt(1))));return rf(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function sf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const hi=z.createContext(null);function af({children:e}){const t=ie(),n=z.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:f,nodeLookup:d,fitViewQueued:p,onNodesChangeMiddlewareMap:h}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;let v=Lo({items:w,lookup:d});for(const m of h.values())v=m(v);u&&c(w),v.length>0?f?.(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:g}=t.getState();m&&g(b)})},[]),o=jo(n),r=z.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:d}=t.getState();let p=l;for(const h of a)p=typeof h=="function"?h(p):h;u?c(p):f&&f(Lo({items:p,lookup:d}))},[]),s=jo(r),i=z.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return _.jsx(hi.Provider,{value:i,children:e})}function cf(){const e=z.useContext(hi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const lf=e=>!!e.panZoom;function Hn(){const e=Jd(),t=ie(),n=cf(),o=ee(lf),r=z.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),i=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},l=f=>{const{nodeLookup:d,nodeOrigin:p}=t.getState(),h=Ro(f)?f:d.get(f.id),w=h.parentId?Or(h.position,h.measured,h.parentId,d,p):h.position,v={...h,position:w,width:h.measured?.width??h.width,height:h.measured?.height??h.height};return Ze(v)},c=(f,d,p={replace:!1})=>{i(h=>h.map(w=>{if(w.id===f){const v=typeof d=="function"?d(w):d;return p.replace&&Ro(v)?v:{...w,...v}}return w}))},u=(f,d,p={replace:!1})=>{a(h=>h.map(w=>{if(w.id===f){const v=typeof d=="function"?d(w):d;return p.replace&&of(v)?v:{...w,...v}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>s(f)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:i,setEdges:a,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:p}=t.getState(),[h,w,v]=p;return{nodes:f.map(m=>({...m})),edges:d.map(m=>({...m})),viewport:{x:h,y:w,zoom:v}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:p,edges:h,onNodesDelete:w,onEdgesDelete:v,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:g,onBeforeDelete:x}=t.getState(),{nodes:M,edges:E}=await zu({nodesToRemove:f,edgesToRemove:d,nodes:p,edges:h,onBeforeDelete:x}),C=E.length>0,D=M.length>0;if(C){const k=E.map(Ho);v?.(E),b(k)}if(D){const k=M.map(Ho);w?.(M),m(k)}return(D||C)&&g?.({nodes:M,edges:E}),{deletedNodes:M,deletedEdges:E}},getIntersectingNodes:(f,d=!0,p)=>{const h=go(f),w=h?f:l(f),v=p!==void 0;return w?(p||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!h&&(m.id===f.id||!b.internals.positionAbsolute))return!1;const g=Ze(v?m:b),x=at(g,w);return d&&x>0||x>=g.width*g.height||x>=w.width*w.height}):[]},isNodeIntersecting:(f,d,p=!0)=>{const w=go(f)?f:l(f);if(!w)return!1;const v=at(w,d);return p&&v>0||v>=d.width*d.height||v>=w.width*w.height},updateNode:c,updateNodeData:(f,d,p={replace:!1})=>{c(f,h=>{const w=typeof d=="function"?d(h):d;return p.replace?{...h,data:w}:{...h,data:{...h.data,...w}}},p)},updateEdge:u,updateEdgeData:(f,d,p={replace:!1})=>{u(f,h=>{const w=typeof d=="function"?d(h):d;return p.replace?{...h,data:w}:{...h,data:{...h.data,...w}}},p)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:p}=t.getState();return Au(f,{nodeLookup:d,nodeOrigin:p})},getHandleConnections:({type:f,id:d,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}-${f}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:d,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}${f?d?`-${f}-${d}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const d=t.getState().fitViewResolver??ju();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(p=>[...p]),d.promise}}},[]);return z.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Vo=e=>e.selected,uf=typeof window<"u"?window:void 0;function df({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ie(),{deleteElements:o}=Hn(),r=lt(e,{actInsideInputWithModifier:!1}),s=lt(t,{target:uf});z.useEffect(()=>{if(r){const{edges:i,nodes:a}=n.getState();o({nodes:a.filter(Vo),edges:i.filter(Vo)}),n.setState({nodesSelectionActive:!1})}},[r]),z.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function ff(e){const t=ie();z.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=An(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ve.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const qt={position:"absolute",width:"100%",height:"100%",top:0,left:0},hf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function gf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=De.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:p=!0,children:h,noWheelClassName:w,noPanClassName:v,onViewportChange:m,isControlledViewport:b,paneClickDistance:g,selectionOnDrag:x}){const M=ie(),E=z.useRef(null),{userSelectionActive:C,lib:D,connectionInProgress:k}=ee(hf,re),V=lt(d),P=z.useRef();ff(E);const $=z.useCallback(L=>{m?.({x:L[0],y:L[1],zoom:L[2]}),b||M.setState({transform:L})},[m,b]);return z.useEffect(()=>{if(E.current){P.current=bd({domNode:E.current,minZoom:u,maxZoom:f,translateExtent:c,viewport:l,onDraggingChange:S=>M.setState({paneDragging:S}),onPanZoomStart:(S,A)=>{const{onViewportChangeStart:N,onMoveStart:T}=M.getState();T?.(S,A),N?.(A)},onPanZoom:(S,A)=>{const{onViewportChange:N,onMove:T}=M.getState();T?.(S,A),N?.(A)},onPanZoomEnd:(S,A)=>{const{onViewportChangeEnd:N,onMoveEnd:T}=M.getState();T?.(S,A),N?.(A)}});const{x:L,y,zoom:I}=P.current.getViewport();return M.setState({panZoom:P.current,transform:[L,y,I],domNode:E.current.closest(".react-flow")}),()=>{P.current?.destroy()}}},[]),z.useEffect(()=>{P.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:V,preventScrolling:p,noPanClassName:v,userSelectionActive:C,noWheelClassName:w,lib:D,onTransformChange:$,connectionInProgress:k,selectionOnDrag:x,paneClickDistance:g})},[e,t,n,o,r,s,i,a,V,p,v,C,w,D,$,k,x,g]),_.jsx("div",{className:"react-flow__renderer",ref:E,style:qt,children:h})}const pf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function mf(){const{userSelectionActive:e,userSelectionRect:t}=ee(pf,re);return e&&t?_.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const cn=(e,t)=>n=>{n.target===t.current&&e?.(n)},yf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function xf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=st.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:p,children:h}){const w=ie(),{userSelectionActive:v,elementsSelectable:m,dragging:b,connectionInProgress:g}=ee(yf,re),x=m&&(e||v),M=z.useRef(null),E=z.useRef(),C=z.useRef(new Set),D=z.useRef(new Set),k=z.useRef(!1),V=N=>{if(k.current||g){k.current=!1;return}l?.(N),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=N=>{if(Array.isArray(o)&&o?.includes(2)){N.preventDefault();return}c?.(N)},$=u?N=>u(N):void 0,L=N=>{k.current&&(N.stopPropagation(),k.current=!1)},y=N=>{const{domNode:T}=w.getState();if(E.current=T?.getBoundingClientRect(),!E.current)return;const H=N.target===M.current;if(!H&&!!N.target.closest(".nokey")||!e||!(s&&H||t)||N.button!==0||!N.isPrimary)return;N.target?.setPointerCapture?.(N.pointerId),k.current=!1;const{x:F,y:B}=ye(N.nativeEvent,E.current);w.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),H||(N.stopPropagation(),N.preventDefault())},I=N=>{const{userSelectionRect:T,transform:H,nodeLookup:j,edgeLookup:R,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:W,defaultEdgeOptions:Q,resetSelectedElements:Z}=w.getState();if(!E.current||!T)return;const{x:O,y:Y}=ye(N.nativeEvent,E.current),{startX:U,startY:K}=T;if(!k.current){const te=t?0:r;if(Math.hypot(O-U,Y-K)<=te)return;Z(),i?.(N)}k.current=!0;const G={startX:U,startY:K,x:O<U?O:U,y:Y<K?Y:K,width:Math.abs(O-U),height:Math.abs(Y-K)},q=C.current,J=D.current;C.current=new Set(kn(j,G,H,n===st.Partial,!0).map(te=>te.id)),D.current=new Set;const ne=Q?.selectable??!0;for(const te of C.current){const se=F.get(te);if(se)for(const{edgeId:le}of se.values()){const oe=R.get(le);oe&&(oe.selectable??ne)&&D.current.add(le)}}if(!po(q,C.current)){const te=Ve(j,C.current,!0);B(te)}if(!po(J,D.current)){const te=Ve(R,D.current);W(te)}w.setState({userSelectionRect:G,userSelectionActive:!0,nodesSelectionActive:!1})},S=N=>{N.button===0&&(N.target?.releasePointerCapture?.(N.pointerId),!v&&N.target===M.current&&w.getState().userSelectionRect&&V?.(N),w.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(a?.(N),w.setState({nodesSelectionActive:C.current.size>0})))},A=o===!0||Array.isArray(o)&&o.includes(0);return _.jsxs("div",{className:ae(["react-flow__pane",{draggable:A,dragging:b,selection:e}]),onClick:x?void 0:cn(V,M),onContextMenu:cn(P,M),onWheel:cn($,M),onPointerEnter:x?void 0:f,onPointerMove:x?I:d,onPointerUp:x?S:void 0,onPointerDownCapture:x?y:void 0,onClickCapture:x?L:void 0,onPointerLeave:p,ref:M,style:qt,children:[h,_.jsx(mf,{})]})}function _n({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ve.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function gi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,nodeClickDistance:i}){const a=ie(),[l,c]=z.useState(!1),u=z.useRef();return z.useEffect(()=>{u.current=cd({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{_n({id:f,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),z.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:i}),()=>{u.current?.destroy()}},[n,o,t,s,e,r]),l}const wf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function pi(){const e=ie();return z.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),f=new Map,d=wf(i),p=r?s[0]:5,h=r?s[1]:5,w=n.direction.x*p*n.factor,v=n.direction.y*h*n.factor;for(const[,m]of c){if(!d(m))continue;let b={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+v};r&&(b=ht(b,s));const{position:g,positionAbsolute:x}=Lr({nodeId:m.id,nextPosition:b,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});m.position=g,m.internals.positionAbsolute=x,f.set(m.id,m)}l(f)},[])}const Rn=z.createContext(null),vf=Rn.Provider;Rn.Consumer;const mi=()=>z.useContext(Rn),_f=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),bf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:s,connection:i}=o,{fromHandle:a,toHandle:l,isValid:c}=i,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:s===Ye.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Sf({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:f,...d},p){const h=i||null,w=e==="target",v=ie(),m=mi(),{connectOnClick:b,noPanClassName:g,rfId:x}=ee(_f,re),{connectingFrom:M,connectingTo:E,clickConnecting:C,isPossibleEndHandle:D,connectionInProcess:k,clickConnectionInProcess:V,valid:P}=ee(bf(m,h,e),re);m||v.getState().onError?.("010",ve.error010());const $=I=>{const{defaultEdgeOptions:S,onConnect:A,hasDefaultEdges:N}=v.getState(),T={...S,...I};if(N){const{edges:H,setEdges:j}=v.getState();j(Zu(T,H))}A?.(T),a?.(T)},L=I=>{if(!m)return;const S=Yr(I.nativeEvent);if(r&&(S&&I.button===0||!S)){const A=v.getState();vn.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:w,handleId:h,nodeId:m,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:$,isValidConnection:n||A.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}S?u?.(I):f?.(I)},y=I=>{const{onClickConnectStart:S,onClickConnectEnd:A,connectionClickStartHandle:N,connectionMode:T,isValidConnection:H,lib:j,rfId:R,nodeLookup:F,connection:B}=v.getState();if(!m||!N&&!r)return;if(!N){S?.(I.nativeEvent,{nodeId:m,handleId:h,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:m,type:e,id:h}});return}const W=Br(I.target),Q=n||H,{connection:Z,isValid:O}=vn.isValid(I.nativeEvent,{handle:{nodeId:m,id:h,type:e},connectionMode:T,fromNodeId:N.nodeId,fromHandleId:N.id||null,fromType:N.type,isValidConnection:Q,flowId:R,doc:W,lib:j,nodeLookup:F});O&&Z&&$(Z);const Y=structuredClone(B);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,A?.(I,Y),v.setState({connectionClickStartHandle:null})};return _.jsx("div",{"data-handleid":h,"data-nodeid":m,"data-handlepos":t,"data-id":`${x}-${m}-${h}-${e}`,className:ae(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,c,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:s,clickconnecting:C,connectingfrom:M,connectingto:E,valid:P,connectionindicator:o&&(!k||D)&&(k||V?s:r)}]),onMouseDown:L,onTouchStart:L,onClick:b?y:void 0,ref:p,...d,children:l})}const Pe=z.memo(fi(Sf));function Ef({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return _.jsxs(_.Fragment,{children:[e?.label,_.jsx(Pe,{type:"source",position:n,isConnectable:t})]})}function Cf({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return _.jsxs(_.Fragment,{children:[_.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label,_.jsx(Pe,{type:"source",position:o,isConnectable:t})]})}function Nf(){return null}function Mf({data:e,isConnectable:t,targetPosition:n=X.Top}){return _.jsxs(_.Fragment,{children:[_.jsx(Pe,{type:"target",position:n,isConnectable:t}),e?.label]})}const Lt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Oo={input:Ef,default:Cf,output:Mf,group:Nf};function If(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const kf=e=>{const{width:t,height:n,x:o,y:r}=ft(e.nodeLookup,{filter:s=>!!s.selected});return{width:me(t)?t:null,height:me(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Pf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ie(),{width:r,height:s,transformString:i,userSelectionActive:a}=ee(kf,re),l=pi(),c=z.useRef(null);if(z.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),gi({nodeRef:c}),a||!r||!s)return null;const u=e?d=>{const p=o.getState().nodes.filter(h=>h.selected);e(d,p)}:void 0,f=d=>{Object.prototype.hasOwnProperty.call(Lt,d.key)&&(d.preventDefault(),l({direction:Lt[d.key],factor:d.shiftKey?4:1}))};return _.jsx("div",{className:ae(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:_.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:s}})})}const Bo=typeof window<"u"?window:void 0,Af=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:f,onSelectionStart:d,onSelectionEnd:p,multiSelectionKeyCode:h,panActivationKeyCode:w,zoomActivationKeyCode:v,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:g,panOnScroll:x,panOnScrollSpeed:M,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:D,defaultViewport:k,translateExtent:V,minZoom:P,maxZoom:$,preventScrolling:L,onSelectionContextMenu:y,noWheelClassName:I,noPanClassName:S,disableKeyboardA11y:A,onViewportChange:N,isControlledViewport:T}){const{nodesSelectionActive:H,userSelectionActive:j}=ee(Af,re),R=lt(c,{target:Bo}),F=lt(w,{target:Bo}),B=F||D,W=F||x,Q=u&&B!==!0,Z=R||j||Q;return df({deleteKeyCode:l,multiSelectionKeyCode:h}),_.jsx(gf,{onPaneContextMenu:s,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:g,panOnScroll:W,panOnScrollSpeed:M,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:k,translateExtent:V,minZoom:P,maxZoom:$,zoomActivationKeyCode:v,preventScrolling:L,noWheelClassName:I,noPanClassName:S,onViewportChange:N,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:Q,children:_.jsxs(xf,{onSelectionStart:d,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:B,isSelecting:!!Z,selectionMode:f,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:Q,children:[e,H&&_.jsx(Pf,{onSelectionContextMenu:y,noPanClassName:S,disableKeyboardA11y:A})]})})}yi.displayName="FlowRenderer";const Tf=z.memo(yi),Df=e=>t=>e?kn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function $f(e){return ee(z.useCallback(Df(e),[e]),re)}const zf=e=>e.updateNodeInternals;function Lf(){const e=ee(zf),[t]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:r.target,force:!0})}),e(o)}));return z.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Hf({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ie(),s=z.useRef(null),i=z.useRef(null),a=z.useRef(e.sourcePosition),l=z.useRef(e.targetPosition),c=z.useRef(t),u=n&&!!e.internals.handleBounds;return z.useEffect(()=>{s.current&&!e.hidden&&(!u||i.current!==s.current)&&(i.current&&o?.unobserve(i.current),o?.observe(s.current),i.current=s.current)},[u,e.hidden]),z.useEffect(()=>()=>{i.current&&(o?.unobserve(i.current),i.current=null)},[]),z.useEffect(()=>{if(s.current){const f=c.current!==t,d=a.current!==e.sourcePosition,p=l.current!==e.targetPosition;(f||d||p)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function Rf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:f,noDragClassName:d,noPanClassName:p,disableKeyboardA11y:h,rfId:w,nodeTypes:v,nodeClickDistance:m,onError:b}){const{node:g,internals:x,isParent:M}=ee(O=>{const Y=O.nodeLookup.get(e),U=O.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:U}},re);let E=g.type||"default",C=v?.[E]||Oo[E];C===void 0&&(b?.("003",ve.error003(E)),E="default",C=v?.default||Oo.default);const D=!!(g.draggable||a&&typeof g.draggable>"u"),k=!!(g.selectable||l&&typeof g.selectable>"u"),V=!!(g.connectable||c&&typeof g.connectable>"u"),P=!!(g.focusable||u&&typeof g.focusable>"u"),$=ie(),L=Vr(g),y=Hf({node:g,nodeType:E,hasDimensions:L,resizeObserver:f}),I=gi({nodeRef:y,disabled:g.hidden||!D,noDragClassName:d,handleSelector:g.dragHandle,nodeId:e,isSelectable:k,nodeClickDistance:m}),S=pi();if(g.hidden)return null;const A=Ce(g),N=If(g),T=k||D||t||n||o||r,H=n?O=>n(O,{...x.userNode}):void 0,j=o?O=>o(O,{...x.userNode}):void 0,R=r?O=>r(O,{...x.userNode}):void 0,F=s?O=>s(O,{...x.userNode}):void 0,B=i?O=>i(O,{...x.userNode}):void 0,W=O=>{const{selectNodesOnDrag:Y,nodeDragThreshold:U}=$.getState();k&&(!Y||!D||U>0)&&_n({id:e,store:$,nodeRef:y}),t&&t(O,{...x.userNode})},Q=O=>{if(!(Fr(O.nativeEvent)||h)){if(Ar.includes(O.key)&&k){const Y=O.key==="Escape";_n({id:e,store:$,unselect:Y,nodeRef:y})}else if(D&&g.selected&&Object.prototype.hasOwnProperty.call(Lt,O.key)){O.preventDefault();const{ariaLabelConfig:Y}=$.getState();$.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:O.key.replace("Arrow","").toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),S({direction:Lt[O.key],factor:O.shiftKey?4:1})}}},Z=()=>{if(h||!y.current?.matches(":focus-visible"))return;const{transform:O,width:Y,height:U,autoPanOnNodeFocus:K,setCenter:G}=$.getState();if(!K)return;kn(new Map([[e,g]]),{x:0,y:0,width:Y,height:U},O,!0).length>0||G(g.position.x+A.width/2,g.position.y+A.height/2,{zoom:O[2]})};return _.jsx("div",{className:ae(["react-flow__node",`react-flow__node-${E}`,{[p]:D},g.className,{selected:g.selected,selectable:k,parent:M,draggable:D,dragging:I}]),ref:y,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:L?"visible":"hidden",...g.style,...N},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:j,onMouseLeave:R,onContextMenu:F,onClick:W,onDoubleClick:B,onKeyDown:P?Q:void 0,tabIndex:P?0:void 0,onFocus:P?Z:void 0,role:g.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":h?void 0:`${ci}-${w}`,"aria-label":g.ariaLabel,...g.domAttributes,children:_.jsx(vf,{value:e,children:_.jsx(C,{id:e,data:g.data,type:E,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:g.selected??!1,selectable:k,draggable:D,deletable:g.deletable??!0,isConnectable:V,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:I,dragHandle:g.dragHandle,zIndex:x.z,parentId:g.parentId,...A})})})}var jf=z.memo(Rf);const Vf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function xi(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:s}=ee(Vf,re),i=$f(e.onlyRenderVisibleElements),a=Lf();return _.jsx("div",{className:"react-flow__nodes",style:qt,children:i.map(l=>_.jsx(jf,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}xi.displayName="NodeRenderer";const Of=z.memo(xi);function Bf(e){return ee(z.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),i=n.nodeLookup.get(r.target);s&&i&&Fu({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}const Ff=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return _.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Yf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return _.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Fo={[Dt.Arrow]:Ff,[Dt.ArrowClosed]:Yf};function Xf(e){const t=ie();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(Fo,e)?Fo[e]:(t.getState().onError?.("009",ve.error009(e)),null),[e])}const Zf=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Xf(t);return l?_.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:_.jsx(l,{color:n,strokeWidth:i})}):null},wi=({defaultColor:e,rfId:t})=>{const n=ee(s=>s.edges),o=ee(s=>s.defaultEdgeOptions),r=z.useMemo(()=>Uu(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?_.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:_.jsx("defs",{children:r.map(s=>_.jsx(Zf,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};wi.displayName="MarkerDefinitions";var Wf=z.memo(wi);function vi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[f,d]=z.useState({x:1,y:0,width:0,height:0}),p=ae(["react-flow__edge-textwrapper",c]),h=z.useRef(null);return z.useEffect(()=>{if(h.current){const w=h.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?_.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...u,children:[r&&_.jsx("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),_.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:h,style:o,children:n}),l]}):null}vi.displayName="EdgeText";const Gf=z.memo(vi);function Kt({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return _.jsxs(_.Fragment,{children:[_.jsx("path",{...u,d:e,fill:"none",className:ae(["react-flow__edge-path",u.className])}),c?_.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&me(t)&&me(n)?_.jsx(Gf,{x:t,y:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Yo({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function _i({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top}){const[i,a]=Yo({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Yo({pos:s,x1:o,y1:r,x2:e,y2:t}),[u,f,d,p]=Xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${a} ${l},${c} ${o},${r}`,u,f,d,p]}function bi(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:m})=>{const[b,g,x]=_i({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a}),M=e.isInternal?void 0:t;return _.jsx(Kt,{id:M,path:b,labelX:g,labelY:x,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:m})})}const qf=bi({isInternal:!1}),Si=bi({isInternal:!0});qf.displayName="SimpleBezierEdge";Si.displayName="SimpleBezierEdgeInternal";function Ei(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,sourcePosition:p=X.Bottom,targetPosition:h=X.Top,markerEnd:w,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[g,x,M]=yn({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:s,targetPosition:h,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),E=e.isInternal?void 0:t;return _.jsx(Kt,{id:E,path:g,labelX:x,labelY:M,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:w,markerStart:v,interactionWidth:b})})}const Ci=Ei({isInternal:!1}),Ni=Ei({isInternal:!0});Ci.displayName="SmoothStepEdge";Ni.displayName="SmoothStepEdgeInternal";function Mi(e){return z.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return _.jsx(Ci,{...n,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Kf=Mi({isInternal:!1}),Ii=Mi({isInternal:!0});Kf.displayName="StepEdge";Ii.displayName="StepEdgeInternal";function ki(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:p,markerStart:h,interactionWidth:w})=>{const[v,m,b]=Gr({sourceX:n,sourceY:o,targetX:r,targetY:s}),g=e.isInternal?void 0:t;return _.jsx(Kt,{id:g,path:v,labelX:m,labelY:b,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:p,markerStart:h,interactionWidth:w})})}const Uf=ki({isInternal:!1}),Pi=ki({isInternal:!0});Uf.displayName="StraightEdge";Pi.displayName="StraightEdgeInternal";function Ai(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,pathOptions:m,interactionWidth:b})=>{const[g,x,M]=Zr({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:m?.curvature}),E=e.isInternal?void 0:t;return _.jsx(Kt,{id:E,path:g,labelX:x,labelY:M,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:v,interactionWidth:b})})}const Qf=Ai({isInternal:!1}),Ti=Ai({isInternal:!0});Qf.displayName="BezierEdge";Ti.displayName="BezierEdgeInternal";const Xo={default:Ti,straight:Pi,step:Ii,smoothstep:Ni,simplebezier:Si},Zo={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Jf=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,eh=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,Wo="react-flow__edgeupdater";function Go({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a}){return _.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ae([Wo,`${Wo}-${a}`]),cx:Jf(t,o,e),cy:eh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function th({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:f,setReconnecting:d,setUpdateHover:p}){const h=ie(),w=(x,M)=>{if(x.button!==0)return;const{autoPanOnConnect:E,domNode:C,isValidConnection:D,connectionMode:k,connectionRadius:V,lib:P,onConnectStart:$,onConnectEnd:L,cancelConnection:y,nodeLookup:I,rfId:S,panBy:A,updateConnection:N}=h.getState(),T=M.type==="target",H=(F,B)=>{d(!1),f?.(F,n,M.type,B)},j=F=>c?.(n,F),R=(F,B)=>{d(!0),u?.(x,n,M.type),$?.(F,B)};vn.onPointerDown(x.nativeEvent,{autoPanOnConnect:E,connectionMode:k,connectionRadius:V,domNode:C,handleId:M.id,nodeId:M.nodeId,nodeLookup:I,isTarget:T,edgeUpdaterType:M.type,lib:P,flowId:S,cancelConnection:y,panBy:A,isValidConnection:D,onConnect:j,onConnectStart:R,onConnectEnd:L,onReconnectEnd:H,updateConnection:N,getTransform:()=>h.getState().transform,getFromHandle:()=>h.getState().connection.fromHandle,dragThreshold:h.getState().connectionDragThreshold,handleDomNode:x.currentTarget})},v=x=>w(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=x=>w(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>p(!0),g=()=>p(!1);return _.jsxs(_.Fragment,{children:[(e===!0||e==="source")&&_.jsx(Go,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&_.jsx(Go,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:g,type:"target"})]})}function nh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,rfId:h,edgeTypes:w,noPanClassName:v,onError:m,disableKeyboardA11y:b}){let g=ee(G=>G.edgeLookup.get(e));const x=ee(G=>G.defaultEdgeOptions);g=x?{...x,...g}:g;let M=g.type||"default",E=w?.[M]||Xo[M];E===void 0&&(m?.("011",ve.error011(M)),M="default",E=w?.default||Xo.default);const C=!!(g.focusable||t&&typeof g.focusable>"u"),D=typeof f<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),k=!!(g.selectable||o&&typeof g.selectable>"u"),V=z.useRef(null),[P,$]=z.useState(!1),[L,y]=z.useState(!1),I=ie(),{zIndex:S,sourceX:A,sourceY:N,targetX:T,targetY:H,sourcePosition:j,targetPosition:R}=ee(z.useCallback(G=>{const q=G.nodeLookup.get(g.source),J=G.nodeLookup.get(g.target);if(!q||!J)return{zIndex:g.zIndex,...Zo};const ne=Ku({id:e,sourceNode:q,targetNode:J,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:G.connectionMode,onError:m});return{zIndex:Bu({selected:g.selected,zIndex:g.zIndex,sourceNode:q,targetNode:J,elevateOnSelect:G.elevateEdgesOnSelect,zIndexMode:G.zIndexMode}),...ne||Zo}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),re),F=z.useMemo(()=>g.markerStart?`url('#${xn(g.markerStart,h)}')`:void 0,[g.markerStart,h]),B=z.useMemo(()=>g.markerEnd?`url('#${xn(g.markerEnd,h)}')`:void 0,[g.markerEnd,h]);if(g.hidden||A===null||N===null||T===null||H===null)return null;const W=G=>{const{addSelectedEdges:q,unselectNodesAndEdges:J,multiSelectionActive:ne}=I.getState();k&&(I.setState({nodesSelectionActive:!1}),g.selected&&ne?(J({nodes:[],edges:[g]}),V.current?.blur()):q([e])),r&&r(G,g)},Q=s?G=>{s(G,{...g})}:void 0,Z=i?G=>{i(G,{...g})}:void 0,O=a?G=>{a(G,{...g})}:void 0,Y=l?G=>{l(G,{...g})}:void 0,U=c?G=>{c(G,{...g})}:void 0,K=G=>{if(!b&&Ar.includes(G.key)&&k){const{unselectNodesAndEdges:q,addSelectedEdges:J}=I.getState();G.key==="Escape"?(V.current?.blur(),q({edges:[g]})):J([e])}};return _.jsx("svg",{style:{zIndex:S},children:_.jsxs("g",{className:ae(["react-flow__edge",`react-flow__edge-${M}`,g.className,v,{selected:g.selected,animated:g.animated,inactive:!k&&!r,updating:P,selectable:k}]),onClick:W,onDoubleClick:Q,onContextMenu:Z,onMouseEnter:O,onMouseMove:Y,onMouseLeave:U,onKeyDown:C?K:void 0,tabIndex:C?0:void 0,role:g.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":C?`${li}-${h}`:void 0,ref:V,...g.domAttributes,children:[!L&&_.jsx(E,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:k,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:A,sourceY:N,targetX:T,targetY:H,sourcePosition:j,targetPosition:R,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),D&&_.jsx(th,{edge:g,isReconnectable:D,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:p,sourceX:A,sourceY:N,targetX:T,targetY:H,sourcePosition:j,targetPosition:R,setUpdateHover:$,setReconnecting:y})]})})}var oh=z.memo(nh);const rh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Di({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:p,onReconnectEnd:h,disableKeyboardA11y:w}){const{edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,onError:g}=ee(rh,re),x=Bf(t);return _.jsxs("div",{className:"react-flow__edges",children:[_.jsx(Wf,{defaultColor:e,rfId:n}),x.map(M=>_.jsx(oh,{id:M,edgesFocusable:v,edgesReconnectable:m,elementsSelectable:b,noPanClassName:r,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:f,onDoubleClick:d,onReconnectStart:p,onReconnectEnd:h,rfId:n,onError:g,edgeTypes:o,disableKeyboardA11y:w},M))]})}Di.displayName="EdgeRenderer";const ih=z.memo(Di),sh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ah({children:e}){const t=ee(sh);return _.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function ch(e){const t=Hn(),n=z.useRef(!1);z.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const lh=e=>e.panZoom?.syncViewport;function uh(e){const t=ee(lh),n=ie();return z.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function dh(e){return e.connection.inProgress?{...e.connection,to:gt(e.connection.to,e.transform)}:{...e.connection}}function fh(e){return dh}function hh(e){const t=fh();return ee(t,re)}const gh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ph({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:s,height:i,isValid:a,inProgress:l}=ee(gh,re);return!(s&&r&&l)?null:_.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:_.jsx("g",{className:ae(["react-flow__connection",$r(a)]),children:_.jsx($i,{style:t,type:n,CustomComponent:o,isValid:a})})})}const $i=({style:e,type:t=Ie.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:s,fromNode:i,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:f,toPosition:d,pointer:p}=hh();if(!r)return;if(n)return _.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:d,connectionStatus:$r(o),toNode:u,toHandle:f,pointer:p});let h="";const w={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:d};switch(t){case Ie.Bezier:[h]=Zr(w);break;case Ie.SimpleBezier:[h]=_i(w);break;case Ie.Step:[h]=yn({...w,borderRadius:0});break;case Ie.SmoothStep:[h]=yn(w);break;default:[h]=Gr(w)}return _.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};$i.displayName="ConnectionLine";const mh={};function qo(e=mh){z.useRef(e),ie(),z.useEffect(()=>{},[e])}function yh(){ie(),z.useRef(!1),z.useEffect(()=>{},[])}function zi({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:p,connectionLineType:h,connectionLineStyle:w,connectionLineComponent:v,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:g,selectionMode:x,multiSelectionKeyCode:M,panActivationKeyCode:E,zoomActivationKeyCode:C,deleteKeyCode:D,onlyRenderVisibleElements:k,elementsSelectable:V,defaultViewport:P,translateExtent:$,minZoom:L,maxZoom:y,preventScrolling:I,defaultMarkerColor:S,zoomOnScroll:A,zoomOnPinch:N,panOnScroll:T,panOnScrollSpeed:H,panOnScrollMode:j,zoomOnDoubleClick:R,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:W,onPaneMouseMove:Q,onPaneMouseLeave:Z,onPaneScroll:O,onPaneContextMenu:Y,paneClickDistance:U,nodeClickDistance:K,onEdgeContextMenu:G,onEdgeMouseEnter:q,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:se,onReconnectStart:le,onReconnectEnd:oe,noDragClassName:ce,noWheelClassName:fe,noPanClassName:we,disableKeyboardA11y:qe,nodeExtent:Ut,rfId:pt,viewport:He,onViewportChange:Ke}){return qo(e),qo(t),yh(),ch(n),uh(He),_.jsx(Tf,{onPaneClick:B,onPaneMouseEnter:W,onPaneMouseMove:Q,onPaneMouseLeave:Z,onPaneContextMenu:Y,onPaneScroll:O,paneClickDistance:U,deleteKeyCode:D,selectionKeyCode:b,selectionOnDrag:g,selectionMode:x,onSelectionStart:d,onSelectionEnd:p,multiSelectionKeyCode:M,panActivationKeyCode:E,zoomActivationKeyCode:C,elementsSelectable:V,zoomOnScroll:A,zoomOnPinch:N,zoomOnDoubleClick:R,panOnScroll:T,panOnScrollSpeed:H,panOnScrollMode:j,panOnDrag:F,defaultViewport:P,translateExtent:$,minZoom:L,maxZoom:y,onSelectionContextMenu:f,preventScrolling:I,noDragClassName:ce,noWheelClassName:fe,noPanClassName:we,disableKeyboardA11y:qe,onViewportChange:Ke,isControlledViewport:!!He,children:_.jsxs(ah,{children:[_.jsx(ih,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:i,onReconnect:se,onReconnectStart:le,onReconnectEnd:oe,onlyRenderVisibleElements:k,onEdgeContextMenu:G,onEdgeMouseEnter:q,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:S,noPanClassName:we,disableKeyboardA11y:qe,rfId:pt}),_.jsx(ph,{style:w,type:h,component:v,containerStyle:m}),_.jsx("div",{className:"react-flow__edgelabel-renderer"}),_.jsx(Of,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:K,onlyRenderVisibleElements:k,noPanClassName:we,noDragClassName:ce,disableKeyboardA11y:qe,nodeExtent:Ut,rfId:pt}),_.jsx("div",{className:"react-flow__viewport-portal"})]})})}zi.displayName="GraphView";const xh=z.memo(zi),Ko=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:f,zIndexMode:d="basic"}={})=>{const p=new Map,h=new Map,w=new Map,v=new Map,m=o??t??[],b=n??e??[],g=u??[0,0],x=f??it;Ur(w,v,m);const M=wn(b,p,h,{nodeOrigin:g,nodeExtent:x,zIndexMode:d});let E=[0,0,1];if(i&&r&&s){const C=ft(p,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:D,y:k,zoom:V}=Pn(C,r,s,l,c,a?.padding??.1);E=[D,k,V]}return{rfId:"1",width:r??0,height:s??0,transform:E,nodes:b,nodesInitialized:M,nodeLookup:p,parentLookup:h,edges:m,edgeLookup:v,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:it,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ye.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:g,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Dr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Lu,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Tr,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},wh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d})=>$d((p,h)=>{async function w(){const{nodeLookup:v,panZoom:m,fitViewOptions:b,fitViewResolver:g,width:x,height:M,minZoom:E,maxZoom:C}=h();m&&(await $u({nodes:v,width:x,height:M,panZoom:m,minZoom:E,maxZoom:C},b),g?.resolve(!0),p({fitViewResolver:null}))}return{...Ko({nodes:e,edges:t,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:o,zIndexMode:d}),setNodes:v=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:g,elevateNodesOnSelect:x,fitViewQueued:M,zIndexMode:E}=h(),C=wn(v,m,b,{nodeOrigin:g,nodeExtent:f,elevateNodesOnSelect:x,checkEquality:!0,zIndexMode:E});M&&C?(w(),p({nodes:v,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:v,nodesInitialized:C})},setEdges:v=>{const{connectionLookup:m,edgeLookup:b}=h();Ur(m,b,v),p({edges:v})},setDefaultNodesAndEdges:(v,m)=>{if(v){const{setNodes:b}=h();b(v),p({hasDefaultNodes:!0})}if(m){const{setEdges:b}=h();b(m),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:g,domNode:x,nodeOrigin:M,nodeExtent:E,debug:C,fitViewQueued:D,zIndexMode:k}=h(),{changes:V,updatedInternals:P}=rd(v,b,g,x,M,E,k);P&&(ed(b,g,{nodeOrigin:M,nodeExtent:E,zIndexMode:k}),D?(w(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),V?.length>0&&(C&&console.log("React Flow: trigger node changes",V),m?.(V)))},updateNodePositions:(v,m=!1)=>{const b=[];let g=[];const{nodeLookup:x,triggerNodeChanges:M,connection:E,updateConnection:C,onNodesChangeMiddlewareMap:D}=h();for(const[k,V]of v){const P=x.get(k),$=!!(P?.expandParent&&P?.parentId&&V?.position),L={id:k,type:"position",position:$?{x:Math.max(0,V.position.x),y:Math.max(0,V.position.y)}:V.position,dragging:m};if(P&&E.inProgress&&E.fromNode.id===P.id){const y=Le(P,E.fromHandle,X.Left,!0);C({...E,from:y})}$&&P.parentId&&b.push({id:k,parentId:P.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),g.push(L)}if(b.length>0){const{parentLookup:k,nodeOrigin:V}=h(),P=Ln(b,x,k,V);g.push(...P)}for(const k of D.values())g=k(g);M(g)},triggerNodeChanges:v=>{const{onNodesChange:m,setNodes:b,nodes:g,hasDefaultNodes:x,debug:M}=h();if(v?.length){if(x){const E=tf(v,g);b(E)}M&&console.log("React Flow: trigger node changes",v),m?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:m,setEdges:b,edges:g,hasDefaultEdges:x,debug:M}=h();if(v?.length){if(x){const E=nf(v,g);b(E)}M&&console.log("React Flow: trigger edge changes",v),m?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:M}=h();if(m){const E=v.map(C=>Te(C,!0));x(E);return}x(Ve(g,new Set([...v]),!0)),M(Ve(b))},addSelectedEdges:v=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:M}=h();if(m){const E=v.map(C=>Te(C,!0));M(E);return}M(Ve(b,new Set([...v]))),x(Ve(g,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:m}={})=>{const{edges:b,nodes:g,nodeLookup:x,triggerNodeChanges:M,triggerEdgeChanges:E}=h(),C=v||g,D=m||b,k=C.map(P=>{const $=x.get(P.id);return $&&($.selected=!1),Te(P.id,!1)}),V=D.map(P=>Te(P.id,!1));M(k),E(V)},setMinZoom:v=>{const{panZoom:m,maxZoom:b}=h();m?.setScaleExtent([v,b]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:m,minZoom:b}=h();m?.setScaleExtent([b,v]),p({maxZoom:v})},setTranslateExtent:v=>{h().panZoom?.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:g,elementsSelectable:x}=h();if(!x)return;const M=m.reduce((C,D)=>D.selected?[...C,Te(D.id,!1)]:C,[]),E=v.reduce((C,D)=>D.selected?[...C,Te(D.id,!1)]:C,[]);b(M),g(E)},setNodeExtent:v=>{const{nodes:m,nodeLookup:b,parentLookup:g,nodeOrigin:x,elevateNodesOnSelect:M,nodeExtent:E,zIndexMode:C}=h();v[0][0]===E[0][0]&&v[0][1]===E[0][1]&&v[1][0]===E[1][0]&&v[1][1]===E[1][1]||(wn(m,b,g,{nodeOrigin:x,nodeExtent:v,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:C}),p({nodeExtent:v}))},panBy:v=>{const{transform:m,width:b,height:g,panZoom:x,translateExtent:M}=h();return id({delta:v,panZoom:x,transform:m,translateExtent:M,width:b,height:g})},setCenter:async(v,m,b)=>{const{width:g,height:x,maxZoom:M,panZoom:E}=h();if(!E)return Promise.resolve(!1);const C=typeof b?.zoom<"u"?b.zoom:M;return await E.setViewport({x:g/2-v*C,y:x/2-m*C,zoom:C},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Dr}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...Ko()})}},Object.is);function vh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d,children:p}){const[h]=z.useState(()=>wh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:c,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:f,zIndexMode:d}));return _.jsx(zd,{value:h,children:_.jsx(af,{children:p})})}function _h({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p}){return z.useContext(Wt)?_.jsx(_.Fragment,{children:e}):_.jsx(vh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:p,children:e})}const bh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Sh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:f,onMoveEnd:d,onConnect:p,onConnectStart:h,onConnectEnd:w,onClickConnectStart:v,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:M,onNodeDoubleClick:E,onNodeDragStart:C,onNodeDrag:D,onNodeDragStop:k,onNodesDelete:V,onEdgesDelete:P,onDelete:$,onSelectionChange:L,onSelectionDragStart:y,onSelectionDrag:I,onSelectionDragStop:S,onSelectionContextMenu:A,onSelectionStart:N,onSelectionEnd:T,onBeforeDelete:H,connectionMode:j,connectionLineType:R=Ie.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:W,deleteKeyCode:Q="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:O=!1,selectionMode:Y=st.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:K=ct()?"Meta":"Control",zoomActivationKeyCode:G=ct()?"Meta":"Control",snapToGrid:q,snapGrid:J,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:oe,nodesFocusable:ce,nodeOrigin:fe=ui,edgesFocusable:we,edgesReconnectable:qe,elementsSelectable:Ut=!0,defaultViewport:pt=Gd,minZoom:He=.5,maxZoom:Ke=2,translateExtent:Vn=it,preventScrolling:Bi=!0,nodeExtent:Qt,defaultMarkerColor:Fi="#b1b1b7",zoomOnScroll:Yi=!0,zoomOnPinch:Xi=!0,panOnScroll:Zi=!1,panOnScrollSpeed:Wi=.5,panOnScrollMode:Gi=De.Free,zoomOnDoubleClick:qi=!0,panOnDrag:Ki=!0,onPaneClick:Ui,onPaneMouseEnter:Qi,onPaneMouseMove:Ji,onPaneMouseLeave:es,onPaneScroll:ts,onPaneContextMenu:ns,paneClickDistance:os=1,nodeClickDistance:rs=0,children:is,onReconnect:ss,onReconnectStart:as,onReconnectEnd:cs,onEdgeContextMenu:ls,onEdgeDoubleClick:us,onEdgeMouseEnter:ds,onEdgeMouseMove:fs,onEdgeMouseLeave:hs,reconnectRadius:gs=10,onNodesChange:ps,onEdgesChange:ms,noDragClassName:ys="nodrag",noWheelClassName:xs="nowheel",noPanClassName:On="nopan",fitView:Bn,fitViewOptions:Fn,connectOnClick:ws,attributionPosition:vs,proOptions:_s,defaultEdgeOptions:bs,elevateNodesOnSelect:Ss=!0,elevateEdgesOnSelect:Es=!1,disableKeyboardA11y:Yn=!1,autoPanOnConnect:Cs,autoPanOnNodeDrag:Ns,autoPanSpeed:Ms,connectionRadius:Is,isValidConnection:ks,onError:Ps,style:As,id:Xn,nodeDragThreshold:Ts,connectionDragThreshold:Ds,viewport:$s,onViewportChange:zs,width:Ls,height:Hs,colorMode:Rs="light",debug:js,onScroll:Zn,ariaLabelConfig:Vs,zIndexMode:Wn="basic",...Os},Bs){const Jt=Xn||"1",Fs=Qd(Rs),Ys=z.useCallback(Gn=>{Gn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Zn?.(Gn)},[Zn]);return _.jsx("div",{"data-testid":"rf__wrapper",...Os,onScroll:Ys,style:{...As,...bh},ref:Bs,className:ae(["react-flow",r,Fs]),id:Xn,role:"application",children:_.jsxs(_h,{nodes:e,edges:t,width:Ls,height:Hs,fitView:Bn,fitViewOptions:Fn,minZoom:He,maxZoom:Ke,nodeOrigin:fe,nodeExtent:Qt,zIndexMode:Wn,children:[_.jsx(xh,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:M,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:i,connectionLineType:R,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:W,selectionKeyCode:Z,selectionOnDrag:O,selectionMode:Y,deleteKeyCode:Q,multiSelectionKeyCode:K,panActivationKeyCode:U,zoomActivationKeyCode:G,onlyRenderVisibleElements:ne,defaultViewport:pt,translateExtent:Vn,minZoom:He,maxZoom:Ke,preventScrolling:Bi,zoomOnScroll:Yi,zoomOnPinch:Xi,zoomOnDoubleClick:qi,panOnScroll:Zi,panOnScrollSpeed:Wi,panOnScrollMode:Gi,panOnDrag:Ki,onPaneClick:Ui,onPaneMouseEnter:Qi,onPaneMouseMove:Ji,onPaneMouseLeave:es,onPaneScroll:ts,onPaneContextMenu:ns,paneClickDistance:os,nodeClickDistance:rs,onSelectionContextMenu:A,onSelectionStart:N,onSelectionEnd:T,onReconnect:ss,onReconnectStart:as,onReconnectEnd:cs,onEdgeContextMenu:ls,onEdgeDoubleClick:us,onEdgeMouseEnter:ds,onEdgeMouseMove:fs,onEdgeMouseLeave:hs,reconnectRadius:gs,defaultMarkerColor:Fi,noDragClassName:ys,noWheelClassName:xs,noPanClassName:On,rfId:Jt,disableKeyboardA11y:Yn,nodeExtent:Qt,viewport:$s,onViewportChange:zs}),_.jsx(Ud,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:h,onConnectEnd:w,onClickConnectStart:v,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:oe,nodesFocusable:ce,edgesFocusable:we,edgesReconnectable:qe,elementsSelectable:Ut,elevateNodesOnSelect:Ss,elevateEdgesOnSelect:Es,minZoom:He,maxZoom:Ke,nodeExtent:Qt,onNodesChange:ps,onEdgesChange:ms,snapToGrid:q,snapGrid:J,connectionMode:j,translateExtent:Vn,connectOnClick:ws,defaultEdgeOptions:bs,fitView:Bn,fitViewOptions:Fn,onNodesDelete:V,onEdgesDelete:P,onDelete:$,onNodeDragStart:C,onNodeDrag:D,onNodeDragStop:k,onSelectionDrag:I,onSelectionDragStart:y,onSelectionDragStop:S,onMove:u,onMoveStart:f,onMoveEnd:d,noPanClassName:On,nodeOrigin:fe,rfId:Jt,autoPanOnConnect:Cs,autoPanOnNodeDrag:Ns,autoPanSpeed:Ms,onError:Ps,connectionRadius:Is,isValidConnection:ks,selectNodesOnDrag:te,nodeDragThreshold:Ts,connectionDragThreshold:Ds,onBeforeDelete:H,debug:js,ariaLabelConfig:Vs,zIndexMode:Wn}),_.jsx(Wd,{onSelectionChange:L}),is,_.jsx(Bd,{proOptions:_s,position:vs}),_.jsx(Od,{rfId:Jt,disableKeyboardA11y:Yn})]})})}var Eh=fi(Sh);function Ch({dimensions:e,lineWidth:t,variant:n,className:o}){return _.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ae(["react-flow__background-pattern",n,o])})}function Nh({radius:e,className:t}){return _.jsx("circle",{cx:e,cy:e,r:e,className:ae(["react-flow__background-pattern","dots",t])})}var ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ke||(ke={}));const Mh={[ke.Dots]:1,[ke.Lines]:1,[ke.Cross]:6},Ih=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Li({id:e,variant:t=ke.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=0,color:i,bgColor:a,style:l,className:c,patternClassName:u}){const f=z.useRef(null),{transform:d,patternId:p}=ee(Ih,re),h=o||Mh[t],w=t===ke.Dots,v=t===ke.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*d[2]||1,m[1]*d[2]||1],g=h*d[2],x=Array.isArray(s)?s:[s,s],M=v?[g,g]:b,E=[x[0]*d[2]||1+M[0]/2,x[1]*d[2]||1+M[1]/2],C=`${p}${e||""}`;return _.jsxs("svg",{className:ae(["react-flow__background",c]),style:{...l,...qt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:f,"data-testid":"rf__background",children:[_.jsx("pattern",{id:C,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:w?_.jsx(Nh,{radius:g/2,className:u}):_.jsx(Ch,{dimensions:M,lineWidth:r,variant:t,className:u})}),_.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}Li.displayName="Background";z.memo(Li);function kh(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:_.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Ph(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Ah(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:_.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Th(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Dh(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function bt({children:e,className:t,...n}){return _.jsx("button",{type:"button",className:ae(["react-flow__controls-button",t]),...n,children:e})}const $h=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Hi({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:u,position:f="bottom-left",orientation:d="vertical","aria-label":p}){const h=ie(),{isInteractive:w,minZoomReached:v,maxZoomReached:m,ariaLabelConfig:b}=ee($h,re),{zoomIn:g,zoomOut:x,fitView:M}=Hn(),E=()=>{g(),s?.()},C=()=>{x(),i?.()},D=()=>{M(r),a?.()},k=()=>{h.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)},V=d==="horizontal"?"horizontal":"vertical";return _.jsxs(Gt,{className:ae(["react-flow__controls",V,c]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??b["controls.ariaLabel"],children:[t&&_.jsxs(_.Fragment,{children:[_.jsx(bt,{onClick:E,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:_.jsx(kh,{})}),_.jsx(bt,{onClick:C,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:v,children:_.jsx(Ph,{})})]}),n&&_.jsx(bt,{className:"react-flow__controls-fitview",onClick:D,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:_.jsx(Ah,{})}),o&&_.jsx(bt,{className:"react-flow__controls-interactive",onClick:k,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?_.jsx(Dh,{}):_.jsx(Th,{})}),u]})}Hi.displayName="Controls";z.memo(Hi);function zh({id:e,x:t,y:n,width:o,height:r,style:s,color:i,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:f,selected:d,onClick:p}){const{background:h,backgroundColor:w}=s||{},v=i||h||w;return _.jsx("rect",{className:ae(["react-flow__minimap-node",{selected:d},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:v,stroke:a,strokeWidth:l},shapeRendering:f,onClick:p?m=>p(m,e):void 0})}const Lh=z.memo(zh),Hh=e=>e.nodes.map(t=>t.id),ln=e=>e instanceof Function?e:()=>e;function Rh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:s=Lh,onClick:i}){const a=ee(Hh,re),l=ln(t),c=ln(e),u=ln(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return _.jsx(_.Fragment,{children:a.map(d=>_.jsx(Vh,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:s,onClick:i,shapeRendering:f},d))})}function jh({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:c,x:u,y:f,width:d,height:p}=ee(h=>{const{internals:w}=h.nodeLookup.get(e),v=w.userNode,{x:m,y:b}=w.positionAbsolute,{width:g,height:x}=Ce(v);return{node:v,x:m,y:b,width:g,height:x}},re);return!c||c.hidden||!Vr(c)?null:_.jsx(a,{x:u,y:f,width:d,height:p,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:s,shapeRendering:i,onClick:l,id:c.id})}const Vh=z.memo(jh);var Oh=z.memo(Rh);const Bh=200,Fh=150,Yh=e=>!e.hidden,Xh=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?jr(ft(e.nodeLookup,{filter:Yh}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Zh="react-flow__minimap-desc";function Ri({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:f,position:d="bottom-right",onClick:p,onNodeClick:h,pannable:w=!1,zoomable:v=!1,ariaLabel:m,inversePan:b,zoomStep:g=1,offsetScale:x=5}){const M=ie(),E=z.useRef(null),{boundingRect:C,viewBB:D,rfId:k,panZoom:V,translateExtent:P,flowWidth:$,flowHeight:L,ariaLabelConfig:y}=ee(Xh,re),I=e?.width??Bh,S=e?.height??Fh,A=C.width/I,N=C.height/S,T=Math.max(A,N),H=T*I,j=T*S,R=x*T,F=C.x-(H-C.width)/2-R,B=C.y-(j-C.height)/2-R,W=H+R*2,Q=j+R*2,Z=`${Zh}-${k}`,O=z.useRef(0),Y=z.useRef();O.current=T,z.useEffect(()=>{if(E.current&&V)return Y.current=gd({domNode:E.current,panZoom:V,getTransform:()=>M.getState().transform,getViewScale:()=>O.current}),()=>{Y.current?.destroy()}},[V]),z.useEffect(()=>{Y.current?.update({translateExtent:P,width:$,height:L,inversePan:b,pannable:w,zoomStep:g,zoomable:v})},[w,v,b,g,P,$,L]);const U=p?q=>{const[J,ne]=Y.current?.pointer(q)||[0,0];p(q,{x:J,y:ne})}:void 0,K=h?z.useCallback((q,J)=>{const ne=M.getState().nodeLookup.get(J).internals.userNode;h(q,ne)},[]):void 0,G=m??y["minimap.ariaLabel"];return _.jsx(Gt,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*T:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:ae(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:_.jsxs("svg",{width:I,height:S,viewBox:`${F} ${B} ${W} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:E,onClick:U,children:[G&&_.jsx("title",{id:Z,children:G}),_.jsx(Oh,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:i,nodeComponent:a}),_.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-R},${B-R}h${W+R*2}v${Q+R*2}h${-W-R*2}z
|
|
7
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ri.displayName="MiniMap";z.memo(Ri);const Wh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Gh={[Ge.Line]:"right",[Ge.Handle]:"bottom-right"};function qh({nodeId:e,position:t,variant:n=Ge.Handle,className:o,style:r=void 0,children:s,color:i,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:p=!0,shouldResize:h,onResizeStart:w,onResize:v,onResizeEnd:m}){const b=mi(),g=typeof e=="string"?e:b,x=ie(),M=z.useRef(null),E=n===Ge.Handle,C=ee(z.useCallback(Wh(E&&p),[E,p]),re),D=z.useRef(null),k=t??Gh[n];z.useEffect(()=>{if(!(!M.current||!g))return D.current||(D.current=Id({domNode:M.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:P,transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I,domNode:S}=x.getState();return{nodeLookup:P,transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:I,paneDomNode:S}},onChange:(P,$)=>{const{triggerNodeChanges:L,nodeLookup:y,parentLookup:I,nodeOrigin:S}=x.getState(),A=[],N={x:P.x,y:P.y},T=y.get(g);if(T&&T.expandParent&&T.parentId){const H=T.origin??S,j=P.width??T.measured.width??0,R=P.height??T.measured.height??0,F={id:T.id,parentId:T.parentId,rect:{width:j,height:R,...Or({x:P.x??T.position.x,y:P.y??T.position.y},{width:j,height:R},T.parentId,y,H)}},B=Ln([F],y,I,S);A.push(...B),N.x=P.x?Math.max(H[0]*j,P.x):void 0,N.y=P.y?Math.max(H[1]*R,P.y):void 0}if(N.x!==void 0&&N.y!==void 0){const H={id:g,type:"position",position:{...N}};A.push(H)}if(P.width!==void 0&&P.height!==void 0){const j={id:g,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};A.push(j)}for(const H of $){const j={...H,type:"position"};A.push(j)}L(A)},onEnd:({width:P,height:$})=>{const L={id:g,type:"dimensions",resizing:!1,dimensions:{width:P,height:$}};x.getState().triggerNodeChanges([L])}})),D.current.update({controlPosition:k,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:f,resizeDirection:d,onResizeStart:w,onResize:v,onResizeEnd:m,shouldResize:h}),()=>{D.current?.destroy()}},[k,a,l,c,u,f,w,v,m,h]);const V=k.split("-");return _.jsx("div",{className:ae(["react-flow__resize-control","nodrag",...V,n,o]),ref:M,style:{...r,scale:C,...i&&{[E?"backgroundColor":"borderColor"]:i}},children:s})}z.memo(qh);const ji=z.createContext(void 0);function Vi(){const e=z.useContext(ji);if(!e)throw new Error("useMetricsMode must be used within MetricsModeProvider");return e}function Kh(e){const t=he.c(5),{children:n}=e,[o,r]=z.useState("requests");let s;t[0]!==o?(s={metricsMode:o,setMetricsMode:r},t[0]=o,t[1]=s):s=t[1];let i;return t[2]!==n||t[3]!==s?(i=_.jsx(ji.Provider,{value:s,children:n}),t[2]=n,t[3]=s,t[4]=i):i=t[4],i}const Uo=10,Ht=56,jn=220,nt=56,Uh={requests:{edgeColor:"var(--chart-1)",textClass:"text-chart-1"},errors:{edgeColor:"var(--chart-3)",textClass:"text-chart-3"},latency:{edgeColor:"var(--chart-4)",textClass:"text-chart-4"}};function Qh(){const e=Date.now(),t=300*1e3,n=Math.floor(e/t)*t,o=new Date(n);return{startDate:new Date(n-1440*60*1e3).toISOString(),endDate:o.toISOString()}}function Jh(e){const t=new Map,n=new Map;for(const s of e){const i=s.connectionId;if(i){const l=n.get(i)??{requests:0,errors:0,totalLatency:0};n.set(i,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}const a=s.gatewayId;if(a){const l=t.get(a)??{requests:0,errors:0,totalLatency:0};t.set(a,{requests:l.requests+1,errors:l.errors+(s.isError?1:0),totalLatency:l.totalLatency+s.durationMs})}}const o=new Map;for(const[s,i]of t)o.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});const r=new Map;for(const[s,i]of n)r.set(s,{requests:i.requests,errors:i.errors,errorRate:i.requests>0?i.errors/i.requests*100:0,avgLatencyMs:i.requests>0?i.totalLatency/i.requests:0});return{gateways:o,connections:r}}function Oi(e,t){if(!e)return"—";switch(t){case"requests":return e.requests===0?"—":e.requests.toLocaleString();case"errors":return e.errorRate===0?"—":`${e.errorRate.toFixed(1)}%`;case"latency":return e.avgLatencyMs===0?"—":`${Math.round(e.avgLatencyMs)}ms`}}function St(e,t){if(!e)return 0;switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function eg(){const e=he.c(9),{locator:t}=bn();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=sa(),e[0]=n):n=e[0];const o=n;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=Qh(),e[1]=r):r=e[1];const s=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={...s,limit:1e3,offset:0},e[2]=i):i=e[2];let a;e[3]!==t?(a={toolCaller:o,toolName:"MONITORING_LOGS_LIST",toolInputParams:i,scope:t,staleTime:3e4},e[3]=t,e[4]=a):a=e[4];const{data:l}=ma(a);let c;e[5]!==l?.logs?(c=l?.logs??[],e[5]=l?.logs,e[6]=c):c=e[6];const u=c;let f;return e[7]!==u?(f=Jh(u),e[7]=u,e[8]=f):f=e[8],f}function tg(e){const t=he.c(29),{data:n}=e,o=Rt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Oi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.gateway.id||t[4]!==n.org||t[5]!==o?(i=()=>{o({to:"/$org/gateways/$gatewayId",params:{org:n.org,gatewayId:n.gateway.id}})},t[3]=n.gateway.id,t[4]=n.org,t[5]=o,t[6]=i):i=t[6];const a=i;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Ht,width:jn},t[7]=l):l=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=_.jsx(ca,{}),t[8]=c):c=t[8];let u;t[9]!==n.gateway.icon||t[10]!==n.gateway.title?(u=_.jsx(er,{icon:n.gateway.icon,name:n.gateway.title,size:"md",fallbackIcon:c,className:"relative z-10"}),t[9]=n.gateway.icon,t[10]=n.gateway.title,t[11]=u):u=t[11];let f;t[12]!==n.gateway.title?(f=_.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.gateway.title}),t[12]=n.gateway.title,t[13]=f):f=t[13];let d;t[14]!==n.colorScheme.textClass?(d=or("text-base leading-none font-semibold tabular-nums",n.colorScheme.textClass),t[14]=n.colorScheme.textClass,t[15]=d):d=t[15];let p;t[16]!==s||t[17]!==d?(p=_.jsx("span",{className:d,children:s}),t[16]=s,t[17]=d,t[18]=p):p=t[18];let h;t[19]!==f||t[20]!==p?(h=_.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[f,p]}),t[19]=f,t[20]=p,t[21]=h):h=t[21];let w;t[22]!==n.colorScheme.edgeColor?(w=_.jsx(Pe,{type:"source",position:X.Right,style:{width:"8px",height:"8px",background:n.colorScheme.edgeColor,border:"none"}}),t[22]=n.colorScheme.edgeColor,t[23]=w):w=t[23];let v;return t[24]!==a||t[25]!==w||t[26]!==u||t[27]!==h?(v=_.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,h,w]}),t[24]=a,t[25]=w,t[26]=u,t[27]=h,t[28]=v):v=t[28],v}function ng(e){const t=he.c(29),{data:n}=e,o=Rt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Oi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const s=r;let i;t[3]!==n.connection.id||t[4]!==n.org||t[5]!==o?(i=()=>{o({to:"/$org/mcps/$connectionId",params:{org:n.org,connectionId:n.connection.id}})},t[3]=n.connection.id,t[4]=n.org,t[5]=o,t[6]=i):i=t[6];const a=i;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Ht,width:jn},t[7]=l):l=t[7];const c=`1px solid ${n.colorScheme.edgeColor}`;let u;t[8]!==c?(u=_.jsx(Pe,{type:"target",position:X.Left,style:{width:"8px",height:"8px",background:"var(--background)",border:c,pointerEvents:"none",cursor:"default"}}),t[8]=c,t[9]=u):u=t[9];let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f=_.jsx(aa,{}),t[10]=f):f=t[10];let d;t[11]!==n.connection.icon||t[12]!==n.connection.title?(d=_.jsx(er,{icon:n.connection.icon,name:n.connection.title,size:"md",fallbackIcon:f,className:"relative z-10"}),t[11]=n.connection.icon,t[12]=n.connection.title,t[13]=d):d=t[13];let p;t[14]!==n.connection.title?(p=_.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.connection.title}),t[14]=n.connection.title,t[15]=p):p=t[15];let h;t[16]!==n.colorScheme.textClass?(h=or("text-base leading-[1.35] font-semibold tabular-nums",n.colorScheme.textClass),t[16]=n.colorScheme.textClass,t[17]=h):h=t[17];let w;t[18]!==s||t[19]!==h?(w=_.jsx("span",{className:h,children:s}),t[18]=s,t[19]=h,t[20]=w):w=t[20];let v;t[21]!==w||t[22]!==p?(v=_.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[p,w]}),t[21]=w,t[22]=p,t[23]=v):v=t[23];let m;return t[24]!==a||t[25]!==v||t[26]!==u||t[27]!==d?(m=_.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[u,d,v]}),t[24]=a,t[25]=v,t[26]=u,t[27]=d,t[28]=m):m=t[28],m}function og(e){const t=he.c(9),{data:n}=e,o=Rt();let r;t[0]!==n.org||t[1]!==o?(r=()=>{o({to:"/$org/store",params:{org:n.org}})},t[0]=n.org,t[1]=o,t[2]=r):r=t[2];const s=r;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i={height:nt,width:nt},t[3]=i):i=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=_.jsx(Pe,{type:"target",position:X.Left,style:{opacity:0,pointerEvents:"none"}}),l=_.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-8 w-8"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=_.jsx(Pe,{type:"source",position:X.Right,style:{opacity:0,pointerEvents:"none"}}),t[6]=c):c=t[6];let u;return t[7]!==s?(u=_.jsxs("div",{className:"flex items-center justify-center p-2 bg-primary border border-primary-foreground/50 rounded-lg shadow-sm cursor-pointer pointer-events-auto",style:i,onClick:s,children:[a,l,c]}),t[7]=s,t[8]=u):u=t[8],u}const rg={gateway:tg,server:ng,mesh:og};function ig(){const e=he.c(8),{metricsMode:t,setMetricsMode:n}=Vi();let o;e[0]!==n?(o=l=>l&&n(l),e[0]=n,e[1]=o):o=e[1];let r,s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=_.jsx(tn,{value:"requests",className:"text-xs px-3 cursor-pointer",children:"Tool Calls"}),s=_.jsx(tn,{value:"errors",className:"text-xs px-3 cursor-pointer",children:"Errors"}),i=_.jsx(tn,{value:"latency",className:"text-xs px-3 cursor-pointer",children:"Latency"}),e[2]=r,e[3]=s,e[4]=i):(r=e[2],s=e[3],i=e[4]);let a;return e[5]!==t||e[6]!==o?(a=_.jsxs(xa,{type:"single",value:t,onValueChange:o,variant:"outline",size:"sm",className:"bg-background/80 backdrop-blur-sm",children:[r,s,i]}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function sg(){const e=he.c(36),{metricsMode:t}=Vi(),{org:n}=bn();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:Uo},e[0]=o):o=e[0];const r=tr(o);let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s={pageSize:Uo},e[1]=s):s=e[1];const i=Jo(s),a=eg();let l,c,u,f,d;if(e[2]!==t||e[3]!==a||e[4]!==i||e[5]!==r){let P;e[11]!==t||e[12]!==a?(P=(L,y)=>St(a.gateways.get(y.id),t)-St(a.gateways.get(L.id),t),e[11]=t,e[12]=a,e[13]=P):P=e[13],d=[...r].sort(P);let $;e[14]!==t||e[15]!==a?($=(L,y)=>St(a.connections.get(y.id),t)-St(a.connections.get(L.id),t),e[14]=t,e[15]=a,e[16]=$):$=e[16],f=[...i].sort($),l=Uh[t],u=new Map,d.forEach((L,y)=>u.set(L.id,y)),c=new Map,f.forEach((L,y)=>c.set(L.id,y)),e[2]=t,e[3]=a,e[4]=i,e[5]=r,e[6]=l,e[7]=c,e[8]=u,e[9]=f,e[10]=d}else l=e[6],c=e[7],u=e[8],f=e[9],d=e[10];const p=-nt/2,h=nt/2,w=p-100-jn,v=h+100,m=d.length,b=f.length;let g,x;if(e[17]!==l||e[18]!==c||e[19]!==u||e[20]!==m||e[21]!==t||e[22]!==a||e[23]!==n.slug||e[24]!==i||e[25]!==r||e[26]!==b){const P={stroke:l.edgeColor,strokeWidth:1.25,strokeDasharray:"8 6",strokeLinecap:"square"};x=[],g=[],x.push({id:"mesh",type:"mesh",position:{x:p,y:-nt/2},data:{org:n.slug,colorScheme:l},draggable:!1,selectable:!1}),[...r].sort(cg).forEach(y=>{const A=((u.get(y.id)??0)-(m-1)/2)*70-Ht/2;x.push({id:`gateway-${y.id}`,type:"gateway",position:{x:w,y:A},data:{gateway:y,metricsMode:t,metric:a.gateways.get(y.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),g.push({id:`e-gw-${y.id}`,source:`gateway-${y.id}`,target:"mesh",type:"smoothstep",animated:!0,style:P})}),[...i].sort(ag).forEach(y=>{const A=((c.get(y.id)??0)-(b-1)/2)*70-Ht/2;x.push({id:`server-${y.id}`,type:"server",position:{x:v,y:A},data:{connection:y,metricsMode:t,metric:a.connections.get(y.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),g.push({id:`e-srv-${y.id}`,source:"mesh",target:`server-${y.id}`,type:"smoothstep",animated:!0,style:P})}),e[17]=l,e[18]=c,e[19]=u,e[20]=m,e[21]=t,e[22]=a,e[23]=n.slug,e[24]=i,e[25]=r,e[26]=b,e[27]=g,e[28]=x}else g=e[27],x=e[28];let M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M={backgroundImage:"radial-gradient(circle, var(--border) 1px, transparent 1.5px)",backgroundSize:"32px 32px"},e[29]=M):M=e[29];const E=M;let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=_.jsx("style",{children:`
|
|
8
8
|
.mesh-minimap .react-flow__node { transition: transform 300ms ease-out; }
|
|
9
9
|
.mesh-minimap .react-flow__edge path { transition: d 300ms ease-out; }
|
|
10
10
|
.mesh-minimap .react-flow__edge.animated path {
|
|
@@ -32,4 +32,4 @@ import{r as z,y as Xs,z as Zs,j as _,c as he,h as Rt,i as Gs,a as Ws,t as qn}fro
|
|
|
32
32
|
width: var(--typewriter-max-width);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
`}),t[6]=h):h=t[6];let w;return t[7]!==s||t[8]!==d||t[9]!==p||t[10]!==n?(w=_.jsxs("span",{className:s,style:d,children:[p,h]},n),t[7]=s,t[8]=d,t[9]=p,t[10]=n,t[11]=w):w=t[11],w}function mg(){const e=he.c(84),{org:t,locator:n}=bn(),{data:o}=
|
|
35
|
+
`}),t[6]=h):h=t[6];let w;return t[7]!==s||t[8]!==d||t[9]!==p||t[10]!==n?(w=_.jsxs("span",{className:s,style:d,children:[p,h]},n),t[7]=s,t[8]=d,t[9]=p,t[10]=n,t[11]=w):w=t[11],w}function mg(){const e=he.c(84),{org:t,locator:n}=bn(),{data:o}=Gs.useSession(),r=o?.user,s=Rt(),{inputValue:i,setInputValue:a,createThread:l,activeThreadId:c,setActiveThreadId:u,hideThread:f}=Kn(),{threads:d,refetch:p}=Us(),[h,w]=nr(`${n}:home-view-mode`,"chat"),v=tr(),m=Qs(),b=Jo();let g;e[0]!==b?(g={connections:b,binding:"LLMS"},e[0]=b,e[1]=g):g=e[1];const[x]=la(g),M=!!x;let E;e[2]!==n?(E=ua.chatSelectedModel(n),e[2]=n,e[3]=E):E=e[3];const[C,D]=Qo(E,m,xg),[k,V]=Qo(`${n}:selected-gateway`,v,yg);let P;e[4]!==D?(P=oe=>{D(oe)},e[4]=D,e[5]=P):P=e[5];const $=P;let L;e[6]!==V?(L=oe=>{V({gatewayId:oe})},e[6]=V,e[7]=L):L=e[7];const y=L,I=Js();let S;e[8]!==l||e[9]!==k?.id?(S=oe=>l({id:oe.id,title:oe.title,gatewayId:k?.id}),e[8]=l,e[9]=k?.id,e[10]=S):S=e[10];let A;e[11]!==c||e[12]!==I||e[13]!==S?(A={threadId:c,systemPrompt:hg,onToolCall:I,onCreateThread:S},e[11]=c,e[12]=I,e[13]=S,e[14]=A):A=e[14];const N=ea(A),{branchContext:T,clearBranch:H}=Kn();let j;e[15]!==c||e[16]!==N||e[17]!==H||e[18]!==k||e[19]!==C||e[20]!==a||e[21]!==r?.image||e[22]!==r?.name?(j=async oe=>{if(!C){qn.error("No model configured");return}if(!k?.id){qn.error("No Hub configured");return}a(""),H();const ce={created_at:new Date().toISOString(),thread_id:c,model:{id:C.id,connectionId:C.connectionId,provider:C.provider??void 0,limits:C.limits??void 0},gateway:{id:k.id},user:{avatar:r?.image??void 0,name:r?.name??"you"}};await N.sendMessage(oe,ce)},e[15]=c,e[16]=N,e[17]=H,e[18]=k,e[19]=C,e[20]=a,e[21]=r?.image,e[22]=r?.name,e[23]=j):j=e[23];const R=j;let F;e[24]!==r?.name?(F=r?.name?.split(" ")[0]||"there",e[24]=r?.name,e[25]=F):F=e[25];const B=F;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=fg(),e[26]=W):W=e[26];const Q=W;let Z;e[27]!==c||e[28]!==d?(Z=d?.find(oe=>oe.id===c),e[27]=c,e[28]=d,e[29]=Z):Z=e[29];const O=Z;if(!M){const oe=r?.id||"";let ce;e[30]!==b?(ce=b??[],e[30]=b,e[31]=ce):ce=e[31];let fe;e[32]!==s||e[33]!==t.slug?(fe=()=>{s({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[32]=s,e[33]=t.slug,e[34]=fe):fe=e[34];let we;return e[35]!==t.id||e[36]!==t.slug||e[37]!==oe||e[38]!==ce||e[39]!==fe?(we=_.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:_.jsx(ta,{orgSlug:t.slug,orgId:t.id,userId:oe,allConnections:ce,onInstallMcpServer:fe})}),e[35]=t.id,e[36]=t.slug,e[37]=oe,e[38]=ce,e[39]=fe,e[40]=we):we=e[40],we}let Y;e[41]!==O||e[42]!==N||e[43]!==h?(Y=_.jsx(ge.Header.Left,{children:h==="graph"?_.jsx("span",{className:"text-sm font-medium text-foreground",children:"Summary"}):!N.isEmpty&&O?.title?_.jsx(pg,{text:O.title,className:"text-sm font-medium text-foreground"}):_.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[41]=O,e[42]=N,e[43]=h,e[44]=Y):Y=e[44];let U;e[45]!==h?(U=h==="graph"&&_.jsx(ig,{}),e[45]=h,e[46]=U):U=e[46];let K;e[47]!==c||e[48]!==l||e[49]!==f||e[50]!==p||e[51]!==u||e[52]!==d||e[53]!==h?(K=h!=="graph"&&_.jsxs(_.Fragment,{children:[_.jsx(da,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:()=>l(),"aria-label":"New chat",children:_.jsx(pa,{size:16})}),_.jsx(ia,{threads:d,activeThreadId:c,onSelectThread:u,onRemoveThread:f,onOpen:()=>p(),variant:"outline"})]}),e[47]=c,e[48]=l,e[49]=f,e[50]=p,e[51]=u,e[52]=d,e[53]=h,e[54]=K):K=e[54];let G;e[55]===Symbol.for("react.memo_cache_sentinel")?(G={value:"chat",icon:_.jsx(rr,{})},e[55]=G):G=e[55];let q;e[56]===Symbol.for("react.memo_cache_sentinel")?(q=[G,{value:"graph",icon:_.jsx(ha,{})}],e[56]=q):q=e[56];let J;e[57]!==w||e[58]!==h?(J=_.jsx(fa,{value:h,onValueChange:w,size:"sm",options:q}),e[57]=w,e[58]=h,e[59]=J):J=e[59];let ne;e[60]!==U||e[61]!==K||e[62]!==J?(ne=_.jsxs(ge.Header.Right,{children:[U,K,J]}),e[60]=U,e[61]=K,e[62]=J,e[63]=ne):ne=e[63];let te;e[64]!==Y||e[65]!==ne?(te=_.jsxs(ge.Header,{children:[Y,ne]}),e[64]=Y,e[65]=ne,e[66]=te):te=e[66];let se;e[67]!==T||e[68]!==N||e[69]!==H||e[70]!==y||e[71]!==$||e[72]!==R||e[73]!==i||e[74]!==k||e[75]!==C||e[76]!==u||e[77]!==a||e[78]!==B||e[79]!==h?(se=h==="graph"?_.jsx("div",{className:"flex-1 overflow-hidden relative",children:_.jsx(Qn,{fallback:_.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground h-full flex items-center justify-center",children:"Failed to load mesh visualization"}),children:_.jsx(z.Suspense,{fallback:_.jsx(lg,{}),children:_.jsx(sg,{})})})}):N.isEmpty?_.jsx("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 py-10",children:_.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-[550px]",children:[_.jsxs("div",{className:"text-center",children:[_.jsxs("p",{className:"text-lg font-medium text-foreground",children:[Q," ",B,","]}),_.jsx("p",{className:"text-base text-muted-foreground",children:"What are we building today?"})]}),k?.id&&_.jsx(Qn,{fallback:null,children:_.jsx(z.Suspense,{fallback:_.jsx("div",{className:"flex justify-center",children:_.jsx(ga,{size:20,className:"animate-spin text-muted-foreground"})}),children:_.jsx(oa,{gatewayId:k.id,onSelect:oe=>{R(oe.description??oe.name)},className:"w-full"})})},k.id),_.jsx("div",{className:"w-full shadow-sm rounded-xl",children:_.jsxs(ra,{value:i,onChange:a,onSubmit:async()=>{i.trim()&&await R(i.trim())},placeholder:"Ask anything or @ for context",maxTextHeight:"65px",children:[_.jsx(to,{selectedGatewayId:k?.id,onGatewayChange:y,placeholder:"Gateway",variant:"borderless"}),_.jsx(Un,{selectedModel:C??void 0,onModelChange:$,placeholder:"Model",variant:"borderless"})]})})]})}):_.jsxs(_.Fragment,{children:[_.jsx(ge.Main,{children:_.jsx(ge.Messages,{messages:N.messages,status:N.status,minHeightOffset:240})}),_.jsx(ge.Footer,{children:_.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsx(ge.ErrorBanner,{error:N.error,onFixInChat:()=>{N.error&&R(`I encountered this error: ${N.error.message}. Can you help me fix it?`)},onDismiss:N.clearError}),_.jsx(ge.FinishReasonWarning,{finishReason:N.finishReason,onContinue:()=>{R("Please continue.")},onDismiss:N.clearFinishReason}),_.jsx(ge.BranchPreview,{branchContext:T,clearBranchContext:H,onGoToOriginalMessage:()=>{T&&(u(T.originalThreadId),H(),a(""))},setInputValue:a}),_.jsxs(ge.Input,{value:i,onChange:a,onSubmit:async()=>{i.trim()&&await R(i.trim())},onStop:N.stop,disabled:!C||!k?.id,isStreaming:N.status==="submitted"||N.status==="streaming",placeholder:C?"Ask anything or @ for context":"Select a model to start chatting",children:[_.jsx(to,{selectedGatewayId:k?.id,onGatewayChange:y,placeholder:"Gateway",variant:"borderless"}),_.jsx(Un,{selectedModel:C??void 0,onModelChange:$,placeholder:"Model",variant:"borderless"}),_.jsx(na,{messages:N.messages})]})]})})]}),e[67]=T,e[68]=N,e[69]=H,e[70]=y,e[71]=$,e[72]=R,e[73]=i,e[74]=k,e[75]=C,e[76]=u,e[77]=a,e[78]=B,e[79]=h,e[80]=se):se=e[80];let le;return e[81]!==te||e[82]!==se?(le=_.jsx(Kh,{children:_.jsxs(ge,{children:[te,se]})}),e[81]=te,e[82]=se,e[83]=le):le=e[83],le}function yg(e,t){return e.id===t.gatewayId}function xg(e,t){return e.id===t.id&&e.connectionId===t.connectionId}function np(){const e=he.c(3),t=Ws();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=_.jsx(z.Suspense,{fallback:_.jsx(Ks,{}),children:_.jsx(mg,{})}),e[0]=n):n=e[0];let o;return e[1]!==t.location.pathname?(o=_.jsx(qs,{children:n},t.location.pathname),e[1]=t.location.pathname,e[2]=o):o=e[2],o}export{np as default};
|