@plitzi/plitzi-builder 0.35.7 → 0.35.8

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.
@@ -3761,35 +3761,40 @@ return P("div",{className:ca("flex flex-col justify-between",e),children:[/* @__
3761
3761
  /* @__PURE__ */P(E4e,{id:"news",isSelected:"news"===n,onClick:i,children:[/* @__PURE__ */T("i",{className:"fa-solid fa-bolt mr-2 flex w-5 items-center justify-center text-yellow-500"}),"New in"]}),
3762
3762
  /* @__PURE__ */P(E4e,{id:"plugins",isSelected:"plugins"===n,onClick:i,children:[/* @__PURE__ */T("i",{className:"fa-solid fa-puzzle-piece mr-2 flex w-5 items-center justify-center"}),"Plugins"]}),
3763
3763
  /* @__PURE__ */P(E4e,{id:"templates",isSelected:"templates"===n,onClick:i,children:[/* @__PURE__ */T("i",{className:"fa-solid fa-map mr-2 flex w-5 items-center justify-center"}),"Templates"]})]})]}),/* @__PURE__ */P(Yj,{intent:"custom",children:[/* @__PURE__ */T("i",{className:"fa-solid fa-comment mr-2 flex w-5 items-center justify-center"}),"Help Center"]})]})},z4e=()=>/* @__PURE__ */T("div",{className:"flex grow basis-0 flex-col",children:"Coming Soon..."}),A4e=()=>{const[e,t]=E("news");/* @__PURE__ */
3764
- return P("div",{className:"flex grow basis-0 flex-col px-6 pt-6",children:[/* @__PURE__ */T("div",{className:"mb-8 flex",children:/* @__PURE__ */P("div",{className:"flex items-center justify-center select-none",children:[/* @__PURE__ */T("div",{className:"mr-4 h-10 w-10 bg-contain bg-no-repeat",style:{backgroundImage:"url(https://cdn.plitzi.com/resources/img/favicon.svg)"}}),/* @__PURE__ */P("div",{className:"flex flex-col text-3xl",children:["Plitzi",/* @__PURE__ */T("span",{className:"text-xs font-bold text-blue-500",children:"Marketplace"})]})]})}),/* @__PURE__ */P("div",{className:"flex grow basis-0",children:[/* @__PURE__ */T(N4e,{onSelect:t,className:"mr-10 border-r border-gray-300 pr-10 pb-6 dark:border-zinc-700"}),/* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col",children:["news"===e&&/* @__PURE__ */T(v4e,{}),"plugins"===e&&/* @__PURE__ */T(C4e,{}),"templates"===e&&/* @__PURE__ */T(z4e,{})]})]})]})},T4e=()=>/* @__PURE__ */T(uPe,{className:"flex grow basis-0 flex-col",children:/* @__PURE__ */T(uPe.Body,{grow:!0,children:/* @__PURE__ */T(A4e,{})})});BQ(),TQ(),uQ(),b1(),mi();var P4e=["loginUrl","userUrl","refreshUrl","logoutUrl","detailsPath","tokenPath","refreshTokenPath","expirationTimePath","refreshExpirationTimePath","sessionHintCookie"],M4e=()=>{const[[e,t]]=Yn(["schema.settings","style.mode"]),{eventBridge:n}=m(E0),[r,i]=E(e),{userProvider:a,keepState:o,stateStorage:s,tokenStorage:l="localStorage",loginUrl:c,userUrl:d,refreshUrl:u,logoutUrl:h,detailsPath:f="details",tokenPath:p="access_token",refreshTokenPath:v="refresh_token",expirationTimePath:b="expire_at",refreshExpirationTimePath:y="refresh_expire_at",sessionHintCookie:x="",sessionGate:w="optimistic",sessionRevalidateSeconds:O=300}=r,k=g(e=>{n.emit("main","schemaUpdateSettings","","stateStorage"),i(t=>({...t,keepState:e.target.checked})),n.emit("main","schemaUpdateSettings",e.target.checked,"keepState")},[n]),S=g(e=>t=>{"userProvider"===e?(P4e.forEach(e=>{n.emit("main","schemaUpdateSettings","",e)}),i(n=>({...n,...Object.fromEntries(P4e.map(e=>[e,""])),[e]:t})),n.emit("main","schemaUpdateSettings",t,e)):"head"===e||(i(n=>({...n,[e]:t})),n.emit("main","schemaUpdateSettings",t,e))},[n]),C=g(e=>t=>{const r=Number(t),a=Number.isFinite(r)&&r>0?r:void 0;i(t=>({...t,[e]:a})),n.emit("main","schemaUpdateSettings",a,e)},[n]),N=g(e=>{n.emit("main","styleUpdateSettings","mode",e)},[n]);/* @__PURE__ */
3764
+ return P("div",{className:"flex grow basis-0 flex-col px-6 pt-6",children:[/* @__PURE__ */T("div",{className:"mb-8 flex",children:/* @__PURE__ */P("div",{className:"flex items-center justify-center select-none",children:[/* @__PURE__ */T("div",{className:"mr-4 h-10 w-10 bg-contain bg-no-repeat",style:{backgroundImage:"url(https://cdn.plitzi.com/resources/img/favicon.svg)"}}),/* @__PURE__ */P("div",{className:"flex flex-col text-3xl",children:["Plitzi",/* @__PURE__ */T("span",{className:"text-xs font-bold text-blue-500",children:"Marketplace"})]})]})}),/* @__PURE__ */P("div",{className:"flex grow basis-0",children:[/* @__PURE__ */T(N4e,{onSelect:t,className:"mr-10 border-r border-gray-300 pr-10 pb-6 dark:border-zinc-700"}),/* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col",children:["news"===e&&/* @__PURE__ */T(v4e,{}),"plugins"===e&&/* @__PURE__ */T(C4e,{}),"templates"===e&&/* @__PURE__ */T(z4e,{})]})]})]})},T4e=()=>/* @__PURE__ */T(uPe,{className:"flex grow basis-0 flex-col",children:/* @__PURE__ */T(uPe.Body,{grow:!0,children:/* @__PURE__ */T(A4e,{})})});BQ(),TQ(),uQ(),b1(),mi();var P4e=["loginUrl","userUrl","refreshUrl","logoutUrl","detailsPath","tokenPath","refreshTokenPath","expirationTimePath","refreshExpirationTimePath","sessionHintCookie"],M4e=()=>{const[[e,t]]=Yn(["schema.settings","style.mode"]),{eventBridge:n}=m(E0),[r,i]=E(e),{userProvider:a,keepState:o,stateStorage:s,tokenStorage:l="localStorage",loginUrl:c,userUrl:d,refreshUrl:u,logoutUrl:h,detailsPath:f="details",tokenPath:p="access_token",refreshTokenPath:v="refresh_token",expirationTimePath:b="expire_at",refreshExpirationTimePath:y="refresh_expire_at",sessionHintCookie:x="",sessionGate:w="optimistic",sessionRevalidateSeconds:O=300,devTools:k=!1}=r,S=g(e=>{n.emit("main","schemaUpdateSettings","","stateStorage"),i(t=>({...t,keepState:e.target.checked})),n.emit("main","schemaUpdateSettings",e.target.checked,"keepState")},[n]),C=g(e=>{i(t=>({...t,devTools:e.target.checked})),n.emit("main","schemaUpdateSettings",e.target.checked,"devTools")},[n]),N=g(e=>t=>{"userProvider"===e?(P4e.forEach(e=>{n.emit("main","schemaUpdateSettings","",e)}),i(n=>({...n,...Object.fromEntries(P4e.map(e=>[e,""])),[e]:t})),n.emit("main","schemaUpdateSettings",t,e)):"head"===e||(i(n=>({...n,[e]:t})),n.emit("main","schemaUpdateSettings",t,e))},[n]),z=g(e=>t=>{const r=Number(t),a=Number.isFinite(r)&&r>0?r:void 0;i(t=>({...t,[e]:a})),n.emit("main","schemaUpdateSettings",a,e)},[n]),M=g(e=>{n.emit("main","styleUpdateSettings","mode",e)},[n]);/* @__PURE__ */
3765
3765
  return T(uPe,{className:"flex grow basis-0 flex-col",rounded:"none",children:/* @__PURE__ */P(uPe.Body,{className:"overflow-y-auto",grow:!0,children:[
3766
3766
  /* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col gap-4 border-b border-gray-300 p-6",children:[
3767
3767
  /* @__PURE__ */T(dTe,{as:"h4",children:"User Settings"}),
3768
- /* @__PURE__ */T(aV,{size:"sm",name:"userProvider",value:a,onChange:S("userProvider"),label:"User Provider",placeholder:"None",children:/* @__PURE__ */T("option",{value:"basic",children:"Basic"})}),
3769
- /* @__PURE__ */P(aV,{size:"sm",name:"tokenStorage",value:l,onChange:S("tokenStorage"),label:"Token Storage",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"localStorage",children:"Local Storage"}),/* @__PURE__ */T("option",{value:"sessionStorage",children:"Session Storage"})]}),"basic"===a&&/* @__PURE__ */P(A,{children:[
3768
+ /* @__PURE__ */T(aV,{size:"sm",name:"userProvider",value:a,onChange:N("userProvider"),label:"User Provider",placeholder:"None",children:/* @__PURE__ */T("option",{value:"basic",children:"Basic"})}),
3769
+ /* @__PURE__ */P(aV,{size:"sm",name:"tokenStorage",value:l,onChange:N("tokenStorage"),label:"Token Storage",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"localStorage",children:"Local Storage"}),/* @__PURE__ */T("option",{value:"sessionStorage",children:"Session Storage"})]}),"basic"===a&&/* @__PURE__ */P(A,{children:[
3770
3770
  /* @__PURE__ */P(lTe,{intent:"info",size:"xs",solid:!1,children:["Every field below accepts schema variables, so one ",
3771
3771
  /* @__PURE__ */T("code",{children:"{{baseUrl}}/auth/login"})," follows the environment its variable is defined for."]}),
3772
- /* @__PURE__ */T(CV,{size:"sm",name:"loginUrl",value:c,onChange:S("loginUrl"),label:"API Login Url"}),
3773
- /* @__PURE__ */T(CV,{size:"sm",name:"userUrl",value:d,onChange:S("userUrl"),label:"API User Profile Url"}),
3774
- /* @__PURE__ */T(CV,{size:"sm",name:"refreshUrl",value:u,onChange:S("refreshUrl"),label:"API Refresh Url (Optional)"}),
3775
- /* @__PURE__ */T(CV,{size:"sm",name:"logoutUrl",value:h,onChange:S("logoutUrl"),label:"API Logout Url"}),
3776
- /* @__PURE__ */T(CV,{size:"sm",name:"detailsPath",value:f,onChange:S("detailsPath"),label:"API Details Object Path - Default: [details] - example: [user.details]"}),
3777
- /* @__PURE__ */T(CV,{size:"sm",name:"tokenPath",value:p,onChange:S("tokenPath"),label:"API Token Object Path - Default: [access_token] - example: [user.access_token]"}),
3778
- /* @__PURE__ */T(CV,{size:"sm",name:"refreshTokenPath",value:v,onChange:S("refreshTokenPath"),label:"API Refresh Token Object Path - Default: [refresh_token]"}),
3779
- /* @__PURE__ */T(CV,{size:"sm",name:"expirationTimePath",value:b,onChange:S("expirationTimePath"),label:"API Expiration Time Object Path - Default: [expire_at] - example: [user.expire_at]"}),
3780
- /* @__PURE__ */T(CV,{size:"sm",name:"refreshExpirationTimePath",value:y,onChange:S("refreshExpirationTimePath"),label:"API Refresh Expiration Time Object Path - Default: [refresh_expire_at]"}),
3772
+ /* @__PURE__ */T(CV,{size:"sm",name:"loginUrl",value:c,onChange:N("loginUrl"),label:"API Login Url"}),
3773
+ /* @__PURE__ */T(CV,{size:"sm",name:"userUrl",value:d,onChange:N("userUrl"),label:"API User Profile Url"}),
3774
+ /* @__PURE__ */T(CV,{size:"sm",name:"refreshUrl",value:u,onChange:N("refreshUrl"),label:"API Refresh Url (Optional)"}),
3775
+ /* @__PURE__ */T(CV,{size:"sm",name:"logoutUrl",value:h,onChange:N("logoutUrl"),label:"API Logout Url"}),
3776
+ /* @__PURE__ */T(CV,{size:"sm",name:"detailsPath",value:f,onChange:N("detailsPath"),label:"API Details Object Path - Default: [details] - example: [user.details]"}),
3777
+ /* @__PURE__ */T(CV,{size:"sm",name:"tokenPath",value:p,onChange:N("tokenPath"),label:"API Token Object Path - Default: [access_token] - example: [user.access_token]"}),
3778
+ /* @__PURE__ */T(CV,{size:"sm",name:"refreshTokenPath",value:v,onChange:N("refreshTokenPath"),label:"API Refresh Token Object Path - Default: [refresh_token]"}),
3779
+ /* @__PURE__ */T(CV,{size:"sm",name:"expirationTimePath",value:b,onChange:N("expirationTimePath"),label:"API Expiration Time Object Path - Default: [expire_at] - example: [user.expire_at]"}),
3780
+ /* @__PURE__ */T(CV,{size:"sm",name:"refreshExpirationTimePath",value:y,onChange:N("refreshExpirationTimePath"),label:"API Refresh Expiration Time Object Path - Default: [refresh_expire_at]"}),
3781
3781
  /* @__PURE__ */P(lTe,{intent:"info",size:"xs",solid:!1,children:["Name a readable cookie your API sets beside its session cookie (value ",
3782
3782
  /* @__PURE__ */T("code",{children:"expiry.refreshExpiry"}),", in seconds) and pages know whether anyone is signed in without asking — including when nobody is."]}),
3783
- /* @__PURE__ */T(CV,{size:"sm",name:"sessionHintCookie",value:x,onChange:S("sessionHintCookie"),label:"Session Hint Cookie (Optional)"}),
3784
- /* @__PURE__ */P(aV,{size:"sm",name:"sessionGate",value:w,onChange:S("sessionGate"),label:"Pages Requiring A Session",children:[/* @__PURE__ */T("option",{value:"optimistic",children:"Render from the stored session, confirm in background"}),/* @__PURE__ */T("option",{value:"strict",children:"Wait for the API to confirm the session"})]}),
3785
- /* @__PURE__ */T(CV,{size:"sm",type:"number",name:"sessionRevalidateSeconds",value:String(O),onChange:C("sessionRevalidateSeconds"),label:"Re-check The Session After (seconds) - Default: [300]"})]})]}),
3783
+ /* @__PURE__ */T(CV,{size:"sm",name:"sessionHintCookie",value:x,onChange:N("sessionHintCookie"),label:"Session Hint Cookie (Optional)"}),
3784
+ /* @__PURE__ */P(aV,{size:"sm",name:"sessionGate",value:w,onChange:N("sessionGate"),label:"Pages Requiring A Session",children:[/* @__PURE__ */T("option",{value:"optimistic",children:"Render from the stored session, confirm in background"}),/* @__PURE__ */T("option",{value:"strict",children:"Wait for the API to confirm the session"})]}),
3785
+ /* @__PURE__ */T(CV,{size:"sm",type:"number",name:"sessionRevalidateSeconds",value:String(O),onChange:z("sessionRevalidateSeconds"),label:"Re-check The Session After (seconds) - Default: [300]"})]})]}),
3786
3786
  /* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col gap-4 border-b border-gray-300 p-6",children:[
3787
3787
  /* @__PURE__ */T(dTe,{as:"h4",children:"Style Settings"}),
3788
3788
  /* @__PURE__ */T(lTe,{intent:"info",size:"xs",solid:!1,children:"Keep on mind that changing this can impact your style"}),
3789
- /* @__PURE__ */P(aV,{size:"sm",name:"mode",value:t,onChange:N,label:"Style Mode (Breakpoint system)",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"desktop-first",children:"Desktop First"}),/* @__PURE__ */T("option",{value:"mobile-first",children:"Mobile First"})]})]}),
3789
+ /* @__PURE__ */P(aV,{size:"sm",name:"mode",value:t,onChange:M,label:"Style Mode (Breakpoint system)",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"desktop-first",children:"Desktop First"}),/* @__PURE__ */T("option",{value:"mobile-first",children:"Mobile First"})]})]}),
3790
3790
  /* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col gap-4 border-b border-gray-300 p-6",children:[
3791
3791
  /* @__PURE__ */T(dTe,{as:"h4",children:"State Settings"}),
