@decocms/mesh 2.10.0 → 2.12.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-BI-lv-P2.js → AlertCircle-Cso_Xxvk.js} +1 -1
- package/dist/client/assets/{ArrowLeft-WX776rGw.js → ArrowLeft-BrsZ2N_5.js} +1 -1
- package/dist/client/assets/{Check-Dh23dmDM.js → Check-JFkjTCfG.js} +1 -1
- package/dist/client/assets/{ChevronDown-CQl6wdMq.js → ChevronDown-HtFMO0lw.js} +1 -1
- package/dist/client/assets/{Clock-C2L66fjj.js → Clock-CW5u1cfj.js} +1 -1
- package/dist/client/assets/{Code01-BvYrq72o.js → Code01-CgNchnl3.js} +1 -1
- package/dist/client/assets/{Copy01-BX4_oHqx.js → Copy01-Dadp_RDG.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-9lU8MC-X.js → DotsHorizontal-B0A7sUYv.js} +1 -1
- package/dist/client/assets/{DotsVertical-BBtotCm7.js → DotsVertical-BHUUUCDx.js} +1 -1
- package/dist/client/assets/Edit01-CxRkZTQ1.js +1 -0
- package/dist/client/assets/{File06-lv7rH_v1.js → File06-D0TXCuMx.js} +1 -1
- package/dist/client/assets/{FilterLines-WZSp93Oe.js → FilterLines-_uykt7r4.js} +1 -1
- package/dist/client/assets/{FlipBackward-CqqvNJYu.js → FlipBackward-GGMv99yc.js} +1 -1
- package/dist/client/assets/{GitBranch01-DN-LFsG4.js → GitBranch01-BUTuezlq.js} +1 -1
- package/dist/client/assets/{Grid01-bigl9l-5.js → Grid01-BbdtRdR8.js} +1 -1
- package/dist/client/assets/{Inbox01-BIZdM9VF.js → Inbox01-CgwXLK3n.js} +1 -1
- package/dist/client/assets/{InfoCircle-FggQ2WMl.js → InfoCircle-D6qJG9Nl.js} +1 -1
- package/dist/client/assets/{Key01-BHIpjeh2.js → Key01-8ewaPBuD.js} +1 -1
- package/dist/client/assets/{LinkExternal01-YcVnQhq1.js → LinkExternal01-D0Wjfr3t.js} +1 -1
- package/dist/client/assets/{Loading01-nz4zkIiQ.js → Loading01-NW_f44Lz.js} +1 -1
- package/dist/client/assets/{Lock01-DJbaRRVq.js → Lock01-BTPtPjN4.js} +1 -1
- package/dist/client/assets/{Play-Dy3YBriV.js → Play-CIMfsFF1.js} +1 -1
- package/dist/client/assets/{Plus-DRzcJPy4.js → Plus-DaP4KLuJ.js} +1 -1
- package/dist/client/assets/{SearchMd-CGgWiIHk.js → SearchMd-tOSOFUes.js} +1 -1
- package/dist/client/assets/{Terminal-DDxodu0O.js → Terminal-ANRX3jJ8.js} +1 -1
- package/dist/client/assets/{Trash01-Nn4emH5w.js → Trash01-CjDzx3jP.js} +1 -1
- package/dist/client/assets/{X-CSDtf13Z.js → X-D3ljCSd1.js} +1 -1
- package/dist/client/assets/{XClose-Da4Q_9Br.js → XClose-Ba3zyI0J.js} +1 -1
- package/dist/client/assets/{alert-dialog-BrdP9Xiy.js → alert-dialog-_Gzpv9vf.js} +1 -1
- package/dist/client/assets/{auth-BkX07Kdp.js → auth-C9dSkS_x.js} +1 -1
- package/dist/client/assets/{auth-catchall-CgZMKj4U.js → auth-catchall-DRL5ZGJM.js} +1 -1
- package/dist/client/assets/{avatar-DVkpHhcq.js → avatar-D1o5pnzU.js} +1 -1
- package/dist/client/assets/{badge-DZOpuutl.js → badge-0b6sJe4S.js} +1 -1
- package/dist/client/assets/{card-VaGCmdRN.js → card-B3fsloDi.js} +1 -1
- package/dist/client/assets/{checkbox-B6_pb64c.js → checkbox-2xIaHvS4.js} +1 -1
- package/dist/client/assets/{collection-detail-BZTq36Jq.js → collection-detail-Bu5gtjud.js} +31 -31
- package/dist/client/assets/{collection-display-button-0kCgwjcX.js → collection-display-button-BGIcja12.js} +1 -1
- package/dist/client/assets/{collection-header-C5jLEW4T.js → collection-header-DhWbmVkk.js} +1 -1
- package/dist/client/assets/{collection-page-BxN-pfZ4.js → collection-page-B4ZjGX9V.js} +1 -1
- package/dist/client/assets/{collection-search-DCk3URyd.js → collection-search-CYZk6T6Z.js} +1 -1
- package/dist/client/assets/collection-tab-IeT0mJ-2.js +1 -0
- package/dist/client/assets/{collection-table-wrapper-DbtYisXO.js → collection-table-wrapper-D2niE2Ci.js} +1 -1
- package/dist/client/assets/connection-card-D0c_wvmz.js +1 -0
- package/dist/client/assets/connection-detail-BmNPUV8x.js +1 -0
- package/dist/client/assets/connections-U2y3agtD.js +1 -0
- package/dist/client/assets/constants-Cy709IUA.js +1 -0
- package/dist/client/assets/{create-organization-dialog-BcohdvN6.js → create-organization-dialog-D0WQQsLG.js} +1 -1
- package/dist/client/assets/{dialog-rGW8NOdv.js → dialog-BXeLl5mO.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DEdU2p2E.js → dropdown-menu-CnL8UM0z.js} +1 -1
- package/dist/client/assets/{empty-state-C6fFQCSt.js → empty-state-BmkZOMzL.js} +1 -1
- package/dist/client/assets/empty-state-DzS1Zp7m.js +2 -0
- package/dist/client/assets/{env-vars-editor-DtIOMaFz.js → env-vars-editor-B_mIaT86.js} +1 -1
- package/dist/client/assets/{error-boundary-B28JvE1I.js → error-boundary-BQnJ9S9E.js} +1 -1
- package/dist/client/assets/{extract-connection-data-fJTZE6Hc.js → extract-connection-data-DPoJQhk8.js} +1 -1
- package/dist/client/assets/{form-CE1tfcze.js → form-DrOt6d2d.js} +1 -1
- package/dist/client/assets/gateway-detail-CniDbJPb.js +1 -0
- package/dist/client/assets/gateways-DmEpJOpx.js +1 -0
- package/dist/client/assets/{home-lONkAboE.js → home-HrkEcREJ.js} +1 -1
- package/dist/client/assets/{index-CJEYCkTv.js → index-Bb8rHnPb.js} +1 -1
- package/dist/client/assets/index-CBIrwxtj.js +88 -0
- package/dist/client/assets/index-ChrSnaFS.css +1 -0
- package/dist/client/assets/{index-Dc4mPG7D.js → index-DMNk-OUX.js} +3 -3
- package/dist/client/assets/index-GoXtajA4.js +25 -0
- package/dist/client/assets/{index-CGbuv4sL.js → index-XOpbMEap.js} +1 -1
- package/dist/client/assets/{input-CLQFaB_P.js → input-68J17rBp.js} +1 -1
- package/dist/client/assets/{layout-D-qTqL0P.js → layout-Olb4shdE.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-CM_r6Qg6.js → lazy-highlighter-Ccgc_fxj.js} +1 -1
- package/dist/client/assets/localstorage-keys-C62ZbWuB.js +1 -0
- package/dist/client/assets/{login-CY0fBMtA.js → login-UTKAAaeX.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DwoWo555.js → mcp-oauth-Db8WtQ8u.js} +1 -1
- package/dist/client/assets/mcp-server-detail-BvVQovUz.js +1 -0
- package/dist/client/assets/members-V-vtwMYY.js +3 -0
- package/dist/client/assets/{monaco-editor-CGmVJ7Sz.js → monaco-editor-B_MycISs.js} +1 -1
- package/dist/client/assets/{monitoring-8m7n1ABH.js → monitoring-CBmCnQ7i.js} +20 -20
- package/dist/client/assets/{oauth-callback-C3UTt1IM.js → oauth-callback-BYBqbF1w.js} +1 -1
- package/dist/client/assets/page-DYF0Qz3l.js +1 -0
- package/dist/client/assets/page-DrIZd1pO.js +35 -0
- package/dist/client/assets/{pin-to-sidebar-button-DmlmCu_p.js → pin-to-sidebar-button-B1xHHS9n.js} +1 -1
- package/dist/client/assets/{popover-Bt6Irkfs.js → popover-DC9U4d6e.js} +1 -1
- package/dist/client/assets/{project-context-provider-jIErvTKU.js → project-context-provider-BJIP5a-U.js} +1 -1
- package/dist/client/assets/{resizable-BDACILOB.js → resizable-CW5_SPIS.js} +1 -1
- package/dist/client/assets/{resource-tabs-B9UXtdu9.js → resource-tabs-BKSlcL1W.js} +1 -1
- package/dist/client/assets/{select-CXOQrDyU.js → select-B9KJyTZZ.js} +1 -1
- package/dist/client/assets/{settings-Cml1v0xs.js → settings-CYg4YPRI.js} +1 -1
- package/dist/client/assets/shell-layout-KIN6fL5j.js +3 -0
- package/dist/client/assets/{spinner-C-rDsJGC.js → spinner-B0sczm1j.js} +1 -1
- package/dist/client/assets/{switch-C2oVrx7C.js → switch-BuVvmF04.js} +1 -1
- package/dist/client/assets/{textarea-DxDFaLzd.js → textarea-BAUX8Qgd.js} +1 -1
- package/dist/client/assets/thread-history-popover-Dv63nk6L.js +20 -0
- package/dist/client/assets/tool-set-selector-DMsE0yRo.js +1 -0
- package/dist/client/assets/tools-list-Dgf0oqyC.js +1 -0
- package/dist/client/assets/{use-binding-C_WCv3Kw.js → use-binding-Dj4lal1A.js} +1 -1
- package/dist/client/assets/use-connection-DoWszS3j.js +1 -0
- package/dist/client/assets/{use-connection-resources-DAy5w-Ms.js → use-connection-resources-BywYCfzc.js} +1 -1
- package/dist/client/assets/use-create-gateway-Ca5SEa8I.js +1 -0
- package/dist/client/assets/use-gateway-CRpsitbG.js +1 -0
- package/dist/client/assets/{use-gateway-system-prompt-B0FWJC8i.js → use-gateway-system-prompt-B4ia2QxW.js} +1 -1
- package/dist/client/assets/{use-list-state-D9IMsf4Z.js → use-list-state-CPUcOhR_.js} +1 -1
- package/dist/client/assets/use-mcp-L2lisTXg.js +1 -0
- package/dist/client/assets/{use-members-BrVgN1Nv.js → use-members-7eRdYOTr.js} +1 -1
- package/dist/client/assets/{use-mobile-BmTi-FB3.js → use-mobile--ytA5LT5.js} +1 -1
- package/dist/client/assets/use-organization-settings-D6rXW2c_.js +1 -0
- package/dist/client/assets/use-tool-call-BBonHr6l.js +1 -0
- package/dist/client/assets/{value-Duay7dd7.js → value-Bd2XBV_y.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Q_4Hio7O.js → view-mode-toggle-BpjQ6V4P.js} +1 -1
- package/dist/client/assets/well-known-mcp-D13f-8h2.js +1 -0
- package/dist/client/assets/workflow-CjynHD6b.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +161 -133
- package/dist/server/migrate.js +2 -2
- package/dist/server/server.js +162 -134
- package/package.json +1 -1
- package/dist/client/assets/collection-tab-BK4lXf-5.js +0 -1
- package/dist/client/assets/connection-card-CtcQXchE.js +0 -1
- package/dist/client/assets/connection-detail-Dtnc6jAX.js +0 -1
- package/dist/client/assets/connections-BkTTX2-6.js +0 -1
- package/dist/client/assets/constants-D7HtiX2k.js +0 -1
- package/dist/client/assets/gateway-detail-DpvUxeca.js +0 -1
- package/dist/client/assets/gateways-DPTsKKk2.js +0 -1
- package/dist/client/assets/index-B-_GLG4a.js +0 -25
- package/dist/client/assets/index-DjBifmxL.js +0 -88
- package/dist/client/assets/index-KJvlasGf.css +0 -1
- package/dist/client/assets/localstorage-keys-Csxol0-8.js +0 -1
- package/dist/client/assets/mcp-server-detail-BfkMNCXA.js +0 -1
- package/dist/client/assets/members-DlfrW4qm.js +0 -3
- package/dist/client/assets/page-CjTfwiJs.js +0 -1
- package/dist/client/assets/page-Cm8i9onu.js +0 -35
- package/dist/client/assets/shell-layout-BC-hIRVP.js +0 -3
- package/dist/client/assets/thread-history-popover-D_x2TXEl.js +0 -72
- package/dist/client/assets/tool-set-selector-B03cDU_f.js +0 -1
- package/dist/client/assets/tools-list-CCvCpz3e.js +0 -1
- package/dist/client/assets/use-connection-D1oWmd80.js +0 -2
- package/dist/client/assets/use-gateway-DEBoqh3W.js +0 -1
- package/dist/client/assets/use-mcp-BSK2ddKq.js +0 -1
- package/dist/client/assets/use-organization-settings-DPGpmRIO.js +0 -1
- package/dist/client/assets/use-tool-call-B5UsmKnA.js +0 -1
- package/dist/client/assets/useQuery-CjN7yze9.js +0 -1
- package/dist/client/assets/well-known-mcp-7PcWXInp.js +0 -1
- package/dist/client/assets/workflow-C6xPZGlX.js +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import{r as z,z as Xi,B as Yi,j as m,c as ge,f as jt,k as Zi,a as Wi,t as Un}from"./index-Dc4mPG7D.js";import{j as Gi,f as Qn,g as qi,h as Ki,i as Ui,C as ue,G as Jn,M as eo,U as Qi,k as Ji}from"./index-DjBifmxL.js";import{D as ea,u as to,b as ta,a as na,c as oa,N as ra,G as sa,T as ia}from"./thread-history-popover-D_x2TXEl.js";import{E as un}from"./error-boundary-B28JvE1I.js";import{u as er,c as aa,I as tr,n as ca}from"./use-connection-D1oWmd80.js";import{u as la}from"./use-binding-C_WCv3Kw.js";import{u as ua,L as da}from"./localstorage-keys-Csxol0-8.js";import{u as Sn}from"./project-context-provider-jIErvTKU.js";import{W as fa}from"./well-known-mcp-7PcWXInp.js";import{c as nr,B as or}from"./input-CLQFaB_P.js";import{V as ha}from"./view-mode-toggle-Q_4Hio7O.js";import{i as ga}from"./GitBranch01-DN-LFsG4.js";import{i as pa}from"./Loading01-nz4zkIiQ.js";import{s as ma}from"./Plus-DRzcJPy4.js";import{u as ya,i as xa}from"./use-gateway-DEBoqh3W.js";import{u as wa}from"./use-tool-call-B5UsmKnA.js";import{i as De,a as no,b as va,c as oo,d as en,T as tn,e as _a}from"./value-Duay7dd7.js";import"./Check-Dh23dmDM.js";import"./SearchMd-CGgWiIHk.js";import"./AlertCircle-BI-lv-P2.js";import"./X-CSDtf13Z.js";import"./Grid01-bigl9l-5.js";import"./textarea-DxDFaLzd.js";import"./Copy01-BX4_oHqx.js";import"./Terminal-DDxodu0O.js";import"./monaco-editor-CGmVJ7Sz.js";import"./spinner-C-rDsJGC.js";import"./alert-dialog-BrdP9Xiy.js";import"./select-CXOQrDyU.js";import"./ChevronDown-CQl6wdMq.js";import"./use-mobile-BmTi-FB3.js";import"./File06-lv7rH_v1.js";import"./InfoCircle-FggQ2WMl.js";import"./use-gateway-system-prompt-B0FWJC8i.js";import"./popover-Bt6Irkfs.js";import"./generate-id-Dyweu44Y.js";import"./Clock-C2L66fjj.js";import"./Trash01-Nn4emH5w.js";import"./auth-BkX07Kdp.js";import"./useQuery-CjN7yze9.js";const En=({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"}));En.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 ba={value:()=>{}};function Ot(){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 Ct(n)}function Ct(e){this._=e}function Sa(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}})}Ct.prototype=Ot.prototype={constructor:Ct,on:function(e,t){var n=this._,o=Sa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Ea(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=ro(n[r],e.name,t);else if(t==null)for(r in n)n[r]=ro(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 Ct(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function Ea(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function ro(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ba,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var dn="http://www.w3.org/1999/xhtml";const so={svg:"http://www.w3.org/2000/svg",xhtml:dn,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)),so.hasOwnProperty(t)?{space:so[t],local:e}:e}function Ca(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dn&&t.documentElement.namespaceURI===dn?t.createElement(e):t.createElementNS(n,e)}}function Na(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rr(e){var t=Vt(e);return(t.local?Na:Ca)(t)}function Ma(){}function Cn(e){return e==null?Ma:function(){return this.querySelector(e)}}function Ia(e){typeof e!="function"&&(e=Cn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new he(o,this._parents)}function ka(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Aa(){return[]}function sr(e){return e==null?Aa:function(){return this.querySelectorAll(e)}}function Pa(e){return function(){return ka(e.apply(this,arguments))}}function Ta(e){typeof e=="function"?e=Pa(e):e=sr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new he(o,r)}function ir(e){return function(){return this.matches(e)}}function ar(e){return function(t){return t.matches(e)}}var Da=Array.prototype.find;function $a(e){return function(){return Da.call(this.children,e)}}function za(){return this.firstElementChild}function La(e){return this.select(e==null?za:$a(typeof e=="function"?e:ar(e)))}var Ha=Array.prototype.filter;function Ra(){return Array.from(this.children)}function ja(e){return function(){return Ha.call(this.children,e)}}function Oa(e){return this.selectAll(e==null?Ra:ja(typeof e=="function"?e:ar(e)))}function Va(e){typeof e!="function"&&(e=ir(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new he(o,this._parents)}function cr(e){return new Array(e.length)}function Ba(){return new he(this._enter||this._groups.map(cr),this._parents)}function At(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}At.prototype={constructor:At,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 Fa(e){return function(){return e}}function Xa(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new At(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Ya(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(d[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new At(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Za(e){return e.__data__}function Wa(e,t){if(!arguments.length)return Array.from(this,Za);var n=t?Ya:Xa,o=this._parents,r=this._groups;typeof e!="function"&&(e=Fa(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],f=r[c],d=f.length,h=Ga(e.call(u,u&&u.__data__,c,o)),g=h.length,v=a[c]=new Array(g),_=s[c]=new Array(g),y=l[c]=new Array(d);n(u,f,v,_,y,h,t);for(var b=0,p=0,w,N;b<g;++b)if(w=v[b]){for(b>=p&&(p=b+1);!(N=_[p])&&++p<g;);w._next=N||null}}return s=new he(s,o),s._enter=a,s._exit=l,s}function Ga(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qa(){return new he(this._exit||this._groups.map(cr),this._parents)}function Ka(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Ua(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<r;++l)a[l]=n[l];return new he(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,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Ja(e){e||(e=ec);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),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new he(r,this._parents).order()}function ec(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function tc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nc(){return Array.from(this)}function oc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function rc(){let e=0;for(const t of this)++e;return e}function sc(){return!this.node()}function ic(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function ac(e){return function(){this.removeAttribute(e)}}function cc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lc(e,t){return function(){this.setAttribute(e,t)}}function uc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function fc(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 hc(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?cc:ac:typeof t=="function"?n.local?fc:dc:n.local?uc:lc)(n,t))}function lr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gc(e){return function(){this.style.removeProperty(e)}}function pc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function mc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function yc(e,t,n){return arguments.length>1?this.each((t==null?gc:typeof t=="function"?mc:pc)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||lr(e).getComputedStyle(e,null).getPropertyValue(t)}function xc(e){return function(){delete this[e]}}function wc(e,t){return function(){this[e]=t}}function vc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _c(e,t){return arguments.length>1?this.each((t==null?xc:typeof t=="function"?vc:wc)(e,t)):this.node()[e]}function ur(e){return e.trim().split(/^|\s+/)}function Nn(e){return e.classList||new dr(e)}function dr(e){this._node=e,this._names=ur(e.getAttribute("class")||"")}dr.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 fr(e,t){for(var n=Nn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function hr(e,t){for(var n=Nn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function bc(e){return function(){fr(this,e)}}function Sc(e){return function(){hr(this,e)}}function Ec(e,t){return function(){(t.apply(this,arguments)?fr:hr)(this,e)}}function Cc(e,t){var n=ur(e+"");if(arguments.length<2){for(var o=Nn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Ec:t?bc:Sc)(n,t))}function Nc(){this.textContent=""}function Mc(e){return function(){this.textContent=e}}function Ic(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function kc(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Ic:Mc)(e)):this.node().textContent}function Ac(){this.innerHTML=""}function Pc(e){return function(){this.innerHTML=e}}function Tc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Dc(e){return arguments.length?this.each(e==null?Ac:(typeof e=="function"?Tc:Pc)(e)):this.node().innerHTML}function $c(){this.nextSibling&&this.parentNode.appendChild(this)}function zc(){return this.each($c)}function Lc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hc(){return this.each(Lc)}function Rc(e){var t=typeof e=="function"?e:rr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jc(){return null}function Oc(e,t){var n=typeof e=="function"?e:rr(e),o=t==null?jc:typeof t=="function"?t:Cn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Vc(){var e=this.parentNode;e&&e.removeChild(this)}function Bc(){return this.each(Vc)}function Fc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yc(e){return this.select(e?Xc:Fc)}function Zc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wc(e){return function(t){e.call(this,t,this.__data__)}}function Gc(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 qc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Kc(e,t,n){return function(){var o=this.__on,r,i=Wc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Uc(e,t,n){var o=Gc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Kc:qc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function gr(e,t,n){var o=lr(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 gr(this,e,t)}}function Jc(e,t){return function(){return gr(this,e,t.apply(this,arguments))}}function el(e,t){return this.each((typeof t=="function"?Jc:Qc)(e,t))}function*tl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var pr=[null];function he(e,t){this._groups=e,this._parents=t}function dt(){return new he([[document.documentElement]],pr)}function nl(){return this}he.prototype=dt.prototype={constructor:he,select:Ia,selectAll:Ta,selectChild:La,selectChildren:Oa,filter:Va,data:Wa,enter:Ba,exit:qa,join:Ka,merge:Ua,selection:nl,order:Qa,sort:Ja,call:tc,nodes:nc,node:oc,size:rc,empty:sc,each:ic,attr:hc,style:yc,property:_c,classed:Cc,text:kc,html:Dc,raise:zc,lower:Hc,append:Rc,insert:Oc,remove:Bc,clone:Yc,datum:Zc,on:Uc,dispatch:el,[Symbol.iterator]:tl};function fe(e){return typeof e=="string"?new he([[document.querySelector(e)]],[document.documentElement]):new he([[e]],pr)}function ol(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ye(e,t){if(e=ol(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 rl={passive:!1},rt={capture:!0,passive:!1};function nn(e){e.stopImmediatePropagation()}function Fe(e){e.preventDefault(),e.stopImmediatePropagation()}function mr(e){var t=e.document.documentElement,n=fe(e).on("dragstart.drag",Fe,rt);"onselectstart"in t?n.on("selectstart.drag",Fe,rt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function yr(e,t){var n=e.document.documentElement,o=fe(e).on("dragstart.drag",null);t&&(o.on("click.drag",Fe,rt),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 yt=e=>()=>e;function fn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}fn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function sl(e){return!e.ctrlKey&&!e.button}function il(){return this.parentNode}function al(e,t){return t??{x:e.x,y:e.y}}function cl(){return navigator.maxTouchPoints||"ontouchstart"in this}function xr(){var e=sl,t=il,n=al,o=cl,r={},i=Ot("start","drag","end"),s=0,a,l,c,u,f=0;function d(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",y,rl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(u||!e.call(this,w,N))){var S=p(this,t.call(this,w,N),w,N,"mouse");S&&(fe(w.view).on("mousemove.drag",g,rt).on("mouseup.drag",v,rt),mr(w.view),nn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function g(w){if(Fe(w),!c){var N=w.clientX-a,S=w.clientY-l;c=N*N+S*S>f}r.mouse("drag",w)}function v(w){fe(w.view).on("mousemove.drag mouseup.drag",null),yr(w.view,c),Fe(w),r.mouse("end",w)}function _(w,N){if(e.call(this,w,N)){var S=w.changedTouches,E=t.call(this,w,N),D=S.length,P,R;for(P=0;P<D;++P)(R=p(this,E,w,N,S[P].identifier,S[P]))&&(nn(w),R("start",w,S[P]))}}function y(w){var N=w.changedTouches,S=N.length,E,D;for(E=0;E<S;++E)(D=r[N[E].identifier])&&(Fe(w),D("drag",w,N[E]))}function b(w){var N=w.changedTouches,S=N.length,E,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),E=0;E<S;++E)(D=r[N[E].identifier])&&(nn(w),D("end",w,N[E]))}function p(w,N,S,E,D,P){var R=i.copy(),k=ye(P||S,N),$,H,x;if((x=n.call(w,new fn("beforestart",{sourceEvent:S,target:d,identifier:D,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:R}),E))!=null)return $=x.x-k[0]||0,H=x.y-k[1]||0,function M(C,A,I){var T=k,L;switch(C){case"start":r[D]=M,L=s++;break;case"end":delete r[D],--s;case"drag":k=ye(I||A,N),L=s;break}R.call(C,w,new fn(C,{sourceEvent:A,subject:x,target:d,identifier:D,active:L,x:k[0]+$,y:k[1]+H,dx:k[0]-T[0],dy:k[1]-T[1],dispatch:R}),E)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:yt(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:yt(w),d):t},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:yt(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:yt(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,d):Math.sqrt(f)},d}var io=180/Math.PI,hn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wr(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*io,skewX:Math.atan(l)*io,scaleX:s,scaleY:a}}var xt;function ll(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?hn:wr(t.a,t.b,t.c,t.d,t.e,t.f)}function ul(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?hn:(e=e.matrix,wr(e.a,e.b,e.c,e.d,e.e,e.f))}function vr(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:De(c,f)},{i:v-2,x:De(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(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:De(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:De(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,h,g){if(c!==f||u!==d){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:De(c,f)},{i:v-2,x:De(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,d),s(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(h){for(var g=-1,v=d.length,_;++g<v;)f[(_=d[g]).i]=_.x(h);return f.join("")}}}var dl=vr(ll,"px, ","px)","deg)"),fl=vr(ul,", ",")",")"),hl=1e-12;function ao(e){return((e=Math.exp(e))+1/e)/2}function gl(e){return((e=Math.exp(e))-1/e)/2}function pl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-l,v=h*h+g*g,_,y;if(v<hl)y=Math.log(d/c)/t,_=function(E){return[a+E*h,l+E*g,c*Math.exp(t*E*y)]};else{var b=Math.sqrt(v),p=(d*d-c*c+o*v)/(2*c*n*b),w=(d*d-c*c-o*v)/(2*d*n*b),N=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);y=(S-N)/t,_=function(E){var D=E*y,P=ao(N),R=c/(n*b)*(P*pl(t*D+N)-gl(N));return[a+R*h,l+R*g,c*P/ao(t*D+N)]}}return _.duration=y*1e3*t/Math.SQRT2,_}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Ye=0,et=0,Qe=0,_r=1e3,Pt,tt,Tt=0,Le=0,Bt=0,st=typeof performance=="object"&&performance.now?performance:Date,br=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mn(){return Le||(br(ml),Le=st.now()+Bt)}function ml(){Le=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=Sr.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Mn():+n)+(t==null?0:+t),!this._next&&tt!==this&&(tt?tt._next=this:Pt=this,tt=this),this._call=e,this._time=n,gn()},stop:function(){this._call&&(this._call=null,this._time=1/0,gn())}};function Sr(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function yl(){Mn(),++Ye;for(var e=Pt,t;e;)(t=Le-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ye}function co(){Le=(Tt=st.now())+Bt,Ye=et=0;try{yl()}finally{Ye=0,wl(),Le=0}}function xl(){var e=st.now(),t=e-Tt;t>_r&&(Bt-=t,Tt=e)}function wl(){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);tt=e,gn(o)}function gn(e){if(!Ye){et&&(et=clearTimeout(et));var t=e-Le;t>24?(e<1/0&&(et=setTimeout(co,e-st.now()-Bt)),Qe&&(Qe=clearInterval(Qe))):(Qe||(Tt=st.now(),Qe=setInterval(xl,_r)),Ye=1,br(co))}}function lo(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var vl=Ot("start","end","cancel","interrupt"),_l=[],Er=0,uo=1,pn=2,Mt=3,fo=4,mn=5,It=6;function Ft(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;bl(e,n,{name:t,index:o,group:r,on:vl,tween:_l,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Er})}function In(e,t){var n=ve(e,t);if(n.state>Er)throw new Error("too late; already scheduled");return n}function be(e,t){var n=ve(e,t);if(n.state>Mt)throw new Error("too late; already running");return n}function ve(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Sr(i,0,n.time);function i(c){n.state=uo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,d,h;if(n.state!==uo)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Mt)return lo(s);h.state===fo?(h.state=It,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=It,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(lo(function(){n.state===Mt&&(n.state=fo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===pn){for(n.state=Mt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);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=mn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===mn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=It,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function kt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>pn&&o.state<mn,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Sl(e){return this.each(function(){kt(this,e)})}function El(e,t){var n,o;return function(){var r=be(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Cl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=be(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Nl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ve(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?El:Cl)(n,e,t))}function kn(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ve(r,o).value[t]}}function Cr(e,t){var n;return(typeof t=="number"?De:t instanceof oo?no:(n=oo(t))?(t=n,no):va)(e,t)}function Ml(e){return function(){this.removeAttribute(e)}}function Il(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Al(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Pl(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Tl(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Dl(e,t){var n=Vt(e),o=n==="transform"?fl:Cr;return this.attrTween(e,typeof t=="function"?(n.local?Tl:Pl)(n,o,kn(this,"attr."+e,t)):t==null?(n.local?Il:Ml)(n):(n.local?Al:kl)(n,o,t))}function $l(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ll(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&zl(e,i)),n}return r._value=t,r}function Hl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&$l(e,i)),n}return r._value=t,r}function Rl(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?Ll:Hl)(o,t))}function jl(e,t){return function(){In(this,e).delay=+t.apply(this,arguments)}}function Ol(e,t){return t=+t,function(){In(this,e).delay=t}}function Vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jl:Ol)(t,e)):ve(this.node(),t).delay}function Bl(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function Fl(e,t){return t=+t,function(){be(this,e).duration=t}}function Xl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Bl:Fl)(t,e)):ve(this.node(),t).duration}function Yl(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function Zl(e){var t=this._id;return arguments.length?this.each(Yl(t,e)):ve(this.node(),t).ease}function Wl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function Gl(e){if(typeof e!="function")throw new Error;return this.each(Wl(this._id,e))}function ql(e){typeof e!="function"&&(e=ir(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Ce(o,this._parents,this._name,this._id)}function Kl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new Ce(s,this._parents,this._name,this._id)}function Ul(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,i=Ul(t)?In:be;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Jl(e,t){var n=this._id;return arguments.length<2?ve(this.node(),n).on.on(e):this.each(Ql(n,e,t))}function eu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function tu(){return this.on("end.remove",eu(this._id))}function nu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Cn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,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,Ft(c[d],t,n,d,c,ve(u,n)));return new Ce(i,this._parents,t,n)}function ou(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),h,g=ve(u,n),v=0,_=d.length;v<_;++v)(h=d[v])&&Ft(h,t,n,v,d,g);i.push(d),s.push(u)}return new Ce(i,s,t,n)}var ru=dt.prototype.constructor;function su(){return new ru(this._groups,this._parents)}function iu(e,t){var n,o,r;return function(){var i=Xe(this,e),s=(this.style.removeProperty(e),Xe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Nr(e){return function(){this.style.removeProperty(e)}}function au(e,t,n){var o,r=n+"",i;return function(){var s=Xe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function cu(e,t,n){var o,r,i;return function(){var s=Xe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Xe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function lu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=be(this,e),c=l.on,u=l.value[i]==null?a||(a=Nr(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function uu(e,t,n){var o=(e+="")=="transform"?dl:Cr;return t==null?this.styleTween(e,iu(e,o)).on("end.style."+e,Nr(e)):typeof t=="function"?this.styleTween(e,cu(e,o,kn(this,"style."+e,t))).each(lu(this._id,e)):this.styleTween(e,au(e,o,t),n).on("end.style."+e,null)}function du(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function fu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&du(e,s,n)),o}return i._value=t,i}function hu(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,fu(e,t,n??""))}function gu(e){return function(){this.textContent=e}}function pu(e){return function(){var t=e(this);this.textContent=t??""}}function mu(e){return this.tween("text",typeof e=="function"?pu(kn(this,"text",e)):gu(e==null?"":e+""))}function yu(e){return function(t){this.textContent=e.call(this,t)}}function xu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&yu(r)),t}return o._value=e,o}function wu(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,xu(e))}function vu(){for(var e=this._name,t=this._id,n=Mr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=ve(l,t);Ft(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ce(o,this._parents,e,n)}function _u(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=be(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var bu=0;function Ce(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Mr(){return++bu}var Se=dt.prototype;Ce.prototype={constructor:Ce,select:nu,selectAll:ou,selectChild:Se.selectChild,selectChildren:Se.selectChildren,filter:ql,merge:Kl,selection:su,transition:vu,call:Se.call,nodes:Se.nodes,node:Se.node,size:Se.size,empty:Se.empty,each:Se.each,on:Jl,attr:Dl,attrTween:Rl,style:uu,styleTween:hu,text:mu,textTween:wu,remove:tu,tween:Nl,delay:Vl,duration:Xl,ease:Zl,easeVarying:Gl,end:_u,[Symbol.iterator]:Se[Symbol.iterator]};function Su(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eu={time:null,delay:0,duration:250,ease:Su};function Cu(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 Nu(e){var t,n;e instanceof Ce?(t=e._id,e=e._name):(t=Mr(),(n=Eu).time=Mn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Ft(l,e,t,c,s,n||Cu(l,t));return new Ce(o,this._parents,e,t)}dt.prototype.interrupt=Sl;dt.prototype.transition=Nu;const wt=e=>()=>e;function Mu(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 Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(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 Xt=new Ee(1,0,0);Ir.prototype=Ee.prototype;function Ir(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Je(e){e.preventDefault(),e.stopImmediatePropagation()}function Iu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ku(){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 ho(){return this.__zoom||Xt}function Au(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Pu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function kr(){var e=Iu,t=ku,n=Tu,o=Au,r=Pu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Ot("start","zoom","end"),u,f,d,h=500,g=150,v=0,_=10;function y(x){x.property("__zoom",ho).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",R).filter(r).on("touchstart.zoom",k).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(x,M,C,A){var I=x.selection?x.selection():x;I.property("__zoom",ho),x!==I?N(x,M,C,A):I.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(x,M,C,A){y.scaleTo(x,function(){var I=this.__zoom.k,T=typeof M=="function"?M.apply(this,arguments):M;return I*T},C,A)},y.scaleTo=function(x,M,C,A){y.transform(x,function(){var I=t.apply(this,arguments),T=this.__zoom,L=C==null?w(I):typeof C=="function"?C.apply(this,arguments):C,O=T.invert(L),j=typeof M=="function"?M.apply(this,arguments):M;return n(p(b(T,j),L,O),I,s)},C,A)},y.translateBy=function(x,M,C,A){y.transform(x,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),s)},null,A)},y.translateTo=function(x,M,C,A,I){y.transform(x,function(){var T=t.apply(this,arguments),L=this.__zoom,O=A==null?w(T):typeof A=="function"?A.apply(this,arguments):A;return n(Xt.translate(O[0],O[1]).scale(L.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof C=="function"?-C.apply(this,arguments):-C),T,s)},A,I)};function b(x,M){return M=Math.max(i[0],Math.min(i[1],M)),M===x.k?x:new Ee(M,x.x,x.y)}function p(x,M,C){var A=M[0]-C[0]*x.k,I=M[1]-C[1]*x.k;return A===x.x&&I===x.y?x:new Ee(x.k,A,I)}function w(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function N(x,M,C,A){x.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var I=this,T=arguments,L=S(I,T).event(A),O=t.apply(I,T),j=C==null?w(O):typeof C=="function"?C.apply(I,T):C,F=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),B=I.__zoom,G=typeof M=="function"?M.apply(I,T):M,U=l(B.invert(j).concat(F/B.k),G.invert(j).concat(F/G.k));return function(Z){if(Z===1)Z=G;else{var V=U(Z),X=F/V[2];Z=new Ee(X,j[0]-V[0]*X,j[1]-V[1]*X)}L.zoom(null,Z)}})}function S(x,M,C){return!C&&x.__zooming||new E(x,M)}function E(x,M){this.that=x,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,M),this.taps=0}E.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,M){return this.mouse&&x!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var M=fe(this.that).datum();c.call(x,this.that,new Mu(x,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:c}),M)}};function D(x,...M){if(!e.apply(this,arguments))return;var C=S(this,M).event(x),A=this.__zoom,I=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=ye(x);if(C.wheel)(C.mouse[0][0]!==T[0]||C.mouse[0][1]!==T[1])&&(C.mouse[1]=A.invert(C.mouse[0]=T)),clearTimeout(C.wheel);else{if(A.k===I)return;C.mouse=[T,A.invert(T)],kt(this),C.start()}Je(x),C.wheel=setTimeout(L,g),C.zoom("mouse",n(p(b(A,I),C.mouse[0],C.mouse[1]),C.extent,s));function L(){C.wheel=null,C.end()}}function P(x,...M){if(d||!e.apply(this,arguments))return;var C=x.currentTarget,A=S(this,M,!0).event(x),I=fe(x.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",F,!0),T=ye(x,C),L=x.clientX,O=x.clientY;mr(x.view),on(x),A.mouse=[T,this.__zoom.invert(T)],kt(this),A.start();function j(B){if(Je(B),!A.moved){var G=B.clientX-L,U=B.clientY-O;A.moved=G*G+U*U>v}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=ye(B,C),A.mouse[1]),A.extent,s))}function F(B){I.on("mousemove.zoom mouseup.zoom",null),yr(B.view,A.moved),Je(B),A.event(B).end()}}function R(x,...M){if(e.apply(this,arguments)){var C=this.__zoom,A=ye(x.changedTouches?x.changedTouches[0]:x,this),I=C.invert(A),T=C.k*(x.shiftKey?.5:2),L=n(p(b(C,T),A,I),t.apply(this,M),s);Je(x),a>0?fe(this).transition().duration(a).call(N,L,A,x):fe(this).call(y.transform,L,A,x)}}function k(x,...M){if(e.apply(this,arguments)){var C=x.touches,A=C.length,I=S(this,M,x.changedTouches.length===A).event(x),T,L,O,j;for(on(x),L=0;L<A;++L)O=C[L],j=ye(O,this),j=[j,this.__zoom.invert(j),O.identifier],I.touch0?!I.touch1&&I.touch0[2]!==j[2]&&(I.touch1=j,I.taps=0):(I.touch0=j,T=!0,I.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(I.taps<2&&(f=j[0],u=setTimeout(function(){u=null},h)),kt(this),I.start())}}function $(x,...M){if(this.__zooming){var C=S(this,M).event(x),A=x.changedTouches,I=A.length,T,L,O,j;for(Je(x),T=0;T<I;++T)L=A[T],O=ye(L,this),C.touch0&&C.touch0[2]===L.identifier?C.touch0[0]=O:C.touch1&&C.touch1[2]===L.identifier&&(C.touch1[0]=O);if(L=C.that.__zoom,C.touch1){var F=C.touch0[0],B=C.touch0[1],G=C.touch1[0],U=C.touch1[1],Z=(Z=G[0]-F[0])*Z+(Z=G[1]-F[1])*Z,V=(V=U[0]-B[0])*V+(V=U[1]-B[1])*V;L=b(L,Math.sqrt(Z/V)),O=[(F[0]+G[0])/2,(F[1]+G[1])/2],j=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(C.touch0)O=C.touch0[0],j=C.touch0[1];else return;C.zoom("touch",n(p(L,O,j),C.extent,s))}}function H(x,...M){if(this.__zooming){var C=S(this,M).event(x),A=x.changedTouches,I=A.length,T,L;for(on(x),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),T=0;T<I;++T)L=A[T],C.touch0&&C.touch0[2]===L.identifier?delete C.touch0:C.touch1&&C.touch1[2]===L.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(L=ye(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<_)){var O=fe(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return y.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:wt(+x),y):o},y.filter=function(x){return arguments.length?(e=typeof x=="function"?x:wt(!!x),y):e},y.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:wt(!!x),y):r},y.extent=function(x){return arguments.length?(t=typeof x=="function"?x:wt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),y):t},y.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],y):[i[0],i[1]]},y.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(x){return arguments.length?(n=x,y):n},y.duration=function(x){return arguments.length?(a=+x,y):a},y.interpolate=function(x){return arguments.length?(l=x,y):l},y.on=function(){var x=c.on.apply(c,arguments);return x===c?y:x},y.clickDistance=function(x){return arguments.length?(v=(x=+x)*x,y):Math.sqrt(v)},y.tapDistance=function(x){return arguments.length?(_=+x,y):_},y}const _e={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"],Pr={"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 Ze;(function(e){e.Strict="strict",e.Loose="loose"})(Ze||(Ze={}));var ze;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ze||(ze={}));var at;(function(e){e.Partial="partial",e.Full="full"})(at||(at={}));const Tr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ae;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ae||(Ae={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const go={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function Dr(e){return e===null?null:e?"valid":"invalid"}const $r=e=>"id"in e&&"source"in e&&"target"in e,Du=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),An=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ft=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},$u=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):An(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,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 Zt(n)},ht=(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,zt(r)),o=!0)}),o?Zt(n):{x:0,y:0,width:0,height:0}},Pn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...pt(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(s&&!f||d)continue;const h=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,v=ct(a,Ge(c)),_=(h??0)*(g??0),y=i&&v>0;(!c.internals.handleBounds||y||v>=_||c.dragging)&&l.push(c)}return l},zu=(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 Lu(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 Hu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Lu(e,s),l=ht(a),c=Tn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function zr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",_e.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[l,c],[l+h,c+g]])}else a&&qe(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=qe(f)?He(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",_e.error015()),{position:{x:d.x-l+(s.measured.width??0)*u[0],y:d.y-c+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Ru({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=zu(s,l);for(const d of l)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const We=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:We(e.x,t[0][0],t[1][0]-(n?.width??0)),y:We(e.y,t[0][1],t[1][1]-(n?.height??0))});function Lr(e,t,n){const{width:o,height:r}=Ne(n),{x:i,y:s}=n.internals.positionAbsolute;return He(e,[[i,s],[i+o,s+r]],t)}const po=(e,t,n)=>e<t?We(Math.abs(e-t),1,t)/t:e>n?-We(Math.abs(e-n),1,t)/t:0,Hr=(e,t,n=15,o=40)=>{const r=po(e.x,o,t.width-o)*n,i=po(e.y,o,t.height-o)*n;return[r,i]},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)}),yn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Zt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ge=(e,t=[0,0])=>{const{x:n,y:o}=An(e)?e.internals.positionAbsolute:ft(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{const{x:n,y:o}=An(e)?e.internals.positionAbsolute:ft(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)}},Rr=(e,t)=>Zt(Yt(yn(e),yn(t))),ct=(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)},mo=e=>xe(e.width)&&xe(e.height)&&xe(e.x)&&xe(e.y),xe=e=>!isNaN(e)&&isFinite(e),ju=(e,t)=>{},gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),pt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?gt(a,s):a},Lt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Oe(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 Ou(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Oe(e,n),r=Oe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Oe(e.top??e.y??0,n),r=Oe(e.bottom??e.y??0,n),i=Oe(e.left??e.x??0,t),s=Oe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vu(e,t,n,o,r,i){const{x:s,y:a}=Lt(e,[t,n,o]),{x:l,y:c}=Lt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Tn=(e,t,n,o,r,i)=>{const s=Ou(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=We(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,v=Vu(e,h,g,u,t,n),_={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:g-_.top+_.bottom,zoom:u}},lt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function qe(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function jr(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 i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Bu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Fu(e){return{...Pr,...e||{}}}function nt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=we(e),a=pt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?gt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Dn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Vr=e=>e?.getRootNode?.()||window?.document,Xu=["INPUT","SELECT","TEXTAREA"];function Br(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Xu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Fr=e=>"clientX"in e,we=(e,t)=>{const n=Fr(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)}},xo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Dn(s)}})};function Xr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function vt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-vt(t-o,i),n];case Y.Right:return[t+vt(o-t,i),n];case Y.Top:return[t,n-vt(n-r,i)];case Y.Bottom:return[t,n+vt(r-n,i)]}}function Yr({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=wo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=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,h,g]}function Zr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Yu({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function Zu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Yt(zt(e),zt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return ct(s,Zt(i))>0}const Wu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Gu=(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)),qu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Wu;let r;return $r(e)?r={...e}:r={...e,id:o(e)},Gu(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,i,s,a]=Zr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const vo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Ku=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},_o=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Uu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=vo[t],l=vo[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},f=Ku({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,_;const y={x:0,y:0},b={x:0,y:0},[,,p,w]=Zr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(v=r.x??c.x+(u.x-c.x)*s,_=r.y??(c.y+u.y)/2):(v=r.x??(c.x+u.x)/2,_=r.y??c.y+(u.y-c.y)*s);const S=[{x:v,y:c.y},{x:v,y:u.y}],E=[{x:c.x,y:_},{x:u.x,y:_}];a[d]===h?g=d==="x"?S:E:g=d==="x"?E:S}else{const S=[{x:c.x,y:u.y}],E=[{x:u.x,y:c.y}];if(d==="x"?g=a.x===h?E:S:g=a.y===h?S:E,t===o){const $=Math.abs(e[d]-n[d]);if($<=i){const H=Math.min(i-1,i-$);a[d]===h?y[d]=(c[d]>e[d]?-1:1)*H:b[d]=(u[d]>n[d]?-1:1)*H}}if(t!==o){const $=d==="x"?"y":"x",H=a[d]===l[$],x=c[$]>u[$],M=c[$]<u[$];(a[d]===1&&(!H&&x||H&&M)||a[d]!==1&&(!H&&M||H&&x))&&(g=d==="x"?S:E)}const D={x:c.x+y.x,y:c.y+y.y},P={x:u.x+b.x,y:u.y+b.y},R=Math.max(Math.abs(D.x-g[0].x),Math.abs(P.x-g[0].x)),k=Math.max(Math.abs(D.y-g[0].y),Math.abs(P.y-g[0].y));R>=k?(v=(D.x+P.x)/2,_=g[0].y):(v=g[0].x,_=(D.y+P.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...g,{x:u.x+b.x,y:u.y+b.y},n],v,_,p,w]}function Qu(e,t,n,o){const r=Math.min(_o(e,t)/2,_o(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function xn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,h,g,v]=Uu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((y,b,p)=>{let w="";return p>0&&p<f.length-1?w=Qu(f[p-1],b,f[p+1],s):w=`${p===0?"M":"L"}${b.x} ${b.y}`,y+=w,y},""),d,h,g,v]}function bo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ju(e){const{sourceNode:t,targetNode:n}=e;if(!bo(t)||!bo(n))return null;const o=t.internals.handleBounds||So(t.handles),r=n.internals.handleBounds||So(n.handles),i=Eo(o?.source??[],e.sourceHandle),s=Eo(e.connectionMode===Ze.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",_e.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=Re(t,i,a),u=Re(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function So(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 Re(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ne(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function Eo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function wn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function ed(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=wn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Gr=1e3,td=10,$n={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},nd={...$n,checkEquality:!0};function zn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function od(e,t,n){const o=zn($n,n);for(const r of e.values())if(r.parentId)Hn(r,e,t,o);else{const i=ft(r,o.nodeOrigin),s=qe(r.extent)?r.extent:o.nodeExtent,a=He(i,s,Ne(r));r.internals.positionAbsolute=a}}function rd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Ln(e){return e==="manual"}function vn(e,t,n,o={}){const r=zn(nd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Ln(r.zIndexMode)?Gr:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=ft(c,r.nodeOrigin),d=qe(c.extent)?c.extent:r.nodeExtent,h=He(f,d,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:h,handleBounds:rd(c,u),z:qr(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&&Hn(u,t,n,o,i)}return l}function sd(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 Hn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=zn($n,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}sd(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*td),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!Ln(l)?Gr:0,{x:d,y:h,z:g}=id(e,u,s,a,f,l),{positionAbsolute:v}=e.internals,_=d!==v.x||h!==v.y;(_||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:d,y:h}:v,z:g}})}function qr(e,t,n){const o=xe(e.zIndex)?e.zIndex:0;return Ln(n)?o:o+(e.selected?t:0)}function id(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ne(e),c=ft(e,n),u=qe(e.extent)?He(c,e.extent,l):c;let f=He({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Lr(f,l,t));const d=qr(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Rn(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??Ge(a),c=Rr(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),f=a.origin??o,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),_=(g-u.width)*f[0],y=(v-u.height)*f[1];(d>0||h>0||_||y)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+_,y:a.position.y-h+y}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-_:0),height:v+(h?f[1]*h-y:0)}})}),r}function ad(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const v=Dn(h.nodeElement),_=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(_||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=qe(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Lr(w,v,t.get(g.parentId)):p&&(w=He(w,p,v));const N={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:xo("source",h.nodeElement,b,f,g.id),target:xo("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,N),g.parentId&&Hn(N,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,_&&(c.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ge(N,r)}))}}if(d.length>0){const h=Rn(d,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function cd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Co(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Kr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Co("source",l,u,e,r,s),Co("target",l,c,e,i,a),t.set(o.id,o)}}function Ur(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ur(n,t):!1}function No(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 ld(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ur(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function rn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function ud({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=gt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function dd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,v=null;function _({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:N,nodeId:S,nodeClickDistance:E=0}){d=fe(w);function D({x:$,y:H}){const{nodeLookup:x,nodeExtent:M,snapGrid:C,snapToGrid:A,nodeOrigin:I,onNodeDrag:T,onSelectionDrag:L,onError:O,updateNodePositions:j}=t();i={x:$,y:H};let F=!1;const B=a.size>1,G=B&&M?yn(ht(a)):null,U=B&&A?ud({dragItems:a,snapGrid:C,x:$,y:H}):null;for(const[Z,V]of a){if(!x.has(Z))continue;let X={x:$-V.distance.x,y:H-V.distance.y};A&&(X=U?{x:Math.round(X.x+U.x),y:Math.round(X.y+U.y)}:gt(X,C));let Q=null;if(B&&M&&!V.extent&&G){const{positionAbsolute:q}=V.internals,ee=q.x-G.x+M[0][0],ne=q.x+V.measured.width-G.x2+M[1][0],te=q.y-G.y+M[0][1],se=q.y+V.measured.height-G.y2+M[1][1];Q=[[ee,te],[ne,se]]}const{position:K,positionAbsolute:W}=zr({nodeId:Z,nextPosition:X,nodeLookup:x,nodeExtent:Q||M,nodeOrigin:I,onError:O});F=F||V.position.x!==K.x||V.position.y!==K.y,V.position=K,V.internals.positionAbsolute=W}if(g=g||F,!!F&&(j(a,!0),v&&(o||T||!S&&L))){const[Z,V]=rn({nodeId:S,dragItems:a,nodeLookup:x});o?.(v,a,Z,V),T?.(v,Z,V),S||L?.(v,V)}}async function P(){if(!u)return;const{transform:$,panBy:H,autoPanSpeed:x,autoPanOnNodeDrag:M}=t();if(!M){l=!1,cancelAnimationFrame(s);return}const[C,A]=Hr(c,u,x);(C!==0||A!==0)&&(i.x=(i.x??0)-C/$[2],i.y=(i.y??0)-A/$[2],await H({x:C,y:A})&&D(i)),s=requestAnimationFrame(P)}function R($){const{nodeLookup:H,multiSelectionActive:x,nodesDraggable:M,transform:C,snapGrid:A,snapToGrid:I,selectNodesOnDrag:T,onNodeDragStart:L,onSelectionDragStart:O,unselectNodesAndEdges:j}=t();f=!0,(!T||!N)&&!x&&S&&(H.get(S)?.selected||j()),N&&T&&S&&e?.(S);const F=nt($.sourceEvent,{transform:C,snapGrid:A,snapToGrid:I,containerBounds:u});if(i=F,a=ld(H,M,F,S),a.size>0&&(n||L||!S&&O)){const[B,G]=rn({nodeId:S,dragItems:a,nodeLookup:H});n?.($.sourceEvent,a,B,G),L?.($.sourceEvent,B,G),S||O?.($.sourceEvent,G)}}const k=xr().clickDistance(E).on("start",$=>{const{domNode:H,nodeDragThreshold:x,transform:M,snapGrid:C,snapToGrid:A}=t();u=H?.getBoundingClientRect()||null,h=!1,g=!1,v=$.sourceEvent,x===0&&R($),i=nt($.sourceEvent,{transform:M,snapGrid:C,snapToGrid:A,containerBounds:u}),c=we($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:H,transform:x,snapGrid:M,snapToGrid:C,nodeDragThreshold:A,nodeLookup:I}=t(),T=nt($.sourceEvent,{transform:x,snapGrid:M,snapToGrid:C,containerBounds:u});if(v=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!I.has(S))&&(h=!0),!h){if(!l&&H&&f&&(l=!0,P()),!f){const L=we($.sourceEvent,u),O=L.x-c.x,j=L.y-c.y;Math.sqrt(O*O+j*j)>A&&R($)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&a&&f&&(c=we($.sourceEvent,u),D(T))}}).on("end",$=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:x,onNodeDragStop:M,onSelectionDragStop:C}=t();if(g&&(x(a,!1),g=!1),r||M||!S&&C){const[A,I]=rn({nodeId:S,dragItems:a,nodeLookup:H,dragging:!1});r?.($.sourceEvent,a,A,I),M?.($.sourceEvent,A,I),S||C?.($.sourceEvent,I)}}}).filter($=>{const H=$.target;return!$.button&&(!b||!No(H,`.${b}`,w))&&(!p||No(H,p,w))});d.call(k)}function y(){d?.on(".drag",null)}return{update:_,destroy:y}}function fd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())ct(r,Ge(i))>0&&o.push(i);return o}const hd=250;function gd(e,t,n,o){let r=[],i=1/0;const s=fd(e,n,t+hd);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:f}=Re(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...c,x:u,y:f}],i=d):d===i&&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 Qr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Re(s,l,l.position,!0)}:l}function Jr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function pd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const es=()=>!0;function md(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:_,isValidConnection:y=es,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:N,autoPanSpeed:S,dragThreshold:E=1,handleDomNode:D}){const P=Vr(e.target);let R=0,k;const{x:$,y:H}=we(e),x=Jr(i,D),M=a?.getBoundingClientRect();let C=!1;if(!M||!x)return;const A=Qr(r,x,o,l,t);if(!A)return;let I=we(e,M),T=!1,L=null,O=!1,j=null;function F(){if(!u||!M)return;const[K,W]=Hr(I,M,S);d({x:K,y:W}),R=requestAnimationFrame(F)}const B={...A,nodeId:r,type:x,position:A.position},G=l.get(r);let Z={inProgress:!0,isValid:null,from:Re(G,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:I,toHandle:null,toPosition:go[B.position],toNode:null,pointer:I};function V(){C=!0,p(Z),g?.(e,{nodeId:r,handleId:o,handleType:x})}E===0&&V();function X(K){if(!C){const{x:se,y:le}=we(K),ce=se-$,pe=le-H;if(!(ce*ce+pe*pe>E*E))return;V()}if(!N()||!B){Q(K);return}const W=w();I=we(K,M),k=gd(pt(I,W,!1,[1,1]),n,l,B),T||(F(),T=!0);const q=ts(K,{handle:k,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:P,lib:c,flowId:f,nodeLookup:l});j=q.handleDomNode,L=q.connection,O=pd(!!k,q.isValid);const ee=l.get(r),ne=ee?Re(ee,B,Y.Left,!0):Z.from,te={...Z,from:ne,isValid:O,to:q.toHandle&&O?Lt({x:q.toHandle.x,y:q.toHandle.y},W):I,toHandle:q.toHandle,toPosition:O&&q.toHandle?q.toHandle.position:go[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:I};p(te),Z=te}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(C){(k||j)&&L&&O&&v?.(L);const{inProgress:W,...q}=Z,ee={...q,toPosition:Z.toHandle?Z.toPosition:null};_?.(K,ee),i&&b?.(K,ee)}h(),cancelAnimationFrame(R),T=!1,O=!1,L=null,j=null,P.removeEventListener("mousemove",X),P.removeEventListener("mouseup",Q),P.removeEventListener("touchmove",X),P.removeEventListener("touchend",Q)}}P.addEventListener("mousemove",X),P.addEventListener("mouseup",Q),P.addEventListener("touchmove",X),P.addEventListener("touchend",Q)}function ts(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=es,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=we(e),v=s.elementFromPoint(h,g),_=v?.classList.contains(`${a}-flow__handle`)?v:d,y={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const b=Jr(void 0,_),p=_.getAttribute("data-nodeid"),w=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!p||!b)return y;const E={source:f?p:o,sourceHandle:f?w:r,target:f?o:p,targetHandle:f?r:w};y.connection=E;const P=N&&S&&(n===Ze.Strict?f&&b==="source"||!f&&b==="target":p!==o||w!==r);y.isValid=P&&c(E),y.toHandle=Qr(p,b,w,u,n,!0)}return y}const _n={onPointerDown:md,isValid:ts};function yd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=fe(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=p.sourceEvent.ctrlKey&<()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,E=w[2]*Math.pow(2,S*N);t.scaleTo(E)};let v=[0,0];const _=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[N[0]-v[0],N[1]-v[1]];v=N;const E=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),D={x:w[0]-S[0]*E,y:w[1]-S[1]*E},P=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},P,a)},b=kr().on("start",_).on("zoom",f?y:null).on("zoom.wheel",d?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ye}}const Wt=e=>({x:e.x,y:e.y,zoom:e.k}),sn=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),Ve=(e,t)=>e.target.closest(`.${t}`),ns=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),xd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,an=(e,t=0,n=xd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},os=e=>{const t=e.ctrlKey&<()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function wd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ve(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=ye(u),y=os(u),b=f*Math.pow(2,y);o.scaleTo(n,b,_,u);return}const d=u.deltaMode===1?20:1;let h=r===ze.Vertical?0:u.deltaX*d,g=r===ze.Horizontal?0:u.deltaY*d;!lt()&&u.shiftKey&&r!==ze.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=Wt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,v),e.panScrollTimeout=setTimeout(()=>{c?.(u,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,v))}}function vd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Ve(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function _d({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Wt(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 bd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&ns(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Wt(i.transform))}}function Sd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ns(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Wt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Ed({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ve(f,`${c}-flow__node`)||Ve(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||u&&!g||Ve(f,a)&&g||Ve(f,l)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&v}}function Cd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=kr().scaleExtent([t,n]).translateExtent(o),d=fe(e).call(f);b({x:r.x,y:r.y,zoom:We(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(os);function v(k,$){return d?new Promise(H=>{f?.interpolate($?.interpolate==="linear"?en:Nt).transform(an(d,$?.duration,$?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function _({noWheelClassName:k,noPanClassName:$,onPaneContextMenu:H,userSelectionActive:x,panOnScroll:M,panOnDrag:C,panOnScrollMode:A,panOnScrollSpeed:I,preventScrolling:T,zoomOnPinch:L,zoomOnScroll:O,zoomOnDoubleClick:j,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:U,paneClickDistance:Z,selectionOnDrag:V}){x&&!c.isZoomingOrPanning&&y();const X=M&&!F&&!x;f.clickDistance(V?1/0:!xe(Z)||Z<0?0:Z);const Q=X?wd({zoomPanValues:c,noWheelClassName:k,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:I,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):vd({noWheelClassName:k,preventScrolling:T,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!x){const W=_d({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});f.on("start",W);const q=bd({zoomPanValues:c,panOnDrag:C,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:G});f.on("zoom",q);const ee=Sd({zoomPanValues:c,panOnDrag:C,panOnScroll:M,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});f.on("end",ee)}const K=Ed({zoomActivationKeyPressed:F,panOnDrag:C,zoomOnScroll:O,panOnScroll:M,zoomOnDoubleClick:j,zoomOnPinch:L,userSelectionActive:x,noPanClassName:$,noWheelClassName:k,lib:B,connectionInProgress:U});f.filter(K),j?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function b(k,$,H){const x=sn(k),M=f?.constrain()(x,$,H);return M&&await v(M),new Promise(C=>C(M))}async function p(k,$){const H=sn(k);return await v(H,$),new Promise(x=>x(H))}function w(k){if(d){const $=sn(k),H=d.property("__zoom");(H.k!==k.zoom||H.x!==k.x||H.y!==k.y)&&f?.transform(d,$,null,{sync:!0})}}function N(){const k=d?Ir(d.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function S(k,$){return d?new Promise(H=>{f?.interpolate($?.interpolate==="linear"?en:Nt).scaleTo(an(d,$?.duration,$?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function E(k,$){return d?new Promise(H=>{f?.interpolate($?.interpolate==="linear"?en:Nt).scaleBy(an(d,$?.duration,$?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function D(k){f?.scaleExtent(k)}function P(k){f?.translateExtent(k)}function R(k){const $=!xe(k)||k<0?0:k;f?.clickDistance($)}return{update:_,destroy:y,setViewport:p,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:E,setScaleExtent:D,setTranslateExtent:P,syncViewport:w,setClickDistance:R}}var Ke;(function(e){e.Line="line",e.Handle="handle"})(Ke||(Ke={}));function Nd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Mo(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 Ie(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function _t(e,t,n){return Math.max(0,t-e,e-n)}function Io(e,t){return e?!t:t}function Md(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:_,minHeight:y,maxHeight:b}=o,{x:p,y:w,width:N,height:S,aspectRatio:E}=e;let D=Math.floor(u?h-e.pointerX:0),P=Math.floor(f?g-e.pointerY:0);const R=N+(l?-D:D),k=S+(c?-P:P),$=-i[0]*N,H=-i[1]*S;let x=_t(R,v,_),M=_t(k,y,b);if(s){let I=0,T=0;l&&D<0?I=Ie(p+D+$,s[0][0]):!l&&D>0&&(I=ke(p+R+$,s[1][0])),c&&P<0?T=Ie(w+P+H,s[0][1]):!c&&P>0&&(T=ke(w+k+H,s[1][1])),x=Math.max(x,I),M=Math.max(M,T)}if(a){let I=0,T=0;l&&D>0?I=ke(p+D,a[0][0]):!l&&D<0&&(I=Ie(p+R,a[1][0])),c&&P>0?T=ke(w+P,a[0][1]):!c&&P<0&&(T=Ie(w+k,a[1][1])),x=Math.max(x,I),M=Math.max(M,T)}if(r){if(u){const I=_t(R/E,y,b)*E;if(x=Math.max(x,I),s){let T=0;!l&&!c||l&&!c&&d?T=ke(w+H+R/E,s[1][1])*E:T=Ie(w+H+(l?D:-D)/E,s[0][1])*E,x=Math.max(x,T)}if(a){let T=0;!l&&!c||l&&!c&&d?T=Ie(w+R/E,a[1][1])*E:T=ke(w+(l?D:-D)/E,a[0][1])*E,x=Math.max(x,T)}}if(f){const I=_t(k*E,v,_)/E;if(M=Math.max(M,I),s){let T=0;!l&&!c||c&&!l&&d?T=ke(p+k*E+$,s[1][0])/E:T=Ie(p+(c?P:-P)*E+$,s[0][0])/E,M=Math.max(M,T)}if(a){let T=0;!l&&!c||c&&!l&&d?T=Ie(p+k*E,a[1][0])/E:T=ke(p+(c?P:-P)*E,a[0][0])/E,M=Math.max(M,T)}}}P=P+(P<0?M:-M),D=D+(D<0?x:-x),r&&(d?R>k*E?P=(Io(l,c)?-D:D)/E:D=(Io(l,c)?-P:P)*E:u?(P=D/E,c=l):(D=P*E,l=c));const C=l?p+D:p,A=c?w+P:w;return{width:N+(l?-D:D),height:S+(c?-P:P),x:i[0]*D*(l?-1:1)+C,y:i[1]*P*(c?-1:1)+A}}const rs={width:0,height:0,x:0,y:0},Id={...rs,pointerX:0,pointerY:0,aspectRatio:1};function kd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Ad(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Pd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=fe(e);let s={controlDirection:Mo("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:h,onResize:g,onResizeEnd:v,shouldResize:_}){let y={...rs},b={...Id};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Mo(c)};let p,w=null,N=[],S,E,D,P=!1;const R=xr().on("start",k=>{const{nodeLookup:$,transform:H,snapGrid:x,snapToGrid:M,nodeOrigin:C,paneDomNode:A}=n();if(p=$.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:I,ySnapped:T}=nt(k.sourceEvent,{transform:H,snapGrid:x,snapToGrid:M,containerBounds:w});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...y,pointerX:I,pointerY:T,aspectRatio:y.width/y.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=$.get(p.parentId),E=S&&p.extent==="parent"?kd(S):void 0),N=[],D=void 0;for(const[L,O]of $)if(O.parentId===t&&(N.push({id:L,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const j=Ad(O,p,O.origin??C);D?D=[[Math.min(j[0][0],D[0][0]),Math.min(j[0][1],D[0][1])],[Math.max(j[1][0],D[1][0]),Math.max(j[1][1],D[1][1])]]:D=j}h?.(k,{...y})}).on("drag",k=>{const{transform:$,snapGrid:H,snapToGrid:x,nodeOrigin:M}=n(),C=nt(k.sourceEvent,{transform:$,snapGrid:H,snapToGrid:x,containerBounds:w}),A=[];if(!p)return;const{x:I,y:T,width:L,height:O}=y,j={},F=p.origin??M,{width:B,height:G,x:U,y:Z}=Md(b,s.controlDirection,C,s.boundaries,s.keepAspectRatio,F,E,D),V=B!==L,X=G!==O,Q=U!==I&&V,K=Z!==T&&X;if(!Q&&!K&&!V&&!X)return;if((Q||K||F[0]===1||F[1]===1)&&(j.x=Q?U:y.x,j.y=K?Z:y.y,y.x=j.x,y.y=j.y,N.length>0)){const ne=U-I,te=Z-T;for(const se of N)se.position={x:se.position.x-ne+F[0]*(B-L),y:se.position.y-te+F[1]*(G-O)},A.push(se)}if((V||X)&&(j.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:y.width,j.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?G:y.height,y.width=j.width,y.height=j.height),S&&p.expandParent){const ne=F[0]*(j.width??0);j.x&&j.x<ne&&(y.x=ne,b.x=b.x-(j.x-ne));const te=F[1]*(j.height??0);j.y&&j.y<te&&(y.y=te,b.y=b.y-(j.y-te))}const W=Nd({width:y.width,prevWidth:L,height:y.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...y,direction:W};_?.(k,q)!==!1&&(P=!0,g?.(k,q),o(j,A))}).on("end",k=>{P&&(v?.(k,{...y}),r?.({...y}),P=!1)});i.call(R)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const Td={},ko=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Td?"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},Dd=e=>e?ko(e):ko,{useDebugValue:$d}=Yi,{useSyncExternalStoreWithSelector:zd}=Xi,Ld=e=>e;function ss(e,t=Ld,n){const o=zd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return $d(o),o}const Ao=(e,t)=>{const n=Dd(e),o=(r,i=t)=>ss(n,r,i);return Object.assign(o,n),o},Hd=(e,t)=>e?Ao(e,t):Ao;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Gt=z.createContext(null),Rd=Gt.Provider,is=_e.error001();function J(e,t){const n=z.useContext(Gt);if(n===null)throw new Error(is);return ss(n,e,t)}function re(){const e=z.useContext(Gt);if(e===null)throw new Error(is);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Po={display:"none"},jd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},as="react-flow__node-desc",cs="react-flow__edge-desc",Od="react-flow__aria-live",Vd=e=>e.ariaLiveMessage,Bd=e=>e.ariaLabelConfig;function Fd({rfId:e}){const t=J(Vd);return m.jsx("div",{id:`${Od}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:jd,children:t})}function Xd({rfId:e,disableKeyboardA11y:t}){const n=J(Bd);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${as}-${e}`,style:Po,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${cs}-${e}`,style:Po,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(Fd,{rfId:e})]})}const qt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return m.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});qt.displayName="Panel";function Yd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:m.jsx(qt,{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:m.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zd=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}},bt=e=>e.id;function Wd(e,t){return oe(e.selectedNodes.map(bt),t.selectedNodes.map(bt))&&oe(e.selectedEdges.map(bt),t.selectedEdges.map(bt))}function Gd({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Zd,Wd);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const qd=e=>!!e.onSelectionChangeHandlers;function Kd({onSelectionChange:e}){const t=J(qd);return e||t?m.jsx(Gd,{onSelectionChange:e}):null}const ls=[0,0],Ud={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"],To=[...Qd,"rfId"],Jd=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}),Do={translateExtent:it,nodeOrigin:ls,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ef(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(Jd,oe),c=re();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Do,a()}),[]);const u=z.useRef(Do);return z.useEffect(()=>{for(const f of To){const d=e[f],h=u.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:Fu(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},To.map(f=>e[f])),null}function $o(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function tf(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=$o(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:$o()?.matches?"dark":"light"}const zo=typeof document<"u"?document:null;function ut(e=null,t={target:zo,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),i=z.useRef(new Set([])),[s,a]=z.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
2
|
-
`).replace(`
|
|
3
|
-
|
|
4
|
-
`,`
|
|
5
|
-
+`).split(`
|
|
6
|
-
`)),u=c.reduce((f,d)=>f.concat(...d),[]);return[c,u]}return[[],[]]},[e]);return z.useEffect(()=>{const l=t?.target??zo,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!c)&&Br(h))return!1;const v=Ho(h.code,a);if(i.current.add(h[v]),Lo(s,i.current,!1)){const _=h.composedPath?.()?.[0]||h.target,y=_?.nodeName==="BUTTON"||_?.nodeName==="A";t.preventDefault!==!1&&(r.current||!y)&&h.preventDefault(),o(!0)}},f=h=>{const g=Ho(h.code,a);Lo(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),r.current=!1},d=()=>{i.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 Lo(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function Ho(e,t){return t.includes(e)?"code":"key"}const nf=()=>{const e=re();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,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},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:i,maxZoom:s,panZoom:a}=e.getState(),l=Tn(t,o,r,i,s,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:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,f=n.snapToGrid??i;return pt(c,o,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Lt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function us(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)of(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function of(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 rf(e,t){return us(e,t)}function sf(e,t){return us(e,t)}function $e(e,t){return{id:e,type:"select",selected:t}}function Be(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push($e(i.id,s)))}return o}function Ro({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function jo(e){return{id:e.id,type:"remove"}}const Oo=e=>Du(e),af=e=>$r(e);function ds(e){return z.forwardRef(e)}const cf=typeof window<"u"?z.useLayoutEffect:z.useEffect;function Vo(e){const[t,n]=z.useState(BigInt(0)),[o]=z.useState(()=>lf(()=>n(r=>r+BigInt(1))));return cf(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function lf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const fs=z.createContext(null);function uf({children:e}){const t=re(),n=z.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let v=l;for(const y of a)v=typeof y=="function"?y(v):y;let _=Ro({items:v,lookup:d});for(const y of g.values())_=y(_);u&&c(v),_.length>0?f?.(_):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:b,setNodes:p}=t.getState();y&&p(b)})},[]),o=Vo(n),r=z.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:d}=t.getState();let h=l;for(const g of a)h=typeof g=="function"?g(h):g;u?c(h):f&&f(Ro({items:h,lookup:d}))},[]),i=Vo(r),s=z.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return m.jsx(fs.Provider,{value:s,children:e})}function df(){const e=z.useContext(fs);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const ff=e=>!!e.panZoom;function jn(){const e=nf(),t=re(),n=df(),o=J(ff),r=z.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),s=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},l=f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=Oo(f)?f:d.get(f.id),v=g.parentId?Or(g.position,g.measured,g.parentId,d,h):g.position,_={...g,position:v,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return Ge(_)},c=(f,d,h={replace:!1})=>{s(g=>g.map(v=>{if(v.id===f){const _=typeof d=="function"?d(v):d;return h.replace&&Oo(_)?_:{...v,..._}}return v}))},u=(f,d,h={replace:!1})=>{a(g=>g.map(v=>{if(v.id===f){const _=typeof d=="function"?d(v):d;return h.replace&&af(_)?_:{...v,..._}}return v}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>i(f)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:s,setEdges:a,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[g,v,_]=h;return{nodes:f.map(y=>({...y})),edges:d.map(y=>({...y})),viewport:{x:g,y:v,zoom:_}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:v,onEdgesDelete:_,triggerNodeChanges:y,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:w}=t.getState(),{nodes:N,edges:S}=await Ru({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:w}),E=S.length>0,D=N.length>0;if(E){const P=S.map(jo);_?.(S),b(P)}if(D){const P=N.map(jo);v?.(N),y(P)}return(D||E)&&p?.({nodes:N,edges:S}),{deletedNodes:N,deletedEdges:S}},getIntersectingNodes:(f,d=!0,h)=>{const g=mo(f),v=g?f:l(f),_=h!==void 0;return v?(h||t.getState().nodes).filter(y=>{const b=t.getState().nodeLookup.get(y.id);if(b&&!g&&(y.id===f.id||!b.internals.positionAbsolute))return!1;const p=Ge(_?y:b),w=ct(p,v);return d&&w>0||w>=p.width*p.height||w>=v.width*v.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const v=mo(f)?f:l(f);if(!v)return!1;const _=ct(v,d);return h&&_>0||_>=d.width*d.height||_>=v.width*v.height},updateNode:c,updateNodeData:(f,d,h={replace:!1})=>{c(f,g=>{const v=typeof d=="function"?d(g):d;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},updateEdge:u,updateEdgeData:(f,d,h={replace:!1})=>{u(f,g=>{const v=typeof d=="function"?d(g):d;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return $u(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const d=t.getState().fitViewResolver??Bu();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return z.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Bo=e=>e.selected,hf=typeof window<"u"?window:void 0;function gf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=jn(),r=ut(e,{actInsideInputWithModifier:!1}),i=ut(t,{target:hf});z.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(Bo),edges:s.filter(Bo)}),n.setState({nodesSelectionActive:!1})}},[r]),z.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function pf(e){const t=re();z.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Dn(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",_e.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 Kt={position:"absolute",width:"100%",height:"100%",top:0,left:0},mf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function yf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=ze.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:g,noWheelClassName:v,noPanClassName:_,onViewportChange:y,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:w}){const N=re(),S=z.useRef(null),{userSelectionActive:E,lib:D,connectionInProgress:P}=J(mf,oe),R=ut(d),k=z.useRef();pf(S);const $=z.useCallback(H=>{y?.({x:H[0],y:H[1],zoom:H[2]}),b||N.setState({transform:H})},[y,b]);return z.useEffect(()=>{if(S.current){k.current=Cd({domNode:S.current,minZoom:u,maxZoom:f,translateExtent:c,viewport:l,onDraggingChange:C=>N.setState({paneDragging:C}),onPanZoomStart:(C,A)=>{const{onViewportChangeStart:I,onMoveStart:T}=N.getState();T?.(C,A),I?.(A)},onPanZoom:(C,A)=>{const{onViewportChange:I,onMove:T}=N.getState();T?.(C,A),I?.(A)},onPanZoomEnd:(C,A)=>{const{onViewportChangeEnd:I,onMoveEnd:T}=N.getState();T?.(C,A),I?.(A)}});const{x:H,y:x,zoom:M}=k.current.getViewport();return N.setState({panZoom:k.current,transform:[H,x,M],domNode:S.current.closest(".react-flow")}),()=>{k.current?.destroy()}}},[]),z.useEffect(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:R,preventScrolling:h,noPanClassName:_,userSelectionActive:E,noWheelClassName:v,lib:D,onTransformChange:$,connectionInProgress:P,selectionOnDrag:w,paneClickDistance:p})},[e,t,n,o,r,i,s,a,R,h,_,E,v,D,$,P,w,p]),m.jsx("div",{className:"react-flow__renderer",ref:S,style:Kt,children:g})}const xf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function wf(){const{userSelectionActive:e,userSelectionRect:t}=J(xf,oe);return e&&t?m.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)},vf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function _f({isSelecting:e,selectionKeyPressed:t,selectionMode:n=at.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:g}){const v=re(),{userSelectionActive:_,elementsSelectable:y,dragging:b,connectionInProgress:p}=J(vf,oe),w=y&&(e||_),N=z.useRef(null),S=z.useRef(),E=z.useRef(new Set),D=z.useRef(new Set),P=z.useRef(!1),R=I=>{if(P.current||p){P.current=!1;return}l?.(I),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},k=I=>{if(Array.isArray(o)&&o?.includes(2)){I.preventDefault();return}c?.(I)},$=u?I=>u(I):void 0,H=I=>{P.current&&(I.stopPropagation(),P.current=!1)},x=I=>{const{domNode:T}=v.getState();if(S.current=T?.getBoundingClientRect(),!S.current)return;const L=I.target===N.current;if(!L&&!!I.target.closest(".nokey")||!e||!(i&&L||t)||I.button!==0||!I.isPrimary)return;I.target?.setPointerCapture?.(I.pointerId),P.current=!1;const{x:F,y:B}=we(I.nativeEvent,S.current);v.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),L||(I.stopPropagation(),I.preventDefault())},M=I=>{const{userSelectionRect:T,transform:L,nodeLookup:O,edgeLookup:j,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:G,defaultEdgeOptions:U,resetSelectedElements:Z}=v.getState();if(!S.current||!T)return;const{x:V,y:X}=we(I.nativeEvent,S.current),{startX:Q,startY:K}=T;if(!P.current){const te=t?0:r;if(Math.hypot(V-Q,X-K)<=te)return;Z(),s?.(I)}P.current=!0;const W={startX:Q,startY:K,x:V<Q?V:Q,y:X<K?X:K,width:Math.abs(V-Q),height:Math.abs(X-K)},q=E.current,ee=D.current;E.current=new Set(Pn(O,W,L,n===at.Partial,!0).map(te=>te.id)),D.current=new Set;const ne=U?.selectable??!0;for(const te of E.current){const se=F.get(te);if(se)for(const{edgeId:le}of se.values()){const ce=j.get(le);ce&&(ce.selectable??ne)&&D.current.add(le)}}if(!yo(q,E.current)){const te=Be(O,E.current,!0);B(te)}if(!yo(ee,D.current)){const te=Be(j,D.current);G(te)}v.setState({userSelectionRect:W,userSelectionActive:!0,nodesSelectionActive:!1})},C=I=>{I.button===0&&(I.target?.releasePointerCapture?.(I.pointerId),!_&&I.target===N.current&&v.getState().userSelectionRect&&R?.(I),v.setState({userSelectionActive:!1,userSelectionRect:null}),P.current&&(a?.(I),v.setState({nodesSelectionActive:E.current.size>0})))},A=o===!0||Array.isArray(o)&&o.includes(0);return m.jsxs("div",{className:ae(["react-flow__pane",{draggable:A,dragging:b,selection:e}]),onClick:w?void 0:cn(R,N),onContextMenu:cn(k,N),onWheel:cn($,N),onPointerEnter:w?void 0:f,onPointerMove:w?M:d,onPointerUp:w?C:void 0,onPointerDownCapture:w?x:void 0,onClickCapture:w?H:void 0,onPointerLeave:h,ref:N,style:Kt,children:[g,m.jsx(wf,{})]})}function bn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",_e.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function hs({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=re(),[l,c]=z.useState(!1),u=z.useRef();return z.useEffect(()=>{u.current=dd({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{bn({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:i,nodeId:r,nodeClickDistance:s}),()=>{u.current?.destroy()}},[n,o,t,i,e,r]),l}const bf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function gs(){const e=re();return z.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),f=new Map,d=bf(s),h=r?i[0]:5,g=r?i[1]:5,v=n.direction.x*h*n.factor,_=n.direction.y*g*n.factor;for(const[,y]of c){if(!d(y))continue;let b={x:y.internals.positionAbsolute.x+v,y:y.internals.positionAbsolute.y+_};r&&(b=gt(b,i));const{position:p,positionAbsolute:w}=zr({nodeId:y.id,nextPosition:b,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});y.position=p,y.internals.positionAbsolute=w,f.set(y.id,y)}l(f)},[])}const On=z.createContext(null),Sf=On.Provider;On.Consumer;const ps=()=>z.useContext(On),Ef=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Cf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,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:i===Ze.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Nf({type:e="source",position:t=Y.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:f,...d},h){const g=s||null,v=e==="target",_=re(),y=ps(),{connectOnClick:b,noPanClassName:p,rfId:w}=J(Ef,oe),{connectingFrom:N,connectingTo:S,clickConnecting:E,isPossibleEndHandle:D,connectionInProcess:P,clickConnectionInProcess:R,valid:k}=J(Cf(y,g,e),oe);y||_.getState().onError?.("010",_e.error010());const $=M=>{const{defaultEdgeOptions:C,onConnect:A,hasDefaultEdges:I}=_.getState(),T={...C,...M};if(I){const{edges:L,setEdges:O}=_.getState();O(qu(T,L))}A?.(T),a?.(T)},H=M=>{if(!y)return;const C=Fr(M.nativeEvent);if(r&&(C&&M.button===0||!C)){const A=_.getState();_n.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:v,handleId:g,nodeId:y,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:$,isValidConnection:n||A.isValidConnection,getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}C?u?.(M):f?.(M)},x=M=>{const{onClickConnectStart:C,onClickConnectEnd:A,connectionClickStartHandle:I,connectionMode:T,isValidConnection:L,lib:O,rfId:j,nodeLookup:F,connection:B}=_.getState();if(!y||!I&&!r)return;if(!I){C?.(M.nativeEvent,{nodeId:y,handleId:g,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const G=Vr(M.target),U=n||L,{connection:Z,isValid:V}=_n.isValid(M.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:T,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:U,flowId:j,doc:G,lib:O,nodeLookup:F});V&&Z&&$(Z);const X=structuredClone(B);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,A?.(M,X),_.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${g}-${e}`,className:ae(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,c,{source:!v,target:v,connectable:o,connectablestart:r,connectableend:i,clickconnecting:E,connectingfrom:N,connectingto:S,valid:k,connectionindicator:o&&(!P||D)&&(P||R?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:b?x:void 0,ref:h,...d,children:l})}const Te=z.memo(ds(Nf));function Mf({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return m.jsxs(m.Fragment,{children:[e?.label,m.jsx(Te,{type:"source",position:n,isConnectable:t})]})}function If({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:o=Y.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(Te,{type:"target",position:n,isConnectable:t}),e?.label,m.jsx(Te,{type:"source",position:o,isConnectable:t})]})}function kf(){return null}function Af({data:e,isConnectable:t,targetPosition:n=Y.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(Te,{type:"target",position:n,isConnectable:t}),e?.label]})}const Ht={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Fo={input:Mf,default:If,output:Af,group:kf};function Pf(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 Tf=e=>{const{width:t,height:n,x:o,y:r}=ht(e.nodeLookup,{filter:i=>!!i.selected});return{width:xe(t)?t:null,height:xe(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 Df({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=re(),{width:r,height:i,transformString:s,userSelectionActive:a}=J(Tf,oe),l=gs(),c=z.useRef(null);if(z.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),hs({nodeRef:c}),a||!r||!i)return null;const u=e?d=>{const h=o.getState().nodes.filter(g=>g.selected);e(d,h)}:void 0,f=d=>{Object.prototype.hasOwnProperty.call(Ht,d.key)&&(d.preventDefault(),l({direction:Ht[d.key],factor:d.shiftKey?4:1}))};return m.jsx("div",{className:ae(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:m.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:i}})})}const Xo=typeof window<"u"?window:void 0,$f=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ms({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:v,zoomActivationKeyCode:_,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:w,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:D,defaultViewport:P,translateExtent:R,minZoom:k,maxZoom:$,preventScrolling:H,onSelectionContextMenu:x,noWheelClassName:M,noPanClassName:C,disableKeyboardA11y:A,onViewportChange:I,isControlledViewport:T}){const{nodesSelectionActive:L,userSelectionActive:O}=J($f,oe),j=ut(c,{target:Xo}),F=ut(v,{target:Xo}),B=F||D,G=F||w,U=u&&B!==!0,Z=j||O||U;return gf({deleteKeyCode:l,multiSelectionKeyCode:g}),m.jsx(yf,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:G,panOnScrollSpeed:N,panOnScrollMode:S,zoomOnDoubleClick:E,panOnDrag:!j&&B,defaultViewport:P,translateExtent:R,minZoom:k,maxZoom:$,zoomActivationKeyCode:_,preventScrolling:H,noWheelClassName:M,noPanClassName:C,onViewportChange:I,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:U,children:m.jsxs(_f,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:B,isSelecting:!!Z,selectionMode:f,selectionKeyPressed:j,paneClickDistance:a,selectionOnDrag:U,children:[e,L&&m.jsx(Df,{onSelectionContextMenu:x,noPanClassName:C,disableKeyboardA11y:A})]})})}ms.displayName="FlowRenderer";const zf=z.memo(ms),Lf=e=>t=>e?Pn(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 Hf(e){return J(z.useCallback(Lf(e),[e]),oe)}const Rf=e=>e.updateNodeInternals;function jf(){const e=J(Rf),[t]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return z.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Of({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),i=z.useRef(null),s=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(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),z.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),z.useEffect(()=>{if(i.current){const f=c.current!==t,d=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(f||d||h)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Vf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:v,nodeTypes:_,nodeClickDistance:y,onError:b}){const{node:p,internals:w,isParent:N}=J(V=>{const X=V.nodeLookup.get(e),Q=V.parentLookup.has(e);return{node:X,internals:X.internals,isParent:Q}},oe);let S=p.type||"default",E=_?.[S]||Fo[S];E===void 0&&(b?.("003",_e.error003(S)),S="default",E=_?.default||Fo.default);const D=!!(p.draggable||a&&typeof p.draggable>"u"),P=!!(p.selectable||l&&typeof p.selectable>"u"),R=!!(p.connectable||c&&typeof p.connectable>"u"),k=!!(p.focusable||u&&typeof p.focusable>"u"),$=re(),H=jr(p),x=Of({node:p,nodeType:S,hasDimensions:H,resizeObserver:f}),M=hs({nodeRef:x,disabled:p.hidden||!D,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:P,nodeClickDistance:y}),C=gs();if(p.hidden)return null;const A=Ne(p),I=Pf(p),T=P||D||t||n||o||r,L=n?V=>n(V,{...w.userNode}):void 0,O=o?V=>o(V,{...w.userNode}):void 0,j=r?V=>r(V,{...w.userNode}):void 0,F=i?V=>i(V,{...w.userNode}):void 0,B=s?V=>s(V,{...w.userNode}):void 0,G=V=>{const{selectNodesOnDrag:X,nodeDragThreshold:Q}=$.getState();P&&(!X||!D||Q>0)&&bn({id:e,store:$,nodeRef:x}),t&&t(V,{...w.userNode})},U=V=>{if(!(Br(V.nativeEvent)||g)){if(Ar.includes(V.key)&&P){const X=V.key==="Escape";bn({id:e,store:$,unselect:X,nodeRef:x})}else if(D&&p.selected&&Object.prototype.hasOwnProperty.call(Ht,V.key)){V.preventDefault();const{ariaLabelConfig:X}=$.getState();$.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),C({direction:Ht[V.key],factor:V.shiftKey?4:1})}}},Z=()=>{if(g||!x.current?.matches(":focus-visible"))return;const{transform:V,width:X,height:Q,autoPanOnNodeFocus:K,setCenter:W}=$.getState();if(!K)return;Pn(new Map([[e,p]]),{x:0,y:0,width:X,height:Q},V,!0).length>0||W(p.position.x+A.width/2,p.position.y+A.height/2,{zoom:V[2]})};return m.jsx("div",{className:ae(["react-flow__node",`react-flow__node-${S}`,{[h]:D},p.className,{selected:p.selected,selectable:P,parent:N,draggable:D,dragging:M}]),ref:x,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:H?"visible":"hidden",...p.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:O,onMouseLeave:j,onContextMenu:F,onClick:G,onDoubleClick:B,onKeyDown:k?U:void 0,tabIndex:k?0:void 0,onFocus:k?Z:void 0,role:p.ariaRole??(k?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${as}-${v}`,"aria-label":p.ariaLabel,...p.domAttributes,children:m.jsx(Sf,{value:e,children:m.jsx(E,{id:e,data:p.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:p.selected??!1,selectable:P,draggable:D,deletable:p.deletable??!0,isConnectable:R,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:M,dragHandle:p.dragHandle,zIndex:w.z,parentId:p.parentId,...A})})})}var Bf=z.memo(Vf);const Ff=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ys(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(Ff,oe),s=Hf(e.onlyRenderVisibleElements),a=jf();return m.jsx("div",{className:"react-flow__nodes",style:Kt,children:s.map(l=>m.jsx(Bf,{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:i},l))})}ys.displayName="NodeRenderer";const Xf=z.memo(ys);function Yf(e){return J(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 i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&Zu({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const Zf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Wf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Yo={[$t.Arrow]:Zf,[$t.ArrowClosed]:Wf};function Gf(e){const t=re();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(Yo,e)?Yo[e]:(t.getState().onError?.("009",_e.error009(e)),null),[e])}const qf=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Gf(t);return l?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:m.jsx(l,{color:n,strokeWidth:s})}):null},xs=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=z.useMemo(()=>ed(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:r.map(i=>m.jsx(qf,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};xs.displayName="MarkerDefinitions";var Kf=z.memo(xs);function ws({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[f,d]=z.useState({x:1,y:0,width:0,height:0}),h=ae(["react-flow__edge-textwrapper",c]),g=z.useRef(null);return z.useEffect(()=>{if(g.current){const v=g.current.getBBox();d({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...u,children:[r&&m.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),m.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:o,children:n}),l]}):null}ws.displayName="EdgeText";const Uf=z.memo(ws);function Ut({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...u,d:e,fill:"none",className:ae(["react-flow__edge-path",u.className])}),c?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&xe(t)&&xe(n)?m.jsx(Uf,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Zo({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===Y.Left||e===Y.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function vs({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top}){const[s,a]=Zo({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Zo({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,f,d,h]=Xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,u,f,d,h]}function _s(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:_,interactionWidth:y})=>{const[b,p,w]=vs({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),N=e.isInternal?void 0:t;return m.jsx(Ut,{id:N,path:b,labelX:p,labelY:w,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:_,interactionWidth:y})})}const Qf=_s({isInternal:!1}),bs=_s({isInternal:!0});Qf.displayName="SimpleBezierEdge";bs.displayName="SimpleBezierEdgeInternal";function Ss(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,sourcePosition:h=Y.Bottom,targetPosition:g=Y.Top,markerEnd:v,markerStart:_,pathOptions:y,interactionWidth:b})=>{const[p,w,N]=xn({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:g,borderRadius:y?.borderRadius,offset:y?.offset,stepPosition:y?.stepPosition}),S=e.isInternal?void 0:t;return m.jsx(Ut,{id:S,path:p,labelX:w,labelY:N,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:v,markerStart:_,interactionWidth:b})})}const Es=Ss({isInternal:!1}),Cs=Ss({isInternal:!0});Es.displayName="SmoothStepEdge";Cs.displayName="SmoothStepEdgeInternal";function Ns(e){return z.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return m.jsx(Es,{...n,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Jf=Ns({isInternal:!1}),Ms=Ns({isInternal:!0});Jf.displayName="StepEdge";Ms.displayName="StepEdgeInternal";function Is(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:v})=>{const[_,y,b]=Wr({sourceX:n,sourceY:o,targetX:r,targetY:i}),p=e.isInternal?void 0:t;return m.jsx(Ut,{id:p,path:_,labelX:y,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:v})})}const eh=Is({isInternal:!1}),ks=Is({isInternal:!0});eh.displayName="StraightEdge";ks.displayName="StraightEdgeInternal";function As(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Y.Bottom,targetPosition:a=Y.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:_,pathOptions:y,interactionWidth:b})=>{const[p,w,N]=Yr({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:y?.curvature}),S=e.isInternal?void 0:t;return m.jsx(Ut,{id:S,path:p,labelX:w,labelY:N,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:_,interactionWidth:b})})}const th=As({isInternal:!1}),Ps=As({isInternal:!0});th.displayName="BezierEdge";Ps.displayName="BezierEdgeInternal";const Wo={default:Ps,straight:ks,step:Ms,smoothstep:Cs,simplebezier:bs},Go={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},nh=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,oh=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,qo="react-flow__edgeupdater";function Ko({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return m.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ae([qo,`${qo}-${a}`]),cx:nh(t,o,e),cy:oh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function rh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const g=re(),v=(w,N)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:E,isValidConnection:D,connectionMode:P,connectionRadius:R,lib:k,onConnectStart:$,onConnectEnd:H,cancelConnection:x,nodeLookup:M,rfId:C,panBy:A,updateConnection:I}=g.getState(),T=N.type==="target",L=(F,B)=>{d(!1),f?.(F,n,N.type,B)},O=F=>c?.(n,F),j=(F,B)=>{d(!0),u?.(w,n,N.type),$?.(F,B)};_n.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:P,connectionRadius:R,domNode:E,handleId:N.id,nodeId:N.nodeId,nodeLookup:M,isTarget:T,edgeUpdaterType:N.type,lib:k,flowId:C,cancelConnection:x,panBy:A,isValidConnection:D,onConnect:O,onConnectStart:j,onConnectEnd:H,onReconnectEnd:L,updateConnection:I,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},_=w=>v(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>v(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(Ko,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:_,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&m.jsx(Ko,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function sh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:v,noPanClassName:_,onError:y,disableKeyboardA11y:b}){let p=J(W=>W.edgeLookup.get(e));const w=J(W=>W.defaultEdgeOptions);p=w?{...w,...p}:p;let N=p.type||"default",S=v?.[N]||Wo[N];S===void 0&&(y?.("011",_e.error011(N)),N="default",S=v?.default||Wo.default);const E=!!(p.focusable||t&&typeof p.focusable>"u"),D=typeof f<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),P=!!(p.selectable||o&&typeof p.selectable>"u"),R=z.useRef(null),[k,$]=z.useState(!1),[H,x]=z.useState(!1),M=re(),{zIndex:C,sourceX:A,sourceY:I,targetX:T,targetY:L,sourcePosition:O,targetPosition:j}=J(z.useCallback(W=>{const q=W.nodeLookup.get(p.source),ee=W.nodeLookup.get(p.target);if(!q||!ee)return{zIndex:p.zIndex,...Go};const ne=Ju({id:e,sourceNode:q,targetNode:ee,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:W.connectionMode,onError:y});return{zIndex:Yu({selected:p.selected,zIndex:p.zIndex,sourceNode:q,targetNode:ee,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode}),...ne||Go}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),oe),F=z.useMemo(()=>p.markerStart?`url('#${wn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),B=z.useMemo(()=>p.markerEnd?`url('#${wn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||A===null||I===null||T===null||L===null)return null;const G=W=>{const{addSelectedEdges:q,unselectNodesAndEdges:ee,multiSelectionActive:ne}=M.getState();P&&(M.setState({nodesSelectionActive:!1}),p.selected&&ne?(ee({nodes:[],edges:[p]}),R.current?.blur()):q([e])),r&&r(W,p)},U=i?W=>{i(W,{...p})}:void 0,Z=s?W=>{s(W,{...p})}:void 0,V=a?W=>{a(W,{...p})}:void 0,X=l?W=>{l(W,{...p})}:void 0,Q=c?W=>{c(W,{...p})}:void 0,K=W=>{if(!b&&Ar.includes(W.key)&&P){const{unselectNodesAndEdges:q,addSelectedEdges:ee}=M.getState();W.key==="Escape"?(R.current?.blur(),q({edges:[p]})):ee([e])}};return m.jsx("svg",{style:{zIndex:C},children:m.jsxs("g",{className:ae(["react-flow__edge",`react-flow__edge-${N}`,p.className,_,{selected:p.selected,animated:p.animated,inactive:!P&&!r,updating:k,selectable:P}]),onClick:G,onDoubleClick:U,onContextMenu:Z,onMouseEnter:V,onMouseMove:X,onMouseLeave:Q,onKeyDown:E?K:void 0,tabIndex:E?0:void 0,role:p.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":E?`${cs}-${g}`:void 0,ref:R,...p.domAttributes,children:[!H&&m.jsx(S,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:P,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:A,sourceY:I,targetX:T,targetY:L,sourcePosition:O,targetPosition:j,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),D&&m.jsx(rh,{edge:p,isReconnectable:D,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:A,sourceY:I,targetX:T,targetY:L,sourcePosition:O,targetPosition:j,setUpdateHover:$,setReconnecting:x})]})})}var ih=z.memo(sh);const ah=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ts({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:v}){const{edgesFocusable:_,edgesReconnectable:y,elementsSelectable:b,onError:p}=J(ah,oe),w=Yf(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(Kf,{defaultColor:e,rfId:n}),w.map(N=>m.jsx(ih,{id:N,edgesFocusable:_,edgesReconnectable:y,elementsSelectable:b,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:o,disableKeyboardA11y:v},N))]})}Ts.displayName="EdgeRenderer";const ch=z.memo(Ts),lh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function uh({children:e}){const t=J(lh);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function dh(e){const t=jn(),n=z.useRef(!1);z.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const fh=e=>e.panZoom?.syncViewport;function hh(e){const t=J(fh),n=re();return z.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function gh(e){return e.connection.inProgress?{...e.connection,to:pt(e.connection.to,e.transform)}:{...e.connection}}function ph(e){return gh}function mh(e){const t=ph();return J(t,oe)}const yh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function xh({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=J(yh,oe);return!(i&&r&&l)?null:m.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:ae(["react-flow__connection",Dr(a)]),children:m.jsx(Ds,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Ds=({style:e,type:t=Ae.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:f,toPosition:d,pointer:h}=mh();if(!r)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:d,connectionStatus:Dr(o),toNode:u,toHandle:f,pointer:h});let g="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:d};switch(t){case Ae.Bezier:[g]=Yr(v);break;case Ae.SimpleBezier:[g]=vs(v);break;case Ae.Step:[g]=xn({...v,borderRadius:0});break;case Ae.SmoothStep:[g]=xn(v);break;default:[g]=Wr(v)}return m.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ds.displayName="ConnectionLine";const wh={};function Uo(e=wh){z.useRef(e),re(),z.useEffect(()=>{},[e])}function vh(){re(),z.useRef(!1),z.useEffect(()=>{},[])}function $s({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:v,connectionLineComponent:_,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:p,selectionMode:w,multiSelectionKeyCode:N,panActivationKeyCode:S,zoomActivationKeyCode:E,deleteKeyCode:D,onlyRenderVisibleElements:P,elementsSelectable:R,defaultViewport:k,translateExtent:$,minZoom:H,maxZoom:x,preventScrolling:M,defaultMarkerColor:C,zoomOnScroll:A,zoomOnPinch:I,panOnScroll:T,panOnScrollSpeed:L,panOnScrollMode:O,zoomOnDoubleClick:j,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:G,onPaneMouseMove:U,onPaneMouseLeave:Z,onPaneScroll:V,onPaneContextMenu:X,paneClickDistance:Q,nodeClickDistance:K,onEdgeContextMenu:W,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:se,onReconnectStart:le,onReconnectEnd:ce,noDragClassName:pe,noWheelClassName:ie,noPanClassName:de,disableKeyboardA11y:me,nodeExtent:Me,rfId:mt,viewport:je,onViewportChange:Ue}){return Uo(e),Uo(t),vh(),dh(n),hh(je),m.jsx(zf,{onPaneClick:B,onPaneMouseEnter:G,onPaneMouseMove:U,onPaneMouseLeave:Z,onPaneContextMenu:X,onPaneScroll:V,paneClickDistance:Q,deleteKeyCode:D,selectionKeyCode:b,selectionOnDrag:p,selectionMode:w,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:S,zoomActivationKeyCode:E,elementsSelectable:R,zoomOnScroll:A,zoomOnPinch:I,zoomOnDoubleClick:j,panOnScroll:T,panOnScrollSpeed:L,panOnScrollMode:O,panOnDrag:F,defaultViewport:k,translateExtent:$,minZoom:H,maxZoom:x,onSelectionContextMenu:f,preventScrolling:M,noDragClassName:pe,noWheelClassName:ie,noPanClassName:de,disableKeyboardA11y:me,onViewportChange:Ue,isControlledViewport:!!je,children:m.jsxs(uh,{children:[m.jsx(ch,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:se,onReconnectStart:le,onReconnectEnd:ce,onlyRenderVisibleElements:P,onEdgeContextMenu:W,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:C,noPanClassName:de,disableKeyboardA11y:me,rfId:mt}),m.jsx(xh,{style:v,type:g,component:_,containerStyle:y}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(Xf,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:K,onlyRenderVisibleElements:P,noPanClassName:de,noDragClassName:pe,disableKeyboardA11y:me,nodeExtent:Me,rfId:mt}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}$s.displayName="GraphView";const _h=z.memo($s),Qo=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,v=new Map,_=new Map,y=o??t??[],b=n??e??[],p=u??[0,0],w=f??it;Kr(v,_,y);const N=vn(b,h,g,{nodeOrigin:p,nodeExtent:w,zIndexMode:d});let S=[0,0,1];if(s&&r&&i){const E=ht(h,{filter:k=>!!((k.width||k.initialWidth)&&(k.height||k.initialHeight))}),{x:D,y:P,zoom:R}=Tn(E,r,i,l,c,a?.padding??.1);S=[D,P,R]}return{rfId:"1",width:r??0,height:i??0,transform:S,nodes:b,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:_,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:it,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ze.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Tr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ju,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Pr,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},bh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d})=>Hd((h,g)=>{async function v(){const{nodeLookup:_,panZoom:y,fitViewOptions:b,fitViewResolver:p,width:w,height:N,minZoom:S,maxZoom:E}=g();y&&(await Hu({nodes:_,width:w,height:N,panZoom:y,minZoom:S,maxZoom:E},b),p?.resolve(!0),h({fitViewResolver:null}))}return{...Qo({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:o,zIndexMode:d}),setNodes:_=>{const{nodeLookup:y,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:w,fitViewQueued:N,zIndexMode:S}=g(),E=vn(_,y,b,{nodeOrigin:p,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S});N&&E?(v(),h({nodes:_,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:_,nodesInitialized:E})},setEdges:_=>{const{connectionLookup:y,edgeLookup:b}=g();Kr(y,b,_),h({edges:_})},setDefaultNodesAndEdges:(_,y)=>{if(_){const{setNodes:b}=g();b(_),h({hasDefaultNodes:!0})}if(y){const{setEdges:b}=g();b(y),h({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:y,nodeLookup:b,parentLookup:p,domNode:w,nodeOrigin:N,nodeExtent:S,debug:E,fitViewQueued:D,zIndexMode:P}=g(),{changes:R,updatedInternals:k}=ad(_,b,p,w,N,S,P);k&&(od(b,p,{nodeOrigin:N,nodeExtent:S,zIndexMode:P}),D?(v(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),R?.length>0&&(E&&console.log("React Flow: trigger node changes",R),y?.(R)))},updateNodePositions:(_,y=!1)=>{const b=[];let p=[];const{nodeLookup:w,triggerNodeChanges:N,connection:S,updateConnection:E,onNodesChangeMiddlewareMap:D}=g();for(const[P,R]of _){const k=w.get(P),$=!!(k?.expandParent&&k?.parentId&&R?.position),H={id:P,type:"position",position:$?{x:Math.max(0,R.position.x),y:Math.max(0,R.position.y)}:R.position,dragging:y};if(k&&S.inProgress&&S.fromNode.id===k.id){const x=Re(k,S.fromHandle,Y.Left,!0);E({...S,from:x})}$&&k.parentId&&b.push({id:P,parentId:k.parentId,rect:{...R.internals.positionAbsolute,width:R.measured.width??0,height:R.measured.height??0}}),p.push(H)}if(b.length>0){const{parentLookup:P,nodeOrigin:R}=g(),k=Rn(b,w,P,R);p.push(...k)}for(const P of D.values())p=P(p);N(p)},triggerNodeChanges:_=>{const{onNodesChange:y,setNodes:b,nodes:p,hasDefaultNodes:w,debug:N}=g();if(_?.length){if(w){const S=rf(_,p);b(S)}N&&console.log("React Flow: trigger node changes",_),y?.(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:y,setEdges:b,edges:p,hasDefaultEdges:w,debug:N}=g();if(_?.length){if(w){const S=sf(_,p);b(S)}N&&console.log("React Flow: trigger edge changes",_),y?.(_)}},addSelectedNodes:_=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(y){const S=_.map(E=>$e(E,!0));w(S);return}w(Be(p,new Set([..._]),!0)),N(Be(b))},addSelectedEdges:_=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(y){const S=_.map(E=>$e(E,!0));N(S);return}N(Be(b,new Set([..._]))),w(Be(p,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:y}={})=>{const{edges:b,nodes:p,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:S}=g(),E=_||p,D=y||b,P=E.map(k=>{const $=w.get(k.id);return $&&($.selected=!1),$e(k.id,!1)}),R=D.map(k=>$e(k.id,!1));N(P),S(R)},setMinZoom:_=>{const{panZoom:y,maxZoom:b}=g();y?.setScaleExtent([_,b]),h({minZoom:_})},setMaxZoom:_=>{const{panZoom:y,minZoom:b}=g();y?.setScaleExtent([b,_]),h({maxZoom:_})},setTranslateExtent:_=>{g().panZoom?.setTranslateExtent(_),h({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:y,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:w}=g();if(!w)return;const N=y.reduce((E,D)=>D.selected?[...E,$e(D.id,!1)]:E,[]),S=_.reduce((E,D)=>D.selected?[...E,$e(D.id,!1)]:E,[]);b(N),p(S)},setNodeExtent:_=>{const{nodes:y,nodeLookup:b,parentLookup:p,nodeOrigin:w,elevateNodesOnSelect:N,nodeExtent:S,zIndexMode:E}=g();_[0][0]===S[0][0]&&_[0][1]===S[0][1]&&_[1][0]===S[1][0]&&_[1][1]===S[1][1]||(vn(y,b,p,{nodeOrigin:w,nodeExtent:_,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:E}),h({nodeExtent:_}))},panBy:_=>{const{transform:y,width:b,height:p,panZoom:w,translateExtent:N}=g();return cd({delta:_,panZoom:w,transform:y,translateExtent:N,width:b,height:p})},setCenter:async(_,y,b)=>{const{width:p,height:w,maxZoom:N,panZoom:S}=g();if(!S)return Promise.resolve(!1);const E=typeof b?.zoom<"u"?b.zoom:N;return await S.setViewport({x:p/2-_*E,y:w/2-y*E,zoom:E},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...Tr}})},updateConnection:_=>{h({connection:_})},reset:()=>h({...Qo()})}},Object.is);function Sh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d,children:h}){const[g]=z.useState(()=>bh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:f,zIndexMode:d}));return m.jsx(Rd,{value:g,children:m.jsx(uf,{children:h})})}function Eh({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return z.useContext(Gt)?m.jsx(m.Fragment,{children:e}):m.jsx(Sh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const Ch={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Nh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:_,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:S,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:P,onNodesDelete:R,onEdgesDelete:k,onDelete:$,onSelectionChange:H,onSelectionDragStart:x,onSelectionDrag:M,onSelectionDragStop:C,onSelectionContextMenu:A,onSelectionStart:I,onSelectionEnd:T,onBeforeDelete:L,connectionMode:O,connectionLineType:j=Ae.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:G,deleteKeyCode:U="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:V=!1,selectionMode:X=at.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:K=lt()?"Meta":"Control",zoomActivationKeyCode:W=lt()?"Meta":"Control",snapToGrid:q,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:ce,nodesFocusable:pe,nodeOrigin:ie=ls,edgesFocusable:de,edgesReconnectable:me,elementsSelectable:Me=!0,defaultViewport:mt=Ud,minZoom:je=.5,maxZoom:Ue=2,translateExtent:Bn=it,preventScrolling:Vs=!0,nodeExtent:Qt,defaultMarkerColor:Bs="#b1b1b7",zoomOnScroll:Fs=!0,zoomOnPinch:Xs=!0,panOnScroll:Ys=!1,panOnScrollSpeed:Zs=.5,panOnScrollMode:Ws=ze.Free,zoomOnDoubleClick:Gs=!0,panOnDrag:qs=!0,onPaneClick:Ks,onPaneMouseEnter:Us,onPaneMouseMove:Qs,onPaneMouseLeave:Js,onPaneScroll:ei,onPaneContextMenu:ti,paneClickDistance:ni=1,nodeClickDistance:oi=0,children:ri,onReconnect:si,onReconnectStart:ii,onReconnectEnd:ai,onEdgeContextMenu:ci,onEdgeDoubleClick:li,onEdgeMouseEnter:ui,onEdgeMouseMove:di,onEdgeMouseLeave:fi,reconnectRadius:hi=10,onNodesChange:gi,onEdgesChange:pi,noDragClassName:mi="nodrag",noWheelClassName:yi="nowheel",noPanClassName:Fn="nopan",fitView:Xn,fitViewOptions:Yn,connectOnClick:xi,attributionPosition:wi,proOptions:vi,defaultEdgeOptions:_i,elevateNodesOnSelect:bi=!0,elevateEdgesOnSelect:Si=!1,disableKeyboardA11y:Zn=!1,autoPanOnConnect:Ei,autoPanOnNodeDrag:Ci,autoPanSpeed:Ni,connectionRadius:Mi,isValidConnection:Ii,onError:ki,style:Ai,id:Wn,nodeDragThreshold:Pi,connectionDragThreshold:Ti,viewport:Di,onViewportChange:$i,width:zi,height:Li,colorMode:Hi="light",debug:Ri,onScroll:Gn,ariaLabelConfig:ji,zIndexMode:qn="basic",...Oi},Vi){const Jt=Wn||"1",Bi=tf(Hi),Fi=z.useCallback(Kn=>{Kn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Gn?.(Kn)},[Gn]);return m.jsx("div",{"data-testid":"rf__wrapper",...Oi,onScroll:Fi,style:{...Ai,...Ch},ref:Vi,className:ae(["react-flow",r,Bi]),id:Wn,role:"application",children:m.jsxs(Eh,{nodes:e,edges:t,width:zi,height:Li,fitView:Xn,fitViewOptions:Yn,minZoom:je,maxZoom:Ue,nodeOrigin:ie,nodeExtent:Qt,zIndexMode:qn,children:[m.jsx(_h,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:S,nodeTypes:i,edgeTypes:s,connectionLineType:j,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:G,selectionKeyCode:Z,selectionOnDrag:V,selectionMode:X,deleteKeyCode:U,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:W,onlyRenderVisibleElements:ne,defaultViewport:mt,translateExtent:Bn,minZoom:je,maxZoom:Ue,preventScrolling:Vs,zoomOnScroll:Fs,zoomOnPinch:Xs,zoomOnDoubleClick:Gs,panOnScroll:Ys,panOnScrollSpeed:Zs,panOnScrollMode:Ws,panOnDrag:qs,onPaneClick:Ks,onPaneMouseEnter:Us,onPaneMouseMove:Qs,onPaneMouseLeave:Js,onPaneScroll:ei,onPaneContextMenu:ti,paneClickDistance:ni,nodeClickDistance:oi,onSelectionContextMenu:A,onSelectionStart:I,onSelectionEnd:T,onReconnect:si,onReconnectStart:ii,onReconnectEnd:ai,onEdgeContextMenu:ci,onEdgeDoubleClick:li,onEdgeMouseEnter:ui,onEdgeMouseMove:di,onEdgeMouseLeave:fi,reconnectRadius:hi,defaultMarkerColor:Bs,noDragClassName:mi,noWheelClassName:yi,noPanClassName:Fn,rfId:Jt,disableKeyboardA11y:Zn,nodeExtent:Qt,viewport:Di,onViewportChange:$i}),m.jsx(ef,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:_,onClickConnectEnd:y,nodesDraggable:se,autoPanOnNodeFocus:le,nodesConnectable:ce,nodesFocusable:pe,edgesFocusable:de,edgesReconnectable:me,elementsSelectable:Me,elevateNodesOnSelect:bi,elevateEdgesOnSelect:Si,minZoom:je,maxZoom:Ue,nodeExtent:Qt,onNodesChange:gi,onEdgesChange:pi,snapToGrid:q,snapGrid:ee,connectionMode:O,translateExtent:Bn,connectOnClick:xi,defaultEdgeOptions:_i,fitView:Xn,fitViewOptions:Yn,onNodesDelete:R,onEdgesDelete:k,onDelete:$,onNodeDragStart:E,onNodeDrag:D,onNodeDragStop:P,onSelectionDrag:M,onSelectionDragStart:x,onSelectionDragStop:C,onMove:u,onMoveStart:f,onMoveEnd:d,noPanClassName:Fn,nodeOrigin:ie,rfId:Jt,autoPanOnConnect:Ei,autoPanOnNodeDrag:Ci,autoPanSpeed:Ni,onError:ki,connectionRadius:Mi,isValidConnection:Ii,selectNodesOnDrag:te,nodeDragThreshold:Pi,connectionDragThreshold:Ti,onBeforeDelete:L,debug:Ri,ariaLabelConfig:ji,zIndexMode:qn}),m.jsx(Kd,{onSelectionChange:H}),ri,m.jsx(Yd,{proOptions:vi,position:wi}),m.jsx(Xd,{rfId:Jt,disableKeyboardA11y:Zn})]})})}var Mh=ds(Nh);function Ih({dimensions:e,lineWidth:t,variant:n,className:o}){return m.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 kh({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:ae(["react-flow__background-pattern","dots",t])})}var Pe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Pe||(Pe={}));const Ah={[Pe.Dots]:1,[Pe.Lines]:1,[Pe.Cross]:6},Ph=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function zs({id:e,variant:t=Pe.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){const f=z.useRef(null),{transform:d,patternId:h}=J(Ph,oe),g=o||Ah[t],v=t===Pe.Dots,_=t===Pe.Cross,y=Array.isArray(n)?n:[n,n],b=[y[0]*d[2]||1,y[1]*d[2]||1],p=g*d[2],w=Array.isArray(i)?i:[i,i],N=_?[p,p]:b,S=[w[0]*d[2]||1+N[0]/2,w[1]*d[2]||1+N[1]/2],E=`${h}${e||""}`;return m.jsxs("svg",{className:ae(["react-flow__background",c]),style:{...l,...Kt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:f,"data-testid":"rf__background",children:[m.jsx("pattern",{id:E,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:v?m.jsx(kh,{radius:p/2,className:u}):m.jsx(Ih,{dimensions:N,lineWidth:r,variant:t,className:u})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}zs.displayName="Background";z.memo(zs);function Th(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Dh(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $h(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.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 zh(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 Lh(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 St({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:ae(["react-flow__controls-button",t]),...n,children:e})}const Hh=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Ls({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const g=re(),{isInteractive:v,minZoomReached:_,maxZoomReached:y,ariaLabelConfig:b}=J(Hh,oe),{zoomIn:p,zoomOut:w,fitView:N}=jn(),S=()=>{p(),i?.()},E=()=>{w(),s?.()},D=()=>{N(r),a?.()},P=()=>{g.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),l?.(!v)},R=d==="horizontal"?"horizontal":"vertical";return m.jsxs(qt,{className:ae(["react-flow__controls",R,c]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(St,{onClick:S,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:y,children:m.jsx(Th,{})}),m.jsx(St,{onClick:E,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:_,children:m.jsx(Dh,{})})]}),n&&m.jsx(St,{className:"react-flow__controls-fitview",onClick:D,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:m.jsx($h,{})}),o&&m.jsx(St,{className:"react-flow__controls-interactive",onClick:P,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:v?m.jsx(Lh,{}):m.jsx(zh,{})}),u]})}Ls.displayName="Controls";z.memo(Ls);function Rh({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:f,selected:d,onClick:h}){const{background:g,backgroundColor:v}=i||{},_=s||g||v;return m.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:_,stroke:a,strokeWidth:l},shapeRendering:f,onClick:h?y=>h(y,e):void 0})}const jh=z.memo(Rh),Oh=e=>e.nodes.map(t=>t.id),ln=e=>e instanceof Function?e:()=>e;function Vh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=jh,onClick:s}){const a=J(Oh,oe),l=ln(t),c=ln(e),u=ln(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:a.map(d=>m.jsx(Fh,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},d))})}function Bh({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:u,y:f,width:d,height:h}=J(g=>{const{internals:v}=g.nodeLookup.get(e),_=v.userNode,{x:y,y:b}=v.positionAbsolute,{width:p,height:w}=Ne(_);return{node:_,x:y,y:b,width:p,height:w}},oe);return!c||c.hidden||!jr(c)?null:m.jsx(a,{x:u,y:f,width:d,height:h,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const Fh=z.memo(Bh);var Xh=z.memo(Vh);const Yh=200,Zh=150,Wh=e=>!e.hidden,Gh=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?Rr(ht(e.nodeLookup,{filter:Wh}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},qh="react-flow__minimap-desc";function Hs({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:v=!1,zoomable:_=!1,ariaLabel:y,inversePan:b,zoomStep:p=1,offsetScale:w=5}){const N=re(),S=z.useRef(null),{boundingRect:E,viewBB:D,rfId:P,panZoom:R,translateExtent:k,flowWidth:$,flowHeight:H,ariaLabelConfig:x}=J(Gh,oe),M=e?.width??Yh,C=e?.height??Zh,A=E.width/M,I=E.height/C,T=Math.max(A,I),L=T*M,O=T*C,j=w*T,F=E.x-(L-E.width)/2-j,B=E.y-(O-E.height)/2-j,G=L+j*2,U=O+j*2,Z=`${qh}-${P}`,V=z.useRef(0),X=z.useRef();V.current=T,z.useEffect(()=>{if(S.current&&R)return X.current=yd({domNode:S.current,panZoom:R,getTransform:()=>N.getState().transform,getViewScale:()=>V.current}),()=>{X.current?.destroy()}},[R]),z.useEffect(()=>{X.current?.update({translateExtent:k,width:$,height:H,inversePan:b,pannable:v,zoomStep:p,zoomable:_})},[v,_,b,p,k,$,H]);const Q=h?q=>{const[ee,ne]=X.current?.pointer(q)||[0,0];h(q,{x:ee,y:ne})}:void 0,K=g?z.useCallback((q,ee)=>{const ne=N.getState().nodeLookup.get(ee).internals.userNode;g(q,ne)},[]):void 0,W=y??x["minimap.ariaLabel"];return m.jsx(qt,{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 s=="number"?s:void 0},className:ae(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:M,height:C,viewBox:`${F} ${B} ${G} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:S,onClick:Q,children:[W&&m.jsx("title",{id:Z,children:W}),m.jsx(Xh,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-j},${B-j}h${G+j*2}v${U+j*2}h${-G-j*2}z
|
|
7
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Hs.displayName="MiniMap";z.memo(Hs);const Kh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Uh={[Ke.Line]:"right",[Ke.Handle]:"bottom-right"};function Qh({nodeId:e,position:t,variant:n=Ke.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:v,onResize:_,onResizeEnd:y}){const b=ps(),p=typeof e=="string"?e:b,w=re(),N=z.useRef(null),S=n===Ke.Handle,E=J(z.useCallback(Kh(S&&h),[S,h]),oe),D=z.useRef(null),P=t??Uh[n];z.useEffect(()=>{if(!(!N.current||!p))return D.current||(D.current=Pd({domNode:N.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:k,transform:$,snapGrid:H,snapToGrid:x,nodeOrigin:M,domNode:C}=w.getState();return{nodeLookup:k,transform:$,snapGrid:H,snapToGrid:x,nodeOrigin:M,paneDomNode:C}},onChange:(k,$)=>{const{triggerNodeChanges:H,nodeLookup:x,parentLookup:M,nodeOrigin:C}=w.getState(),A=[],I={x:k.x,y:k.y},T=x.get(p);if(T&&T.expandParent&&T.parentId){const L=T.origin??C,O=k.width??T.measured.width??0,j=k.height??T.measured.height??0,F={id:T.id,parentId:T.parentId,rect:{width:O,height:j,...Or({x:k.x??T.position.x,y:k.y??T.position.y},{width:O,height:j},T.parentId,x,L)}},B=Rn([F],x,M,C);A.push(...B),I.x=k.x?Math.max(L[0]*O,k.x):void 0,I.y=k.y?Math.max(L[1]*j,k.y):void 0}if(I.x!==void 0&&I.y!==void 0){const L={id:p,type:"position",position:{...I}};A.push(L)}if(k.width!==void 0&&k.height!==void 0){const O={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:k.width,height:k.height}};A.push(O)}for(const L of $){const O={...L,type:"position"};A.push(O)}H(A)},onEnd:({width:k,height:$})=>{const H={id:p,type:"dimensions",resizing:!1,dimensions:{width:k,height:$}};w.getState().triggerNodeChanges([H])}})),D.current.update({controlPosition:P,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:f,resizeDirection:d,onResizeStart:v,onResize:_,onResizeEnd:y,shouldResize:g}),()=>{D.current?.destroy()}},[P,a,l,c,u,f,v,_,y,g]);const R=P.split("-");return m.jsx("div",{className:ae(["react-flow__resize-control","nodrag",...R,n,o]),ref:N,style:{...r,scale:E,...s&&{[S?"backgroundColor":"borderColor"]:s}},children:i})}z.memo(Qh);const Rs=z.createContext(void 0);function js(){const e=z.useContext(Rs);if(!e)throw new Error("useMetricsMode must be used within MetricsModeProvider");return e}function Jh(e){const t=ge.c(5),{children:n}=e,[o,r]=z.useState("requests");let i;t[0]!==o?(i={metricsMode:o,setMetricsMode:r},t[0]=o,t[1]=i):i=t[1];let s;return t[2]!==n||t[3]!==i?(s=m.jsx(Rs.Provider,{value:i,children:n}),t[2]=n,t[3]=i,t[4]=s):s=t[4],s}const Jo=10,Rt=56,Vn=220,ot=56,eg={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 tg(){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 ng(e){const t=new Map,n=new Map;for(const i of e){const s=i.connectionId;if(s){const l=n.get(s)??{requests:0,errors:0,totalLatency:0};n.set(s,{requests:l.requests+1,errors:l.errors+(i.isError?1:0),totalLatency:l.totalLatency+i.durationMs})}const a=i.gatewayId;if(a){const l=t.get(a)??{requests:0,errors:0,totalLatency:0};t.set(a,{requests:l.requests+1,errors:l.errors+(i.isError?1:0),totalLatency:l.totalLatency+i.durationMs})}}const o=new Map;for(const[i,s]of t)o.set(i,{requests:s.requests,errors:s.errors,errorRate:s.requests>0?s.errors/s.requests*100:0,avgLatencyMs:s.requests>0?s.totalLatency/s.requests:0});const r=new Map;for(const[i,s]of n)r.set(i,{requests:s.requests,errors:s.errors,errorRate:s.requests>0?s.errors/s.requests*100:0,avgLatencyMs:s.requests>0?s.totalLatency/s.requests:0});return{gateways:o,connections:r}}function Os(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 Et(e,t){if(!e)return 0;switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function og(){const e=ge.c(9),{locator:t}=Sn();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=aa(),e[0]=n):n=e[0];const o=n;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=tg(),e[1]=r):r=e[1];const i=r;let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={...i,limit:1e3,offset:0},e[2]=s):s=e[2];let a;e[3]!==t?(a={toolCaller:o,toolName:"MONITORING_LOGS_LIST",toolInputParams:s,scope:t,staleTime:3e4},e[3]=t,e[4]=a):a=e[4];const{data:l}=wa(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=ng(u),e[7]=u,e[8]=f):f=e[8],f}function rg(e){const t=ge.c(29),{data:n}=e,o=jt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Os(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const i=r;let s;t[3]!==n.gateway.id||t[4]!==n.org||t[5]!==o?(s=()=>{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]=s):s=t[6];const a=s;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Rt,width:Vn},t[7]=l):l=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=m.jsx(xa,{}),t[8]=c):c=t[8];let u;t[9]!==n.gateway.icon||t[10]!==n.gateway.title?(u=m.jsx(tr,{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=m.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=nr("text-base leading-none font-semibold tabular-nums",n.colorScheme.textClass),t[14]=n.colorScheme.textClass,t[15]=d):d=t[15];let h;t[16]!==i||t[17]!==d?(h=m.jsx("span",{className:d,children:i}),t[16]=i,t[17]=d,t[18]=h):h=t[18];let g;t[19]!==f||t[20]!==h?(g=m.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[f,h]}),t[19]=f,t[20]=h,t[21]=g):g=t[21];let v;t[22]!==n.colorScheme.edgeColor?(v=m.jsx(Te,{type:"source",position:Y.Right,style:{width:"8px",height:"8px",background:n.colorScheme.edgeColor,border:"none"}}),t[22]=n.colorScheme.edgeColor,t[23]=v):v=t[23];let _;return t[24]!==a||t[25]!==v||t[26]!==u||t[27]!==g?(_=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,g,v]}),t[24]=a,t[25]=v,t[26]=u,t[27]=g,t[28]=_):_=t[28],_}function sg(e){const t=ge.c(29),{data:n}=e,o=jt();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=Os(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const i=r;let s;t[3]!==n.connection.id||t[4]!==n.org||t[5]!==o?(s=()=>{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]=s):s=t[6];const a=s;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Rt,width:Vn},t[7]=l):l=t[7];const c=`1px solid ${n.colorScheme.edgeColor}`;let u;t[8]!==c?(u=m.jsx(Te,{type:"target",position:Y.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=m.jsx(ca,{}),t[10]=f):f=t[10];let d;t[11]!==n.connection.icon||t[12]!==n.connection.title?(d=m.jsx(tr,{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 h;t[14]!==n.connection.title?(h=m.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.connection.title}),t[14]=n.connection.title,t[15]=h):h=t[15];let g;t[16]!==n.colorScheme.textClass?(g=nr("text-base leading-[1.35] font-semibold tabular-nums",n.colorScheme.textClass),t[16]=n.colorScheme.textClass,t[17]=g):g=t[17];let v;t[18]!==i||t[19]!==g?(v=m.jsx("span",{className:g,children:i}),t[18]=i,t[19]=g,t[20]=v):v=t[20];let _;t[21]!==v||t[22]!==h?(_=m.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[h,v]}),t[21]=v,t[22]=h,t[23]=_):_=t[23];let y;return t[24]!==a||t[25]!==_||t[26]!==u||t[27]!==d?(y=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,_]}),t[24]=a,t[25]=_,t[26]=u,t[27]=d,t[28]=y):y=t[28],y}function ig(e){const t=ge.c(9),{data:n}=e,o=jt();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 i=r;let s;t[3]===Symbol.for("react.memo_cache_sentinel")?(s={height:ot,width:ot},t[3]=s):s=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=m.jsx(Te,{type:"target",position:Y.Left,style:{opacity:0,pointerEvents:"none"}}),l=m.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=m.jsx(Te,{type:"source",position:Y.Right,style:{opacity:0,pointerEvents:"none"}}),t[6]=c):c=t[6];let u;return t[7]!==i?(u=m.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:s,onClick:i,children:[a,l,c]}),t[7]=i,t[8]=u):u=t[8],u}const ag={gateway:rg,server:sg,mesh:ig};function cg(){const e=ge.c(8),{metricsMode:t,setMetricsMode:n}=js();let o;e[0]!==n?(o=l=>l&&n(l),e[0]=n,e[1]=o):o=e[1];let r,i,s;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=m.jsx(tn,{value:"requests",className:"text-xs px-3 cursor-pointer",children:"Tool Calls"}),i=m.jsx(tn,{value:"errors",className:"text-xs px-3 cursor-pointer",children:"Errors"}),s=m.jsx(tn,{value:"latency",className:"text-xs px-3 cursor-pointer",children:"Latency"}),e[2]=r,e[3]=i,e[4]=s):(r=e[2],i=e[3],s=e[4]);let a;return e[5]!==t||e[6]!==o?(a=m.jsxs(_a,{type:"single",value:t,onValueChange:o,variant:"outline",size:"sm",className:"bg-background/80 backdrop-blur-sm",children:[r,i,s]}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function lg(){const e=ge.c(36),{metricsMode:t}=js(),{org:n}=Sn();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:Jo},e[0]=o):o=e[0];const r=ya(o);let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={pageSize:Jo},e[1]=i):i=e[1];const s=er(i),a=og();let l,c,u,f,d;if(e[2]!==t||e[3]!==a||e[4]!==s||e[5]!==r){let k;e[11]!==t||e[12]!==a?(k=(H,x)=>Et(a.gateways.get(x.id),t)-Et(a.gateways.get(H.id),t),e[11]=t,e[12]=a,e[13]=k):k=e[13],d=[...r].sort(k);let $;e[14]!==t||e[15]!==a?($=(H,x)=>Et(a.connections.get(x.id),t)-Et(a.connections.get(H.id),t),e[14]=t,e[15]=a,e[16]=$):$=e[16],f=[...s].sort($),l=eg[t],u=new Map,d.forEach((H,x)=>u.set(H.id,x)),c=new Map,f.forEach((H,x)=>c.set(H.id,x)),e[2]=t,e[3]=a,e[4]=s,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 h=-ot/2,g=ot/2,v=h-100-Vn,_=g+100,y=d.length,b=f.length;let p,w;if(e[17]!==l||e[18]!==c||e[19]!==u||e[20]!==y||e[21]!==t||e[22]!==a||e[23]!==n.slug||e[24]!==s||e[25]!==r||e[26]!==b){const k={stroke:l.edgeColor,strokeWidth:1.25,strokeDasharray:"8 6",strokeLinecap:"square"};w=[],p=[],w.push({id:"mesh",type:"mesh",position:{x:h,y:-ot/2},data:{org:n.slug,colorScheme:l},draggable:!1,selectable:!1}),[...r].sort(dg).forEach(x=>{const A=((u.get(x.id)??0)-(y-1)/2)*70-Rt/2;w.push({id:`gateway-${x.id}`,type:"gateway",position:{x:v,y:A},data:{gateway:x,metricsMode:t,metric:a.gateways.get(x.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),p.push({id:`e-gw-${x.id}`,source:`gateway-${x.id}`,target:"mesh",type:"smoothstep",animated:!0,style:k})}),[...s].sort(ug).forEach(x=>{const A=((c.get(x.id)??0)-(b-1)/2)*70-Rt/2;w.push({id:`server-${x.id}`,type:"server",position:{x:_,y:A},data:{connection:x,metricsMode:t,metric:a.connections.get(x.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),p.push({id:`e-srv-${x.id}`,source:"mesh",target:`server-${x.id}`,type:"smoothstep",animated:!0,style:k})}),e[17]=l,e[18]=c,e[19]=u,e[20]=y,e[21]=t,e[22]=a,e[23]=n.slug,e[24]=s,e[25]=r,e[26]=b,e[27]=p,e[28]=w}else p=e[27],w=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 S=N;let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=m.jsx("style",{children:`
|
|
8
|
-
.mesh-minimap .react-flow__node { transition: transform 300ms ease-out; }
|
|
9
|
-
.mesh-minimap .react-flow__edge path { transition: d 300ms ease-out; }
|
|
10
|
-
.mesh-minimap .react-flow__edge.animated path {
|
|
11
|
-
animation: dashdraw 0.8s linear infinite;
|
|
12
|
-
}
|
|
13
|
-
@keyframes dashdraw {
|
|
14
|
-
from {
|
|
15
|
-
stroke-dashoffset: 0;
|
|
16
|
-
}
|
|
17
|
-
to {
|
|
18
|
-
stroke-dashoffset: -14;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`}),e[30]=E):E=e[30];let D;e[31]===Symbol.for("react.memo_cache_sentinel")?(D={padding:.3},e[31]=D):D=e[31];let P;e[32]===Symbol.for("react.memo_cache_sentinel")?(P={hideAttribution:!0},e[32]=P):P=e[32];let R;return e[33]!==p||e[34]!==w?(R=m.jsxs("div",{className:"w-full h-full min-h-[420px] relative mesh-minimap bg-background",style:S,children:[E,m.jsx(Mh,{nodes:w,edges:p,nodeTypes:ag,fitView:!0,fitViewOptions:D,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnDrag:!0,preventScrolling:!0,proOptions:P,className:"bg-transparent"})]}),e[33]=p,e[34]=w,e[35]=R):R=e[35],R}function ug(e,t){return e.id.localeCompare(t.id)}function dg(e,t){return e.id.localeCompare(t.id)}function fg(){const e=ge.c(3);let t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=m.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(gg)}),n=m.jsx("div",{className:"h-14 w-28 bg-muted animate-pulse rounded-xl"}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=m.jsx("div",{className:"bg-background p-5 h-full min-h-[420px] flex items-center justify-center",children:m.jsxs("div",{className:"flex items-center gap-16",children:[t,n,m.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(hg)})]})}),e[2]=o):o=e[2],o}function hg(e){return m.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function gg(e){return m.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function pg(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function mg(e){const t=ge.c(12),{text:n,className:o,speed:r}=e,i=o===void 0?"":o,s=r===void 0?30:r,a=n.length/s*1e3,l=n.length,c=`${n.length}ch`,u=`${a}ms`;let f;t[0]!==c||t[1]!==l||t[2]!==u?(f={"--typewriter-duration":u,"--typewriter-steps":l,"--typewriter-max-width":c},t[0]=c,t[1]=l,t[2]=u,t[3]=f):f=t[3];const d=f;let h;t[4]!==n?(h=m.jsx("span",{className:"typewriter-text",children:n}),t[4]=n,t[5]=h):h=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=m.jsx("style",{children:`
|
|
22
|
-
.typewriter-text {
|
|
23
|
-
display: inline-block;
|
|
24
|
-
width: 0;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
white-space: nowrap;
|
|
27
|
-
animation: typewriter var(--typewriter-duration) steps(var(--typewriter-steps)) forwards;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@keyframes typewriter {
|
|
31
|
-
to {
|
|
32
|
-
width: var(--typewriter-max-width);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`}),t[6]=g):g=t[6];let v;return t[7]!==i||t[8]!==d||t[9]!==h||t[10]!==n?(v=m.jsxs("span",{className:i,style:d,children:[h,g]},n),t[7]=i,t[8]=d,t[9]=h,t[10]=n,t[11]=v):v=t[11],v}function yg(){const e=ge.c(86),{org:t,locator:n}=Sn(),{data:o}=Wi.useSession(),r=o?.user,i=jt(),{inputValue:s,setInputValue:a,createThread:l,activeThreadId:c,setActiveThreadId:u,hideThread:f}=Qn(),{threads:d,refetch:h}=qi(),[g,v]=ua(`${n}:home-view-mode`,"chat"),_=Ki(),y=Ui(),b=er();let p;e[0]!==b?(p={connections:b,binding:"LLMS"},e[0]=b,e[1]=p):p=e[1];const[w]=la(p),N=!!w;let S;e[2]!==n?(S=da.chatSelectedModel(n),e[2]=n,e[3]=S):S=e[3];const[E,D]=to(S,y,wg);let P;e[4]===Symbol.for("react.memo_cache_sentinel")?(P={gatewayId:fa.DECOPILOT},e[4]=P):P=e[4];const[R,k]=to(`${n}:selected-gateway`,_,xg,P);console.log({selectedGateway:R,gateways:_});let $;e[5]!==D?($=ie=>{D(ie)},e[5]=D,e[6]=$):$=e[6];const H=$;let x;e[7]!==k?(x=ie=>{k({gatewayId:ie})},e[7]=k,e[8]=x):x=e[8];const M=x,C=ta(),A=na(R?.id);let I;e[9]!==l||e[10]!==R?.id?(I=ie=>l({id:ie.id,title:ie.title,gatewayId:R?.id}),e[9]=l,e[10]=R?.id,e[11]=I):I=e[11];let T;e[12]!==c||e[13]!==C||e[14]!==A||e[15]!==I?(T={threadId:c,systemPrompt:A,onToolCall:C,onCreateThread:I},e[12]=c,e[13]=C,e[14]=A,e[15]=I,e[16]=T):T=e[16];const L=oa(T),{branchContext:O,clearBranch:j}=Qn();let F;e[17]!==c||e[18]!==L||e[19]!==j||e[20]!==R||e[21]!==E||e[22]!==a||e[23]!==r?.image||e[24]!==r?.name?(F=async ie=>{if(!E){Un.error("No model configured");return}if(!R?.id){Un.error("No Agent configured");return}a(""),j();const de={created_at:new Date().toISOString(),thread_id:c,model:{id:E.id,connectionId:E.connectionId,provider:E.provider??void 0,limits:E.limits??void 0},gateway:{id:R.id},user:{avatar:r?.image??void 0,name:r?.name??"you"}};await L.sendMessage(ie,de)},e[17]=c,e[18]=L,e[19]=j,e[20]=R,e[21]=E,e[22]=a,e[23]=r?.image,e[24]=r?.name,e[25]=F):F=e[25];const B=F;let G;e[26]!==r?.name?(G=r?.name?.split(" ")[0]||"there",e[26]=r?.name,e[27]=G):G=e[27];const U=G;let Z;e[28]===Symbol.for("react.memo_cache_sentinel")?(Z=pg(),e[28]=Z):Z=e[28];const V=Z;let X;e[29]!==c||e[30]!==d?(X=d?.find(ie=>ie.id===c),e[29]=c,e[30]=d,e[31]=X):X=e[31];const Q=X;if(!N){const ie=r?.id||"";let de;e[32]!==b?(de=b??[],e[32]=b,e[33]=de):de=e[33];let me;e[34]!==i||e[35]!==t.slug?(me=()=>{i({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[34]=i,e[35]=t.slug,e[36]=me):me=e[36];let Me;return e[37]!==t.id||e[38]!==t.slug||e[39]!==ie||e[40]!==de||e[41]!==me?(Me=m.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:m.jsx(ra,{orgSlug:t.slug,orgId:t.id,userId:ie,allConnections:de,onInstallMcpServer:me})}),e[37]=t.id,e[38]=t.slug,e[39]=ie,e[40]=de,e[41]=me,e[42]=Me):Me=e[42],Me}let K;e[43]!==Q||e[44]!==L||e[45]!==g?(K=m.jsx(ue.Header.Left,{children:g==="graph"?m.jsx("span",{className:"text-sm font-medium text-foreground",children:"Summary"}):!L.isEmpty&&Q?.title?m.jsx(mg,{text:Q.title,className:"text-sm font-medium text-foreground"}):m.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[43]=Q,e[44]=L,e[45]=g,e[46]=K):K=e[46];let W;e[47]!==g?(W=g==="graph"&&m.jsx(cg,{}),e[47]=g,e[48]=W):W=e[48];let q;e[49]!==c||e[50]!==l||e[51]!==f||e[52]!==h||e[53]!==u||e[54]!==d||e[55]!==g?(q=g!=="graph"&&m.jsxs(m.Fragment,{children:[m.jsx(or,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:()=>l(),"aria-label":"New chat",children:m.jsx(ma,{size:16})}),m.jsx(ia,{threads:d,activeThreadId:c,onSelectThread:u,onRemoveThread:f,onOpen:()=>h(),variant:"outline"})]}),e[49]=c,e[50]=l,e[51]=f,e[52]=h,e[53]=u,e[54]=d,e[55]=g,e[56]=q):q=e[56];let ee;e[57]===Symbol.for("react.memo_cache_sentinel")?(ee={value:"chat",icon:m.jsx(En,{})},e[57]=ee):ee=e[57];let ne;e[58]===Symbol.for("react.memo_cache_sentinel")?(ne=[ee,{value:"graph",icon:m.jsx(ga,{})}],e[58]=ne):ne=e[58];let te;e[59]!==v||e[60]!==g?(te=m.jsx(ha,{value:g,onValueChange:v,size:"sm",options:ne}),e[59]=v,e[60]=g,e[61]=te):te=e[61];let se;e[62]!==W||e[63]!==q||e[64]!==te?(se=m.jsxs(ue.Header.Right,{children:[W,q,te]}),e[62]=W,e[63]=q,e[64]=te,e[65]=se):se=e[65];let le;e[66]!==K||e[67]!==se?(le=m.jsxs(ue.Header,{children:[K,se]}),e[66]=K,e[67]=se,e[68]=le):le=e[68];let ce;e[69]!==O||e[70]!==L||e[71]!==j||e[72]!==M||e[73]!==H||e[74]!==B||e[75]!==s||e[76]!==R||e[77]!==E||e[78]!==u||e[79]!==a||e[80]!==U||e[81]!==g?(ce=g==="graph"?m.jsx("div",{className:"flex-1 overflow-hidden relative",children:m.jsx(un,{fallback:m.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:m.jsx(z.Suspense,{fallback:m.jsx(fg,{}),children:m.jsx(lg,{})})})}):L.isEmpty?m.jsx("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 py-10",children:m.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-[550px]",children:[m.jsxs("div",{className:"text-center",children:[m.jsxs("p",{className:"text-lg font-medium text-foreground",children:[V," ",U,","]}),m.jsx("p",{className:"text-base text-muted-foreground",children:"What are we building today?"})]}),R?.id&&m.jsx(un,{fallback:null,children:m.jsx(z.Suspense,{fallback:m.jsx("div",{className:"flex justify-center",children:m.jsx(pa,{size:20,className:"animate-spin text-muted-foreground"})}),children:m.jsx(sa,{gatewayId:R.id,onSelect:ie=>{B(ie.description??ie.name)},className:"w-full"})})},R.id),m.jsx("div",{className:"w-full shadow-sm rounded-xl",children:m.jsxs(Ji,{value:s,onChange:a,onSubmit:async()=>{s.trim()&&await B(s.trim())},placeholder:"Ask anything or @ for context",maxTextHeight:"65px",children:[m.jsx(Jn,{selectedGatewayId:R?.id,onGatewayChange:M,placeholder:"Agent",variant:"borderless"}),m.jsx(eo,{selectedModel:E??void 0,onModelChange:H,placeholder:"Model",variant:"borderless"})]})})]})}):m.jsxs(m.Fragment,{children:[m.jsx(ue.Main,{children:m.jsx(ue.Messages,{messages:L.messages,status:L.status,minHeightOffset:240})}),m.jsx(ue.Footer,{children:m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(ue.ErrorBanner,{error:L.error,onFixInChat:()=>{L.error&&B(`I encountered this error: ${L.error.message}. Can you help me fix it?`)},onDismiss:L.clearError}),m.jsx(ue.FinishReasonWarning,{finishReason:L.finishReason,onContinue:()=>{B("Please continue.")},onDismiss:L.clearFinishReason}),m.jsx(ue.BranchPreview,{branchContext:O,clearBranchContext:j,onGoToOriginalMessage:()=>{O&&(u(O.originalThreadId),j(),a(""))},setInputValue:a}),m.jsxs(ue.Input,{value:s,onChange:a,onSubmit:async()=>{s.trim()&&await B(s.trim())},onStop:L.stop,disabled:!E||!R?.id,isStreaming:L.status==="submitted"||L.status==="streaming",placeholder:E?"Ask anything or @ for context":"Select a model to start chatting",children:[m.jsx(Jn,{selectedGatewayId:R?.id,onGatewayChange:M,placeholder:"Agent",variant:"borderless"}),m.jsx(eo,{selectedModel:E??void 0,onModelChange:H,placeholder:"Model",variant:"borderless"}),m.jsx(Qi,{messages:L.messages})]})]})})]}),e[69]=O,e[70]=L,e[71]=j,e[72]=M,e[73]=H,e[74]=B,e[75]=s,e[76]=R,e[77]=E,e[78]=u,e[79]=a,e[80]=U,e[81]=g,e[82]=ce):ce=e[82];let pe;return e[83]!==le||e[84]!==ce?(pe=m.jsx(Jh,{children:m.jsxs(ue,{children:[le,ce]})}),e[83]=le,e[84]=ce,e[85]=pe):pe=e[85],pe}function xg(e,t){return e.id===t.gatewayId}function wg(e,t){return e.id===t.id&&e.connectionId===t.connectionId}function vg(e){const t=ge.c(14),{error:n,onRetry:o}=e,r=n?.message?.includes("401")||n?.message?.toLowerCase().includes("unauthorized");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=m.jsxs(ue.Header,{children:[m.jsx(ue.Header.Left,{children:m.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),m.jsx(ue.Header.Right,{})]}),t[0]=i):i=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=m.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:m.jsx(En,{className:"h-6 w-6 text-destructive"})}),t[1]=s):s=t[1];const a=r?"Unable to load models":"Something went wrong";let l;t[2]!==a?(l=m.jsx("h3",{className:"text-lg font-medium",children:a}),t[2]=a,t[3]=l):l=t[3];const c=r?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":n?.message||"An unexpected error occurred";let u;t[4]!==c?(u=m.jsx("p",{className:"text-sm text-muted-foreground",children:c}),t[4]=c,t[5]=u):u=t[5];let f;t[6]!==l||t[7]!==u?(f=m.jsxs("div",{className:"space-y-2",children:[l,u]}),t[6]=l,t[7]=u,t[8]=f):f=t[8];let d;t[9]!==o?(d=m.jsx(or,{variant:"outline",onClick:o,children:"Try again"}),t[9]=o,t[10]=d):d=t[10];let h;return t[11]!==f||t[12]!==d?(h=m.jsxs(ue,{children:[i,m.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:m.jsxs("div",{className:"max-w-sm space-y-4",children:[s,f,d]})})]}),t[11]=f,t[12]=d,t[13]=h):h=t[13],h}function _g(){const e=ge.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=m.jsx(un,{fallback:bg,children:m.jsx(z.Suspense,{fallback:m.jsx(ea,{}),children:m.jsx(yg,{})})}),e[0]=t):t=e[0],t}function bg(e){const{error:t,resetError:n}=e;return m.jsx(vg,{error:t,onRetry:n})}function lp(){const e=ge.c(3),t=Zi();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=m.jsx(_g,{}),e[0]=n):n=e[0];let o;return e[1]!==t.location.pathname?(o=m.jsx(Gi,{children:n},t.location.pathname),e[1]=t.location.pathname,e[2]=o):o=e[2],o}export{lp as default};
|