3792
- /* @__PURE__ */T(LV,{size:"sm",name:"keepState",checked:o,onChange:k,type:"checkbox",label:"Keep State"}),o&&/* @__PURE__ */P(aV,{size:"sm",name:"stateStorage",value:s,onChange:S("stateStorage"),label:"State Storage",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"localStorage",children:"Local Storage"}),/* @__PURE__ */T("option",{value:"sessionStorage",children:"Session Storage"})]})]})]})})};function I4e(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=I4e(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var R4e={value:()=>{}};function D4e(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new L4e(r)}function L4e(e){this._=e}function j4e(e,t){for(var n,r=0,i=e.length;r<i;++r)if((n=e[r]).name===t)return n.value}function V4e(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=R4e,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}L4e.prototype=D4e.prototype={constructor:L4e,on:function(e,t){var n,r,i=this._,a=(r=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<s;)if(n=(e=a[o]).type)i[n]=V4e(i[n],e.name,t);else if(null==t)for(n in i)i[n]=V4e(i[n],e.name,null);return this}for(;++o<s;)if((n=(e=a[o]).type)&&(n=j4e(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new L4e(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=0,n=(r=this._[e]).length;a<n;++a)r[a].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};var Q4e={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function B4e(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Q4e.hasOwnProperty(t)?{space:Q4e[t],local:e}:e}function F4e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return"http://www.w3.org/1999/xhtml"===n&&"http://www.w3.org/1999/xhtml"===t.documentElement.namespaceURI?t.createElement(e):t.createElementNS(n,e)}}function _4e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function q4e(e){var t=B4e(e);return(t.local?_4e:F4e)(t)}function W4e(){}function U4e(e){return null==e?W4e:function(){return this.querySelector(e)}}function H4e(){return[]}function Z4e(e){return null==e?H4e:function(){return this.querySelectorAll(e)}}function Y4e(e){return function(){return this.matches(e)}}function X4e(e){return function(t){return t.matches(e)}}var G4e=Array.prototype.find;function K4e(){return this.firstElementChild}var $4e=Array.prototype.filter;function J4e(){return Array.from(this.children)}function e6e(e){return new Array(e.length)}function t6e(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function n6e(e,t,n,r,i,a){for(var o,s=0,l=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],r[s]=o):n[s]=new t6e(e,a[s]);for(;s<l;++s)(o=t[s])&&(i[s]=o)}function r6e(e,t,n,r,i,a,o){var s,l,c,d=/* @__PURE__ */new Map,u=t.length,h=a.length,f=new Array(u);for(s=0;s<u;++s)(l=t[s])&&(f[s]=c=o.call(l,l.__data__,s,t)+"",d.has(c)?i[s]=l:d.set(c,l));for(s=0;s<h;++s)c=o.call(e,a[s],s,a)+"",(l=d.get(c))?(r[s]=l,l.__data__=a[s],d.delete(c)):n[s]=new t6e(e,a[s]);for(s=0;s<u;++s)(l=t[s])&&d.get(f[s])===l&&(i[s]=l)}function i6e(e){return e.__data__}function a6e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function o6e(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function s6e(e){return function(){this.removeAttribute(e)}}function l6e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function c6e(e,t){return function(){this.setAttribute(e,t)}}function d6e(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function u6e(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function h6e(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function f6e(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function p6e(e){return function(){this.style.removeProperty(e)}}function m6e(e,t,n){return function(){this.style.setProperty(e,t,n)}}function g6e(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function v6e(e,t){return e.style.getPropertyValue(t)||f6e(e).getComputedStyle(e,null).getPropertyValue(t)}function b6e(e){return function(){delete this[e]}}function y6e(e,t){return function(){this[e]=t}}function x6e(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function w6e(e){return e.trim().split(/^|\s+/)}function O6e(e){return e.classList||new k6e(e)}function k6e(e){this._node=e,this._names=w6e(e.getAttribute("class")||"")}function S6e(e,t){for(var n=O6e(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function C6e(e,t){for(var n=O6e(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function E6e(e){return function(){S6e(this,e)}}function N6e(e){return function(){C6e(this,e)}}function z6e(e,t){return function(){(t.apply(this,arguments)?S6e:C6e)(this,e)}}function A6e(){this.textContent=""}function T6e(e){return function(){this.textContent=e}}function P6e(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function M6e(){this.innerHTML=""}function I6e(e){return function(){this.innerHTML=e}}function R6e(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function D6e(){this.nextSibling&&this.parentNode.appendChild(this)}function L6e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function j6e(){return null}function V6e(){var e=this.parentNode;e&&e.removeChild(this)}function Q6e(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function B6e(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function F6e(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,a=t.length;r<a;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function _6e(e,t,n){return function(){var r,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((r=i[o]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=t);this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},i?i.push(r):this.__on=[r]}}function q6e(e,t,n){var r=f6e(e),i=r.CustomEvent;"function"==typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function W6e(e,t){return function(){return q6e(this,e,t)}}function U6e(e,t){return function(){return q6e(this,e,t.apply(this,arguments))}}t6e.prototype={constructor:t6e,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)}},k6e.prototype={add:function(e){this._names.indexOf(e)<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}};var H6e=[null];function Z6e(e,t){this._groups=e,this._parents=t}function Y6e(){return new Z6e([[document.documentElement]],H6e)}function X6e(e){return"string"==typeof e?new Z6e([[document.querySelector(e)]],[document.documentElement]):new Z6e([[e]],H6e)}function G6e(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}Z6e.prototype=Y6e.prototype={constructor:Z6e,select:function(e){"function"!=typeof e&&(e=U4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o,s=t[i],l=s.length,c=r[i]=new Array(l),d=0;d<l;++d)(a=s[d])&&(o=e.call(a,a.__data__,d,s))&&("__data__"in a&&(o.__data__=a.__data__),c[d]=o);return new Z6e(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):Z4e(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o,s=t[a],l=s.length,c=0;c<l;++c)(o=s[c])&&(r.push(e.call(o,o.__data__,c,s)),i.push(o));return new Z6e(r,i)},selectChild:function(e){return this.select(null==e?K4e:function(e){return function(){return G4e.call(this.children,e)}}("function"==typeof e?e:X4e(e)))},selectChildren:function(e){return this.selectAll(null==e?J4e:function(e){return function(){return $4e.call(this.children,e)}}("function"==typeof e?e:X4e(e)))},filter:function(e){"function"!=typeof e&&(e=Y4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&l.push(a);return new Z6e(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,i6e);var n=t?r6e:n6e,r=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=new Array(a),s=new Array(a),l=new Array(a),c=0;c<a;++c){var d=r[c],u=i[c],h=u.length,f=a6e(e.call(d,d&&d.__data__,c,r)),p=f.length,m=s[c]=new Array(p),g=o[c]=new Array(p);n(d,u,m,g,l[c]=new Array(h),f,t);for(var v,b,y=0,x=0;y<p;++y)if(v=m[y]){for(y>=x&&(x=y+1);!(b=g[x])&&++x<p;);v._next=b||null}}return(o=new Z6e(o,r))._enter=s,o._exit=l,o},enter:function(){return new Z6e(this._enter||this._groups.map(e6e),this._parents)},exit:function(){return new Z6e(this._exit||this._groups.map(e6e),this._parents)},join:function(e,t,n){var r=this.enter(),i=this,a=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=new Array(i),l=0;l<o;++l)for(var c,d=n[l],u=r[l],h=d.length,f=s[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(f[p]=c);for(;l<i;++l)s[l]=n[l];return new Z6e(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,i=e[t],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=o6e);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,s=n[a],l=s.length,c=i[a]=new Array(l),d=0;d<l;++d)(o=s[d])&&(c[d]=o);c.sort(t)}return new Z6e(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i,a=t[n],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var n=B4e(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?l6e:s6e:"function"==typeof t?n.local?h6e:u6e:n.local?d6e:c6e)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?p6e:"function"==typeof t?g6e:m6e)(e,t,null==n?"":n)):v6e(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?b6e:"function"==typeof t?x6e:y6e)(e,t)):this.node()[e]},classed:function(e,t){var n=w6e(e+"");if(arguments.length<2){for(var r=O6e(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?z6e:t?E6e:N6e)(n,t))},text:function(e){return arguments.length?this.each(null==e?A6e:("function"==typeof e?P6e:T6e)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?M6e:("function"==typeof e?R6e:I6e)(e)):this.node().innerHTML},raise:function(){return this.each(D6e)},lower:function(){return this.each(L6e)},append:function(e){var t="function"==typeof e?e:q4e(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:q4e(e),r=null==t?j6e:"function"==typeof t?t:U4e(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(V6e)},clone:function(e){return this.select(e?B6e:Q6e)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?_6e:F6e,r=0;r<o;++r)this.each(s(a[r],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,d=s.length;c<d;++c)for(r=0,l=s[c];r<o;++r)if((i=a[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?U6e:W6e)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,i=e[t],a=0,o=i.length;a<o;++a)(r=i[a])&&(yield r)}};var K6e={passive:!1},$6e={capture:!0,passive:!1};function J6e(e){e.stopImmediatePropagation()}function e9e(e){e.preventDefault(),e.stopImmediatePropagation()}function t9e(e){var t=e.document.documentElement,n=X6e(e).on("dragstart.drag",e9e,$6e);"onselectstart"in t?n.on("selectstart.drag",e9e,$6e):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function n9e(e,t){var n=e.document.documentElement,r=X6e(e).on("dragstart.drag",null);t&&(r.on("click.drag",e9e,$6e),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var r9e=e=>()=>e;function i9e(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function a9e(e){return!e.ctrlKey&&!e.button}function o9e(){return this.parentNode}function s9e(e,t){return null==t?{x:e.x,y:e.y}:t}function l9e(){return navigator.maxTouchPoints||"ontouchstart"in this}function c9e(){var e,t,n,r,i=a9e,a=o9e,o=s9e,s=l9e,l={},c=D4e("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",f).filter(s).on("touchstart.drag",g).on("touchmove.drag",v,K6e).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(o,s){if(!r&&i.call(this,o,s)){var l=y(this,a.call(this,o,s),o,s,"mouse");l&&(X6e(o.view).on("mousemove.drag",p,$6e).on("mouseup.drag",m,$6e),t9e(o.view),J6e(o),n=!1,e=o.clientX,t=o.clientY,l("start",o))}}function p(r){if(e9e(r),!n){var i=r.clientX-e,a=r.clientY-t;n=i*i+a*a>u}l.mouse("drag",r)}function m(e){X6e(e.view).on("mousemove.drag mouseup.drag",null),n9e(e.view,n),e9e(e),l.mouse("end",e)}function g(e,t){if(i.call(this,e,t))for(var n,r=e.changedTouches,o=a.call(this,e,t),s=r.length,l=0;l<s;++l)(n=y(this,o,e,t,r[l].identifier,r[l]))&&(J6e(e),n("start",e,r[l]))}function v(e){for(var t,n=e.changedTouches,r=n.length,i=0;i<r;++i)(t=l[n[i].identifier])&&(e9e(e),t("drag",e,n[i]))}function b(e){var t,n,i=e.changedTouches,a=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<a;++t)(n=l[i[t].identifier])&&(J6e(e),n("end",e,i[t]))}function y(e,t,n,r,i,a){var s,u,f,p=c.copy(),m=G6e(a||n,t);if(null!=(f=o.call(e,new i9e("beforestart",{sourceEvent:n,target:h,identifier:i,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),r)))return s=f.x-m[0]||0,u=f.y-m[1]||0,function n(a,o,c){var g,v=m;switch(a){case"start":l[i]=n,g=d++;break;case"end":delete l[i],--d;case"drag":m=G6e(c||o,t),g=d}p.call(a,e,new i9e(a,{sourceEvent:o,subject:f,target:h,identifier:i,active:g,x:m[0]+s,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:p}),r)}}return h.filter=function(e){return arguments.length?(i="function"==typeof e?e:r9e(!!e),h):i},h.container=function(e){return arguments.length?(a="function"==typeof e?e:r9e(e),h):a},h.subject=function(e){return arguments.length?(o="function"==typeof e?e:r9e(e),h):o},h.touchable=function(e){return arguments.length?(s="function"==typeof e?e:r9e(!!e),h):s},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,h):Math.sqrt(u)},h}function d9e(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function u9e(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function h9e(){}i9e.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var f9e=.7,p9e=1/f9e,m9e="\\s*([+-]?\\d+)\\s*",g9e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",v9e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",b9e=/^#([0-9a-f]{3,8})$/,y9e=new RegExp(`^rgb\\(${m9e},${m9e},${m9e}\\)$`),x9e=new RegExp(`^rgb\\(${v9e},${v9e},${v9e}\\)$`),w9e=new RegExp(`^rgba\\(${m9e},${m9e},${m9e},${g9e}\\)$`),O9e=new RegExp(`^rgba\\(${v9e},${v9e},${v9e},${g9e}\\)$`),k9e=new RegExp(`^hsl\\(${g9e},${v9e},${v9e}\\)$`),S9e=new RegExp(`^hsla\\(${g9e},${v9e},${v9e},${g9e}\\)$`),C9e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function E9e(){return this.rgb().formatHex()}function N9e(){return this.rgb().formatRgb()}function z9e(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=b9e.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?A9e(t):3===n?new M9e(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?T9e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?T9e(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=y9e.exec(e))?new M9e(t[1],t[2],t[3],1):(t=x9e.exec(e))?new M9e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=w9e.exec(e))?T9e(t[1],t[2],t[3],t[4]):(t=O9e.exec(e))?T9e(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=k9e.exec(e))?V9e(t[1],t[2]/100,t[3]/100,1):(t=S9e.exec(e))?V9e(t[1],t[2]/100,t[3]/100,t[4]):C9e.hasOwnProperty(e)?A9e(C9e[e]):"transparent"===e?new M9e(NaN,NaN,NaN,0):null}function A9e(e){return new M9e(e>>16&255,e>>8&255,255&e,1)}function T9e(e,t,n,r){return r<=0&&(e=t=n=NaN),new M9e(e,t,n,r)}function P9e(e,t,n,r){return 1===arguments.length?function(e){return e instanceof h9e||(e=z9e(e)),e?new M9e((e=e.rgb()).r,e.g,e.b,e.opacity):new M9e}(e):new M9e(e,t,n,null==r?1:r)}function M9e(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function I9e(){return`#${j9e(this.r)}${j9e(this.g)}${j9e(this.b)}`}function R9e(){const e=D9e(this.opacity);return`${1===e?"rgb(":"rgba("}${L9e(this.r)}, ${L9e(this.g)}, ${L9e(this.b)}${1===e?")":`, ${e})`}`}function D9e(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function L9e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function j9e(e){return((e=L9e(e))<16?"0":"")+e.toString(16)}function V9e(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B9e(e,t,n,r)}function Q9e(e){if(e instanceof B9e)return new B9e(e.h,e.s,e.l,e.opacity);if(e instanceof h9e||(e=z9e(e)),!e)return new B9e;if(e instanceof B9e)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new B9e(o,s,l,e.opacity)}function B9e(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function F9e(e){return(e=(e||0)%360)<0?e+360:e}function _9e(e){return Math.max(0,Math.min(1,e||0))}function q9e(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function W9e(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}d9e(h9e,z9e,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:E9e,formatHex:E9e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Q9e(this).formatHsl()},formatRgb:N9e,toString:N9e}),d9e(M9e,P9e,u9e(h9e,{brighter(e){return e=null==e?p9e:Math.pow(p9e,e),new M9e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?f9e:Math.pow(f9e,e),new M9e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new M9e(L9e(this.r),L9e(this.g),L9e(this.b),D9e(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:I9e,formatHex:I9e,formatHex8:function(){return`#${j9e(this.r)}${j9e(this.g)}${j9e(this.b)}${j9e(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:R9e,toString:R9e})),d9e(B9e,function(e,t,n,r){return 1===arguments.length?Q9e(e):new B9e(e,t,n,null==r?1:r)},u9e(h9e,{brighter(e){return e=null==e?p9e:Math.pow(p9e,e),new B9e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?f9e:Math.pow(f9e,e),new B9e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new M9e(q9e(e>=240?e-240:e+120,i,r),q9e(e,i,r),q9e(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B9e(F9e(this.h),_9e(this.s),_9e(this.l),D9e(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=D9e(this.opacity);return`${1===e?"hsl(":"hsla("}${F9e(this.h)}, ${100*_9e(this.s)}%, ${100*_9e(this.l)}%${1===e?")":`, ${e})`}`}}));var U9e=e=>()=>e;function H9e(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):U9e(isNaN(e)?t:e)}var Z9e=function e(t){var n=function(e){return 1===(e=+e)?H9e:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):U9e(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=P9e(e)).r,(t=P9e(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=H9e(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Y9e(e){return function(t){for(var n,r=t.length,i=new Array(r),a=new Array(r),o=new Array(r),s=0;s<r;++s)n=P9e(t[s]),i[s]=n.r||0,a[s]=n.g||0,o[s]=n.b||0;return i=e(i),a=e(a),o=e(o),n.opacity=1,function(e){return n.r=i(e),n.g=a(e),n.b=o(e),n+""}}}function X9e(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function G9e(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),a=new Array(n),o=0;o<r;++o)i[o]=r8e(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function K9e(e,t){var n=/* @__PURE__ */new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $9e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function J9e(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=r8e(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}Y9e(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return W9e((n-r/t)*t,o,i,a,s)}}),Y9e(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return W9e((n-r/t)*t,i,a,o,s)}});var e8e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,t8e=new RegExp(e8e.source,"g");function n8e(e,t){var n,r,i,a=e8e.lastIndex=t8e.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=e8e.exec(e))&&(r=t8e.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:$9e(n,r)})),a=t8e.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function r8e(e,t){var n,r=typeof t;return null==t||"boolean"===r?U9e(t):("number"===r?$9e:"string"===r?(n=z9e(t))?(t=n,Z9e):n8e:t instanceof z9e?Z9e:t instanceof Date?K9e:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?X9e:Array.isArray(t)?G9e:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?J9e:$9e)(e,t)}var i8e,a8e=180/Math.PI,o8e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function s8e(e,t,n,r,i,a){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*a8e,skewX:Math.atan(l)*a8e,scaleX:o,scaleY:s}}function l8e(e,t,n,r){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],l=[];return a=e(a),o=e(o),function(e,r,i,a,o,s){if(e!==i||r!==a){var l=o.push("translate(",null,t,null,n);s.push({i:l-4,x:$9e(e,i)},{i:l-2,x:$9e(r,a)})}else(i||a)&&o.push("translate("+i+t+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(e,t,n,a){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:$9e(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(a.rotate,o.rotate,s,l),function(e,t,n,a){e!==t?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:$9e(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(a.skewX,o.skewX,s,l),function(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:$9e(e,n)},{i:s-2,x:$9e(t,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var c8e=l8e(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?o8e:s8e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),d8e=l8e(function(e){return null==e?o8e:(i8e||(i8e=document.createElementNS("http://www.w3.org/2000/svg","g")),i8e.setAttribute("transform",e),(e=i8e.transform.baseVal.consolidate())?s8e((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):o8e)},", ",")",")");function u8e(e){return((e=Math.exp(e))+1/e)/2}var h8e,f8e,p8e=function e(t,n,r){function i(e,i){var a,o,s=e[0],l=e[1],c=e[2],d=i[0],u=i[1],h=i[2],f=d-s,p=u-l,m=f*f+p*p;if(m<1e-12)o=Math.log(h/c)/t,a=function(e){return[s+e*f,l+e*p,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(h*h-c*c+r*m)/(2*c*n*g),b=(h*h-c*c-r*m)/(2*h*n*g),y=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(b*b+1)-b)-y)/t,a=function(e){var r=e*o,i=u8e(y),a=c/(n*g)*(i*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*r+y)-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[s+a*f,l+a*p,c*i/u8e(t*r+y)]}}return a.duration=1e3*o*t/Math.SQRT2,a}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),m8e=0,g8e=0,v8e=0,b8e=0,y8e=0,x8e=0,w8e="object"==typeof performance&&performance.now?performance:Date,O8e="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function k8e(){return y8e||(O8e(S8e),y8e=w8e.now()+x8e)}function S8e(){y8e=0}function C8e(){this._call=this._time=this._next=null}function E8e(e,t,n){var r=new C8e;return r.restart(e,t,n),r}function N8e(){y8e=(b8e=w8e.now())+x8e,m8e=g8e=0;try{!function(){k8e(),++m8e;for(var e,t=h8e;t;)(e=y8e-t._time)>=0&&t._call.call(void 0,e),t=t._next;--m8e}()}finally{m8e=0,function(){for(var e,t,n=h8e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:h8e=t);f8e=e,A8e(r)}(),y8e=0}}function z8e(){var e=w8e.now(),t=e-b8e;t>1e3&&(x8e-=t,b8e=e)}function A8e(e){m8e||(g8e&&(g8e=clearTimeout(g8e)),e-y8e>24?(e<1/0&&(g8e=setTimeout(N8e,e-w8e.now()-x8e)),v8e&&(v8e=clearInterval(v8e))):(v8e||(b8e=w8e.now(),v8e=setInterval(z8e,1e3)),m8e=1,O8e(N8e)))}function T8e(e,t,n){var r=new C8e;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}C8e.prototype=E8e.prototype={constructor:C8e,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?k8e():+n)+(null==t?0:+t),this._next||f8e===this||(f8e?f8e._next=this:h8e=this,f8e=this),this._call=e,this._time=n,A8e()},stop:function(){this._call&&(this._call=null,this._time=1/0,A8e())}};var P8e=D4e("start","end","cancel","interrupt"),M8e=[];function I8e(e,t,n,r,i,a){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function a(l){var c,d,u,h;if(1!==n.state)return s();for(c in i)if((h=i[c]).name===n.name){if(3===h.state)return T8e(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[c]):+c<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[c])}if(T8e(function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function o(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(s),n.state=5,1),a=-1,o=r.length;++a<o;)r[a].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=E8e(function(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)},0,n.time)}(e,n,{name:t,index:r,group:i,on:P8e,tween:M8e,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function R8e(e,t){var n=L8e(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function D8e(e,t){var n=L8e(e,t);if(n.state>3)throw new Error("too late; already running");return n}function L8e(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function j8e(e,t){var n,r,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(n=a[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete e.__transition}}function V8e(e,t){var n,r;return function(){var i=D8e(this,e),a=i.tween;if(a!==n)for(var o=0,s=(r=n=a).length;o<s;++o)if(r[o].name===t){(r=r.slice()).splice(o,1);break}i.tween=r}}function Q8e(e,t,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=D8e(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=s;break}l===c&&i.push(s)}a.tween=i}}function B8e(e,t,n){var r=e._id;return e.each(function(){var e=D8e(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return L8e(e,r).value[t]}}function F8e(e,t){var n;return("number"==typeof t?$9e:t instanceof z9e?Z9e:(n=z9e(t))?(t=n,Z9e):n8e)(e,t)}function _8e(e){return function(){this.removeAttribute(e)}}function q8e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function W8e(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttribute(e);return o===a?null:o===r?i:i=t(r=o,n)}}function U8e(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===r?i:i=t(r=o,n)}}function H8e(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(e))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttribute(e)}}function Z8e(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttributeNS(e.space,e.local)}}function Y8e(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function X8e(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function G8e(e,t){return function(){R8e(this,e).delay=+t.apply(this,arguments)}}function K8e(e,t){return t=+t,function(){R8e(this,e).delay=t}}function $8e(e,t){return function(){D8e(this,e).duration=+t.apply(this,arguments)}}function J8e(e,t){return t=+t,function(){D8e(this,e).duration=t}}var e7e=Y6e.prototype.constructor;function t7e(e){return function(){this.style.removeProperty(e)}}var n7e=0;function r7e(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function i7e(){return++n7e}var a7e=Y6e.prototype;r7e.prototype=function(e){return Y6e().transition(e)}.prototype={constructor:r7e,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=U4e(e));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s,l,c=r[o],d=c.length,u=a[o]=new Array(d),h=0;h<d;++h)(s=c[h])&&(l=e.call(s,s.__data__,h,c))&&("__data__"in s&&(l.__data__=s.__data__),u[h]=l,I8e(u[h],t,n,h,u,L8e(s,n)));return new r7e(a,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Z4e(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var l,c=r[s],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,f=e.call(l,l.__data__,u,c),p=L8e(l,n),m=0,g=f.length;m<g;++m)(h=f[m])&&I8e(h,t,n,m,f,p);a.push(f),o.push(l)}return new r7e(a,o,t,n)},selectChild:a7e.selectChild,selectChildren:a7e.selectChildren,filter:function(e){"function"!=typeof e&&(e=Y4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&l.push(a);return new r7e(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var l,c=t[s],d=n[s],u=c.length,h=o[s]=new Array(u),f=0;f<u;++f)(l=c[f]||d[f])&&(h[f]=l);for(;s<r;++s)o[s]=t[s];return new r7e(o,this._parents,this._name,this._id)},selection:function(){return new e7e(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=i7e(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,c=0;c<l;++c)if(o=s[c]){var d=L8e(o,t);I8e(o,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new r7e(r,this._parents,e,n)},call:a7e.call,nodes:a7e.nodes,node:a7e.node,size:a7e.size,empty:a7e.empty,each:a7e.each,on:function(e,t){var n=this._id;return arguments.length<2?L8e(this.node(),n).on.on(e):this.each(function(e,t,n){var r,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?R8e:D8e;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}(n,e,t))},attr:function(e,t){var n=B4e(e),r="transform"===n?d8e:F8e;return this.attrTween(e,"function"==typeof t?(n.local?Z8e:H8e)(n,r,B8e(this,"attr."+e,t)):null==t?(n.local?q8e:_8e)(n):(n.local?U8e:W8e)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=B4e(e);return this.tween(n,(r.local?Y8e:X8e)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?c8e:F8e;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var a=v6e(this,e),o=(this.style.removeProperty(e),v6e(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}(e,r)).on("end.style."+e,t7e(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,a;return function(){var o=v6e(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=v6e(this,e)),o===l?null:o===r&&l===i?a:(i=l,a=t(r=o,s))}}(e,r,B8e(this,"style."+e,t))).each(function(e,t){var n,r,i,a,o="style."+t,s="end."+o;return function(){var l=D8e(this,e),c=l.on,d=null==l.value[o]?a||(a=t7e(t)):void 0;c===n&&i===d||(r=(n=c).copy()).on(s,i=d),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,a=n+"";return function(){var o=v6e(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(B8e(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=L8e(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((null==t?V8e:Q8e)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?G8e:K8e)(t,e)):L8e(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?$8e:J8e)(t,e)):L8e(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){D8e(this,e).ease=t}}(t,e)):L8e(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;D8e(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},l={value:function(){0===--i&&a()}};n.each(function(){var n=D8e(this,r),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===i&&a()})},[Symbol.iterator]:a7e[Symbol.iterator]};var o7e={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function s7e(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Y6e.prototype.interrupt=function(e){return this.each(function(){j8e(this,e)})},Y6e.prototype.transition=function(e){var t,n;e instanceof r7e?(t=e._id,e=e._name):(t=i7e(),(n=o7e).time=k8e(),e=null==e?null:e+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,c=0;c<l;++c)(o=s[c])&&I8e(o,e,t,c,s,n||s7e(o,t));return new r7e(r,this._parents,e,t)};var l7e=e=>()=>e;function c7e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function d7e(e,t,n){this.k=e,this.x=t,this.y=n}d7e.prototype={constructor:d7e,scale:function(e){return 1===e?this:new d7e(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new d7e(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 u7e=new d7e(1,0,0);function h7e(e){for(;!e.__zoom;)if(!(e=e.parentNode))return u7e;return e.__zoom}function f7e(e){e.stopImmediatePropagation()}function p7e(e){e.preventDefault(),e.stopImmediatePropagation()}function m7e(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function g7e(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 v7e(){return this.__zoom||u7e}function b7e(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function y7e(){return navigator.maxTouchPoints||"ontouchstart"in this}function x7e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function w7e(){var e,t,n,r=m7e,i=g7e,a=x7e,o=b7e,s=y7e,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=p8e,h=D4e("start","zoom","end"),f=0,p=10;function m(e){e.property("__zoom",v7e).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new d7e(t,e.x,e.y)}function v(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new d7e(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,r){e.on("start.zoom",function(){x(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,a=arguments,o=x(e,a).event(r),s=i.apply(e,a),l=null==n?b(s):"function"==typeof n?n.apply(e,a):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,f=u(d.invert(l).concat(c/d.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=f(e),n=c/t[2];e=new d7e(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function x(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function O(e,...t){if(r.apply(this,arguments)){var n=x(this,t).event(e),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,o.apply(this,arguments)))),d=G6e(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=i.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[d,i.invert(d)],j8e(this),n.start()}p7e(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(v(g(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function k(e,...t){if(!n&&r.apply(this,arguments)){var i=e.currentTarget,o=x(this,t,!0).event(e),s=X6e(e.view).on("mousemove.zoom",function(e){if(p7e(e),!o.moved){var t=e.clientX-d,n=e.clientY-u;o.moved=t*t+n*n>f}o.event(e).zoom("mouse",a(v(o.that.__zoom,o.mouse[0]=G6e(e,i),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),n9e(e.view,o.moved),p7e(e),o.event(e).end()},!0),l=G6e(e,i),d=e.clientX,u=e.clientY;t9e(e.view),f7e(e),o.mouse=[l,this.__zoom.invert(l)],j8e(this),o.start()}}function S(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,o=G6e(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(o),l=n.k*(e.shiftKey?.5:2),u=a(v(g(n,l),o,s),i.apply(this,t),c);p7e(e),d>0?X6e(this).transition().duration(d).call(y,u,o,e):X6e(this).call(m.transform,u,o,e)}}function C(n,...i){if(r.apply(this,arguments)){var a,o,s,l,c=n.touches,d=c.length,u=x(this,i,n.changedTouches.length===d).event(n);for(f7e(n),o=0;o<d;++o)l=[l=G6e(s=c[o],this),this.__zoom.invert(l),s.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,a=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),j8e(this),u.start())}}function E(e,...t){if(this.__zooming){var n,r,i,o,s=x(this,t).event(e),l=e.changedTouches,d=l.length;for(p7e(e),n=0;n<d;++n)i=G6e(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var u=s.touch0[0],h=s.touch0[1],f=s.touch1[0],p=s.touch1[1],m=(m=f[0]-u[0])*m+(m=f[1]-u[1])*m,b=(b=p[0]-h[0])*b+(b=p[1]-h[1])*b;r=g(r,Math.sqrt(m/b)),i=[(u[0]+f[0])/2,(u[1]+f[1])/2],o=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],o=s.touch0[1]}s.zoom("touch",a(v(r,i,o),s.extent,c))}}function N(e,...r){if(this.__zooming){var i,a,o=x(this,r).event(e),s=e.changedTouches,l=s.length;for(f7e(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)a=s[i],o.touch0&&o.touch0[2]===a.identifier?delete o.touch0:o.touch1&&o.touch1[2]===a.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(a=G6e(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<p)){var c=X6e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property("__zoom",v7e),e!==i?y(e,t,n,r):i.interrupt().each(function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,r){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,r)},m.scaleTo=function(e,t,n,r){m.transform(e,function(){var e=i.apply(this,arguments),r=this.__zoom,o=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(o),l="function"==typeof t?t.apply(this,arguments):t;return a(v(g(r,l),o,s),e,c)},n,r)},m.translateBy=function(e,t,n,r){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},m.translateTo=function(e,t,n,r,o){m.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,s=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return a(u7e.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},r,o)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=X6e(this.that).datum();h.call(e,this.that,new c7e(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:h}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:l7e(+e),m):o},m.filter=function(e){return arguments.length?(r="function"==typeof e?e:l7e(!!e),m):r},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:l7e(!!e),m):s},m.extent=function(e){return arguments.length?(i="function"==typeof e?e:l7e([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):i},m.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],m):[l[0],l[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(u=e,m):u},m.on=function(){var e=h.on.apply(h,arguments);return e===h?m:e},m.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,m):Math.sqrt(f)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m}h7e.prototype=d7e.prototype;var O7e,k7e,S7e,C7e=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],E7e=["Enter"," ","Escape"],N7e={"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"};!function(e){e.Strict="strict",e.Loose="loose"}(O7e||(O7e={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(k7e||(k7e={})),function(e){e.Partial="partial",e.Full="full"}(S7e||(S7e={}));var z7e,A7e,T7e,P7e={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(z7e||(z7e={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(A7e||(A7e={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(T7e||(T7e={}));var M7e={[T7e.Left]:T7e.Right,[T7e.Right]:T7e.Left,[T7e.Top]:T7e.Bottom,[T7e.Bottom]:T7e.Top},I7e=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,R7e=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),D7e=(e,t=[0,0])=>{const{width:n,height:r}=set(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},L7e=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=W7e(n,Y7e(e)),r=!0)}),r?H7e(n):{x:0,y:0,width:0,height:0}},j7e=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{const s=(t.x-n)/i,l=(t.y-r)/i,c=t.width/i,d=t.height/i,u=[];for(const h of e.values()){const{measured:e,selectable:t=!0,hidden:n=!1}=h;if(o&&!t||n)continue;const r=e.width??h.width??h.initialWidth??0,i=e.height??h.height??h.initialHeight??0,{x:f,y:p}=h.internals.positionAbsolute,m=G7e(s,l,c,d,f,p,r,i),g=r*i,v=a&&m>0;(!h.internals.handleBounds||v||m>=g||h.dragging)&&u.push(h)}return u};function V7e({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){const o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let u=o.extent||i;if("parent"!==o.extent||o.expandParent)s&&oet(o.extent)&&(u=[[o.extent[0][0]+l,o.extent[0][1]+c],[o.extent[1][0]+l,o.extent[1][1]+c]]);else if(s){const{width:e,height:t}=set(s);e&&t&&(u=[[l,c],[l+e,c+t]])}else a?.("005","Only child nodes can use a parent extent.");const h=oet(u)?B7e(t,u,o.measured):t;return void 0!==o.measured.width&&void 0!==o.measured.height||a?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:h.x-l+(o.measured.width??0)*d[0],y:h.y-c+(o.measured.height??0)*d[1]},positionAbsolute:h}}var Q7e=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),B7e=(e={x:0,y:0},t,n)=>({x:Q7e(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Q7e(e.y,t[0][1],t[1][1]-(n?.height??0))});function F7e(e,t,n){const{width:r,height:i}=set(n),{x:a,y:o}=n.internals.positionAbsolute;return B7e(e,[[a,o],[a+r,o+i]],t)}var _7e=(e,t,n)=>e<t?Q7e(Math.abs(e-t),1,t)/t:e>n?-Q7e(Math.abs(e-n),1,t)/t:0,q7e=(e,t,n=15,r=40)=>[_7e(e.x,r,t.width-r)*n,_7e(e.y,r,t.height-r)*n],W7e=(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)}),U7e=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),H7e=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Z7e=(e,t=[0,0])=>{const{x:n,y:r}=R7e(e)?e.internals.positionAbsolute:D7e(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Y7e=(e,t=[0,0])=>{const{x:n,y:r}=R7e(e)?e.internals.positionAbsolute:D7e(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},X7e=(e,t)=>H7e(W7e(U7e(e),U7e(t))),G7e=(e,t,n,r,i,a,o,s)=>{const l=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),c=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(l*c)},K7e=(e,t)=>G7e(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$7e=e=>J7e(e.width)&&J7e(e.height)&&J7e(e.x)&&J7e(e.y),J7e=e=>!isNaN(e)&&isFinite(e),eet=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),tet=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return a?eet(s,o):s},net=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ret(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return 0}var iet=(e,t,n,r,i,a)=>{const o=function(e,t,n){if("string"==typeof e||"number"==typeof e){const r=ret(e,n),i=ret(e,t);return{top:r,right:i,bottom:r,left:i,x:2*i,y:2*r}}if("object"==typeof e){const r=ret(e.top??e.y??0,n),i=ret(e.bottom??e.y??0,n),a=ret(e.left??e.x??0,t),o=ret(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(a,t,n),s=(t-o.x)/e.width,l=(n-o.y)/e.height,c=Q7e(Math.min(s,l),r,i),d=t/2-(e.x+e.width/2)*c,u=n/2-(e.y+e.height/2)*c,h=function(e,t,n,r,i,a){const{x:o,y:s}=net(e,[t,n,r]),{x:l,y:c}=net({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-l,u=a-c;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(d),bottom:Math.floor(u)}}(e,d,u,c,t,n),f=Math.min(h.left-o.left,0),p=Math.min(h.top-o.top,0);return{x:d-f+Math.min(h.right-o.right,0),y:u-p+Math.min(h.bottom-o.bottom,0),zoom:c}},aet=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function oet(e){return null!=e&&"parent"!==e}function set(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cet(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function det(e,t={width:0,height:0},n,r,i){const a={...e},o=r.get(n);if(o){const e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function uet(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function het(e){return{...N7e,...e||{}}}function fet(e){return null===e?null:e?"valid":"invalid"}function pet(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:a,y:o}=xet(e),s=tet({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:l,y:c}=n?eet(s,t):s;return{xSnapped:l,ySnapped:c,...s}}var met=e=>({width:e.offsetWidth,height:e.offsetHeight}),get=e=>e?.getRootNode?.()||window?.document,vet=["INPUT","SELECT","TEXTAREA"];function bet(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(vet.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}var yet=e=>"clientX"in e,xet=(e,t)=>{const n=yet(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wet=(e,t,n,r,i)=>{const a=t.querySelectorAll(`.${e}`);return a&&a.length?Array.from(a).map(t=>{const a=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:i,position:t.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...met(t)}}):null};function Oet({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){const l=.125*e+.375*i+.375*o+.125*n,c=.125*t+.375*a+.375*s+.125*r;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ket(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function Cet({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case T7e.Left:return[t-ket(t-r,a),n];case T7e.Right:return[t+ket(r-t,a),n];case T7e.Top:return[t,n-ket(n-i,a)];case T7e.Bottom:return[t,n+ket(i-n,a)]}}function Eet({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top,curvature:o=.25}){const[s,l]=Cet({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[c,d]=Cet({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[u,h,f,p]=Oet({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${s},${l} ${c},${d} ${r},${i}`,u,h,f,p]}function Net({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function zet({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const a=W7e(Y7e(e),Y7e(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return K7e(o,H7e(a))>0}var Aet=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`;function Tet({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,a,o,s]=Net({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Pet={[T7e.Left]:{x:-1,y:0},[T7e.Right]:{x:1,y:0},[T7e.Top]:{x:0,y:-1},[T7e.Bottom]:{x:0,y:1}},Met=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Iet(e,t,n,r){const i=Math.min(Met(e,t)/2,Met(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o)return`L ${a+i*(e.x<n.x?-1:1)},${o}Q ${a},${o} ${a},${o+i*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function Ret({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top,borderRadius:o=5,centerX:s,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,h,f,p,m]=function({source:e,sourcePosition:t=T7e.Bottom,target:n,targetPosition:r=T7e.Top,center:i,offset:a,stepPosition:o}){const s=Pet[t],l=Pet[r],c={x:e.x+s.x*a,y:e.y+s.y*a},d={x:n.x+l.x*a,y:n.y+l.y*a},u=(({source:e,sourcePosition:t=T7e.Bottom,target:n})=>t===T7e.Left||t===T7e.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})({source:c,sourcePosition:t,target:d}),h=0!==u.x?"x":"y",f=u[h];let p,m,g=[];const v={x:0,y:0},b={x:0,y:0},[,,y,x]=Net({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[h]*l[h]===-1){"x"===h?(p=i.x??c.x+(d.x-c.x)*o,m=i.y??(c.y+d.y)/2):(p=i.x??(c.x+d.x)/2,m=i.y??c.y+(d.y-c.y)*o);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:m},{x:d.x,y:m}];g=s[h]===f?"x"===h?e:t:"x"===h?t:e}else{const i=[{x:c.x,y:d.y}],o=[{x:d.x,y:c.y}];if(g="x"===h?s.x===f?o:i:s.y===f?i:o,t===r){const t=Math.abs(e[h]-n[h]);if(t<=a){const r=Math.min(a-1,a-t);s[h]===f?v[h]=(c[h]>e[h]?-1:1)*r:b[h]=(d[h]>n[h]?-1:1)*r}}if(t!==r){const e="x"===h?"y":"x",t=s[h]===l[e],n=c[e]>d[e],r=c[e]<d[e];(1===s[h]&&(!t&&n||t&&r)||1!==s[h]&&(!t&&r||t&&n))&&(g="x"===h?i:o)}const u={x:c.x+v.x,y:c.y+v.y},y={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(u.x-g[0].x),Math.abs(y.x-g[0].x))>=Math.max(Math.abs(u.y-g[0].y),Math.abs(y.y-g[0].y))?(p=(u.x+y.x)/2,m=g[0].y):(p=g[0].x,m=(u.y+y.y)/2)}const w={x:c.x+v.x,y:c.y+v.y},O={x:d.x+b.x,y:d.y+b.y};return[[e,...w.x!==g[0].x||w.y!==g[0].y?[w]:[],...g,...O.x!==g[g.length-1].x||O.y!==g[g.length-1].y?[O]:[],n],p,m,y,x]}({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:l},offset:c,stepPosition:d});let g=`M${u[0].x} ${u[0].y}`;for(let v=1;v<u.length-1;v++)g+=Iet(u[v-1],u[v],u[v+1],o);return g+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[g,h,f,p,m]}function Det(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Let(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,"source"===r.type?t.push(r):"target"===r.type&&n.push(r);return{source:t,target:n}}function jet(e,t,n=T7e.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??set(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case T7e.Top:return{x:i+o/2,y:a};case T7e.Right:return{x:i+o,y:a+s/2};case T7e.Bottom:return{x:i+o/2,y:a+s};case T7e.Left:return{x:i,y:a+s/2}}}function Vet(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Qet(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}var Bet={nodeOrigin:[0,0],nodeExtent:C7e,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Fet={...Bet,checkEquality:!0};function _et(e,t){const n={...e};for(const r in t)void 0!==t[r]&&(n[r]=t[r]);return n}function qet(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const t={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};"source"===i.type?n.push(t):"target"===i.type&&r.push(t)}return{source:n,target:r}}function Wet(e){return"manual"===e}function Uet(e,t,n,r={}){const i=_et(Fet,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Wet(i.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=o.get(d.id);if(i.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=D7e(d,i.nodeOrigin),r=oet(d.extent)?d.extent:i.nodeExtent,a=B7e(n,r,set(d));e={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:a,handleBounds:qet(d,e),z:Zet(d,s,i.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Het(e,t,n,r,a),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Het(e,t,n,r,i){const{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:l}=_et(Bet,r),c=e.parentId,d=t.get(c);if(!d)return;!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,/* @__PURE__ */new Map([[e.id,e]]))}(e,n),i&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+10*i.i),i&&void 0!==d.internals.rootParentIndex&&(i.i=d.internals.rootParentIndex);const{x:u,y:h,z:f}=function(e,t,n,r,i,a){const{x:o,y:s}=t.internals.positionAbsolute,l=set(e),c=D7e(e,n),d=oet(e.extent)?B7e(c,e.extent,l):c;let u=B7e({x:o+d.x,y:s+d.y},r,l);"parent"===e.extent&&(u=F7e(u,l,t));const h=Zet(e,i,a),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=h?f+1:h}}(e,d,o,s,a&&!Wet(l)?1e3:0,l),{positionAbsolute:p}=e.internals,m=u!==p.x||h!==p.y;(m||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:u,y:h}:p,z:f}})}function Zet(e,t,n){const r=J7e(e.zIndex)?e.zIndex:0;return Wet(n)?r:r+(e.selected?t:0)}function Yet(e,t,n,r=[0,0]){const i=[],a=/* @__PURE__ */new Map;for(const o of e){const e=t.get(o.parentId);if(!e)continue;const n=a.get(o.parentId)?.expandedRect??Z7e(e),r=X7e(n,o.rect);a.set(o.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{const s=a.internals.positionAbsolute,l=set(a),c=a.origin??r,d=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,u=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),p=(h-l.width)*c[0],m=(f-l.height)*c[1];(d>0||u>0||p||m)&&(i.push({id:o,type:"position",position:{x:a.position.x-d+p,y:a.position.y-u+m}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&i.push({id:o,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?c[0]*d-p:0),height:f+(u?c[1]*u-m:0)}})}),i}function Xet(e,t,n,r,i,a){let o=i;const s=r.get(o)||/* @__PURE__ */new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;const l=r.get(o)||/* @__PURE__ */new Map;if(r.set(o,l.set(n,t)),a){o=`${i}-${e}-${a}`;const s=r.get(o)||/* @__PURE__ */new Map;r.set(o,s.set(n,t))}}function Get(e,t,n){e.clear(),t.clear();for(const r of n){const{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},l=`${n}-${a}--${i}-${o}`;Xet("source",s,`${i}-${o}--${n}-${a}`,e,n,a),Xet("target",s,l,e,i,o),t.set(r.id,r)}}function Ket(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ket(n,t))}function $et(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Jet({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[o,s]of t){const e=n.get(o)?.internals.userNode;e&&i.push({...e,position:s.position,dragging:r})}if(!e)return[i[0],i];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function ett(e,t,n,r,i,a=!1){const o=r.get(e);if(!o)return null;const s="strict"===i?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&a?{...l,...jet(o,l,l.position,!0)}:l}function ttt(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}var ntt=()=>!0;function rtt(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:l,isValidConnection:c=ntt,nodeLookup:d}){const u="target"===a,h=t?o.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:p}=xet(e),m=o.elementFromPoint(f,p),g=m?.classList.contains(`${s}-flow__handle`)?m:h,v={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const e=ttt(void 0,g),t=g.getAttribute("data-nodeid"),a=g.getAttribute("data-handleid"),o=g.classList.contains("connectable"),s=g.classList.contains("connectableend");if(!t||!e)return v;const l={source:u?t:r,sourceHandle:u?a:i,target:u?r:t,targetHandle:u?i:a};v.connection=l,v.isValid=o&&s&&(n===O7e.Strict?u&&"source"===e||!u&&"target"===e:t!==r||a!==i)&&c(l),v.toHandle=ett(t,e,a,d,n,!0)}return v}var itt,att={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:h,cancelConnection:f,onConnectStart:p,onConnect:m,onConnectEnd:g,isValidConnection:v=ntt,onReconnectEnd:b,updateConnection:y,getTransform:x,getFromHandle:w,autoPanSpeed:O,dragThreshold:k=1,handleDomNode:S}){const C=get(e.target);let E,N=0;const{x:z,y:A}=xet(e),T=ttt(a,S),P=s?.getBoundingClientRect();let M=!1;if(!P||!T)return;const I=ett(i,T,r,l,t);if(!I)return;let R=xet(e,P),D=!1,L=null,j=!1,V=null;function Q(){if(!d||!P)return;const[e,t]=q7e(R,P,O);h({x:e,y:t}),N=requestAnimationFrame(Q)}const B={...I,nodeId:i,type:T,position:I.position},F=l.get(i);let _={inProgress:!0,isValid:null,from:jet(F,B,T7e.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:F,to:R,toHandle:null,toPosition:M7e[B.position],toNode:null,pointer:R};function q(){M=!0,y(_),p?.(e,{nodeId:i,handleId:r,handleType:T})}function W(e){if(!M){const{x:t,y:n}=xet(e),r=t-z,i=n-A;if(!(r*r+i*i>k*k))return;q()}if(!w()||!B)return void U(e);const a=x();R=xet(e,P),E=function(e,t,n,r){let i=[],a=1/0;const o=function(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const a of t.values())K7e(i,Z7e(a))>0&&r.push(a);return r}(e,n,t+250);for(const s of o){const n=[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]];for(const o of n){if(r.nodeId===o.nodeId&&r.type===o.type&&r.id===o.id)continue;const{x:n,y:l}=jet(s,o,o.position,!0),c=Math.sqrt(Math.pow(n-e.x,2)+Math.pow(l-e.y,2));c>t||(c<a?(i=[{...o,x:n,y:l}],a=c):c===a&&i.push({...o,x:n,y:l}))}}if(!i.length)return null;if(i.length>1){const e="source"===r.type?"target":"source";return i.find(t=>t.type===e)??i[0]}return i[0]}(tet(R,a,!1,[1,1]),n,l,B),D||(Q(),D=!0);const s=rtt(e,{handle:E,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:v,doc:C,lib:c,flowId:u,nodeLookup:l});V=s.handleDomNode,L=s.connection,j=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!E,s.isValid);const d=l.get(i),h=d?jet(d,B,T7e.Left,!0):_.from,f={..._,from:h,isValid:j,to:s.toHandle&&j?net({x:s.toHandle.x,y:s.toHandle.y},a):R,toHandle:s.toHandle,toPosition:j&&s.toHandle?s.toHandle.position:M7e[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null,pointer:R};y(f),_=f}function U(e){if(!("touches"in e&&e.touches.length>0)){if(M){(E||V)&&L&&j&&m?.(L);const{inProgress:t,...n}=_,r={...n,toPosition:_.toHandle?_.toPosition:null};g?.(e,r),a&&b?.(e,r)}f(),cancelAnimationFrame(N),D=!1,j=!1,L=null,V=null,C.removeEventListener("mousemove",W),C.removeEventListener("mouseup",U),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",U)}}0===k&&q(),C.addEventListener("mousemove",W),C.addEventListener("mouseup",U),C.addEventListener("touchmove",W),C.addEventListener("touchend",U)},isValid:rtt},ott=e=>({x:e.x,y:e.y,zoom:e.k}),stt=({x:e,y:t,zoom:n})=>u7e.translate(e,t).scale(n),ltt=(e,t)=>e.target.closest(`.${t}`),ctt=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),dtt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,utt=(e,t=0,n=dtt,r=()=>{})=>{const i="number"==typeof t&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},htt=e=>{const t=e.ctrlKey&&aet()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function ftt(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ptt(e,t){return Math.max(0,t-e)}function mtt(e,t){return Math.max(0,e-t)}function gtt(e,t,n){return Math.max(0,t-e,e-n)}function vtt(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(itt||(itt={}));var btt={width:0,height:0,x:0,y:0},ytt={...btt,pointerX:0,pointerY:0,aspectRatio:1};function xtt(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,l=n[1]*o;return[[r-s,i-l],[r+a-s,i+o-l]]}var{useRef:wtt,useEffect:Ott,useMemo:ktt,useDebugValue:Stt}=e,Ctt={useSyncExternalStoreWithSelector:(e,t,n,r,i)=>{const a=wtt(null);let o;null===a.current?(o={hasValue:!1,value:null},a.current=o):o=a.current;const[s,l]=ktt(()=>{let e,a,s=!1;const l=t=>{if(!s){s=!0,e=t;const n=r(t);if(void 0!==i&&o.hasValue){const e=o.value;if(i(e,n))return a=e,e}return a=n,n}const n=e,l=a;if(Object.is(n,t))return l;const c=r(t);return void 0!==i&&i(l,c)?(e=t,l):(e=t,a=c,c)},c=void 0===n?null:n;return[()=>l(t()),null===c?void 0:()=>l(c())]},[t,n,r,i]),c=N(e,s,l);return Ott(()=>{o.hasValue=!0,o.value=c},[c]),Stt(c),c}},Ett=e=>{let t;const n=/* @__PURE__ */new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},{useDebugValue:Ntt}=t,{useSyncExternalStoreWithSelector:ztt}=Ctt,Att=e=>e;function Ttt(e,t=Att,n){const r=ztt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ntt(r),r}var Ptt=(e,t)=>{const n=(e=>e?Ett(e):Ett)(e),r=(e,r=t)=>Ttt(n,e,r);return Object.assign(r,n),r};function Mtt(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Itt=l(null),Rtt=Itt.Provider,Dtt=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function Ltt(e,t){const n=v(Itt);if(null===n)throw new Error(Dtt);return Ttt(n,e,t)}function jtt(){const e=v(Itt);if(null===e)throw new Error(Dtt);return k(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Vtt={display:"none"},Qtt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Btt="react-flow__node-desc",Ftt="react-flow__edge-desc",_tt=e=>e.ariaLiveMessage,qtt=e=>e.ariaLabelConfig;function Wtt({rfId:e}){const t=Ltt(_tt);return T("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Qtt,children:t})}function Utt({rfId:e,disableKeyboardA11y:t}){const n=Ltt(qtt);return P(A,{children:[T("div",{id:`${Btt}-${e}`,style:Vtt,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T("div",{id:`${Ftt}-${e}`,style:Vtt,children:n["edge.a11yDescription.default"]}),!t&&T(Wtt,{rfId:e})]})}var Htt=u(({position:e="top-left",children:t,className:n,style:r,...i},a)=>{const o=`${e}`.split("-");return T("div",{className:I4e(["react-flow__panel",n,...o]),style:r,ref:a,...i,children:t})});Htt.displayName="Panel";var Ztt="https://reactflow.dev?utm_source=attribution";function Ytt({proOptions:e,position:t="bottom-right"}){return y(()=>{},[]),e?.hideAttribution?null:T(Htt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ztt}`,children:T("a",{href:Ztt,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xtt=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Gtt=e=>e.id;function Ktt(e,t){return Mtt(e.selectedNodes.map(Gtt),t.selectedNodes.map(Gtt))&&Mtt(e.selectedEdges.map(Gtt),t.selectedEdges.map(Gtt))}function $tt({onSelectionChange:e}){const t=jtt(),{selectedNodes:n,selectedEdges:r}=Ltt(Xtt,Ktt);return y(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Jtt=e=>!!e.onSelectionChangeHandlers;function ent({onSelectionChange:e}){const t=Ltt(Jtt);return e||t?T($tt,{onSelectionChange:e}):null}var tnt=[0,0],nnt={x:0,y:0,zoom:1},rnt=["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","rfId"],int=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}),ant={translateExtent:C7e,nodeOrigin:tnt,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ont(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:l}=Ltt(int,Mtt),c=jtt();y(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=ant,s()}),[]);const d=C(ant);return y(()=>{for(const s of rnt){const l=e[s];l!==d.current[s]&&void 0!==e[s]&&("nodes"===s?t(l):"edges"===s?n(l):"minZoom"===s?r(l):"maxZoom"===s?i(l):"translateExtent"===s?a(l):"nodeExtent"===s?o(l):"ariaLabelConfig"===s?c.setState({ariaLabelConfig:het(l)}):"fitView"===s?c.setState({fitViewQueued:l}):"fitViewOptions"===s?c.setState({fitViewOptions:l}):c.setState({[s]:l}))}d.current=e},rnt.map(t=>e[t])),null}function snt(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}var lnt="undefined"!=typeof document?document:null;function cnt(e=null,t={target:lnt,actInsideInputWithModifier:!0}){const[n,r]=E(!1),i=C(!1),a=C(/* @__PURE__ */new Set([])),[o,s]=k(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n"));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return y(()=>{const n=t?.target??lnt,l=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!l)&&bet(e))return!1;const n=unt(e.code,s);if(a.current.add(e[n]),dnt(o,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,a="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&a||e.preventDefault(),r(!0)}},c=e=>{const t=unt(e.code,s);dnt(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function dnt(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function unt(e,t){return t.includes(e)?"code":"key"}function hnt(e,t){const n=[],r=/* @__PURE__ */new Map,i=[];for(const a of e)if("add"!==a.type)if("remove"===a.type||"replace"===a.type)r.set(a.id,[a]);else{const e=r.get(a.id);e?e.push(a):r.set(a.id,[a])}else i.push(a);for(const a of t){const e=r.get(a.id);if(!e){n.push(a);continue}if("remove"===e[0].type)continue;if("replace"===e[0].type){n.push({...e[0].item});continue}const t={...a};for(const n of e)fnt(n,t);n.push(t)}return i.length&&i.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function fnt(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function pnt(e,t){return hnt(e,t)}function mnt(e,t){return hnt(e,t)}function gnt(e,t){return{id:e,type:"select",selected:t}}function vnt(e,t=/* @__PURE__ */new Set,n=!1){const r=[];for(const[i,a]of e){const e=t.has(i);void 0===a.selected&&!e||a.selected===e||(n&&(a.selected=e),r.push(gnt(a.id,e)))}return r}function bnt({items:e=[],lookup:t}){const n=[],r=new Map(e.map(e=>[e.id,e]));for(const[i,a]of e.entries()){const e=t.get(a.id),r=e?.internals?.userNode??e;void 0!==r&&r!==a&&n.push({id:a.id,item:a,type:"replace"}),void 0===r&&n.push({item:a,type:"add",index:i})}for(const[i]of t)void 0===r.get(i)&&n.push({id:i,type:"remove"});return n}function ynt(e){return{id:e.id,type:"remove"}}var xnt=(e,t)=>{};var wnt=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function Ont(e){return u(e)}var knt="undefined"!=typeof window?O:y;function Snt(e){const[t,n]=E(BigInt(0)),[r]=E(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return knt(()=>{const t=r.get();t.length&&(e(t),r.reset())},[t]),r}var Cnt=l(null);function Ent({children:e}){const t=jtt(),n=Snt(g(e=>{const{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=bnt({items:c,lookup:o});for(const t of l.values())d=t(d);i&&r(c),d.length>0?a?.(d):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Snt(g(e=>{const{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState();let s=n;for(const t of e)s="function"==typeof t?t(s):t;i?r(s):a&&a(bnt({items:s,lookup:o}))},[])),i=k(()=>({nodeQueue:n,edgeQueue:r}),[]);return T(Cnt.Provider,{value:i,children:e})}var Nnt=e=>!!e.panZoom;function znt(){const e=(()=>{const e=jtt();return k(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return!!r&&r.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,a],panZoom:o}=e.getState();return!!o&&(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),l=iet(t,r,i,a,o,n?.padding??.1);return!!s&&(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;const{x:s,y:l}=o.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},d=n.snapGrid??i,u=n.snapToGrid??a;return tet(c,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:a}=r.getBoundingClientRect(),o=net(t,n);return{x:o.x+i,y:o.y+a}}}),[])})(),t=jtt(),n=function(){const e=v(Cnt);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Ltt(Nnt),i=k(()=>{const e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{const{nodeLookup:n,nodeOrigin:r}=t.getState(),i=wnt(e)?e:n.get(e.id),a=i.parentId?det(i.position,i.measured,i.parentId,n,r):i.position,o={...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height};return Z7e(o)},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){const e="function"==typeof t?t(r):t;return n.replace&&wnt(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){const e="function"==typeof t?t(r):t;return n.replace&&I7e(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:h}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const a=new Set(e.map(e=>e.id)),o=[];for(const u of n){if(!1===u.deletable)continue;const e=a.has(u.id),t=!e&&u.parentId&&o.find(e=>e.id===u.parentId);(e||t)&&o.push(u)}const s=new Set(t.map(e=>e.id)),l=r.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=/* @__PURE__ */new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(o,l);for(const u of l)s.has(u.id)&&!c.find(e=>e.id===u.id)&&c.push(u);if(!i)return{edges:c,nodes:o};const d=await i({nodes:o,edges:c});return"boolean"==typeof d?d?{edges:c,nodes:o}:{edges:[],nodes:[]}:d}({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:d}),f=h.length>0,p=u.length>0;if(f){const e=h.map(ynt);o?.(h),l(e)}if(p){const e=u.map(ynt);a?.(u),s(e)}return(p||f)&&c?.({nodes:u,edges:h}),{deletedNodes:u,deletedEdges:h}},getIntersectingNodes:(e,n=!0,r)=>{const i=$7e(e),o=i?e:a(e),s=void 0!==r;return o?(r||t.getState().nodes).filter(r=>{const a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;const l=Z7e(s?r:a),c=K7e(l,o);return n&&c>0||c>=l.width*l.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const r=$7e(e)?e:a(e);if(!r)return!1;const i=K7e(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{const r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:r}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((e,r)=>{const i="string"==typeof r;let a=t.nodeLookup||i?void 0:r;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):R7e(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,W7e(e,Y7e(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?H7e(r):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const r=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return k(()=>({...i,...e,viewportInitialized:r}),[r])}var Ant=e=>e.selected,Tnt="undefined"!=typeof window?window:void 0,Pnt={position:"absolute",width:"100%",height:"100%",top:0,left:0},Mnt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Int({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=k7e.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:v,noPanClassName:b,onViewportChange:x,isControlledViewport:w,paneClickDistance:O,selectionOnDrag:k}){const S=jtt(),E=C(null),{userSelectionActive:N,lib:z,connectionInProgress:A}=Ltt(Mnt,Mtt),P=cnt(f),M=C();!function(e){const t=jtt();y(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=met(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(E);const I=g(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),w||S.setState({transform:e})},[x,w]);return y(()=>{if(E.current){M.current=function({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];("undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);const h=w7e().extent(()=>u).scaleExtent([t,n]).translateExtent(r),f=X6e(e).call(h);b({x:i.x,y:i.y,zoom:Q7e(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=f.on("wheel.zoom"),m=f.on("dblclick.zoom");async function g(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).transform(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})}function v(){h.on("zoom",null)}async function b(e,t,n){const r=stt(e),i=h?.constrain()(r,t,n);return i&&await g(i),i}return h.wheelDelta(htt),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:g,preventScrolling:b,zoomOnPinch:y,zoomOnScroll:x,zoomOnDoubleClick:w,panActivationKeyPressed:O=!1,zoomActivationKeyPressed:k,lib:S,onTransformChange:C,connectionInProgress:E,paneClickDistance:N,selectionOnDrag:z}){r&&!c.isZoomingOrPanning&&v();const A=i&&!k&&!r;h.clickDistance(z?1/0:!J7e(N)||N<0?0:N);const T=A?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(ltt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&o){const e=G6e(d),t=htt(d),i=u*Math.pow(2,t);return void r.scaleTo(n,i,e,d)}const h=1===d.deltaMode?20:1;let f=i===k7e.Vertical?0:d.deltaX*h,p=i===k7e.Horizontal?0:d.deltaY*h;!aet()&&d.shiftKey&&i!==k7e.Vertical&&(f=d.deltaY*h,p=0),r.translateBy(n,-f/u*a,-p/u*a,{internal:!0});const m=ott(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,m):(e.isPanScrolling=!0,s?.(d,m)),e.panScrollTimeout=setTimeout(()=>{c?.(d,m),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:f,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const a="wheel"===r.type,o=!t&&a&&!r.ctrlKey,s=ltt(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}({noWheelClassName:e,preventScrolling:b,d3ZoomHandler:p});f.on("wheel.zoom",T,{passive:!1});const P=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=ott(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,"mousedown"===r.sourceEvent?.type&&t(!0),n&&n?.(r.sourceEvent,i)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:o});h.on("start",P);const M=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!(!n||!ctt(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ott(a.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:C});h.on("zoom",M);const I=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ctt(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const t=ott(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:l});h.on("end",I);const R=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return h=>{const f=t||n,p=r&&h.ctrlKey,m="wheel"===h.type;if(1===h.button&&"mousedown"===h.type&&(ltt(h,`${d}-flow__node`)||ltt(h,`${d}-flow__edge`)||ltt(h,`${d}-flow__selection`)||ltt(h,`${d}-flow__nodesselection`)))return!0;if(!(i||f||a||o||r))return!1;if(s)return!1;if(u&&!m)return!1;if(ltt(h,l)&&m)return!1;if(ltt(h,c)&&(!m||a&&m&&!t))return!1;if(!r&&h.ctrlKey&&m)return!1;if(!r&&"touchstart"===h.type&&h.touches?.length>1)return h.preventDefault(),!1;if(!f&&!a&&!p&&m)return!1;if(!i&&("mousedown"===h.type||"touchstart"===h.type))return!1;if(Array.isArray(i)&&!i.includes(h.button)&&"mousedown"===h.type)return!1;const g=Array.isArray(i)&&i.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||m||e)&&g}}({panActivationKeyPressed:O,zoomActivationKeyPressed:k,panOnDrag:d,zoomOnScroll:x,panOnScroll:i,zoomOnDoubleClick:w,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:S,connectionInProgress:E});h.filter(R),w?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)},destroy:v,setViewport:async function(e,t){const n=stt(e);return await g(n,t),n},setViewportConstrained:b,getViewport:function(){const e=f?h7e(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).scaleTo(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).scaleBy(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(f){const t=stt(e),n=f.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(f,t,null,{sync:!0})}},setClickDistance:function(e){const t=!J7e(e)||e<0?0:e;h?.clickDistance(t)}}}({domNode:E.current,minZoom:u,maxZoom:h,translateExtent:d,viewport:c,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{M.current?.destroy()}}},[]),y(()=>{M.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:P,preventScrolling:p,noPanClassName:b,userSelectionActive:N,noWheelClassName:v,lib:z,onTransformChange:I,connectionInProgress:A,selectionOnDrag:k,paneClickDistance:O})},[e,t,n,r,i,a,o,s,l,P,p,b,N,v,z,I,A,k,O]),T("div",{className:"react-flow__renderer",ref:E,style:Pnt,children:m})}var Rnt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Dnt(){const{userSelectionActive:e,userSelectionRect:t}=Ltt(Rnt,Mtt);return e&&t?T("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Lnt=(e,t)=>n=>{n.target===t.current&&e?.(n)},jnt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Vnt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=S7e.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){const g=C(0),v=jtt(),{userSelectionActive:b,elementsSelectable:x,dragging:w,panBy:O,autoPanSpeed:k}=Ltt(jnt,Mtt),S=x&&(e||b),E=C(null),N=C(),z=C(/* @__PURE__ */new Set),A=C(/* @__PURE__ */new Set),M=C(!1),I=C(!1),R=C({x:0,y:0}),D=C(!1),L=e=>{if(I.current||M.current||v.getState().connection.inProgress)return I.current=!1,void(M.current=!1);c?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},j=u?e=>u(e):void 0;function V(e,t){const{userSelectionRect:r}=v.getState();if(!r)return;const{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=v.getState(),u={x:r.startX,y:r.startY},{x:h,y:f}=net(u,i),p={startX:u.x,startY:u.y,x:e<h?e:h,y:t<f?t:f,width:Math.abs(e-h),height:Math.abs(t-f)},m=z.current,g=A.current;z.current=new Set(j7e(a,p,i,n===S7e.Partial,!0).map(e=>e.id)),A.current=/* @__PURE__ */new Set;const b=d?.selectable??!0;for(const n of z.current){const e=s.get(n);if(e)for(const{edgeId:t}of e.values()){const e=o.get(t);e&&(e.selectable??b)&&A.current.add(t)}}uet(m,z.current)||l(vnt(a,z.current,!0)),uet(g,A.current)||c(vnt(o,A.current)),v.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function Q(){if(!i||!N.current)return;const[e,t]=q7e(R.current,N.current,k);O({x:e,y:t}).then(e=>{if(!I.current||!e)return void(g.current=requestAnimationFrame(Q));const{x:t,y:n}=R.current;V(t,n),g.current=requestAnimationFrame(Q)})}const B=()=>{cancelAnimationFrame(g.current),g.current=0,D.current=!1};y(()=>()=>B(),[]);const F=!0===r||Array.isArray(r)&&r.includes(0);return P("div",{className:I4e(["react-flow__pane",{draggable:F,dragging:w,selection:e}]),onClick:S?void 0:Lnt(L,E),onContextMenu:Lnt(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():d?.(e)},E),onWheel:Lnt(j,E),onPointerEnter:S?void 0:h,onPointerMove:S?e=>{const{userSelectionRect:n,transform:r,resetSelectedElements:i}=v.getState();if(!N.current||!n)return;const{x:o,y:l}=xet(e.nativeEvent,N.current);R.current={x:o,y:l};const c=net({x:n.startX,y:n.startY},r);if(!I.current){const n=t?0:a;if(Math.hypot(o-c.x,l-c.y)<=n)return;i(),s?.(e)}I.current=!0,D.current||(Q(),D.current=!0),V(o,l)}:f,onPointerUp:e=>{S?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&v.getState().userSelectionRect&&L?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(l?.(e),v.setState({nodesSelectionActive:z.current.size>0})),B()):e.target===E.current&&v.getState().connection.inProgress&&(M.current=!0)},onPointerCancel:S?e=>{e.target?.releasePointerCapture?.(e.pointerId),B()}:void 0,onPointerDownCapture:S?n=>{if("touch"===n.pointerType&&!1!==r&&!t)return;const{domNode:i,transform:a}=v.getState();if(N.current=i?.getBoundingClientRect(),!N.current)return;const s=n.target===E.current;if(!s&&n.target.closest(".nokey")||!e||!(o&&s||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=xet(n.nativeEvent,N.current),d=tet({x:l,y:c},a);v.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),s||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:S?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:p,ref:E,style:Pnt,children:[m,T(Dnt,{})]})}function Qnt({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&o)&&(a({nodes:[c],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):l?.("012",(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.`)(e))}function Bnt({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){const s=jtt(),[l,c]=E(!1),d=C();return y(()=>{if(!t)return d.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=/* @__PURE__ */new Map,l=!1,c={x:0,y:0},d=null,u=!1,h=null,f=!1,p=!1,m=null;return{update:function({noDragClassName:g,handleSelector:v,domNode:b,isSelectable:y,nodeId:x,nodeClickDistance:w=0}){function O({x:e,y:n}){const{nodeLookup:i,nodeExtent:o,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:h,onError:f,updateNodePositions:g}=t();a={x:e,y:n};let v=!1;const b=s.size>1,y=b&&o?U7e(L7e(s)):null,w=b&&c?function({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const a={x:n-i.distance.x,y:r-i.distance.y},o=eet(a,t);return{x:o.x-a.x,y:o.y-a.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(const[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};c&&(a=w?{x:Math.round(a.x+w.x),y:Math.round(a.y+w.y)}:eet(a,l));let s=null;if(b&&o&&!r.extent&&y){const{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0];s=[[t,e.y-y.y+o[0][1]],[n,e.y+r.measured.height-y.y2+o[1][1]]]}const{position:u,positionAbsolute:h}=V7e({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:d,onError:f});v=v||r.position.x!==u.x||r.position.y!==u.y,r.position=u,r.internals.positionAbsolute=h}if(p=p||v,v&&(g(s,!0),m&&(r||u||!x&&h))){const[e,t]=Jet({nodeId:x,dragItems:s,nodeLookup:i});r?.(m,s,e,t),u?.(m,e,t),x||h?.(m,t)}}async function k(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i)return l=!1,void cancelAnimationFrame(o);const[s,u]=q7e(c,d,r);0===s&&0===u||(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-u/e[2],await n({x:s,y:u})&&O(a)),o=requestAnimationFrame(k)}function S(r){const{nodeLookup:i,multiSelectionActive:o,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:m,onSelectionDragStart:g,unselectNodesAndEdges:v}=t();u=!0,p&&y||o||!x||i.get(x)?.selected||v(),y&&p&&x&&e?.(x);const b=pet(r.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:d});if(a=b,s=function(e,t,n,r){const i=/* @__PURE__ */new Map;for(const[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Ket(o,e))&&(o.draggable||t&&void 0===o.draggable)){const t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}(i,l,b,x),s.size>0&&(n||m||!x&&g)){const[e,t]=Jet({nodeId:x,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),m?.(r.sourceEvent,e,t),x||g?.(r.sourceEvent,t)}}h=X6e(b);const C=c9e().clickDistance(w).on("start",e=>{const{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();d=n?.getBoundingClientRect()||null,f=!1,p=!1,m=e.sourceEvent,0===r&&S(e),a=pet(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:d}),c=xet(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:h,nodeLookup:p}=t(),g=pet(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:d});if(m=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||x&&!p.has(x))&&(f=!0),!f){if(!l&&n&&u&&(l=!0,k()),!u){const t=xet(e.sourceEvent,d),n=t.x-c.x,r=t.y-c.y;Math.sqrt(n*n+r*r)>h&&S(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&u&&(c=xet(e.sourceEvent,d),O(g))}}).on("end",e=>{if(u&&!f){if(l=!1,u=!1,cancelAnimationFrame(o),s.size>0){const{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(p&&(r(s,!1),p=!1),i||a||!x&&o){const[t,r]=Jet({nodeId:x,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),x||o?.(e.sourceEvent,r)}}}else f&&s.size>0&&t().updateNodePositions(s,!1)}).filter(e=>{const t=e.target;return!e.button&&(!g||!$et(t,`.${g}`,b))&&(!v||$et(t,v,b))});h.call(C)},destroy:function(){h?.on(".drag",null)}}}({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Qnt({id:t,store:s,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}}),()=>{d.current?.destroy(),d.current=void 0}},[t,s,e]),y(()=>{!t&&e.current&&d.current&&d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),l}function Fnt(){const e=jtt();return g(t=>{const{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),d=/* @__PURE__ */new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(a),h=r?i[0]:5,f=r?i[1]:5,p=t.direction.x*h*t.factor,m=t.direction.y*f*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+m};r&&(t=eet(t,i));const{position:a,positionAbsolute:s}=V7e({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:o});e.position=a,e.internals.positionAbsolute=s,d.set(e.id,e)}s(d)},[])}var _nt=l(null),qnt=_nt.Provider;_nt.Consumer;var Wnt=()=>v(_nt),Unt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Hnt=l(null);function Znt({children:e}){const t=Ltt(Unt,Mtt);return T(Hnt.Provider,{value:t,children:e})}var Ynt={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Xnt=p(Ont(function({type:e="source",position:t=T7e.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:l,className:c,onMouseDown:d,onTouchStart:u,...h},f){const p=o||null,m="target"===e,g=jtt(),b=Wnt(),{connectOnClick:y,noPanClassName:x,rfId:w}=function(){const e=v(Hnt);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:O,connectingTo:k,clickConnecting:S,isPossibleEndHandle:C,connectionInProcess:E,clickConnectionInProcess:N,valid:z}=Ltt(((e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:l,isValid:c}=o;if(!s&&!i)return Ynt;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:d,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===O7e.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:d&&c}})(b,p,e),Mtt);b||g.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const A=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){const{edges:e,setEdges:t,onError:n}=g.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const r=n.getEdgeId||Aet;let i;return i=I7e(e)?{...e}:{...e,id:r(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(i,t)?t:(null===i.sourceHandle&&delete i.sourceHandle,null===i.targetHandle&&delete i.targetHandle,t.concat(i))})(e,t,{...n,onError:n.onError??xnt})}(i,e,{onError:n}))}n?.(i),s?.(i)},P=e=>{if(!b)return;const t=yet(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=g.getState();att.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:m,handleId:p,nodeId:b,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:A,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?d?.(e):u?.(e)};return T("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${w}-${b}-${p}-${e}`,className:I4e(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,c,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:a,clickconnecting:S,connectingfrom:O,connectingto:k,valid:z,connectionindicator:r&&(!E||C)&&(E||N?a:i)}]),onMouseDown:P,onTouchStart:P,onClick:y?t=>{const{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:h}=g.getState();if(!b||!o&&!i)return;if(!o)return r?.(t.nativeEvent,{nodeId:b,handleId:p,handleType:e}),void g.setState({connectionClickStartHandle:{nodeId:b,type:e,id:p}});const f=get(t.target),m=n||l,{connection:v,isValid:y}=att.isValid(t.nativeEvent,{handle:{nodeId:b,id:p,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:m,flowId:d,doc:f,lib:c,nodeLookup:u});y&&v&&A(v);const x=structuredClone(h);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,a?.(t,x),g.setState({connectionClickStartHandle:null})}:void 0,ref:f,...h,children:l})})),Gnt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Knt={input:function({data:e,isConnectable:t,sourcePosition:n=T7e.Bottom}){return P(A,{children:[e?.label,T(Xnt,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=T7e.Top,sourcePosition:r=T7e.Bottom}){return P(A,{children:[T(Xnt,{type:"target",position:n,isConnectable:t}),e?.label,T(Xnt,{type:"source",position:r,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=T7e.Top}){return P(A,{children:[T(Xnt,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},$nt=e=>{const{width:t,height:n,x:r,y:i}=L7e(e.nodeLookup,{filter:e=>!!e.selected});return{width:J7e(t)?t:null,height:J7e(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Jnt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=jtt(),{width:i,height:a,transformString:o,userSelectionActive:s}=Ltt($nt,Mtt),l=Fnt(),c=C(null);y(()=>{n||c.current?.focus({preventScroll:!0})},[n]);const d=!s&&null!==i&&null!==a;if(Bnt({nodeRef:c,disabled:!d}),!d)return null;const u=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return T("div",{className:I4e(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:T("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Gnt,e.key)&&(e.preventDefault(),l({direction:Gnt[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var ert="undefined"!=typeof window?window:void 0,trt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function nrt({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:u,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:g,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:C,autoPanOnSelection:E,defaultViewport:N,translateExtent:z,minZoom:A,maxZoom:M,preventScrolling:I,onSelectionContextMenu:R,noWheelClassName:D,noPanClassName:L,disableKeyboardA11y:j,onViewportChange:V,isControlledViewport:Q}){const{nodesSelectionActive:B,userSelectionActive:F}=Ltt(trt,Mtt),_=cnt(c,{target:ert}),q=cnt(m,{target:ert}),W=q||C,U=q||w,H=d&&!0!==W,Z=_||F||H;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=jtt(),{deleteElements:r}=znt(),i=cnt(e,{actInsideInputWithModifier:!1}),a=cnt(t,{target:Tnt});y(()=>{if(i){const{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Ant),edges:e.filter(Ant)}),n.setState({nodesSelectionActive:!1})}},[i]),y(()=>{n.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:l,multiSelectionKeyCode:p}),T(Int,{onPaneContextMenu:a,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:U,panActivationKeyPressed:q,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!_&&W,defaultViewport:N,translateExtent:z,minZoom:A,maxZoom:M,zoomActivationKeyCode:g,preventScrolling:I,noWheelClassName:D,noPanClassName:L,onViewportChange:V,isControlledViewport:Q,paneClickDistance:s,selectionOnDrag:H,children:P(Vnt,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:W,autoPanOnSelection:E,isSelecting:!!Z,selectionMode:u,selectionKeyPressed:_,paneClickDistance:s,selectionOnDrag:H,children:[e,B&&T(Jnt,{onSelectionContextMenu:R,noPanClassName:L,disableKeyboardA11y:j})]})})}nrt.displayName="FlowRenderer";var rrt=p(nrt);var irt=e=>e.updateNodeInternals,art=p(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:u,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:p,rfId:m,nodeTypes:g,nodeClickDistance:v,onError:b}){const{node:x,internals:w,isParent:O}=Ltt(t=>{const n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},Mtt);let k=x.type||"default",S=g?.[k]||Knt[k];void 0===S&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(k)),k="default",S=g?.default||Knt.default);const E=!!(x.draggable||s&&void 0===x.draggable),N=!!(x.selectable||l&&void 0===x.selectable),z=!!(x.connectable||c&&void 0===x.connectable),A=!!(x.focusable||d&&void 0===x.focusable),P=jtt(),M=cet(x),I=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=jtt(),a=C(null),o=C(null),s=C(e.sourcePosition),l=C(e.targetPosition),c=C(t),d=n&&!!e.internals.handleBounds;return y(()=>{!a.current||e.hidden||d&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[d,e.hidden]),y(()=>()=>{o.current&&(r?.unobserve(o.current),o.current=null)},[]),y(()=>{if(a.current){const n=c.current!==t,r=s.current!==e.sourcePosition,o=l.current!==e.targetPosition;(n||r||o)&&(c.current=t,s.current=e.sourcePosition,l.current=e.targetPosition,i.getState().updateNodeInternals(/* @__PURE__ */new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}({node:x,nodeType:k,hasDimensions:M,resizeObserver:u}),R=Bnt({nodeRef:I,disabled:x.hidden||!E,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:N,nodeClickDistance:v}),D=Fnt();if(x.hidden)return null;const L=set(x),j=function(e){return void 0===e.internals.handleBounds?{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}}(x),V=N||E||t||n||r||i,Q=n?e=>n(e,{...w.userNode}):void 0,B=r?e=>r(e,{...w.userNode}):void 0,F=i?e=>i(e,{...w.userNode}):void 0,_=a?e=>a(e,{...w.userNode}):void 0,q=o?e=>o(e,{...w.userNode}):void 0;return T("div",{className:I4e(["react-flow__node",`react-flow__node-${k}`,{[f]:E},x.className,{selected:x.selected,selectable:N,parent:O,draggable:E,dragging:R}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:V?"all":"none",visibility:M?"visible":"hidden",...x.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Q,onMouseMove:B,onMouseLeave:F,onContextMenu:_,onClick:n=>{const{selectNodesOnDrag:r,nodeDragThreshold:i}=P.getState();N&&(!r||!E||i>0)&&Qnt({id:e,store:P,nodeRef:I}),t&&t(n,{...w.userNode})},onDoubleClick:q,onKeyDown:A?t=>{if(!bet(t.nativeEvent)&&!p)if(E7e.includes(t.key)&&N){const n="Escape"===t.key;Qnt({id:e,store:P,unselect:n,nodeRef:I})}else if(E&&x.selected&&Object.prototype.hasOwnProperty.call(Gnt,t.key)){t.preventDefault();const{ariaLabelConfig:e}=P.getState();P.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),D({direction:Gnt[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:A?0:void 0,onFocus:A?()=>{if(p||!I.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=P.getState();i&&(j7e(/* @__PURE__ */new Map([[e,x]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(x.position.x+L.width/2,x.position.y+L.height/2,{zoom:t[2]}))}:void 0,role:x.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Btt}-${m}`,"aria-label":x.ariaLabel,...x.domAttributes,children:T(qnt,{value:e,children:T(S,{id:e,data:x.data,type:k,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:N,draggable:E,deletable:x.deletable??!0,isConnectable:z,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:R,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...L})})})}),ort=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function srt(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=Ltt(ort,Mtt),a=(s=e.onlyRenderVisibleElements,Ltt(g((e=>t=>e?j7e(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(s),[s]),Mtt)),o=function(){const e=Ltt(irt),[t]=E(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=/* @__PURE__ */new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return y(()=>()=>{t?.disconnect()},[t]),t}();var s;return T("div",{className:"react-flow__nodes",style:Pnt,children:a.map(a=>T(art,{id:a,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:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}srt.displayName="NodeRenderer";var lrt=p(srt),crt={[A7e.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return T("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[A7e.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return T("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},drt=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const l=function(e){const t=jtt();return k(()=>Object.prototype.hasOwnProperty.call(crt,e)?crt[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return l?T("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0",children:T(l,{color:n,strokeWidth:o})}):null},urt=({defaultColor:e,rfId:t})=>{const n=Ltt(e=>e.edges),r=Ltt(e=>e.defaultEdgeOptions),i=k(()=>function(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const a=/* @__PURE__ */new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&"object"==typeof r){const i=Qet(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?T("svg",{className:"react-flow__marker","aria-hidden":"true",children:T("defs",{children:i.map(e=>T(drt,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};urt.displayName="MarkerDefinitions";var hrt=p(urt);function frt({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:l,className:c,...d}){const[u,h]=E({x:1,y:0,width:0,height:0}),f=I4e(["react-flow__edge-textwrapper",c]),p=C(null);return y(()=>{if(p.current){const e=p.current.getBBox();h({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?P("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:f,visibility:u.width?"visible":"hidden",...d,children:[i&&T("rect",{width:u.width+2*o[0],x:-o[0],y:-o[1],height:u.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),T("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:p,style:r,children:n}),l]}):null}frt.displayName="EdgeText";var prt=p(frt);function mrt({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return P(A,{children:[T("path",{...d,d:e,fill:"none",className:I4e(["react-flow__edge-path",d.className])}),c?T("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,r&&J7e(t)&&J7e(n)?T(prt,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function grt({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===T7e.Left||e===T7e.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function vrt({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top}){const[o,s]=grt({pos:n,x1:e,y1:t,x2:r,y2:i}),[l,c]=grt({pos:a,x1:r,y1:i,x2:e,y2:t}),[d,u,h,f]=Oet({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${o},${s} ${l},${c} ${r},${i}`,d,u,h,f]}function brt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:v})=>{const[b,y,x]=vrt({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),w=e.isInternal?void 0:t;return T(mrt,{id:w,path:b,labelX:y,labelY:x,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:v})})}var yrt=brt({isInternal:!1}),xrt=brt({isInternal:!0});function wrt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,sourcePosition:f=T7e.Bottom,targetPosition:p=T7e.Top,markerEnd:m,markerStart:g,pathOptions:v,interactionWidth:b})=>{const[y,x,w]=Ret({sourceX:n,sourceY:r,sourcePosition:f,targetX:i,targetY:a,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),O=e.isInternal?void 0:t;return T(mrt,{id:O,path:y,labelX:x,labelY:w,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}yrt.displayName="SimpleBezierEdge",xrt.displayName="SimpleBezierEdgeInternal";var Ort=wrt({isInternal:!1}),krt=wrt({isInternal:!0});function Srt(e){return p(({id:t,...n})=>{const r=e.isInternal?void 0:t;return T(Ort,{...n,id:r,pathOptions:k(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}Ort.displayName="SmoothStepEdge",krt.displayName="SmoothStepEdgeInternal";var Crt=Srt({isInternal:!1}),Ert=Srt({isInternal:!0});function Nrt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:p,interactionWidth:m})=>{const[g,v,b]=Tet({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return T(mrt,{id:y,path:g,labelX:v,labelY:b,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:p,interactionWidth:m})})}Crt.displayName="StepEdge",Ert.displayName="StepEdgeInternal";var zrt=Nrt({isInternal:!1}),Art=Nrt({isInternal:!0});function Trt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=T7e.Bottom,targetPosition:s=T7e.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,pathOptions:v,interactionWidth:b})=>{const[y,x,w]=Eet({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:v?.curvature}),O=e.isInternal?void 0:t;return T(mrt,{id:O,path:y,labelX:x,labelY:w,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:b})})}zrt.displayName="StraightEdge",Art.displayName="StraightEdgeInternal";var Prt=Trt({isInternal:!1}),Mrt=Trt({isInternal:!0});Prt.displayName="BezierEdge",Mrt.displayName="BezierEdgeInternal";var Irt={default:Mrt,straight:Art,step:Ert,smoothstep:krt,simplebezier:xrt},Rrt={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Drt=(e,t,n)=>n===T7e.Left?e-t:n===T7e.Right?e+t:e,Lrt=(e,t,n)=>n===T7e.Top?e-t:n===T7e.Bottom?e+t:e,jrt="react-flow__edgeupdater";function Vrt({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return T("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:I4e([jrt,`${jrt}-${s}`]),cx:Drt(t,r,e),cy:Lrt(n,r,e),r:r,stroke:"transparent",fill:"transparent"})}function Qrt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:u,setReconnecting:h,setUpdateHover:f}){const p=jtt(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:l,cancelConnection:f,nodeLookup:m,rfId:g,panBy:v,updateConnection:b}=p.getState(),y="target"===t.type;att.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:f,panBy:v,isValidConnection:(...e)=>p.getState().isValidConnection?.(...e)??!0,onConnect:e=>c?.(n,e),onConnectStart:(r,i)=>{h(!0),d?.(e,n,t.type),l?.(r,i)},onConnectEnd:(...e)=>p.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{h(!1),u?.(e,n,t.type,r)},updateConnection:b,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=()=>f(!0),v=()=>f(!1);return P(A,{children:[(!0===e||"source"===e)&&T(Vrt,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:g,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&T(Vrt,{position:l,centerX:a,centerY:o,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:g,onMouseOut:v,type:"target"})]})}var Brt=p(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,rfId:p,edgeTypes:m,noPanClassName:v,onError:b,disableKeyboardA11y:y}){let x=Ltt(t=>t.edgeLookup.get(e));const w=Ltt(e=>e.defaultEdgeOptions);x=w?{...w,...x}:x;let O=x.type||"default",S=m?.[O]||Irt[O];void 0===S&&(b?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(O)),O="default",S=m?.default||Irt.default);const N=!!(x.focusable||t&&void 0===x.focusable),z=void 0!==u&&(x.reconnectable||n&&void 0===x.reconnectable),A=!!(x.selectable||r&&void 0===x.selectable),M=C(null),[I,R]=E(!1),[D,L]=E(!1),j=jtt(),{zIndex:V=x.zIndex,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W}=Ltt(g(t=>{const n=t.nodeLookup.get(x.source),r=t.nodeLookup.get(x.target);if(!n||!r)return Rrt;const i=function(e){const{sourceNode:t,targetNode:n}=e;if(!Det(t)||!Det(n))return null;const r=t.internals.handleBounds||Let(t.handles),i=n.internals.handleBounds||Let(n.handles),a=Vet(r?.source??[],e.sourceHandle),o=Vet(e.connectionMode===O7e.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:r}", edge id: ${t}.`)(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=a?.position||T7e.Bottom,l=o?.position||T7e.Top,c=jet(t,a,s),d=jet(n,o,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:s,targetPosition:l}}({id:e,sourceNode:n,targetNode:r,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:t.connectionMode,onError:b}),a=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a="basic"}){return"manual"===a?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}({selected:x.selected,zIndex:x.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Rrt,zIndex:a}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex,b]),Mtt),U=k(()=>x.markerStart?`url('#${Qet(x.markerStart,p)}')`:void 0,[x.markerStart,p]),H=k(()=>x.markerEnd?`url('#${Qet(x.markerEnd,p)}')`:void 0,[x.markerEnd,p]);if(x.hidden||null===Q||null===B||null===F||null===_)return null;const Z=a?e=>{a(e,{...x})}:void 0,Y=o?e=>{o(e,{...x})}:void 0,X=s?e=>{s(e,{...x})}:void 0,G=l?e=>{l(e,{...x})}:void 0,K=c?e=>{c(e,{...x})}:void 0;return T("svg",{style:{zIndex:V},children:P("g",{className:I4e(["react-flow__edge",`react-flow__edge-${O}`,x.className,v,{selected:x.selected,animated:x.animated,inactive:!A&&!i,updating:I,selectable:A}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();A&&(j.setState({nodesSelectionActive:!1}),x.selected&&a?(r({nodes:[],edges:[x]}),M.current?.blur()):n([e])),i&&i(t,x)},onDoubleClick:Z,onContextMenu:Y,onMouseEnter:X,onMouseMove:G,onMouseLeave:K,onKeyDown:N?t=>{if(!y&&E7e.includes(t.key)&&A){const{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();"Escape"===t.key?(M.current?.blur(),n({edges:[x]})):r([e])}}:void 0,tabIndex:N?0:void 0,role:x.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===x.ariaLabel?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":N?`${Ftt}-${p}`:void 0,ref:M,...x.domAttributes,children:[!D&&T(S,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:A,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:U,markerEnd:H,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),z&&T(Qrt,{edge:x,isReconnectable:z,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W,setUpdateHover:R,setReconnecting:L})]})})}),Frt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _rt({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:y,onError:x}=Ltt(Frt,Mtt),w=Ltt(g(e=>{if(!O)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const r=e.nodeLookup.get(n.source),i=e.nodeLookup.get(n.target);r&&i&&zet({sourceNode:r,targetNode:i,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[O=t]),Mtt);var O;return P("div",{className:"react-flow__edges",children:[T(hrt,{defaultColor:e,rfId:n}),w.map(e=>T(Brt,{id:e,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:y,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:u,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:m},e))]})}_rt.displayName="EdgeRenderer";var qrt=p(_rt),Wrt=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Urt({children:e}){const t=jtt(),n=C(null),[r]=E(()=>t.getState().transform);return knt(()=>{let e=null;const r=()=>{const r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=Wrt(r)))};return r(),t.subscribe(r)},[t]),T("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Wrt(r)},children:e})}var Hrt=e=>e.panZoom?.syncViewport;function Zrt(e){return e.connection.inProgress?{...e.connection,to:tet(e.connection.to,e.transform)}:{...e.connection}}var Yrt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Xrt({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:l}=Ltt(Yrt,Mtt);return a&&i&&l?T("svg",{style:e,width:a,height:o,className:"react-flow__connectionline react-flow__container",children:T("g",{className:I4e(["react-flow__connection",fet(s)]),children:T(Grt,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Grt=({style:e,type:t=z7e.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:l,to:c,toNode:d,toHandle:u,toPosition:h,pointer:f}=Ltt(function(e){if(e){const t=t=>e(Zrt(t));return t}return Zrt}(p),Mtt);var p;if(!i)return;if(n)return T(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:h,connectionStatus:fet(r),toNode:d,toHandle:u,pointer:f});let m="";const g={sourceX:a.x,sourceY:a.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:h};switch(t){case z7e.Bezier:[m]=Eet(g);break;case z7e.SimpleBezier:[m]=vrt(g);break;case z7e.Step:[m]=Ret({...g,borderRadius:0});break;case z7e.SmoothStep:[m]=Ret(g);break;default:[m]=Tet(g)}return T("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};Grt.displayName="ConnectionLine";var Krt={};function $rt(e=Krt){C(e),jtt(),y(()=>{},[e])}function Jrt({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:h,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:g,connectionLineContainerStyle:v,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:E,onlyRenderVisibleElements:N,elementsSelectable:z,defaultViewport:A,translateExtent:M,minZoom:I,maxZoom:R,preventScrolling:D,defaultMarkerColor:L,zoomOnScroll:j,zoomOnPinch:V,panOnScroll:Q,panOnScrollSpeed:B,panOnScrollMode:F,zoomOnDoubleClick:_,panOnDrag:q,autoPanOnSelection:W,onPaneClick:U,onPaneMouseEnter:H,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneScroll:X,onPaneContextMenu:G,paneClickDistance:K,nodeClickDistance:$,onEdgeContextMenu:J,onEdgeMouseEnter:ee,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:re,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,noDragClassName:se,noWheelClassName:le,noPanClassName:ce,disableKeyboardA11y:de,nodeExtent:ue,rfId:he,viewport:fe,onViewportChange:pe,nodesDraggable:me}){return $rt(e),$rt(t),jtt(),C(!1),y(()=>{},[]),function(e){const t=znt(),n=C(!1);y(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=Ltt(Hrt),n=jtt();y(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(fe),T(rrt,{onPaneClick:U,onPaneMouseEnter:H,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneContextMenu:G,onPaneScroll:X,paneClickDistance:K,deleteKeyCode:E,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:z,zoomOnScroll:j,zoomOnPinch:V,zoomOnDoubleClick:_,panOnScroll:Q,panOnScrollSpeed:B,panOnScrollMode:F,panOnDrag:q,autoPanOnSelection:W,defaultViewport:A,translateExtent:M,minZoom:I,maxZoom:R,onSelectionContextMenu:u,preventScrolling:D,noDragClassName:se,noWheelClassName:le,noPanClassName:ce,disableKeyboardA11y:de,onViewportChange:pe,isControlledViewport:!!fe,children:P(Urt,{children:[T(qrt,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,onlyRenderVisibleElements:N,onEdgeContextMenu:J,onEdgeMouseEnter:ee,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:re,defaultMarkerColor:L,noPanClassName:ce,disableKeyboardA11y:de,rfId:he}),T(Xrt,{style:m,type:p,component:g,containerStyle:v}),T("div",{className:"react-flow__edgelabel-renderer"}),T(lrt,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:$,onlyRenderVisibleElements:N,noPanClassName:ce,noDragClassName:se,disableKeyboardA11y:de,nodeExtent:ue,rfId:he,nodesDraggable:me}),T("div",{className:"react-flow__viewport-portal"})]})})}Jrt.displayName="GraphView";var eit=p(Jrt),tit=(e,t)=>{},nit=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:h="basic"}={})=>{const f=/* @__PURE__ */new Map,p=/* @__PURE__ */new Map,m=/* @__PURE__ */new Map,g=/* @__PURE__ */new Map,v=r??t??[],b=n??e??[],y=d??[0,0],x=u??C7e;Get(m,g,v);const{nodesInitialized:w}=Uet(b,f,p,{nodeOrigin:y,nodeExtent:x,zIndexMode:h});let O=[0,0,1];if(o&&i&&a){const e=L7e(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:r}=iet(e,i,a,l,c,s?.padding??.1);O=[t,n,r]}return{rfId:"1",width:i??0,height:a??0,transform:O,nodes:b,nodesInitialized:w,nodeLookup:f,parentLookup:p,edges:v,edgeLookup:g,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:l,maxZoom:c,translateExtent:C7e,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:O7e.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...P7e},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tit,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:N7e,zIndexMode:h,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:/* @__PURE__ */new Map,onEdgesChangeMiddlewareMap:/* @__PURE__ */new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},rit=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h})=>((e,t)=>e?Ptt(e,t):Ptt)((f,p)=>{async function m(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(0===e.size)return!0;const s=function(e,t){const n=/* @__PURE__ */new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){const{width:t,height:n}=set(e);i=t>0&&n>0}else i=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!i||r&&!r.has(e.id)||n.set(e.id,e)}),n}(e,o),l=L7e(s),c=iet(l,t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(c,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...nit({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Uet(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),u=l&&d;o&&c?(m(),f({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):f({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Get(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,r,i,a,o){const s=r?.querySelector(".xyflow__viewport");let l=!1;if(!s)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const f of e.values()){const e=t.get(f.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const r=met(f.nodeElement),s=e.measured.width!==r.width||e.measured.height!==r.height;if(r.width&&r.height&&(s||!e.internals.handleBounds||f.force)){const d=f.nodeElement.getBoundingClientRect(),p=oet(e.extent)?e.extent:a;let{positionAbsolute:m}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(m=F7e(m,r,n))}else p&&(m=B7e(m,p,r));const g={...e,measured:r,internals:{...e.internals,positionAbsolute:m,handleBounds:{source:wet("source",f.nodeElement,d,u,e.id),target:wet("target",f.nodeElement,d,u,e.id)}}};t.set(e.id,g),e.parentId&&Het(g,t,n,{nodeOrigin:i,zIndexMode:o}),l=!0,s&&(c.push({id:e.id,type:"dimensions",dimensions:r}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:Z7e(g,i)}))}}if(h.length>0){const e=Yet(h,t,n,i);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,r,i,a,o,c);u&&(function(e,t,n){const r=_et(Bet,n);for(const i of e.values())if(i.parentId)Het(i,e,t,r);else{const e=D7e(i,r.nodeOrigin),t=oet(i.extent)?i.extent:r.nodeExtent,n=B7e(e,t,set(i));i.internals.positionAbsolute=n}}(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:c}),l?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),d?.length>0&&t?.(d))},updateNodePositions:(e,t=!1)=>{const n=[];let r=[];const{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:l}=p();for(const[c,d]of e){const e=i.get(c),a=!!(e?.expandParent&&e?.parentId&&d?.position),l={id:c,type:"position",position:a?{x:Math.max(0,d.position.x),y:Math.max(0,d.position.y)}:d.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){const t=jet(e,o.fromHandle,T7e.Left,!0);s({...o,from:t})}a&&e.parentId&&n.push({id:c,parentId:e.parentId,rect:{...d.internals.positionAbsolute,width:d.measured.width??0,height:d.measured.height??0}}),r.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),a=Yet(n,i,e,t);r.push(...a)}for(const c of l.values())r=c(r);a(r)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=p();e?.length&&(i&&n(pnt(e,r)),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=p();e?.length&&(i&&n(mnt(e,r)),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();t?i(e.map(e=>gnt(e,!0))):(i(vnt(r,/* @__PURE__ */new Set([...e]),!0)),a(vnt(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();t?a(e.map(e=>gnt(e,!0))):(a(vnt(n,/* @__PURE__ */new Set([...e]))),i(vnt(r,/* @__PURE__ */new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=p(),s=e||r,l=t||n,c=[];for(const u of s){if(!u.selected)continue;const e=i.get(u.id);e&&(e.selected=!1),c.push(gnt(u.id,!1))}const d=[];for(const u of l)u.selected&&d.push(gnt(u.id,!1));a(c),o(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=p();if(!i)return;const a=t.reduce((e,t)=>t.selected?[...e,gnt(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,gnt(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=p();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(Uet(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),f({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{const{width:r,height:i,maxZoom:a,panZoom:o}=p();if(!o)return!1;const s=void 0!==n?.zoom?n.zoom:a;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{f({connection:{...P7e}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...nit()})}},Object.is);function iit({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h,children:f}){const[p]=E(()=>rit({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:c,minZoom:o,maxZoom:s,fitViewOptions:l,nodeOrigin:d,nodeExtent:u,zIndexMode:h}));return T(Rtt,{value:p,children:T(Ent,{children:T(Znt,{children:f})})})}function ait({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f}){return v(Itt)?T(A,{children:e}):T(iit,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f,children:e})}var oit,sit={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},lit=Ont(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:h,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:k,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:z,onNodesDelete:A,onEdgesDelete:M,onDelete:I,onSelectionChange:R,onSelectionDragStart:D,onSelectionDrag:L,onSelectionDragStop:j,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:B,onBeforeDelete:F,connectionMode:_,connectionLineType:q=z7e.Bezier,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:H,deleteKeyCode:Z="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:X=!1,selectionMode:G=S7e.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:$=(aet()?"Meta":"Control"),zoomActivationKeyCode:J=(aet()?"Meta":"Control"),snapToGrid:ee,snapGrid:te,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:re,nodesDraggable:ie,autoPanOnNodeFocus:ae,nodesConnectable:oe,nodesFocusable:se,nodeOrigin:le=tnt,edgesFocusable:ce,edgesReconnectable:de,elementsSelectable:ue=!0,defaultViewport:he=nnt,minZoom:fe=.5,maxZoom:pe=2,translateExtent:me=C7e,preventScrolling:ge=!0,nodeExtent:ve,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:we=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:ke=k7e.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:Ne,onPaneMouseMove:ze,onPaneMouseLeave:Ae,onPaneScroll:Te,onPaneContextMenu:Pe,paneClickDistance:Me=1,nodeClickDistance:Ie=0,children:Re,onReconnect:De,onReconnectStart:Le,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Qe,onEdgeMouseEnter:Be,onEdgeMouseMove:Fe,onEdgeMouseLeave:_e,reconnectRadius:qe=10,onNodesChange:We,onEdgesChange:Ue,noDragClassName:He="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:Ye="nopan",fitView:Xe,fitViewOptions:Ge,connectOnClick:Ke,attributionPosition:$e,proOptions:Je,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:lt,isValidConnection:ct,onError:dt,style:ut,id:ht,nodeDragThreshold:ft,connectionDragThreshold:pt,viewport:mt,onViewportChange:gt,width:vt,height:bt,colorMode:yt="light",debug:xt,onScroll:wt,ariaLabelConfig:Ot,zIndexMode:kt="basic",...St},Ct){const Et=ht||"1",Nt=function(e){const[t,n]=E("system"===e?null:e);return y(()=>{if("system"!==e)return void n(e);const t=snt(),r=()=>n(t?.matches?"dark":"light");return r(),t?.addEventListener("change",r),()=>{t?.removeEventListener("change",r)}},[e]),null!==t?t:snt()?.matches?"dark":"light"}(yt),zt=g(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),wt?.(e)},[wt]);return T("div",{"data-testid":"rf__wrapper",...St,onScroll:zt,style:{...ut,...sit},ref:Ct,className:I4e(["react-flow",i,Nt]),id:ht,role:"application",children:P(ait,{nodes:e,edges:t,width:vt,height:bt,fitView:Xe,fitViewOptions:Ge,minZoom:fe,maxZoom:pe,nodeOrigin:le,nodeExtent:ve,zIndexMode:kt,children:[T(ont,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ie,autoPanOnNodeFocus:ae,nodesConnectable:oe,nodesFocusable:se,edgesFocusable:ce,edgesReconnectable:de,elementsSelectable:ue,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:fe,maxZoom:pe,nodeExtent:ve,onNodesChange:We,onEdgesChange:Ue,snapToGrid:ee,snapGrid:te,connectionMode:_,translateExtent:me,connectOnClick:Ke,defaultEdgeOptions:et,fitView:Xe,fitViewOptions:Ge,onNodesDelete:A,onEdgesDelete:M,onDelete:I,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:z,onSelectionDrag:L,onSelectionDragStart:D,onSelectionDragStop:j,onMove:d,onMoveStart:u,onMoveEnd:h,noPanClassName:Ye,nodeOrigin:le,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:dt,connectionRadius:lt,isValidConnection:ct,selectNodesOnDrag:re,nodeDragThreshold:ft,connectionDragThreshold:pt,onBeforeDelete:F,debug:xt,ariaLabelConfig:Ot,zIndexMode:kt}),T(eit,{onInit:c,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:k,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:q,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:H,selectionKeyCode:Y,selectionOnDrag:X,selectionMode:G,deleteKeyCode:Z,multiSelectionKeyCode:$,panActivationKeyCode:K,zoomActivationKeyCode:J,onlyRenderVisibleElements:ne,defaultViewport:he,translateExtent:me,minZoom:fe,maxZoom:pe,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:Se,panOnScroll:we,panOnScrollSpeed:Oe,panOnScrollMode:ke,panOnDrag:Ce,autoPanOnSelection:ot,onPaneClick:Ee,onPaneMouseEnter:Ne,onPaneMouseMove:ze,onPaneMouseLeave:Ae,onPaneScroll:Te,onPaneContextMenu:Pe,paneClickDistance:Me,nodeClickDistance:Ie,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:B,onReconnect:De,onReconnectStart:Le,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Qe,onEdgeMouseEnter:Be,onEdgeMouseMove:Fe,onEdgeMouseLeave:_e,reconnectRadius:qe,defaultMarkerColor:be,noDragClassName:He,noWheelClassName:Ze,noPanClassName:Ye,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:mt,onViewportChange:gt,nodesDraggable:ie}),T(ent,{onSelectionChange:R}),Re,T(Ytt,{proOptions:Je,position:$e}),T(Utt,{rfId:Et,disableKeyboardA11y:rt})]})})}),cit=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function dit({children:e}){const t=Ltt(cit);return t?I(e,t):null}function uit({dimensions:e,lineWidth:t,variant:n,className:r}){return T("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:I4e(["react-flow__background-pattern",n,r])})}function hit({radius:e,className:t}){return T("circle",{cx:e,cy:e,r:e,className:I4e(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(oit||(oit={}));var fit={[oit.Dots]:1,[oit.Lines]:1,[oit.Cross]:6},pit=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function mit({id:e,variant:t=oit.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:l,className:c,patternClassName:d}){const u=C(null),{transform:h,patternId:f}=Ltt(pit,Mtt),p=r||fit[t],m=t===oit.Dots,g=t===oit.Cross,v=Array.isArray(n)?n:[n,n],b=[v[0]*h[2]||1,v[1]*h[2]||1],y=p*h[2],x=Array.isArray(a)?a:[a,a],w=g?[y,y]:b,O=[x[0]*h[2]+w[0]/2,x[1]*h[2]+w[1]/2],k=`${f}${e||""}`;return P("svg",{className:I4e(["react-flow__background",c]),style:{...l,...Pnt,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:u,"data-testid":"rf__background",children:[T("pattern",{id:k,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${O[0]},-${O[1]})`,children:m?T(hit,{radius:y/2,className:d}):T(uit,{dimensions:w,lineWidth:i,variant:t,className:d})}),T("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}mit.displayName="Background";var git=p(mit);function vit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function bit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T("path",{d:"M0 0h32v4.2H0z"})})}function yit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T("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 xit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("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 wit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("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 Oit({children:e,className:t,...n}){return T("button",{type:"button",className:I4e(["react-flow__controls-button",t]),...n,children:e})}var kit=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Sit({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:l,className:c,children:d,position:u="bottom-left",orientation:h="vertical","aria-label":f}){const p=jtt(),{isInteractive:m,minZoomReached:g,maxZoomReached:v,ariaLabelConfig:b}=Ltt(kit,Mtt),{zoomIn:y,zoomOut:x,fitView:w}=znt();return P(Htt,{className:I4e(["react-flow__controls","horizontal"===h?"horizontal":"vertical",c]),position:u,style:e,"data-testid":"rf__controls","aria-label":f??b["controls.ariaLabel"],children:[t&&P(A,{children:[T(Oit,{onClick:()=>{y(),a?.()},className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:v,children:T(vit,{})}),T(Oit,{onClick:()=>{x(),o?.()},className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:g,children:T(bit,{})})]}),n&&T(Oit,{className:"react-flow__controls-fitview",onClick:()=>{w(i),s?.()},title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:T(yit,{})}),r&&T(Oit,{className:"react-flow__controls-interactive",onClick:()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),l?.(!m)},title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:T(m?wit:xit,{})}),d]})}Sit.displayName="Controls";var Cit=p(Sit),Eit=p(function({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:l,className:c,borderRadius:d,shapeRendering:u,selected:h,onClick:f}){const{background:p,backgroundColor:m}=a||{},g=o||p||m;return T("rect",{className:I4e(["react-flow__minimap-node",{selected:h},c]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:l},shapeRendering:u,onClick:f?t=>f(t,e):void 0})}),Nit=e=>e.nodes.map(e=>e.id),zit=e=>e instanceof Function?e:()=>e,Ait=p(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:l}){const{node:c,x:d,y:u,width:h,height:f}=Ltt(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=set(r);return{node:r,x:i,y:a,width:o,height:s}},Mtt);return c&&!c.hidden&&cet(c)?T(s,{x:d,y:u,width:h,height:f,style:c.style,selected:!!c.selected,className:r(c),color:t(c),borderRadius:i,strokeColor:n(c),strokeWidth:a,shapeRendering:o,onClick:l,id:c.id}):null}),Tit=p(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Eit,onClick:o}){const s=Ltt(Nit,Mtt),l=zit(t),c=zit(e),d=zit(n),u="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return T(A,{children:s.map(e=>T(Ait,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:u},e))})}),Pit=e=>!e.hidden,Mit=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]};let n=!1;for(const r of e.nodeLookup.values())if(!r.hidden){n=!0;break}return{viewBB:t,boundingRect:n?X7e(L7e(e.nodeLookup,{filter:Pit}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Iit=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Rit=(e,t)=>Iit(e.viewBB,t.viewBB)&&Iit(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function Dit({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:u,position:h="bottom-right",onClick:f,onNodeClick:p,pannable:m=!1,zoomable:v=!1,ariaLabel:b,inversePan:x,zoomStep:w=1,offsetScale:O=5}){const k=jtt(),S=C(null),{boundingRect:E,panZoom:N,viewBB:z,rfId:A,translateExtent:M,flowWidth:I,flowHeight:R,ariaLabelConfig:D}=Ltt(Mit,Rit),L=e?.width??200,j=e?.height??150,V=E.width/L,Q=E.height/j,B=Math.max(V,Q),F=B*L,_=B*j,q=O*B,W=E.x-(F-E.width)/2-q,U=E.y-(_-E.height)/2-q,H=F+2*q,Z=_+2*q,Y=`react-flow__minimap-desc-${A}`,X=C(0),G=C();X.current=B,y(()=>{const e=k.getState().panZoom;if(S.current&&e)return G.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=X6e(e);return{update:function({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const h=w7e().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?i=>{const s=n();if("mousemove"!==i.sourceEvent.type&&"touchmove"!==i.sourceEvent.type||!t)return;const l=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const h=r()*Math.max(s[2],Math.log(s[2]))*(d?-1:1),f={x:s[0]-c[0]*h,y:s[1]-c[1]*h},p=[[0,0],[a,o]];t.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const r=n(),i=e.sourceEvent.ctrlKey&&aet()?10:1,a=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*Math.pow(2,a*i);t.scaleTo(o)}:null);i.call(h,{})},destroy:function(){i.on("zoom",null)},pointer:G6e}}({domNode:S.current,panZoom:e,getTransform:()=>k.getState().transform,getViewScale:()=>X.current}),()=>{G.current?.destroy()}},[N]),y(()=>{G.current?.update({translateExtent:M,width:I,height:R,inversePan:x,pannable:m,zoomStep:w,zoomable:v})},[m,v,x,w,M,I,R]);const K=f?e=>{const[t,n]=G.current?.pointer(e)||[0,0];f(e,{x:t,y:n})}:void 0,$=g((e,t)=>{const n=k.getState().nodeLookup.get(t).internals.userNode;p?.(e,n)},[p]),J=p?$:void 0,ee=b??D["minimap.ariaLabel"];return T(Htt,{position:h,style:{...e,"--xy-minimap-background-color-props":"string"==typeof l?l:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof c?c:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof u?u*B:void 0,"--xy-minimap-node-background-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof o?o:void 0},className:I4e(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:P("svg",{width:L,height:j,viewBox:`${W} ${U} ${H} ${Z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:S,onClick:K,children:[ee&&T("title",{id:Y,children:ee}),T(Tit,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),T("path",{className:"react-flow__minimap-mask",d:`M${W-q},${U-q}h${H+2*q}v${Z+2*q}h${-H-2*q}z\n M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Dit.displayName="MiniMap";var Lit=p(Dit),jit={[itt.Line]:"right",[itt.Handle]:"bottom-right"};p(function({nodeId:e,position:t,variant:n=itt.Handle,className:r,style:i,children:a,color:o,minWidth:s=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:h,autoScale:f=!0,shouldResize:p,onResizeStart:m,onResize:v,onResizeEnd:b}){const x=Wnt(),w="string"==typeof e?e:x,O=jtt(),k=C(null),S=n===itt.Handle,E=Ltt(g((N=S&&f,e=>N?`${Math.max(1/e.transform[2],1)}`:void 0),[S,f]),Mtt);var N;const z=C(null),A=t??jit[n];y(()=>{if(k.current&&w)return z.current||(z.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const a=X6e(e);let o={controlDirection:ftt("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:h,shouldResize:f}){let p,m={...btt},g={...ytt};o={boundaries:s,resizeDirection:c,keepAspectRatio:l,controlDirection:ftt(e)};let v,b,y,x=null,w=[],O=!1;const k=c9e().on("start",e=>{const{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:l}=n();if(p=r.get(t),!p)return;x=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=pet(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},g={...m,pointerX:c,pointerY:u,aspectRatio:m.width/m.height},v=void 0,b=oet(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(v=r.get(p.parentId)),v&&"parent"===p.extent&&(b=[[0,0],[v.measured.width,v.measured.height]]),w=[],y=void 0;for(const[n,d]of r)if(d.parentId===t&&(w.push({id:n,position:{...d.position},extent:d.extent}),"parent"===d.extent||d.expandParent)){const e=xtt(d,p,d.origin??s);y=y?[[Math.min(e[0][0],y[0][0]),Math.min(e[0][1],y[0][1])],[Math.max(e[1][0],y[1][0]),Math.max(e[1][1],y[1][1])]]:e}d?.(e,{...m})}).on("drag",e=>{const{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),l=pet(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:x}),c=[];if(!p)return;const{x:d,y:h,width:k,height:S}=m,C={},E=p.origin??s,{width:N,height:z,x:A,y:T}=function(e,t,n,r,i,a,o,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,h=d&&u,{xSnapped:f,ySnapped:p}=n,{minWidth:m,maxWidth:g,minHeight:v,maxHeight:b}=r,{x:y,y:x,width:w,height:O,aspectRatio:k}=e;let S=Math.floor(d?f-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const E=w+(l?-S:S),N=O+(c?-C:C),z=-a[0]*w,A=-a[1]*O;let T=gtt(E,m,g),P=gtt(N,v,b);if(o){let e=0,t=0;l&&S<0?e=ptt(y+S+z,o[0][0]):!l&&S>0&&(e=mtt(y+E+z,o[1][0])),c&&C<0?t=ptt(x+C+A,o[0][1]):!c&&C>0&&(t=mtt(x+N+A,o[1][1])),T=Math.max(T,e),P=Math.max(P,t)}if(s){let e=0,t=0;l&&S>0?e=mtt(y+S,s[0][0]):!l&&S<0&&(e=ptt(y+E,s[1][0])),c&&C>0?t=mtt(x+C,s[0][1]):!c&&C<0&&(t=ptt(x+N,s[1][1])),T=Math.max(T,e),P=Math.max(P,t)}if(i){if(d){const e=gtt(E/k,v,b)*k;if(T=Math.max(T,e),o){let e=0;e=!l&&!c||l&&!c&&h?mtt(x+A+E/k,o[1][1])*k:ptt(x+A+(l?S:-S)/k,o[0][1])*k,T=Math.max(T,e)}if(s){let e=0;e=!l&&!c||l&&!c&&h?ptt(x+E/k,s[1][1])*k:mtt(x+(l?S:-S)/k,s[0][1])*k,T=Math.max(T,e)}}if(u){const e=gtt(N*k,m,g)/k;if(P=Math.max(P,e),o){let e=0;e=!l&&!c||c&&!l&&h?mtt(y+N*k+z,o[1][0])/k:ptt(y+(c?C:-C)*k+z,o[0][0])/k,P=Math.max(P,e)}if(s){let e=0;e=!l&&!c||c&&!l&&h?ptt(y+N*k,s[1][0])/k:mtt(y+(c?C:-C)*k,s[0][0])/k,P=Math.max(P,e)}}}C+=C<0?P:-P,S+=S<0?T:-T,i&&(h?E>N*k?C=(vtt(l,c)?-S:S)/k:S=(vtt(l,c)?-C:C)*k:d?(C=S/k,c=l):(S=C*k,l=c));const M=l?y+S:y,I=c?x+C:x;return{width:w+(l?-S:S),height:O+(c?-C:C),x:a[0]*S*(l?-1:1)+M,y:a[1]*C*(c?-1:1)+I}}(g,o.controlDirection,l,o.boundaries,o.keepAspectRatio,E,b,y),P=N!==k,M=z!==S,I=A!==d&&P,R=T!==h&&M;if(!(I||R||P||M))return;if((I||R||1===E[0]||1===E[1])&&(C.x=I?A:m.x,C.y=R?T:m.y,m.x=C.x,m.y=C.y,w.length>0)){const e=A-d,t=T-h;for(const n of w)n.position={x:n.position.x-e+E[0]*(N-k),y:n.position.y-t+E[1]*(z-S)},c.push(n)}if((P||M)&&(C.width=!P||o.resizeDirection&&"horizontal"!==o.resizeDirection?m.width:N,C.height=!M||o.resizeDirection&&"vertical"!==o.resizeDirection?m.height:z,m.width=C.width,m.height=C.height),v&&p.expandParent){const e=E[0]*(C.width??0);C.x&&C.x<e&&(m.x=e,g.x=g.x-(C.x-e));const t=E[1]*(C.height??0);C.y&&C.y<t&&(m.y=t,g.y=g.y-(C.y-t))}const D=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){const o=e-t,s=n-r,l=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(l[0]=-1*l[0]),s&&a&&(l[1]=-1*l[1]),l}({width:m.width,prevWidth:k,height:m.height,prevHeight:S,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),L={...m,direction:D};!1!==f?.(e,L)&&(O=!0,u?.(e,L),r(C,c))}).on("end",e=>{O&&(h?.(e,{...m}),i?.({...m}),O=!1)});a.call(k)},destroy:function(){a.on(".drag",null)}}}({domNode:k.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=O.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=O.getState(),o=[],s={x:e.x,y:e.y},l=r.get(w);if(l&&l.expandParent&&l.parentId){const t=l.origin??a,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Yet([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...det({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,r,t)}}],r,i,a);o.push(...d),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:w,type:"position",position:{...s}};o.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:w,type:"dimensions",resizing:!0,setAttributes:!h||("horizontal"===h?"width":"height"),dimensions:{width:e.width,height:e.height}};o.push(t)}for(const c of t){const e={...c,type:"position"};o.push(e)}n(o)},onEnd:({width:e,height:t})=>{const n={id:w,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};O.getState().triggerNodeChanges([n])}})),z.current.update({controlPosition:A,boundaries:{minWidth:s,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:u,resizeDirection:h,onResizeStart:m,onResize:v,onResizeEnd:b,shouldResize:p}),()=>{z.current?.destroy()}},[A,s,l,c,d,u,m,v,b,p]);const P=A.split("-");return T("div",{className:I4e(["react-flow__resize-control","nodrag",...P,n,r]),ref:k,style:{...i,scale:E,...o&&{[S?"backgroundColor":"borderColor"]:o}},children:a})}),KV(),KV(),ka();var Vit={none:{label:"None",color:"bg-slate-100 text-slate-700 border-slate-300 dark:bg-zinc-700 dark:text-zinc-300 dark:border-zinc-600",icon:"fa-solid fa-lock"},public:{label:"Public",color:"bg-secondary-100 text-secondary-700 border-secondary-300",icon:"fa-solid fa-globe"},authenticated:{label:"Auth",color:"bg-primary-100 text-primary-700 border-primary-300",icon:"fa-solid fa-shield-halved"}},Qit=p(({id:e,data:t,selected:n=!1})=>{const{getEdges:r,setNodes:i}=znt(),{addToast:a}=dUe(),{showDialog:o}=FPe(),s=Vit[t.accessLevel],l=g(async()=>{r().find(t=>t.source===e)?a("You can't remove this folder with elements or folders",{appeareance:"warning",autoDismiss:!0,placement:"top-right"}):await o(/* @__PURE__ */T(_Pe.Header,{children:/* @__PURE__ */P("h4",{children:["Remove ","folder"===t.type?"Folder":"Page"]})}),/* @__PURE__ */T(_Pe.Body,{children:/* @__PURE__ */T("h4",{children:"Do you want to remove this item ?"})}),void 0,{size:"sm"},e)&&i(t=>t.filter(t=>t.id!==e))},[a,t.type,r,e,i,o]);/* @__PURE__ */
3792
+ /* @__PURE__ */T(LV,{size:"sm",name:"keepState",checked:o,onChange:S,type:"checkbox",label:"Keep State"}),o&&/* @__PURE__ */P(aV,{size:"sm",name:"stateStorage",value:s,onChange:N("stateStorage"),label:"State Storage",placeholder:"None",children:[/* @__PURE__ */T("option",{value:"localStorage",children:"Local Storage"}),/* @__PURE__ */T("option",{value:"sessionStorage",children:"Session Storage"})]})]}),
3793
+ /* @__PURE__ */P("div",{className:"flex grow basis-0 flex-col gap-4 border-b border-gray-300 p-6",children:[
3794
+ /* @__PURE__ */T(dTe,{as:"h4",children:"Debugging"}),
3795
+ /* @__PURE__ */P(lTe,{intent:"warning",size:"xs",solid:!1,children:["For sites served with SSR — usually your ",
3796
+ /* @__PURE__ */T("code",{children:"*.plitzi.app"})," address, or a custom domain pointed at it. Anyone who opens the site can then open the dev tools (Shift+F12) and read its elements, state and interactions. Switch it off when you are done."]}),
3797
+ /* @__PURE__ */T(LV,{size:"sm",name:"devTools",checked:k,onChange:C,type:"checkbox",label:"Dev tools on the published SSR site (*.plitzi.app)"})]})]})})};function I4e(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=I4e(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var R4e={value:()=>{}};function D4e(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new L4e(r)}function L4e(e){this._=e}function j4e(e,t){for(var n,r=0,i=e.length;r<i;++r)if((n=e[r]).name===t)return n.value}function V4e(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=R4e,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}L4e.prototype=D4e.prototype={constructor:L4e,on:function(e,t){var n,r,i=this._,a=(r=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<s;)if(n=(e=a[o]).type)i[n]=V4e(i[n],e.name,t);else if(null==t)for(n in i)i[n]=V4e(i[n],e.name,null);return this}for(;++o<s;)if((n=(e=a[o]).type)&&(n=j4e(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new L4e(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=0,n=(r=this._[e]).length;a<n;++a)r[a].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};var Q4e={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function B4e(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Q4e.hasOwnProperty(t)?{space:Q4e[t],local:e}:e}function F4e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return"http://www.w3.org/1999/xhtml"===n&&"http://www.w3.org/1999/xhtml"===t.documentElement.namespaceURI?t.createElement(e):t.createElementNS(n,e)}}function _4e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function q4e(e){var t=B4e(e);return(t.local?_4e:F4e)(t)}function W4e(){}function U4e(e){return null==e?W4e:function(){return this.querySelector(e)}}function H4e(){return[]}function Z4e(e){return null==e?H4e:function(){return this.querySelectorAll(e)}}function Y4e(e){return function(){return this.matches(e)}}function X4e(e){return function(t){return t.matches(e)}}var G4e=Array.prototype.find;function K4e(){return this.firstElementChild}var $4e=Array.prototype.filter;function J4e(){return Array.from(this.children)}function e6e(e){return new Array(e.length)}function t6e(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function n6e(e,t,n,r,i,a){for(var o,s=0,l=t.length,c=a.length;s<c;++s)(o=t[s])?(o.__data__=a[s],r[s]=o):n[s]=new t6e(e,a[s]);for(;s<l;++s)(o=t[s])&&(i[s]=o)}function r6e(e,t,n,r,i,a,o){var s,l,c,d=/* @__PURE__ */new Map,u=t.length,h=a.length,f=new Array(u);for(s=0;s<u;++s)(l=t[s])&&(f[s]=c=o.call(l,l.__data__,s,t)+"",d.has(c)?i[s]=l:d.set(c,l));for(s=0;s<h;++s)c=o.call(e,a[s],s,a)+"",(l=d.get(c))?(r[s]=l,l.__data__=a[s],d.delete(c)):n[s]=new t6e(e,a[s]);for(s=0;s<u;++s)(l=t[s])&&d.get(f[s])===l&&(i[s]=l)}function i6e(e){return e.__data__}function a6e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function o6e(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function s6e(e){return function(){this.removeAttribute(e)}}function l6e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function c6e(e,t){return function(){this.setAttribute(e,t)}}function d6e(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function u6e(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function h6e(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function f6e(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function p6e(e){return function(){this.style.removeProperty(e)}}function m6e(e,t,n){return function(){this.style.setProperty(e,t,n)}}function g6e(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function v6e(e,t){return e.style.getPropertyValue(t)||f6e(e).getComputedStyle(e,null).getPropertyValue(t)}function b6e(e){return function(){delete this[e]}}function y6e(e,t){return function(){this[e]=t}}function x6e(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function w6e(e){return e.trim().split(/^|\s+/)}function O6e(e){return e.classList||new k6e(e)}function k6e(e){this._node=e,this._names=w6e(e.getAttribute("class")||"")}function S6e(e,t){for(var n=O6e(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function C6e(e,t){for(var n=O6e(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function E6e(e){return function(){S6e(this,e)}}function N6e(e){return function(){C6e(this,e)}}function z6e(e,t){return function(){(t.apply(this,arguments)?S6e:C6e)(this,e)}}function A6e(){this.textContent=""}function T6e(e){return function(){this.textContent=e}}function P6e(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function M6e(){this.innerHTML=""}function I6e(e){return function(){this.innerHTML=e}}function R6e(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function D6e(){this.nextSibling&&this.parentNode.appendChild(this)}function L6e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function j6e(){return null}function V6e(){var e=this.parentNode;e&&e.removeChild(this)}function Q6e(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function B6e(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function F6e(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,a=t.length;r<a;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function _6e(e,t,n){return function(){var r,i=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var o=0,s=i.length;o<s;++o)if((r=i[o]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=t);this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},i?i.push(r):this.__on=[r]}}function q6e(e,t,n){var r=f6e(e),i=r.CustomEvent;"function"==typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function W6e(e,t){return function(){return q6e(this,e,t)}}function U6e(e,t){return function(){return q6e(this,e,t.apply(this,arguments))}}t6e.prototype={constructor:t6e,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)}},k6e.prototype={add:function(e){this._names.indexOf(e)<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}};var H6e=[null];function Z6e(e,t){this._groups=e,this._parents=t}function Y6e(){return new Z6e([[document.documentElement]],H6e)}function X6e(e){return"string"==typeof e?new Z6e([[document.querySelector(e)]],[document.documentElement]):new Z6e([[e]],H6e)}function G6e(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}Z6e.prototype=Y6e.prototype={constructor:Z6e,select:function(e){"function"!=typeof e&&(e=U4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o,s=t[i],l=s.length,c=r[i]=new Array(l),d=0;d<l;++d)(a=s[d])&&(o=e.call(a,a.__data__,d,s))&&("__data__"in a&&(o.__data__=a.__data__),c[d]=o);return new Z6e(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}(e):Z4e(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o,s=t[a],l=s.length,c=0;c<l;++c)(o=s[c])&&(r.push(e.call(o,o.__data__,c,s)),i.push(o));return new Z6e(r,i)},selectChild:function(e){return this.select(null==e?K4e:function(e){return function(){return G4e.call(this.children,e)}}("function"==typeof e?e:X4e(e)))},selectChildren:function(e){return this.selectAll(null==e?J4e:function(e){return function(){return $4e.call(this.children,e)}}("function"==typeof e?e:X4e(e)))},filter:function(e){"function"!=typeof e&&(e=Y4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&l.push(a);return new Z6e(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,i6e);var n=t?r6e:n6e,r=this._parents,i=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var a=i.length,o=new Array(a),s=new Array(a),l=new Array(a),c=0;c<a;++c){var d=r[c],u=i[c],h=u.length,f=a6e(e.call(d,d&&d.__data__,c,r)),p=f.length,m=s[c]=new Array(p),g=o[c]=new Array(p);n(d,u,m,g,l[c]=new Array(h),f,t);for(var v,b,y=0,x=0;y<p;++y)if(v=m[y]){for(y>=x&&(x=y+1);!(b=g[x])&&++x<p;);v._next=b||null}}return(o=new Z6e(o,r))._enter=s,o._exit=l,o},enter:function(){return new Z6e(this._enter||this._groups.map(e6e),this._parents)},exit:function(){return new Z6e(this._exit||this._groups.map(e6e),this._parents)},join:function(e,t,n){var r=this.enter(),i=this,a=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?a.remove():n(a),r&&i?r.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=new Array(i),l=0;l<o;++l)for(var c,d=n[l],u=r[l],h=d.length,f=s[l]=new Array(h),p=0;p<h;++p)(c=d[p]||u[p])&&(f[p]=c);for(;l<i;++l)s[l]=n[l];return new Z6e(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,i=e[t],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=o6e);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,s=n[a],l=s.length,c=i[a]=new Array(l),d=0;d<l;++d)(o=s[d])&&(c[d]=o);c.sort(t)}return new Z6e(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i,a=t[n],o=0,s=a.length;o<s;++o)(i=a[o])&&e.call(i,i.__data__,o,a);return this},attr:function(e,t){var n=B4e(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?l6e:s6e:"function"==typeof t?n.local?h6e:u6e:n.local?d6e:c6e)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?p6e:"function"==typeof t?g6e:m6e)(e,t,null==n?"":n)):v6e(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?b6e:"function"==typeof t?x6e:y6e)(e,t)):this.node()[e]},classed:function(e,t){var n=w6e(e+"");if(arguments.length<2){for(var r=O6e(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?z6e:t?E6e:N6e)(n,t))},text:function(e){return arguments.length?this.each(null==e?A6e:("function"==typeof e?P6e:T6e)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?M6e:("function"==typeof e?R6e:I6e)(e)):this.node().innerHTML},raise:function(){return this.each(D6e)},lower:function(){return this.each(L6e)},append:function(e){var t="function"==typeof e?e:q4e(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:q4e(e),r=null==t?j6e:"function"==typeof t?t:U4e(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(V6e)},clone:function(e){return this.select(e?B6e:Q6e)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,i,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(s=t?_6e:F6e,r=0;r<o;++r)this.each(s(a[r],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,d=s.length;c<d;++c)for(r=0,l=s[c];r<o;++r)if((i=a[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?U6e:W6e)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,i=e[t],a=0,o=i.length;a<o;++a)(r=i[a])&&(yield r)}};var K6e={passive:!1},$6e={capture:!0,passive:!1};function J6e(e){e.stopImmediatePropagation()}function e9e(e){e.preventDefault(),e.stopImmediatePropagation()}function t9e(e){var t=e.document.documentElement,n=X6e(e).on("dragstart.drag",e9e,$6e);"onselectstart"in t?n.on("selectstart.drag",e9e,$6e):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function n9e(e,t){var n=e.document.documentElement,r=X6e(e).on("dragstart.drag",null);t&&(r.on("click.drag",e9e,$6e),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var r9e=e=>()=>e;function i9e(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function a9e(e){return!e.ctrlKey&&!e.button}function o9e(){return this.parentNode}function s9e(e,t){return null==t?{x:e.x,y:e.y}:t}function l9e(){return navigator.maxTouchPoints||"ontouchstart"in this}function c9e(){var e,t,n,r,i=a9e,a=o9e,o=s9e,s=l9e,l={},c=D4e("start","drag","end"),d=0,u=0;function h(e){e.on("mousedown.drag",f).filter(s).on("touchstart.drag",g).on("touchmove.drag",v,K6e).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(o,s){if(!r&&i.call(this,o,s)){var l=y(this,a.call(this,o,s),o,s,"mouse");l&&(X6e(o.view).on("mousemove.drag",p,$6e).on("mouseup.drag",m,$6e),t9e(o.view),J6e(o),n=!1,e=o.clientX,t=o.clientY,l("start",o))}}function p(r){if(e9e(r),!n){var i=r.clientX-e,a=r.clientY-t;n=i*i+a*a>u}l.mouse("drag",r)}function m(e){X6e(e.view).on("mousemove.drag mouseup.drag",null),n9e(e.view,n),e9e(e),l.mouse("end",e)}function g(e,t){if(i.call(this,e,t))for(var n,r=e.changedTouches,o=a.call(this,e,t),s=r.length,l=0;l<s;++l)(n=y(this,o,e,t,r[l].identifier,r[l]))&&(J6e(e),n("start",e,r[l]))}function v(e){for(var t,n=e.changedTouches,r=n.length,i=0;i<r;++i)(t=l[n[i].identifier])&&(e9e(e),t("drag",e,n[i]))}function b(e){var t,n,i=e.changedTouches,a=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<a;++t)(n=l[i[t].identifier])&&(J6e(e),n("end",e,i[t]))}function y(e,t,n,r,i,a){var s,u,f,p=c.copy(),m=G6e(a||n,t);if(null!=(f=o.call(e,new i9e("beforestart",{sourceEvent:n,target:h,identifier:i,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:p}),r)))return s=f.x-m[0]||0,u=f.y-m[1]||0,function n(a,o,c){var g,v=m;switch(a){case"start":l[i]=n,g=d++;break;case"end":delete l[i],--d;case"drag":m=G6e(c||o,t),g=d}p.call(a,e,new i9e(a,{sourceEvent:o,subject:f,target:h,identifier:i,active:g,x:m[0]+s,y:m[1]+u,dx:m[0]-v[0],dy:m[1]-v[1],dispatch:p}),r)}}return h.filter=function(e){return arguments.length?(i="function"==typeof e?e:r9e(!!e),h):i},h.container=function(e){return arguments.length?(a="function"==typeof e?e:r9e(e),h):a},h.subject=function(e){return arguments.length?(o="function"==typeof e?e:r9e(e),h):o},h.touchable=function(e){return arguments.length?(s="function"==typeof e?e:r9e(!!e),h):s},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,h):Math.sqrt(u)},h}function d9e(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function u9e(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function h9e(){}i9e.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var f9e=.7,p9e=1/f9e,m9e="\\s*([+-]?\\d+)\\s*",g9e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",v9e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",b9e=/^#([0-9a-f]{3,8})$/,y9e=new RegExp(`^rgb\\(${m9e},${m9e},${m9e}\\)$`),x9e=new RegExp(`^rgb\\(${v9e},${v9e},${v9e}\\)$`),w9e=new RegExp(`^rgba\\(${m9e},${m9e},${m9e},${g9e}\\)$`),O9e=new RegExp(`^rgba\\(${v9e},${v9e},${v9e},${g9e}\\)$`),k9e=new RegExp(`^hsl\\(${g9e},${v9e},${v9e}\\)$`),S9e=new RegExp(`^hsla\\(${g9e},${v9e},${v9e},${g9e}\\)$`),C9e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function E9e(){return this.rgb().formatHex()}function N9e(){return this.rgb().formatRgb()}function z9e(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=b9e.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?A9e(t):3===n?new M9e(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?T9e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?T9e(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=y9e.exec(e))?new M9e(t[1],t[2],t[3],1):(t=x9e.exec(e))?new M9e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=w9e.exec(e))?T9e(t[1],t[2],t[3],t[4]):(t=O9e.exec(e))?T9e(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=k9e.exec(e))?V9e(t[1],t[2]/100,t[3]/100,1):(t=S9e.exec(e))?V9e(t[1],t[2]/100,t[3]/100,t[4]):C9e.hasOwnProperty(e)?A9e(C9e[e]):"transparent"===e?new M9e(NaN,NaN,NaN,0):null}function A9e(e){return new M9e(e>>16&255,e>>8&255,255&e,1)}function T9e(e,t,n,r){return r<=0&&(e=t=n=NaN),new M9e(e,t,n,r)}function P9e(e,t,n,r){return 1===arguments.length?function(e){return e instanceof h9e||(e=z9e(e)),e?new M9e((e=e.rgb()).r,e.g,e.b,e.opacity):new M9e}(e):new M9e(e,t,n,null==r?1:r)}function M9e(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function I9e(){return`#${j9e(this.r)}${j9e(this.g)}${j9e(this.b)}`}function R9e(){const e=D9e(this.opacity);return`${1===e?"rgb(":"rgba("}${L9e(this.r)}, ${L9e(this.g)}, ${L9e(this.b)}${1===e?")":`, ${e})`}`}function D9e(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function L9e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function j9e(e){return((e=L9e(e))<16?"0":"")+e.toString(16)}function V9e(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B9e(e,t,n,r)}function Q9e(e){if(e instanceof B9e)return new B9e(e.h,e.s,e.l,e.opacity);if(e instanceof h9e||(e=z9e(e)),!e)return new B9e;if(e instanceof B9e)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new B9e(o,s,l,e.opacity)}function B9e(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function F9e(e){return(e=(e||0)%360)<0?e+360:e}function _9e(e){return Math.max(0,Math.min(1,e||0))}function q9e(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function W9e(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}d9e(h9e,z9e,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:E9e,formatHex:E9e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Q9e(this).formatHsl()},formatRgb:N9e,toString:N9e}),d9e(M9e,P9e,u9e(h9e,{brighter(e){return e=null==e?p9e:Math.pow(p9e,e),new M9e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?f9e:Math.pow(f9e,e),new M9e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new M9e(L9e(this.r),L9e(this.g),L9e(this.b),D9e(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:I9e,formatHex:I9e,formatHex8:function(){return`#${j9e(this.r)}${j9e(this.g)}${j9e(this.b)}${j9e(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:R9e,toString:R9e})),d9e(B9e,function(e,t,n,r){return 1===arguments.length?Q9e(e):new B9e(e,t,n,null==r?1:r)},u9e(h9e,{brighter(e){return e=null==e?p9e:Math.pow(p9e,e),new B9e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?f9e:Math.pow(f9e,e),new B9e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new M9e(q9e(e>=240?e-240:e+120,i,r),q9e(e,i,r),q9e(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B9e(F9e(this.h),_9e(this.s),_9e(this.l),D9e(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=D9e(this.opacity);return`${1===e?"hsl(":"hsla("}${F9e(this.h)}, ${100*_9e(this.s)}%, ${100*_9e(this.l)}%${1===e?")":`, ${e})`}`}}));var U9e=e=>()=>e;function H9e(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):U9e(isNaN(e)?t:e)}var Z9e=function e(t){var n=function(e){return 1===(e=+e)?H9e:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):U9e(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=P9e(e)).r,(t=P9e(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=H9e(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function Y9e(e){return function(t){for(var n,r=t.length,i=new Array(r),a=new Array(r),o=new Array(r),s=0;s<r;++s)n=P9e(t[s]),i[s]=n.r||0,a[s]=n.g||0,o[s]=n.b||0;return i=e(i),a=e(a),o=e(o),n.opacity=1,function(e){return n.r=i(e),n.g=a(e),n.b=o(e),n+""}}}function X9e(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function G9e(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),a=new Array(n),o=0;o<r;++o)i[o]=r8e(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function K9e(e,t){var n=/* @__PURE__ */new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $9e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function J9e(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=r8e(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}Y9e(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return W9e((n-r/t)*t,o,i,a,s)}}),Y9e(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return W9e((n-r/t)*t,i,a,o,s)}});var e8e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,t8e=new RegExp(e8e.source,"g");function n8e(e,t){var n,r,i,a=e8e.lastIndex=t8e.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=e8e.exec(e))&&(r=t8e.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:$9e(n,r)})),a=t8e.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function r8e(e,t){var n,r=typeof t;return null==t||"boolean"===r?U9e(t):("number"===r?$9e:"string"===r?(n=z9e(t))?(t=n,Z9e):n8e:t instanceof z9e?Z9e:t instanceof Date?K9e:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?X9e:Array.isArray(t)?G9e:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?J9e:$9e)(e,t)}var i8e,a8e=180/Math.PI,o8e={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function s8e(e,t,n,r,i,a){var o,s,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*a8e,skewX:Math.atan(l)*a8e,scaleX:o,scaleY:s}}function l8e(e,t,n,r){function i(e){return e.length?e.pop()+" ":""}return function(a,o){var s=[],l=[];return a=e(a),o=e(o),function(e,r,i,a,o,s){if(e!==i||r!==a){var l=o.push("translate(",null,t,null,n);s.push({i:l-4,x:$9e(e,i)},{i:l-2,x:$9e(r,a)})}else(i||a)&&o.push("translate("+i+t+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(e,t,n,a){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:$9e(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(a.rotate,o.rotate,s,l),function(e,t,n,a){e!==t?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:$9e(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(a.skewX,o.skewX,s,l),function(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:$9e(e,n)},{i:s-2,x:$9e(t,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var c8e=l8e(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?o8e:s8e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),d8e=l8e(function(e){return null==e?o8e:(i8e||(i8e=document.createElementNS("http://www.w3.org/2000/svg","g")),i8e.setAttribute("transform",e),(e=i8e.transform.baseVal.consolidate())?s8e((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):o8e)},", ",")",")");function u8e(e){return((e=Math.exp(e))+1/e)/2}var h8e,f8e,p8e=function e(t,n,r){function i(e,i){var a,o,s=e[0],l=e[1],c=e[2],d=i[0],u=i[1],h=i[2],f=d-s,p=u-l,m=f*f+p*p;if(m<1e-12)o=Math.log(h/c)/t,a=function(e){return[s+e*f,l+e*p,c*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),v=(h*h-c*c+r*m)/(2*c*n*g),b=(h*h-c*c-r*m)/(2*h*n*g),y=Math.log(Math.sqrt(v*v+1)-v);o=(Math.log(Math.sqrt(b*b+1)-b)-y)/t,a=function(e){var r=e*o,i=u8e(y),a=c/(n*g)*(i*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*r+y)-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[s+a*f,l+a*p,c*i/u8e(t*r+y)]}}return a.duration=1e3*o*t/Math.SQRT2,a}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),m8e=0,g8e=0,v8e=0,b8e=0,y8e=0,x8e=0,w8e="object"==typeof performance&&performance.now?performance:Date,O8e="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function k8e(){return y8e||(O8e(S8e),y8e=w8e.now()+x8e)}function S8e(){y8e=0}function C8e(){this._call=this._time=this._next=null}function E8e(e,t,n){var r=new C8e;return r.restart(e,t,n),r}function N8e(){y8e=(b8e=w8e.now())+x8e,m8e=g8e=0;try{!function(){k8e(),++m8e;for(var e,t=h8e;t;)(e=y8e-t._time)>=0&&t._call.call(void 0,e),t=t._next;--m8e}()}finally{m8e=0,function(){for(var e,t,n=h8e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:h8e=t);f8e=e,A8e(r)}(),y8e=0}}function z8e(){var e=w8e.now(),t=e-b8e;t>1e3&&(x8e-=t,b8e=e)}function A8e(e){m8e||(g8e&&(g8e=clearTimeout(g8e)),e-y8e>24?(e<1/0&&(g8e=setTimeout(N8e,e-w8e.now()-x8e)),v8e&&(v8e=clearInterval(v8e))):(v8e||(b8e=w8e.now(),v8e=setInterval(z8e,1e3)),m8e=1,O8e(N8e)))}function T8e(e,t,n){var r=new C8e;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}C8e.prototype=E8e.prototype={constructor:C8e,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?k8e():+n)+(null==t?0:+t),this._next||f8e===this||(f8e?f8e._next=this:h8e=this,f8e=this),this._call=e,this._time=n,A8e()},stop:function(){this._call&&(this._call=null,this._time=1/0,A8e())}};var P8e=D4e("start","end","cancel","interrupt"),M8e=[];function I8e(e,t,n,r,i,a){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function a(l){var c,d,u,h;if(1!==n.state)return s();for(c in i)if((h=i[c]).name===n.name){if(3===h.state)return T8e(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[c]):+c<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[c])}if(T8e(function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function o(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(s),n.state=5,1),a=-1,o=r.length;++a<o;)r[a].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=E8e(function(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)},0,n.time)}(e,n,{name:t,index:r,group:i,on:P8e,tween:M8e,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function R8e(e,t){var n=L8e(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function D8e(e,t){var n=L8e(e,t);if(n.state>3)throw new Error("too late; already running");return n}function L8e(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function j8e(e,t){var n,r,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(n=a[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete e.__transition}}function V8e(e,t){var n,r;return function(){var i=D8e(this,e),a=i.tween;if(a!==n)for(var o=0,s=(r=n=a).length;o<s;++o)if(r[o].name===t){(r=r.slice()).splice(o,1);break}i.tween=r}}function Q8e(e,t,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=D8e(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=s;break}l===c&&i.push(s)}a.tween=i}}function B8e(e,t,n){var r=e._id;return e.each(function(){var e=D8e(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return L8e(e,r).value[t]}}function F8e(e,t){var n;return("number"==typeof t?$9e:t instanceof z9e?Z9e:(n=z9e(t))?(t=n,Z9e):n8e)(e,t)}function _8e(e){return function(){this.removeAttribute(e)}}function q8e(e){return function(){this.removeAttributeNS(e.space,e.local)}}function W8e(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttribute(e);return o===a?null:o===r?i:i=t(r=o,n)}}function U8e(e,t,n){var r,i,a=n+"";return function(){var o=this.getAttributeNS(e.space,e.local);return o===a?null:o===r?i:i=t(r=o,n)}}function H8e(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttribute(e))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttribute(e)}}function Z8e(e,t,n){var r,i,a;return function(){var o,s,l=n(this);if(null!=l)return(o=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:o===r&&s===i?a:(i=s,a=t(r=o,l));this.removeAttributeNS(e.space,e.local)}}function Y8e(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function X8e(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function G8e(e,t){return function(){R8e(this,e).delay=+t.apply(this,arguments)}}function K8e(e,t){return t=+t,function(){R8e(this,e).delay=t}}function $8e(e,t){return function(){D8e(this,e).duration=+t.apply(this,arguments)}}function J8e(e,t){return t=+t,function(){D8e(this,e).duration=t}}var e7e=Y6e.prototype.constructor;function t7e(e){return function(){this.style.removeProperty(e)}}var n7e=0;function r7e(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function i7e(){return++n7e}var a7e=Y6e.prototype;r7e.prototype=function(e){return Y6e().transition(e)}.prototype={constructor:r7e,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=U4e(e));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var s,l,c=r[o],d=c.length,u=a[o]=new Array(d),h=0;h<d;++h)(s=c[h])&&(l=e.call(s,s.__data__,h,c))&&("__data__"in s&&(l.__data__=s.__data__),u[h]=l,I8e(u[h],t,n,h,u,L8e(s,n)));return new r7e(a,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Z4e(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var l,c=r[s],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var h,f=e.call(l,l.__data__,u,c),p=L8e(l,n),m=0,g=f.length;m<g;++m)(h=f[m])&&I8e(h,t,n,m,f,p);a.push(f),o.push(l)}return new r7e(a,o,t,n)},selectChild:a7e.selectChild,selectChildren:a7e.selectChildren,filter:function(e){"function"!=typeof e&&(e=Y4e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var a,o=t[i],s=o.length,l=r[i]=[],c=0;c<s;++c)(a=o[c])&&e.call(a,a.__data__,c,o)&&l.push(a);return new r7e(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=new Array(r),s=0;s<a;++s)for(var l,c=t[s],d=n[s],u=c.length,h=o[s]=new Array(u),f=0;f<u;++f)(l=c[f]||d[f])&&(h[f]=l);for(;s<r;++s)o[s]=t[s];return new r7e(o,this._parents,this._name,this._id)},selection:function(){return new e7e(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=i7e(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,c=0;c<l;++c)if(o=s[c]){var d=L8e(o,t);I8e(o,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new r7e(r,this._parents,e,n)},call:a7e.call,nodes:a7e.nodes,node:a7e.node,size:a7e.size,empty:a7e.empty,each:a7e.each,on:function(e,t){var n=this._id;return arguments.length<2?L8e(this.node(),n).on.on(e):this.each(function(e,t,n){var r,i,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?R8e:D8e;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}(n,e,t))},attr:function(e,t){var n=B4e(e),r="transform"===n?d8e:F8e;return this.attrTween(e,"function"==typeof t?(n.local?Z8e:H8e)(n,r,B8e(this,"attr."+e,t)):null==t?(n.local?q8e:_8e)(n):(n.local?U8e:W8e)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=B4e(e);return this.tween(n,(r.local?Y8e:X8e)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?c8e:F8e;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var a=v6e(this,e),o=(this.style.removeProperty(e),v6e(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}(e,r)).on("end.style."+e,t7e(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,a;return function(){var o=v6e(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=v6e(this,e)),o===l?null:o===r&&l===i?a:(i=l,a=t(r=o,s))}}(e,r,B8e(this,"style."+e,t))).each(function(e,t){var n,r,i,a,o="style."+t,s="end."+o;return function(){var l=D8e(this,e),c=l.on,d=null==l.value[o]?a||(a=t7e(t)):void 0;c===n&&i===d||(r=(n=c).copy()).on(s,i=d),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,a=n+"";return function(){var o=v6e(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(B8e(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=L8e(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((null==t?V8e:Q8e)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?G8e:K8e)(t,e)):L8e(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?$8e:J8e)(t,e)):L8e(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){D8e(this,e).ease=t}}(t,e)):L8e(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;D8e(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},l={value:function(){0===--i&&a()}};n.each(function(){var n=D8e(this,r),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===i&&a()})},[Symbol.iterator]:a7e[Symbol.iterator]};var o7e={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function s7e(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Y6e.prototype.interrupt=function(e){return this.each(function(){j8e(this,e)})},Y6e.prototype.transition=function(e){var t,n;e instanceof r7e?(t=e._id,e=e._name):(t=i7e(),(n=o7e).time=k8e(),e=null==e?null:e+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,s=r[a],l=s.length,c=0;c<l;++c)(o=s[c])&&I8e(o,e,t,c,s,n||s7e(o,t));return new r7e(r,this._parents,e,t)};var l7e=e=>()=>e;function c7e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function d7e(e,t,n){this.k=e,this.x=t,this.y=n}d7e.prototype={constructor:d7e,scale:function(e){return 1===e?this:new d7e(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new d7e(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 u7e=new d7e(1,0,0);function h7e(e){for(;!e.__zoom;)if(!(e=e.parentNode))return u7e;return e.__zoom}function f7e(e){e.stopImmediatePropagation()}function p7e(e){e.preventDefault(),e.stopImmediatePropagation()}function m7e(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function g7e(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 v7e(){return this.__zoom||u7e}function b7e(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function y7e(){return navigator.maxTouchPoints||"ontouchstart"in this}function x7e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function w7e(){var e,t,n,r=m7e,i=g7e,a=x7e,o=b7e,s=y7e,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=p8e,h=D4e("start","zoom","end"),f=0,p=10;function m(e){e.property("__zoom",v7e).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new d7e(t,e.x,e.y)}function v(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new d7e(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,r){e.on("start.zoom",function(){x(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,a=arguments,o=x(e,a).event(r),s=i.apply(e,a),l=null==n?b(s):"function"==typeof n?n.apply(e,a):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,h="function"==typeof t?t.apply(e,a):t,f=u(d.invert(l).concat(c/d.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=f(e),n=c/t[2];e=new d7e(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function x(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function O(e,...t){if(r.apply(this,arguments)){var n=x(this,t).event(e),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,o.apply(this,arguments)))),d=G6e(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=i.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[d,i.invert(d)],j8e(this),n.start()}p7e(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(v(g(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function k(e,...t){if(!n&&r.apply(this,arguments)){var i=e.currentTarget,o=x(this,t,!0).event(e),s=X6e(e.view).on("mousemove.zoom",function(e){if(p7e(e),!o.moved){var t=e.clientX-d,n=e.clientY-u;o.moved=t*t+n*n>f}o.event(e).zoom("mouse",a(v(o.that.__zoom,o.mouse[0]=G6e(e,i),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),n9e(e.view,o.moved),p7e(e),o.event(e).end()},!0),l=G6e(e,i),d=e.clientX,u=e.clientY;t9e(e.view),f7e(e),o.mouse=[l,this.__zoom.invert(l)],j8e(this),o.start()}}function S(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,o=G6e(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(o),l=n.k*(e.shiftKey?.5:2),u=a(v(g(n,l),o,s),i.apply(this,t),c);p7e(e),d>0?X6e(this).transition().duration(d).call(y,u,o,e):X6e(this).call(m.transform,u,o,e)}}function C(n,...i){if(r.apply(this,arguments)){var a,o,s,l,c=n.touches,d=c.length,u=x(this,i,n.changedTouches.length===d).event(n);for(f7e(n),o=0;o<d;++o)l=[l=G6e(s=c[o],this),this.__zoom.invert(l),s.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,a=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),j8e(this),u.start())}}function E(e,...t){if(this.__zooming){var n,r,i,o,s=x(this,t).event(e),l=e.changedTouches,d=l.length;for(p7e(e),n=0;n<d;++n)i=G6e(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var u=s.touch0[0],h=s.touch0[1],f=s.touch1[0],p=s.touch1[1],m=(m=f[0]-u[0])*m+(m=f[1]-u[1])*m,b=(b=p[0]-h[0])*b+(b=p[1]-h[1])*b;r=g(r,Math.sqrt(m/b)),i=[(u[0]+f[0])/2,(u[1]+f[1])/2],o=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],o=s.touch0[1]}s.zoom("touch",a(v(r,i,o),s.extent,c))}}function N(e,...r){if(this.__zooming){var i,a,o=x(this,r).event(e),s=e.changedTouches,l=s.length;for(f7e(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)a=s[i],o.touch0&&o.touch0[2]===a.identifier?delete o.touch0:o.touch1&&o.touch1[2]===a.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(a=G6e(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<p)){var c=X6e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property("__zoom",v7e),e!==i?y(e,t,n,r):i.interrupt().each(function(){x(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,r){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,r)},m.scaleTo=function(e,t,n,r){m.transform(e,function(){var e=i.apply(this,arguments),r=this.__zoom,o=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(o),l="function"==typeof t?t.apply(this,arguments):t;return a(v(g(r,l),o,s),e,c)},n,r)},m.translateBy=function(e,t,n,r){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},m.translateTo=function(e,t,n,r,o){m.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,s=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return a(u7e.translate(s[0],s[1]).scale(o.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},r,o)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=X6e(this.that).datum();h.call(e,this.that,new c7e(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:h}),t)}},m.wheelDelta=function(e){return arguments.length?(o="function"==typeof e?e:l7e(+e),m):o},m.filter=function(e){return arguments.length?(r="function"==typeof e?e:l7e(!!e),m):r},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:l7e(!!e),m):s},m.extent=function(e){return arguments.length?(i="function"==typeof e?e:l7e([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):i},m.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],m):[l[0],l[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(u=e,m):u},m.on=function(){var e=h.on.apply(h,arguments);return e===h?m:e},m.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,m):Math.sqrt(f)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m}h7e.prototype=d7e.prototype;var O7e,k7e,S7e,C7e=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],E7e=["Enter"," ","Escape"],N7e={"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"};!function(e){e.Strict="strict",e.Loose="loose"}(O7e||(O7e={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(k7e||(k7e={})),function(e){e.Partial="partial",e.Full="full"}(S7e||(S7e={}));var z7e,A7e,T7e,P7e={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(z7e||(z7e={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(A7e||(A7e={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(T7e||(T7e={}));var M7e={[T7e.Left]:T7e.Right,[T7e.Right]:T7e.Left,[T7e.Top]:T7e.Bottom,[T7e.Bottom]:T7e.Top},I7e=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,R7e=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),D7e=(e,t=[0,0])=>{const{width:n,height:r}=set(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},L7e=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=W7e(n,Y7e(e)),r=!0)}),r?H7e(n):{x:0,y:0,width:0,height:0}},j7e=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{const s=(t.x-n)/i,l=(t.y-r)/i,c=t.width/i,d=t.height/i,u=[];for(const h of e.values()){const{measured:e,selectable:t=!0,hidden:n=!1}=h;if(o&&!t||n)continue;const r=e.width??h.width??h.initialWidth??0,i=e.height??h.height??h.initialHeight??0,{x:f,y:p}=h.internals.positionAbsolute,m=G7e(s,l,c,d,f,p,r,i),g=r*i,v=a&&m>0;(!h.internals.handleBounds||v||m>=g||h.dragging)&&u.push(h)}return u};function V7e({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){const o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},d=o.origin??r;let u=o.extent||i;if("parent"!==o.extent||o.expandParent)s&&oet(o.extent)&&(u=[[o.extent[0][0]+l,o.extent[0][1]+c],[o.extent[1][0]+l,o.extent[1][1]+c]]);else if(s){const{width:e,height:t}=set(s);e&&t&&(u=[[l,c],[l+e,c+t]])}else a?.("005","Only child nodes can use a parent extent.");const h=oet(u)?B7e(t,u,o.measured):t;return void 0!==o.measured.width&&void 0!==o.measured.height||a?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:h.x-l+(o.measured.width??0)*d[0],y:h.y-c+(o.measured.height??0)*d[1]},positionAbsolute:h}}var Q7e=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),B7e=(e={x:0,y:0},t,n)=>({x:Q7e(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Q7e(e.y,t[0][1],t[1][1]-(n?.height??0))});function F7e(e,t,n){const{width:r,height:i}=set(n),{x:a,y:o}=n.internals.positionAbsolute;return B7e(e,[[a,o],[a+r,o+i]],t)}var _7e=(e,t,n)=>e<t?Q7e(Math.abs(e-t),1,t)/t:e>n?-Q7e(Math.abs(e-n),1,t)/t:0,q7e=(e,t,n=15,r=40)=>[_7e(e.x,r,t.width-r)*n,_7e(e.y,r,t.height-r)*n],W7e=(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)}),U7e=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),H7e=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Z7e=(e,t=[0,0])=>{const{x:n,y:r}=R7e(e)?e.internals.positionAbsolute:D7e(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Y7e=(e,t=[0,0])=>{const{x:n,y:r}=R7e(e)?e.internals.positionAbsolute:D7e(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},X7e=(e,t)=>H7e(W7e(U7e(e),U7e(t))),G7e=(e,t,n,r,i,a,o,s)=>{const l=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),c=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(l*c)},K7e=(e,t)=>G7e(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$7e=e=>J7e(e.width)&&J7e(e.height)&&J7e(e.x)&&J7e(e.y),J7e=e=>!isNaN(e)&&isFinite(e),eet=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),tet=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return a?eet(s,o):s},net=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ret(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return 0}var iet=(e,t,n,r,i,a)=>{const o=function(e,t,n){if("string"==typeof e||"number"==typeof e){const r=ret(e,n),i=ret(e,t);return{top:r,right:i,bottom:r,left:i,x:2*i,y:2*r}}if("object"==typeof e){const r=ret(e.top??e.y??0,n),i=ret(e.bottom??e.y??0,n),a=ret(e.left??e.x??0,t),o=ret(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(a,t,n),s=(t-o.x)/e.width,l=(n-o.y)/e.height,c=Q7e(Math.min(s,l),r,i),d=t/2-(e.x+e.width/2)*c,u=n/2-(e.y+e.height/2)*c,h=function(e,t,n,r,i,a){const{x:o,y:s}=net(e,[t,n,r]),{x:l,y:c}=net({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-l,u=a-c;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(d),bottom:Math.floor(u)}}(e,d,u,c,t,n),f=Math.min(h.left-o.left,0),p=Math.min(h.top-o.top,0);return{x:d-f+Math.min(h.right-o.right,0),y:u-p+Math.min(h.bottom-o.bottom,0),zoom:c}},aet=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function oet(e){return null!=e&&"parent"!==e}function set(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cet(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function det(e,t={width:0,height:0},n,r,i){const a={...e},o=r.get(n);if(o){const e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function uet(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function het(e){return{...N7e,...e||{}}}function fet(e){return null===e?null:e?"valid":"invalid"}function pet(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:a,y:o}=xet(e),s=tet({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:l,y:c}=n?eet(s,t):s;return{xSnapped:l,ySnapped:c,...s}}var met=e=>({width:e.offsetWidth,height:e.offsetHeight}),get=e=>e?.getRootNode?.()||window?.document,vet=["INPUT","SELECT","TEXTAREA"];function bet(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(vet.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}var yet=e=>"clientX"in e,xet=(e,t)=>{const n=yet(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wet=(e,t,n,r,i)=>{const a=t.querySelectorAll(`.${e}`);return a&&a.length?Array.from(a).map(t=>{const a=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:i,position:t.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...met(t)}}):null};function Oet({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){const l=.125*e+.375*i+.375*o+.125*n,c=.125*t+.375*a+.375*s+.125*r;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ket(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function Cet({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case T7e.Left:return[t-ket(t-r,a),n];case T7e.Right:return[t+ket(r-t,a),n];case T7e.Top:return[t,n-ket(n-i,a)];case T7e.Bottom:return[t,n+ket(i-n,a)]}}function Eet({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top,curvature:o=.25}){const[s,l]=Cet({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[c,d]=Cet({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[u,h,f,p]=Oet({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${s},${l} ${c},${d} ${r},${i}`,u,h,f,p]}function Net({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function zet({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const a=W7e(Y7e(e),Y7e(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return K7e(o,H7e(a))>0}var Aet=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`;function Tet({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,a,o,s]=Net({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Pet={[T7e.Left]:{x:-1,y:0},[T7e.Right]:{x:1,y:0},[T7e.Top]:{x:0,y:-1},[T7e.Bottom]:{x:0,y:1}},Met=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Iet(e,t,n,r){const i=Math.min(Met(e,t)/2,Met(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o)return`L ${a+i*(e.x<n.x?-1:1)},${o}Q ${a},${o} ${a},${o+i*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function Ret({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top,borderRadius:o=5,centerX:s,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,h,f,p,m]=function({source:e,sourcePosition:t=T7e.Bottom,target:n,targetPosition:r=T7e.Top,center:i,offset:a,stepPosition:o}){const s=Pet[t],l=Pet[r],c={x:e.x+s.x*a,y:e.y+s.y*a},d={x:n.x+l.x*a,y:n.y+l.y*a},u=(({source:e,sourcePosition:t=T7e.Bottom,target:n})=>t===T7e.Left||t===T7e.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})({source:c,sourcePosition:t,target:d}),h=0!==u.x?"x":"y",f=u[h];let p,m,g=[];const v={x:0,y:0},b={x:0,y:0},[,,y,x]=Net({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[h]*l[h]===-1){"x"===h?(p=i.x??c.x+(d.x-c.x)*o,m=i.y??(c.y+d.y)/2):(p=i.x??(c.x+d.x)/2,m=i.y??c.y+(d.y-c.y)*o);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:m},{x:d.x,y:m}];g=s[h]===f?"x"===h?e:t:"x"===h?t:e}else{const i=[{x:c.x,y:d.y}],o=[{x:d.x,y:c.y}];if(g="x"===h?s.x===f?o:i:s.y===f?i:o,t===r){const t=Math.abs(e[h]-n[h]);if(t<=a){const r=Math.min(a-1,a-t);s[h]===f?v[h]=(c[h]>e[h]?-1:1)*r:b[h]=(d[h]>n[h]?-1:1)*r}}if(t!==r){const e="x"===h?"y":"x",t=s[h]===l[e],n=c[e]>d[e],r=c[e]<d[e];(1===s[h]&&(!t&&n||t&&r)||1!==s[h]&&(!t&&r||t&&n))&&(g="x"===h?i:o)}const u={x:c.x+v.x,y:c.y+v.y},y={x:d.x+b.x,y:d.y+b.y};Math.max(Math.abs(u.x-g[0].x),Math.abs(y.x-g[0].x))>=Math.max(Math.abs(u.y-g[0].y),Math.abs(y.y-g[0].y))?(p=(u.x+y.x)/2,m=g[0].y):(p=g[0].x,m=(u.y+y.y)/2)}const w={x:c.x+v.x,y:c.y+v.y},O={x:d.x+b.x,y:d.y+b.y};return[[e,...w.x!==g[0].x||w.y!==g[0].y?[w]:[],...g,...O.x!==g[g.length-1].x||O.y!==g[g.length-1].y?[O]:[],n],p,m,y,x]}({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:l},offset:c,stepPosition:d});let g=`M${u[0].x} ${u[0].y}`;for(let v=1;v<u.length-1;v++)g+=Iet(u[v-1],u[v],u[v+1],o);return g+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[g,h,f,p,m]}function Det(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Let(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,"source"===r.type?t.push(r):"target"===r.type&&n.push(r);return{source:t,target:n}}function jet(e,t,n=T7e.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??set(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case T7e.Top:return{x:i+o/2,y:a};case T7e.Right:return{x:i+o,y:a+s/2};case T7e.Bottom:return{x:i+o/2,y:a+s};case T7e.Left:return{x:i,y:a+s/2}}}function Vet(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Qet(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}var Bet={nodeOrigin:[0,0],nodeExtent:C7e,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Fet={...Bet,checkEquality:!0};function _et(e,t){const n={...e};for(const r in t)void 0!==t[r]&&(n[r]=t[r]);return n}function qet(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const t={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};"source"===i.type?n.push(t):"target"===i.type&&r.push(t)}return{source:n,target:r}}function Wet(e){return"manual"===e}function Uet(e,t,n,r={}){const i=_et(Fet,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!Wet(i.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=o.get(d.id);if(i.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=D7e(d,i.nodeOrigin),r=oet(d.extent)?d.extent:i.nodeExtent,a=B7e(n,r,set(d));e={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:a,handleBounds:qet(d,e),z:Zet(d,s,i.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Het(e,t,n,r,a),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Het(e,t,n,r,i){const{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:l}=_et(Bet,r),c=e.parentId,d=t.get(c);if(!d)return;!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,/* @__PURE__ */new Map([[e.id,e]]))}(e,n),i&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+10*i.i),i&&void 0!==d.internals.rootParentIndex&&(i.i=d.internals.rootParentIndex);const{x:u,y:h,z:f}=function(e,t,n,r,i,a){const{x:o,y:s}=t.internals.positionAbsolute,l=set(e),c=D7e(e,n),d=oet(e.extent)?B7e(c,e.extent,l):c;let u=B7e({x:o+d.x,y:s+d.y},r,l);"parent"===e.extent&&(u=F7e(u,l,t));const h=Zet(e,i,a),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=h?f+1:h}}(e,d,o,s,a&&!Wet(l)?1e3:0,l),{positionAbsolute:p}=e.internals,m=u!==p.x||h!==p.y;(m||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:u,y:h}:p,z:f}})}function Zet(e,t,n){const r=J7e(e.zIndex)?e.zIndex:0;return Wet(n)?r:r+(e.selected?t:0)}function Yet(e,t,n,r=[0,0]){const i=[],a=/* @__PURE__ */new Map;for(const o of e){const e=t.get(o.parentId);if(!e)continue;const n=a.get(o.parentId)?.expandedRect??Z7e(e),r=X7e(n,o.rect);a.set(o.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{const s=a.internals.positionAbsolute,l=set(a),c=a.origin??r,d=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,u=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),p=(h-l.width)*c[0],m=(f-l.height)*c[1];(d>0||u>0||p||m)&&(i.push({id:o,type:"position",position:{x:a.position.x-d+p,y:a.position.y-u+m}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&i.push({id:o,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?c[0]*d-p:0),height:f+(u?c[1]*u-m:0)}})}),i}function Xet(e,t,n,r,i,a){let o=i;const s=r.get(o)||/* @__PURE__ */new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;const l=r.get(o)||/* @__PURE__ */new Map;if(r.set(o,l.set(n,t)),a){o=`${i}-${e}-${a}`;const s=r.get(o)||/* @__PURE__ */new Map;r.set(o,s.set(n,t))}}function Get(e,t,n){e.clear(),t.clear();for(const r of n){const{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},l=`${n}-${a}--${i}-${o}`;Xet("source",s,`${i}-${o}--${n}-${a}`,e,n,a),Xet("target",s,l,e,i,o),t.set(r.id,r)}}function Ket(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ket(n,t))}function $et(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Jet({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[o,s]of t){const e=n.get(o)?.internals.userNode;e&&i.push({...e,position:s.position,dragging:r})}if(!e)return[i[0],i];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function ett(e,t,n,r,i,a=!1){const o=r.get(e);if(!o)return null;const s="strict"===i?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&a?{...l,...jet(o,l,l.position,!0)}:l}function ttt(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}var ntt=()=>!0;function rtt(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:l,isValidConnection:c=ntt,nodeLookup:d}){const u="target"===a,h=t?o.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:p}=xet(e),m=o.elementFromPoint(f,p),g=m?.classList.contains(`${s}-flow__handle`)?m:h,v={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const e=ttt(void 0,g),t=g.getAttribute("data-nodeid"),a=g.getAttribute("data-handleid"),o=g.classList.contains("connectable"),s=g.classList.contains("connectableend");if(!t||!e)return v;const l={source:u?t:r,sourceHandle:u?a:i,target:u?r:t,targetHandle:u?i:a};v.connection=l,v.isValid=o&&s&&(n===O7e.Strict?u&&"source"===e||!u&&"target"===e:t!==r||a!==i)&&c(l),v.toHandle=ett(t,e,a,d,n,!0)}return v}var itt,att={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:h,cancelConnection:f,onConnectStart:p,onConnect:m,onConnectEnd:g,isValidConnection:v=ntt,onReconnectEnd:b,updateConnection:y,getTransform:x,getFromHandle:w,autoPanSpeed:O,dragThreshold:k=1,handleDomNode:S}){const C=get(e.target);let E,N=0;const{x:z,y:A}=xet(e),T=ttt(a,S),P=s?.getBoundingClientRect();let M=!1;if(!P||!T)return;const I=ett(i,T,r,l,t);if(!I)return;let R=xet(e,P),D=!1,L=null,j=!1,V=null;function Q(){if(!d||!P)return;const[e,t]=q7e(R,P,O);h({x:e,y:t}),N=requestAnimationFrame(Q)}const B={...I,nodeId:i,type:T,position:I.position},F=l.get(i);let _={inProgress:!0,isValid:null,from:jet(F,B,T7e.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:F,to:R,toHandle:null,toPosition:M7e[B.position],toNode:null,pointer:R};function q(){M=!0,y(_),p?.(e,{nodeId:i,handleId:r,handleType:T})}function W(e){if(!M){const{x:t,y:n}=xet(e),r=t-z,i=n-A;if(!(r*r+i*i>k*k))return;q()}if(!w()||!B)return void U(e);const a=x();R=xet(e,P),E=function(e,t,n,r){let i=[],a=1/0;const o=function(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const a of t.values())K7e(i,Z7e(a))>0&&r.push(a);return r}(e,n,t+250);for(const s of o){const n=[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]];for(const o of n){if(r.nodeId===o.nodeId&&r.type===o.type&&r.id===o.id)continue;const{x:n,y:l}=jet(s,o,o.position,!0),c=Math.sqrt(Math.pow(n-e.x,2)+Math.pow(l-e.y,2));c>t||(c<a?(i=[{...o,x:n,y:l}],a=c):c===a&&i.push({...o,x:n,y:l}))}}if(!i.length)return null;if(i.length>1){const e="source"===r.type?"target":"source";return i.find(t=>t.type===e)??i[0]}return i[0]}(tet(R,a,!1,[1,1]),n,l,B),D||(Q(),D=!0);const s=rtt(e,{handle:E,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:v,doc:C,lib:c,flowId:u,nodeLookup:l});V=s.handleDomNode,L=s.connection,j=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!E,s.isValid);const d=l.get(i),h=d?jet(d,B,T7e.Left,!0):_.from,f={..._,from:h,isValid:j,to:s.toHandle&&j?net({x:s.toHandle.x,y:s.toHandle.y},a):R,toHandle:s.toHandle,toPosition:j&&s.toHandle?s.toHandle.position:M7e[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null,pointer:R};y(f),_=f}function U(e){if(!("touches"in e&&e.touches.length>0)){if(M){(E||V)&&L&&j&&m?.(L);const{inProgress:t,...n}=_,r={...n,toPosition:_.toHandle?_.toPosition:null};g?.(e,r),a&&b?.(e,r)}f(),cancelAnimationFrame(N),D=!1,j=!1,L=null,V=null,C.removeEventListener("mousemove",W),C.removeEventListener("mouseup",U),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",U)}}0===k&&q(),C.addEventListener("mousemove",W),C.addEventListener("mouseup",U),C.addEventListener("touchmove",W),C.addEventListener("touchend",U)},isValid:rtt},ott=e=>({x:e.x,y:e.y,zoom:e.k}),stt=({x:e,y:t,zoom:n})=>u7e.translate(e,t).scale(n),ltt=(e,t)=>e.target.closest(`.${t}`),ctt=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),dtt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,utt=(e,t=0,n=dtt,r=()=>{})=>{const i="number"==typeof t&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},htt=e=>{const t=e.ctrlKey&&aet()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function ftt(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ptt(e,t){return Math.max(0,t-e)}function mtt(e,t){return Math.max(0,e-t)}function gtt(e,t,n){return Math.max(0,t-e,e-n)}function vtt(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(itt||(itt={}));var btt={width:0,height:0,x:0,y:0},ytt={...btt,pointerX:0,pointerY:0,aspectRatio:1};function xtt(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,l=n[1]*o;return[[r-s,i-l],[r+a-s,i+o-l]]}var{useRef:wtt,useEffect:Ott,useMemo:ktt,useDebugValue:Stt}=e,Ctt={useSyncExternalStoreWithSelector:(e,t,n,r,i)=>{const a=wtt(null);let o;null===a.current?(o={hasValue:!1,value:null},a.current=o):o=a.current;const[s,l]=ktt(()=>{let e,a,s=!1;const l=t=>{if(!s){s=!0,e=t;const n=r(t);if(void 0!==i&&o.hasValue){const e=o.value;if(i(e,n))return a=e,e}return a=n,n}const n=e,l=a;if(Object.is(n,t))return l;const c=r(t);return void 0!==i&&i(l,c)?(e=t,l):(e=t,a=c,c)},c=void 0===n?null:n;return[()=>l(t()),null===c?void 0:()=>l(c())]},[t,n,r,i]),c=N(e,s,l);return Ott(()=>{o.hasValue=!0,o.value=c},[c]),Stt(c),c}},Ett=e=>{let t;const n=/* @__PURE__ */new Set,r=(e,r)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},{useDebugValue:Ntt}=t,{useSyncExternalStoreWithSelector:ztt}=Ctt,Att=e=>e;function Ttt(e,t=Att,n){const r=ztt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ntt(r),r}var Ptt=(e,t)=>{const n=(e=>e?Ett(e):Ett)(e),r=(e,r=t)=>Ttt(n,e,r);return Object.assign(r,n),r};function Mtt(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Itt=l(null),Rtt=Itt.Provider,Dtt=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function Ltt(e,t){const n=v(Itt);if(null===n)throw new Error(Dtt);return Ttt(n,e,t)}function jtt(){const e=v(Itt);if(null===e)throw new Error(Dtt);return k(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Vtt={display:"none"},Qtt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Btt="react-flow__node-desc",Ftt="react-flow__edge-desc",_tt=e=>e.ariaLiveMessage,qtt=e=>e.ariaLabelConfig;function Wtt({rfId:e}){const t=Ltt(_tt);return T("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Qtt,children:t})}function Utt({rfId:e,disableKeyboardA11y:t}){const n=Ltt(qtt);return P(A,{children:[T("div",{id:`${Btt}-${e}`,style:Vtt,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T("div",{id:`${Ftt}-${e}`,style:Vtt,children:n["edge.a11yDescription.default"]}),!t&&T(Wtt,{rfId:e})]})}var Htt=u(({position:e="top-left",children:t,className:n,style:r,...i},a)=>{const o=`${e}`.split("-");return T("div",{className:I4e(["react-flow__panel",n,...o]),style:r,ref:a,...i,children:t})});Htt.displayName="Panel";var Ztt="https://reactflow.dev?utm_source=attribution";function Ytt({proOptions:e,position:t="bottom-right"}){return y(()=>{},[]),e?.hideAttribution?null:T(Htt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ztt}`,children:T("a",{href:Ztt,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xtt=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Gtt=e=>e.id;function Ktt(e,t){return Mtt(e.selectedNodes.map(Gtt),t.selectedNodes.map(Gtt))&&Mtt(e.selectedEdges.map(Gtt),t.selectedEdges.map(Gtt))}function $tt({onSelectionChange:e}){const t=jtt(),{selectedNodes:n,selectedEdges:r}=Ltt(Xtt,Ktt);return y(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Jtt=e=>!!e.onSelectionChangeHandlers;function ent({onSelectionChange:e}){const t=Ltt(Jtt);return e||t?T($tt,{onSelectionChange:e}):null}var tnt=[0,0],nnt={x:0,y:0,zoom:1},rnt=["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","rfId"],int=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}),ant={translateExtent:C7e,nodeOrigin:tnt,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ont(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:l}=Ltt(int,Mtt),c=jtt();y(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=ant,s()}),[]);const d=C(ant);return y(()=>{for(const s of rnt){const l=e[s];l!==d.current[s]&&void 0!==e[s]&&("nodes"===s?t(l):"edges"===s?n(l):"minZoom"===s?r(l):"maxZoom"===s?i(l):"translateExtent"===s?a(l):"nodeExtent"===s?o(l):"ariaLabelConfig"===s?c.setState({ariaLabelConfig:het(l)}):"fitView"===s?c.setState({fitViewQueued:l}):"fitViewOptions"===s?c.setState({fitViewOptions:l}):c.setState({[s]:l}))}d.current=e},rnt.map(t=>e[t])),null}function snt(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}var lnt="undefined"!=typeof document?document:null;function cnt(e=null,t={target:lnt,actInsideInputWithModifier:!0}){const[n,r]=E(!1),i=C(!1),a=C(/* @__PURE__ */new Set([])),[o,s]=k(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n"));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return y(()=>{const n=t?.target??lnt,l=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!l)&&bet(e))return!1;const n=unt(e.code,s);if(a.current.add(e[n]),dnt(o,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,a="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&a||e.preventDefault(),r(!0)}},c=e=>{const t=unt(e.code,s);dnt(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function dnt(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function unt(e,t){return t.includes(e)?"code":"key"}function hnt(e,t){const n=[],r=/* @__PURE__ */new Map,i=[];for(const a of e)if("add"!==a.type)if("remove"===a.type||"replace"===a.type)r.set(a.id,[a]);else{const e=r.get(a.id);e?e.push(a):r.set(a.id,[a])}else i.push(a);for(const a of t){const e=r.get(a.id);if(!e){n.push(a);continue}if("remove"===e[0].type)continue;if("replace"===e[0].type){n.push({...e[0].item});continue}const t={...a};for(const n of e)fnt(n,t);n.push(t)}return i.length&&i.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function fnt(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function pnt(e,t){return hnt(e,t)}function mnt(e,t){return hnt(e,t)}function gnt(e,t){return{id:e,type:"select",selected:t}}function vnt(e,t=/* @__PURE__ */new Set,n=!1){const r=[];for(const[i,a]of e){const e=t.has(i);void 0===a.selected&&!e||a.selected===e||(n&&(a.selected=e),r.push(gnt(a.id,e)))}return r}function bnt({items:e=[],lookup:t}){const n=[],r=new Map(e.map(e=>[e.id,e]));for(const[i,a]of e.entries()){const e=t.get(a.id),r=e?.internals?.userNode??e;void 0!==r&&r!==a&&n.push({id:a.id,item:a,type:"replace"}),void 0===r&&n.push({item:a,type:"add",index:i})}for(const[i]of t)void 0===r.get(i)&&n.push({id:i,type:"remove"});return n}function ynt(e){return{id:e.id,type:"remove"}}var xnt=(e,t)=>{};var wnt=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function Ont(e){return u(e)}var knt="undefined"!=typeof window?O:y;function Snt(e){const[t,n]=E(BigInt(0)),[r]=E(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return knt(()=>{const t=r.get();t.length&&(e(t),r.reset())},[t]),r}var Cnt=l(null);function Ent({children:e}){const t=jtt(),n=Snt(g(e=>{const{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=bnt({items:c,lookup:o});for(const t of l.values())d=t(d);i&&r(c),d.length>0?a?.(d):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Snt(g(e=>{const{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState();let s=n;for(const t of e)s="function"==typeof t?t(s):t;i?r(s):a&&a(bnt({items:s,lookup:o}))},[])),i=k(()=>({nodeQueue:n,edgeQueue:r}),[]);return T(Cnt.Provider,{value:i,children:e})}var Nnt=e=>!!e.panZoom;function znt(){const e=(()=>{const e=jtt();return k(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return!!r&&r.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,a],panZoom:o}=e.getState();return!!o&&(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),l=iet(t,r,i,a,o,n?.padding??.1);return!!s&&(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;const{x:s,y:l}=o.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},d=n.snapGrid??i,u=n.snapToGrid??a;return tet(c,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:a}=r.getBoundingClientRect(),o=net(t,n);return{x:o.x+i,y:o.y+a}}}),[])})(),t=jtt(),n=function(){const e=v(Cnt);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Ltt(Nnt),i=k(()=>{const e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{const{nodeLookup:n,nodeOrigin:r}=t.getState(),i=wnt(e)?e:n.get(e.id),a=i.parentId?det(i.position,i.measured,i.parentId,n,r):i.position,o={...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height};return Z7e(o)},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){const e="function"==typeof t?t(r):t;return n.replace&&wnt(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){const e="function"==typeof t?t(r):t;return n.replace&&I7e(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:h}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const a=new Set(e.map(e=>e.id)),o=[];for(const u of n){if(!1===u.deletable)continue;const e=a.has(u.id),t=!e&&u.parentId&&o.find(e=>e.id===u.parentId);(e||t)&&o.push(u)}const s=new Set(t.map(e=>e.id)),l=r.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=/* @__PURE__ */new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(o,l);for(const u of l)s.has(u.id)&&!c.find(e=>e.id===u.id)&&c.push(u);if(!i)return{edges:c,nodes:o};const d=await i({nodes:o,edges:c});return"boolean"==typeof d?d?{edges:c,nodes:o}:{edges:[],nodes:[]}:d}({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:d}),f=h.length>0,p=u.length>0;if(f){const e=h.map(ynt);o?.(h),l(e)}if(p){const e=u.map(ynt);a?.(u),s(e)}return(p||f)&&c?.({nodes:u,edges:h}),{deletedNodes:u,deletedEdges:h}},getIntersectingNodes:(e,n=!0,r)=>{const i=$7e(e),o=i?e:a(e),s=void 0!==r;return o?(r||t.getState().nodes).filter(r=>{const a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;const l=Z7e(s?r:a),c=K7e(l,o);return n&&c>0||c>=l.width*l.height||c>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const r=$7e(e)?e:a(e);if(!r)return!1;const i=K7e(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{const r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:r}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((e,r)=>{const i="string"==typeof r;let a=t.nodeLookup||i?void 0:r;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):R7e(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,W7e(e,Y7e(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?H7e(r):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const r=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return k(()=>({...i,...e,viewportInitialized:r}),[r])}var Ant=e=>e.selected,Tnt="undefined"!=typeof window?window:void 0,Pnt={position:"absolute",width:"100%",height:"100%",top:0,left:0},Mnt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Int({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=k7e.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:v,noPanClassName:b,onViewportChange:x,isControlledViewport:w,paneClickDistance:O,selectionOnDrag:k}){const S=jtt(),E=C(null),{userSelectionActive:N,lib:z,connectionInProgress:A}=Ltt(Mnt,Mtt),P=cnt(f),M=C();!function(e){const t=jtt();y(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=met(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(E);const I=g(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),w||S.setState({transform:e})},[x,w]);return y(()=>{if(E.current){M.current=function({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];("undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);const h=w7e().extent(()=>u).scaleExtent([t,n]).translateExtent(r),f=X6e(e).call(h);b({x:i.x,y:i.y,zoom:Q7e(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=f.on("wheel.zoom"),m=f.on("dblclick.zoom");async function g(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).transform(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})}function v(){h.on("zoom",null)}async function b(e,t,n){const r=stt(e),i=h?.constrain()(r,t,n);return i&&await g(i),i}return h.wheelDelta(htt),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:g,preventScrolling:b,zoomOnPinch:y,zoomOnScroll:x,zoomOnDoubleClick:w,panActivationKeyPressed:O=!1,zoomActivationKeyPressed:k,lib:S,onTransformChange:C,connectionInProgress:E,paneClickDistance:N,selectionOnDrag:z}){r&&!c.isZoomingOrPanning&&v();const A=i&&!k&&!r;h.clickDistance(z?1/0:!J7e(N)||N<0?0:N);const T=A?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(ltt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&o){const e=G6e(d),t=htt(d),i=u*Math.pow(2,t);return void r.scaleTo(n,i,e,d)}const h=1===d.deltaMode?20:1;let f=i===k7e.Vertical?0:d.deltaX*h,p=i===k7e.Horizontal?0:d.deltaY*h;!aet()&&d.shiftKey&&i!==k7e.Vertical&&(f=d.deltaY*h,p=0),r.translateBy(n,-f/u*a,-p/u*a,{internal:!0});const m=ott(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,m):(e.isPanScrolling=!0,s?.(d,m)),e.panScrollTimeout=setTimeout(()=>{c?.(d,m),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:f,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const a="wheel"===r.type,o=!t&&a&&!r.ctrlKey,s=ltt(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}({noWheelClassName:e,preventScrolling:b,d3ZoomHandler:p});f.on("wheel.zoom",T,{passive:!1});const P=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=ott(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,"mousedown"===r.sourceEvent?.type&&t(!0),n&&n?.(r.sourceEvent,i)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:o});h.on("start",P);const M=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!(!n||!ctt(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ott(a.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:C});h.on("zoom",M);const I=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ctt(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const t=ott(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:l});h.on("end",I);const R=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return h=>{const f=t||n,p=r&&h.ctrlKey,m="wheel"===h.type;if(1===h.button&&"mousedown"===h.type&&(ltt(h,`${d}-flow__node`)||ltt(h,`${d}-flow__edge`)||ltt(h,`${d}-flow__selection`)||ltt(h,`${d}-flow__nodesselection`)))return!0;if(!(i||f||a||o||r))return!1;if(s)return!1;if(u&&!m)return!1;if(ltt(h,l)&&m)return!1;if(ltt(h,c)&&(!m||a&&m&&!t))return!1;if(!r&&h.ctrlKey&&m)return!1;if(!r&&"touchstart"===h.type&&h.touches?.length>1)return h.preventDefault(),!1;if(!f&&!a&&!p&&m)return!1;if(!i&&("mousedown"===h.type||"touchstart"===h.type))return!1;if(Array.isArray(i)&&!i.includes(h.button)&&"mousedown"===h.type)return!1;const g=Array.isArray(i)&&i.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||m||e)&&g}}({panActivationKeyPressed:O,zoomActivationKeyPressed:k,panOnDrag:d,zoomOnScroll:x,panOnScroll:i,zoomOnDoubleClick:w,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:S,connectionInProgress:E});h.filter(R),w?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)},destroy:v,setViewport:async function(e,t){const n=stt(e);return await g(n,t),n},setViewportConstrained:b,getViewport:function(){const e=f?h7e(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).scaleTo(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!f&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?r8e:p8e).scaleBy(utt(f,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(f){const t=stt(e),n=f.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(f,t,null,{sync:!0})}},setClickDistance:function(e){const t=!J7e(e)||e<0?0:e;h?.clickDistance(t)}}}({domNode:E.current,minZoom:u,maxZoom:h,translateExtent:d,viewport:c,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{M.current?.destroy()}}},[]),y(()=>{M.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:P,preventScrolling:p,noPanClassName:b,userSelectionActive:N,noWheelClassName:v,lib:z,onTransformChange:I,connectionInProgress:A,selectionOnDrag:k,paneClickDistance:O})},[e,t,n,r,i,a,o,s,l,P,p,b,N,v,z,I,A,k,O]),T("div",{className:"react-flow__renderer",ref:E,style:Pnt,children:m})}var Rnt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Dnt(){const{userSelectionActive:e,userSelectionRect:t}=Ltt(Rnt,Mtt);return e&&t?T("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Lnt=(e,t)=>n=>{n.target===t.current&&e?.(n)},jnt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Vnt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=S7e.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){const g=C(0),v=jtt(),{userSelectionActive:b,elementsSelectable:x,dragging:w,panBy:O,autoPanSpeed:k}=Ltt(jnt,Mtt),S=x&&(e||b),E=C(null),N=C(),z=C(/* @__PURE__ */new Set),A=C(/* @__PURE__ */new Set),M=C(!1),I=C(!1),R=C({x:0,y:0}),D=C(!1),L=e=>{if(I.current||M.current||v.getState().connection.inProgress)return I.current=!1,void(M.current=!1);c?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},j=u?e=>u(e):void 0;function V(e,t){const{userSelectionRect:r}=v.getState();if(!r)return;const{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=v.getState(),u={x:r.startX,y:r.startY},{x:h,y:f}=net(u,i),p={startX:u.x,startY:u.y,x:e<h?e:h,y:t<f?t:f,width:Math.abs(e-h),height:Math.abs(t-f)},m=z.current,g=A.current;z.current=new Set(j7e(a,p,i,n===S7e.Partial,!0).map(e=>e.id)),A.current=/* @__PURE__ */new Set;const b=d?.selectable??!0;for(const n of z.current){const e=s.get(n);if(e)for(const{edgeId:t}of e.values()){const e=o.get(t);e&&(e.selectable??b)&&A.current.add(t)}}uet(m,z.current)||l(vnt(a,z.current,!0)),uet(g,A.current)||c(vnt(o,A.current)),v.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function Q(){if(!i||!N.current)return;const[e,t]=q7e(R.current,N.current,k);O({x:e,y:t}).then(e=>{if(!I.current||!e)return void(g.current=requestAnimationFrame(Q));const{x:t,y:n}=R.current;V(t,n),g.current=requestAnimationFrame(Q)})}const B=()=>{cancelAnimationFrame(g.current),g.current=0,D.current=!1};y(()=>()=>B(),[]);const F=!0===r||Array.isArray(r)&&r.includes(0);return P("div",{className:I4e(["react-flow__pane",{draggable:F,dragging:w,selection:e}]),onClick:S?void 0:Lnt(L,E),onContextMenu:Lnt(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():d?.(e)},E),onWheel:Lnt(j,E),onPointerEnter:S?void 0:h,onPointerMove:S?e=>{const{userSelectionRect:n,transform:r,resetSelectedElements:i}=v.getState();if(!N.current||!n)return;const{x:o,y:l}=xet(e.nativeEvent,N.current);R.current={x:o,y:l};const c=net({x:n.startX,y:n.startY},r);if(!I.current){const n=t?0:a;if(Math.hypot(o-c.x,l-c.y)<=n)return;i(),s?.(e)}I.current=!0,D.current||(Q(),D.current=!0),V(o,l)}:f,onPointerUp:e=>{S?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&v.getState().userSelectionRect&&L?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(l?.(e),v.setState({nodesSelectionActive:z.current.size>0})),B()):e.target===E.current&&v.getState().connection.inProgress&&(M.current=!0)},onPointerCancel:S?e=>{e.target?.releasePointerCapture?.(e.pointerId),B()}:void 0,onPointerDownCapture:S?n=>{if("touch"===n.pointerType&&!1!==r&&!t)return;const{domNode:i,transform:a}=v.getState();if(N.current=i?.getBoundingClientRect(),!N.current)return;const s=n.target===E.current;if(!s&&n.target.closest(".nokey")||!e||!(o&&s||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=xet(n.nativeEvent,N.current),d=tet({x:l,y:c},a);v.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),s||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:S?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:p,ref:E,style:Pnt,children:[m,T(Dnt,{})]})}function Qnt({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&o)&&(a({nodes:[c],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):l?.("012",(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.`)(e))}function Bnt({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){const s=jtt(),[l,c]=E(!1),d=C();return y(()=>{if(!t)return d.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=/* @__PURE__ */new Map,l=!1,c={x:0,y:0},d=null,u=!1,h=null,f=!1,p=!1,m=null;return{update:function({noDragClassName:g,handleSelector:v,domNode:b,isSelectable:y,nodeId:x,nodeClickDistance:w=0}){function O({x:e,y:n}){const{nodeLookup:i,nodeExtent:o,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:h,onError:f,updateNodePositions:g}=t();a={x:e,y:n};let v=!1;const b=s.size>1,y=b&&o?U7e(L7e(s)):null,w=b&&c?function({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const a={x:n-i.distance.x,y:r-i.distance.y},o=eet(a,t);return{x:o.x-a.x,y:o.y-a.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(const[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};c&&(a=w?{x:Math.round(a.x+w.x),y:Math.round(a.y+w.y)}:eet(a,l));let s=null;if(b&&o&&!r.extent&&y){const{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0];s=[[t,e.y-y.y+o[0][1]],[n,e.y+r.measured.height-y.y2+o[1][1]]]}const{position:u,positionAbsolute:h}=V7e({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:d,onError:f});v=v||r.position.x!==u.x||r.position.y!==u.y,r.position=u,r.internals.positionAbsolute=h}if(p=p||v,v&&(g(s,!0),m&&(r||u||!x&&h))){const[e,t]=Jet({nodeId:x,dragItems:s,nodeLookup:i});r?.(m,s,e,t),u?.(m,e,t),x||h?.(m,t)}}async function k(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i)return l=!1,void cancelAnimationFrame(o);const[s,u]=q7e(c,d,r);0===s&&0===u||(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-u/e[2],await n({x:s,y:u})&&O(a)),o=requestAnimationFrame(k)}function S(r){const{nodeLookup:i,multiSelectionActive:o,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:m,onSelectionDragStart:g,unselectNodesAndEdges:v}=t();u=!0,p&&y||o||!x||i.get(x)?.selected||v(),y&&p&&x&&e?.(x);const b=pet(r.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:d});if(a=b,s=function(e,t,n,r){const i=/* @__PURE__ */new Map;for(const[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Ket(o,e))&&(o.draggable||t&&void 0===o.draggable)){const t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}(i,l,b,x),s.size>0&&(n||m||!x&&g)){const[e,t]=Jet({nodeId:x,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),m?.(r.sourceEvent,e,t),x||g?.(r.sourceEvent,t)}}h=X6e(b);const C=c9e().clickDistance(w).on("start",e=>{const{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();d=n?.getBoundingClientRect()||null,f=!1,p=!1,m=e.sourceEvent,0===r&&S(e),a=pet(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:d}),c=xet(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:h,nodeLookup:p}=t(),g=pet(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:d});if(m=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||x&&!p.has(x))&&(f=!0),!f){if(!l&&n&&u&&(l=!0,k()),!u){const t=xet(e.sourceEvent,d),n=t.x-c.x,r=t.y-c.y;Math.sqrt(n*n+r*r)>h&&S(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&u&&(c=xet(e.sourceEvent,d),O(g))}}).on("end",e=>{if(u&&!f){if(l=!1,u=!1,cancelAnimationFrame(o),s.size>0){const{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(p&&(r(s,!1),p=!1),i||a||!x&&o){const[t,r]=Jet({nodeId:x,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),x||o?.(e.sourceEvent,r)}}}else f&&s.size>0&&t().updateNodePositions(s,!1)}).filter(e=>{const t=e.target;return!e.button&&(!g||!$et(t,`.${g}`,b))&&(!v||$et(t,v,b))});h.call(C)},destroy:function(){h?.on(".drag",null)}}}({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Qnt({id:t,store:s,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}}),()=>{d.current?.destroy(),d.current=void 0}},[t,s,e]),y(()=>{!t&&e.current&&d.current&&d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),l}function Fnt(){const e=jtt();return g(t=>{const{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),d=/* @__PURE__ */new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(a),h=r?i[0]:5,f=r?i[1]:5,p=t.direction.x*h*t.factor,m=t.direction.y*f*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+m};r&&(t=eet(t,i));const{position:a,positionAbsolute:s}=V7e({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:o});e.position=a,e.internals.positionAbsolute=s,d.set(e.id,e)}s(d)},[])}var _nt=l(null),qnt=_nt.Provider;_nt.Consumer;var Wnt=()=>v(_nt),Unt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Hnt=l(null);function Znt({children:e}){const t=Ltt(Unt,Mtt);return T(Hnt.Provider,{value:t,children:e})}var Ynt={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Xnt=p(Ont(function({type:e="source",position:t=T7e.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:l,className:c,onMouseDown:d,onTouchStart:u,...h},f){const p=o||null,m="target"===e,g=jtt(),b=Wnt(),{connectOnClick:y,noPanClassName:x,rfId:w}=function(){const e=v(Hnt);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:O,connectingTo:k,clickConnecting:S,isPossibleEndHandle:C,connectionInProcess:E,clickConnectionInProcess:N,valid:z}=Ltt(((e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:l,isValid:c}=o;if(!s&&!i)return Ynt;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:d,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===O7e.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:d&&c}})(b,p,e),Mtt);b||g.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const A=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){const{edges:e,setEdges:t,onError:n}=g.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const r=n.getEdgeId||Aet;let i;return i=I7e(e)?{...e}:{...e,id:r(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(i,t)?t:(null===i.sourceHandle&&delete i.sourceHandle,null===i.targetHandle&&delete i.targetHandle,t.concat(i))})(e,t,{...n,onError:n.onError??xnt})}(i,e,{onError:n}))}n?.(i),s?.(i)},P=e=>{if(!b)return;const t=yet(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=g.getState();att.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:m,handleId:p,nodeId:b,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:A,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?d?.(e):u?.(e)};return T("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${w}-${b}-${p}-${e}`,className:I4e(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,c,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:a,clickconnecting:S,connectingfrom:O,connectingto:k,valid:z,connectionindicator:r&&(!E||C)&&(E||N?a:i)}]),onMouseDown:P,onTouchStart:P,onClick:y?t=>{const{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:h}=g.getState();if(!b||!o&&!i)return;if(!o)return r?.(t.nativeEvent,{nodeId:b,handleId:p,handleType:e}),void g.setState({connectionClickStartHandle:{nodeId:b,type:e,id:p}});const f=get(t.target),m=n||l,{connection:v,isValid:y}=att.isValid(t.nativeEvent,{handle:{nodeId:b,id:p,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:m,flowId:d,doc:f,lib:c,nodeLookup:u});y&&v&&A(v);const x=structuredClone(h);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,a?.(t,x),g.setState({connectionClickStartHandle:null})}:void 0,ref:f,...h,children:l})})),Gnt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Knt={input:function({data:e,isConnectable:t,sourcePosition:n=T7e.Bottom}){return P(A,{children:[e?.label,T(Xnt,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=T7e.Top,sourcePosition:r=T7e.Bottom}){return P(A,{children:[T(Xnt,{type:"target",position:n,isConnectable:t}),e?.label,T(Xnt,{type:"source",position:r,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=T7e.Top}){return P(A,{children:[T(Xnt,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},$nt=e=>{const{width:t,height:n,x:r,y:i}=L7e(e.nodeLookup,{filter:e=>!!e.selected});return{width:J7e(t)?t:null,height:J7e(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Jnt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=jtt(),{width:i,height:a,transformString:o,userSelectionActive:s}=Ltt($nt,Mtt),l=Fnt(),c=C(null);y(()=>{n||c.current?.focus({preventScroll:!0})},[n]);const d=!s&&null!==i&&null!==a;if(Bnt({nodeRef:c,disabled:!d}),!d)return null;const u=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return T("div",{className:I4e(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:T("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Gnt,e.key)&&(e.preventDefault(),l({direction:Gnt[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var ert="undefined"!=typeof window?window:void 0,trt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function nrt({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:u,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:g,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:C,autoPanOnSelection:E,defaultViewport:N,translateExtent:z,minZoom:A,maxZoom:M,preventScrolling:I,onSelectionContextMenu:R,noWheelClassName:D,noPanClassName:L,disableKeyboardA11y:j,onViewportChange:V,isControlledViewport:Q}){const{nodesSelectionActive:B,userSelectionActive:F}=Ltt(trt,Mtt),_=cnt(c,{target:ert}),q=cnt(m,{target:ert}),W=q||C,U=q||w,H=d&&!0!==W,Z=_||F||H;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=jtt(),{deleteElements:r}=znt(),i=cnt(e,{actInsideInputWithModifier:!1}),a=cnt(t,{target:Tnt});y(()=>{if(i){const{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Ant),edges:e.filter(Ant)}),n.setState({nodesSelectionActive:!1})}},[i]),y(()=>{n.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:l,multiSelectionKeyCode:p}),T(Int,{onPaneContextMenu:a,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:U,panActivationKeyPressed:q,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!_&&W,defaultViewport:N,translateExtent:z,minZoom:A,maxZoom:M,zoomActivationKeyCode:g,preventScrolling:I,noWheelClassName:D,noPanClassName:L,onViewportChange:V,isControlledViewport:Q,paneClickDistance:s,selectionOnDrag:H,children:P(Vnt,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:W,autoPanOnSelection:E,isSelecting:!!Z,selectionMode:u,selectionKeyPressed:_,paneClickDistance:s,selectionOnDrag:H,children:[e,B&&T(Jnt,{onSelectionContextMenu:R,noPanClassName:L,disableKeyboardA11y:j})]})})}nrt.displayName="FlowRenderer";var rrt=p(nrt);var irt=e=>e.updateNodeInternals,art=p(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:u,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:p,rfId:m,nodeTypes:g,nodeClickDistance:v,onError:b}){const{node:x,internals:w,isParent:O}=Ltt(t=>{const n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},Mtt);let k=x.type||"default",S=g?.[k]||Knt[k];void 0===S&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(k)),k="default",S=g?.default||Knt.default);const E=!!(x.draggable||s&&void 0===x.draggable),N=!!(x.selectable||l&&void 0===x.selectable),z=!!(x.connectable||c&&void 0===x.connectable),A=!!(x.focusable||d&&void 0===x.focusable),P=jtt(),M=cet(x),I=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=jtt(),a=C(null),o=C(null),s=C(e.sourcePosition),l=C(e.targetPosition),c=C(t),d=n&&!!e.internals.handleBounds;return y(()=>{!a.current||e.hidden||d&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[d,e.hidden]),y(()=>()=>{o.current&&(r?.unobserve(o.current),o.current=null)},[]),y(()=>{if(a.current){const n=c.current!==t,r=s.current!==e.sourcePosition,o=l.current!==e.targetPosition;(n||r||o)&&(c.current=t,s.current=e.sourcePosition,l.current=e.targetPosition,i.getState().updateNodeInternals(/* @__PURE__ */new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}({node:x,nodeType:k,hasDimensions:M,resizeObserver:u}),R=Bnt({nodeRef:I,disabled:x.hidden||!E,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:N,nodeClickDistance:v}),D=Fnt();if(x.hidden)return null;const L=set(x),j=function(e){return void 0===e.internals.handleBounds?{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}}(x),V=N||E||t||n||r||i,Q=n?e=>n(e,{...w.userNode}):void 0,B=r?e=>r(e,{...w.userNode}):void 0,F=i?e=>i(e,{...w.userNode}):void 0,_=a?e=>a(e,{...w.userNode}):void 0,q=o?e=>o(e,{...w.userNode}):void 0;return T("div",{className:I4e(["react-flow__node",`react-flow__node-${k}`,{[f]:E},x.className,{selected:x.selected,selectable:N,parent:O,draggable:E,dragging:R}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:V?"all":"none",visibility:M?"visible":"hidden",...x.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Q,onMouseMove:B,onMouseLeave:F,onContextMenu:_,onClick:n=>{const{selectNodesOnDrag:r,nodeDragThreshold:i}=P.getState();N&&(!r||!E||i>0)&&Qnt({id:e,store:P,nodeRef:I}),t&&t(n,{...w.userNode})},onDoubleClick:q,onKeyDown:A?t=>{if(!bet(t.nativeEvent)&&!p)if(E7e.includes(t.key)&&N){const n="Escape"===t.key;Qnt({id:e,store:P,unselect:n,nodeRef:I})}else if(E&&x.selected&&Object.prototype.hasOwnProperty.call(Gnt,t.key)){t.preventDefault();const{ariaLabelConfig:e}=P.getState();P.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),D({direction:Gnt[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:A?0:void 0,onFocus:A?()=>{if(p||!I.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=P.getState();i&&(j7e(/* @__PURE__ */new Map([[e,x]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(x.position.x+L.width/2,x.position.y+L.height/2,{zoom:t[2]}))}:void 0,role:x.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Btt}-${m}`,"aria-label":x.ariaLabel,...x.domAttributes,children:T(qnt,{value:e,children:T(S,{id:e,data:x.data,type:k,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:N,draggable:E,deletable:x.deletable??!0,isConnectable:z,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:R,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...L})})})}),ort=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function srt(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=Ltt(ort,Mtt),a=(s=e.onlyRenderVisibleElements,Ltt(g((e=>t=>e?j7e(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(s),[s]),Mtt)),o=function(){const e=Ltt(irt),[t]=E(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=/* @__PURE__ */new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return y(()=>()=>{t?.disconnect()},[t]),t}();var s;return T("div",{className:"react-flow__nodes",style:Pnt,children:a.map(a=>T(art,{id:a,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:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}srt.displayName="NodeRenderer";var lrt=p(srt),crt={[A7e.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return T("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[A7e.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return T("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},drt=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const l=function(e){const t=jtt();return k(()=>Object.prototype.hasOwnProperty.call(crt,e)?crt[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return l?T("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0",children:T(l,{color:n,strokeWidth:o})}):null},urt=({defaultColor:e,rfId:t})=>{const n=Ltt(e=>e.edges),r=Ltt(e=>e.defaultEdgeOptions),i=k(()=>function(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const a=/* @__PURE__ */new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&"object"==typeof r){const i=Qet(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?T("svg",{className:"react-flow__marker","aria-hidden":"true",children:T("defs",{children:i.map(e=>T(drt,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};urt.displayName="MarkerDefinitions";var hrt=p(urt);function frt({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:l,className:c,...d}){const[u,h]=E({x:1,y:0,width:0,height:0}),f=I4e(["react-flow__edge-textwrapper",c]),p=C(null);return y(()=>{if(p.current){const e=p.current.getBBox();h({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?P("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:f,visibility:u.width?"visible":"hidden",...d,children:[i&&T("rect",{width:u.width+2*o[0],x:-o[0],y:-o[1],height:u.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),T("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:p,style:r,children:n}),l]}):null}frt.displayName="EdgeText";var prt=p(frt);function mrt({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return P(A,{children:[T("path",{...d,d:e,fill:"none",className:I4e(["react-flow__edge-path",d.className])}),c?T("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,r&&J7e(t)&&J7e(n)?T(prt,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function grt({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===T7e.Left||e===T7e.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function vrt({sourceX:e,sourceY:t,sourcePosition:n=T7e.Bottom,targetX:r,targetY:i,targetPosition:a=T7e.Top}){const[o,s]=grt({pos:n,x1:e,y1:t,x2:r,y2:i}),[l,c]=grt({pos:a,x1:r,y1:i,x2:e,y2:t}),[d,u,h,f]=Oet({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${o},${s} ${l},${c} ${r},${i}`,d,u,h,f]}function brt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:v})=>{const[b,y,x]=vrt({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),w=e.isInternal?void 0:t;return T(mrt,{id:w,path:b,labelX:y,labelY:x,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:v})})}var yrt=brt({isInternal:!1}),xrt=brt({isInternal:!0});function wrt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,sourcePosition:f=T7e.Bottom,targetPosition:p=T7e.Top,markerEnd:m,markerStart:g,pathOptions:v,interactionWidth:b})=>{const[y,x,w]=Ret({sourceX:n,sourceY:r,sourcePosition:f,targetX:i,targetY:a,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),O=e.isInternal?void 0:t;return T(mrt,{id:O,path:y,labelX:x,labelY:w,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}yrt.displayName="SimpleBezierEdge",xrt.displayName="SimpleBezierEdgeInternal";var Ort=wrt({isInternal:!1}),krt=wrt({isInternal:!0});function Srt(e){return p(({id:t,...n})=>{const r=e.isInternal?void 0:t;return T(Ort,{...n,id:r,pathOptions:k(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}Ort.displayName="SmoothStepEdge",krt.displayName="SmoothStepEdgeInternal";var Crt=Srt({isInternal:!1}),Ert=Srt({isInternal:!0});function Nrt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:p,interactionWidth:m})=>{const[g,v,b]=Tet({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return T(mrt,{id:y,path:g,labelX:v,labelY:b,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:p,interactionWidth:m})})}Crt.displayName="StepEdge",Ert.displayName="StepEdgeInternal";var zrt=Nrt({isInternal:!1}),Art=Nrt({isInternal:!0});function Trt(e){return p(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=T7e.Bottom,targetPosition:s=T7e.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,pathOptions:v,interactionWidth:b})=>{const[y,x,w]=Eet({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:v?.curvature}),O=e.isInternal?void 0:t;return T(mrt,{id:O,path:y,labelX:x,labelY:w,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:g,interactionWidth:b})})}zrt.displayName="StraightEdge",Art.displayName="StraightEdgeInternal";var Prt=Trt({isInternal:!1}),Mrt=Trt({isInternal:!0});Prt.displayName="BezierEdge",Mrt.displayName="BezierEdgeInternal";var Irt={default:Mrt,straight:Art,step:Ert,smoothstep:krt,simplebezier:xrt},Rrt={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Drt=(e,t,n)=>n===T7e.Left?e-t:n===T7e.Right?e+t:e,Lrt=(e,t,n)=>n===T7e.Top?e-t:n===T7e.Bottom?e+t:e,jrt="react-flow__edgeupdater";function Vrt({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return T("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:I4e([jrt,`${jrt}-${s}`]),cx:Drt(t,r,e),cy:Lrt(n,r,e),r:r,stroke:"transparent",fill:"transparent"})}function Qrt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:u,setReconnecting:h,setUpdateHover:f}){const p=jtt(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:l,cancelConnection:f,nodeLookup:m,rfId:g,panBy:v,updateConnection:b}=p.getState(),y="target"===t.type;att.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:f,panBy:v,isValidConnection:(...e)=>p.getState().isValidConnection?.(...e)??!0,onConnect:e=>c?.(n,e),onConnectStart:(r,i)=>{h(!0),d?.(e,n,t.type),l?.(r,i)},onConnectEnd:(...e)=>p.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{h(!1),u?.(e,n,t.type,r)},updateConnection:b,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=()=>f(!0),v=()=>f(!1);return P(A,{children:[(!0===e||"source"===e)&&T(Vrt,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:g,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&T(Vrt,{position:l,centerX:a,centerY:o,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:g,onMouseOut:v,type:"target"})]})}var Brt=p(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,rfId:p,edgeTypes:m,noPanClassName:v,onError:b,disableKeyboardA11y:y}){let x=Ltt(t=>t.edgeLookup.get(e));const w=Ltt(e=>e.defaultEdgeOptions);x=w?{...w,...x}:x;let O=x.type||"default",S=m?.[O]||Irt[O];void 0===S&&(b?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(O)),O="default",S=m?.default||Irt.default);const N=!!(x.focusable||t&&void 0===x.focusable),z=void 0!==u&&(x.reconnectable||n&&void 0===x.reconnectable),A=!!(x.selectable||r&&void 0===x.selectable),M=C(null),[I,R]=E(!1),[D,L]=E(!1),j=jtt(),{zIndex:V=x.zIndex,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W}=Ltt(g(t=>{const n=t.nodeLookup.get(x.source),r=t.nodeLookup.get(x.target);if(!n||!r)return Rrt;const i=function(e){const{sourceNode:t,targetNode:n}=e;if(!Det(t)||!Det(n))return null;const r=t.internals.handleBounds||Let(t.handles),i=n.internals.handleBounds||Let(n.handles),a=Vet(r?.source??[],e.sourceHandle),o=Vet(e.connectionMode===O7e.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:r}", edge id: ${t}.`)(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=a?.position||T7e.Bottom,l=o?.position||T7e.Top,c=jet(t,a,s),d=jet(n,o,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:s,targetPosition:l}}({id:e,sourceNode:n,targetNode:r,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:t.connectionMode,onError:b}),a=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a="basic"}){return"manual"===a?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}({selected:x.selected,zIndex:x.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Rrt,zIndex:a}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex,b]),Mtt),U=k(()=>x.markerStart?`url('#${Qet(x.markerStart,p)}')`:void 0,[x.markerStart,p]),H=k(()=>x.markerEnd?`url('#${Qet(x.markerEnd,p)}')`:void 0,[x.markerEnd,p]);if(x.hidden||null===Q||null===B||null===F||null===_)return null;const Z=a?e=>{a(e,{...x})}:void 0,Y=o?e=>{o(e,{...x})}:void 0,X=s?e=>{s(e,{...x})}:void 0,G=l?e=>{l(e,{...x})}:void 0,K=c?e=>{c(e,{...x})}:void 0;return T("svg",{style:{zIndex:V},children:P("g",{className:I4e(["react-flow__edge",`react-flow__edge-${O}`,x.className,v,{selected:x.selected,animated:x.animated,inactive:!A&&!i,updating:I,selectable:A}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();A&&(j.setState({nodesSelectionActive:!1}),x.selected&&a?(r({nodes:[],edges:[x]}),M.current?.blur()):n([e])),i&&i(t,x)},onDoubleClick:Z,onContextMenu:Y,onMouseEnter:X,onMouseMove:G,onMouseLeave:K,onKeyDown:N?t=>{if(!y&&E7e.includes(t.key)&&A){const{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();"Escape"===t.key?(M.current?.blur(),n({edges:[x]})):r([e])}}:void 0,tabIndex:N?0:void 0,role:x.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===x.ariaLabel?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":N?`${Ftt}-${p}`:void 0,ref:M,...x.domAttributes,children:[!D&&T(S,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:A,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:U,markerEnd:H,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),z&&T(Qrt,{edge:x,isReconnectable:z,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,sourceX:Q,sourceY:B,targetX:F,targetY:_,sourcePosition:q,targetPosition:W,setUpdateHover:R,setReconnecting:L})]})})}),Frt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _rt({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:y,onError:x}=Ltt(Frt,Mtt),w=Ltt(g(e=>{if(!O)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const r=e.nodeLookup.get(n.source),i=e.nodeLookup.get(n.target);r&&i&&zet({sourceNode:r,targetNode:i,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[O=t]),Mtt);var O;return P("div",{className:"react-flow__edges",children:[T(hrt,{defaultColor:e,rfId:n}),w.map(e=>T(Brt,{id:e,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:y,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:u,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:m},e))]})}_rt.displayName="EdgeRenderer";var qrt=p(_rt),Wrt=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Urt({children:e}){const t=jtt(),n=C(null),[r]=E(()=>t.getState().transform);return knt(()=>{let e=null;const r=()=>{const r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=Wrt(r)))};return r(),t.subscribe(r)},[t]),T("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Wrt(r)},children:e})}var Hrt=e=>e.panZoom?.syncViewport;function Zrt(e){return e.connection.inProgress?{...e.connection,to:tet(e.connection.to,e.transform)}:{...e.connection}}var Yrt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Xrt({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:l}=Ltt(Yrt,Mtt);return a&&i&&l?T("svg",{style:e,width:a,height:o,className:"react-flow__connectionline react-flow__container",children:T("g",{className:I4e(["react-flow__connection",fet(s)]),children:T(Grt,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Grt=({style:e,type:t=z7e.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:l,to:c,toNode:d,toHandle:u,toPosition:h,pointer:f}=Ltt(function(e){if(e){const t=t=>e(Zrt(t));return t}return Zrt}(p),Mtt);var p;if(!i)return;if(n)return T(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:h,connectionStatus:fet(r),toNode:d,toHandle:u,pointer:f});let m="";const g={sourceX:a.x,sourceY:a.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:h};switch(t){case z7e.Bezier:[m]=Eet(g);break;case z7e.SimpleBezier:[m]=vrt(g);break;case z7e.Step:[m]=Ret({...g,borderRadius:0});break;case z7e.SmoothStep:[m]=Ret(g);break;default:[m]=Tet(g)}return T("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};Grt.displayName="ConnectionLine";var Krt={};function $rt(e=Krt){C(e),jtt(),y(()=>{},[e])}function Jrt({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:h,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:g,connectionLineContainerStyle:v,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:E,onlyRenderVisibleElements:N,elementsSelectable:z,defaultViewport:A,translateExtent:M,minZoom:I,maxZoom:R,preventScrolling:D,defaultMarkerColor:L,zoomOnScroll:j,zoomOnPinch:V,panOnScroll:Q,panOnScrollSpeed:B,panOnScrollMode:F,zoomOnDoubleClick:_,panOnDrag:q,autoPanOnSelection:W,onPaneClick:U,onPaneMouseEnter:H,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneScroll:X,onPaneContextMenu:G,paneClickDistance:K,nodeClickDistance:$,onEdgeContextMenu:J,onEdgeMouseEnter:ee,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:re,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,noDragClassName:se,noWheelClassName:le,noPanClassName:ce,disableKeyboardA11y:de,nodeExtent:ue,rfId:he,viewport:fe,onViewportChange:pe,nodesDraggable:me}){return $rt(e),$rt(t),jtt(),C(!1),y(()=>{},[]),function(e){const t=znt(),n=C(!1);y(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=Ltt(Hrt),n=jtt();y(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(fe),T(rrt,{onPaneClick:U,onPaneMouseEnter:H,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneContextMenu:G,onPaneScroll:X,paneClickDistance:K,deleteKeyCode:E,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:z,zoomOnScroll:j,zoomOnPinch:V,zoomOnDoubleClick:_,panOnScroll:Q,panOnScrollSpeed:B,panOnScrollMode:F,panOnDrag:q,autoPanOnSelection:W,defaultViewport:A,translateExtent:M,minZoom:I,maxZoom:R,onSelectionContextMenu:u,preventScrolling:D,noDragClassName:se,noWheelClassName:le,noPanClassName:ce,disableKeyboardA11y:de,onViewportChange:pe,isControlledViewport:!!fe,children:P(Urt,{children:[T(qrt,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,onlyRenderVisibleElements:N,onEdgeContextMenu:J,onEdgeMouseEnter:ee,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:re,defaultMarkerColor:L,noPanClassName:ce,disableKeyboardA11y:de,rfId:he}),T(Xrt,{style:m,type:p,component:g,containerStyle:v}),T("div",{className:"react-flow__edgelabel-renderer"}),T(lrt,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:$,onlyRenderVisibleElements:N,noPanClassName:ce,noDragClassName:se,disableKeyboardA11y:de,nodeExtent:ue,rfId:he,nodesDraggable:me}),T("div",{className:"react-flow__viewport-portal"})]})})}Jrt.displayName="GraphView";var eit=p(Jrt),tit=(e,t)=>{},nit=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:h="basic"}={})=>{const f=/* @__PURE__ */new Map,p=/* @__PURE__ */new Map,m=/* @__PURE__ */new Map,g=/* @__PURE__ */new Map,v=r??t??[],b=n??e??[],y=d??[0,0],x=u??C7e;Get(m,g,v);const{nodesInitialized:w}=Uet(b,f,p,{nodeOrigin:y,nodeExtent:x,zIndexMode:h});let O=[0,0,1];if(o&&i&&a){const e=L7e(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:r}=iet(e,i,a,l,c,s?.padding??.1);O=[t,n,r]}return{rfId:"1",width:i??0,height:a??0,transform:O,nodes:b,nodesInitialized:w,nodeLookup:f,parentLookup:p,edges:v,edgeLookup:g,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:l,maxZoom:c,translateExtent:C7e,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:O7e.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...P7e},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tit,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:N7e,zIndexMode:h,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:/* @__PURE__ */new Map,onEdgesChangeMiddlewareMap:/* @__PURE__ */new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},rit=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h})=>((e,t)=>e?Ptt(e,t):Ptt)((f,p)=>{async function m(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(0===e.size)return!0;const s=function(e,t){const n=/* @__PURE__ */new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){const{width:t,height:n}=set(e);i=t>0&&n>0}else i=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!i||r&&!r.has(e.id)||n.set(e.id,e)}),n}(e,o),l=L7e(s),c=iet(l,t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(c,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...nit({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Uet(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),u=l&&d;o&&c?(m(),f({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):f({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Get(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,r,i,a,o){const s=r?.querySelector(".xyflow__viewport");let l=!1;if(!s)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(d.transform),h=[];for(const f of e.values()){const e=t.get(f.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const r=met(f.nodeElement),s=e.measured.width!==r.width||e.measured.height!==r.height;if(r.width&&r.height&&(s||!e.internals.handleBounds||f.force)){const d=f.nodeElement.getBoundingClientRect(),p=oet(e.extent)?e.extent:a;let{positionAbsolute:m}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(m=F7e(m,r,n))}else p&&(m=B7e(m,p,r));const g={...e,measured:r,internals:{...e.internals,positionAbsolute:m,handleBounds:{source:wet("source",f.nodeElement,d,u,e.id),target:wet("target",f.nodeElement,d,u,e.id)}}};t.set(e.id,g),e.parentId&&Het(g,t,n,{nodeOrigin:i,zIndexMode:o}),l=!0,s&&(c.push({id:e.id,type:"dimensions",dimensions:r}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:Z7e(g,i)}))}}if(h.length>0){const e=Yet(h,t,n,i);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,r,i,a,o,c);u&&(function(e,t,n){const r=_et(Bet,n);for(const i of e.values())if(i.parentId)Het(i,e,t,r);else{const e=D7e(i,r.nodeOrigin),t=oet(i.extent)?i.extent:r.nodeExtent,n=B7e(e,t,set(i));i.internals.positionAbsolute=n}}(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:c}),l?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),d?.length>0&&t?.(d))},updateNodePositions:(e,t=!1)=>{const n=[];let r=[];const{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:l}=p();for(const[c,d]of e){const e=i.get(c),a=!!(e?.expandParent&&e?.parentId&&d?.position),l={id:c,type:"position",position:a?{x:Math.max(0,d.position.x),y:Math.max(0,d.position.y)}:d.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){const t=jet(e,o.fromHandle,T7e.Left,!0);s({...o,from:t})}a&&e.parentId&&n.push({id:c,parentId:e.parentId,rect:{...d.internals.positionAbsolute,width:d.measured.width??0,height:d.measured.height??0}}),r.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),a=Yet(n,i,e,t);r.push(...a)}for(const c of l.values())r=c(r);a(r)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=p();e?.length&&(i&&n(pnt(e,r)),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=p();e?.length&&(i&&n(mnt(e,r)),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();t?i(e.map(e=>gnt(e,!0))):(i(vnt(r,/* @__PURE__ */new Set([...e]),!0)),a(vnt(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();t?a(e.map(e=>gnt(e,!0))):(a(vnt(n,/* @__PURE__ */new Set([...e]))),i(vnt(r,/* @__PURE__ */new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=p(),s=e||r,l=t||n,c=[];for(const u of s){if(!u.selected)continue;const e=i.get(u.id);e&&(e.selected=!1),c.push(gnt(u.id,!1))}const d=[];for(const u of l)u.selected&&d.push(gnt(u.id,!1));a(c),o(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=p();if(!i)return;const a=t.reduce((e,t)=>t.selected?[...e,gnt(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,gnt(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=p();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(Uet(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),f({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{const{width:r,height:i,maxZoom:a,panZoom:o}=p();if(!o)return!1;const s=void 0!==n?.zoom?n.zoom:a;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{f({connection:{...P7e}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...nit()})}},Object.is);function iit({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h,children:f}){const[p]=E(()=>rit({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:c,minZoom:o,maxZoom:s,fitViewOptions:l,nodeOrigin:d,nodeExtent:u,zIndexMode:h}));return T(Rtt,{value:p,children:T(Ent,{children:T(Znt,{children:f})})})}function ait({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f}){return v(Itt)?T(A,{children:e}):T(iit,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f,children:e})}var oit,sit={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},lit=Ont(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:h,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:k,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:z,onNodesDelete:A,onEdgesDelete:M,onDelete:I,onSelectionChange:R,onSelectionDragStart:D,onSelectionDrag:L,onSelectionDragStop:j,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:B,onBeforeDelete:F,connectionMode:_,connectionLineType:q=z7e.Bezier,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:H,deleteKeyCode:Z="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:X=!1,selectionMode:G=S7e.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:$=(aet()?"Meta":"Control"),zoomActivationKeyCode:J=(aet()?"Meta":"Control"),snapToGrid:ee,snapGrid:te,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:re,nodesDraggable:ie,autoPanOnNodeFocus:ae,nodesConnectable:oe,nodesFocusable:se,nodeOrigin:le=tnt,edgesFocusable:ce,edgesReconnectable:de,elementsSelectable:ue=!0,defaultViewport:he=nnt,minZoom:fe=.5,maxZoom:pe=2,translateExtent:me=C7e,preventScrolling:ge=!0,nodeExtent:ve,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:we=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:ke=k7e.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:Ne,onPaneMouseMove:ze,onPaneMouseLeave:Ae,onPaneScroll:Te,onPaneContextMenu:Pe,paneClickDistance:Me=1,nodeClickDistance:Ie=0,children:Re,onReconnect:De,onReconnectStart:Le,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Qe,onEdgeMouseEnter:Be,onEdgeMouseMove:Fe,onEdgeMouseLeave:_e,reconnectRadius:qe=10,onNodesChange:We,onEdgesChange:Ue,noDragClassName:He="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:Ye="nopan",fitView:Xe,fitViewOptions:Ge,connectOnClick:Ke,attributionPosition:$e,proOptions:Je,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:lt,isValidConnection:ct,onError:dt,style:ut,id:ht,nodeDragThreshold:ft,connectionDragThreshold:pt,viewport:mt,onViewportChange:gt,width:vt,height:bt,colorMode:yt="light",debug:xt,onScroll:wt,ariaLabelConfig:Ot,zIndexMode:kt="basic",...St},Ct){const Et=ht||"1",Nt=function(e){const[t,n]=E("system"===e?null:e);return y(()=>{if("system"!==e)return void n(e);const t=snt(),r=()=>n(t?.matches?"dark":"light");return r(),t?.addEventListener("change",r),()=>{t?.removeEventListener("change",r)}},[e]),null!==t?t:snt()?.matches?"dark":"light"}(yt),zt=g(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),wt?.(e)},[wt]);return T("div",{"data-testid":"rf__wrapper",...St,onScroll:zt,style:{...ut,...sit},ref:Ct,className:I4e(["react-flow",i,Nt]),id:ht,role:"application",children:P(ait,{nodes:e,edges:t,width:vt,height:bt,fitView:Xe,fitViewOptions:Ge,minZoom:fe,maxZoom:pe,nodeOrigin:le,nodeExtent:ve,zIndexMode:kt,children:[T(ont,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ie,autoPanOnNodeFocus:ae,nodesConnectable:oe,nodesFocusable:se,edgesFocusable:ce,edgesReconnectable:de,elementsSelectable:ue,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:fe,maxZoom:pe,nodeExtent:ve,onNodesChange:We,onEdgesChange:Ue,snapToGrid:ee,snapGrid:te,connectionMode:_,translateExtent:me,connectOnClick:Ke,defaultEdgeOptions:et,fitView:Xe,fitViewOptions:Ge,onNodesDelete:A,onEdgesDelete:M,onDelete:I,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:z,onSelectionDrag:L,onSelectionDragStart:D,onSelectionDragStop:j,onMove:d,onMoveStart:u,onMoveEnd:h,noPanClassName:Ye,nodeOrigin:le,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:dt,connectionRadius:lt,isValidConnection:ct,selectNodesOnDrag:re,nodeDragThreshold:ft,connectionDragThreshold:pt,onBeforeDelete:F,debug:xt,ariaLabelConfig:Ot,zIndexMode:kt}),T(eit,{onInit:c,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:O,onNodeContextMenu:k,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:q,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:H,selectionKeyCode:Y,selectionOnDrag:X,selectionMode:G,deleteKeyCode:Z,multiSelectionKeyCode:$,panActivationKeyCode:K,zoomActivationKeyCode:J,onlyRenderVisibleElements:ne,defaultViewport:he,translateExtent:me,minZoom:fe,maxZoom:pe,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:Se,panOnScroll:we,panOnScrollSpeed:Oe,panOnScrollMode:ke,panOnDrag:Ce,autoPanOnSelection:ot,onPaneClick:Ee,onPaneMouseEnter:Ne,onPaneMouseMove:ze,onPaneMouseLeave:Ae,onPaneScroll:Te,onPaneContextMenu:Pe,paneClickDistance:Me,nodeClickDistance:Ie,onSelectionContextMenu:V,onSelectionStart:Q,onSelectionEnd:B,onReconnect:De,onReconnectStart:Le,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Qe,onEdgeMouseEnter:Be,onEdgeMouseMove:Fe,onEdgeMouseLeave:_e,reconnectRadius:qe,defaultMarkerColor:be,noDragClassName:He,noWheelClassName:Ze,noPanClassName:Ye,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:mt,onViewportChange:gt,nodesDraggable:ie}),T(ent,{onSelectionChange:R}),Re,T(Ytt,{proOptions:Je,position:$e}),T(Utt,{rfId:Et,disableKeyboardA11y:rt})]})})}),cit=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function dit({children:e}){const t=Ltt(cit);return t?I(e,t):null}function uit({dimensions:e,lineWidth:t,variant:n,className:r}){return T("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:I4e(["react-flow__background-pattern",n,r])})}function hit({radius:e,className:t}){return T("circle",{cx:e,cy:e,r:e,className:I4e(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(oit||(oit={}));var fit={[oit.Dots]:1,[oit.Lines]:1,[oit.Cross]:6},pit=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function mit({id:e,variant:t=oit.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:l,className:c,patternClassName:d}){const u=C(null),{transform:h,patternId:f}=Ltt(pit,Mtt),p=r||fit[t],m=t===oit.Dots,g=t===oit.Cross,v=Array.isArray(n)?n:[n,n],b=[v[0]*h[2]||1,v[1]*h[2]||1],y=p*h[2],x=Array.isArray(a)?a:[a,a],w=g?[y,y]:b,O=[x[0]*h[2]+w[0]/2,x[1]*h[2]+w[1]/2],k=`${f}${e||""}`;return P("svg",{className:I4e(["react-flow__background",c]),style:{...l,...Pnt,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:u,"data-testid":"rf__background",children:[T("pattern",{id:k,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${O[0]},-${O[1]})`,children:m?T(hit,{radius:y/2,className:d}):T(uit,{dimensions:w,lineWidth:i,variant:t,className:d})}),T("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}mit.displayName="Background";var git=p(mit);function vit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function bit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T("path",{d:"M0 0h32v4.2H0z"})})}function yit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T("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 xit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("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 wit(){return T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T("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 Oit({children:e,className:t,...n}){return T("button",{type:"button",className:I4e(["react-flow__controls-button",t]),...n,children:e})}var kit=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Sit({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:l,className:c,children:d,position:u="bottom-left",orientation:h="vertical","aria-label":f}){const p=jtt(),{isInteractive:m,minZoomReached:g,maxZoomReached:v,ariaLabelConfig:b}=Ltt(kit,Mtt),{zoomIn:y,zoomOut:x,fitView:w}=znt();return P(Htt,{className:I4e(["react-flow__controls","horizontal"===h?"horizontal":"vertical",c]),position:u,style:e,"data-testid":"rf__controls","aria-label":f??b["controls.ariaLabel"],children:[t&&P(A,{children:[T(Oit,{onClick:()=>{y(),a?.()},className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:v,children:T(vit,{})}),T(Oit,{onClick:()=>{x(),o?.()},className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:g,children:T(bit,{})})]}),n&&T(Oit,{className:"react-flow__controls-fitview",onClick:()=>{w(i),s?.()},title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:T(yit,{})}),r&&T(Oit,{className:"react-flow__controls-interactive",onClick:()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),l?.(!m)},title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:T(m?wit:xit,{})}),d]})}Sit.displayName="Controls";var Cit=p(Sit),Eit=p(function({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:l,className:c,borderRadius:d,shapeRendering:u,selected:h,onClick:f}){const{background:p,backgroundColor:m}=a||{},g=o||p||m;return T("rect",{className:I4e(["react-flow__minimap-node",{selected:h},c]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:l},shapeRendering:u,onClick:f?t=>f(t,e):void 0})}),Nit=e=>e.nodes.map(e=>e.id),zit=e=>e instanceof Function?e:()=>e,Ait=p(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:l}){const{node:c,x:d,y:u,width:h,height:f}=Ltt(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=set(r);return{node:r,x:i,y:a,width:o,height:s}},Mtt);return c&&!c.hidden&&cet(c)?T(s,{x:d,y:u,width:h,height:f,style:c.style,selected:!!c.selected,className:r(c),color:t(c),borderRadius:i,strokeColor:n(c),strokeWidth:a,shapeRendering:o,onClick:l,id:c.id}):null}),Tit=p(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Eit,onClick:o}){const s=Ltt(Nit,Mtt),l=zit(t),c=zit(e),d=zit(n),u="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return T(A,{children:s.map(e=>T(Ait,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:u},e))})}),Pit=e=>!e.hidden,Mit=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]};let n=!1;for(const r of e.nodeLookup.values())if(!r.hidden){n=!0;break}return{viewBB:t,boundingRect:n?X7e(L7e(e.nodeLookup,{filter:Pit}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Iit=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Rit=(e,t)=>Iit(e.viewBB,t.viewBB)&&Iit(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function Dit({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:u,position:h="bottom-right",onClick:f,onNodeClick:p,pannable:m=!1,zoomable:v=!1,ariaLabel:b,inversePan:x,zoomStep:w=1,offsetScale:O=5}){const k=jtt(),S=C(null),{boundingRect:E,panZoom:N,viewBB:z,rfId:A,translateExtent:M,flowWidth:I,flowHeight:R,ariaLabelConfig:D}=Ltt(Mit,Rit),L=e?.width??200,j=e?.height??150,V=E.width/L,Q=E.height/j,B=Math.max(V,Q),F=B*L,_=B*j,q=O*B,W=E.x-(F-E.width)/2-q,U=E.y-(_-E.height)/2-q,H=F+2*q,Z=_+2*q,Y=`react-flow__minimap-desc-${A}`,X=C(0),G=C();X.current=B,y(()=>{const e=k.getState().panZoom;if(S.current&&e)return G.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=X6e(e);return{update:function({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const h=w7e().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?i=>{const s=n();if("mousemove"!==i.sourceEvent.type&&"touchmove"!==i.sourceEvent.type||!t)return;const l=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const h=r()*Math.max(s[2],Math.log(s[2]))*(d?-1:1),f={x:s[0]-c[0]*h,y:s[1]-c[1]*h},p=[[0,0],[a,o]];t.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const r=n(),i=e.sourceEvent.ctrlKey&&aet()?10:1,a=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*Math.pow(2,a*i);t.scaleTo(o)}:null);i.call(h,{})},destroy:function(){i.on("zoom",null)},pointer:G6e}}({domNode:S.current,panZoom:e,getTransform:()=>k.getState().transform,getViewScale:()=>X.current}),()=>{G.current?.destroy()}},[N]),y(()=>{G.current?.update({translateExtent:M,width:I,height:R,inversePan:x,pannable:m,zoomStep:w,zoomable:v})},[m,v,x,w,M,I,R]);const K=f?e=>{const[t,n]=G.current?.pointer(e)||[0,0];f(e,{x:t,y:n})}:void 0,$=g((e,t)=>{const n=k.getState().nodeLookup.get(t).internals.userNode;p?.(e,n)},[p]),J=p?$:void 0,ee=b??D["minimap.ariaLabel"];return T(Htt,{position:h,style:{...e,"--xy-minimap-background-color-props":"string"==typeof l?l:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof c?c:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof u?u*B:void 0,"--xy-minimap-node-background-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof o?o:void 0},className:I4e(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:P("svg",{width:L,height:j,viewBox:`${W} ${U} ${H} ${Z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:S,onClick:K,children:[ee&&T("title",{id:Y,children:ee}),T(Tit,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),T("path",{className:"react-flow__minimap-mask",d:`M${W-q},${U-q}h${H+2*q}v${Z+2*q}h${-H-2*q}z\n M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Dit.displayName="MiniMap";var Lit=p(Dit),jit={[itt.Line]:"right",[itt.Handle]:"bottom-right"};p(function({nodeId:e,position:t,variant:n=itt.Handle,className:r,style:i,children:a,color:o,minWidth:s=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:h,autoScale:f=!0,shouldResize:p,onResizeStart:m,onResize:v,onResizeEnd:b}){const x=Wnt(),w="string"==typeof e?e:x,O=jtt(),k=C(null),S=n===itt.Handle,E=Ltt(g((N=S&&f,e=>N?`${Math.max(1/e.transform[2],1)}`:void 0),[S,f]),Mtt);var N;const z=C(null),A=t??jit[n];y(()=>{if(k.current&&w)return z.current||(z.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const a=X6e(e);let o={controlDirection:ftt("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:h,shouldResize:f}){let p,m={...btt},g={...ytt};o={boundaries:s,resizeDirection:c,keepAspectRatio:l,controlDirection:ftt(e)};let v,b,y,x=null,w=[],O=!1;const k=c9e().on("start",e=>{const{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:l}=n();if(p=r.get(t),!p)return;x=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=pet(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},g={...m,pointerX:c,pointerY:u,aspectRatio:m.width/m.height},v=void 0,b=oet(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(v=r.get(p.parentId)),v&&"parent"===p.extent&&(b=[[0,0],[v.measured.width,v.measured.height]]),w=[],y=void 0;for(const[n,d]of r)if(d.parentId===t&&(w.push({id:n,position:{...d.position},extent:d.extent}),"parent"===d.extent||d.expandParent)){const e=xtt(d,p,d.origin??s);y=y?[[Math.min(e[0][0],y[0][0]),Math.min(e[0][1],y[0][1])],[Math.max(e[1][0],y[1][0]),Math.max(e[1][1],y[1][1])]]:e}d?.(e,{...m})}).on("drag",e=>{const{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),l=pet(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:x}),c=[];if(!p)return;const{x:d,y:h,width:k,height:S}=m,C={},E=p.origin??s,{width:N,height:z,x:A,y:T}=function(e,t,n,r,i,a,o,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,h=d&&u,{xSnapped:f,ySnapped:p}=n,{minWidth:m,maxWidth:g,minHeight:v,maxHeight:b}=r,{x:y,y:x,width:w,height:O,aspectRatio:k}=e;let S=Math.floor(d?f-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const E=w+(l?-S:S),N=O+(c?-C:C),z=-a[0]*w,A=-a[1]*O;let T=gtt(E,m,g),P=gtt(N,v,b);if(o){let e=0,t=0;l&&S<0?e=ptt(y+S+z,o[0][0]):!l&&S>0&&(e=mtt(y+E+z,o[1][0])),c&&C<0?t=ptt(x+C+A,o[0][1]):!c&&C>0&&(t=mtt(x+N+A,o[1][1])),T=Math.max(T,e),P=Math.max(P,t)}if(s){let e=0,t=0;l&&S>0?e=mtt(y+S,s[0][0]):!l&&S<0&&(e=ptt(y+E,s[1][0])),c&&C>0?t=mtt(x+C,s[0][1]):!c&&C<0&&(t=ptt(x+N,s[1][1])),T=Math.max(T,e),P=Math.max(P,t)}if(i){if(d){const e=gtt(E/k,v,b)*k;if(T=Math.max(T,e),o){let e=0;e=!l&&!c||l&&!c&&h?mtt(x+A+E/k,o[1][1])*k:ptt(x+A+(l?S:-S)/k,o[0][1])*k,T=Math.max(T,e)}if(s){let e=0;e=!l&&!c||l&&!c&&h?ptt(x+E/k,s[1][1])*k:mtt(x+(l?S:-S)/k,s[0][1])*k,T=Math.max(T,e)}}if(u){const e=gtt(N*k,m,g)/k;if(P=Math.max(P,e),o){let e=0;e=!l&&!c||c&&!l&&h?mtt(y+N*k+z,o[1][0])/k:ptt(y+(c?C:-C)*k+z,o[0][0])/k,P=Math.max(P,e)}if(s){let e=0;e=!l&&!c||c&&!l&&h?ptt(y+N*k,s[1][0])/k:mtt(y+(c?C:-C)*k,s[0][0])/k,P=Math.max(P,e)}}}C+=C<0?P:-P,S+=S<0?T:-T,i&&(h?E>N*k?C=(vtt(l,c)?-S:S)/k:S=(vtt(l,c)?-C:C)*k:d?(C=S/k,c=l):(S=C*k,l=c));const M=l?y+S:y,I=c?x+C:x;return{width:w+(l?-S:S),height:O+(c?-C:C),x:a[0]*S*(l?-1:1)+M,y:a[1]*C*(c?-1:1)+I}}(g,o.controlDirection,l,o.boundaries,o.keepAspectRatio,E,b,y),P=N!==k,M=z!==S,I=A!==d&&P,R=T!==h&&M;if(!(I||R||P||M))return;if((I||R||1===E[0]||1===E[1])&&(C.x=I?A:m.x,C.y=R?T:m.y,m.x=C.x,m.y=C.y,w.length>0)){const e=A-d,t=T-h;for(const n of w)n.position={x:n.position.x-e+E[0]*(N-k),y:n.position.y-t+E[1]*(z-S)},c.push(n)}if((P||M)&&(C.width=!P||o.resizeDirection&&"horizontal"!==o.resizeDirection?m.width:N,C.height=!M||o.resizeDirection&&"vertical"!==o.resizeDirection?m.height:z,m.width=C.width,m.height=C.height),v&&p.expandParent){const e=E[0]*(C.width??0);C.x&&C.x<e&&(m.x=e,g.x=g.x-(C.x-e));const t=E[1]*(C.height??0);C.y&&C.y<t&&(m.y=t,g.y=g.y-(C.y-t))}const D=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){const o=e-t,s=n-r,l=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(l[0]=-1*l[0]),s&&a&&(l[1]=-1*l[1]),l}({width:m.width,prevWidth:k,height:m.height,prevHeight:S,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),L={...m,direction:D};!1!==f?.(e,L)&&(O=!0,u?.(e,L),r(C,c))}).on("end",e=>{O&&(h?.(e,{...m}),i?.({...m}),O=!1)});a.call(k)},destroy:function(){a.on(".drag",null)}}}({domNode:k.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=O.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=O.getState(),o=[],s={x:e.x,y:e.y},l=r.get(w);if(l&&l.expandParent&&l.parentId){const t=l.origin??a,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Yet([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...det({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,r,t)}}],r,i,a);o.push(...d),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:w,type:"position",position:{...s}};o.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:w,type:"dimensions",resizing:!0,setAttributes:!h||("horizontal"===h?"width":"height"),dimensions:{width:e.width,height:e.height}};o.push(t)}for(const c of t){const e={...c,type:"position"};o.push(e)}n(o)},onEnd:({width:e,height:t})=>{const n={id:w,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};O.getState().triggerNodeChanges([n])}})),z.current.update({controlPosition:A,boundaries:{minWidth:s,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:u,resizeDirection:h,onResizeStart:m,onResize:v,onResizeEnd:b,shouldResize:p}),()=>{z.current?.destroy()}},[A,s,l,c,d,u,m,v,b,p]);const P=A.split("-");return T("div",{className:I4e(["react-flow__resize-control","nodrag",...P,n,r]),ref:k,style:{...i,scale:E,...o&&{[S?"backgroundColor":"borderColor"]:o}},children:a})}),KV(),KV(),ka();var Vit={none:{label:"None",color:"bg-slate-100 text-slate-700 border-slate-300 dark:bg-zinc-700 dark:text-zinc-300 dark:border-zinc-600",icon:"fa-solid fa-lock"},public:{label:"Public",color:"bg-secondary-100 text-secondary-700 border-secondary-300",icon:"fa-solid fa-globe"},authenticated:{label:"Auth",color:"bg-primary-100 text-primary-700 border-primary-300",icon:"fa-solid fa-shield-halved"}},Qit=p(({id:e,data:t,selected:n=!1})=>{const{getEdges:r,setNodes:i}=znt(),{addToast:a}=dUe(),{showDialog:o}=FPe(),s=Vit[t.accessLevel],l=g(async()=>{r().find(t=>t.source===e)?a("You can't remove this folder with elements or folders",{appeareance:"warning",autoDismiss:!0,placement:"top-right"}):await o(/* @__PURE__ */T(_Pe.Header,{children:/* @__PURE__ */P("h4",{children:["Remove ","folder"===t.type?"Folder":"Page"]})}),/* @__PURE__ */T(_Pe.Body,{children:/* @__PURE__ */T("h4",{children:"Do you want to remove this item ?"})}),void 0,{size:"sm"},e)&&i(t=>t.filter(t=>t.id!==e))},[a,t.type,r,e,i,o]);/* @__PURE__ */
3793
3798
  return P(A,{children:[
3794
3799
  /* @__PURE__ */T(Xnt,{type:"target",position:T7e.Top,className:"bg-primary-500! hover:bg-primary-600! h-5! w-5! border-4! border-white! shadow-lg transition-all duration-200 hover:scale-110"}),
3795
3800
  /* @__PURE__ */P(uPe,{className:ca("min-h-37.5 w-50 shadow-md transition-shadow hover:shadow-lg",{"ring-2 ring-blue-500 ring-offset-2":n}),size:"xs",children:[/* @__PURE__ */T(uPe.Header,{children:/* @__PURE__ */P("div",{className:"flex w-full items-start",children:[/* @__PURE__ */P("div",{className:"flex w-full items-center justify-between gap-1",children:[/* @__PURE__ */T(Uj,{icon:"folder"===t.type?"fa-regular fa-folder":"fa-regular fa-file",className:ca("mt-0.5 h-5 shrink-0 text-slate-600",{"text-yellow-600":"folder"===t.type,"text-slate-600":"folder"!==t.type})}),/* @__PURE__ */P("div",{className:"min-w-0 flex-1",children:[/* @__PURE__ */T("h3",{className:"text-foreground truncate text-sm font-semibold",children:t.title}),t.path&&/* @__PURE__ */T("p",{className:"text-muted-foreground truncate rounded-sm text-xs text-gray-500 dark:text-zinc-400",children:t.path})]})]}),n&&/* @__PURE__ */T("div",{className:"flex items-center justify-center rounded p-1 hover:bg-red-100",title:"Remove",children:/* @__PURE__ */T(Uj,{icon:"fas fa-trash-alt",intent:"danger",size:"sm",onClick:l,className:"cursor-pointer"})})]})}),/* @__PURE__ */P(uPe.Body,{children:[/* @__PURE__ */T("hr",{className:"my-1 border-gray-300 dark:border-zinc-700"}),/* @__PURE__ */P("div",{className:"space-y-2 py-2",children:[/* @__PURE__ */P("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */T(zGe,{solid:!1,intent:"custom",size:"xs",icon:s.icon,className:s.color,children:s.label}),"page"===t.type&&t.isDefault&&/* @__PURE__ */T(zGe,{solid:!1,intent:"custom",size:"xs",icon:"fas fa-home",className:"bg-primary-100 text-primary-700 border-primary-300",children:"Home Page"})]}),t.description&&/* @__PURE__ */T("p",{className:"text-muted-foreground line-clamp-3 text-xs",children:t.description})]})]})]}),"folder"===t.type&&/* @__PURE__ */T(Xnt,{type:"source",position:T7e.Bottom,className:"bg-primary-500! hover:bg-primary-600! h-5! w-5! border-4! border-white! shadow-lg transition-all duration-200 hover:scale-110"})]})}),Bit=(e,t=null,n=0,r=0)=>{const i=[],a=[];let o=r;return e.forEach(e=>{const{id:r,title:s,accessLevel:l,type:c,path:d,description:u,icon:h}=e,f=210*n,p={id:r,title:s,accessLevel:l,type:c,path:d,description:u,icon:h};if("page"===e.type&&(p.isDefault=e.isDefault),i.push({id:r,type:"custom",data:p,position:{x:o,y:f}}),t&&a.push({id:`${t}-${r}`,source:t,target:r,type:"customEdge",animated:!0,style:{strokeWidth:2}}),"folder"===c&&e.children.length>0){const t=Bit(e.children,r,n+1,o);i.push(...t.nodes),a.push(...t.edges);const s=250*t.nodes.filter(e=>"folder"!==e.data.type).length;o+=Math.max(250,s)}else o+=250}),{nodes:i,edges:a}};eQ(),vQ();var Fit={custom:Qit},_it={customEdge:({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,selected:a=!1,style:o})=>{const{setEdges:s}=znt(),[l,c,d]=Ret({sourceX:t,sourceY:n,targetX:r,targetY:i}),u=g(()=>s(t=>t.filter(t=>t.id!==e)),[e,s]);/* @__PURE__ */
@@ -4111,5 +4116,5 @@ return T(XB,{value:q,children:e})};Gp(),y1(),IR(),DF(),LF(),JJ(),mi();var flt=({
4111
4116
  return T(mK,{value:U,children:e})},plt=l({});plt.displayName="StyleContext",y1(),DF(),mi(),zF();var mlt=({children:e,style:t,includeSubscriptions:n=!0,middlewares:r=[]})=>{let{subscriptionManager:i}=m(eF),[a,o]=$it(slt,t??lB,r);Fn("style",a);let s=g((e,t=!1)=>o({type:olt.STYLE_UPDATE,style:e,fromSubscriptions:t}),[o]),l=g((e,t,n,r,i,a,s=!1)=>{t||=Lje(n),o({type:olt.STYLE_ADD_SELECTOR,displayMode:e,selector:t,selectorType:n,path:r,value:i,params:a,fromSubscriptions:s})},[o]),c=g((e,t,n,r,i,a=!1)=>o({type:olt.STYLE_UPDATE_SELECTOR,displayMode:e,selector:t,path:n,value:r,params:i,fromSubscriptions:a}),[o]),d=g((e,t,n=!1)=>o({type:olt.STYLE_REMOVE_SELECTOR,displayMode:e,selector:t,fromSubscriptions:n}),[o]),u=g((e,t,n=!1)=>o({type:olt.STYLE_REMOVE_SELECTORS,displayMode:e,selectors:t,fromSubscriptions:n}),[o]),h=g((e,t,n,r,i,a=!1)=>{o({type:olt.STYLE_ADD_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,value:i,fromSubscriptions:a})},[o]),f=g((e,t,n,r,i,a=!1)=>{o({type:olt.STYLE_UPDATE_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,value:i,fromSubscriptions:a})},[o]),p=g((e,t,n,r,i=!1)=>{o({type:olt.STYLE_REMOVE_SELECTOR_VARIABLE,displayMode:e,selector:t,category:n,name:r,fromSubscriptions:i})},[o]),v=g((e,t,n,r=!1)=>o({type:olt.STYLE_ADD_VARIABLE,category:e,name:t,value:n,fromSubscriptions:r}),[o]),b=g((e,t,n,r=!1)=>o({type:olt.STYLE_UPDATE_VARIABLE,category:e,name:t,value:n,fromSubscriptions:r}),[o]),x=g((e,t,n=!1)=>o({type:olt.STYLE_REMOVE_VARIABLE,category:e,name:t,fromSubscriptions:n}),[o]),w=g((e,t=!1)=>o({type:olt.STYLE_ADD_FONT,font:e,fromSubscriptions:t}),[o]),O=g((e,t,n=!1)=>o({type:olt.STYLE_UPDATE_FONT,family:e,font:t,fromSubscriptions:n}),[o]),S=g((e,t=!1)=>o({type:olt.STYLE_REMOVE_FONT,family:e,fromSubscriptions:t}),[o]),C=g((e,t=!1)=>o({type:olt.STYLE_ADD_TEMPLATE,platform:e,fromSubscriptions:t}),[o]),E=g((e,t,n=!1)=>{o({type:olt.STYLE_UPDATE_SETTINGS,path:e,value:t,fromSubscriptions:n})},[o]);y(()=>{if(n)return i.subscribe("STYLE_UPDATED",e=>s(e,!0)),i.subscribe("STYLE_ADD_SELECTOR",({displayMode:e,selector:t,type:n,path:r,style:i,params:a})=>l(e,t,n,r,i,a,!0)),i.subscribe("STYLE_UPDATE_SELECTOR",({displayMode:e,selector:t,path:n,style:r,params:i})=>c(e,t,n,r,i,!0)),i.subscribe("STYLE_REMOVE_SELECTOR",({displayMode:e,selector:t})=>d(e,t,!0)),i.subscribe("STYLE_REMOVE_SELECTORS",({displayMode:e,selectors:t})=>u(e,t,!0)),i.subscribe("STYLE_ADD_SELECTOR_VARIABLE",({displayMode:e,selector:t,category:n,name:r,value:i})=>h(e,t,n,r,i,!0)),i.subscribe("STYLE_UPDATE_SELECTOR_VARIABLE",({displayMode:e,selector:t,category:n,name:r,value:i})=>f(e,t,n,r,i,!0)),i.subscribe("STYLE_REMOVE_SELECTOR_VARIABLE",({displayMode:e,selector:t,category:n,name:r})=>p(e,t,n,r,!0)),i.subscribe("STYLE_ADD_VARIABLE",({category:e,name:t,value:n})=>v(e,t,n,!0)),i.subscribe("STYLE_UPDATE_VARIABLE",({category:e,name:t,value:n})=>b(e,t,n,!0)),i.subscribe("STYLE_REMOVE_VARIABLE",({category:e,name:t})=>x(e,t,!0)),i.subscribe("STYLE_ADD_FONT",({font:e})=>w(e,!0)),i.subscribe("STYLE_UPDATE_FONT",({family:e,font:t})=>O(e,t,!0)),i.subscribe("STYLE_REMOVE_FONT",({family:e})=>S(e,!0)),i.subscribe("STYLE_UPDATE_SETTINGS",({path:e,value:t})=>E(e,t,!0)),()=>i.unsubscribe(["STYLE_UPDATED","STYLE_ADD_SELECTOR","STYLE_UPDATE_SELECTOR","STYLE_REMOVE_SELECTOR","STYLE_REMOVE_SELECTORS","STYLE_ADD_SELECTOR_VARIABLE","STYLE_UPDATE_SELECTOR_VARIABLE","STYLE_REMOVE_SELECTOR_VARIABLE","STYLE_ADD_VARIABLE","STYLE_UPDATE_VARIABLE","STYLE_REMOVE_VARIABLE","STYLE_ADD_FONT","STYLE_UPDATE_FONT","STYLE_REMOVE_FONT","STYLE_UPDATE_SETTINGS"],!0)},[i,n,s,l,c,d,u,h,f,p,v,b,x,w,O,S,E]);let N=k(()=>({styleUpdate:s,styleAddSelector:l,styleUpdateSelector:c,styleRemoveSelector:d,styleRemoveSelectors:u,styleAddSelectorVariable:h,styleUpdateSelectorVariable:f,styleRemoveSelectorVariable:p,styleAddVariable:v,styleUpdateVariable:b,styleRemoveVariable:x,styleAddFont:w,styleUpdateFont:O,styleRemoveFont:S,styleAddTemplate:C,styleUpdateSettings:E}),[s,l,c,d,u,h,f,p,v,b,x,w,O,S,C,E]);return N0("main",N),/* @__PURE__ */T(plt,{value:N,children:e})};IR(),LF();var glt=({children:e,includeSubscriptions:t=!0})=>{const{style:n}=m(tF),{enqueueMiddleware:r}=m(dlt),{undoableMiddleware:i}=m(cGe),a=k(()=>[{middleware:i},{middleware:r,filterCallback:cR}],[r,i]);/* @__PURE__ */
4112
4117
  return T(mlt,{style:n,middlewares:a,includeSubscriptions:t,children:e})};Gp();var vlt={past:[],future:[],canUndo:!1,canRedo:!1},blt=(e=vlt,t)=>{switch(t.type){case"undoableAddUndo":{const n=Xi(t,["type"]),r=[...e.past,n];return{past:r,future:[],canUndo:r.length>0,canRedo:!1}}case"undoableUndo":case"undoableRedo":return{past:t.past,future:t.future,canUndo:t.past.length>0,canRedo:t.future.length>0};case"undoableClearHistory":return 0===e.past.length&&0===e.future.length?e:vlt;default:return e}};IR();var ylt=({children:e})=>{const[t,n]=S(blt,vlt),r=C(t);r.current=t;const i=g((e,t=!0)=>{switch(e.action.type){case Zst[e.action.type]:{const n=e;return void n.dispatch({type:Zst.SCHEMA_UPDATE,schema:t?n.prevState:n.nextState})}case olt[e.action.type]:{const n=e;return void n.dispatch({type:olt.STYLE_UPDATE,style:t?n.prevState:n.nextState})}case llt[e.action.type]:{const n=e,r=n.prevState.segmentId;return void n.dispatch({type:llt.SEGMENTS_UPDATE,segment:t?n.prevState[r]:n.nextState[r],segmentId:r})}default:return}},[]),a=g((e,t,r,i)=>{n({type:"undoableAddUndo",prevState:e,action:t,nextState:r,dispatch:i})},[n]),o=g(()=>{const{canUndo:e,past:t,future:a}=r.current;if(e){const e=t.pop();if(!e)return;const r=[...a,e];i(e),n({type:"undoableUndo",past:t,future:r})}},[n,i]),s=g(()=>{const{canRedo:e,past:t,future:a}=r.current;if(e){const e=a.pop();if(!e)return;const r=[...t,e];i(e,!1),n({type:"undoableRedo",past:r,future:a})}},[n,i]),l=g(()=>{n({type:"undoableClearHistory"})},[n]),c=g((e,t,n,r)=>{cR(r)?a(e,r,t,n):r.fromSubscriptions&&l()},[a,l]),{canUndo:d,canRedo:u}=t,h=k(()=>({canUndo:d,canRedo:u,dispatchUndoable:n,undoableAddUndo:a,undoableUndo:o,undoableRedo:s,undoableClearHistory:l,undoableMiddleware:c}),[d,u,n,a,o,s,l,c]);/* @__PURE__ */
4113
4118
  return T(cGe,{value:h,children:e})},xlt=({children:e,instanceId:t,webKey:n="",webId:r,environment:i="main",userKey:a="",server:o,includeSubscriptions:s=!0,includeRealTime:l=!0,debugMode:c=!1})=>/* @__PURE__ */T(Fst,{instanceId:t,webKey:n,webId:r,environment:i,userKey:a,server:o,children:/* @__PURE__ */T(qst,{includeSubscriptions:s,includeRealTime:l,children:/* @__PURE__ */T(ult,{includeSubscriptions:s,children:/* @__PURE__ */T(ylt,{children:/* @__PURE__ */T(gXe,{debugMode:c,children:/* @__PURE__ */T(flt,{children:/* @__PURE__ */T(Dst,{children:/* @__PURE__ */T(Ist,{children:/* @__PURE__ */T(Ust,{children:/* @__PURE__ */T(BPe,{children:/* @__PURE__ */T(hlt,{includeSubscriptions:s,children:/* @__PURE__ */T(glt,{includeSubscriptions:s,children:/* @__PURE__ */T(qXe,{server:o,children:/* @__PURE__ */T(Lst,{children:e})})})})})})})})})})})})})});mi();var wlt=({webKey:e="",webId:t,userKey:n="",instanceId:r="",server:i,environment:a="main",includeSubscriptions:o=!0,includeRealTime:s=!0,externalStyle:l="",debugMode:c=!1})=>{const[d,u]=E(!1),[h,f]=nje("builder-state.app.displayBorderComponents","black"),[p,m]=E(1),[g,v]=E("desktop"),[b,y]=E(!1);Xn("displayMode",g),Xn(["render.previewMode","render.debugMode","render.environment"],[d,c,a]);const x=k(()=>({previewMode:d,debugMode:c,setPreviewMode:u,displayBorderComponents:h,setDisplayBorderComponents:f,zoom:p,setZoom:m,displayMode:g,setDisplayMode:v,mobilePreview:b,setMobilePreview:y}),[d,c,u,h,f,p,m,g,v,b,y]),w=k(()=>/* @__PURE__ */T(xlt,{instanceId:r,webKey:e,webId:t,environment:a,userKey:n,server:i,includeSubscriptions:o,includeRealTime:s,debugMode:c,children:/* @__PURE__ */T(dXe,{children:/* @__PURE__ */T($Xe,{children:/* @__PURE__ */T(kPe,{renderLeftPopup:!1,renderRightPopup:!1,renderFloatingPopup:!d,children:/* @__PURE__ */T(M2e,{innerClassName:"flex",enabled:c,instanceId:r,children:/* @__PURE__ */T(Ast,{externalStyle:l})})})})})}),[r,e,t,a,n,i,o,s,d,c,l]);/* @__PURE__ */
4114
- return T(SPe,{value:x,children:w})},Olt=e=>{const t=new Headers;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(e=>{const n=e.split(":"),r=n.shift()?.trim();if(r){const e=n.join(":").trim();t.append(r,e)}}),t},klt=(e,t)=>t?.customFetch?((e,t)=>new Promise((n,r)=>{const i=new XMLHttpRequest;i.onload=()=>{const e={url:"",status:i.status,statusText:i.statusText,headers:Olt(i.getAllResponseHeaders()||"")};e.url="responseURL"in i?i.responseURL:e.headers.get("X-Request-URL")??"";const t=i.response??i.responseText;n(new Response(t,e))},i.onerror=e=>{r(/* @__PURE__ */new TypeError("Network request failed")),t?.onError&&t.onError(e)},i.ontimeout=()=>{r(/* @__PURE__ */new TypeError("Network request failed"))},i.open(t?.method??"GET",e,!0),t?.headers&&Object.keys(t.headers).forEach(e=>{const n=t.headers;n[e]&&i.setRequestHeader(e,n[e])}),t?.onProgress&&(i.upload.onprogress=t.onProgress),t?.onAbortPossible&&t.onAbortPossible(()=>{i.abort()}),t?.body&&i.send(t.body)}))(e,t):fetch(e,t),Slt={name:"@plitzi/plitzi-builder",version:"0.35.7",homepage:"./",license:"AGPL-3.0",files:["dist"],repository:{type:"https",url:"https://github.com/plitzi/plitzi-workspace.git"},type:"module",main:"dist/plitzi-builder.js",module:"dist/plitzi-builder.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/plitzi-builder.js",default:"./dist/plitzi-builder.js"},"./plitzi-builder.css":"./dist/plitzi-builder.css","./plitzi-builder-vendor.js":"./dist/plitzi-builder-vendor.js","./plitzi-builder-dev-vendor.js":"./dist/plitzi-builder-dev-vendor.js","./plitzi-builder-dev-vendor.js.map":"./dist/plitzi-builder-dev-vendor.js.map"},dependencies:{"@apollo/client":"^4.3.0","@fortawesome/fontawesome-free":"^7.3.1","@plitzi/nexus":"^1.1.4","@plitzi/plitzi-sdk":"workspace:*","@plitzi/plitzi-ui":"^1.6.21","@plitzi/sdk-auth":"workspace:*","@plitzi/sdk-dev-tools":"workspace:*","@plitzi/sdk-elements":"workspace:*","@plitzi/sdk-event-bridge":"workspace:*","@plitzi/sdk-interactions":"workspace:*","@plitzi/sdk-navigation":"workspace:*","@plitzi/sdk-plugins":"workspace:*","@plitzi/sdk-schema":"workspace:*","@plitzi/sdk-shared":"workspace:*","@plitzi/sdk-style":"workspace:*","@plitzi/sdk-variables":"workspace:*","@tanstack/react-virtual":"^3.14.12","@xyflow/react":"^12.11.6","apollo-upload-client":"^20.0.0",clsx:"^2.1.1",graphql:"^17.0.2","graphql-ws":"^6.2.1",immer:"^11.1.18",jszip:"^3.10.2","react-hook-form":"^7.88.0","react-router-dom":"^7.18.3",swr:"^2.5.1",uuid:"^14.0.2",zod:"^4.6.4"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@babel/compat-data":"^8.0.5","@babel/core":"^8.0.5","@babel/helper-builder-react-jsx-experimental":"^7.12.11","@babel/helper-validator-identifier":"^8.0.4","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-transform-private-methods":"^8.0.1","@babel/plugin-transform-runtime":"^8.0.1","@babel/polyfill":"^7.12.1","@babel/preset-env":"^8.0.5","@babel/preset-react":"^8.0.1","@tailwindcss/postcss":"^4.3.3","css-loader":"^7.1.5",eslint:"^9.39.5","eslint-plugin-import":"^2.32.0","flow-bin":"^0.331.0",postcss:"^8.5.28","postcss-loader":"^8.2.1","postcss-scss":"^4.0.9",prettier:"^3.9.6","prop-types":"^15.8.1",react:"^19.3.0","react-dom":"^19.3.0","react-refresh":"^0.19.0","react-test-renderer":"^19.3.0",sass:"^1.104.1","sass-embedded":"^1.104.1","sass-loader":"^17.0.1",stylelint:"^17.15.0","stylelint-order":"^8.1.1","stylelint-scss":"^7.2.0",terser:"^5.51.2",typescript:"^6.0.3",vite:"^8.3.0","vite-plugin-dts":"^5.1.0","vite-plugin-ejs":"^2.0.0","vite-plugin-mkcert":"^2.1.0","vite-plugin-react":"^4.0.1",vitest:"^5.0.0"},scripts:{start:"vite dev --mode development",test:"vitest run","test:coverage":"",lint:"TIMING=1 eslint ./src","lint-style":'stylelint "**/*.scss" --custom-syntax postcss-scss',"lint-style:fix":'stylelint "**/*.scss" --custom-syntax postcss-scss --fix',typecheck:"tsc -p tsconfig.app.json --noEmit","build:dev":"tsc -p tsconfig.app.json --noEmit && vite build --mode development","build:dev-watch":"tsc -p tsconfig.app.json --noEmit && vite build --mode development --watch","build:dev-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build --mode development","build:dev-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build --mode development","build:prod":"tsc -p tsconfig.app.json --noEmit && vite build","build:prod-watch":"tsc -p tsconfig.app.json --noEmit && vite build --watch","build:prod-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build","build:prod-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build","build-vendor:dev":"vite build --config vite.vendor.config.ts --mode development","build-vendor:prod":"vite build --config vite.vendor.config.ts"},eslintConfig:{extends:"react-app"},browserslist:{production:[">0.2%","not dead","not op_mini all"],development:["last 1 chrome version","last 1 firefox version","last 1 safari version"]}};cM(),kR(),RT(),JV(),QQ(),SQ(),nQ(),HV(),GV(),AQ(),aQ(),vF(),DQ(),dQ(),fQ(),Cj(),ka(),ek(),pF(),an(),pi(),h1(),CR(),vj(),Yg(),u1(),mi(),C1();var Clt={Button:Zj,FileUpload:kDe,ContentEditable:G1,Card:dPe,Form:XDe,Input:SV,Switch:sV,Checkbox:DV,Select:iV,Select2:PV,Heading:cTe,Flex:Bj,ContainerResizable:WTe,ContainerCollapsable:rQe,Icon:Wj,IconGroup:Uje,Popup:wPe,Sidebar:JTe,Tree:_Ge,Accordion:FTe,QueryBuilder:XQ,Alert:sTe,Modal:VPe,Text:BGe,Label:Jj,TextArea:hTe,ContainerFrame:EPe,KVInput:xTe,Markdown:_ee,MenuList:tVe,ContainerDraggable:vPe,Breadcrumb:AGe,CodeMirror:iTe,ErrorMessage:Gj,ColorPicker:oDe,MetricInput:lVe,ContainerTabs:LGe,ContainerFloating:bV,Badge:NGe},Elt=e=>{const{children:t,server:r,webKey:i="",includeSubscriptions:a=!0,userKey:o="",className:s="min-h-screen",debugMode:l=!1}=e,c=k(()=>function(e){if(!e)return 0;let t={};try{let n=e.split(".")[1],r=typeof window<"u"?window.atob(n):Buffer.from(n,"base64").toString();t=JSON.parse(r)}catch{return 0}return ji(t,"data.spaceId",0)}(i),[i]),[d,u]=nje(`web_${c}_state.instanceId`,"","sessionStorage"),[f,p]=nje("builder-state.debugMode",!1,"localStorage",l),m=k(()=>(e=>{const t={apiServer:"https://api.plitzi.com",ssrServer:"https://ssr.plitzi.com",basePath:"",host:"https://plitzi.com",serverUrl:"https://server.plitzi.com",fontsBaseUrl:"",websocketServer:"wss://server.plitzi.com",subscriptionServer:"wss://server.plitzi.com/subscriptions",location:void 0,...e};return"/"===t.basePath?t.basePath="":t.basePath&&(t.basePath=t.basePath.replaceAll("//","/")),t})(r),[r]),v=g(e=>{e.shiftKey&&"F12"===e.key&&p(e=>!e)},[p]);y(()=>{l&&window.addEventListener("keydown",v)},[v,l]),y(()=>{},[]);let b=!1;try{gYe(),b=!0}catch{b=!1}y(()=>{const e=HQ();u(e)},[c,u]);const x=g((e,t,n,r)=>{if(!e)return;const i=new oM,a=new eKe({uri:e.serverUrl,fetch:klt}),s=new wGe(e=>{const n={...e.headers??{},"plitzi-instance-id":r,"plitzi-access-token":o,"sdk-version":Slt.version,"Apollo-Require-Preflight":"true"};return t&&(n.authorization=`Bearer ${t}`),{headers:n}}),l=OT.from([EI(e.serverUrl),vD(),s,a]);if(!n||!e.subscriptionServer)return new tI({link:l,cache:i});const c=function(e){const{url:t,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:l=0,retryAttempts:c=5,retryWait:d=async function(e){const t=Math.pow(2,e);await new Promise(e=>setTimeout(e,1e3*t+Math.floor(2700*Math.random()+300)))},shouldRetry:u=cKe,on:h,webSocketImpl:f,generateID:p=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},jsonMessageReplacer:m,jsonMessageReviver:g}=e;let v;if(f){if(!("function"==typeof(b=f)&&"constructor"in b&&"CLOSED"in b&&"CLOSING"in b&&"CONNECTING"in b&&"OPEN"in b))throw new Error("Invalid WebSocket implementation provided");v=f}else"undefined"!=typeof WebSocket?v=WebSocket:"undefined"!=typeof global?v=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&(v=window.WebSocket||window.MozWebSocket);var b;if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const y=v,x=(()=>{const e=/* @__PURE__ */(()=>{const e={};return{on:(t,n)=>(e[t]=n,()=>{delete e[t]}),emit(t){"id"in t&&e[t.id]?.(t)}}})(),t={connecting:h?.connecting?[h.connecting]:[],opened:h?.opened?[h.opened]:[],connected:h?.connected?[h.connected]:[],ping:h?.ping?[h.ping]:[],pong:h?.pong?[h.pong]:[],message:h?.message?[e.emit,h.message]:[e.emit],closed:h?.closed?[h.closed]:[],error:h?.error?[h.error]:[]};return{onMessage:e.on,on(e,n){const r=t[e];return r.push(n),()=>{const e=r.indexOf(n);e>-1&&r.splice(e,1)}},emit(e,...n){for(const r of[...t[e]])r(...n)}}})();function w(e){const t=[x.on("error",n=>{t.forEach(e=>e()),e(n)}),x.on("closed",n=>{t.forEach(e=>e()),e(n)})]}let O,k,S=0,C=!1,E=0,N=!1;async function z(){clearTimeout(k);const[e,r]=await(O??(O=new Promise((e,r)=>(async()=>{if(C){if(await d(E),!S)return O=void 0,r({code:1e3,reason:"All Subscriptions Gone"});E++}x.emit("connecting",C);const i=new y("function"==typeof t?await t():t,"graphql-transport-ws");let a,c;function u(){isFinite(o)&&o>0&&(clearTimeout(c),c=setTimeout(()=>{i.readyState===y.OPEN&&(i.send(sKe({type:aKe.Ping})),x.emit("ping",!1,void 0))},o))}w(e=>{O=void 0,clearTimeout(a),clearTimeout(c),r(e),e instanceof lKe&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=e=>x.emit("error",e),i.onclose=e=>x.emit("closed",e),i.onopen=async()=>{try{x.emit("opened",i);const e="function"==typeof n?await n():n;if(i.readyState!==y.OPEN)return;i.send(sKe(e?{type:aKe.ConnectionInit,payload:e}:{type:aKe.ConnectionInit},m)),isFinite(l)&&l>0&&(a=setTimeout(()=>{i.close(iKe.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),u()}catch(e){x.emit("error",e),i.close(iKe.InternalClientError,rKe(e instanceof Error?e.message:String(e),"Internal client error"))}};let h=!1;i.onmessage=({data:t})=>{try{const n=function(e,t){return oKe("string"==typeof e?JSON.parse(e,t):e)}(t,g);if(x.emit("message",n),"ping"===n.type||"pong"===n.type)return x.emit(n.type,!0,n.payload),void("pong"===n.type?u():s||(i.send(sKe(n.payload?{type:aKe.Pong,payload:n.payload}:{type:aKe.Pong})),x.emit("pong",!1,n.payload)));if(h)return;if(n.type!==aKe.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(a),h=!0,x.emit("connected",i,n.payload,C),C=!1,E=0,e([i,new Promise((e,t)=>w(t))])}catch(n){i.onmessage=null,x.emit("error",n),i.close(iKe.BadResponse,rKe(n instanceof Error?n.message:String(n),"Bad response"))}}})())));e.readyState===y.CLOSING&&await r;let i=()=>{};const c=new Promise(e=>i=e);return[e,i,Promise.race([c.then(()=>{if(!S){const t=()=>e.close(1e3,"Normal Closure");isFinite(a)&&a>0?k=setTimeout(()=>{e.readyState===y.OPEN&&t()},a):t()}}),r])]}function A(e){if(cKe(e)&&(t=e.code,![1e3,1001,1006,1005,1012,1013,1014].includes(t)&&t>=1e3&&t<=1999||[iKe.InternalServerError,iKe.InternalClientError,iKe.BadRequest,iKe.BadResponse,iKe.Unauthorized,iKe.SubprotocolNotAcceptable,iKe.SubscriberAlreadyExists,iKe.TooManyInitialisationRequests].includes(e.code)))throw e;var t;if(N)return!1;if(cKe(e)&&1e3===e.code)return S>0;if(!c||E>=c)throw e;if(!u(e))throw e;return C=!0}function T(e,t){const n=p(e);let r=!1,i=!1,a=()=>{S--,r=!0};return(async()=>{for(S++;;)try{const[o,s,l]=await z();if(r)return s();const c=x.onMessage(n,e=>{switch(e.type){case aKe.Next:return void t.next(e.payload);case aKe.Error:return i=!0,r=!0,t.error(e.payload),void a();case aKe.Complete:return r=!0,void a()}});return o.send(sKe({id:n,type:aKe.Subscribe,payload:e},m)),a=()=>{r||o.readyState!==y.OPEN||o.send(sKe({id:n,type:aKe.Complete},m)),S--,r=!0,s()},void(await l.finally(c))}catch(o){if(!A(o))return}})().then(()=>{i||t.complete()}).catch(e=>{t.error(e)}),()=>{r||a()}}return r||(async()=>{for(S++;;)try{const[,,e]=await z();await e}catch(e){try{if(!A(e))return}catch(t){return i?.(t)}}})(),{on:x.on,subscribe:T,iterate(e){const t=[],n={done:!1,error:null,resolve:()=>{}},r=T(e,{next(e){t.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=async function*(){for(;;){for(t.length||await new Promise(e=>n.resolve=e);t.length;)yield t.shift();if(n.error)throw n.error;if(n.done)return}}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(r(),{done:!0,value:void 0}),i},async dispose(){if(N=!0,O){const[e]=await O;e.close(1e3,"Normal Closure")}},terminate(){O&&x.emit("closed",new lKe)}}}({url:e.subscriptionServer,shouldRetry:()=>!0,retryAttempts:1/0,connectionParams:{authToken:t,instanceId:r,userToken:o},onNonLazyError:e=>{if(e instanceof Error){const{message:t}=e;"Space Not Allowed"!==t&&"Invalid Token"!==t&&"Missing auth token"!==t&&"Missing instanceId"!==t&&"Access Not Authorized"!==t&&"Token Invalid"!==t||c.dispose()}}}),d=new OGe(c),u=OT.split(({query:e})=>{const t=pN(e);return"OperationDefinition"===t.kind&&t.operation===Lx.SUBSCRIPTION},OT.from([vD(),d]),l),h=new tI({link:u,cache:i});return h.subscriptionClient=c,h},[o]),w=k(()=>x(m,i,a,d),[x,m,i,a,d]),O=k(()=>{const e={};return t?(n.forEach(t,t=>{if(!h(t))return;const{renderType:n,component:r,settings:i,definition:a,...o}=t.props;if(!n||!r)return;const s=r;s.type=n,s.pluginSettings=i,s.extraProps=o,a&&(s.content=a),e[n]=s}),e):e},[t]);y(()=>{if(w)return()=>{const e=w.subscriptionClient;e&&e.dispose()}},[w]);const S=k(()=>w&&/* @__PURE__ */T(CGe,{client:w,children:/* @__PURE__ */T(CTe,{localCustomComponents:O,localComponents:L,children:/* @__PURE__ */T(cUe,{children:/* @__PURE__ */T(wlt,{...Xi(e,["children","server"]),debugMode:f,server:m,instanceId:d,webId:c})})})}),[w,f,d,O,e,m,c]),C=k(()=>({styleSelector:"base",collaboration:{collaborators:[]},render:{..._,previewMode:!1}}),[]);/* @__PURE__ */
4119
+ return T(SPe,{value:x,children:w})},Olt=e=>{const t=new Headers;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(e=>{const n=e.split(":"),r=n.shift()?.trim();if(r){const e=n.join(":").trim();t.append(r,e)}}),t},klt=(e,t)=>t?.customFetch?((e,t)=>new Promise((n,r)=>{const i=new XMLHttpRequest;i.onload=()=>{const e={url:"",status:i.status,statusText:i.statusText,headers:Olt(i.getAllResponseHeaders()||"")};e.url="responseURL"in i?i.responseURL:e.headers.get("X-Request-URL")??"";const t=i.response??i.responseText;n(new Response(t,e))},i.onerror=e=>{r(/* @__PURE__ */new TypeError("Network request failed")),t?.onError&&t.onError(e)},i.ontimeout=()=>{r(/* @__PURE__ */new TypeError("Network request failed"))},i.open(t?.method??"GET",e,!0),t?.headers&&Object.keys(t.headers).forEach(e=>{const n=t.headers;n[e]&&i.setRequestHeader(e,n[e])}),t?.onProgress&&(i.upload.onprogress=t.onProgress),t?.onAbortPossible&&t.onAbortPossible(()=>{i.abort()}),t?.body&&i.send(t.body)}))(e,t):fetch(e,t),Slt={name:"@plitzi/plitzi-builder",version:"0.35.8",homepage:"./",license:"AGPL-3.0",files:["dist"],repository:{type:"https",url:"https://github.com/plitzi/plitzi-workspace.git"},type:"module",main:"dist/plitzi-builder.js",module:"dist/plitzi-builder.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/plitzi-builder.js",default:"./dist/plitzi-builder.js"},"./plitzi-builder.css":"./dist/plitzi-builder.css","./plitzi-builder-vendor.js":"./dist/plitzi-builder-vendor.js","./plitzi-builder-dev-vendor.js":"./dist/plitzi-builder-dev-vendor.js","./plitzi-builder-dev-vendor.js.map":"./dist/plitzi-builder-dev-vendor.js.map"},dependencies:{"@apollo/client":"^4.3.0","@fortawesome/fontawesome-free":"^7.3.1","@plitzi/nexus":"^1.1.4","@plitzi/plitzi-sdk":"workspace:*","@plitzi/plitzi-ui":"^1.6.21","@plitzi/sdk-auth":"workspace:*","@plitzi/sdk-dev-tools":"workspace:*","@plitzi/sdk-elements":"workspace:*","@plitzi/sdk-event-bridge":"workspace:*","@plitzi/sdk-interactions":"workspace:*","@plitzi/sdk-navigation":"workspace:*","@plitzi/sdk-plugins":"workspace:*","@plitzi/sdk-schema":"workspace:*","@plitzi/sdk-shared":"workspace:*","@plitzi/sdk-style":"workspace:*","@plitzi/sdk-variables":"workspace:*","@tanstack/react-virtual":"^3.14.12","@xyflow/react":"^12.11.6","apollo-upload-client":"^20.0.0",clsx:"^2.1.1",graphql:"^17.0.2","graphql-ws":"^6.2.1",immer:"^11.1.18",jszip:"^3.10.2","react-hook-form":"^7.88.0","react-router-dom":"^7.18.3",swr:"^2.5.1",uuid:"^14.0.2",zod:"^4.6.4"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@babel/compat-data":"^8.0.5","@babel/core":"^8.0.5","@babel/helper-builder-react-jsx-experimental":"^7.12.11","@babel/helper-validator-identifier":"^8.0.4","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-transform-private-methods":"^8.0.1","@babel/plugin-transform-runtime":"^8.0.1","@babel/polyfill":"^7.12.1","@babel/preset-env":"^8.0.5","@babel/preset-react":"^8.0.1","@tailwindcss/postcss":"^4.3.3","css-loader":"^7.1.5",eslint:"^9.39.5","eslint-plugin-import":"^2.32.0","flow-bin":"^0.331.0",postcss:"^8.5.28","postcss-loader":"^8.2.1","postcss-scss":"^4.0.9",prettier:"^3.9.6","prop-types":"^15.8.1",react:"^19.3.0","react-dom":"^19.3.0","react-refresh":"^0.19.0","react-test-renderer":"^19.3.0",sass:"^1.104.1","sass-embedded":"^1.104.1","sass-loader":"^17.0.1",stylelint:"^17.15.0","stylelint-order":"^8.1.1","stylelint-scss":"^7.2.0",terser:"^5.51.2",typescript:"^6.0.3",vite:"^8.3.0","vite-plugin-dts":"^5.1.0","vite-plugin-ejs":"^2.0.0","vite-plugin-mkcert":"^2.1.0","vite-plugin-react":"^4.0.1",vitest:"^5.0.0"},scripts:{start:"vite dev --mode development",test:"vitest run","test:coverage":"",lint:"TIMING=1 eslint ./src","lint-style":'stylelint "**/*.scss" --custom-syntax postcss-scss',"lint-style:fix":'stylelint "**/*.scss" --custom-syntax postcss-scss --fix',typecheck:"tsc -p tsconfig.app.json --noEmit","build:dev":"tsc -p tsconfig.app.json --noEmit && vite build --mode development","build:dev-watch":"tsc -p tsconfig.app.json --noEmit && vite build --mode development --watch","build:dev-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build --mode development","build:dev-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build --mode development","build:prod":"tsc -p tsconfig.app.json --noEmit && vite build","build:prod-watch":"tsc -p tsconfig.app.json --noEmit && vite build --watch","build:prod-gzip":"tsc -p tsconfig.app.json --noEmit && ONLY_GZIP=1 vite build","build:prod-analyze":"tsc -p tsconfig.app.json --noEmit && ONLY_ANALYZE=1 vite build","build-vendor:dev":"vite build --config vite.vendor.config.ts --mode development","build-vendor:prod":"vite build --config vite.vendor.config.ts"},eslintConfig:{extends:"react-app"},browserslist:{production:[">0.2%","not dead","not op_mini all"],development:["last 1 chrome version","last 1 firefox version","last 1 safari version"]}};cM(),kR(),RT(),JV(),QQ(),SQ(),nQ(),HV(),GV(),AQ(),aQ(),vF(),DQ(),dQ(),fQ(),Cj(),ka(),ek(),pF(),an(),pi(),h1(),CR(),vj(),Yg(),u1(),mi(),C1();var Clt={Button:Zj,FileUpload:kDe,ContentEditable:G1,Card:dPe,Form:XDe,Input:SV,Switch:sV,Checkbox:DV,Select:iV,Select2:PV,Heading:cTe,Flex:Bj,ContainerResizable:WTe,ContainerCollapsable:rQe,Icon:Wj,IconGroup:Uje,Popup:wPe,Sidebar:JTe,Tree:_Ge,Accordion:FTe,QueryBuilder:XQ,Alert:sTe,Modal:VPe,Text:BGe,Label:Jj,TextArea:hTe,ContainerFrame:EPe,KVInput:xTe,Markdown:_ee,MenuList:tVe,ContainerDraggable:vPe,Breadcrumb:AGe,CodeMirror:iTe,ErrorMessage:Gj,ColorPicker:oDe,MetricInput:lVe,ContainerTabs:LGe,ContainerFloating:bV,Badge:NGe},Elt=e=>{const{children:t,server:r,webKey:i="",includeSubscriptions:a=!0,userKey:o="",className:s="min-h-screen",debugMode:l=!1}=e,c=k(()=>function(e){if(!e)return 0;let t={};try{let n=e.split(".")[1],r=typeof window<"u"?window.atob(n):Buffer.from(n,"base64").toString();t=JSON.parse(r)}catch{return 0}return ji(t,"data.spaceId",0)}(i),[i]),[d,u]=nje(`web_${c}_state.instanceId`,"","sessionStorage"),[f,p]=nje("builder-state.debugMode",!1,"localStorage",l),m=k(()=>(e=>{const t={apiServer:"https://api.plitzi.com",ssrServer:"https://ssr.plitzi.com",basePath:"",host:"https://plitzi.com",serverUrl:"https://server.plitzi.com",fontsBaseUrl:"",websocketServer:"wss://server.plitzi.com",subscriptionServer:"wss://server.plitzi.com/subscriptions",location:void 0,...e};return"/"===t.basePath?t.basePath="":t.basePath&&(t.basePath=t.basePath.replaceAll("//","/")),t})(r),[r]),v=g(e=>{e.shiftKey&&"F12"===e.key&&p(e=>!e)},[p]);y(()=>{l&&window.addEventListener("keydown",v)},[v,l]),y(()=>{},[]);let b=!1;try{gYe(),b=!0}catch{b=!1}y(()=>{const e=HQ();u(e)},[c,u]);const x=g((e,t,n,r)=>{if(!e)return;const i=new oM,a=new eKe({uri:e.serverUrl,fetch:klt}),s=new wGe(e=>{const n={...e.headers??{},"plitzi-instance-id":r,"plitzi-access-token":o,"sdk-version":Slt.version,"Apollo-Require-Preflight":"true"};return t&&(n.authorization=`Bearer ${t}`),{headers:n}}),l=OT.from([EI(e.serverUrl),vD(),s,a]);if(!n||!e.subscriptionServer)return new tI({link:l,cache:i});const c=function(e){const{url:t,connectionParams:n,lazy:r=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:l=0,retryAttempts:c=5,retryWait:d=async function(e){const t=Math.pow(2,e);await new Promise(e=>setTimeout(e,1e3*t+Math.floor(2700*Math.random()+300)))},shouldRetry:u=cKe,on:h,webSocketImpl:f,generateID:p=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},jsonMessageReplacer:m,jsonMessageReviver:g}=e;let v;if(f){if(!("function"==typeof(b=f)&&"constructor"in b&&"CLOSED"in b&&"CLOSING"in b&&"CONNECTING"in b&&"OPEN"in b))throw new Error("Invalid WebSocket implementation provided");v=f}else"undefined"!=typeof WebSocket?v=WebSocket:"undefined"!=typeof global?v=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&(v=window.WebSocket||window.MozWebSocket);var b;if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const y=v,x=(()=>{const e=/* @__PURE__ */(()=>{const e={};return{on:(t,n)=>(e[t]=n,()=>{delete e[t]}),emit(t){"id"in t&&e[t.id]?.(t)}}})(),t={connecting:h?.connecting?[h.connecting]:[],opened:h?.opened?[h.opened]:[],connected:h?.connected?[h.connected]:[],ping:h?.ping?[h.ping]:[],pong:h?.pong?[h.pong]:[],message:h?.message?[e.emit,h.message]:[e.emit],closed:h?.closed?[h.closed]:[],error:h?.error?[h.error]:[]};return{onMessage:e.on,on(e,n){const r=t[e];return r.push(n),()=>{const e=r.indexOf(n);e>-1&&r.splice(e,1)}},emit(e,...n){for(const r of[...t[e]])r(...n)}}})();function w(e){const t=[x.on("error",n=>{t.forEach(e=>e()),e(n)}),x.on("closed",n=>{t.forEach(e=>e()),e(n)})]}let O,k,S=0,C=!1,E=0,N=!1;async function z(){clearTimeout(k);const[e,r]=await(O??(O=new Promise((e,r)=>(async()=>{if(C){if(await d(E),!S)return O=void 0,r({code:1e3,reason:"All Subscriptions Gone"});E++}x.emit("connecting",C);const i=new y("function"==typeof t?await t():t,"graphql-transport-ws");let a,c;function u(){isFinite(o)&&o>0&&(clearTimeout(c),c=setTimeout(()=>{i.readyState===y.OPEN&&(i.send(sKe({type:aKe.Ping})),x.emit("ping",!1,void 0))},o))}w(e=>{O=void 0,clearTimeout(a),clearTimeout(c),r(e),e instanceof lKe&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=e=>x.emit("error",e),i.onclose=e=>x.emit("closed",e),i.onopen=async()=>{try{x.emit("opened",i);const e="function"==typeof n?await n():n;if(i.readyState!==y.OPEN)return;i.send(sKe(e?{type:aKe.ConnectionInit,payload:e}:{type:aKe.ConnectionInit},m)),isFinite(l)&&l>0&&(a=setTimeout(()=>{i.close(iKe.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),u()}catch(e){x.emit("error",e),i.close(iKe.InternalClientError,rKe(e instanceof Error?e.message:String(e),"Internal client error"))}};let h=!1;i.onmessage=({data:t})=>{try{const n=function(e,t){return oKe("string"==typeof e?JSON.parse(e,t):e)}(t,g);if(x.emit("message",n),"ping"===n.type||"pong"===n.type)return x.emit(n.type,!0,n.payload),void("pong"===n.type?u():s||(i.send(sKe(n.payload?{type:aKe.Pong,payload:n.payload}:{type:aKe.Pong})),x.emit("pong",!1,n.payload)));if(h)return;if(n.type!==aKe.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(a),h=!0,x.emit("connected",i,n.payload,C),C=!1,E=0,e([i,new Promise((e,t)=>w(t))])}catch(n){i.onmessage=null,x.emit("error",n),i.close(iKe.BadResponse,rKe(n instanceof Error?n.message:String(n),"Bad response"))}}})())));e.readyState===y.CLOSING&&await r;let i=()=>{};const c=new Promise(e=>i=e);return[e,i,Promise.race([c.then(()=>{if(!S){const t=()=>e.close(1e3,"Normal Closure");isFinite(a)&&a>0?k=setTimeout(()=>{e.readyState===y.OPEN&&t()},a):t()}}),r])]}function A(e){if(cKe(e)&&(t=e.code,![1e3,1001,1006,1005,1012,1013,1014].includes(t)&&t>=1e3&&t<=1999||[iKe.InternalServerError,iKe.InternalClientError,iKe.BadRequest,iKe.BadResponse,iKe.Unauthorized,iKe.SubprotocolNotAcceptable,iKe.SubscriberAlreadyExists,iKe.TooManyInitialisationRequests].includes(e.code)))throw e;var t;if(N)return!1;if(cKe(e)&&1e3===e.code)return S>0;if(!c||E>=c)throw e;if(!u(e))throw e;return C=!0}function T(e,t){const n=p(e);let r=!1,i=!1,a=()=>{S--,r=!0};return(async()=>{for(S++;;)try{const[o,s,l]=await z();if(r)return s();const c=x.onMessage(n,e=>{switch(e.type){case aKe.Next:return void t.next(e.payload);case aKe.Error:return i=!0,r=!0,t.error(e.payload),void a();case aKe.Complete:return r=!0,void a()}});return o.send(sKe({id:n,type:aKe.Subscribe,payload:e},m)),a=()=>{r||o.readyState!==y.OPEN||o.send(sKe({id:n,type:aKe.Complete},m)),S--,r=!0,s()},void(await l.finally(c))}catch(o){if(!A(o))return}})().then(()=>{i||t.complete()}).catch(e=>{t.error(e)}),()=>{r||a()}}return r||(async()=>{for(S++;;)try{const[,,e]=await z();await e}catch(e){try{if(!A(e))return}catch(t){return i?.(t)}}})(),{on:x.on,subscribe:T,iterate(e){const t=[],n={done:!1,error:null,resolve:()=>{}},r=T(e,{next(e){t.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=async function*(){for(;;){for(t.length||await new Promise(e=>n.resolve=e);t.length;)yield t.shift();if(n.error)throw n.error;if(n.done)return}}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(r(),{done:!0,value:void 0}),i},async dispose(){if(N=!0,O){const[e]=await O;e.close(1e3,"Normal Closure")}},terminate(){O&&x.emit("closed",new lKe)}}}({url:e.subscriptionServer,shouldRetry:()=>!0,retryAttempts:1/0,connectionParams:{authToken:t,instanceId:r,userToken:o},onNonLazyError:e=>{if(e instanceof Error){const{message:t}=e;"Space Not Allowed"!==t&&"Invalid Token"!==t&&"Missing auth token"!==t&&"Missing instanceId"!==t&&"Access Not Authorized"!==t&&"Token Invalid"!==t||c.dispose()}}}),d=new OGe(c),u=OT.split(({query:e})=>{const t=pN(e);return"OperationDefinition"===t.kind&&t.operation===Lx.SUBSCRIPTION},OT.from([vD(),d]),l),h=new tI({link:u,cache:i});return h.subscriptionClient=c,h},[o]),w=k(()=>x(m,i,a,d),[x,m,i,a,d]),O=k(()=>{const e={};return t?(n.forEach(t,t=>{if(!h(t))return;const{renderType:n,component:r,settings:i,definition:a,...o}=t.props;if(!n||!r)return;const s=r;s.type=n,s.pluginSettings=i,s.extraProps=o,a&&(s.content=a),e[n]=s}),e):e},[t]);y(()=>{if(w)return()=>{const e=w.subscriptionClient;e&&e.dispose()}},[w]);const S=k(()=>w&&/* @__PURE__ */T(CGe,{client:w,children:/* @__PURE__ */T(CTe,{localCustomComponents:O,localComponents:L,children:/* @__PURE__ */T(cUe,{children:/* @__PURE__ */T(wlt,{...Xi(e,["children","server"]),debugMode:f,server:m,instanceId:d,webId:c})})})}),[w,f,d,O,e,m,c]),C=k(()=>({styleSelector:"base",collaboration:{collaborators:[]},render:{..._,previewMode:!1}}),[]);/* @__PURE__ */
4115
4120
  return T(On,{value:C,middlewares:[ze(Ty("builder")),f0(c),...f?[t1(),Ce({shouldRecord:e=>!e?.startsWith("runtime.elements")&&!e?.startsWith("collaboration")&&!e?.startsWith("theme")})]:[]],children:/* @__PURE__ */T(BK,{defaultTheme:"dark",cookieName:"builder-theme",children:/* @__PURE__ */T(QGe,{components:Clt,children:/* @__PURE__ */P(zPe,{className:ca("plitzi-builder flex items-stretch",s),children:[!b&&/* @__PURE__ */T(eXe,{basename:m.basePath??"",children:S}),b&&S]})})})})};function Nlt(e,t={},n={},r=!1){const i=()=>(r||gD(),/* @__PURE__ */T(Elt,{...t,debugMode:r,children:Object.keys(n).map(e=>/* @__PURE__ */T(xGe.Plugin,{renderType:e,settings:n[e].pluginSettings,definition:n[e].content,component:n[e]},e))}));"undefined"!=typeof document&&z.createRoot(document.getElementById(e)).render(/* @__PURE__ */T(i,{}))}N1(),Jp(),dx(),ax(),cx(),xD(),ix(),mi();var zlt=e=>{const{debugMode:t=!1,children:n}=e;return y(()=>{t||gD()},[t]),/* @__PURE__ */T(Elt,{...e,children:n})};zlt.Plugin=xGe.Plugin;var{version:Alt}=Slt;export{By as ComponentContext,CTe as ComponentProvider,P1 as JsxManager,Ry as PlitziServiceProvider,B1 as PluginManager,Fy as PluginRemote,jne as ReplicaProvider,Dy as RootElement,zlt as default,Nlt as render,Yn as useBuilderStore,Jh as useElement,Iy as usePlitziServiceContext,T1 as useRscData,Alt as version,n1 as withElement};