@theclearsky/react-blender-nodes 0.0.3 → 0.0.4

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.
@@ -1,4 +1,4 @@
1
- (function(ee,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],k):(ee=typeof globalThis<"u"?globalThis:ee||self,k(ee["react-blender-nodes"]={},ee.React))})(this,function(ee,k){"use strict";function Dl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const pe=Dl(k);function zl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var on={exports:{}},St={};/**
1
+ (function(Q,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],T):(Q=typeof globalThis<"u"?globalThis:Q||self,T(Q["react-blender-nodes"]={},Q.React))})(this,function(Q,T){"use strict";function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const pe=Fl(T);function Wl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cn={exports:{}},Ct={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var kr;function $l(){if(kr)return St;kr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,s){var i=null;if(s!==void 0&&(i=""+s),r.key!==void 0&&(i=""+r.key),"key"in r){s={};for(var a in r)a!=="key"&&(s[a]=r[a])}else s=r;return r=s.ref,{$$typeof:e,type:o,key:i,ref:r!==void 0?r:null,props:s}}return St.Fragment=t,St.jsx=n,St.jsxs=n,St}var Et={};/**
9
+ */var Dr;function Yl(){if(Dr)return Ct;Dr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var a in r)a!=="key"&&(i[a]=r[a])}else i=r;return r=i.ref,{$$typeof:e,type:o,key:s,ref:r!==void 0?r:null,props:i}}return Ct.Fragment=t,Ct.jsx=n,Ct.jsxs=n,Ct}var kt={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,12 +14,12 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Mr;function Ll(){return Mr||(Mr=1,process.env.NODE_ENV!=="production"&&function(){function e(S){if(S==null)return null;if(typeof S=="function")return S.$$typeof===R?null:S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case m:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case N:return"Suspense";case _:return"SuspenseList";case D:return"Activity"}if(typeof S=="object")switch(typeof S.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),S.$$typeof){case p:return"Portal";case g:return(S.displayName||"Context")+".Provider";case C:return(S._context.displayName||"Context")+".Consumer";case y:var T=S.render;return S=S.displayName,S||(S=T.displayName||T.name||"",S=S!==""?"ForwardRef("+S+")":"ForwardRef"),S;case I:return T=S.displayName||null,T!==null?T:e(S.type)||"Memo";case E:T=S._payload,S=S._init;try{return e(S(T))}catch{}}return null}function t(S){return""+S}function n(S){try{t(S);var T=!1}catch{T=!0}if(T){T=console;var j=T.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&S[Symbol.toStringTag]||S.constructor.name||"Object";return j.call(T,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),t(S)}}function o(S){if(S===m)return"<>";if(typeof S=="object"&&S!==null&&S.$$typeof===E)return"<...>";try{var T=e(S);return T?"<"+T+">":"<...>"}catch{return"<...>"}}function r(){var S=L.A;return S===null?null:S.getOwner()}function s(){return Error("react-stack-top-frame")}function i(S){if(z.call(S,"key")){var T=Object.getOwnPropertyDescriptor(S,"key").get;if(T&&T.isReactWarning)return!1}return S.key!==void 0}function a(S,T){function j(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",T))}j.isReactWarning=!0,Object.defineProperty(S,"key",{get:j,configurable:!0})}function l(){var S=e(this.type);return M[S]||(M[S]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),S=this.props.ref,S!==void 0?S:null}function c(S,T,j,B,F,Z,K,W){return j=Z.ref,S={$$typeof:f,type:S,key:T,props:Z,_owner:F},(j!==void 0?j:null)!==null?Object.defineProperty(S,"ref",{enumerable:!1,get:l}):Object.defineProperty(S,"ref",{enumerable:!1,value:null}),S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(S,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(S,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(S,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S}function d(S,T,j,B,F,Z,K,W){var V=T.children;if(V!==void 0)if(B)if(H(V)){for(B=0;B<V.length;B++)h(V[B]);Object.freeze&&Object.freeze(V)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(V);if(z.call(T,"key")){V=e(S);var Y=Object.keys(T).filter(function(re){return re!=="key"});B=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",$[V+B]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var zr;function Xl(){return zr||(zr=1,process.env.NODE_ENV!=="production"&&function(){function e(S){if(S==null)return null;if(typeof S=="function")return S.$$typeof===V?null:S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case g:return"Fragment";case w:return"Profiler";case y:return"StrictMode";case C:return"Suspense";case E:return"SuspenseList";case z:return"Activity"}if(typeof S=="object")switch(typeof S.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),S.$$typeof){case p:return"Portal";case m:return(S.displayName||"Context")+".Provider";case _:return(S._context.displayName||"Context")+".Consumer";case x:var O=S.render;return S=S.displayName,S||(S=O.displayName||O.name||"",S=S!==""?"ForwardRef("+S+")":"ForwardRef"),S;case M:return O=S.displayName||null,O!==null?O:e(S.type)||"Memo";case N:O=S._payload,S=S._init;try{return e(S(O))}catch{}}return null}function t(S){return""+S}function n(S){try{t(S);var O=!1}catch{O=!0}if(O){O=console;var H=O.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&S[Symbol.toStringTag]||S.constructor.name||"Object";return H.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),t(S)}}function o(S){if(S===g)return"<>";if(typeof S=="object"&&S!==null&&S.$$typeof===N)return"<...>";try{var O=e(S);return O?"<"+O+">":"<...>"}catch{return"<...>"}}function r(){var S=j.A;return S===null?null:S.getOwner()}function i(){return Error("react-stack-top-frame")}function s(S){if(D.call(S,"key")){var O=Object.getOwnPropertyDescriptor(S,"key").get;if(O&&O.isReactWarning)return!1}return S.key!==void 0}function a(S,O){function H(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",O))}H.isReactWarning=!0,Object.defineProperty(S,"key",{get:H,configurable:!0})}function l(){var S=e(this.type);return k[S]||(k[S]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),S=this.props.ref,S!==void 0?S:null}function c(S,O,H,B,F,U,K,W){return H=U.ref,S={$$typeof:h,type:S,key:O,props:U,_owner:F},(H!==void 0?H:null)!==null?Object.defineProperty(S,"ref",{enumerable:!1,get:l}):Object.defineProperty(S,"ref",{enumerable:!1,value:null}),S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(S,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(S,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(S,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S}function d(S,O,H,B,F,U,K,W){var R=O.children;if(R!==void 0)if(B)if(L(R)){for(B=0;B<R.length;B++)f(R[B]);Object.freeze&&Object.freeze(R)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(R);if(D.call(O,"key")){R=e(S);var Y=Object.keys(O).filter(function(re){return re!=="key"});B=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",$[R+B]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,B,V,Y,V),$[V+B]=!0)}if(V=null,j!==void 0&&(n(j),V=""+j),i(T)&&(n(T.key),V=""+T.key),"key"in T){j={};for(var J in T)J!=="key"&&(j[J]=T[J])}else j=T;return V&&a(j,typeof S=="function"?S.displayName||S.name||"Unknown":S),c(S,V,Z,F,r(),j,K,W)}function h(S){typeof S=="object"&&S!==null&&S.$$typeof===f&&S._store&&(S._store.validated=1)}var u=k,f=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),g=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),R=Symbol.for("react.client.reference"),L=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,H=Array.isArray,b=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(S){return S()}};var P,M={},A=u.react_stack_bottom_frame.bind(u,s)(),O=b(o(s)),$={};Et.Fragment=m,Et.jsx=function(S,T,j,B,F){var Z=1e4>L.recentlyCreatedOwnerStacks++;return d(S,T,j,!1,B,F,Z?Error("react-stack-top-frame"):A,Z?b(o(S)):O)},Et.jsxs=function(S,T,j,B,F){var Z=1e4>L.recentlyCreatedOwnerStacks++;return d(S,T,j,!0,B,F,Z?Error("react-stack-top-frame"):A,Z?b(o(S)):O)}}()),Et}var Ar;function jl(){return Ar||(Ar=1,process.env.NODE_ENV==="production"?on.exports=$l():on.exports=Ll()),on.exports}var v=jl();function Pr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Hl(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pr(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Pr(e[r],null)}}}}function Rl(e){const t=Bl(e),n=pe.forwardRef((o,r)=>{const{children:s,...i}=o,a=pe.Children.toArray(s),l=a.find(Wl);if(l){const c=l.props.children,d=a.map(h=>h===l?pe.Children.count(c)>1?pe.Children.only(null):pe.isValidElement(c)?c.props.children:null:h);return v.jsx(t,{...i,ref:r,children:pe.isValidElement(c)?pe.cloneElement(c,void 0,d):null})}return v.jsx(t,{...i,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Vl=Rl("Slot");function Bl(e){const t=pe.forwardRef((n,o)=>{const{children:r,...s}=n;if(pe.isValidElement(r)){const i=Gl(r),a=Yl(s,r.props);return r.type!==pe.Fragment&&(a.ref=o?Hl(o,i):i),pe.cloneElement(r,a)}return pe.Children.count(r)>1?pe.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Fl=Symbol("radix.slottable");function Wl(e){return pe.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Fl}function Yl(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...a)=>{const l=s(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Gl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ir(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Ir(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Or(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ir(e))&&(o&&(o+=" "),o+=t);return o}const Tr=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Dr=Or,Xl=(e,t)=>n=>{var o;if(t?.variants==null)return Dr(e,n?.class,n?.className);const{variants:r,defaultVariants:s}=t,i=Object.keys(r).map(c=>{const d=n?.[c],h=s?.[c];if(d===null)return null;const u=Tr(d)||Tr(h);return r[c][u]}),a=n&&Object.entries(n).reduce((c,d)=>{let[h,u]=d;return u===void 0||(c[h]=u),c},{}),l=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((c,d)=>{let{class:h,className:u,...f}=d;return Object.entries(f).every(p=>{let[m,x]=p;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...c,h,u]:c},[]);return Dr(e,i,l,n?.class,n?.className)},co="-",Zl=e=>{const t=ql(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{const a=i.split(co);return a[0]===""&&a.length!==1&&a.shift(),zr(a,t)||Ul(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&o[i]?[...l,...o[i]]:l}}},zr=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),r=o?zr(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;const s=e.join(co);return t.validators.find(({validator:i})=>i(s))?.classGroupId},$r=/^\[(.+)\]$/,Ul=e=>{if($r.test(e)){const t=$r.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},ql=e=>{const{theme:t,classGroups:n}=e,o={nextPart:new Map,validators:[]};for(const r in n)uo(n[r],o,r,t);return o},uo=(e,t,n,o)=>{e.forEach(r=>{if(typeof r=="string"){const s=r===""?t:Lr(t,r);s.classGroupId=n;return}if(typeof r=="function"){if(Kl(r)){uo(r(o),t,n,o);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,i])=>{uo(i,Lr(t,s),n,o)})})},Lr=(e,t)=>{let n=e;return t.split(co).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},Kl=e=>e.isThemeGetter,Ql=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const r=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,o=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=o.get(s))!==void 0)return r(s,i),i},set(s,i){n.has(s)?n.set(s,i):r(s,i)}}},fo="!",ho=":",Jl=ho.length,ec=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let i=0,a=0,l=0,c;for(let p=0;p<r.length;p++){let m=r[p];if(i===0&&a===0){if(m===ho){s.push(r.slice(l,p)),l=p+Jl;continue}if(m==="/"){c=p;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const d=s.length===0?r:r.substring(l),h=tc(d),u=h!==d,f=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:f}};if(t){const r=t+ho,s=o;o=i=>i.startsWith(r)?s(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},tc=e=>e.endsWith(fo)?e.substring(0,e.length-1):e.startsWith(fo)?e.substring(1):e,nc=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const r=[];let s=[];return o.forEach(i=>{i[0]==="["||t[i]?(r.push(...s.sort(),i),s=[]):s.push(i)}),r.push(...s.sort()),r}},oc=e=>({cache:Ql(e.cacheSize),parseClassName:ec(e),sortModifiers:nc(e),...Zl(e)}),rc=/\s+/,sc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s}=t,i=[],a=e.trim().split(rc);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:h,modifiers:u,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(d);if(h){l=d+(l.length>0?" "+l:l);continue}let x=!!m,w=o(x?p.substring(0,m):p);if(!w){if(!x){l=d+(l.length>0?" "+l:l);continue}if(w=o(p),!w){l=d+(l.length>0?" "+l:l);continue}x=!1}const C=s(u).join(":"),g=f?C+fo:C,y=g+w;if(i.includes(y))continue;i.push(y);const N=r(w,x);for(let _=0;_<N.length;++_){const I=N[_];i.push(g+I)}l=d+(l.length>0?" "+l:l)}return l};function ic(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=jr(t))&&(o&&(o+=" "),o+=n);return o}const jr=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=jr(e[o]))&&(n&&(n+=" "),n+=t);return n};function ac(e,...t){let n,o,r,s=i;function i(l){const c=t.reduce((d,h)=>h(d),e());return n=oc(c),o=n.cache.get,r=n.cache.set,s=a,a(l)}function a(l){const c=o(l);if(c)return c;const d=sc(l,n);return r(l,d),d}return function(){return s(ic.apply(null,arguments))}}const de=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Hr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lc=/^\d+\/\d+$/,cc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tt=e=>lc.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),po=e=>e.endsWith("%")&&te(e.slice(0,-1)),Oe=e=>cc.test(e),pc=()=>!0,gc=e=>uc.test(e)&&!dc.test(e),Vr=()=>!1,mc=e=>fc.test(e),yc=e=>hc.test(e),xc=e=>!G(e)&&!X(e),wc=e=>nt(e,Gr,Vr),G=e=>Hr.test(e),Fe=e=>nt(e,Xr,gc),go=e=>nt(e,Ec,te),Br=e=>nt(e,Wr,Vr),bc=e=>nt(e,Yr,yc),rn=e=>nt(e,Zr,mc),X=e=>Rr.test(e),Ct=e=>ot(e,Xr),vc=e=>ot(e,Cc),Fr=e=>ot(e,Wr),_c=e=>ot(e,Gr),Sc=e=>ot(e,Yr),sn=e=>ot(e,Zr,!0),nt=(e,t,n)=>{const o=Hr.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},ot=(e,t,n=!1)=>{const o=Rr.exec(e);return o?o[1]?t(o[1]):n:!1},Wr=e=>e==="position"||e==="percentage",Yr=e=>e==="image"||e==="url",Gr=e=>e==="length"||e==="size"||e==="bg-size",Xr=e=>e==="length",Ec=e=>e==="number",Cc=e=>e==="family-name",Zr=e=>e==="shadow",Nc=ac(()=>{const e=de("color"),t=de("font"),n=de("text"),o=de("font-weight"),r=de("tracking"),s=de("leading"),i=de("breakpoint"),a=de("container"),l=de("spacing"),c=de("radius"),d=de("shadow"),h=de("inset-shadow"),u=de("text-shadow"),f=de("drop-shadow"),p=de("blur"),m=de("perspective"),x=de("aspect"),w=de("ease"),C=de("animate"),g=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...y(),X,G],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],E=()=>[X,G,l],D=()=>[tt,"full","auto",...E()],R=()=>[Le,"none","subgrid",X,G],L=()=>["auto",{span:["full",Le,X,G]},Le,X,G],z=()=>[Le,"auto",X,G],H=()=>["auto","min","max","fr",X,G],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...E()],A=()=>[tt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],O=()=>[e,X,G],$=()=>[...y(),Fr,Br,{position:[X,G]}],S=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",_c,wc,{size:[X,G]}],j=()=>[po,Ct,Fe],B=()=>["","none","full",c,X,G],F=()=>["",te,Ct,Fe],Z=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[te,po,Fr,Br],V=()=>["","none",p,X,G],Y=()=>["none",te,X,G],J=()=>["none",te,X,G],re=()=>[te,X,G],q=()=>[tt,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Oe],breakpoint:[Oe],color:[pc],container:[Oe],"drop-shadow":[Oe],ease:["in","out","in-out"],font:[xc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Oe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Oe],shadow:[Oe],spacing:["px",te],text:[Oe],"text-shadow":[Oe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tt,G,X,x]}],container:["container"],columns:[{columns:[te,G,X,a]}],"break-after":[{"break-after":g()}],"break-before":[{"break-before":g()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Le,"auto",X,G]}],basis:[{basis:[tt,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,tt,"auto","initial","none",G]}],grow:[{grow:["",te,X,G]}],shrink:[{shrink:["",te,X,G]}],order:[{order:[Le,"first","last","none",X,G]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...b(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[a,"screen",...A()]}],"min-w":[{"min-w":[a,"screen","none",...A()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,Ct,Fe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,X,go]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",po,G]}],"font-family":[{font:[vc,G,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,X,G]}],"line-clamp":[{"line-clamp":[te,"none",X,go]}],leading:[{leading:[s,...E()]}],"list-image":[{"list-image":["none",X,G]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",X,G]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",X,Fe]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[te,"auto",X,G]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",X,G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X,G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:S()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Le,X,G],radial:["",X,G],conic:[Le,X,G]},Sc,bc]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[te,X,G]}],"outline-w":[{outline:["",te,Ct,Fe]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",d,sn,rn]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",h,sn,rn]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[te,Fe]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",u,sn,rn]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[te,X,G]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[te]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[X,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[te]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:S()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",X,G]}],filter:[{filter:["","none",X,G]}],blur:[{blur:V()}],brightness:[{brightness:[te,X,G]}],contrast:[{contrast:[te,X,G]}],"drop-shadow":[{"drop-shadow":["","none",f,sn,rn]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",te,X,G]}],"hue-rotate":[{"hue-rotate":[te,X,G]}],invert:[{invert:["",te,X,G]}],saturate:[{saturate:[te,X,G]}],sepia:[{sepia:["",te,X,G]}],"backdrop-filter":[{"backdrop-filter":["","none",X,G]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[te,X,G]}],"backdrop-contrast":[{"backdrop-contrast":[te,X,G]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,X,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,X,G]}],"backdrop-invert":[{"backdrop-invert":["",te,X,G]}],"backdrop-opacity":[{"backdrop-opacity":[te,X,G]}],"backdrop-saturate":[{"backdrop-saturate":[te,X,G]}],"backdrop-sepia":[{"backdrop-sepia":["",te,X,G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",X,G]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",X,G]}],ease:[{ease:["linear","initial",w,X,G]}],delay:[{delay:[te,X,G]}],animate:[{animate:["none",C,X,G]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,X,G]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[X,G,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:q()}],"translate-x":[{"translate-x":q()}],"translate-y":[{"translate-y":q()}],"translate-z":[{"translate-z":q()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",X,G]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",X,G]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[te,Ct,Fe,go]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function se(...e){return Nc(Or(e))}const kc=Xl("inline-flex items-center justify-center gap-2 py-2 px-4 rounded-md transition-all text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white disabled:cursor-not-allowed outline-none focus-visible:outline-none border",{variants:{color:{dark:"bg-secondary-black border-secondary-dark-gray",lightNonPriority:"bg-primary-gray border-transparent",lightPriority:"bg-primary-gray border-transparent",lightParentGroupBasedHover:"bg-primary-gray border-transparent"},applyHoverStyles:{true:"",false:""}},defaultVariants:{color:"dark",applyHoverStyles:!0},compoundVariants:[{color:"dark",applyHoverStyles:!0,className:"hover:bg-primary-dark-gray"},{color:"lightNonPriority",applyHoverStyles:!0,className:"hover:bg-secondary-light-gray-as-transparent-overlay-over-primary-gray"},{color:"lightPriority",applyHoverStyles:!0,className:"hover:bg-primary-light-gray-as-transparent-overlay-over-primary-gray"},{color:"lightParentGroupBasedHover",applyHoverStyles:!0,className:"hover:bg-primary-light-gray-as-transparent-overlay-over-primary-gray group-hover/lightParentGroupBasedHover:bg-secondary-light-gray-as-transparent-overlay-over-primary-gray"}]}),rt=k.forwardRef(({className:e,color:t,asChild:n=!1,applyHoverStyles:o,...r},s)=>{const i=n?Vl:"button";return v.jsx(i,{ref:s,"data-slot":"button",className:se(kc({color:t,className:e,applyHoverStyles:o})),...r})});rt.displayName="Button";function mo(e,t){const n=t?.inputs instanceof Array?t?.inputs:[],o=t?.outputs instanceof Array?t?.outputs:[];return n.flatMap(i=>"inputs"in i?i.inputs:[i]).concat(o).find(i=>i?.id===e)}function Mc(e,t,n){return t.map(o=>o.id===e?{...o,value:n}:o)}function Ac(e,t,n){return"inputs"in t?{...t,inputs:Mc(e,t.inputs,n)}:t.id===e?{...t,value:n}:t}function Ur(e,t,n){return{...t,inputs:(t.inputs||[]).map(r=>Ac(e,r,n))}}function yo(e,t,n,o=!1,r=!1){if(t>n){const s=t;t=n,n=s}return(o?e>=t:e>t)&&(r?e<=n:e<n)}function an(e,t,n=!1,o=!1){return yo(e.x,t.left,t.right,n)&&yo(e.y,t.top,t.bottom,o)}function qr(e){const t=e.startsWith("-"),n=e.replaceAll(/[^0-9\.]/g,""),o=n.indexOf(".");let r=0;if(o===-1)r=Number(n);else{const s=n.substring(0,o).replaceAll(/[^0-9]/g,""),i=n.substring(o+1).replaceAll(/[^0-9]/g,"");r=+(s+"."+i)}return t&&(r=-r),r}function xo(e,t){return e.toFixed(t).replace(/[0]+$/,"")}const Ne=["string","number","complex","noEquivalent","inferFromConnection"],Kr={[Ne[0]]:Ne[0],[Ne[1]]:Ne[1],[Ne[2]]:Ne[2],[Ne[3]]:Ne[3],[Ne[4]]:Ne[4]};function Pc(e){return!!Kr[e]}function Ic(e){return e}function Oc(e){return e}function Tc(e){return e}function Dc(e){return e}var Qr=Symbol.for("immer-nothing"),Jr=Symbol.for("immer-draftable"),xe=Symbol.for("immer-state"),zc=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function ge(e,...t){if(process.env.NODE_ENV!=="production"){const n=zc[e],o=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var st=Object.getPrototypeOf;function it(e){return!!e&&!!e[xe]}function We(e){return e?es(e)||Array.isArray(e)||!!e[Jr]||!!e.constructor?.[Jr]||Nt(e)||un(e):!1}var $c=Object.prototype.constructor.toString();function es(e){if(!e||typeof e!="object")return!1;const t=st(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===$c}function ln(e,t){cn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function cn(e){const t=e[xe];return t?t.type_:Array.isArray(e)?1:Nt(e)?2:un(e)?3:0}function wo(e,t){return cn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ts(e,t,n){const o=cn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Lc(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Nt(e){return e instanceof Map}function un(e){return e instanceof Set}function Ye(e){return e.copy_||e.base_}function bo(e,t){if(Nt(e))return new Map(e);if(un(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=es(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[xe];let r=Reflect.ownKeys(o);for(let s=0;s<r.length;s++){const i=r[s],a=o[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(o[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(st(e),o)}else{const o=st(e);if(o!==null&&n)return{...e};const r=Object.create(o);return Object.assign(r,e)}}function vo(e,t=!1){return fn(e)||it(e)||!We(e)||(cn(e)>1&&Object.defineProperties(e,{set:{value:dn},add:{value:dn},clear:{value:dn},delete:{value:dn}}),Object.freeze(e),t&&Object.values(e).forEach(n=>vo(n,!0))),e}function dn(){ge(2)}function fn(e){return Object.isFrozen(e)}var jc={};function Ge(e){const t=jc[e];return t||ge(0,e),t}var kt;function ns(){return kt}function Hc(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function os(e,t){t&&(Ge("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _o(e){So(e),e.drafts_.forEach(Rc),e.drafts_=null}function So(e){e===kt&&(kt=e.parent_)}function rs(e){return kt=Hc(kt,e)}function Rc(e){const t=e[xe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ss(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xe].modified_&&(_o(t),ge(4)),We(e)&&(e=hn(t,e),t.parent_||pn(t,e)),t.patches_&&Ge("Patches").generateReplacementPatches_(n[xe].base_,e,t.patches_,t.inversePatches_)):e=hn(t,n,[]),_o(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Qr?e:void 0}function hn(e,t,n){if(fn(t))return t;const o=t[xe];if(!o)return ln(t,(r,s)=>is(e,o,t,r,s,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return pn(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const r=o.copy_;let s=r,i=!1;o.type_===3&&(s=new Set(r),r.clear(),i=!0),ln(s,(a,l)=>is(e,o,r,a,l,n,i)),pn(e,r,!1),n&&e.patches_&&Ge("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function is(e,t,n,o,r,s,i){if(process.env.NODE_ENV!=="production"&&r===n&&ge(5),it(r)){const a=s&&t&&t.type_!==3&&!wo(t.assigned_,o)?s.concat(o):void 0,l=hn(e,r,a);if(ts(n,o,l),it(l))e.canAutoFreeze_=!1;else return}else i&&n.add(r);if(We(r)&&!fn(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;hn(e,r),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(Nt(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&pn(e,r)}}function pn(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vo(t,n)}function Vc(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:ns(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,s=Eo;n&&(r=[o],s=Mt);const{revoke:i,proxy:a}=Proxy.revocable(r,s);return o.draft_=a,o.revoke_=i,a}var Eo={get(e,t){if(t===xe)return e;const n=Ye(e);if(!wo(n,t))return Bc(e,n,t);const o=n[t];return e.finalized_||!We(o)?o:o===Co(e.base_,t)?(ko(e),e.copy_[t]=Mo(o,e)):o},has(e,t){return t in Ye(e)},ownKeys(e){return Reflect.ownKeys(Ye(e))},set(e,t,n){const o=as(Ye(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const r=Co(Ye(e),t),s=r?.[xe];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Lc(n,r)&&(n!==void 0||wo(e.base_,t)))return!0;ko(e),No(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Co(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ko(e),No(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Ye(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){ge(11)},getPrototypeOf(e){return st(e.base_)},setPrototypeOf(){ge(12)}},Mt={};ln(Eo,(e,t)=>{Mt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Mt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ge(13),Mt.set.call(this,e,t,void 0)},Mt.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ge(14),Eo.set.call(this,e[0],t,n,e[0])};function Co(e,t){const n=e[xe];return(n?Ye(n):e)[t]}function Bc(e,t,n){const o=as(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}function as(e,t){if(!(t in e))return;let n=st(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=st(n)}}function No(e){e.modified_||(e.modified_=!0,e.parent_&&No(e.parent_))}function ko(e){e.copy_||(e.copy_=bo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Fc=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const i=this;return function(l=s,...c){return i.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&ge(6),o!==void 0&&typeof o!="function"&&ge(7);let r;if(We(t)){const s=rs(this),i=Mo(t,void 0);let a=!0;try{r=n(i),a=!1}finally{a?_o(s):So(s)}return os(s,o),ss(r,s)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===Qr&&(r=void 0),this.autoFreeze_&&vo(r,!0),o){const s=[],i=[];Ge("Patches").generateReplacementPatches_(t,r,s,i),o(s,i)}return r}else ge(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...a)=>this.produceWithPatches(i,l=>t(l,...a));let o,r;return[this.produce(t,n,(i,a)=>{o=i,r=a}),o,r]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){We(e)||ge(8),it(e)&&(e=Wc(e));const t=rs(this),n=Mo(e,void 0);return n[xe].isManual_=!0,So(t),n}finishDraft(e,t){const n=e&&e[xe];(!n||!n.isManual_)&&ge(9);const{scope_:o}=n;return os(o,t),ss(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}n>-1&&(t=t.slice(n+1));const o=Ge("Patches").applyPatches_;return it(e)?o(e,t):this.produce(e,r=>o(r,t))}};function Mo(e,t){const n=Nt(e)?Ge("MapSet").proxyMap_(e,t):un(e)?Ge("MapSet").proxySet_(e,t):Vc(e,t);return(t?t.scope_:ns()).drafts_.push(n),n}function Wc(e){return it(e)||ge(10,e),ls(e)}function ls(e){if(!We(e)||fn(e))return e;const t=e[xe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=bo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=bo(e,!0);return ln(n,(o,r)=>{ts(n,o,ls(r))}),t&&(t.finalized_=!1),n}var Yc=new Fc,Gc=Yc.produce;function At(e){const t=[];for(let o=0;o<Math.floor(e/8);o++)t.push(Math.random().toString(36).substring(2,10));return t.push(Math.random().toString(36).substring(2,e%8+2)),t.join("")}function ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ue(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Xc={value:()=>{}};function gn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new mn(n)}function mn(e){this._=e}function Zc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}mn.prototype=gn.prototype={constructor:mn,on:function(e,t){var n=this._,o=Zc(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=Uc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=cs(n[r],e.name,t);else if(t==null)for(r in n)n[r]=cs(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new mn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function Uc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function cs(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Xc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ao="http://www.w3.org/1999/xhtml";const us={svg:"http://www.w3.org/2000/svg",xhtml:Ao,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),us.hasOwnProperty(t)?{space:us[t],local:e}:e}function qc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ao&&t.documentElement.namespaceURI===Ao?t.createElement(e):t.createElementNS(n,e)}}function Kc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ds(e){var t=yn(e);return(t.local?Kc:qc)(t)}function Qc(){}function Po(e){return e==null?Qc:function(){return this.querySelector(e)}}function Jc(e){typeof e!="function"&&(e=Po(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,d=0;d<i;++d)(l=s[d])&&(c=e.call(l,l.__data__,d,s))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new we(o,this._parents)}function eu(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function tu(){return[]}function fs(e){return e==null?tu:function(){return this.querySelectorAll(e)}}function nu(e){return function(){return eu(e.apply(this,arguments))}}function ou(e){typeof e=="function"?e=nu(e):e=fs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new we(o,r)}function hs(e){return function(){return this.matches(e)}}function ps(e){return function(t){return t.matches(e)}}var ru=Array.prototype.find;function su(e){return function(){return ru.call(this.children,e)}}function iu(){return this.firstElementChild}function au(e){return this.select(e==null?iu:su(typeof e=="function"?e:ps(e)))}var lu=Array.prototype.filter;function cu(){return Array.from(this.children)}function uu(e){return function(){return lu.call(this.children,e)}}function du(e){return this.selectAll(e==null?cu:uu(typeof e=="function"?e:ps(e)))}function fu(e){typeof e!="function"&&(e=hs(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new we(o,this._parents)}function gs(e){return new Array(e.length)}function hu(){return new we(this._enter||this._groups.map(gs),this._parents)}function xn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xn.prototype={constructor:xn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function pu(e){return function(){return e}}function gu(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new xn(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function mu(e,t,n,o,r,s,i){var a,l,c=new Map,d=t.length,h=s.length,u=new Array(d),f;for(a=0;a<d;++a)(l=t[a])&&(u[a]=f=i.call(l,l.__data__,a,t)+"",c.has(f)?r[a]=l:c.set(f,l));for(a=0;a<h;++a)f=i.call(e,s[a],a,s)+"",(l=c.get(f))?(o[a]=l,l.__data__=s[a],c.delete(f)):n[a]=new xn(e,s[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function yu(e){return e.__data__}function xu(e,t){if(!arguments.length)return Array.from(this,yu);var n=t?mu:gu,o=this._parents,r=this._groups;typeof e!="function"&&(e=pu(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var d=o[c],h=r[c],u=h.length,f=wu(e.call(d,d&&d.__data__,c,o)),p=f.length,m=a[c]=new Array(p),x=i[c]=new Array(p),w=l[c]=new Array(u);n(d,h,m,x,w,f,t);for(var C=0,g=0,y,N;C<p;++C)if(y=m[C]){for(C>=g&&(g=C+1);!(N=x[g])&&++g<p;);y._next=N||null}}return i=new we(i,o),i._enter=a,i._exit=l,i}function wu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bu(){return new we(this._exit||this._groups.map(gs),this._parents)}function vu(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function _u(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],d=o[l],h=c.length,u=a[l]=new Array(h),f,p=0;p<h;++p)(f=c[p]||d[p])&&(u[p]=f);for(;l<r;++l)a[l]=n[l];return new we(a,this._parents)}function Su(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Eu(e){e||(e=Cu);function t(h,u){return h&&u?e(h.__data__,u.__data__):!h-!u}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,d=0;d<a;++d)(c=i[d])&&(l[d]=c);l.sort(t)}return new we(r,this._parents).order()}function Cu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nu(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ku(){return Array.from(this)}function Mu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Au(){let e=0;for(const t of this)++e;return e}function Pu(){return!this.node()}function Iu(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ou(e){return function(){this.removeAttribute(e)}}function Tu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Du(e,t){return function(){this.setAttribute(e,t)}}function zu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $u(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Lu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ju(e,t){var n=yn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Tu:Ou:typeof t=="function"?n.local?Lu:$u:n.local?zu:Du)(n,t))}function ms(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Hu(e){return function(){this.style.removeProperty(e)}}function Ru(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Vu(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Bu(e,t,n){return arguments.length>1?this.each((t==null?Hu:typeof t=="function"?Vu:Ru)(e,t,n??"")):at(this.node(),e)}function at(e,t){return e.style.getPropertyValue(t)||ms(e).getComputedStyle(e,null).getPropertyValue(t)}function Fu(e){return function(){delete this[e]}}function Wu(e,t){return function(){this[e]=t}}function Yu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Gu(e,t){return arguments.length>1?this.each((t==null?Fu:typeof t=="function"?Yu:Wu)(e,t)):this.node()[e]}function ys(e){return e.trim().split(/^|\s+/)}function Io(e){return e.classList||new xs(e)}function xs(e){this._node=e,this._names=ys(e.getAttribute("class")||"")}xs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ws(e,t){for(var n=Io(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=Io(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Xu(e){return function(){ws(this,e)}}function Zu(e){return function(){bs(this,e)}}function Uu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function qu(e,t){var n=ys(e+"");if(arguments.length<2){for(var o=Io(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Uu:t?Xu:Zu)(n,t))}function Ku(){this.textContent=""}function Qu(e){return function(){this.textContent=e}}function Ju(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ed(e){return arguments.length?this.each(e==null?Ku:(typeof e=="function"?Ju:Qu)(e)):this.node().textContent}function td(){this.innerHTML=""}function nd(e){return function(){this.innerHTML=e}}function od(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function rd(e){return arguments.length?this.each(e==null?td:(typeof e=="function"?od:nd)(e)):this.node().innerHTML}function sd(){this.nextSibling&&this.parentNode.appendChild(this)}function id(){return this.each(sd)}function ad(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ld(){return this.each(ad)}function cd(e){var t=typeof e=="function"?e:ds(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ud(){return null}function dd(e,t){var n=typeof e=="function"?e:ds(e),o=t==null?ud:typeof t=="function"?t:Po(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function fd(){var e=this.parentNode;e&&e.removeChild(this)}function hd(){return this.each(fd)}function pd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function md(e){return this.select(e?gd:pd)}function yd(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xd(e){return function(t){e.call(this,t,this.__data__)}}function wd(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function bd(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function vd(e,t,n){return function(){var o=this.__on,r,s=xd(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function _d(e,t,n){var o=wd(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<s;++r)if((i=o[r]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?vd:bd,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function vs(e,t,n){var o=ms(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Sd(e,t){return function(){return vs(this,e,t)}}function Ed(e,t){return function(){return vs(this,e,t.apply(this,arguments))}}function Cd(e,t){return this.each((typeof t=="function"?Ed:Sd)(e,t))}function*Nd(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var _s=[null];function we(e,t){this._groups=e,this._parents=t}function Pt(){return new we([[document.documentElement]],_s)}function kd(){return this}we.prototype=Pt.prototype={constructor:we,select:Jc,selectAll:ou,selectChild:au,selectChildren:du,filter:fu,data:xu,enter:hu,exit:bu,join:vu,merge:_u,selection:kd,order:Su,sort:Eu,call:Nu,nodes:ku,node:Mu,size:Au,empty:Pu,each:Iu,attr:ju,style:Bu,property:Gu,classed:qu,text:ed,html:rd,raise:id,lower:ld,append:cd,insert:dd,remove:hd,clone:md,datum:yd,on:_d,dispatch:Cd,[Symbol.iterator]:Nd};function be(e){return typeof e=="string"?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],_s)}function Md(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ve(e,t){if(e=Md(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ad={passive:!1},It={capture:!0,passive:!1};function Oo(e){e.stopImmediatePropagation()}function lt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ss(e){var t=e.document.documentElement,n=be(e).on("dragstart.drag",lt,It);"onselectstart"in t?n.on("selectstart.drag",lt,It):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=be(e).on("dragstart.drag",null);t&&(o.on("click.drag",lt,It),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const wn=e=>()=>e;function To(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}To.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Pd(e){return!e.ctrlKey&&!e.button}function Id(){return this.parentNode}function Od(e,t){return t??{x:e.x,y:e.y}}function Td(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=Pd,t=Id,n=Od,o=Td,r={},s=gn("start","drag","end"),i=0,a,l,c,d,h=0;function u(y){y.on("mousedown.drag",f).filter(o).on("touchstart.drag",x).on("touchmove.drag",w,Ad).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(y,N){if(!(d||!e.call(this,y,N))){var _=g(this,t.call(this,y,N),y,N,"mouse");_&&(be(y.view).on("mousemove.drag",p,It).on("mouseup.drag",m,It),Ss(y.view),Oo(y),c=!1,a=y.clientX,l=y.clientY,_("start",y))}}function p(y){if(lt(y),!c){var N=y.clientX-a,_=y.clientY-l;c=N*N+_*_>h}r.mouse("drag",y)}function m(y){be(y.view).on("mousemove.drag mouseup.drag",null),Es(y.view,c),lt(y),r.mouse("end",y)}function x(y,N){if(e.call(this,y,N)){var _=y.changedTouches,I=t.call(this,y,N),E=_.length,D,R;for(D=0;D<E;++D)(R=g(this,I,y,N,_[D].identifier,_[D]))&&(Oo(y),R("start",y,_[D]))}}function w(y){var N=y.changedTouches,_=N.length,I,E;for(I=0;I<_;++I)(E=r[N[I].identifier])&&(lt(y),E("drag",y,N[I]))}function C(y){var N=y.changedTouches,_=N.length,I,E;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<_;++I)(E=r[N[I].identifier])&&(Oo(y),E("end",y,N[I]))}function g(y,N,_,I,E,D){var R=s.copy(),L=ve(D||_,N),z,H,b;if((b=n.call(y,new To("beforestart",{sourceEvent:_,target:u,identifier:E,active:i,x:L[0],y:L[1],dx:0,dy:0,dispatch:R}),I))!=null)return z=b.x-L[0]||0,H=b.y-L[1]||0,function P(M,A,O){var $=L,S;switch(M){case"start":r[E]=P,S=i++;break;case"end":delete r[E],--i;case"drag":L=ve(O||A,N),S=i;break}R.call(M,y,new To(M,{sourceEvent:A,subject:b,target:u,identifier:E,active:S,x:L[0]+z,y:L[1]+H,dx:L[0]-$[0],dy:L[1]-$[1],dispatch:R}),I)}}return u.filter=function(y){return arguments.length?(e=typeof y=="function"?y:wn(!!y),u):e},u.container=function(y){return arguments.length?(t=typeof y=="function"?y:wn(y),u):t},u.subject=function(y){return arguments.length?(n=typeof y=="function"?y:wn(y),u):n},u.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:wn(!!y),u):o},u.on=function(){var y=s.on.apply(s,arguments);return y===s?u:y},u.clickDistance=function(y){return arguments.length?(h=(y=+y)*y,u):Math.sqrt(h)},u}function Do(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ns(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ot(){}var Tt=.7,bn=1/Tt,ct="\\s*([+-]?\\d+)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ke="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dd=/^#([0-9a-f]{3,8})$/,zd=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),$d=new RegExp(`^rgb\\(${ke},${ke},${ke}\\)$`),Ld=new RegExp(`^rgba\\(${ct},${ct},${ct},${Dt}\\)$`),jd=new RegExp(`^rgba\\(${ke},${ke},${ke},${Dt}\\)$`),Hd=new RegExp(`^hsl\\(${Dt},${ke},${ke}\\)$`),Rd=new RegExp(`^hsla\\(${Dt},${ke},${ke},${Dt}\\)$`),ks={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};Do(Ot,Xe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ms,formatHex:Ms,formatHex8:Vd,formatHsl:Bd,formatRgb:As,toString:As});function Ms(){return this.rgb().formatHex()}function Vd(){return this.rgb().formatHex8()}function Bd(){return Ds(this).formatHsl()}function As(){return this.rgb().formatRgb()}function Xe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Dd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ps(t):n===3?new me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=zd.exec(e))?new me(t[1],t[2],t[3],1):(t=$d.exec(e))?new me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ld.exec(e))?vn(t[1],t[2],t[3],t[4]):(t=jd.exec(e))?vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hd.exec(e))?Ts(t[1],t[2]/100,t[3]/100,1):(t=Rd.exec(e))?Ts(t[1],t[2]/100,t[3]/100,t[4]):ks.hasOwnProperty(e)?Ps(ks[e]):e==="transparent"?new me(NaN,NaN,NaN,0):null}function Ps(e){return new me(e>>16&255,e>>8&255,e&255,1)}function vn(e,t,n,o){return o<=0&&(e=t=n=NaN),new me(e,t,n,o)}function Fd(e){return e instanceof Ot||(e=Xe(e)),e?(e=e.rgb(),new me(e.r,e.g,e.b,e.opacity)):new me}function zo(e,t,n,o){return arguments.length===1?Fd(e):new me(e,t,n,o??1)}function me(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Do(me,zo,Ns(Ot,{brighter(e){return e=e==null?bn:Math.pow(bn,e),new me(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tt:Math.pow(Tt,e),new me(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new me(Ze(this.r),Ze(this.g),Ze(this.b),_n(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:Is,formatHex:Is,formatHex8:Wd,formatRgb:Os,toString:Os}));function Is(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}`}function Wd(){return`#${Ue(this.r)}${Ue(this.g)}${Ue(this.b)}${Ue((isNaN(this.opacity)?1:this.opacity)*255)}`}function Os(){const e=_n(this.opacity);return`${e===1?"rgb(":"rgba("}${Ze(this.r)}, ${Ze(this.g)}, ${Ze(this.b)}${e===1?")":`, ${e})`}`}function _n(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ze(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ue(e){return e=Ze(e),(e<16?"0":"")+e.toString(16)}function Ts(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _e(e,t,n,o)}function Ds(e){if(e instanceof _e)return new _e(e.h,e.s,e.l,e.opacity);if(e instanceof Ot||(e=Xe(e)),!e)return new _e;if(e instanceof _e)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),s=Math.max(t,n,o),i=NaN,a=s-r,l=(s+r)/2;return a?(t===s?i=(n-o)/a+(n<o)*6:n===s?i=(o-t)/a+2:i=(t-n)/a+4,a/=l<.5?s+r:2-s-r,i*=60):a=l>0&&l<1?0:i,new _e(i,a,l,e.opacity)}function Yd(e,t,n,o){return arguments.length===1?Ds(e):new _e(e,t,n,o??1)}function _e(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Do(_e,Yd,Ns(Ot,{brighter(e){return e=e==null?bn:Math.pow(bn,e),new _e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tt:Math.pow(Tt,e),new _e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new me($o(e>=240?e-240:e+120,r,o),$o(e,r,o),$o(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new _e(zs(this.h),Sn(this.s),Sn(this.l),_n(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=_n(this.opacity);return`${e===1?"hsl(":"hsla("}${zs(this.h)}, ${Sn(this.s)*100}%, ${Sn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zs(e){return e=(e||0)%360,e<0?e+360:e}function Sn(e){return Math.max(0,Math.min(1,e||0))}function $o(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Lo=e=>()=>e;function Gd(e,t){return function(n){return e+n*t}}function Xd(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function Zd(e){return(e=+e)==1?$s:function(t,n){return n-t?Xd(t,n,e):Lo(isNaN(t)?n:t)}}function $s(e,t){var n=t-e;return n?Gd(e,n):Lo(isNaN(e)?t:e)}const En=function e(t){var n=Zd(t);function o(r,s){var i=n((r=zo(r)).r,(s=zo(s)).r),a=n(r.g,s.g),l=n(r.b,s.b),c=$s(r.opacity,s.opacity);return function(d){return r.r=i(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return o.gamma=e,o}(1);function Ud(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(s){for(r=0;r<n;++r)o[r]=e[r]*(1-s)+t[r]*s;return o}}function qd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Kd(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),s=new Array(n),i;for(i=0;i<o;++i)r[i]=zt(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(a){for(i=0;i<o;++i)s[i]=r[i](a);return s}}function Qd(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Me(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Jd(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=zt(e[r],t[r]):o[r]=t[r];return function(s){for(r in n)o[r]=n[r](s);return o}}var jo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ho=new RegExp(jo.source,"g");function ef(e){return function(){return e}}function tf(e){return function(t){return e(t)+""}}function Ls(e,t){var n=jo.lastIndex=Ho.lastIndex=0,o,r,s,i=-1,a=[],l=[];for(e=e+"",t=t+"";(o=jo.exec(e))&&(r=Ho.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),a[i]?a[i]+=s:a[++i]=s),(o=o[0])===(r=r[0])?a[i]?a[i]+=r:a[++i]=r:(a[++i]=null,l.push({i,x:Me(o,r)})),n=Ho.lastIndex;return n<t.length&&(s=t.slice(n),a[i]?a[i]+=s:a[++i]=s),a.length<2?l[0]?tf(l[0].x):ef(t):(t=l.length,function(c){for(var d=0,h;d<t;++d)a[(h=l[d]).i]=h.x(c);return a.join("")})}function zt(e,t){var n=typeof t,o;return t==null||n==="boolean"?Lo(t):(n==="number"?Me:n==="string"?(o=Xe(t))?(t=o,En):Ls:t instanceof Xe?En:t instanceof Date?Qd:qd(t)?Ud:Array.isArray(t)?Kd:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Jd:Me)(e,t)}var js=180/Math.PI,Ro={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hs(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*js,skewX:Math.atan(l)*js,scaleX:i,scaleY:a}}var Cn;function nf(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ro:Hs(t.a,t.b,t.c,t.d,t.e,t.f)}function of(e){return e==null||(Cn||(Cn=document.createElementNS("http://www.w3.org/2000/svg","g")),Cn.setAttribute("transform",e),!(e=Cn.transform.baseVal.consolidate()))?Ro:(e=e.matrix,Hs(e.a,e.b,e.c,e.d,e.e,e.f))}function Rs(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,d,h,u,f,p){if(c!==h||d!==u){var m=f.push("translate(",null,t,null,n);p.push({i:m-4,x:Me(c,h)},{i:m-2,x:Me(d,u)})}else(h||u)&&f.push("translate("+h+t+u+n)}function i(c,d,h,u){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),u.push({i:h.push(r(h)+"rotate(",null,o)-2,x:Me(c,d)})):d&&h.push(r(h)+"rotate("+d+o)}function a(c,d,h,u){c!==d?u.push({i:h.push(r(h)+"skewX(",null,o)-2,x:Me(c,d)}):d&&h.push(r(h)+"skewX("+d+o)}function l(c,d,h,u,f,p){if(c!==h||d!==u){var m=f.push(r(f)+"scale(",null,",",null,")");p.push({i:m-4,x:Me(c,h)},{i:m-2,x:Me(d,u)})}else(h!==1||u!==1)&&f.push(r(f)+"scale("+h+","+u+")")}return function(c,d){var h=[],u=[];return c=e(c),d=e(d),s(c.translateX,c.translateY,d.translateX,d.translateY,h,u),i(c.rotate,d.rotate,h,u),a(c.skewX,d.skewX,h,u),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,h,u),c=d=null,function(f){for(var p=-1,m=u.length,x;++p<m;)h[(x=u[p]).i]=x.x(f);return h.join("")}}}var rf=Rs(nf,"px, ","px)","deg)"),sf=Rs(of,", ",")",")"),af=1e-12;function Vs(e){return((e=Math.exp(e))+1/e)/2}function lf(e){return((e=Math.exp(e))-1/e)/2}function cf(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nn=function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],d=i[0],h=i[1],u=i[2],f=d-a,p=h-l,m=f*f+p*p,x,w;if(m<af)w=Math.log(u/c)/t,x=function(I){return[a+I*f,l+I*p,c*Math.exp(t*I*w)]};else{var C=Math.sqrt(m),g=(u*u-c*c+o*m)/(2*c*n*C),y=(u*u-c*c-o*m)/(2*u*n*C),N=Math.log(Math.sqrt(g*g+1)-g),_=Math.log(Math.sqrt(y*y+1)-y);w=(_-N)/t,x=function(I){var E=I*w,D=Vs(N),R=c/(n*C)*(D*cf(t*E+N)-lf(N));return[a+R*f,l+R*p,c*D/Vs(t*E+N)]}}return x.duration=w*1e3*t/Math.SQRT2,x}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r}(Math.SQRT2,2,4);var ut=0,$t=0,Lt=0,Bs=1e3,kn,jt,Mn=0,qe=0,An=0,Ht=typeof performance=="object"&&performance.now?performance:Date,Fs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vo(){return qe||(Fs(uf),qe=Ht.now()+An)}function uf(){qe=0}function Pn(){this._call=this._time=this._next=null}Pn.prototype=Ws.prototype={constructor:Pn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Vo():+n)+(t==null?0:+t),!this._next&&jt!==this&&(jt?jt._next=this:kn=this,jt=this),this._call=e,this._time=n,Bo()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bo())}};function Ws(e,t,n){var o=new Pn;return o.restart(e,t,n),o}function df(){Vo(),++ut;for(var e=kn,t;e;)(t=qe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ut}function Ys(){qe=(Mn=Ht.now())+An,ut=$t=0;try{df()}finally{ut=0,hf(),qe=0}}function ff(){var e=Ht.now(),t=e-Mn;t>Bs&&(An-=t,Mn=e)}function hf(){for(var e,t=kn,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:kn=n);jt=e,Bo(o)}function Bo(e){if(!ut){$t&&($t=clearTimeout($t));var t=e-qe;t>24?(e<1/0&&($t=setTimeout(Ys,e-Ht.now()-An)),Lt&&(Lt=clearInterval(Lt))):(Lt||(Mn=Ht.now(),Lt=setInterval(ff,Bs)),ut=1,Fs(Ys))}}function Gs(e,t,n){var o=new Pn;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var pf=gn("start","end","cancel","interrupt"),gf=[],Xs=0,Zs=1,Fo=2,In=3,Us=4,Wo=5,On=6;function Tn(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;mf(e,n,{name:t,index:o,group:r,on:pf,tween:gf,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Xs})}function Yo(e,t){var n=Se(e,t);if(n.state>Xs)throw new Error("too late; already scheduled");return n}function Ae(e,t){var n=Se(e,t);if(n.state>In)throw new Error("too late; already running");return n}function Se(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function mf(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Ws(s,0,n.time);function s(c){n.state=Zs,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var d,h,u,f;if(n.state!==Zs)return l();for(d in o)if(f=o[d],f.name===n.name){if(f.state===In)return Gs(i);f.state===Us?(f.state=On,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[d]):+d<t&&(f.state=On,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[d])}if(Gs(function(){n.state===In&&(n.state=Us,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Fo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Fo){for(n.state=In,r=new Array(u=n.tween.length),d=0,h=-1;d<u;++d)(f=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++h]=f);r.length=h+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Wo,1),h=-1,u=r.length;++h<u;)r[h].call(e,d);n.state===Wo&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=On,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Dn(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Fo&&o.state<Wo,o.state=On,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function yf(e){return this.each(function(){Dn(this,e)})}function xf(e,t){var n,o;return function(){var r=Ae(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function wf(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=Ae(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function bf(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Se(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?xf:wf)(n,e,t))}function Go(e,t,n){var o=e._id;return e.each(function(){var r=Ae(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Se(r,o).value[t]}}function qs(e,t){var n;return(typeof t=="number"?Me:t instanceof Xe?En:(n=Xe(t))?(t=n,En):Ls)(e,t)}function vf(e){return function(){this.removeAttribute(e)}}function _f(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sf(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function Ef(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function Cf(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Nf(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function kf(e,t){var n=yn(e),o=n==="transform"?sf:qs;return this.attrTween(e,typeof t=="function"?(n.local?Nf:Cf)(n,o,Go(this,"attr."+e,t)):t==null?(n.local?_f:vf)(n):(n.local?Ef:Sf)(n,o,t))}function Mf(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Af(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Pf(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Af(e,s)),n}return r._value=t,r}function If(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Mf(e,s)),n}return r._value=t,r}function Of(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=yn(e);return this.tween(n,(o.local?Pf:If)(o,t))}function Tf(e,t){return function(){Yo(this,e).delay=+t.apply(this,arguments)}}function Df(e,t){return t=+t,function(){Yo(this,e).delay=t}}function zf(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Tf:Df)(t,e)):Se(this.node(),t).delay}function $f(e,t){return function(){Ae(this,e).duration=+t.apply(this,arguments)}}function Lf(e,t){return t=+t,function(){Ae(this,e).duration=t}}function jf(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?$f:Lf)(t,e)):Se(this.node(),t).duration}function Hf(e,t){if(typeof t!="function")throw new Error;return function(){Ae(this,e).ease=t}}function Rf(e){var t=this._id;return arguments.length?this.each(Hf(t,e)):Se(this.node(),t).ease}function Vf(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ae(this,e).ease=n}}function Bf(e){if(typeof e!="function")throw new Error;return this.each(Vf(this._id,e))}function Ff(e){typeof e!="function"&&(e=hs(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Te(o,this._parents,this._name,this._id)}function Wf(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],d=l.length,h=i[a]=new Array(d),u,f=0;f<d;++f)(u=l[f]||c[f])&&(h[f]=u);for(;a<o;++a)i[a]=t[a];return new Te(i,this._parents,this._name,this._id)}function Yf(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Gf(e,t,n){var o,r,s=Yf(t)?Yo:Ae;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Xf(e,t){var n=this._id;return arguments.length<2?Se(this.node(),n).on.on(e):this.each(Gf(n,e,t))}function Zf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uf(){return this.on("end.remove",Zf(this._id))}function qf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Po(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),d,h,u=0;u<l;++u)(d=a[u])&&(h=e.call(d,d.__data__,u,a))&&("__data__"in d&&(h.__data__=d.__data__),c[u]=h,Tn(c[u],t,n,u,c,Se(d,n)));return new Te(s,this._parents,t,n)}function Kf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,d,h=0;h<c;++h)if(d=l[h]){for(var u=e.call(d,d.__data__,h,l),f,p=Se(d,n),m=0,x=u.length;m<x;++m)(f=u[m])&&Tn(f,t,n,m,u,p);s.push(u),i.push(d)}return new Te(s,i,t,n)}var Qf=Pt.prototype.constructor;function Jf(){return new Qf(this._groups,this._parents)}function eh(e,t){var n,o,r;return function(){var s=at(this,e),i=(this.style.removeProperty(e),at(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ks(e){return function(){this.style.removeProperty(e)}}function th(e,t,n){var o,r=n+"",s;return function(){var i=at(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function nh(e,t,n){var o,r,s;return function(){var i=at(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),at(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function oh(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=Ae(this,e),c=l.on,d=l.value[s]==null?a||(a=Ks(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(i,r=d),l.on=o}}function rh(e,t,n){var o=(e+="")=="transform"?rf:qs;return t==null?this.styleTween(e,eh(e,o)).on("end.style."+e,Ks(e)):typeof t=="function"?this.styleTween(e,nh(e,o,Go(this,"style."+e,t))).each(oh(this._id,e)):this.styleTween(e,th(e,o,t),n).on("end.style."+e,null)}function sh(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ih(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&sh(e,i,n)),o}return s._value=t,s}function ah(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,ih(e,t,n??""))}function lh(e){return function(){this.textContent=e}}function ch(e){return function(){var t=e(this);this.textContent=t??""}}function uh(e){return this.tween("text",typeof e=="function"?ch(Go(this,"text",e)):lh(e==null?"":e+""))}function dh(e){return function(t){this.textContent=e.call(this,t)}}function fh(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&dh(r)),t}return o._value=e,o}function hh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,fh(e))}function ph(){for(var e=this._name,t=this._id,n=Qs(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var d=Se(l,t);Tn(l,e,n,c,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Te(o,this._parents,e,n)}function gh(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=Ae(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var mh=0;function Te(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Qs(){return++mh}var De=Pt.prototype;Te.prototype={constructor:Te,select:qf,selectAll:Kf,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Ff,merge:Wf,selection:Jf,transition:ph,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:Xf,attr:kf,attrTween:Of,style:rh,styleTween:ah,text:uh,textTween:hh,remove:Uf,tween:bf,delay:zf,duration:jf,ease:Rf,easeVarying:Bf,end:gh,[Symbol.iterator]:De[Symbol.iterator]};function yh(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xh={time:null,delay:0,duration:250,ease:yh};function wh(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function bh(e){var t,n;e instanceof Te?(t=e._id,e=e._name):(t=Qs(),(n=xh).time=Vo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Tn(l,e,t,c,i,n||wh(l,t));return new Te(o,this._parents,e,t)}Pt.prototype.interrupt=yf,Pt.prototype.transition=bh;const zn=e=>()=>e;function vh(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function ze(e,t,n){this.k=e,this.x=t,this.y=n}ze.prototype={constructor:ze,scale:function(e){return e===1?this:new ze(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ze(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 $n=new ze(1,0,0);Js.prototype=ze.prototype;function Js(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $n;return e.__zoom}function Xo(e){e.stopImmediatePropagation()}function Rt(e){e.preventDefault(),e.stopImmediatePropagation()}function _h(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Sh(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ei(){return this.__zoom||$n}function Eh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ch(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nh(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function ti(){var e=_h,t=Sh,n=Nh,o=Eh,r=Ch,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nn,c=gn("start","zoom","end"),d,h,u,f=500,p=150,m=0,x=10;function w(b){b.property("__zoom",ei).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",R).filter(r).on("touchstart.zoom",L).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(b,P,M,A){var O=b.selection?b.selection():b;O.property("__zoom",ei),b!==O?N(b,P,M,A):O.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},w.scaleBy=function(b,P,M,A){w.scaleTo(b,function(){var O=this.__zoom.k,$=typeof P=="function"?P.apply(this,arguments):P;return O*$},M,A)},w.scaleTo=function(b,P,M,A){w.transform(b,function(){var O=t.apply(this,arguments),$=this.__zoom,S=M==null?y(O):typeof M=="function"?M.apply(this,arguments):M,T=$.invert(S),j=typeof P=="function"?P.apply(this,arguments):P;return n(g(C($,j),S,T),O,i)},M,A)},w.translateBy=function(b,P,M,A){w.transform(b,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),i)},null,A)},w.translateTo=function(b,P,M,A,O){w.transform(b,function(){var $=t.apply(this,arguments),S=this.__zoom,T=A==null?y($):typeof A=="function"?A.apply(this,arguments):A;return n($n.translate(T[0],T[1]).scale(S.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof M=="function"?-M.apply(this,arguments):-M),$,i)},A,O)};function C(b,P){return P=Math.max(s[0],Math.min(s[1],P)),P===b.k?b:new ze(P,b.x,b.y)}function g(b,P,M){var A=P[0]-M[0]*b.k,O=P[1]-M[1]*b.k;return A===b.x&&O===b.y?b:new ze(b.k,A,O)}function y(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function N(b,P,M,A){b.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var O=this,$=arguments,S=_(O,$).event(A),T=t.apply(O,$),j=M==null?y(T):typeof M=="function"?M.apply(O,$):M,B=Math.max(T[1][0]-T[0][0],T[1][1]-T[0][1]),F=O.__zoom,Z=typeof P=="function"?P.apply(O,$):P,K=l(F.invert(j).concat(B/F.k),Z.invert(j).concat(B/Z.k));return function(W){if(W===1)W=Z;else{var V=K(W),Y=B/V[2];W=new ze(Y,j[0]-V[0]*Y,j[1]-V[1]*Y)}S.zoom(null,W)}})}function _(b,P,M){return!M&&b.__zooming||new I(b,P)}function I(b,P){this.that=b,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,P),this.taps=0}I.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,P){return this.mouse&&b!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var P=be(this.that).datum();c.call(b,this.that,new vh(b,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:c}),P)}};function E(b,...P){if(!e.apply(this,arguments))return;var M=_(this,P).event(b),A=this.__zoom,O=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),$=ve(b);if(M.wheel)(M.mouse[0][0]!==$[0]||M.mouse[0][1]!==$[1])&&(M.mouse[1]=A.invert(M.mouse[0]=$)),clearTimeout(M.wheel);else{if(A.k===O)return;M.mouse=[$,A.invert($)],Dn(this),M.start()}Rt(b),M.wheel=setTimeout(S,p),M.zoom("mouse",n(g(C(A,O),M.mouse[0],M.mouse[1]),M.extent,i));function S(){M.wheel=null,M.end()}}function D(b,...P){if(u||!e.apply(this,arguments))return;var M=b.currentTarget,A=_(this,P,!0).event(b),O=be(b.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",B,!0),$=ve(b,M),S=b.clientX,T=b.clientY;Ss(b.view),Xo(b),A.mouse=[$,this.__zoom.invert($)],Dn(this),A.start();function j(F){if(Rt(F),!A.moved){var Z=F.clientX-S,K=F.clientY-T;A.moved=Z*Z+K*K>m}A.event(F).zoom("mouse",n(g(A.that.__zoom,A.mouse[0]=ve(F,M),A.mouse[1]),A.extent,i))}function B(F){O.on("mousemove.zoom mouseup.zoom",null),Es(F.view,A.moved),Rt(F),A.event(F).end()}}function R(b,...P){if(e.apply(this,arguments)){var M=this.__zoom,A=ve(b.changedTouches?b.changedTouches[0]:b,this),O=M.invert(A),$=M.k*(b.shiftKey?.5:2),S=n(g(C(M,$),A,O),t.apply(this,P),i);Rt(b),a>0?be(this).transition().duration(a).call(N,S,A,b):be(this).call(w.transform,S,A,b)}}function L(b,...P){if(e.apply(this,arguments)){var M=b.touches,A=M.length,O=_(this,P,b.changedTouches.length===A).event(b),$,S,T,j;for(Xo(b),S=0;S<A;++S)T=M[S],j=ve(T,this),j=[j,this.__zoom.invert(j),T.identifier],O.touch0?!O.touch1&&O.touch0[2]!==j[2]&&(O.touch1=j,O.taps=0):(O.touch0=j,$=!0,O.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(O.taps<2&&(h=j[0],d=setTimeout(function(){d=null},f)),Dn(this),O.start())}}function z(b,...P){if(this.__zooming){var M=_(this,P).event(b),A=b.changedTouches,O=A.length,$,S,T,j;for(Rt(b),$=0;$<O;++$)S=A[$],T=ve(S,this),M.touch0&&M.touch0[2]===S.identifier?M.touch0[0]=T:M.touch1&&M.touch1[2]===S.identifier&&(M.touch1[0]=T);if(S=M.that.__zoom,M.touch1){var B=M.touch0[0],F=M.touch0[1],Z=M.touch1[0],K=M.touch1[1],W=(W=Z[0]-B[0])*W+(W=Z[1]-B[1])*W,V=(V=K[0]-F[0])*V+(V=K[1]-F[1])*V;S=C(S,Math.sqrt(W/V)),T=[(B[0]+Z[0])/2,(B[1]+Z[1])/2],j=[(F[0]+K[0])/2,(F[1]+K[1])/2]}else if(M.touch0)T=M.touch0[0],j=M.touch0[1];else return;M.zoom("touch",n(g(S,T,j),M.extent,i))}}function H(b,...P){if(this.__zooming){var M=_(this,P).event(b),A=b.changedTouches,O=A.length,$,S;for(Xo(b),u&&clearTimeout(u),u=setTimeout(function(){u=null},f),$=0;$<O;++$)S=A[$],M.touch0&&M.touch0[2]===S.identifier?delete M.touch0:M.touch1&&M.touch1[2]===S.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(S=ve(S,this),Math.hypot(h[0]-S[0],h[1]-S[1])<x)){var T=be(this).on("dblclick.zoom");T&&T.apply(this,arguments)}}}return w.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:zn(+b),w):o},w.filter=function(b){return arguments.length?(e=typeof b=="function"?b:zn(!!b),w):e},w.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:zn(!!b),w):r},w.extent=function(b){return arguments.length?(t=typeof b=="function"?b:zn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),w):t},w.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],w):[s[0],s[1]]},w.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],w):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},w.constrain=function(b){return arguments.length?(n=b,w):n},w.duration=function(b){return arguments.length?(a=+b,w):a},w.interpolate=function(b){return arguments.length?(l=b,w):l},w.on=function(){var b=c.on.apply(c,arguments);return b===c?w:b},w.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,w):Math.sqrt(m)},w.tapDistance=function(b){return arguments.length?(x=+b,w):x},w}const ye={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ni=["Enter"," ","Escape"],oi={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var dt;(function(e){e.Strict="strict",e.Loose="loose"})(dt||(dt={}));var Ke;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ke||(Ke={}));var ft;(function(e){e.Partial="partial",e.Full="full"})(ft||(ft={}));const ri={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var je;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(je||(je={}));var Ln;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ln||(Ln={}));var U;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(U||(U={}));const si={[U.Left]:U.Right,[U.Right]:U.Left,[U.Top]:U.Bottom,[U.Bottom]:U.Top};function kh(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function ii(e,t,n){if(!n)return;const o=[];e.forEach((r,s)=>{t?.has(s)||o.push(r)}),o.length&&n(o)}function ai(e){return e===null?null:e?"valid":"invalid"}const li=e=>"id"in e&&"source"in e&&"target"in e,Mh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Zo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Bt=(e,t=[0,0])=>{const{width:n,height:o}=$e(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Ah=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):Zo(r)?r:t.nodeLookup.get(r.id));const a=i?Rn(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return jn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hn(n)},Ft=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const r=Rn(o);n=jn(n,r)}}),Hn(n)},Uo=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:d,selectable:h=!0,hidden:u=!1}=c;if(i&&!h||u)continue;const f=d.width??c.width??c.initialWidth??null,p=d.height??c.height??c.initialHeight??null,m=Wt(a,pt(c)),x=(f??0)*(p??0),w=s&&m>0;(!c.internals.handleBounds||w||m>=x||c.dragging)&&l.push(c)}return l},Ph=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ih(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Oh({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Ih(e,i),l=Ft(a),c=Ko(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function ci({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??o;let h=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ye.error005());else{const f=a.measured.width,p=a.measured.height;f&&p&&(h=[[l,c],[l+f,c+p]])}else a&&mt(i.extent)&&(h=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const u=mt(h)?Qe(t,h,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ye.error015()),{position:{x:u.x-l+(i.measured.width??0)*d[0],y:u.y-c+(i.measured.height??0)*d[1]},positionAbsolute:u}}async function Th({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(u=>u.id)),i=[];for(const u of n){if(u.deletable===!1)continue;const f=s.has(u.id),p=!f&&u.parentId&&i.find(m=>m.id===u.parentId);(f||p)&&i.push(u)}const a=new Set(t.map(u=>u.id)),l=o.filter(u=>u.deletable!==!1),d=Ph(i,l);for(const u of l)a.has(u.id)&&!d.find(p=>p.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:i};const h=await r({nodes:i,edges:d});return typeof h=="boolean"?h?{edges:d,nodes:i}:{edges:[],nodes:[]}:h}const ht=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Qe=(e={x:0,y:0},t,n)=>({x:ht(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ht(e.y,t[0][1],t[1][1]-(n?.height??0))});function ui(e,t,n){const{width:o,height:r}=$e(n),{x:s,y:i}=n.internals.positionAbsolute;return Qe(e,[[s,i],[s+o,i+r]],t)}const di=(e,t,n)=>e<t?ht(Math.abs(e-t),1,t)/t:e>n?-ht(Math.abs(e-n),1,t)/t:0,fi=(e,t,n=15,o=40)=>{const r=di(e.x,o,t.width-o)*n,s=di(e.y,o,t.height-o)*n;return[r,s]},jn=(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)}),qo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Hn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),pt=(e,t=[0,0])=>{const{x:n,y:o}=Zo(e)?e.internals.positionAbsolute:Bt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Rn=(e,t=[0,0])=>{const{x:n,y:o}=Zo(e)?e.internals.positionAbsolute:Bt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},hi=(e,t)=>Hn(jn(qo(e),qo(t))),Wt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},pi=e=>Ee(e.width)&&Ee(e.height)&&Ee(e.x)&&Ee(e.y),Ee=e=>!isNaN(e)&&isFinite(e),gi=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Yt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Gt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Yt(a,i):a},Vn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function gt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Dh(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=gt(e,n),r=gt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=gt(e.top??e.y??0,n),r=gt(e.bottom??e.y??0,n),s=gt(e.left??e.x??0,t),i=gt(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function zh(e,t,n,o,r,s){const{x:i,y:a}=Vn(e,[t,n,o]),{x:l,y:c}=Vn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,h=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(h)}}const Ko=(e,t,n,o,r,s)=>{const i=Dh(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),d=ht(c,o,r),h=e.x+e.width/2,u=e.y+e.height/2,f=t/2-h*d,p=n/2-u*d,m=zh(e,f,p,d,t,n),x={left:Math.min(m.left-i.left,0),top:Math.min(m.top-i.top,0),right:Math.min(m.right-i.right,0),bottom:Math.min(m.bottom-i.bottom,0)};return{x:f-x.left+x.right,y:p-x.top+x.bottom,zoom:d}},Xt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function mt(e){return e!=null&&e!=="parent"}function $e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function mi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function yi(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function xi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function $h(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Lh(e){return{...oi,...e||{}}}function Zt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=Pe(e),a=Gt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Yt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Qo=e=>({width:e.offsetWidth,height:e.offsetHeight}),wi=e=>e?.getRootNode?.()||window?.document,jh=["INPUT","SELECT","TEXTAREA"];function bi(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:jh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const vi=e=>"clientX"in e,Pe=(e,t)=>{const n=vi(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},_i=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Qo(i)}})};function Si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,d=Math.abs(l-e),h=Math.abs(c-t);return[l,c,d,h]}function Bn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ei({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case U.Left:return[t-Bn(t-o,s),n];case U.Right:return[t+Bn(o-t,s),n];case U.Top:return[t,n-Bn(n-r,s)];case U.Bottom:return[t,n+Bn(r-n,s)]}}function Fn({sourceX:e,sourceY:t,sourcePosition:n=U.Bottom,targetX:o,targetY:r,targetPosition:s=U.Top,curvature:i=.25}){const[a,l]=Ei({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,d]=Ei({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[h,u,f,p]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,h,u,f,p]}function Ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Hh({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){if(o!==void 0)return o;const s=r&&n?1e3:0,i=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return s+i}function Rh({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=jn(Rn(e),Rn(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Wt(i,Hn(s))>0}const Vh=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Bh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Ni=(e,t)=>{if(!e.source||!e.target)return gi("006",ye.error006()),t;let n;return li(e)?n={...e}:n={...e,id:Vh(e)},Bh(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function ki({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Mi={[U.Left]:{x:-1,y:0},[U.Right]:{x:1,y:0},[U.Top]:{x:0,y:-1},[U.Bottom]:{x:0,y:1}},Fh=({source:e,sourcePosition:t=U.Bottom,target:n})=>t===U.Left||t===U.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},Ai=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wh({source:e,sourcePosition:t=U.Bottom,target:n,targetPosition:o=U.Top,center:r,offset:s,stepPosition:i}){const a=Mi[t],l=Mi[o],c={x:e.x+a.x*s,y:e.y+a.y*s},d={x:n.x+l.x*s,y:n.y+l.y*s},h=Fh({source:c,sourcePosition:t,target:d}),u=h.x!==0?"x":"y",f=h[u];let p=[],m,x;const w={x:0,y:0},C={x:0,y:0},[,,g,y]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*l[u]===-1){u==="x"?(m=r.x??c.x+(d.x-c.x)*i,x=r.y??(c.y+d.y)/2):(m=r.x??(c.x+d.x)/2,x=r.y??c.y+(d.y-c.y)*i);const _=[{x:m,y:c.y},{x:m,y:d.y}],I=[{x:c.x,y:x},{x:d.x,y:x}];a[u]===f?p=u==="x"?_:I:p=u==="x"?I:_}else{const _=[{x:c.x,y:d.y}],I=[{x:d.x,y:c.y}];if(u==="x"?p=a.x===f?I:_:p=a.y===f?_:I,t===o){const z=Math.abs(e[u]-n[u]);if(z<=s){const H=Math.min(s-1,s-z);a[u]===f?w[u]=(c[u]>e[u]?-1:1)*H:C[u]=(d[u]>n[u]?-1:1)*H}}if(t!==o){const z=u==="x"?"y":"x",H=a[u]===l[z],b=c[z]>d[z],P=c[z]<d[z];(a[u]===1&&(!H&&b||H&&P)||a[u]!==1&&(!H&&P||H&&b))&&(p=u==="x"?_:I)}const E={x:c.x+w.x,y:c.y+w.y},D={x:d.x+C.x,y:d.y+C.y},R=Math.max(Math.abs(E.x-p[0].x),Math.abs(D.x-p[0].x)),L=Math.max(Math.abs(E.y-p[0].y),Math.abs(D.y-p[0].y));R>=L?(m=(E.x+D.x)/2,x=p[0].y):(m=p[0].x,x=(E.y+D.y)/2)}return[[e,{x:c.x+w.x,y:c.y+w.y},...p,{x:d.x+C.x,y:d.y+C.y},n],m,x,g,y]}function Yh(e,t,n,o){const r=Math.min(Ai(e,t)/2,Ai(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*d}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Jo({sourceX:e,sourceY:t,sourcePosition:n=U.Bottom,targetX:o,targetY:r,targetPosition:s=U.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[h,u,f,p,m]=Wh({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:d});return[h.reduce((w,C,g)=>{let y="";return g>0&&g<h.length-1?y=Yh(h[g-1],C,h[g+1],i):y=`${g===0?"M":"L"}${C.x} ${C.y}`,w+=y,w},""),u,f,p,m]}function Pi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Gh(e){const{sourceNode:t,targetNode:n}=e;if(!Pi(t)||!Pi(n))return null;const o=t.internals.handleBounds||Ii(t.handles),r=n.internals.handleBounds||Ii(n.handles),s=Oi(o?.source??[],e.sourceHandle),i=Oi(e.connectionMode===dt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ye.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||U.Bottom,l=i?.position||U.Top,c=Ut(t,s,a),d=Ut(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}function Ii(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Ut(e,t,n=U.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??$e(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case U.Top:return{x:r+i/2,y:s};case U.Right:return{x:r+i,y:s+a/2};case U.Bottom:return{x:r+i/2,y:s+a};case U.Left:return{x:r,y:s+a/2}}}function Oi(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function er(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Xh(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=er(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const tr={nodeOrigin:[0,0],nodeExtent:Vt,elevateNodesOnSelect:!0,defaults:{}},Zh={...tr,checkEquality:!0};function nr(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Uh(e,t,n){const o=nr(tr,n);for(const r of e.values())if(r.parentId)rr(r,e,t,o);else{const s=Bt(r,o.nodeOrigin),i=mt(r.extent)?r.extent:o.nodeExtent,a=Qe(s,i,$e(r));r.internals.positionAbsolute=a}}function or(e,t,n,o){const r=nr(Zh,o);let s=e.length>0;const i=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let c=i.get(l.id);if(r.checkEquality&&l===c?.internals.userNode)t.set(l.id,c);else{const d=Bt(l,r.nodeOrigin),h=mt(l.extent)?l.extent:r.nodeExtent,u=Qe(d,h,$e(l));c={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:u,handleBounds:l.measured?c?.internals.handleBounds:void 0,z:Ti(l,a),userNode:l}},t.set(l.id,c)}(c.measured===void 0||c.measured.width===void 0||c.measured.height===void 0)&&!c.hidden&&(s=!1),l.parentId&&rr(c,t,n,o)}return s}function qh(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function rr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:s,nodeExtent:i}=nr(tr,o),a=e.parentId,l=t.get(a);if(!l){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qh(e,n);const c=r?1e3:0,{x:d,y:h,z:u}=Kh(e,l,s,i,c),{positionAbsolute:f}=e.internals,p=d!==f.x||h!==f.y;(p||u!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:d,y:h}:f,z:u}})}function Ti(e,t){return(Ee(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Kh(e,t,n,o,r){const{x:s,y:i}=t.internals.positionAbsolute,a=$e(e),l=Bt(e,n),c=mt(e.extent)?Qe(l,e.extent,a):l;let d=Qe({x:s+c.x,y:i+c.y},o,a);e.extent==="parent"&&(d=ui(d,a,t));const h=Ti(e,r),u=t.internals.z??0;return{x:d.x,y:d.y,z:u>=h?u+1:h}}function sr(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??pt(a),c=hi(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,d=$e(a),h=a.origin??o,u=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,f=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,p=Math.max(d.width,Math.round(i.width)),m=Math.max(d.height,Math.round(i.height)),x=(p-d.width)*h[0],w=(m-d.height)*h[1];(u>0||f>0||x||w)&&(r.push({id:l,type:"position",position:{x:a.position.x-u+x,y:a.position.y-f+w}}),n.get(l)?.forEach(C=>{e.some(g=>g.id===C.id)||r.push({id:C.id,type:"position",position:{x:C.position.x+u,y:C.position.y+f}})})),(d.width<i.width||d.height<i.height||u||f)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(u?h[0]*u-x:0),height:m+(f?h[1]*f-w:0)}})}),r}function Qh(e,t,n,o,r,s){const i=o?.querySelector(".xyflow__viewport");let a=!1;if(!i)return{changes:[],updatedInternals:a};const l=[],c=window.getComputedStyle(i),{m22:d}=new window.DOMMatrixReadOnly(c.transform),h=[];for(const u of e.values()){const f=t.get(u.id);if(!f)continue;if(f.hidden){t.set(f.id,{...f,internals:{...f.internals,handleBounds:void 0}}),a=!0;continue}const p=Qo(u.nodeElement),m=f.measured.width!==p.width||f.measured.height!==p.height;if(!!(p.width&&p.height&&(m||!f.internals.handleBounds||u.force))){const w=u.nodeElement.getBoundingClientRect(),C=mt(f.extent)?f.extent:s;let{positionAbsolute:g}=f.internals;f.parentId&&f.extent==="parent"?g=ui(g,p,t.get(f.parentId)):C&&(g=Qe(g,C,p));const y={...f,measured:p,internals:{...f.internals,positionAbsolute:g,handleBounds:{source:_i("source",u.nodeElement,w,d,f.id),target:_i("target",u.nodeElement,w,d,f.id)}}};t.set(f.id,y),f.parentId&&rr(y,t,n,{nodeOrigin:r}),a=!0,m&&(l.push({id:f.id,type:"dimensions",dimensions:p}),f.expandParent&&f.parentId&&h.push({id:f.id,parentId:f.parentId,rect:pt(y,r)}))}}if(h.length>0){const u=sr(h,t,n,r);l.push(...u)}return{changes:l,updatedInternals:a}}async function Jh({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function Di(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function zi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,d=`${s}-${a}--${r}-${i}`;Di("source",l,d,e,r,i),Di("target",l,c,e,s,a),t.set(o.id,o)}}function ep(e,t){if(e===null||t===null)return!1;const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(n[r].id!==o[r].id||n[r].type!==o[r].type||!Object.is(n[r].data,o[r].data))return!1;return!0}function $i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:$i(n,t):!1}function Li(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function tp(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!$i(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function ir({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function np({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Yt(s,t);return{x:i.x-s.x,y:i.y-s.y}}function op({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},d=null,h=!1,u=null,f=!1,p=!1,m=null;function x({noDragClassName:C,handleSelector:g,domNode:y,isSelectable:N,nodeId:_,nodeClickDistance:I=0}){u=be(y);function E({x:z,y:H}){const{nodeLookup:b,nodeExtent:P,snapGrid:M,snapToGrid:A,nodeOrigin:O,onNodeDrag:$,onSelectionDrag:S,onError:T,updateNodePositions:j}=t();s={x:z,y:H};let B=!1;const F=a.size>1,Z=F&&P?qo(Ft(a)):null,K=F&&A?np({dragItems:a,snapGrid:M,x:z,y:H}):null;for(const[W,V]of a){if(!b.has(W))continue;let Y={x:z-V.distance.x,y:H-V.distance.y};A&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:Yt(Y,M));let J=null;if(F&&P&&!V.extent&&Z){const{positionAbsolute:ne}=V.internals,Q=ne.x-Z.x+P[0][0],le=ne.x+V.measured.width-Z.x2+P[1][0],he=ne.y-Z.y+P[0][1],Ce=ne.y+V.measured.height-Z.y2+P[1][1];J=[[Q,he],[le,Ce]]}const{position:re,positionAbsolute:q}=ci({nodeId:W,nextPosition:Y,nodeLookup:b,nodeExtent:J||P,nodeOrigin:O,onError:T});B=B||V.position.x!==re.x||V.position.y!==re.y,V.position=re,V.internals.positionAbsolute=q}if(p=p||B,!!B&&(j(a,!0),m&&(o||$||!_&&S))){const[W,V]=ir({nodeId:_,dragItems:a,nodeLookup:b});o?.(m,a,W,V),$?.(m,W,V),_||S?.(m,V)}}async function D(){if(!d)return;const{transform:z,panBy:H,autoPanSpeed:b,autoPanOnNodeDrag:P}=t();if(!P){l=!1,cancelAnimationFrame(i);return}const[M,A]=fi(c,d,b);(M!==0||A!==0)&&(s.x=(s.x??0)-M/z[2],s.y=(s.y??0)-A/z[2],await H({x:M,y:A})&&E(s)),i=requestAnimationFrame(D)}function R(z){const{nodeLookup:H,multiSelectionActive:b,nodesDraggable:P,transform:M,snapGrid:A,snapToGrid:O,selectNodesOnDrag:$,onNodeDragStart:S,onSelectionDragStart:T,unselectNodesAndEdges:j}=t();h=!0,(!$||!N)&&!b&&_&&(H.get(_)?.selected||j()),N&&$&&_&&e?.(_);const B=Zt(z.sourceEvent,{transform:M,snapGrid:A,snapToGrid:O,containerBounds:d});if(s=B,a=tp(H,P,B,_),a.size>0&&(n||S||!_&&T)){const[F,Z]=ir({nodeId:_,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,F,Z),S?.(z.sourceEvent,F,Z),_||T?.(z.sourceEvent,Z)}}const L=Cs().clickDistance(I).on("start",z=>{const{domNode:H,nodeDragThreshold:b,transform:P,snapGrid:M,snapToGrid:A}=t();d=H?.getBoundingClientRect()||null,f=!1,p=!1,m=z.sourceEvent,b===0&&R(z),s=Zt(z.sourceEvent,{transform:P,snapGrid:M,snapToGrid:A,containerBounds:d}),c=Pe(z.sourceEvent,d)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:b,snapGrid:P,snapToGrid:M,nodeDragThreshold:A,nodeLookup:O}=t(),$=Zt(z.sourceEvent,{transform:b,snapGrid:P,snapToGrid:M,containerBounds:d});if(m=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||_&&!O.has(_))&&(f=!0),!f){if(!l&&H&&h&&(l=!0,D()),!h){const S=$.xSnapped-(s.x??0),T=$.ySnapped-(s.y??0);Math.sqrt(S*S+T*T)>A&&R(z)}(s.x!==$.xSnapped||s.y!==$.ySnapped)&&a&&h&&(c=Pe(z.sourceEvent,d),E($))}}).on("end",z=>{if(!(!h||f)&&(l=!1,h=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:H,updateNodePositions:b,onNodeDragStop:P,onSelectionDragStop:M}=t();if(p&&(b(a,!1),p=!1),r||P||!_&&M){const[A,O]=ir({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,A,O),P?.(z.sourceEvent,A,O),_||M?.(z.sourceEvent,O)}}}).filter(z=>{const H=z.target;return!z.button&&(!C||!Li(H,`.${C}`,y))&&(!g||Li(H,g,y))});u.call(L)}function w(){u?.on(".drag",null)}return{update:x,destroy:w}}function rp(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())Wt(r,pt(s))>0&&o.push(s);return o}const sp=250;function ip(e,t,n,o){let r=[],s=1/0;const i=rp(e,n,t+sp);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:d,y:h}=Ut(a,c,c.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));u>t||(u<s?(r=[{...c,x:d,y:h}],s=u):u===s&&r.push({...c,x:d,y:h}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ji(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Ut(i,l,l.position,!0)}:l}function Hi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ap(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ri=()=>!0;function lp(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:h,panBy:u,cancelConnection:f,onConnectStart:p,onConnect:m,onConnectEnd:x,isValidConnection:w=Ri,onReconnectEnd:C,updateConnection:g,getTransform:y,getFromHandle:N,autoPanSpeed:_,dragThreshold:I=1,handleDomNode:E}){const D=wi(e.target);let R=0,L;const{x:z,y:H}=Pe(e),b=Hi(s,E),P=a?.getBoundingClientRect();let M=!1;if(!P||!b)return;const A=ji(r,b,o,l,t);if(!A)return;let O=Pe(e,P),$=!1,S=null,T=!1,j=null;function B(){if(!d||!P)return;const[re,q]=fi(O,P,_);u({x:re,y:q}),R=requestAnimationFrame(B)}const F={...A,nodeId:r,type:b,position:A.position},Z=l.get(r);let W={inProgress:!0,isValid:null,from:Ut(Z,F,U.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:Z,to:O,toHandle:null,toPosition:si[F.position],toNode:null};function V(){M=!0,g(W),p?.(e,{nodeId:r,handleId:o,handleType:b})}I===0&&V();function Y(re){if(!M){const{x:le,y:he}=Pe(re),Ce=le-z,vt=he-H;if(!(Ce*Ce+vt*vt>I*I))return;V()}if(!N()||!F){J(re);return}const q=y();O=Pe(re,P),L=ip(Gt(O,q,!1,[1,1]),n,l,F),$||(B(),$=!0);const ne=Vi(re,{handle:L,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:w,doc:D,lib:c,flowId:h,nodeLookup:l});j=ne.handleDomNode,S=ne.connection,T=ap(!!L,ne.isValid);const Q={...W,isValid:T,to:ne.toHandle&&T?Vn({x:ne.toHandle.x,y:ne.toHandle.y},q):O,toHandle:ne.toHandle,toPosition:T&&ne.toHandle?ne.toHandle.position:si[F.position],toNode:ne.toHandle?l.get(ne.toHandle.nodeId):null};T&&L&&W.toHandle&&Q.toHandle&&W.toHandle.type===Q.toHandle.type&&W.toHandle.nodeId===Q.toHandle.nodeId&&W.toHandle.id===Q.toHandle.id&&W.to.x===Q.to.x&&W.to.y===Q.to.y||(g(Q),W=Q)}function J(re){if(M){(L||j)&&S&&T&&m?.(S);const{inProgress:q,...ne}=W,Q={...ne,toPosition:W.toHandle?W.toPosition:null};x?.(re,Q),s&&C?.(re,Q)}f(),cancelAnimationFrame(R),$=!1,T=!1,S=null,j=null,D.removeEventListener("mousemove",Y),D.removeEventListener("mouseup",J),D.removeEventListener("touchmove",Y),D.removeEventListener("touchend",J)}D.addEventListener("mousemove",Y),D.addEventListener("mouseup",J),D.addEventListener("touchmove",Y),D.addEventListener("touchend",J)}function Vi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=Ri,nodeLookup:d}){const h=s==="target",u=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:p}=Pe(e),m=i.elementFromPoint(f,p),x=m?.classList.contains(`${a}-flow__handle`)?m:u,w={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const C=Hi(void 0,x),g=x.getAttribute("data-nodeid"),y=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!g||!C)return w;const I={source:h?g:o,sourceHandle:h?y:r,target:h?o:g,targetHandle:h?r:y};w.connection=I;const D=N&&_&&(n===dt.Strict?h&&C==="source"||!h&&C==="target":g!==o||y!==r);w.isValid=D&&c(I),w.toHandle=ji(g,C,y,d,n,!0)}return w}const ar={onPointerDown:lp,isValid:Vi};function cp({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=be(e);function s({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:h=!0,zoomable:u=!0,inversePan:f=!1}){const p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const y=n(),N=g.sourceEvent.ctrlKey&&Xt()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,I=y[2]*Math.pow(2,_*N);t.scaleTo(I)};let m=[0,0];const x=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(m=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},w=g=>{const y=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[N[0]-m[0],N[1]-m[1]];m=N;const I=o()*Math.max(y[2],Math.log(y[2]))*(f?-1:1),E={x:y[0]-_[0]*I,y:y[1]-_[1]*I},D=[[0,0],[l,c]];t.setViewportConstrained({x:E.x,y:E.y,zoom:y[2]},D,a)},C=ti().on("start",x).on("zoom",h?w:null).on("zoom.wheel",u?p:null);r.call(C,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:ve}}const up=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Wn=e=>({x:e.x,y:e.y,zoom:e.k}),lr=({x:e,y:t,zoom:n})=>$n.translate(e,t).scale(n),yt=(e,t)=>e.target.closest(`.${t}`),Bi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),dp=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cr=(e,t=0,n=dp,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Fi=e=>{const t=e.ctrlKey&&Xt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function fp({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(yt(d,t))return!1;d.preventDefault(),d.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(d.ctrlKey&&i){const x=ve(d),w=Fi(d),C=h*Math.pow(2,w);o.scaleTo(n,C,x,d);return}const u=d.deltaMode===1?20:1;let f=r===Ke.Vertical?0:d.deltaX*u,p=r===Ke.Horizontal?0:d.deltaY*u;!Xt()&&d.shiftKey&&r!==Ke.Vertical&&(f=d.deltaY*u,p=0),o.translateBy(n,-(f/h)*s,-(p/h)*s,{internal:!0});const m=Wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a?.(d,m)),e.isPanScrolling&&(l?.(d,m),e.panScrollTimeout=setTimeout(()=>{c?.(d,m),e.isPanScrolling=!1},150))}}function hp({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=yt(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function pp({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Wn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function gp({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&Bi(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Wn(s.transform))}}function mp({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Bi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&up(e.prevViewport,i.transform))){const a=Wn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function yp({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c}){return d=>{const h=e||t,u=n&&d.ctrlKey;if(d.button===1&&d.type==="mousedown"&&(yt(d,`${c}-flow__node`)||yt(d,`${c}-flow__edge`)))return!0;if(!o&&!h&&!r&&!s&&!n||i||yt(d,a)&&d.type==="wheel"||yt(d,l)&&(d.type!=="wheel"||r&&d.type==="wheel"&&!e)||!n&&d.ctrlKey&&d.type==="wheel")return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!r&&!u&&d.type==="wheel"||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const f=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||d.type==="wheel")&&f}}function xp({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),u=ti().clickDistance(!Ee(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),f=be(e).call(u);g({x:s.x,y:s.y,zoom:ht(s.zoom,t,n)},[[0,0],[h.width,h.height]],r);const p=f.on("wheel.zoom"),m=f.on("dblclick.zoom");u.wheelDelta(Fi);function x(z,H){return f?new Promise(b=>{u?.interpolate(H?.interpolate==="linear"?zt:Nn).transform(cr(f,H?.duration,H?.ease,()=>b(!0)),z)}):Promise.resolve(!1)}function w({noWheelClassName:z,noPanClassName:H,onPaneContextMenu:b,userSelectionActive:P,panOnScroll:M,panOnDrag:A,panOnScrollMode:O,panOnScrollSpeed:$,preventScrolling:S,zoomOnPinch:T,zoomOnScroll:j,zoomOnDoubleClick:B,zoomActivationKeyPressed:F,lib:Z,onTransformChange:K}){P&&!d.isZoomingOrPanning&&C();const V=M&&!F&&!P?fp({zoomPanValues:d,noWheelClassName:z,d3Selection:f,d3Zoom:u,panOnScrollMode:O,panOnScrollSpeed:$,zoomOnPinch:T,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):hp({noWheelClassName:z,preventScrolling:S,d3ZoomHandler:p});if(f.on("wheel.zoom",V,{passive:!1}),!P){const J=pp({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});u.on("start",J);const re=gp({zoomPanValues:d,panOnDrag:A,onPaneContextMenu:!!b,onPanZoom:i,onTransformChange:K});u.on("zoom",re);const q=mp({zoomPanValues:d,panOnDrag:A,panOnScroll:M,onPaneContextMenu:b,onPanZoomEnd:l,onDraggingChange:c});u.on("end",q)}const Y=yp({zoomActivationKeyPressed:F,panOnDrag:A,zoomOnScroll:j,panOnScroll:M,zoomOnDoubleClick:B,zoomOnPinch:T,userSelectionActive:P,noPanClassName:H,noWheelClassName:z,lib:Z});u.filter(Y),B?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function C(){u.on("zoom",null)}async function g(z,H,b){const P=lr(z),M=u?.constrain()(P,H,b);return M&&await x(M),new Promise(A=>A(M))}async function y(z,H){const b=lr(z);return await x(b,H),new Promise(P=>P(b))}function N(z){if(f){const H=lr(z),b=f.property("__zoom");(b.k!==z.zoom||b.x!==z.x||b.y!==z.y)&&u?.transform(f,H,null,{sync:!0})}}function _(){const z=f?Js(f.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function I(z,H){return f?new Promise(b=>{u?.interpolate(H?.interpolate==="linear"?zt:Nn).scaleTo(cr(f,H?.duration,H?.ease,()=>b(!0)),z)}):Promise.resolve(!1)}function E(z,H){return f?new Promise(b=>{u?.interpolate(H?.interpolate==="linear"?zt:Nn).scaleBy(cr(f,H?.duration,H?.ease,()=>b(!0)),z)}):Promise.resolve(!1)}function D(z){u?.scaleExtent(z)}function R(z){u?.translateExtent(z)}function L(z){const H=!Ee(z)||z<0?0:z;u?.clickDistance(H)}return{update:w,destroy:C,setViewport:y,setViewportConstrained:g,getViewport:_,scaleTo:I,scaleBy:E,setScaleExtent:D,setTranslateExtent:R,syncViewport:N,setClickDistance:L}}var Je;(function(e){e.Line="line",e.Handle="handle"})(Je||(Je={}));function wp({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function bp(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function He(e,t){return Math.max(0,t-e)}function Re(e,t){return Math.max(0,e-t)}function Yn(e,t,n){return Math.max(0,t-e,e-n)}function Wi(e,t){return e?!t:t}function vp(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:h}=t,u=d&&h,{xSnapped:f,ySnapped:p}=n,{minWidth:m,maxWidth:x,minHeight:w,maxHeight:C}=o,{x:g,y,width:N,height:_,aspectRatio:I}=e;let E=Math.floor(d?f-e.pointerX:0),D=Math.floor(h?p-e.pointerY:0);const R=N+(l?-E:E),L=_+(c?-D:D),z=-s[0]*N,H=-s[1]*_;let b=Yn(R,m,x),P=Yn(L,w,C);if(i){let O=0,$=0;l&&E<0?O=He(g+E+z,i[0][0]):!l&&E>0&&(O=Re(g+R+z,i[1][0])),c&&D<0?$=He(y+D+H,i[0][1]):!c&&D>0&&($=Re(y+L+H,i[1][1])),b=Math.max(b,O),P=Math.max(P,$)}if(a){let O=0,$=0;l&&E>0?O=Re(g+E,a[0][0]):!l&&E<0&&(O=He(g+R,a[1][0])),c&&D>0?$=Re(y+D,a[0][1]):!c&&D<0&&($=He(y+L,a[1][1])),b=Math.max(b,O),P=Math.max(P,$)}if(r){if(d){const O=Yn(R/I,w,C)*I;if(b=Math.max(b,O),i){let $=0;!l&&!c||l&&!c&&u?$=Re(y+H+R/I,i[1][1])*I:$=He(y+H+(l?E:-E)/I,i[0][1])*I,b=Math.max(b,$)}if(a){let $=0;!l&&!c||l&&!c&&u?$=He(y+R/I,a[1][1])*I:$=Re(y+(l?E:-E)/I,a[0][1])*I,b=Math.max(b,$)}}if(h){const O=Yn(L*I,m,x)/I;if(P=Math.max(P,O),i){let $=0;!l&&!c||c&&!l&&u?$=Re(g+L*I+z,i[1][0])/I:$=He(g+(c?D:-D)*I+z,i[0][0])/I,P=Math.max(P,$)}if(a){let $=0;!l&&!c||c&&!l&&u?$=He(g+L*I,a[1][0])/I:$=Re(g+(c?D:-D)*I,a[0][0])/I,P=Math.max(P,$)}}}D=D+(D<0?P:-P),E=E+(E<0?b:-b),r&&(u?R>L*I?D=(Wi(l,c)?-E:E)/I:E=(Wi(l,c)?-D:D)*I:d?(D=E/I,c=l):(E=D*I,l=c));const M=l?g+E:g,A=c?y+D:y;return{width:N+(l?-E:E),height:_+(c?-D:D),x:s[0]*E*(l?-1:1)+M,y:s[1]*D*(c?-1:1)+A}}const Yi={width:0,height:0,x:0,y:0},_p={...Yi,pointerX:0,pointerY:0,aspectRatio:1};function Sp(e){return[[0,0],[e.measured.width,e.measured.height]]}function Ep(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function Cp({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=be(e);function i({controlPosition:l,boundaries:c,keepAspectRatio:d,resizeDirection:h,onResizeStart:u,onResize:f,onResizeEnd:p,shouldResize:m}){let x={...Yi},w={..._p};const C=bp(l);let g,y=null,N=[],_,I,E;const D=Cs().on("start",R=>{const{nodeLookup:L,transform:z,snapGrid:H,snapToGrid:b,nodeOrigin:P,paneDomNode:M}=n();if(g=L.get(t),!g)return;y=M?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:O}=Zt(R.sourceEvent,{transform:z,snapGrid:H,snapToGrid:b,containerBounds:y});x={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},w={...x,pointerX:A,pointerY:O,aspectRatio:x.width/x.height},_=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=L.get(g.parentId),I=_&&g.extent==="parent"?Sp(_):void 0),N=[],E=void 0;for(const[$,S]of L)if(S.parentId===t&&(N.push({id:$,position:{...S.position},extent:S.extent}),S.extent==="parent"||S.expandParent)){const T=Ep(S,g,S.origin??P);E?E=[[Math.min(T[0][0],E[0][0]),Math.min(T[0][1],E[0][1])],[Math.max(T[1][0],E[1][0]),Math.max(T[1][1],E[1][1])]]:E=T}u?.(R,{...x})}).on("drag",R=>{const{transform:L,snapGrid:z,snapToGrid:H,nodeOrigin:b}=n(),P=Zt(R.sourceEvent,{transform:L,snapGrid:z,snapToGrid:H,containerBounds:y}),M=[];if(!g)return;const{x:A,y:O,width:$,height:S}=x,T={},j=g.origin??b,{width:B,height:F,x:Z,y:K}=vp(w,C,P,c,d,j,I,E),W=B!==$,V=F!==S,Y=Z!==A&&W,J=K!==O&&V;if(!Y&&!J&&!W&&!V)return;if((Y||J||j[0]===1||j[1]===1)&&(T.x=Y?Z:x.x,T.y=J?K:x.y,x.x=T.x,x.y=T.y,N.length>0)){const Q=Z-A,le=K-O;for(const he of N)he.position={x:he.position.x-Q+j[0]*(B-$),y:he.position.y-le+j[1]*(F-S)},M.push(he)}if((W||V)&&(T.width=W&&(!h||h==="horizontal")?B:x.width,T.height=V&&(!h||h==="vertical")?F:x.height,x.width=T.width,x.height=T.height),_&&g.expandParent){const Q=j[0]*(T.width??0);T.x&&T.x<Q&&(x.x=Q,w.x=w.x-(T.x-Q));const le=j[1]*(T.height??0);T.y&&T.y<le&&(x.y=le,w.y=w.y-(T.y-le))}const re=wp({width:x.width,prevWidth:$,height:x.height,prevHeight:S,affectsX:C.affectsX,affectsY:C.affectsY}),q={...x,direction:re};m?.(R,q)!==!1&&(f?.(R,q),o(T,M))}).on("end",R=>{p?.(R,{...x}),r?.({...x})});s.call(D)}function a(){s.on(".drag",null)}return{update:i,destroy:a}}var Gn={exports:{}},ur={},Xn={exports:{}},dr={};/**
22
+ <%s key={someKey} {...props} />`,B,R,Y,R),$[R+B]=!0)}if(R=null,H!==void 0&&(n(H),R=""+H),s(O)&&(n(O.key),R=""+O.key),"key"in O){H={};for(var ee in O)ee!=="key"&&(H[ee]=O[ee])}else H=O;return R&&a(H,typeof S=="function"?S.displayName||S.name||"Unknown":S),c(S,R,U,F,r(),H,K,W)}function f(S){typeof S=="object"&&S!==null&&S.$$typeof===h&&S._store&&(S._store.validated=1)}var u=T,h=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),m=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),j=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,L=Array.isArray,b=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(S){return S()}};var I,k={},A=u.react_stack_bottom_frame.bind(u,i)(),P=b(o(i)),$={};kt.Fragment=g,kt.jsx=function(S,O,H,B,F){var U=1e4>j.recentlyCreatedOwnerStacks++;return d(S,O,H,!1,B,F,U?Error("react-stack-top-frame"):A,U?b(o(S)):P)},kt.jsxs=function(S,O,H,B,F){var U=1e4>j.recentlyCreatedOwnerStacks++;return d(S,O,H,!0,B,F,U?Error("react-stack-top-frame"):A,U?b(o(S)):P)}}()),kt}var $r;function Gl(){return $r||($r=1,process.env.NODE_ENV==="production"?cn.exports=Yl():cn.exports=Xl()),cn.exports}var v=Gl();function jr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ul(...e){return t=>{let n=!1;const o=e.map(r=>{const i=jr(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<o.length;r++){const i=o[r];typeof i=="function"?i():jr(e[r],null)}}}}function ql(e){const t=Kl(e),n=pe.forwardRef((o,r)=>{const{children:i,...s}=o,a=pe.Children.toArray(i),l=a.find(Jl);if(l){const c=l.props.children,d=a.map(f=>f===l?pe.Children.count(c)>1?pe.Children.only(null):pe.isValidElement(c)?c.props.children:null:f);return v.jsx(t,{...s,ref:r,children:pe.isValidElement(c)?pe.cloneElement(c,void 0,d):null})}return v.jsx(t,{...s,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var Zl=ql("Slot");function Kl(e){const t=pe.forwardRef((n,o)=>{const{children:r,...i}=n;if(pe.isValidElement(r)){const s=tc(r),a=ec(i,r.props);return r.type!==pe.Fragment&&(a.ref=o?Ul(o,s):s),pe.cloneElement(r,a)}return pe.Children.count(r)>1?pe.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ql=Symbol("radix.slottable");function Jl(e){return pe.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ql}function ec(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function tc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Hr(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Hr(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Lr(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Hr(e))&&(o&&(o+=" "),o+=t);return o}const Vr=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Rr=Lr,nc=(e,t)=>n=>{var o;if(t?.variants==null)return Rr(e,n?.class,n?.className);const{variants:r,defaultVariants:i}=t,s=Object.keys(r).map(c=>{const d=n?.[c],f=i?.[c];if(d===null)return null;const u=Vr(d)||Vr(f);return r[c][u]}),a=n&&Object.entries(n).reduce((c,d)=>{let[f,u]=d;return u===void 0||(c[f]=u),c},{}),l=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((c,d)=>{let{class:f,className:u,...h}=d;return Object.entries(h).every(p=>{let[g,y]=p;return Array.isArray(y)?y.includes({...i,...a}[g]):{...i,...a}[g]===y})?[...c,f,u]:c},[]);return Rr(e,s,l,n?.class,n?.className)},po="-",oc=e=>{const t=ic(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{const a=s.split(po);return a[0]===""&&a.length!==1&&a.shift(),Br(a,t)||rc(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&o[s]?[...l,...o[s]]:l}}},Br=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),r=o?Br(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;const i=e.join(po);return t.validators.find(({validator:s})=>s(i))?.classGroupId},Fr=/^\[(.+)\]$/,rc=e=>{if(Fr.test(e)){const t=Fr.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},ic=e=>{const{theme:t,classGroups:n}=e,o={nextPart:new Map,validators:[]};for(const r in n)go(n[r],o,r,t);return o},go=(e,t,n,o)=>{e.forEach(r=>{if(typeof r=="string"){const i=r===""?t:Wr(t,r);i.classGroupId=n;return}if(typeof r=="function"){if(sc(r)){go(r(o),t,n,o);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,s])=>{go(s,Wr(t,i),n,o)})})},Wr=(e,t)=>{let n=e;return t.split(po).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},sc=e=>e.isThemeGetter,ac=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const r=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,o=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=o.get(i))!==void 0)return r(i,s),s},set(i,s){n.has(i)?n.set(i,s):r(i,s)}}},mo="!",yo=":",lc=yo.length,cc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const i=[];let s=0,a=0,l=0,c;for(let p=0;p<r.length;p++){let g=r[p];if(s===0&&a===0){if(g===yo){i.push(r.slice(l,p)),l=p+lc;continue}if(g==="/"){c=p;continue}}g==="["?s++:g==="]"?s--:g==="("?a++:g===")"&&a--}const d=i.length===0?r:r.substring(l),f=uc(d),u=f!==d,h=c&&c>l?c-l:void 0;return{modifiers:i,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:h}};if(t){const r=t+yo,i=o;o=s=>s.startsWith(r)?i(s.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(n){const r=o;o=i=>n({className:i,parseClassName:r})}return o},uc=e=>e.endsWith(mo)?e.substring(0,e.length-1):e.startsWith(mo)?e.substring(1):e,dc=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const r=[];let i=[];return o.forEach(s=>{s[0]==="["||t[s]?(r.push(...i.sort(),s),i=[]):i.push(s)}),r.push(...i.sort()),r}},fc=e=>({cache:ac(e.cacheSize),parseClassName:cc(e),sortModifiers:dc(e),...oc(e)}),hc=/\s+/,pc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:i}=t,s=[],a=e.trim().split(hc);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:f,modifiers:u,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}=n(d);if(f){l=d+(l.length>0?" "+l:l);continue}let y=!!g,w=o(y?p.substring(0,g):p);if(!w){if(!y){l=d+(l.length>0?" "+l:l);continue}if(w=o(p),!w){l=d+(l.length>0?" "+l:l);continue}y=!1}const _=i(u).join(":"),m=h?_+mo:_,x=m+w;if(s.includes(x))continue;s.push(x);const C=r(w,y);for(let E=0;E<C.length;++E){const M=C[E];s.push(m+M)}l=d+(l.length>0?" "+l:l)}return l};function gc(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Yr(t))&&(o&&(o+=" "),o+=n);return o}const Yr=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Yr(e[o]))&&(n&&(n+=" "),n+=t);return n};function mc(e,...t){let n,o,r,i=s;function s(l){const c=t.reduce((d,f)=>f(d),e());return n=fc(c),o=n.cache.get,r=n.cache.set,i=a,a(l)}function a(l){const c=o(l);if(c)return c;const d=pc(l,n);return r(l,d),d}return function(){return i(gc.apply(null,arguments))}}const de=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Xr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yc=/^\d+\/\d+$/,xc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_c=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ot=e=>yc.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),He=e=>!!e&&Number.isInteger(Number(e)),xo=e=>e.endsWith("%")&&te(e.slice(0,-1)),Oe=e=>xc.test(e),Ec=()=>!0,Sc=e=>wc.test(e)&&!bc.test(e),Ur=()=>!1,Nc=e=>vc.test(e),Cc=e=>_c.test(e),kc=e=>!X(e)&&!G(e),Tc=e=>rt(e,Jr,Ur),X=e=>Xr.test(e),Fe=e=>rt(e,ei,Sc),wo=e=>rt(e,Oc,te),qr=e=>rt(e,Kr,Ur),Mc=e=>rt(e,Qr,Cc),un=e=>rt(e,ti,Nc),G=e=>Gr.test(e),Tt=e=>it(e,ei),Ac=e=>it(e,Dc),Zr=e=>it(e,Kr),Ic=e=>it(e,Jr),Pc=e=>it(e,Qr),dn=e=>it(e,ti,!0),rt=(e,t,n)=>{const o=Xr.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},it=(e,t,n=!1)=>{const o=Gr.exec(e);return o?o[1]?t(o[1]):n:!1},Kr=e=>e==="position"||e==="percentage",Qr=e=>e==="image"||e==="url",Jr=e=>e==="length"||e==="size"||e==="bg-size",ei=e=>e==="length",Oc=e=>e==="number",Dc=e=>e==="family-name",ti=e=>e==="shadow",zc=mc(()=>{const e=de("color"),t=de("font"),n=de("text"),o=de("font-weight"),r=de("tracking"),i=de("leading"),s=de("breakpoint"),a=de("container"),l=de("spacing"),c=de("radius"),d=de("shadow"),f=de("inset-shadow"),u=de("text-shadow"),h=de("drop-shadow"),p=de("blur"),g=de("perspective"),y=de("aspect"),w=de("ease"),_=de("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...x(),G,X],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],N=()=>[G,X,l],z=()=>[ot,"full","auto",...N()],V=()=>[He,"none","subgrid",G,X],j=()=>["auto",{span:["full",He,G,X]},He,G,X],D=()=>[He,"auto",G,X],L=()=>["auto","min","max","fr",G,X],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...N()],A=()=>[ot,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],P=()=>[e,G,X],$=()=>[...x(),Zr,qr,{position:[G,X]}],S=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",Ic,Tc,{size:[G,X]}],H=()=>[xo,Tt,Fe],B=()=>["","none","full",c,G,X],F=()=>["",te,Tt,Fe],U=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[te,xo,Zr,qr],R=()=>["","none",p,G,X],Y=()=>["none",te,G,X],ee=()=>["none",te,G,X],re=()=>[te,G,X],Z=()=>[ot,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Oe],breakpoint:[Oe],color:[Ec],container:[Oe],"drop-shadow":[Oe],ease:["in","out","in-out"],font:[kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Oe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Oe],shadow:[Oe],spacing:["px",te],text:[Oe],"text-shadow":[Oe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ot,X,G,y]}],container:["container"],columns:[{columns:[te,X,G,a]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[He,"auto",G,X]}],basis:[{basis:[ot,"full","auto",a,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,ot,"auto","initial","none",X]}],grow:[{grow:["",te,G,X]}],shrink:[{shrink:["",te,G,X]}],order:[{order:[He,"first","last","none",G,X]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...b(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[a,"screen",...A()]}],"min-w":[{"min-w":[a,"screen","none",...A()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,Tt,Fe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,G,wo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xo,X]}],"font-family":[{font:[Ac,X,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,G,X]}],"line-clamp":[{"line-clamp":[te,"none",G,wo]}],leading:[{leading:[i,...N()]}],"list-image":[{"list-image":["none",G,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",G,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",G,Fe]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[te,"auto",G,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:S()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},He,G,X],radial:["",G,X],conic:[He,G,X]},Pc,Mc]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[te,G,X]}],"outline-w":[{outline:["",te,Tt,Fe]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,dn,un]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",f,dn,un]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[te,Fe]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",u,dn,un]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[te,G,X]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[te]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[G,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[te]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:S()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",G,X]}],filter:[{filter:["","none",G,X]}],blur:[{blur:R()}],brightness:[{brightness:[te,G,X]}],contrast:[{contrast:[te,G,X]}],"drop-shadow":[{"drop-shadow":["","none",h,dn,un]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",te,G,X]}],"hue-rotate":[{"hue-rotate":[te,G,X]}],invert:[{invert:["",te,G,X]}],saturate:[{saturate:[te,G,X]}],sepia:[{sepia:["",te,G,X]}],"backdrop-filter":[{"backdrop-filter":["","none",G,X]}],"backdrop-blur":[{"backdrop-blur":R()}],"backdrop-brightness":[{"backdrop-brightness":[te,G,X]}],"backdrop-contrast":[{"backdrop-contrast":[te,G,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,G,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,G,X]}],"backdrop-invert":[{"backdrop-invert":["",te,G,X]}],"backdrop-opacity":[{"backdrop-opacity":[te,G,X]}],"backdrop-saturate":[{"backdrop-saturate":[te,G,X]}],"backdrop-sepia":[{"backdrop-sepia":["",te,G,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",G,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",G,X]}],ease:[{ease:["linear","initial",w,G,X]}],delay:[{delay:[te,G,X]}],animate:[{animate:["none",_,G,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,G,X]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[G,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G,X]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[te,Tt,Fe,wo]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ie(...e){return zc(Lr(e))}const $c=nc("inline-flex items-center justify-center gap-2 py-2 px-4 rounded-md transition-all text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white disabled:cursor-not-allowed outline-none focus-visible:outline-none border",{variants:{color:{dark:"bg-secondary-black border-secondary-dark-gray",lightNonPriority:"bg-primary-gray border-transparent",lightPriority:"bg-primary-gray border-transparent",lightParentGroupBasedHover:"bg-primary-gray border-transparent"},applyHoverStyles:{true:"",false:""}},defaultVariants:{color:"dark",applyHoverStyles:!0},compoundVariants:[{color:"dark",applyHoverStyles:!0,className:"hover:bg-primary-dark-gray"},{color:"lightNonPriority",applyHoverStyles:!0,className:"hover:bg-secondary-light-gray-as-transparent-overlay-over-primary-gray"},{color:"lightPriority",applyHoverStyles:!0,className:"hover:bg-primary-light-gray-as-transparent-overlay-over-primary-gray"},{color:"lightParentGroupBasedHover",applyHoverStyles:!0,className:"hover:bg-primary-light-gray-as-transparent-overlay-over-primary-gray group-hover/lightParentGroupBasedHover:bg-secondary-light-gray-as-transparent-overlay-over-primary-gray"}]}),st=T.forwardRef(({className:e,color:t,asChild:n=!1,applyHoverStyles:o,...r},i)=>{const s=n?Zl:"button";return v.jsx(s,{ref:i,"data-slot":"button",className:ie($c({color:t,className:e,applyHoverStyles:o})),...r})});st.displayName="Button";function bo(e,t,n,o=!1,r=!1){if(t>n){const i=t;t=n,n=i}return(o?e>=t:e>t)&&(r?e<=n:e<n)}function ni(e,t,n=!1,o=!1){return bo(e.x,t.left,t.right,n)&&bo(e.y,t.top,t.bottom,o)}function oi(e){const t=e.startsWith("-"),n=e.replaceAll(/[^0-9\.]/g,""),o=n.indexOf(".");let r=0;if(o===-1)r=Number(n);else{const i=n.substring(0,o).replaceAll(/[^0-9]/g,""),s=n.substring(o+1).replaceAll(/[^0-9]/g,"");r=+(i+"."+s)}return t&&(r=-r),r}function vo(e,t){return e.toFixed(t).replace(/[0]+$/,"").replace(/\.$/,"")}const ke=["string","number","complex","noEquivalent","inferFromConnection"],ri={[ke[0]]:ke[0],[ke[1]]:ke[1],[ke[2]]:ke[2],[ke[3]]:ke[3],[ke[4]]:ke[4]};function jc(e){return!!ri[e]}function Hc(e){return e}function Lc(e,t){return e in t}function Vc(e){return e}function Rc(e,t){return e in t}function Bc(e){return e}function Fc(e){return e}function Wc(e){return e}var ii=Symbol.for("immer-nothing"),si=Symbol.for("immer-draftable"),xe=Symbol.for("immer-state"),Yc=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function ge(e,...t){if(process.env.NODE_ENV!=="production"){const n=Yc[e],o=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var at=Object.getPrototypeOf;function lt(e){return!!e&&!!e[xe]}function We(e){return e?ai(e)||Array.isArray(e)||!!e[si]||!!e.constructor?.[si]||Mt(e)||pn(e):!1}var Xc=Object.prototype.constructor.toString();function ai(e){if(!e||typeof e!="object")return!1;const t=at(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Xc}function fn(e,t){hn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function hn(e){const t=e[xe];return t?t.type_:Array.isArray(e)?1:Mt(e)?2:pn(e)?3:0}function _o(e,t){return hn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function li(e,t,n){const o=hn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Gc(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mt(e){return e instanceof Map}function pn(e){return e instanceof Set}function Ye(e){return e.copy_||e.base_}function Eo(e,t){if(Mt(e))return new Map(e);if(pn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ai(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[xe];let r=Reflect.ownKeys(o);for(let i=0;i<r.length;i++){const s=r[i],a=o[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(o[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(at(e),o)}else{const o=at(e);if(o!==null&&n)return{...e};const r=Object.create(o);return Object.assign(r,e)}}function So(e,t=!1){return mn(e)||lt(e)||!We(e)||(hn(e)>1&&Object.defineProperties(e,{set:{value:gn},add:{value:gn},clear:{value:gn},delete:{value:gn}}),Object.freeze(e),t&&Object.values(e).forEach(n=>So(n,!0))),e}function gn(){ge(2)}function mn(e){return Object.isFrozen(e)}var Uc={};function Xe(e){const t=Uc[e];return t||ge(0,e),t}var At;function ci(){return At}function qc(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ui(e,t){t&&(Xe("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function No(e){Co(e),e.drafts_.forEach(Zc),e.drafts_=null}function Co(e){e===At&&(At=e.parent_)}function di(e){return At=qc(At,e)}function Zc(e){const t=e[xe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xe].modified_&&(No(t),ge(4)),We(e)&&(e=yn(t,e),t.parent_||xn(t,e)),t.patches_&&Xe("Patches").generateReplacementPatches_(n[xe].base_,e,t.patches_,t.inversePatches_)):e=yn(t,n,[]),No(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ii?e:void 0}function yn(e,t,n){if(mn(t))return t;const o=t[xe];if(!o)return fn(t,(r,i)=>hi(e,o,t,r,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return xn(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const r=o.copy_;let i=r,s=!1;o.type_===3&&(i=new Set(r),r.clear(),s=!0),fn(i,(a,l)=>hi(e,o,r,a,l,n,s)),xn(e,r,!1),n&&e.patches_&&Xe("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function hi(e,t,n,o,r,i,s){if(process.env.NODE_ENV!=="production"&&r===n&&ge(5),lt(r)){const a=i&&t&&t.type_!==3&&!_o(t.assigned_,o)?i.concat(o):void 0,l=yn(e,r,a);if(li(n,o,l),lt(l))e.canAutoFreeze_=!1;else return}else s&&n.add(r);if(We(r)&&!mn(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yn(e,r),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(Mt(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&xn(e,r)}}function xn(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&So(t,n)}function Kc(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:ci(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=ko;n&&(r=[o],i=It);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}var ko={get(e,t){if(t===xe)return e;const n=Ye(e);if(!_o(n,t))return Qc(e,n,t);const o=n[t];return e.finalized_||!We(o)?o:o===To(e.base_,t)?(Ao(e),e.copy_[t]=Io(o,e)):o},has(e,t){return t in Ye(e)},ownKeys(e){return Reflect.ownKeys(Ye(e))},set(e,t,n){const o=pi(Ye(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const r=To(Ye(e),t),i=r?.[xe];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Gc(n,r)&&(n!==void 0||_o(e.base_,t)))return!0;Ao(e),Mo(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return To(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ao(e),Mo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Ye(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){ge(11)},getPrototypeOf(e){return at(e.base_)},setPrototypeOf(){ge(12)}},It={};fn(ko,(e,t)=>{It[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),It.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ge(13),It.set.call(this,e,t,void 0)},It.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ge(14),ko.set.call(this,e[0],t,n,e[0])};function To(e,t){const n=e[xe];return(n?Ye(n):e)[t]}function Qc(e,t,n){const o=pi(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}function pi(e,t){if(!(t in e))return;let n=at(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=at(n)}}function Mo(e){e.modified_||(e.modified_=!0,e.parent_&&Mo(e.parent_))}function Ao(e){e.copy_||(e.copy_=Eo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jc=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...c){return s.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&ge(6),o!==void 0&&typeof o!="function"&&ge(7);let r;if(We(t)){const i=di(this),s=Io(t,void 0);let a=!0;try{r=n(s),a=!1}finally{a?No(i):Co(i)}return ui(i,o),fi(r,i)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===ii&&(r=void 0),this.autoFreeze_&&So(r,!0),o){const i=[],s=[];Xe("Patches").generateReplacementPatches_(t,r,i,s),o(i,s)}return r}else ge(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let o,r;return[this.produce(t,n,(s,a)=>{o=s,r=a}),o,r]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){We(e)||ge(8),lt(e)&&(e=eu(e));const t=di(this),n=Io(e,void 0);return n[xe].isManual_=!0,Co(t),n}finishDraft(e,t){const n=e&&e[xe];(!n||!n.isManual_)&&ge(9);const{scope_:o}=n;return ui(o,t),fi(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}n>-1&&(t=t.slice(n+1));const o=Xe("Patches").applyPatches_;return lt(e)?o(e,t):this.produce(e,r=>o(r,t))}};function Io(e,t){const n=Mt(e)?Xe("MapSet").proxyMap_(e,t):pn(e)?Xe("MapSet").proxySet_(e,t):Kc(e,t);return(t?t.scope_:ci()).drafts_.push(n),n}function eu(e){return lt(e)||ge(10,e),gi(e)}function gi(e){if(!We(e)||mn(e))return e;const t=e[xe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Eo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Eo(e,!0);return fn(n,(o,r)=>{li(n,o,gi(r))}),t&&(t.finalized_=!1),n}var tu=new Jc,nu=tu.produce;function ct(e){const t=[];for(let o=0;o<Math.floor(e/8);o++)t.push(Math.random().toString(36).substring(2,10));return t.push(Math.random().toString(36).substring(2,e%8+2)),t.join("")}function ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ue(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ou={value:()=>{}};function wn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new bn(n)}function bn(e){this._=e}function ru(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}bn.prototype=wn.prototype={constructor:bn,on:function(e,t){var n=this._,o=ru(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=iu(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=mi(n[r],e.name,t);else if(t==null)for(r in n)n[r]=mi(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new bn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function iu(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function mi(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ou,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Po="http://www.w3.org/1999/xhtml";const yi={svg:"http://www.w3.org/2000/svg",xhtml:Po,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),yi.hasOwnProperty(t)?{space:yi[t],local:e}:e}function su(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Po&&t.documentElement.namespaceURI===Po?t.createElement(e):t.createElementNS(n,e)}}function au(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xi(e){var t=vn(e);return(t.local?au:su)(t)}function lu(){}function Oo(e){return e==null?lu:function(){return this.querySelector(e)}}function cu(e){typeof e!="function"&&(e=Oo(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new we(o,this._parents)}function uu(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function du(){return[]}function wi(e){return e==null?du:function(){return this.querySelectorAll(e)}}function fu(e){return function(){return uu(e.apply(this,arguments))}}function hu(e){typeof e=="function"?e=fu(e):e=wi(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new we(o,r)}function bi(e){return function(){return this.matches(e)}}function vi(e){return function(t){return t.matches(e)}}var pu=Array.prototype.find;function gu(e){return function(){return pu.call(this.children,e)}}function mu(){return this.firstElementChild}function yu(e){return this.select(e==null?mu:gu(typeof e=="function"?e:vi(e)))}var xu=Array.prototype.filter;function wu(){return Array.from(this.children)}function bu(e){return function(){return xu.call(this.children,e)}}function vu(e){return this.selectAll(e==null?wu:bu(typeof e=="function"?e:vi(e)))}function _u(e){typeof e!="function"&&(e=bi(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new we(o,this._parents)}function _i(e){return new Array(e.length)}function Eu(){return new we(this._enter||this._groups.map(_i),this._parents)}function _n(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_n.prototype={constructor:_n,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Su(e){return function(){return e}}function Nu(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new _n(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Cu(e,t,n,o,r,i,s){var a,l,c=new Map,d=t.length,f=i.length,u=new Array(d),h;for(a=0;a<d;++a)(l=t[a])&&(u[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new _n(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function ku(e){return e.__data__}function Tu(e,t){if(!arguments.length)return Array.from(this,ku);var n=t?Cu:Nu,o=this._parents,r=this._groups;typeof e!="function"&&(e=Su(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],f=r[c],u=f.length,h=Mu(e.call(d,d&&d.__data__,c,o)),p=h.length,g=a[c]=new Array(p),y=s[c]=new Array(p),w=l[c]=new Array(u);n(d,f,g,y,w,h,t);for(var _=0,m=0,x,C;_<p;++_)if(x=g[_]){for(_>=m&&(m=_+1);!(C=y[m])&&++m<p;);x._next=C||null}}return s=new we(s,o),s._enter=a,s._exit=l,s}function Mu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Au(){return new we(this._exit||this._groups.map(_i),this._parents)}function Iu(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Pu(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],d=o[l],f=c.length,u=a[l]=new Array(f),h,p=0;p<f;++p)(h=c[p]||d[p])&&(u[p]=h);for(;l<r;++l)a[l]=n[l];return new we(a,this._parents)}function Ou(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Du(e){e||(e=zu);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new we(r,this._parents).order()}function zu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $u(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ju(){return Array.from(this)}function Hu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Lu(){let e=0;for(const t of this)++e;return e}function Vu(){return!this.node()}function Ru(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Bu(e){return function(){this.removeAttribute(e)}}function Fu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wu(e,t){return function(){this.setAttribute(e,t)}}function Yu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Gu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Uu(e,t){var n=vn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Fu:Bu:typeof t=="function"?n.local?Gu:Xu:n.local?Yu:Wu)(n,t))}function Ei(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function qu(e){return function(){this.style.removeProperty(e)}}function Zu(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ku(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Qu(e,t,n){return arguments.length>1?this.each((t==null?qu:typeof t=="function"?Ku:Zu)(e,t,n??"")):ut(this.node(),e)}function ut(e,t){return e.style.getPropertyValue(t)||Ei(e).getComputedStyle(e,null).getPropertyValue(t)}function Ju(e){return function(){delete this[e]}}function ed(e,t){return function(){this[e]=t}}function td(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nd(e,t){return arguments.length>1?this.each((t==null?Ju:typeof t=="function"?td:ed)(e,t)):this.node()[e]}function Si(e){return e.trim().split(/^|\s+/)}function Do(e){return e.classList||new Ni(e)}function Ni(e){this._node=e,this._names=Si(e.getAttribute("class")||"")}Ni.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ci(e,t){for(var n=Do(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ki(e,t){for(var n=Do(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function od(e){return function(){Ci(this,e)}}function rd(e){return function(){ki(this,e)}}function id(e,t){return function(){(t.apply(this,arguments)?Ci:ki)(this,e)}}function sd(e,t){var n=Si(e+"");if(arguments.length<2){for(var o=Do(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?id:t?od:rd)(n,t))}function ad(){this.textContent=""}function ld(e){return function(){this.textContent=e}}function cd(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ud(e){return arguments.length?this.each(e==null?ad:(typeof e=="function"?cd:ld)(e)):this.node().textContent}function dd(){this.innerHTML=""}function fd(e){return function(){this.innerHTML=e}}function hd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function pd(e){return arguments.length?this.each(e==null?dd:(typeof e=="function"?hd:fd)(e)):this.node().innerHTML}function gd(){this.nextSibling&&this.parentNode.appendChild(this)}function md(){return this.each(gd)}function yd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xd(){return this.each(yd)}function wd(e){var t=typeof e=="function"?e:xi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function bd(){return null}function vd(e,t){var n=typeof e=="function"?e:xi(e),o=t==null?bd:typeof t=="function"?t:Oo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function _d(){var e=this.parentNode;e&&e.removeChild(this)}function Ed(){return this.each(_d)}function Sd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cd(e){return this.select(e?Nd:Sd)}function kd(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Td(e){return function(t){e.call(this,t,this.__data__)}}function Md(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ad(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Id(e,t,n){return function(){var o=this.__on,r,i=Td(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Pd(e,t,n){var o=Md(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Id:Ad,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Ti(e,t,n){var o=Ei(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Od(e,t){return function(){return Ti(this,e,t)}}function Dd(e,t){return function(){return Ti(this,e,t.apply(this,arguments))}}function zd(e,t){return this.each((typeof t=="function"?Dd:Od)(e,t))}function*$d(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Mi=[null];function we(e,t){this._groups=e,this._parents=t}function Pt(){return new we([[document.documentElement]],Mi)}function jd(){return this}we.prototype=Pt.prototype={constructor:we,select:cu,selectAll:hu,selectChild:yu,selectChildren:vu,filter:_u,data:Tu,enter:Eu,exit:Au,join:Iu,merge:Pu,selection:jd,order:Ou,sort:Du,call:$u,nodes:ju,node:Hu,size:Lu,empty:Vu,each:Ru,attr:Uu,style:Qu,property:nd,classed:sd,text:ud,html:pd,raise:md,lower:xd,append:wd,insert:vd,remove:Ed,clone:Cd,datum:kd,on:Pd,dispatch:zd,[Symbol.iterator]:$d};function be(e){return typeof e=="string"?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],Mi)}function Hd(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=Hd(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ld={passive:!1},Ot={capture:!0,passive:!1};function zo(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ai(e){var t=e.document.documentElement,n=be(e).on("dragstart.drag",dt,Ot);"onselectstart"in t?n.on("selectstart.drag",dt,Ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ii(e,t){var n=e.document.documentElement,o=be(e).on("dragstart.drag",null);t&&(o.on("click.drag",dt,Ot),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const En=e=>()=>e;function $o(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}$o.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Vd(e){return!e.ctrlKey&&!e.button}function Rd(){return this.parentNode}function Bd(e,t){return t??{x:e.x,y:e.y}}function Fd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pi(){var e=Vd,t=Rd,n=Bd,o=Fd,r={},i=wn("start","drag","end"),s=0,a,l,c,d,f=0;function u(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",w,Ld).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,C){if(!(d||!e.call(this,x,C))){var E=m(this,t.call(this,x,C),x,C,"mouse");E&&(be(x.view).on("mousemove.drag",p,Ot).on("mouseup.drag",g,Ot),Ai(x.view),zo(x),c=!1,a=x.clientX,l=x.clientY,E("start",x))}}function p(x){if(dt(x),!c){var C=x.clientX-a,E=x.clientY-l;c=C*C+E*E>f}r.mouse("drag",x)}function g(x){be(x.view).on("mousemove.drag mouseup.drag",null),Ii(x.view,c),dt(x),r.mouse("end",x)}function y(x,C){if(e.call(this,x,C)){var E=x.changedTouches,M=t.call(this,x,C),N=E.length,z,V;for(z=0;z<N;++z)(V=m(this,M,x,C,E[z].identifier,E[z]))&&(zo(x),V("start",x,E[z]))}}function w(x){var C=x.changedTouches,E=C.length,M,N;for(M=0;M<E;++M)(N=r[C[M].identifier])&&(dt(x),N("drag",x,C[M]))}function _(x){var C=x.changedTouches,E=C.length,M,N;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<E;++M)(N=r[C[M].identifier])&&(zo(x),N("end",x,C[M]))}function m(x,C,E,M,N,z){var V=i.copy(),j=_e(z||E,C),D,L,b;if((b=n.call(x,new $o("beforestart",{sourceEvent:E,target:u,identifier:N,active:s,x:j[0],y:j[1],dx:0,dy:0,dispatch:V}),M))!=null)return D=b.x-j[0]||0,L=b.y-j[1]||0,function I(k,A,P){var $=j,S;switch(k){case"start":r[N]=I,S=s++;break;case"end":delete r[N],--s;case"drag":j=_e(P||A,C),S=s;break}V.call(k,x,new $o(k,{sourceEvent:A,subject:b,target:u,identifier:N,active:S,x:j[0]+D,y:j[1]+L,dx:j[0]-$[0],dy:j[1]-$[1],dispatch:V}),M)}}return u.filter=function(x){return arguments.length?(e=typeof x=="function"?x:En(!!x),u):e},u.container=function(x){return arguments.length?(t=typeof x=="function"?x:En(x),u):t},u.subject=function(x){return arguments.length?(n=typeof x=="function"?x:En(x),u):n},u.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:En(!!x),u):o},u.on=function(){var x=i.on.apply(i,arguments);return x===i?u:x},u.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,u):Math.sqrt(f)},u}function jo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Oi(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Dt(){}var zt=.7,Sn=1/zt,ft="\\s*([+-]?\\d+)\\s*",$t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Te="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Wd=/^#([0-9a-f]{3,8})$/,Yd=new RegExp(`^rgb\\(${ft},${ft},${ft}\\)$`),Xd=new RegExp(`^rgb\\(${Te},${Te},${Te}\\)$`),Gd=new RegExp(`^rgba\\(${ft},${ft},${ft},${$t}\\)$`),Ud=new RegExp(`^rgba\\(${Te},${Te},${Te},${$t}\\)$`),qd=new RegExp(`^hsl\\(${$t},${Te},${Te}\\)$`),Zd=new RegExp(`^hsla\\(${$t},${Te},${Te},${$t}\\)$`),Di={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};jo(Dt,Ge,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zi,formatHex:zi,formatHex8:Kd,formatHsl:Qd,formatRgb:$i,toString:$i});function zi(){return this.rgb().formatHex()}function Kd(){return this.rgb().formatHex8()}function Qd(){return Ri(this).formatHsl()}function $i(){return this.rgb().formatRgb()}function Ge(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Wd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ji(t):n===3?new me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Nn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Nn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Yd.exec(e))?new me(t[1],t[2],t[3],1):(t=Xd.exec(e))?new me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Gd.exec(e))?Nn(t[1],t[2],t[3],t[4]):(t=Ud.exec(e))?Nn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qd.exec(e))?Vi(t[1],t[2]/100,t[3]/100,1):(t=Zd.exec(e))?Vi(t[1],t[2]/100,t[3]/100,t[4]):Di.hasOwnProperty(e)?ji(Di[e]):e==="transparent"?new me(NaN,NaN,NaN,0):null}function ji(e){return new me(e>>16&255,e>>8&255,e&255,1)}function Nn(e,t,n,o){return o<=0&&(e=t=n=NaN),new me(e,t,n,o)}function Jd(e){return e instanceof Dt||(e=Ge(e)),e?(e=e.rgb(),new me(e.r,e.g,e.b,e.opacity)):new me}function Ho(e,t,n,o){return arguments.length===1?Jd(e):new me(e,t,n,o??1)}function me(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}jo(me,Ho,Oi(Dt,{brighter(e){return e=e==null?Sn:Math.pow(Sn,e),new me(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zt:Math.pow(zt,e),new me(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new me(Ue(this.r),Ue(this.g),Ue(this.b),Cn(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:Hi,formatHex:Hi,formatHex8:ef,formatRgb:Li,toString:Li}));function Hi(){return`#${qe(this.r)}${qe(this.g)}${qe(this.b)}`}function ef(){return`#${qe(this.r)}${qe(this.g)}${qe(this.b)}${qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Li(){const e=Cn(this.opacity);return`${e===1?"rgb(":"rgba("}${Ue(this.r)}, ${Ue(this.g)}, ${Ue(this.b)}${e===1?")":`, ${e})`}`}function Cn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ue(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qe(e){return e=Ue(e),(e<16?"0":"")+e.toString(16)}function Vi(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ee(e,t,n,o)}function Ri(e){if(e instanceof Ee)return new Ee(e.h,e.s,e.l,e.opacity);if(e instanceof Dt||(e=Ge(e)),!e)return new Ee;if(e instanceof Ee)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Ee(s,a,l,e.opacity)}function tf(e,t,n,o){return arguments.length===1?Ri(e):new Ee(e,t,n,o??1)}function Ee(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}jo(Ee,tf,Oi(Dt,{brighter(e){return e=e==null?Sn:Math.pow(Sn,e),new Ee(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zt:Math.pow(zt,e),new Ee(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new me(Lo(e>=240?e-240:e+120,r,o),Lo(e,r,o),Lo(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Ee(Bi(this.h),kn(this.s),kn(this.l),Cn(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=Cn(this.opacity);return`${e===1?"hsl(":"hsla("}${Bi(this.h)}, ${kn(this.s)*100}%, ${kn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bi(e){return e=(e||0)%360,e<0?e+360:e}function kn(e){return Math.max(0,Math.min(1,e||0))}function Lo(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Vo=e=>()=>e;function nf(e,t){return function(n){return e+n*t}}function of(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function rf(e){return(e=+e)==1?Fi:function(t,n){return n-t?of(t,n,e):Vo(isNaN(t)?n:t)}}function Fi(e,t){var n=t-e;return n?nf(e,n):Vo(isNaN(e)?t:e)}const Tn=function e(t){var n=rf(t);function o(r,i){var s=n((r=Ho(r)).r,(i=Ho(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=Fi(r.opacity,i.opacity);return function(d){return r.r=s(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return o.gamma=e,o}(1);function sf(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function af(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function lf(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=jt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function cf(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Me(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uf(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=jt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Ro=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bo=new RegExp(Ro.source,"g");function df(e){return function(){return e}}function ff(e){return function(t){return e(t)+""}}function Wi(e,t){var n=Ro.lastIndex=Bo.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Ro.exec(e))&&(r=Bo.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:Me(o,r)})),n=Bo.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?ff(l[0].x):df(t):(t=l.length,function(c){for(var d=0,f;d<t;++d)a[(f=l[d]).i]=f.x(c);return a.join("")})}function jt(e,t){var n=typeof t,o;return t==null||n==="boolean"?Vo(t):(n==="number"?Me:n==="string"?(o=Ge(t))?(t=o,Tn):Wi:t instanceof Ge?Tn:t instanceof Date?cf:af(t)?sf:Array.isArray(t)?lf:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?uf:Me)(e,t)}var Yi=180/Math.PI,Fo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Xi(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Yi,skewX:Math.atan(l)*Yi,scaleX:s,scaleY:a}}var Mn;function hf(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fo:Xi(t.a,t.b,t.c,t.d,t.e,t.f)}function pf(e){return e==null||(Mn||(Mn=document.createElementNS("http://www.w3.org/2000/svg","g")),Mn.setAttribute("transform",e),!(e=Mn.transform.baseVal.consolidate()))?Fo:(e=e.matrix,Xi(e.a,e.b,e.c,e.d,e.e,e.f))}function Gi(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,d,f,u,h,p){if(c!==f||d!==u){var g=h.push("translate(",null,t,null,n);p.push({i:g-4,x:Me(c,f)},{i:g-2,x:Me(d,u)})}else(f||u)&&h.push("translate("+f+t+u+n)}function s(c,d,f,u){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),u.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Me(c,d)})):d&&f.push(r(f)+"rotate("+d+o)}function a(c,d,f,u){c!==d?u.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Me(c,d)}):d&&f.push(r(f)+"skewX("+d+o)}function l(c,d,f,u,h,p){if(c!==f||d!==u){var g=h.push(r(h)+"scale(",null,",",null,")");p.push({i:g-4,x:Me(c,f)},{i:g-2,x:Me(d,u)})}else(f!==1||u!==1)&&h.push(r(h)+"scale("+f+","+u+")")}return function(c,d){var f=[],u=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,f,u),s(c.rotate,d.rotate,f,u),a(c.skewX,d.skewX,f,u),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,u),c=d=null,function(h){for(var p=-1,g=u.length,y;++p<g;)f[(y=u[p]).i]=y.x(h);return f.join("")}}}var gf=Gi(hf,"px, ","px)","deg)"),mf=Gi(pf,", ",")",")"),yf=1e-12;function Ui(e){return((e=Math.exp(e))+1/e)/2}function xf(e){return((e=Math.exp(e))-1/e)/2}function wf(e){return((e=Math.exp(2*e))-1)/(e+1)}const An=function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],d=s[0],f=s[1],u=s[2],h=d-a,p=f-l,g=h*h+p*p,y,w;if(g<yf)w=Math.log(u/c)/t,y=function(M){return[a+M*h,l+M*p,c*Math.exp(t*M*w)]};else{var _=Math.sqrt(g),m=(u*u-c*c+o*g)/(2*c*n*_),x=(u*u-c*c-o*g)/(2*u*n*_),C=Math.log(Math.sqrt(m*m+1)-m),E=Math.log(Math.sqrt(x*x+1)-x);w=(E-C)/t,y=function(M){var N=M*w,z=Ui(C),V=c/(n*_)*(z*wf(t*N+C)-xf(C));return[a+V*h,l+V*p,c*z/Ui(t*N+C)]}}return y.duration=w*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r}(Math.SQRT2,2,4);var ht=0,Ht=0,Lt=0,qi=1e3,In,Vt,Pn=0,Ze=0,On=0,Rt=typeof performance=="object"&&performance.now?performance:Date,Zi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wo(){return Ze||(Zi(bf),Ze=Rt.now()+On)}function bf(){Ze=0}function Dn(){this._call=this._time=this._next=null}Dn.prototype=Ki.prototype={constructor:Dn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Wo():+n)+(t==null?0:+t),!this._next&&Vt!==this&&(Vt?Vt._next=this:In=this,Vt=this),this._call=e,this._time=n,Yo()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yo())}};function Ki(e,t,n){var o=new Dn;return o.restart(e,t,n),o}function vf(){Wo(),++ht;for(var e=In,t;e;)(t=Ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ht}function Qi(){Ze=(Pn=Rt.now())+On,ht=Ht=0;try{vf()}finally{ht=0,Ef(),Ze=0}}function _f(){var e=Rt.now(),t=e-Pn;t>qi&&(On-=t,Pn=e)}function Ef(){for(var e,t=In,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:In=n);Vt=e,Yo(o)}function Yo(e){if(!ht){Ht&&(Ht=clearTimeout(Ht));var t=e-Ze;t>24?(e<1/0&&(Ht=setTimeout(Qi,e-Rt.now()-On)),Lt&&(Lt=clearInterval(Lt))):(Lt||(Pn=Rt.now(),Lt=setInterval(_f,qi)),ht=1,Zi(Qi))}}function Ji(e,t,n){var o=new Dn;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Sf=wn("start","end","cancel","interrupt"),Nf=[],es=0,ts=1,Xo=2,zn=3,ns=4,Go=5,$n=6;function jn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Cf(e,n,{name:t,index:o,group:r,on:Sf,tween:Nf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:es})}function Uo(e,t){var n=Se(e,t);if(n.state>es)throw new Error("too late; already scheduled");return n}function Ae(e,t){var n=Se(e,t);if(n.state>zn)throw new Error("too late; already running");return n}function Se(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Cf(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Ki(i,0,n.time);function i(c){n.state=ts,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var d,f,u,h;if(n.state!==ts)return l();for(d in o)if(h=o[d],h.name===n.name){if(h.state===zn)return Ji(s);h.state===ns?(h.state=$n,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=$n,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(Ji(function(){n.state===zn&&(n.state=ns,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Xo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xo){for(n.state=zn,r=new Array(u=n.tween.length),d=0,f=-1;d<u;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Go,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);n.state===Go&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=$n,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Hn(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Xo&&o.state<Go,o.state=$n,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function kf(e){return this.each(function(){Hn(this,e)})}function Tf(e,t){var n,o;return function(){var r=Ae(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Mf(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Ae(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Af(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Se(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Tf:Mf)(n,e,t))}function qo(e,t,n){var o=e._id;return e.each(function(){var r=Ae(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Se(r,o).value[t]}}function os(e,t){var n;return(typeof t=="number"?Me:t instanceof Ge?Tn:(n=Ge(t))?(t=n,Tn):Wi)(e,t)}function If(e){return function(){this.removeAttribute(e)}}function Pf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Of(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Df(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function zf(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function $f(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function jf(e,t){var n=vn(e),o=n==="transform"?mf:os;return this.attrTween(e,typeof t=="function"?(n.local?$f:zf)(n,o,qo(this,"attr."+e,t)):t==null?(n.local?Pf:If)(n):(n.local?Df:Of)(n,o,t))}function Hf(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Lf(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Vf(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Lf(e,i)),n}return r._value=t,r}function Rf(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Hf(e,i)),n}return r._value=t,r}function Bf(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=vn(e);return this.tween(n,(o.local?Vf:Rf)(o,t))}function Ff(e,t){return function(){Uo(this,e).delay=+t.apply(this,arguments)}}function Wf(e,t){return t=+t,function(){Uo(this,e).delay=t}}function Yf(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ff:Wf)(t,e)):Se(this.node(),t).delay}function Xf(e,t){return function(){Ae(this,e).duration=+t.apply(this,arguments)}}function Gf(e,t){return t=+t,function(){Ae(this,e).duration=t}}function Uf(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Xf:Gf)(t,e)):Se(this.node(),t).duration}function qf(e,t){if(typeof t!="function")throw new Error;return function(){Ae(this,e).ease=t}}function Zf(e){var t=this._id;return arguments.length?this.each(qf(t,e)):Se(this.node(),t).ease}function Kf(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ae(this,e).ease=n}}function Qf(e){if(typeof e!="function")throw new Error;return this.each(Kf(this._id,e))}function Jf(e){typeof e!="function"&&(e=bi(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new De(o,this._parents,this._name,this._id)}function eh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],d=l.length,f=s[a]=new Array(d),u,h=0;h<d;++h)(u=l[h]||c[h])&&(f[h]=u);for(;a<o;++a)s[a]=t[a];return new De(s,this._parents,this._name,this._id)}function th(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function nh(e,t,n){var o,r,i=th(t)?Uo:Ae;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function oh(e,t){var n=this._id;return arguments.length<2?Se(this.node(),n).on.on(e):this.each(nh(n,e,t))}function rh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ih(){return this.on("end.remove",rh(this._id))}function sh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Oo(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),d,f,u=0;u<l;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),c[u]=f,jn(c[u],t,n,u,c,Se(d,n)));return new De(i,this._parents,t,n)}function ah(e){var t=this._name,n=this._id;typeof e!="function"&&(e=wi(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,d,f=0;f<c;++f)if(d=l[f]){for(var u=e.call(d,d.__data__,f,l),h,p=Se(d,n),g=0,y=u.length;g<y;++g)(h=u[g])&&jn(h,t,n,g,u,p);i.push(u),s.push(d)}return new De(i,s,t,n)}var lh=Pt.prototype.constructor;function ch(){return new lh(this._groups,this._parents)}function uh(e,t){var n,o,r;return function(){var i=ut(this,e),s=(this.style.removeProperty(e),ut(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function rs(e){return function(){this.style.removeProperty(e)}}function dh(e,t,n){var o,r=n+"",i;return function(){var s=ut(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function fh(e,t,n){var o,r,i;return function(){var s=ut(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),ut(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function hh(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=Ae(this,e),c=l.on,d=l.value[i]==null?a||(a=rs(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(s,r=d),l.on=o}}function ph(e,t,n){var o=(e+="")=="transform"?gf:os;return t==null?this.styleTween(e,uh(e,o)).on("end.style."+e,rs(e)):typeof t=="function"?this.styleTween(e,fh(e,o,qo(this,"style."+e,t))).each(hh(this._id,e)):this.styleTween(e,dh(e,o,t),n).on("end.style."+e,null)}function gh(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function mh(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&gh(e,s,n)),o}return i._value=t,i}function yh(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,mh(e,t,n??""))}function xh(e){return function(){this.textContent=e}}function wh(e){return function(){var t=e(this);this.textContent=t??""}}function bh(e){return this.tween("text",typeof e=="function"?wh(qo(this,"text",e)):xh(e==null?"":e+""))}function vh(e){return function(t){this.textContent=e.call(this,t)}}function _h(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&vh(r)),t}return o._value=e,o}function Eh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,_h(e))}function Sh(){for(var e=this._name,t=this._id,n=is(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=Se(l,t);jn(l,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new De(o,this._parents,e,n)}function Nh(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=Ae(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Ch=0;function De(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function is(){return++Ch}var ze=Pt.prototype;De.prototype={constructor:De,select:sh,selectAll:ah,selectChild:ze.selectChild,selectChildren:ze.selectChildren,filter:Jf,merge:eh,selection:ch,transition:Sh,call:ze.call,nodes:ze.nodes,node:ze.node,size:ze.size,empty:ze.empty,each:ze.each,on:oh,attr:jf,attrTween:Bf,style:ph,styleTween:yh,text:bh,textTween:Eh,remove:ih,tween:Af,delay:Yf,duration:Uf,ease:Zf,easeVarying:Qf,end:Nh,[Symbol.iterator]:ze[Symbol.iterator]};function kh(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Th={time:null,delay:0,duration:250,ease:kh};function Mh(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ah(e){var t,n;e instanceof De?(t=e._id,e=e._name):(t=is(),(n=Th).time=Wo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&jn(l,e,t,c,s,n||Mh(l,t));return new De(o,this._parents,e,t)}Pt.prototype.interrupt=kf,Pt.prototype.transition=Ah;const Ln=e=>()=>e;function Ih(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function $e(e,t,n){this.k=e,this.x=t,this.y=n}$e.prototype={constructor:$e,scale:function(e){return e===1?this:new $e(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $e(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 Vn=new $e(1,0,0);ss.prototype=$e.prototype;function ss(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vn;return e.__zoom}function Zo(e){e.stopImmediatePropagation()}function Bt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ph(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Oh(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function as(){return this.__zoom||Vn}function Dh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zh(){return navigator.maxTouchPoints||"ontouchstart"in this}function $h(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ls(){var e=Ph,t=Oh,n=$h,o=Dh,r=zh,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=An,c=wn("start","zoom","end"),d,f,u,h=500,p=150,g=0,y=10;function w(b){b.property("__zoom",as).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(b,I,k,A){var P=b.selection?b.selection():b;P.property("__zoom",as),b!==P?C(b,I,k,A):P.interrupt().each(function(){E(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},w.scaleBy=function(b,I,k,A){w.scaleTo(b,function(){var P=this.__zoom.k,$=typeof I=="function"?I.apply(this,arguments):I;return P*$},k,A)},w.scaleTo=function(b,I,k,A){w.transform(b,function(){var P=t.apply(this,arguments),$=this.__zoom,S=k==null?x(P):typeof k=="function"?k.apply(this,arguments):k,O=$.invert(S),H=typeof I=="function"?I.apply(this,arguments):I;return n(m(_($,H),S,O),P,s)},k,A)},w.translateBy=function(b,I,k,A){w.transform(b,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),s)},null,A)},w.translateTo=function(b,I,k,A,P){w.transform(b,function(){var $=t.apply(this,arguments),S=this.__zoom,O=A==null?x($):typeof A=="function"?A.apply(this,arguments):A;return n(Vn.translate(O[0],O[1]).scale(S.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof k=="function"?-k.apply(this,arguments):-k),$,s)},A,P)};function _(b,I){return I=Math.max(i[0],Math.min(i[1],I)),I===b.k?b:new $e(I,b.x,b.y)}function m(b,I,k){var A=I[0]-k[0]*b.k,P=I[1]-k[1]*b.k;return A===b.x&&P===b.y?b:new $e(b.k,A,P)}function x(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function C(b,I,k,A){b.on("start.zoom",function(){E(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,$=arguments,S=E(P,$).event(A),O=t.apply(P,$),H=k==null?x(O):typeof k=="function"?k.apply(P,$):k,B=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=P.__zoom,U=typeof I=="function"?I.apply(P,$):I,K=l(F.invert(H).concat(B/F.k),U.invert(H).concat(B/U.k));return function(W){if(W===1)W=U;else{var R=K(W),Y=B/R[2];W=new $e(Y,H[0]-R[0]*Y,H[1]-R[1]*Y)}S.zoom(null,W)}})}function E(b,I,k){return!k&&b.__zooming||new M(b,I)}function M(b,I){this.that=b,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,I),this.taps=0}M.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,I){return this.mouse&&b!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var I=be(this.that).datum();c.call(b,this.that,new Ih(b,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:c}),I)}};function N(b,...I){if(!e.apply(this,arguments))return;var k=E(this,I).event(b),A=this.__zoom,P=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,o.apply(this,arguments)))),$=_e(b);if(k.wheel)(k.mouse[0][0]!==$[0]||k.mouse[0][1]!==$[1])&&(k.mouse[1]=A.invert(k.mouse[0]=$)),clearTimeout(k.wheel);else{if(A.k===P)return;k.mouse=[$,A.invert($)],Hn(this),k.start()}Bt(b),k.wheel=setTimeout(S,p),k.zoom("mouse",n(m(_(A,P),k.mouse[0],k.mouse[1]),k.extent,s));function S(){k.wheel=null,k.end()}}function z(b,...I){if(u||!e.apply(this,arguments))return;var k=b.currentTarget,A=E(this,I,!0).event(b),P=be(b.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",B,!0),$=_e(b,k),S=b.clientX,O=b.clientY;Ai(b.view),Zo(b),A.mouse=[$,this.__zoom.invert($)],Hn(this),A.start();function H(F){if(Bt(F),!A.moved){var U=F.clientX-S,K=F.clientY-O;A.moved=U*U+K*K>g}A.event(F).zoom("mouse",n(m(A.that.__zoom,A.mouse[0]=_e(F,k),A.mouse[1]),A.extent,s))}function B(F){P.on("mousemove.zoom mouseup.zoom",null),Ii(F.view,A.moved),Bt(F),A.event(F).end()}}function V(b,...I){if(e.apply(this,arguments)){var k=this.__zoom,A=_e(b.changedTouches?b.changedTouches[0]:b,this),P=k.invert(A),$=k.k*(b.shiftKey?.5:2),S=n(m(_(k,$),A,P),t.apply(this,I),s);Bt(b),a>0?be(this).transition().duration(a).call(C,S,A,b):be(this).call(w.transform,S,A,b)}}function j(b,...I){if(e.apply(this,arguments)){var k=b.touches,A=k.length,P=E(this,I,b.changedTouches.length===A).event(b),$,S,O,H;for(Zo(b),S=0;S<A;++S)O=k[S],H=_e(O,this),H=[H,this.__zoom.invert(H),O.identifier],P.touch0?!P.touch1&&P.touch0[2]!==H[2]&&(P.touch1=H,P.taps=0):(P.touch0=H,$=!0,P.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(P.taps<2&&(f=H[0],d=setTimeout(function(){d=null},h)),Hn(this),P.start())}}function D(b,...I){if(this.__zooming){var k=E(this,I).event(b),A=b.changedTouches,P=A.length,$,S,O,H;for(Bt(b),$=0;$<P;++$)S=A[$],O=_e(S,this),k.touch0&&k.touch0[2]===S.identifier?k.touch0[0]=O:k.touch1&&k.touch1[2]===S.identifier&&(k.touch1[0]=O);if(S=k.that.__zoom,k.touch1){var B=k.touch0[0],F=k.touch0[1],U=k.touch1[0],K=k.touch1[1],W=(W=U[0]-B[0])*W+(W=U[1]-B[1])*W,R=(R=K[0]-F[0])*R+(R=K[1]-F[1])*R;S=_(S,Math.sqrt(W/R)),O=[(B[0]+U[0])/2,(B[1]+U[1])/2],H=[(F[0]+K[0])/2,(F[1]+K[1])/2]}else if(k.touch0)O=k.touch0[0],H=k.touch0[1];else return;k.zoom("touch",n(m(S,O,H),k.extent,s))}}function L(b,...I){if(this.__zooming){var k=E(this,I).event(b),A=b.changedTouches,P=A.length,$,S;for(Zo(b),u&&clearTimeout(u),u=setTimeout(function(){u=null},h),$=0;$<P;++$)S=A[$],k.touch0&&k.touch0[2]===S.identifier?delete k.touch0:k.touch1&&k.touch1[2]===S.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(S=_e(S,this),Math.hypot(f[0]-S[0],f[1]-S[1])<y)){var O=be(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return w.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Ln(+b),w):o},w.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ln(!!b),w):e},w.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Ln(!!b),w):r},w.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Ln([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),w):t},w.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],w):[i[0],i[1]]},w.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],w):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},w.constrain=function(b){return arguments.length?(n=b,w):n},w.duration=function(b){return arguments.length?(a=+b,w):a},w.interpolate=function(b){return arguments.length?(l=b,w):l},w.on=function(){var b=c.on.apply(c,arguments);return b===c?w:b},w.clickDistance=function(b){return arguments.length?(g=(b=+b)*b,w):Math.sqrt(g)},w.tapDistance=function(b){return arguments.length?(y=+b,w):y},w}const ye={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ft=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],cs=["Enter"," ","Escape"],us={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var pt;(function(e){e.Strict="strict",e.Loose="loose"})(pt||(pt={}));var Ke;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ke||(Ke={}));var gt;(function(e){e.Partial="partial",e.Full="full"})(gt||(gt={}));const ds={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Le;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Le||(Le={}));var Rn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rn||(Rn={}));var q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(q||(q={}));const fs={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function jh(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function hs(e,t,n){if(!n)return;const o=[];e.forEach((r,i)=>{t?.has(i)||o.push(r)}),o.length&&n(o)}function ps(e){return e===null?null:e?"valid":"invalid"}const gs=e=>"id"in e&&"source"in e&&"target"in e,Hh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ko=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Wt=(e,t=[0,0])=>{const{width:n,height:o}=je(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Lh=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Ko(r)?r:t.nodeLookup.get(r.id));const a=s?Wn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Bn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Fn(n)},Yt=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const r=Wn(o);n=Bn(n,r)}}),Fn(n)},Qo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...Ut(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:d,selectable:f=!0,hidden:u=!1}=c;if(s&&!f||u)continue;const h=d.width??c.width??c.initialWidth??null,p=d.height??c.height??c.initialHeight??null,g=Xt(a,yt(c)),y=(h??0)*(p??0),w=i&&g>0;(!c.internals.handleBounds||w||g>=y||c.dragging)&&l.push(c)}return l},Jo=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Vh(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Rh({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Vh(e,s),l=Yt(a),c=tr(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function ms({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ye.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(f=[[l,c],[l+h,c+p]])}else a&&wt(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const u=wt(f)?Qe(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ye.error015()),{position:{x:u.x-l+(s.measured.width??0)*d[0],y:u.y-c+(s.measured.height??0)*d[1]},positionAbsolute:u}}async function Bh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const h=i.has(u.id),p=!h&&u.parentId&&s.find(g=>g.id===u.parentId);(h||p)&&s.push(u)}const a=new Set(t.map(u=>u.id)),l=o.filter(u=>u.deletable!==!1),d=Jo(s,l);for(const u of l)a.has(u.id)&&!d.find(p=>p.id===u.id)&&d.push(u);if(!r)return{edges:d,nodes:s};const f=await r({nodes:s,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:s}:{edges:[],nodes:[]}:f}const mt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Qe=(e={x:0,y:0},t,n)=>({x:mt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:mt(e.y,t[0][1],t[1][1]-(n?.height??0))});function ys(e,t,n){const{width:o,height:r}=je(n),{x:i,y:s}=n.internals.positionAbsolute;return Qe(e,[[i,s],[i+o,s+r]],t)}const xs=(e,t,n)=>e<t?mt(Math.abs(e-t),1,t)/t:e>n?-mt(Math.abs(e-n),1,t)/t:0,ws=(e,t,n=15,o=40)=>{const r=xs(e.x,o,t.width-o)*n,i=xs(e.y,o,t.height-o)*n;return[r,i]},Bn=(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)}),er=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),yt=(e,t=[0,0])=>{const{x:n,y:o}=Ko(e)?e.internals.positionAbsolute:Wt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Wn=(e,t=[0,0])=>{const{x:n,y:o}=Ko(e)?e.internals.positionAbsolute:Wt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},bs=(e,t)=>Fn(Bn(er(e),er(t))),Xt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},vs=e=>Ne(e.width)&&Ne(e.height)&&Ne(e.x)&&Ne(e.y),Ne=e=>!isNaN(e)&&isFinite(e),_s=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ut=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Gt(a,s):a},Yn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function xt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fh(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=xt(e,n),r=xt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=xt(e.top??e.y??0,n),r=xt(e.bottom??e.y??0,n),i=xt(e.left??e.x??0,t),s=xt(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Wh(e,t,n,o,r,i){const{x:s,y:a}=Yn(e,[t,n,o]),{x:l,y:c}=Yn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(f)}}const tr=(e,t,n,o,r,i)=>{const s=Fh(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=mt(c,o,r),f=e.x+e.width/2,u=e.y+e.height/2,h=t/2-f*d,p=n/2-u*d,g=Wh(e,h,p,d,t,n),y={left:Math.min(g.left-s.left,0),top:Math.min(g.top-s.top,0),right:Math.min(g.right-s.right,0),bottom:Math.min(g.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:p-y.top+y.bottom,zoom:d}},qt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function wt(e){return e!=null&&e!=="parent"}function je(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Es(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ss(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Ns(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Yh(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Xh(e){return{...us,...e||{}}}function Zt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=Ie(e),a=Ut({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Gt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const nr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Cs=e=>e?.getRootNode?.()||window?.document,Gh=["INPUT","SELECT","TEXTAREA"];function ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Gh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ts=e=>"clientX"in e,Ie=(e,t)=>{const n=Ts(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Ms=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...nr(s)}})};function As({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,d=Math.abs(l-e),f=Math.abs(c-t);return[l,c,d,f]}function Xn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Is({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case q.Left:return[t-Xn(t-o,i),n];case q.Right:return[t+Xn(o-t,i),n];case q.Top:return[t,n-Xn(n-r,i)];case q.Bottom:return[t,n+Xn(r-n,i)]}}function Gn({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top,curvature:s=.25}){const[a,l]=Is({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=Is({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,u,h,p]=As({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,f,u,h,p]}function Ps({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Uh({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){if(o!==void 0)return o;const i=r&&n?1e3:0,s=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return i+s}function qh({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Bn(Wn(e),Wn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Xt(s,Fn(i))>0}const Zh=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Kh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Un=(e,t)=>{if(!e.source||!e.target)return _s("006",ye.error006()),t;let n;return gs(e)?n={...e}:n={...e,id:Zh(e)},Kh(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Os({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Ps({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ds={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},Qh=({source:e,sourcePosition:t=q.Bottom,target:n})=>t===q.Left||t===q.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},zs=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Jh({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:o=q.Top,center:r,offset:i,stepPosition:s}){const a=Ds[t],l=Ds[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},f=Qh({source:c,sourcePosition:t,target:d}),u=f.x!==0?"x":"y",h=f[u];let p=[],g,y;const w={x:0,y:0},_={x:0,y:0},[,,m,x]=Ps({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[u]*l[u]===-1){u==="x"?(g=r.x??c.x+(d.x-c.x)*s,y=r.y??(c.y+d.y)/2):(g=r.x??(c.x+d.x)/2,y=r.y??c.y+(d.y-c.y)*s);const E=[{x:g,y:c.y},{x:g,y:d.y}],M=[{x:c.x,y},{x:d.x,y}];a[u]===h?p=u==="x"?E:M:p=u==="x"?M:E}else{const E=[{x:c.x,y:d.y}],M=[{x:d.x,y:c.y}];if(u==="x"?p=a.x===h?M:E:p=a.y===h?E:M,t===o){const D=Math.abs(e[u]-n[u]);if(D<=i){const L=Math.min(i-1,i-D);a[u]===h?w[u]=(c[u]>e[u]?-1:1)*L:_[u]=(d[u]>n[u]?-1:1)*L}}if(t!==o){const D=u==="x"?"y":"x",L=a[u]===l[D],b=c[D]>d[D],I=c[D]<d[D];(a[u]===1&&(!L&&b||L&&I)||a[u]!==1&&(!L&&I||L&&b))&&(p=u==="x"?E:M)}const N={x:c.x+w.x,y:c.y+w.y},z={x:d.x+_.x,y:d.y+_.y},V=Math.max(Math.abs(N.x-p[0].x),Math.abs(z.x-p[0].x)),j=Math.max(Math.abs(N.y-p[0].y),Math.abs(z.y-p[0].y));V>=j?(g=(N.x+z.x)/2,y=p[0].y):(g=p[0].x,y=(N.y+z.y)/2)}return[[e,{x:c.x+w.x,y:c.y+w.y},...p,{x:d.x+_.x,y:d.y+_.y},n],g,y,m,x]}function ep(e,t,n,o){const r=Math.min(zs(e,t)/2,zs(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function or({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[f,u,h,p,g]=Jh({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});return[f.reduce((w,_,m)=>{let x="";return m>0&&m<f.length-1?x=ep(f[m-1],_,f[m+1],s):x=`${m===0?"M":"L"}${_.x} ${_.y}`,w+=x,w},""),u,h,p,g]}function $s(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function tp(e){const{sourceNode:t,targetNode:n}=e;if(!$s(t)||!$s(n))return null;const o=t.internals.handleBounds||js(t.handles),r=n.internals.handleBounds||js(n.handles),i=Hs(o?.source??[],e.sourceHandle),s=Hs(e.connectionMode===pt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||q.Bottom,l=s?.position||q.Top,c=Kt(t,i,a),d=Kt(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}function js(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Kt(e,t,n=q.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??je(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case q.Top:return{x:r+s/2,y:i};case q.Right:return{x:r+s,y:i+a/2};case q.Bottom:return{x:r+s/2,y:i+a};case q.Left:return{x:r,y:i+a/2}}}function Hs(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function rr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function np(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=rr(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ir={nodeOrigin:[0,0],nodeExtent:Ft,elevateNodesOnSelect:!0,defaults:{}},op={...ir,checkEquality:!0};function sr(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function rp(e,t,n){const o=sr(ir,n);for(const r of e.values())if(r.parentId)lr(r,e,t,o);else{const i=Wt(r,o.nodeOrigin),s=wt(r.extent)?r.extent:o.nodeExtent,a=Qe(i,s,je(r));r.internals.positionAbsolute=a}}function ar(e,t,n,o){const r=sr(op,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let c=s.get(l.id);if(r.checkEquality&&l===c?.internals.userNode)t.set(l.id,c);else{const d=Wt(l,r.nodeOrigin),f=wt(l.extent)?l.extent:r.nodeExtent,u=Qe(d,f,je(l));c={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:u,handleBounds:l.measured?c?.internals.handleBounds:void 0,z:Ls(l,a),userNode:l}},t.set(l.id,c)}(c.measured===void 0||c.measured.width===void 0||c.measured.height===void 0)&&!c.hidden&&(i=!1),l.parentId&&lr(c,t,n,o)}return i}function ip(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function lr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=sr(ir,o),a=e.parentId,l=t.get(a);if(!l){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ip(e,n);const c=r?1e3:0,{x:d,y:f,z:u}=sp(e,l,i,s,c),{positionAbsolute:h}=e.internals,p=d!==h.x||f!==h.y;(p||u!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:d,y:f}:h,z:u}})}function Ls(e,t){return(Ne(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function sp(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=je(e),l=Wt(e,n),c=wt(e.extent)?Qe(l,e.extent,a):l;let d=Qe({x:i+c.x,y:s+c.y},o,a);e.extent==="parent"&&(d=ys(d,a,t));const f=Ls(e,r),u=t.internals.z??0;return{x:d.x,y:d.y,z:u>=f?u+1:f}}function cr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??yt(a),c=bs(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,d=je(a),f=a.origin??o,u=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,p=Math.max(d.width,Math.round(s.width)),g=Math.max(d.height,Math.round(s.height)),y=(p-d.width)*f[0],w=(g-d.height)*f[1];(u>0||h>0||y||w)&&(r.push({id:l,type:"position",position:{x:a.position.x-u+y,y:a.position.y-h+w}}),n.get(l)?.forEach(_=>{e.some(m=>m.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+u,y:_.position.y+h}})})),(d.width<s.width||d.height<s.height||u||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(u?f[0]*u-y:0),height:g+(h?f[1]*h-w:0)}})}),r}function ap(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const l=[],c=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const u of e.values()){const h=t.get(u.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const p=nr(u.nodeElement),g=h.measured.width!==p.width||h.measured.height!==p.height;if(!!(p.width&&p.height&&(g||!h.internals.handleBounds||u.force))){const w=u.nodeElement.getBoundingClientRect(),_=wt(h.extent)?h.extent:i;let{positionAbsolute:m}=h.internals;h.parentId&&h.extent==="parent"?m=ys(m,p,t.get(h.parentId)):_&&(m=Qe(m,_,p));const x={...h,measured:p,internals:{...h.internals,positionAbsolute:m,handleBounds:{source:Ms("source",u.nodeElement,w,d,h.id),target:Ms("target",u.nodeElement,w,d,h.id)}}};t.set(h.id,x),h.parentId&&lr(x,t,n,{nodeOrigin:r}),a=!0,g&&(l.push({id:h.id,type:"dimensions",dimensions:p}),h.expandParent&&h.parentId&&f.push({id:h.id,parentId:h.parentId,rect:yt(x,r)}))}}if(f.length>0){const u=cr(f,t,n,r);l.push(...u)}return{changes:l,updatedInternals:a}}async function lp({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Vs(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Rs(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;Vs("source",l,d,e,r,s),Vs("target",l,c,e,i,a),t.set(o.id,o)}}function cp(e,t){if(e===null||t===null)return!1;const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(n[r].id!==o[r].id||n[r].type!==o[r].type||!Object.is(n[r].data,o[r].data))return!1;return!0}function Bs(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Bs(n,t):!1}function Fs(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function up(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Bs(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function ur({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function dp({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Gt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function fp({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,f=!1,u=null,h=!1,p=!1,g=null;function y({noDragClassName:_,handleSelector:m,domNode:x,isSelectable:C,nodeId:E,nodeClickDistance:M=0}){u=be(x);function N({x:D,y:L}){const{nodeLookup:b,nodeExtent:I,snapGrid:k,snapToGrid:A,nodeOrigin:P,onNodeDrag:$,onSelectionDrag:S,onError:O,updateNodePositions:H}=t();i={x:D,y:L};let B=!1;const F=a.size>1,U=F&&I?er(Yt(a)):null,K=F&&A?dp({dragItems:a,snapGrid:k,x:D,y:L}):null;for(const[W,R]of a){if(!b.has(W))continue;let Y={x:D-R.distance.x,y:L-R.distance.y};A&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:Gt(Y,k));let ee=null;if(F&&I&&!R.extent&&U){const{positionAbsolute:ne}=R.internals,J=ne.x-U.x+I[0][0],le=ne.x+R.measured.width-U.x2+I[1][0],he=ne.y-U.y+I[0][1],Ce=ne.y+R.measured.height-U.y2+I[1][1];ee=[[J,he],[le,Ce]]}const{position:re,positionAbsolute:Z}=ms({nodeId:W,nextPosition:Y,nodeLookup:b,nodeExtent:ee||I,nodeOrigin:P,onError:O});B=B||R.position.x!==re.x||R.position.y!==re.y,R.position=re,R.internals.positionAbsolute=Z}if(p=p||B,!!B&&(H(a,!0),g&&(o||$||!E&&S))){const[W,R]=ur({nodeId:E,dragItems:a,nodeLookup:b});o?.(g,a,W,R),$?.(g,W,R),E||S?.(g,R)}}async function z(){if(!d)return;const{transform:D,panBy:L,autoPanSpeed:b,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[k,A]=ws(c,d,b);(k!==0||A!==0)&&(i.x=(i.x??0)-k/D[2],i.y=(i.y??0)-A/D[2],await L({x:k,y:A})&&N(i)),s=requestAnimationFrame(z)}function V(D){const{nodeLookup:L,multiSelectionActive:b,nodesDraggable:I,transform:k,snapGrid:A,snapToGrid:P,selectNodesOnDrag:$,onNodeDragStart:S,onSelectionDragStart:O,unselectNodesAndEdges:H}=t();f=!0,(!$||!C)&&!b&&E&&(L.get(E)?.selected||H()),C&&$&&E&&e?.(E);const B=Zt(D.sourceEvent,{transform:k,snapGrid:A,snapToGrid:P,containerBounds:d});if(i=B,a=up(L,I,B,E),a.size>0&&(n||S||!E&&O)){const[F,U]=ur({nodeId:E,dragItems:a,nodeLookup:L});n?.(D.sourceEvent,a,F,U),S?.(D.sourceEvent,F,U),E||O?.(D.sourceEvent,U)}}const j=Pi().clickDistance(M).on("start",D=>{const{domNode:L,nodeDragThreshold:b,transform:I,snapGrid:k,snapToGrid:A}=t();d=L?.getBoundingClientRect()||null,h=!1,p=!1,g=D.sourceEvent,b===0&&V(D),i=Zt(D.sourceEvent,{transform:I,snapGrid:k,snapToGrid:A,containerBounds:d}),c=Ie(D.sourceEvent,d)}).on("drag",D=>{const{autoPanOnNodeDrag:L,transform:b,snapGrid:I,snapToGrid:k,nodeDragThreshold:A,nodeLookup:P}=t(),$=Zt(D.sourceEvent,{transform:b,snapGrid:I,snapToGrid:k,containerBounds:d});if(g=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||E&&!P.has(E))&&(h=!0),!h){if(!l&&L&&f&&(l=!0,z()),!f){const S=$.xSnapped-(i.x??0),O=$.ySnapped-(i.y??0);Math.sqrt(S*S+O*O)>A&&V(D)}(i.x!==$.xSnapped||i.y!==$.ySnapped)&&a&&f&&(c=Ie(D.sourceEvent,d),N($))}}).on("end",D=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:L,updateNodePositions:b,onNodeDragStop:I,onSelectionDragStop:k}=t();if(p&&(b(a,!1),p=!1),r||I||!E&&k){const[A,P]=ur({nodeId:E,dragItems:a,nodeLookup:L,dragging:!1});r?.(D.sourceEvent,a,A,P),I?.(D.sourceEvent,A,P),E||k?.(D.sourceEvent,P)}}}).filter(D=>{const L=D.target;return!D.button&&(!_||!Fs(L,`.${_}`,x))&&(!m||Fs(L,m,x))});u.call(j)}function w(){u?.on(".drag",null)}return{update:y,destroy:w}}function hp(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Xt(r,yt(i))>0&&o.push(i);return o}const pp=250;function gp(e,t,n,o){let r=[],i=1/0;const s=hp(e,n,t+pp);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:d,y:f}=Kt(a,c,c.position,!0),u=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));u>t||(u<i?(r=[{...c,x:d,y:f}],i=u):u===i&&r.push({...c,x:d,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Ws(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Kt(s,l,l.position,!0)}:l}function Ys(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function mp(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Xs=()=>!0;function yp(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:f,panBy:u,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:y,isValidConnection:w=Xs,onReconnectEnd:_,updateConnection:m,getTransform:x,getFromHandle:C,autoPanSpeed:E,dragThreshold:M=1,handleDomNode:N}){const z=Cs(e.target);let V=0,j;const{x:D,y:L}=Ie(e),b=Ys(i,N),I=a?.getBoundingClientRect();let k=!1;if(!I||!b)return;const A=Ws(r,b,o,l,t);if(!A)return;let P=Ie(e,I),$=!1,S=null,O=!1,H=null;function B(){if(!d||!I)return;const[re,Z]=ws(P,I,E);u({x:re,y:Z}),V=requestAnimationFrame(B)}const F={...A,nodeId:r,type:b,position:A.position},U=l.get(r);let W={inProgress:!0,isValid:null,from:Kt(U,F,q.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:U,to:P,toHandle:null,toPosition:fs[F.position],toNode:null};function R(){k=!0,m(W),p?.(e,{nodeId:r,handleId:o,handleType:b})}M===0&&R();function Y(re){if(!k){const{x:le,y:he}=Ie(re),Ce=le-D,St=he-L;if(!(Ce*Ce+St*St>M*M))return;R()}if(!C()||!F){ee(re);return}const Z=x();P=Ie(re,I),j=gp(Ut(P,Z,!1,[1,1]),n,l,F),$||(B(),$=!0);const ne=Gs(re,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:w,doc:z,lib:c,flowId:f,nodeLookup:l});H=ne.handleDomNode,S=ne.connection,O=mp(!!j,ne.isValid);const J={...W,isValid:O,to:ne.toHandle&&O?Yn({x:ne.toHandle.x,y:ne.toHandle.y},Z):P,toHandle:ne.toHandle,toPosition:O&&ne.toHandle?ne.toHandle.position:fs[F.position],toNode:ne.toHandle?l.get(ne.toHandle.nodeId):null};O&&j&&W.toHandle&&J.toHandle&&W.toHandle.type===J.toHandle.type&&W.toHandle.nodeId===J.toHandle.nodeId&&W.toHandle.id===J.toHandle.id&&W.to.x===J.to.x&&W.to.y===J.to.y||(m(J),W=J)}function ee(re){if(k){(j||H)&&S&&O&&g?.(S);const{inProgress:Z,...ne}=W,J={...ne,toPosition:W.toHandle?W.toPosition:null};y?.(re,J),i&&_?.(re,J)}h(),cancelAnimationFrame(V),$=!1,O=!1,S=null,H=null,z.removeEventListener("mousemove",Y),z.removeEventListener("mouseup",ee),z.removeEventListener("touchmove",Y),z.removeEventListener("touchend",ee)}z.addEventListener("mousemove",Y),z.addEventListener("mouseup",ee),z.addEventListener("touchmove",Y),z.addEventListener("touchend",ee)}function Gs(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Xs,nodeLookup:d}){const f=i==="target",u=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=Ie(e),g=s.elementFromPoint(h,p),y=g?.classList.contains(`${a}-flow__handle`)?g:u,w={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const _=Ys(void 0,y),m=y.getAttribute("data-nodeid"),x=y.getAttribute("data-handleid"),C=y.classList.contains("connectable"),E=y.classList.contains("connectableend");if(!m||!_)return w;const M={source:f?m:o,sourceHandle:f?x:r,target:f?o:m,targetHandle:f?r:x};w.connection=M;const z=C&&E&&(n===pt.Strict?f&&_==="source"||!f&&_==="target":m!==o||x!==r);w.isValid=z&&c(M),w.toHandle=Ws(m,_,x,d,n,!0)}return w}const dr={onPointerDown:yp,isValid:Gs};function xp({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=be(e);function i({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:f=!0,zoomable:u=!0,inversePan:h=!1}){const p=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const x=n(),C=m.sourceEvent.ctrlKey&&qt()?10:1,E=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,M=x[2]*Math.pow(2,E*C);t.scaleTo(M)};let g=[0,0];const y=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(g=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},w=m=>{const x=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const C=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],E=[C[0]-g[0],C[1]-g[1]];g=C;const M=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),N={x:x[0]-E[0]*M,y:x[1]-E[1]*M},z=[[0,0],[l,c]];t.setViewportConstrained({x:N.x,y:N.y,zoom:x[2]},z,a)},_=ls().on("start",y).on("zoom",f?w:null).on("zoom.wheel",u?p:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:_e}}const wp=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,qn=e=>({x:e.x,y:e.y,zoom:e.k}),fr=({x:e,y:t,zoom:n})=>Vn.translate(e,t).scale(n),bt=(e,t)=>e.target.closest(`.${t}`),Us=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),bp=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,hr=(e,t=0,n=bp,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},qs=e=>{const t=e.ctrlKey&&qt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vp({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(bt(d,t))return!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&s){const y=_e(d),w=qs(d),_=f*Math.pow(2,w);o.scaleTo(n,_,y,d);return}const u=d.deltaMode===1?20:1;let h=r===Ke.Vertical?0:d.deltaX*u,p=r===Ke.Horizontal?0:d.deltaY*u;!qt()&&d.shiftKey&&r!==Ke.Vertical&&(h=d.deltaY*u,p=0),o.translateBy(n,-(h/f)*i,-(p/f)*i,{internal:!0});const g=qn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a?.(d,g)),e.isPanScrolling&&(l?.(d,g),e.panScrollTimeout=setTimeout(()=>{c?.(d,g),e.isPanScrolling=!1},150))}}function _p({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=bt(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Ep({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=qn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Sp({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Us(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,qn(i.transform))}}function Np({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Us(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&wp(e.prevViewport,s.transform))){const a=qn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Cp({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c}){return d=>{const f=e||t,u=n&&d.ctrlKey;if(d.button===1&&d.type==="mousedown"&&(bt(d,`${c}-flow__node`)||bt(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||bt(d,a)&&d.type==="wheel"||bt(d,l)&&(d.type!=="wheel"||r&&d.type==="wheel"&&!e)||!n&&d.ctrlKey&&d.type==="wheel")return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!u&&d.type==="wheel"||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const h=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||d.type==="wheel")&&h}}function kp({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=ls().clickDistance(!Ne(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=be(e).call(u);m({x:i.x,y:i.y,zoom:mt(i.zoom,t,n)},[[0,0],[f.width,f.height]],r);const p=h.on("wheel.zoom"),g=h.on("dblclick.zoom");u.wheelDelta(qs);function y(D,L){return h?new Promise(b=>{u?.interpolate(L?.interpolate==="linear"?jt:An).transform(hr(h,L?.duration,L?.ease,()=>b(!0)),D)}):Promise.resolve(!1)}function w({noWheelClassName:D,noPanClassName:L,onPaneContextMenu:b,userSelectionActive:I,panOnScroll:k,panOnDrag:A,panOnScrollMode:P,panOnScrollSpeed:$,preventScrolling:S,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:B,zoomActivationKeyPressed:F,lib:U,onTransformChange:K}){I&&!d.isZoomingOrPanning&&_();const R=k&&!F&&!I?vp({zoomPanValues:d,noWheelClassName:D,d3Selection:h,d3Zoom:u,panOnScrollMode:P,panOnScrollSpeed:$,zoomOnPinch:O,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):_p({noWheelClassName:D,preventScrolling:S,d3ZoomHandler:p});if(h.on("wheel.zoom",R,{passive:!1}),!I){const ee=Ep({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});u.on("start",ee);const re=Sp({zoomPanValues:d,panOnDrag:A,onPaneContextMenu:!!b,onPanZoom:s,onTransformChange:K});u.on("zoom",re);const Z=Np({zoomPanValues:d,panOnDrag:A,panOnScroll:k,onPaneContextMenu:b,onPanZoomEnd:l,onDraggingChange:c});u.on("end",Z)}const Y=Cp({zoomActivationKeyPressed:F,panOnDrag:A,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:B,zoomOnPinch:O,userSelectionActive:I,noPanClassName:L,noWheelClassName:D,lib:U});u.filter(Y),B?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function _(){u.on("zoom",null)}async function m(D,L,b){const I=fr(D),k=u?.constrain()(I,L,b);return k&&await y(k),new Promise(A=>A(k))}async function x(D,L){const b=fr(D);return await y(b,L),new Promise(I=>I(b))}function C(D){if(h){const L=fr(D),b=h.property("__zoom");(b.k!==D.zoom||b.x!==D.x||b.y!==D.y)&&u?.transform(h,L,null,{sync:!0})}}function E(){const D=h?ss(h.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}function M(D,L){return h?new Promise(b=>{u?.interpolate(L?.interpolate==="linear"?jt:An).scaleTo(hr(h,L?.duration,L?.ease,()=>b(!0)),D)}):Promise.resolve(!1)}function N(D,L){return h?new Promise(b=>{u?.interpolate(L?.interpolate==="linear"?jt:An).scaleBy(hr(h,L?.duration,L?.ease,()=>b(!0)),D)}):Promise.resolve(!1)}function z(D){u?.scaleExtent(D)}function V(D){u?.translateExtent(D)}function j(D){const L=!Ne(D)||D<0?0:D;u?.clickDistance(L)}return{update:w,destroy:_,setViewport:x,setViewportConstrained:m,getViewport:E,scaleTo:M,scaleBy:N,setScaleExtent:z,setTranslateExtent:V,syncViewport:C,setClickDistance:j}}var Je;(function(e){e.Line="line",e.Handle="handle"})(Je||(Je={}));function Tp({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Mp(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ve(e,t){return Math.max(0,t-e)}function Re(e,t){return Math.max(0,e-t)}function Zn(e,t,n){return Math.max(0,t-e,e-n)}function Zs(e,t){return e?!t:t}function Ap(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:f}=t,u=d&&f,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:y,minHeight:w,maxHeight:_}=o,{x:m,y:x,width:C,height:E,aspectRatio:M}=e;let N=Math.floor(d?h-e.pointerX:0),z=Math.floor(f?p-e.pointerY:0);const V=C+(l?-N:N),j=E+(c?-z:z),D=-i[0]*C,L=-i[1]*E;let b=Zn(V,g,y),I=Zn(j,w,_);if(s){let P=0,$=0;l&&N<0?P=Ve(m+N+D,s[0][0]):!l&&N>0&&(P=Re(m+V+D,s[1][0])),c&&z<0?$=Ve(x+z+L,s[0][1]):!c&&z>0&&($=Re(x+j+L,s[1][1])),b=Math.max(b,P),I=Math.max(I,$)}if(a){let P=0,$=0;l&&N>0?P=Re(m+N,a[0][0]):!l&&N<0&&(P=Ve(m+V,a[1][0])),c&&z>0?$=Re(x+z,a[0][1]):!c&&z<0&&($=Ve(x+j,a[1][1])),b=Math.max(b,P),I=Math.max(I,$)}if(r){if(d){const P=Zn(V/M,w,_)*M;if(b=Math.max(b,P),s){let $=0;!l&&!c||l&&!c&&u?$=Re(x+L+V/M,s[1][1])*M:$=Ve(x+L+(l?N:-N)/M,s[0][1])*M,b=Math.max(b,$)}if(a){let $=0;!l&&!c||l&&!c&&u?$=Ve(x+V/M,a[1][1])*M:$=Re(x+(l?N:-N)/M,a[0][1])*M,b=Math.max(b,$)}}if(f){const P=Zn(j*M,g,y)/M;if(I=Math.max(I,P),s){let $=0;!l&&!c||c&&!l&&u?$=Re(m+j*M+D,s[1][0])/M:$=Ve(m+(c?z:-z)*M+D,s[0][0])/M,I=Math.max(I,$)}if(a){let $=0;!l&&!c||c&&!l&&u?$=Ve(m+j*M,a[1][0])/M:$=Re(m+(c?z:-z)*M,a[0][0])/M,I=Math.max(I,$)}}}z=z+(z<0?I:-I),N=N+(N<0?b:-b),r&&(u?V>j*M?z=(Zs(l,c)?-N:N)/M:N=(Zs(l,c)?-z:z)*M:d?(z=N/M,c=l):(N=z*M,l=c));const k=l?m+N:m,A=c?x+z:x;return{width:C+(l?-N:N),height:E+(c?-z:z),x:i[0]*N*(l?-1:1)+k,y:i[1]*z*(c?-1:1)+A}}const Ks={width:0,height:0,x:0,y:0},Ip={...Ks,pointerX:0,pointerY:0,aspectRatio:1};function Pp(e){return[[0,0],[e.measured.width,e.measured.height]]}function Op(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Dp({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=be(e);function s({controlPosition:l,boundaries:c,keepAspectRatio:d,resizeDirection:f,onResizeStart:u,onResize:h,onResizeEnd:p,shouldResize:g}){let y={...Ks},w={...Ip};const _=Mp(l);let m,x=null,C=[],E,M,N;const z=Pi().on("start",V=>{const{nodeLookup:j,transform:D,snapGrid:L,snapToGrid:b,nodeOrigin:I,paneDomNode:k}=n();if(m=j.get(t),!m)return;x=k?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:P}=Zt(V.sourceEvent,{transform:D,snapGrid:L,snapToGrid:b,containerBounds:x});y={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},w={...y,pointerX:A,pointerY:P,aspectRatio:y.width/y.height},E=void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(E=j.get(m.parentId),M=E&&m.extent==="parent"?Pp(E):void 0),C=[],N=void 0;for(const[$,S]of j)if(S.parentId===t&&(C.push({id:$,position:{...S.position},extent:S.extent}),S.extent==="parent"||S.expandParent)){const O=Op(S,m,S.origin??I);N?N=[[Math.min(O[0][0],N[0][0]),Math.min(O[0][1],N[0][1])],[Math.max(O[1][0],N[1][0]),Math.max(O[1][1],N[1][1])]]:N=O}u?.(V,{...y})}).on("drag",V=>{const{transform:j,snapGrid:D,snapToGrid:L,nodeOrigin:b}=n(),I=Zt(V.sourceEvent,{transform:j,snapGrid:D,snapToGrid:L,containerBounds:x}),k=[];if(!m)return;const{x:A,y:P,width:$,height:S}=y,O={},H=m.origin??b,{width:B,height:F,x:U,y:K}=Ap(w,_,I,c,d,H,M,N),W=B!==$,R=F!==S,Y=U!==A&&W,ee=K!==P&&R;if(!Y&&!ee&&!W&&!R)return;if((Y||ee||H[0]===1||H[1]===1)&&(O.x=Y?U:y.x,O.y=ee?K:y.y,y.x=O.x,y.y=O.y,C.length>0)){const J=U-A,le=K-P;for(const he of C)he.position={x:he.position.x-J+H[0]*(B-$),y:he.position.y-le+H[1]*(F-S)},k.push(he)}if((W||R)&&(O.width=W&&(!f||f==="horizontal")?B:y.width,O.height=R&&(!f||f==="vertical")?F:y.height,y.width=O.width,y.height=O.height),E&&m.expandParent){const J=H[0]*(O.width??0);O.x&&O.x<J&&(y.x=J,w.x=w.x-(O.x-J));const le=H[1]*(O.height??0);O.y&&O.y<le&&(y.y=le,w.y=w.y-(O.y-le))}const re=Tp({width:y.width,prevWidth:$,height:y.height,prevHeight:S,affectsX:_.affectsX,affectsY:_.affectsY}),Z={...y,direction:re};g?.(V,Z)!==!1&&(h?.(V,Z),o(O,k))}).on("end",V=>{p?.(V,{...y}),r?.({...y})});i.call(z)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}var Kn={exports:{}},pr={},Qn={exports:{}},gr={};/**
23
23
  * @license React
24
24
  * use-sync-external-store-shim.production.js
25
25
  *
@@ -27,7 +27,7 @@ React keys must be passed directly to JSX without using spread:
27
27
  *
28
28
  * This source code is licensed under the MIT license found in the
29
29
  * LICENSE file in the root directory of this source tree.
30
- */var Gi;function Np(){if(Gi)return dr;Gi=1;var e=k;function t(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,u){var f=u(),p=o({inst:{value:f,getSnapshot:u}}),m=p[0].inst,x=p[1];return s(function(){m.value=f,m.getSnapshot=u,l(m)&&x({inst:m})},[h,f,u]),r(function(){return l(m)&&x({inst:m}),h(function(){l(m)&&x({inst:m})})},[h]),i(f),f}function l(h){var u=h.getSnapshot;h=h.value;try{var f=u();return!n(h,f)}catch{return!0}}function c(h,u){return u()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return dr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,dr}var fr={};/**
30
+ */var Qs;function zp(){if(Qs)return gr;Qs=1;var e=T;function t(f,u){return f===u&&(f!==0||1/f===1/u)||f!==f&&u!==u}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(f,u){var h=u(),p=o({inst:{value:h,getSnapshot:u}}),g=p[0].inst,y=p[1];return i(function(){g.value=h,g.getSnapshot=u,l(g)&&y({inst:g})},[f,h,u]),r(function(){return l(g)&&y({inst:g}),f(function(){l(g)&&y({inst:g})})},[f]),s(h),h}function l(f){var u=f.getSnapshot;f=f.value;try{var h=u();return!n(f,h)}catch{return!0}}function c(f,u){return u()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return gr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,gr}var mr={};/**
31
31
  * @license React
32
32
  * use-sync-external-store-shim.development.js
33
33
  *
@@ -35,7 +35,7 @@ React keys must be passed directly to JSX without using spread:
35
35
  *
36
36
  * This source code is licensed under the MIT license found in the
37
37
  * LICENSE file in the root directory of this source tree.
38
- */var Xi;function kp(){return Xi||(Xi=1,process.env.NODE_ENV!=="production"&&function(){function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}function t(f,p){d||r.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!h){var x=p();s(m,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}x=i({inst:{value:m,getSnapshot:p}});var w=x[0].inst,C=x[1];return l(function(){w.value=m,w.getSnapshot=p,n(w)&&C({inst:w})},[f,m,p]),a(function(){return n(w)&&C({inst:w}),f(function(){n(w)&&C({inst:w})})},[f]),c(m),m}function n(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!s(f,m)}catch{return!0}}function o(f,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=k,s=typeof Object.is=="function"?Object.is:e,i=r.useState,a=r.useEffect,l=r.useLayoutEffect,c=r.useDebugValue,d=!1,h=!1,u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;fr.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),fr}var Zi;function Ui(){return Zi||(Zi=1,process.env.NODE_ENV==="production"?Xn.exports=Np():Xn.exports=kp()),Xn.exports}/**
38
+ */var Js;function $p(){return Js||(Js=1,process.env.NODE_ENV!=="production"&&function(){function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function t(h,p){d||r.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!f){var y=p();i(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=s({inst:{value:g,getSnapshot:p}});var w=y[0].inst,_=y[1];return l(function(){w.value=g,w.getSnapshot=p,n(w)&&_({inst:w})},[h,g,p]),a(function(){return n(w)&&_({inst:w}),h(function(){n(w)&&_({inst:w})})},[h]),c(g),g}function n(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!i(h,g)}catch{return!0}}function o(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=T,i=typeof Object.is=="function"?Object.is:e,s=r.useState,a=r.useEffect,l=r.useLayoutEffect,c=r.useDebugValue,d=!1,f=!1,u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;mr.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),mr}var ea;function ta(){return ea||(ea=1,process.env.NODE_ENV==="production"?Qn.exports=zp():Qn.exports=$p()),Qn.exports}/**
39
39
  * @license React
40
40
  * use-sync-external-store-shim/with-selector.production.js
41
41
  *
@@ -43,7 +43,7 @@ React keys must be passed directly to JSX without using spread:
43
43
  *
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
- */var qi;function Mp(){if(qi)return ur;qi=1;var e=k,t=Ui();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return ur.useSyncExternalStoreWithSelector=function(c,d,h,u,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function w(_){if(!C){if(C=!0,g=_,_=u(_),f!==void 0&&m.hasValue){var I=m.value;if(f(I,_))return y=I}return y=_}if(I=y,o(g,_))return I;var E=u(_);return f!==void 0&&f(I,E)?(g=_,I):(g=_,y=E)}var C=!1,g,y,N=h===void 0?null:h;return[function(){return w(d())},N===null?void 0:function(){return w(N())}]},[d,h,u,f]);var x=r(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=x},[x]),l(x),x},ur}var hr={};/**
46
+ */var na;function jp(){if(na)return pr;na=1;var e=T,t=ta();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return pr.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function w(E){if(!_){if(_=!0,m=E,E=u(E),h!==void 0&&g.hasValue){var M=g.value;if(h(M,E))return x=M}return x=E}if(M=x,o(m,E))return M;var N=u(E);return h!==void 0&&h(M,N)?(m=E,M):(m=E,x=N)}var _=!1,m,x,C=f===void 0?null:f;return[function(){return w(d())},C===null?void 0:function(){return w(C())}]},[d,f,u,h]);var y=r(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},pr}var yr={};/**
47
47
  * @license React
48
48
  * use-sync-external-store-shim/with-selector.development.js
49
49
  *
@@ -51,57 +51,57 @@ React keys must be passed directly to JSX without using spread:
51
51
  *
52
52
  * This source code is licensed under the MIT license found in the
53
53
  * LICENSE file in the root directory of this source tree.
54
- */var Ki;function Ap(){return Ki||(Ki=1,process.env.NODE_ENV!=="production"&&function(){function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=k,n=Ui(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;hr.useSyncExternalStoreWithSelector=function(c,d,h,u,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function w(_){if(!C){if(C=!0,g=_,_=u(_),f!==void 0&&m.hasValue){var I=m.value;if(f(I,_))return y=I}return y=_}if(I=y,o(g,_))return I;var E=u(_);return f!==void 0&&f(I,E)?(g=_,I):(g=_,y=E)}var C=!1,g,y,N=h===void 0?null:h;return[function(){return w(d())},N===null?void 0:function(){return w(N())}]},[d,h,u,f]);var x=r(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=x},[x]),l(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),hr}var Qi;function Pp(){return Qi||(Qi=1,process.env.NODE_ENV==="production"?Gn.exports=Mp():Gn.exports=Ap()),Gn.exports}var Ip=Pp();const Op=zl(Ip),Tp={},Ji=e=>{let t;const n=new Set,o=(d,h)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const f=t;t=h??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(p=>p(t,f))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Tp?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},Dp=e=>e?Ji(e):Ji,{useDebugValue:zp}=k,{useSyncExternalStoreWithSelector:$p}=Op,Lp=e=>e;function ea(e,t=Lp,n){const o=$p(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zp(o),o}const ta=(e,t)=>{const n=Dp(e),o=(r,s=t)=>ea(n,r,s);return Object.assign(o,n),o},jp=(e,t)=>e?ta(e,t):ta;function ce(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Zn=k.createContext(null),Hp=Zn.Provider,na=ye.error001();function oe(e,t){const n=k.useContext(Zn);if(n===null)throw new Error(na);return ea(n,e,t)}function ie(){const e=k.useContext(Zn);if(e===null)throw new Error(na);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const oa={display:"none"},Rp={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ra="react-flow__node-desc",sa="react-flow__edge-desc",Vp="react-flow__aria-live",Bp=e=>e.ariaLiveMessage,Fp=e=>e.ariaLabelConfig;function Wp({rfId:e}){const t=oe(Bp);return v.jsx("div",{id:`${Vp}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Rp,children:t})}function Yp({rfId:e,disableKeyboardA11y:t}){const n=oe(Fp);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${ra}-${e}`,style:oa,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${sa}-${e}`,style:oa,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(Wp,{rfId:e})]})}const Un=k.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return v.jsx("div",{className:ue(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Un.displayName="Panel";function Gp({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:v.jsx(Un,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:v.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Xp=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},qn=e=>e.id;function Zp(e,t){return ce(e.selectedNodes.map(qn),t.selectedNodes.map(qn))&&ce(e.selectedEdges.map(qn),t.selectedEdges.map(qn))}function Up({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=oe(Xp,Zp);return k.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const qp=e=>!!e.onSelectionChangeHandlers;function Kp({onSelectionChange:e}){const t=oe(qp);return e||t?v.jsx(Up,{onSelectionChange:e}):null}const ia=[0,0],Qp={x:0,y:0,zoom:1},aa=[...["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","paneClickDistance","ariaLabelConfig"],"rfId"],Jp=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,setPaneClickDistance:e.setPaneClickDistance}),la={translateExtent:Vt,nodeOrigin:ia,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function eg(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l,setPaneClickDistance:c}=oe(Jp,ce),d=ie();k.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{h.current=la,a()}),[]);const h=k.useRef(la);return k.useEffect(()=>{for(const u of aa){const f=e[u],p=h.current[u];f!==p&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?s(f):u==="nodeExtent"?i(f):u==="paneClickDistance"?c(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Lh(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}h.current=e},aa.map(u=>e[u])),null}function ca(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function tg(e){const[t,n]=k.useState(e==="system"?null:e);return k.useEffect(()=>{if(e!=="system"){n(e);return}const o=ca(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ca()?.matches?"dark":"light"}const ua=typeof document<"u"?document:null;function qt(e=null,t={target:ua,actInsideInputWithModifier:!0}){const[n,o]=k.useState(!1),r=k.useRef(!1),s=k.useRef(new Set([])),[i,a]=k.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
54
+ */var oa;function Hp(){return oa||(oa=1,process.env.NODE_ENV!=="production"&&function(){function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=T,n=ta(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;yr.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function w(E){if(!_){if(_=!0,m=E,E=u(E),h!==void 0&&g.hasValue){var M=g.value;if(h(M,E))return x=M}return x=E}if(M=x,o(m,E))return M;var N=u(E);return h!==void 0&&h(M,N)?(m=E,M):(m=E,x=N)}var _=!1,m,x,C=f===void 0?null:f;return[function(){return w(d())},C===null?void 0:function(){return w(C())}]},[d,f,u,h]);var y=r(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),yr}var ra;function Lp(){return ra||(ra=1,process.env.NODE_ENV==="production"?Kn.exports=jp():Kn.exports=Hp()),Kn.exports}var Vp=Lp();const Rp=Wl(Vp),Bp={},ia=e=>{let t;const n=new Set,o=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(p=>p(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Bp?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},Fp=e=>e?ia(e):ia,{useDebugValue:Wp}=T,{useSyncExternalStoreWithSelector:Yp}=Rp,Xp=e=>e;function sa(e,t=Xp,n){const o=Yp(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wp(o),o}const aa=(e,t)=>{const n=Fp(e),o=(r,i=t)=>sa(n,r,i);return Object.assign(o,n),o},Gp=(e,t)=>e?aa(e,t):aa;function ce(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Jn=T.createContext(null),Up=Jn.Provider,la=ye.error001();function oe(e,t){const n=T.useContext(Jn);if(n===null)throw new Error(la);return sa(n,e,t)}function ae(){const e=T.useContext(Jn);if(e===null)throw new Error(la);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ca={display:"none"},qp={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ua="react-flow__node-desc",da="react-flow__edge-desc",Zp="react-flow__aria-live",Kp=e=>e.ariaLiveMessage,Qp=e=>e.ariaLabelConfig;function Jp({rfId:e}){const t=oe(Kp);return v.jsx("div",{id:`${Zp}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:qp,children:t})}function eg({rfId:e,disableKeyboardA11y:t}){const n=oe(Qp);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${ua}-${e}`,style:ca,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${da}-${e}`,style:ca,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(Jp,{rfId:e})]})}const eo=T.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return v.jsx("div",{className:ue(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});eo.displayName="Panel";function tg({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:v.jsx(eo,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:v.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ng=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},to=e=>e.id;function og(e,t){return ce(e.selectedNodes.map(to),t.selectedNodes.map(to))&&ce(e.selectedEdges.map(to),t.selectedEdges.map(to))}function rg({onSelectionChange:e}){const t=ae(),{selectedNodes:n,selectedEdges:o}=oe(ng,og);return T.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const ig=e=>!!e.onSelectionChangeHandlers;function sg({onSelectionChange:e}){const t=oe(ig);return e||t?v.jsx(rg,{onSelectionChange:e}):null}const fa=[0,0],ag={x:0,y:0,zoom:1},ha=[...["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","paneClickDistance","ariaLabelConfig"],"rfId"],lg=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,setPaneClickDistance:e.setPaneClickDistance}),pa={translateExtent:Ft,nodeOrigin:fa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function cg(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l,setPaneClickDistance:c}=oe(lg,ce),d=ae();T.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{f.current=pa,a()}),[]);const f=T.useRef(pa);return T.useEffect(()=>{for(const u of ha){const h=e[u],p=f.current[u];h!==p&&(typeof e[u]>"u"||(u==="nodes"?t(h):u==="edges"?n(h):u==="minZoom"?o(h):u==="maxZoom"?r(h):u==="translateExtent"?i(h):u==="nodeExtent"?s(h):u==="paneClickDistance"?c(h):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Xh(h)}):u==="fitView"?d.setState({fitViewQueued:h}):u==="fitViewOptions"?d.setState({fitViewOptions:h}):d.setState({[u]:h})))}f.current=e},ha.map(u=>e[u])),null}function ga(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ug(e){const[t,n]=T.useState(e==="system"?null:e);return T.useEffect(()=>{if(e!=="system"){n(e);return}const o=ga(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ga()?.matches?"dark":"light"}const ma=typeof document<"u"?document:null;function Qt(e=null,t={target:ma,actInsideInputWithModifier:!0}){const[n,o]=T.useState(!1),r=T.useRef(!1),i=T.useRef(new Set([])),[s,a]=T.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
55
55
  `).replace(`
56
56
 
57
57
  `,`
58
58
  +`).split(`
59
- `)),d=c.reduce((h,u)=>h.concat(...u),[]);return[c,d]}return[[],[]]},[e]);return k.useEffect(()=>{const l=t?.target??ua,c=t?.actInsideInputWithModifier??!0;if(e!==null){const d=f=>{if(r.current=f.ctrlKey||f.metaKey||f.shiftKey||f.altKey,(!r.current||r.current&&!c)&&bi(f))return!1;const m=fa(f.code,a);if(s.current.add(f[m]),da(i,s.current,!1)){const x=f.composedPath?.()?.[0]||f.target,w=x?.nodeName==="BUTTON"||x?.nodeName==="A";t.preventDefault!==!1&&(r.current||!w)&&f.preventDefault(),o(!0)}},h=f=>{const p=fa(f.code,a);da(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(f[p]),f.key==="Meta"&&s.current.clear(),r.current=!1},u=()=>{s.current.clear(),o(!1)};return l?.addEventListener("keydown",d),l?.addEventListener("keyup",h),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{l?.removeEventListener("keydown",d),l?.removeEventListener("keyup",h),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,o]),n}function da(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function fa(e,t){return t.includes(e)?"code":"key"}const ng=()=>{const e=ie();return k.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),l=Ko(t,o,r,s,i,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,h=n.snapToGrid??s;return Gt(c,o,h,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:s}=o.getBoundingClientRect(),i=Vn(t,n);return{x:i.x+r,y:i.y+s}}}),[])};function ha(e,t){const n=[],o=new Map,r=[];for(const s of e)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const i=o.get(s.id);i?i.push(s):o.set(s.id,[s])}for(const s of t){const i=o.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const l of i)og(l,a);n.push(a)}return r.length&&r.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function og(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function pa(e,t){return ha(e,t)}function ga(e,t){return ha(e,t)}function et(e,t){return{id:e,type:"select",selected:t}}function xt(e,t=new Set,n=!1){const o=[];for(const[r,s]of e){const i=t.has(r);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),o.push(et(s.id,i)))}return o}function ma({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,s]of e.entries()){const i=t.get(s.id),a=i?.internals?.userNode??i;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function ya(e){return{id:e.id,type:"remove"}}const xa=e=>Mh(e),rg=e=>li(e);function wa(e){return k.forwardRef(e)}const sg=typeof window<"u"?k.useLayoutEffect:k.useEffect;function ba(e){const[t,n]=k.useState(BigInt(0)),[o]=k.useState(()=>ig(()=>n(r=>r+BigInt(1))));return sg(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function ig(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const va=k.createContext(null);function ag({children:e}){const t=ie(),n=k.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:d,onNodesChange:h,nodeLookup:u,fitViewQueued:f}=t.getState();let p=l;for(const x of a)p=typeof x=="function"?x(p):x;const m=ma({items:p,lookup:u});d&&c(p),m.length>0?h?.(m):f&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:w,setNodes:C}=t.getState();x&&C(w)})},[]),o=ba(n),r=k.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:d,onEdgesChange:h,edgeLookup:u}=t.getState();let f=l;for(const p of a)f=typeof p=="function"?p(f):p;d?c(f):h&&h(ma({items:f,lookup:u}))},[]),s=ba(r),i=k.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return v.jsx(va.Provider,{value:i,children:e})}function lg(){const e=k.useContext(va);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const cg=e=>!!e.panZoom;function wt(){const e=ng(),t=ie(),n=lg(),o=oe(cg),r=k.useMemo(()=>{const s=h=>t.getState().nodeLookup.get(h),i=h=>{n.nodeQueue.push(h)},a=h=>{n.edgeQueue.push(h)},l=h=>{const{nodeLookup:u,nodeOrigin:f}=t.getState(),p=xa(h)?h:u.get(h.id),m=p.parentId?yi(p.position,p.measured,p.parentId,u,f):p.position,x={...p,position:m,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return pt(x)},c=(h,u,f={replace:!1})=>{i(p=>p.map(m=>{if(m.id===h){const x=typeof u=="function"?u(m):u;return f.replace&&xa(x)?x:{...m,...x}}return m}))},d=(h,u,f={replace:!1})=>{a(p=>p.map(m=>{if(m.id===h){const x=typeof u=="function"?u(m):u;return f.replace&&rg(x)?x:{...m,...x}}return m}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>s(h)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(u=>({...u}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:i,setEdges:a,addNodes:h=>{const u=Array.isArray(h)?h:[h];n.nodeQueue.push(f=>[...f,...u])},addEdges:h=>{const u=Array.isArray(h)?h:[h];n.edgeQueue.push(f=>[...f,...u])},toObject:()=>{const{nodes:h=[],edges:u=[],transform:f}=t.getState(),[p,m,x]=f;return{nodes:h.map(w=>({...w})),edges:u.map(w=>({...w})),viewport:{x:p,y:m,zoom:x}}},deleteElements:async({nodes:h=[],edges:u=[]})=>{const{nodes:f,edges:p,onNodesDelete:m,onEdgesDelete:x,triggerNodeChanges:w,triggerEdgeChanges:C,onDelete:g,onBeforeDelete:y}=t.getState(),{nodes:N,edges:_}=await Th({nodesToRemove:h,edgesToRemove:u,nodes:f,edges:p,onBeforeDelete:y}),I=_.length>0,E=N.length>0;if(I){const D=_.map(ya);x?.(_),C(D)}if(E){const D=N.map(ya);m?.(N),w(D)}return(E||I)&&g?.({nodes:N,edges:_}),{deletedNodes:N,deletedEdges:_}},getIntersectingNodes:(h,u=!0,f)=>{const p=pi(h),m=p?h:l(h),x=f!==void 0;return m?(f||t.getState().nodes).filter(w=>{const C=t.getState().nodeLookup.get(w.id);if(C&&!p&&(w.id===h.id||!C.internals.positionAbsolute))return!1;const g=pt(x?w:C),y=Wt(g,m);return u&&y>0||y>=g.width*g.height||y>=m.width*m.height}):[]},isNodeIntersecting:(h,u,f=!0)=>{const m=pi(h)?h:l(h);if(!m)return!1;const x=Wt(m,u);return f&&x>0||x>=m.width*m.height},updateNode:c,updateNodeData:(h,u,f={replace:!1})=>{c(h,p=>{const m=typeof u=="function"?u(p):u;return f.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},f)},updateEdge:d,updateEdgeData:(h,u,f={replace:!1})=>{d(h,p=>{const m=typeof u=="function"?u(p):u;return f.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},f)},getNodesBounds:h=>{const{nodeLookup:u,nodeOrigin:f}=t.getState();return Ah(h,{nodeLookup:u,nodeOrigin:f})},getHandleConnections:({type:h,id:u,nodeId:f})=>Array.from(t.getState().connectionLookup.get(`${f}-${h}${u?`-${u}`:""}`)?.values()??[]),getNodeConnections:({type:h,handleId:u,nodeId:f})=>Array.from(t.getState().connectionLookup.get(`${f}${h?u?`-${h}-${u}`:`-${h}`:""}`)?.values()??[]),fitView:async h=>{const u=t.getState().fitViewResolver??$h();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:u}),n.nodeQueue.push(f=>[...f]),u.promise}}},[]);return k.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const _a=e=>e.selected,ug=typeof window<"u"?window:void 0;function dg({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ie(),{deleteElements:o}=wt(),r=qt(e,{actInsideInputWithModifier:!1}),s=qt(t,{target:ug});k.useEffect(()=>{if(r){const{edges:i,nodes:a}=n.getState();o({nodes:a.filter(_a),edges:i.filter(_a)}),n.setState({nodesSelectionActive:!1})}},[r]),k.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function fg(e){const t=ie();k.useEffect(()=>{const n=()=>{if(!e.current)return!1;const o=Qo(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ye.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const Kn={position:"absolute",width:"100%",height:"100%",top:0,left:0},hg=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function pg({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=Ke.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:d,maxZoom:h,zoomActivationKeyCode:u,preventScrolling:f=!0,children:p,noWheelClassName:m,noPanClassName:x,onViewportChange:w,isControlledViewport:C,paneClickDistance:g}){const y=ie(),N=k.useRef(null),{userSelectionActive:_,lib:I}=oe(hg,ce),E=qt(u),D=k.useRef();fg(N);const R=k.useCallback(L=>{w?.({x:L[0],y:L[1],zoom:L[2]}),C||y.setState({transform:L})},[w,C]);return k.useEffect(()=>{if(N.current){D.current=xp({domNode:N.current,minZoom:d,maxZoom:h,translateExtent:c,viewport:l,paneClickDistance:g,onDraggingChange:b=>y.setState({paneDragging:b}),onPanZoomStart:(b,P)=>{const{onViewportChangeStart:M,onMoveStart:A}=y.getState();A?.(b,P),M?.(P)},onPanZoom:(b,P)=>{const{onViewportChange:M,onMove:A}=y.getState();A?.(b,P),M?.(P)},onPanZoomEnd:(b,P)=>{const{onViewportChangeEnd:M,onMoveEnd:A}=y.getState();A?.(b,P),M?.(P)}});const{x:L,y:z,zoom:H}=D.current.getViewport();return y.setState({panZoom:D.current,transform:[L,z,H],domNode:N.current.closest(".react-flow")}),()=>{D.current?.destroy()}}},[]),k.useEffect(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:E,preventScrolling:f,noPanClassName:x,userSelectionActive:_,noWheelClassName:m,lib:I,onTransformChange:R})},[e,t,n,o,r,s,i,a,E,f,x,_,m,I,R]),v.jsx("div",{className:"react-flow__renderer",ref:N,style:Kn,children:p})}const gg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function mg(){const{userSelectionActive:e,userSelectionRect:t}=oe(gg,ce);return e&&t?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const pr=(e,t)=>n=>{n.target===t.current&&e?.(n)},yg=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function xg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ft.Full,panOnDrag:o,selectionOnDrag:r,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:u,children:f}){const p=ie(),{userSelectionActive:m,elementsSelectable:x,dragging:w,connectionInProgress:C}=oe(yg,ce),g=x&&(e||m),y=k.useRef(null),N=k.useRef(),_=k.useRef(new Set),I=k.useRef(new Set),E=k.useRef(!1),D=k.useRef(!1),R=A=>{if(E.current||C){E.current=!1;return}a?.(A),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},L=A=>{if(Array.isArray(o)&&o?.includes(2)){A.preventDefault();return}l?.(A)},z=c?A=>c(A):void 0,H=A=>{const{resetSelectedElements:O,domNode:$}=p.getState();if(N.current=$?.getBoundingClientRect(),!x||!e||A.button!==0||A.target!==y.current||!N.current)return;A.target?.setPointerCapture?.(A.pointerId),D.current=!0,E.current=!1;const{x:S,y:T}=Pe(A.nativeEvent,N.current);O(),p.setState({userSelectionRect:{width:0,height:0,startX:S,startY:T,x:S,y:T}}),s?.(A)},b=A=>{const{userSelectionRect:O,transform:$,nodeLookup:S,edgeLookup:T,connectionLookup:j,triggerNodeChanges:B,triggerEdgeChanges:F,defaultEdgeOptions:Z}=p.getState();if(!N.current||!O)return;E.current=!0;const{x:K,y:W}=Pe(A.nativeEvent,N.current),{startX:V,startY:Y}=O,J={startX:V,startY:Y,x:K<V?K:V,y:W<Y?W:Y,width:Math.abs(K-V),height:Math.abs(W-Y)},re=_.current,q=I.current;_.current=new Set(Uo(S,J,$,n===ft.Partial,!0).map(Q=>Q.id)),I.current=new Set;const ne=Z?.selectable??!0;for(const Q of _.current){const le=j.get(Q);if(le)for(const{edgeId:he}of le.values()){const Ce=T.get(he);Ce&&(Ce.selectable??ne)&&I.current.add(he)}}if(!xi(re,_.current)){const Q=xt(S,_.current,!0);B(Q)}if(!xi(q,I.current)){const Q=xt(T,I.current);F(Q)}p.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},P=A=>{if(A.button!==0||!D.current)return;A.target?.releasePointerCapture?.(A.pointerId);const{userSelectionRect:O}=p.getState();!m&&O&&A.target===y.current&&R?.(A),p.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:_.current.size>0}),i?.(A),(t||r)&&(E.current=!1),D.current=!1},M=o===!0||Array.isArray(o)&&o.includes(0);return v.jsxs("div",{className:ue(["react-flow__pane",{draggable:M,dragging:w,selection:e}]),onClick:g?void 0:pr(R,y),onContextMenu:pr(L,y),onWheel:pr(z,y),onPointerEnter:g?void 0:d,onPointerDown:g?H:h,onPointerMove:g?b:h,onPointerUp:g?P:void 0,onPointerLeave:u,ref:y,style:Kn,children:[f,v.jsx(mg,{})]})}function gr({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(s({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Sa({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,nodeClickDistance:i}){const a=ie(),[l,c]=k.useState(!1),d=k.useRef();return k.useEffect(()=>{d.current=op({getStoreItems:()=>a.getState(),onNodeMouseDown:h=>{gr({id:h,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),k.useEffect(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:r,nodeClickDistance:i}),()=>{d.current?.destroy()}},[n,o,t,s,e,r]),l}const wg=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ea(){const e=ie();return k.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:d}=e.getState(),h=new Map,u=wg(i),f=r?s[0]:5,p=r?s[1]:5,m=n.direction.x*f*n.factor,x=n.direction.y*p*n.factor;for(const[,w]of c){if(!u(w))continue;let C={x:w.internals.positionAbsolute.x+m,y:w.internals.positionAbsolute.y+x};r&&(C=Yt(C,s));const{position:g,positionAbsolute:y}=ci({nodeId:w.id,nextPosition:C,nodeLookup:c,nodeExtent:o,nodeOrigin:d,onError:a});w.position=g,w.internals.positionAbsolute=y,h.set(w.id,w)}l(h)},[])}const mr=k.createContext(null),bg=mr.Provider;mr.Consumer;const Qn=()=>k.useContext(mr),vg=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),_g=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:s,connection:i}=o,{fromHandle:a,toHandle:l,isValid:c}=i,d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:s===dt.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}};function Sg({type:e="source",position:t=U.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:h,...u},f){const p=i||null,m=e==="target",x=ie(),w=Qn(),{connectOnClick:C,noPanClassName:g,rfId:y}=oe(vg,ce),{connectingFrom:N,connectingTo:_,clickConnecting:I,isPossibleEndHandle:E,connectionInProcess:D,clickConnectionInProcess:R,valid:L}=oe(_g(w,p,e),ce);w||x.getState().onError?.("010",ye.error010());const z=P=>{const{defaultEdgeOptions:M,onConnect:A,hasDefaultEdges:O}=x.getState(),$={...M,...P};if(O){const{edges:S,setEdges:T}=x.getState();T(Ni($,S))}A?.($),a?.($)},H=P=>{if(!w)return;const M=vi(P.nativeEvent);if(r&&(M&&P.button===0||!M)){const A=x.getState();ar.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:m,handleId:p,nodeId:w,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:z,isValidConnection:n||A.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}M?d?.(P):h?.(P)},b=P=>{const{onClickConnectStart:M,onClickConnectEnd:A,connectionClickStartHandle:O,connectionMode:$,isValidConnection:S,lib:T,rfId:j,nodeLookup:B,connection:F}=x.getState();if(!w||!O&&!r)return;if(!O){M?.(P.nativeEvent,{nodeId:w,handleId:p,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:w,type:e,id:p}});return}const Z=wi(P.target),K=n||S,{connection:W,isValid:V}=ar.isValid(P.nativeEvent,{handle:{nodeId:w,id:p,type:e},connectionMode:$,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:K,flowId:j,doc:Z,lib:T,nodeLookup:B});V&&W&&z(W);const Y=structuredClone(F);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,A?.(P,Y),x.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":p,"data-nodeid":w,"data-handlepos":t,"data-id":`${y}-${w}-${p}-${e}`,className:ue(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,c,{source:!m,target:m,connectable:o,connectablestart:r,connectableend:s,clickconnecting:I,connectingfrom:N,connectingto:_,valid:L,connectionindicator:o&&(!D||E)&&(D||R?s:r)}]),onMouseDown:H,onTouchStart:H,onClick:C?b:void 0,ref:f,...u,children:l})}const Kt=k.memo(wa(Sg));function Eg({data:e,isConnectable:t,sourcePosition:n=U.Bottom}){return v.jsxs(v.Fragment,{children:[e?.label,v.jsx(Kt,{type:"source",position:n,isConnectable:t})]})}function Cg({data:e,isConnectable:t,targetPosition:n=U.Top,sourcePosition:o=U.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(Kt,{type:"target",position:n,isConnectable:t}),e?.label,v.jsx(Kt,{type:"source",position:o,isConnectable:t})]})}function Ng(){return null}function kg({data:e,isConnectable:t,targetPosition:n=U.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(Kt,{type:"target",position:n,isConnectable:t}),e?.label]})}const Jn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ca={input:Eg,default:Cg,output:kg,group:Ng};function Mg(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const Ag=e=>{const{width:t,height:n,x:o,y:r}=Ft(e.nodeLookup,{filter:s=>!!s.selected});return{width:Ee(t)?t:null,height:Ee(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Pg({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ie(),{width:r,height:s,transformString:i,userSelectionActive:a}=oe(Ag,ce),l=Ea(),c=k.useRef(null);if(k.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),Sa({nodeRef:c}),a||!r||!s)return null;const d=e?u=>{const f=o.getState().nodes.filter(p=>p.selected);e(u,f)}:void 0,h=u=>{Object.prototype.hasOwnProperty.call(Jn,u.key)&&(u.preventDefault(),l({direction:Jn[u.key],factor:u.shiftKey?4:1}))};return v.jsx("div",{className:ue(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:v.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s}})})}const Na=typeof window<"u"?window:void 0,Ig=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ka({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:h,onSelectionStart:u,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:x,elementsSelectable:w,zoomOnScroll:C,zoomOnPinch:g,panOnScroll:y,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:I,panOnDrag:E,defaultViewport:D,translateExtent:R,minZoom:L,maxZoom:z,preventScrolling:H,onSelectionContextMenu:b,noWheelClassName:P,noPanClassName:M,disableKeyboardA11y:A,onViewportChange:O,isControlledViewport:$}){const{nodesSelectionActive:S,userSelectionActive:T}=oe(Ig),j=qt(c,{target:Na}),B=qt(m,{target:Na}),F=B||E,Z=B||y,K=d&&F!==!0,W=j||T||K;return dg({deleteKeyCode:l,multiSelectionKeyCode:p}),v.jsx(pg,{onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:C,zoomOnPinch:g,panOnScroll:Z,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:I,panOnDrag:!j&&F,defaultViewport:D,translateExtent:R,minZoom:L,maxZoom:z,zoomActivationKeyCode:x,preventScrolling:H,noWheelClassName:P,noPanClassName:M,onViewportChange:O,isControlledViewport:$,paneClickDistance:a,children:v.jsxs(xg,{onSelectionStart:u,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:F,isSelecting:!!W,selectionMode:h,selectionKeyPressed:j,selectionOnDrag:K,children:[e,S&&v.jsx(Pg,{onSelectionContextMenu:b,noPanClassName:M,disableKeyboardA11y:A})]})})}ka.displayName="FlowRenderer";const Og=k.memo(ka),Tg=e=>t=>e?Uo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Dg(e){return oe(k.useCallback(Tg(e),[e]),ce)}const zg=e=>e.updateNodeInternals;function $g(){const e=oe(zg),[t]=k.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const s=r.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:r.target,force:!0})}),e(o)}));return k.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Lg({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ie(),s=k.useRef(null),i=k.useRef(null),a=k.useRef(e.sourcePosition),l=k.useRef(e.targetPosition),c=k.useRef(t),d=n&&!!e.internals.handleBounds;return k.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&o?.unobserve(i.current),o?.observe(s.current),i.current=s.current)},[d,e.hidden]),k.useEffect(()=>()=>{i.current&&(o?.unobserve(i.current),i.current=null)},[]),k.useEffect(()=>{if(s.current){const h=c.current!==t,u=a.current!==e.sourcePosition,f=l.current!==e.targetPosition;(h||u||f)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function jg({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:h,noDragClassName:u,noPanClassName:f,disableKeyboardA11y:p,rfId:m,nodeTypes:x,nodeClickDistance:w,onError:C}){const{node:g,internals:y,isParent:N}=oe(V=>{const Y=V.nodeLookup.get(e),J=V.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:J}},ce);let _=g.type||"default",I=x?.[_]||Ca[_];I===void 0&&(C?.("003",ye.error003(_)),_="default",I=x?.default||Ca.default);const E=!!(g.draggable||a&&typeof g.draggable>"u"),D=!!(g.selectable||l&&typeof g.selectable>"u"),R=!!(g.connectable||c&&typeof g.connectable>"u"),L=!!(g.focusable||d&&typeof g.focusable>"u"),z=ie(),H=mi(g),b=Lg({node:g,nodeType:_,hasDimensions:H,resizeObserver:h}),P=Sa({nodeRef:b,disabled:g.hidden||!E,noDragClassName:u,handleSelector:g.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:w}),M=Ea();if(g.hidden)return null;const A=$e(g),O=Mg(g),$=D||E||t||n||o||r,S=n?V=>n(V,{...y.userNode}):void 0,T=o?V=>o(V,{...y.userNode}):void 0,j=r?V=>r(V,{...y.userNode}):void 0,B=s?V=>s(V,{...y.userNode}):void 0,F=i?V=>i(V,{...y.userNode}):void 0,Z=V=>{const{selectNodesOnDrag:Y,nodeDragThreshold:J}=z.getState();D&&(!Y||!E||J>0)&&gr({id:e,store:z,nodeRef:b}),t&&t(V,{...y.userNode})},K=V=>{if(!(bi(V.nativeEvent)||p)){if(ni.includes(V.key)&&D){const Y=V.key==="Escape";gr({id:e,store:z,unselect:Y,nodeRef:b})}else if(E&&g.selected&&Object.prototype.hasOwnProperty.call(Jn,V.key)){V.preventDefault();const{ariaLabelConfig:Y}=z.getState();z.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),M({direction:Jn[V.key],factor:V.shiftKey?4:1})}}},W=()=>{if(p||!b.current?.matches(":focus-visible"))return;const{transform:V,width:Y,height:J,autoPanOnNodeFocus:re,setCenter:q}=z.getState();if(!re)return;Uo(new Map([[e,g]]),{x:0,y:0,width:Y,height:J},V,!0).length>0||q(g.position.x+A.width/2,g.position.y+A.height/2,{zoom:V[2]})};return v.jsx("div",{className:ue(["react-flow__node",`react-flow__node-${_}`,{[f]:E},g.className,{selected:g.selected,selectable:D,parent:N,draggable:E,dragging:P}]),ref:b,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:H?"visible":"hidden",...g.style,...O},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:S,onMouseMove:T,onMouseLeave:j,onContextMenu:B,onClick:Z,onDoubleClick:F,onKeyDown:L?K:void 0,tabIndex:L?0:void 0,onFocus:L?W:void 0,role:g.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${ra}-${m}`,"aria-label":g.ariaLabel,...g.domAttributes,children:v.jsx(bg,{value:e,children:v.jsx(I,{id:e,data:g.data,type:_,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:g.selected??!1,selectable:D,draggable:E,deletable:g.deletable??!0,isConnectable:R,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:P,dragHandle:g.dragHandle,zIndex:y.z,parentId:g.parentId,...A})})})}const Hg=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ma(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:s}=oe(Hg,ce),i=Dg(e.onlyRenderVisibleElements),a=$g();return v.jsx("div",{className:"react-flow__nodes",style:Kn,children:i.map(l=>v.jsx(jg,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}Ma.displayName="NodeRenderer";const Rg=k.memo(Ma);function Vg(e){return oe(k.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const s=n.nodeLookup.get(r.source),i=n.nodeLookup.get(r.target);s&&i&&Rh({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),ce)}const Bg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return v.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Fg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return v.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Aa={[Ln.Arrow]:Bg,[Ln.ArrowClosed]:Fg};function Wg(e){const t=ie();return k.useMemo(()=>Object.prototype.hasOwnProperty.call(Aa,e)?Aa[e]:(t.getState().onError?.("009",ye.error009(e)),null),[e])}const Yg=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Wg(t);return l?v.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:v.jsx(l,{color:n,strokeWidth:i})}):null},Pa=({defaultColor:e,rfId:t})=>{const n=oe(s=>s.edges),o=oe(s=>s.defaultEdgeOptions),r=k.useMemo(()=>Xh(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:r.map(s=>v.jsx(Yg,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};Pa.displayName="MarkerDefinitions";var Gg=k.memo(Pa);function Ia({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d}){const[h,u]=k.useState({x:1,y:0,width:0,height:0}),f=ue(["react-flow__edge-textwrapper",c]),p=k.useRef(null);return k.useEffect(()=>{if(p.current){const m=p.current.getBBox();u({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?v.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:f,visibility:h.width?"visible":"hidden",...d,children:[r&&v.jsx("rect",{width:h.width+2*i[0],x:-i[0],y:-i[1],height:h.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),v.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:p,style:o,children:n}),l]}):null}Ia.displayName="EdgeText";const Xg=k.memo(Ia);function bt({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...d,d:e,fill:"none",className:ue(["react-flow__edge-path",d.className])}),c?v.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&Ee(t)&&Ee(n)?v.jsx(Xg,{x:t,y:n,label:o,labelStyle:r,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Oa({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===U.Left||e===U.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Ta({sourceX:e,sourceY:t,sourcePosition:n=U.Bottom,targetX:o,targetY:r,targetPosition:s=U.Top}){const[i,a]=Oa({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Oa({pos:s,x1:o,y1:r,x2:e,y2:t}),[d,h,u,f]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${a} ${l},${c} ${o},${r}`,d,h,u,f]}function Da(e){return k.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,interactionWidth:w})=>{const[C,g,y]=Ta({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a}),N=e.isInternal?void 0:t;return v.jsx(bt,{id:N,path:C,labelX:g,labelY:y,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,interactionWidth:w})})}const Zg=Da({isInternal:!1}),za=Da({isInternal:!0});Zg.displayName="SimpleBezierEdge",za.displayName="SimpleBezierEdgeInternal";function $a(e){return k.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:u,sourcePosition:f=U.Bottom,targetPosition:p=U.Top,markerEnd:m,markerStart:x,pathOptions:w,interactionWidth:C})=>{const[g,y,N]=Jo({sourceX:n,sourceY:o,sourcePosition:f,targetX:r,targetY:s,targetPosition:p,borderRadius:w?.borderRadius,offset:w?.offset,stepPosition:w?.stepPosition}),_=e.isInternal?void 0:t;return v.jsx(bt,{id:_,path:g,labelX:y,labelY:N,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:u,markerEnd:m,markerStart:x,interactionWidth:C})})}const La=$a({isInternal:!1}),ja=$a({isInternal:!0});La.displayName="SmoothStepEdge",ja.displayName="SmoothStepEdgeInternal";function Ha(e){return k.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return v.jsx(La,{...n,id:o,pathOptions:k.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Ug=Ha({isInternal:!1}),Ra=Ha({isInternal:!0});Ug.displayName="StepEdge",Ra.displayName="StepEdgeInternal";function Va(e){return k.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:u,markerEnd:f,markerStart:p,interactionWidth:m})=>{const[x,w,C]=ki({sourceX:n,sourceY:o,targetX:r,targetY:s}),g=e.isInternal?void 0:t;return v.jsx(bt,{id:g,path:x,labelX:w,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:u,markerEnd:f,markerStart:p,interactionWidth:m})})}const qg=Va({isInternal:!1}),Ba=Va({isInternal:!0});qg.displayName="StraightEdge",Ba.displayName="StraightEdgeInternal";function Fa(e){return k.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i=U.Bottom,targetPosition:a=U.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,pathOptions:w,interactionWidth:C})=>{const[g,y,N]=Fn({sourceX:n,sourceY:o,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:w?.curvature}),_=e.isInternal?void 0:t;return v.jsx(bt,{id:_,path:g,labelX:y,labelY:N,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,interactionWidth:C})})}const Kg=Fa({isInternal:!1}),Wa=Fa({isInternal:!0});Kg.displayName="BezierEdge",Wa.displayName="BezierEdgeInternal";const Ya={default:Wa,straight:Ba,step:Ra,smoothstep:ja,simplebezier:za},Ga={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Qg=(e,t,n)=>n===U.Left?e-t:n===U.Right?e+t:e,Jg=(e,t,n)=>n===U.Top?e-t:n===U.Bottom?e+t:e,Xa="react-flow__edgeupdater";function Za({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:a}){return v.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:ue([Xa,`${Xa}-${a}`]),cx:Qg(t,o,e),cy:Jg(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function em({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:h,setReconnecting:u,setUpdateHover:f}){const p=ie(),m=(y,N)=>{if(y.button!==0)return;const{autoPanOnConnect:_,domNode:I,isValidConnection:E,connectionMode:D,connectionRadius:R,lib:L,onConnectStart:z,onConnectEnd:H,cancelConnection:b,nodeLookup:P,rfId:M,panBy:A,updateConnection:O}=p.getState(),$=N.type==="target",S=(B,F)=>{u(!1),h?.(B,n,N.type,F)},T=B=>c?.(n,B),j=(B,F)=>{u(!0),d?.(y,n,N.type),z?.(B,F)};ar.onPointerDown(y.nativeEvent,{autoPanOnConnect:_,connectionMode:D,connectionRadius:R,domNode:I,handleId:N.id,nodeId:N.nodeId,nodeLookup:P,isTarget:$,edgeUpdaterType:N.type,lib:L,flowId:M,cancelConnection:b,panBy:A,isValidConnection:E,onConnect:T,onConnectStart:j,onConnectEnd:H,onReconnectEnd:S,updateConnection:O,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},x=y=>m(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),w=y=>m(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>f(!0),g=()=>f(!1);return v.jsxs(v.Fragment,{children:[(e===!0||e==="source")&&v.jsx(Za,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:x,onMouseEnter:C,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&v.jsx(Za,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:w,onMouseEnter:C,onMouseOut:g,type:"target"})]})}function tm({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:h,onReconnectStart:u,onReconnectEnd:f,rfId:p,edgeTypes:m,noPanClassName:x,onError:w,disableKeyboardA11y:C}){let g=oe(q=>q.edgeLookup.get(e));const y=oe(q=>q.defaultEdgeOptions);g=y?{...y,...g}:g;let N=g.type||"default",_=m?.[N]||Ya[N];_===void 0&&(w?.("011",ye.error011(N)),N="default",_=m?.default||Ya.default);const I=!!(g.focusable||t&&typeof g.focusable>"u"),E=typeof h<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),D=!!(g.selectable||o&&typeof g.selectable>"u"),R=k.useRef(null),[L,z]=k.useState(!1),[H,b]=k.useState(!1),P=ie(),{zIndex:M,sourceX:A,sourceY:O,targetX:$,targetY:S,sourcePosition:T,targetPosition:j}=oe(k.useCallback(q=>{const ne=q.nodeLookup.get(g.source),Q=q.nodeLookup.get(g.target);if(!ne||!Q)return{zIndex:g.zIndex,...Ga};const le=Gh({id:e,sourceNode:ne,targetNode:Q,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:q.connectionMode,onError:w});return{zIndex:Hh({selected:g.selected,zIndex:g.zIndex,sourceNode:ne,targetNode:Q,elevateOnSelect:q.elevateEdgesOnSelect}),...le||Ga}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),ce),B=k.useMemo(()=>g.markerStart?`url('#${er(g.markerStart,p)}')`:void 0,[g.markerStart,p]),F=k.useMemo(()=>g.markerEnd?`url('#${er(g.markerEnd,p)}')`:void 0,[g.markerEnd,p]);if(g.hidden||A===null||O===null||$===null||S===null)return null;const Z=q=>{const{addSelectedEdges:ne,unselectNodesAndEdges:Q,multiSelectionActive:le}=P.getState();D&&(P.setState({nodesSelectionActive:!1}),g.selected&&le?(Q({nodes:[],edges:[g]}),R.current?.blur()):ne([e])),r&&r(q,g)},K=s?q=>{s(q,{...g})}:void 0,W=i?q=>{i(q,{...g})}:void 0,V=a?q=>{a(q,{...g})}:void 0,Y=l?q=>{l(q,{...g})}:void 0,J=c?q=>{c(q,{...g})}:void 0,re=q=>{if(!C&&ni.includes(q.key)&&D){const{unselectNodesAndEdges:ne,addSelectedEdges:Q}=P.getState();q.key==="Escape"?(R.current?.blur(),ne({edges:[g]})):Q([e])}};return v.jsx("svg",{style:{zIndex:M},children:v.jsxs("g",{className:ue(["react-flow__edge",`react-flow__edge-${N}`,g.className,x,{selected:g.selected,animated:g.animated,inactive:!D&&!r,updating:L,selectable:D}]),onClick:Z,onDoubleClick:K,onContextMenu:W,onMouseEnter:V,onMouseMove:Y,onMouseLeave:J,onKeyDown:I?re:void 0,tabIndex:I?0:void 0,role:g.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":I?`${sa}-${p}`:void 0,ref:R,...g.domAttributes,children:[!H&&v.jsx(_,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:D,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:A,sourceY:O,targetX:$,targetY:S,sourcePosition:T,targetPosition:j,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:B,markerEnd:F,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),E&&v.jsx(em,{edge:g,isReconnectable:E,reconnectRadius:d,onReconnect:h,onReconnectStart:u,onReconnectEnd:f,sourceX:A,sourceY:O,targetX:$,targetY:S,sourcePosition:T,targetPosition:j,setUpdateHover:z,setReconnecting:b})]})})}const nm=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ua({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:h,onEdgeDoubleClick:u,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:x,edgesReconnectable:w,elementsSelectable:C,onError:g}=oe(nm,ce),y=Vg(t);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(Gg,{defaultColor:e,rfId:n}),y.map(N=>v.jsx(tm,{id:N,edgesFocusable:x,edgesReconnectable:w,elementsSelectable:C,noPanClassName:r,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:h,onDoubleClick:u,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:g,edgeTypes:o,disableKeyboardA11y:m},N))]})}Ua.displayName="EdgeRenderer";const om=k.memo(Ua),rm=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function sm({children:e}){const t=oe(rm);return v.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function im(e){const t=wt(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const am=e=>e.panZoom?.syncViewport;function lm(e){const t=oe(am),n=ie();return k.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function cm(e){return e.connection.inProgress?{...e.connection,to:Gt(e.connection.to,e.transform)}:{...e.connection}}function um(e){return cm}function qa(e){const t=um();return oe(t,ce)}const dm=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function fm({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:s,height:i,isValid:a,inProgress:l}=oe(dm,ce);return!(s&&r&&l)?null:v.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:ue(["react-flow__connection",ai(a)]),children:v.jsx(Ka,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Ka=({style:e,type:t=je.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:s,fromNode:i,fromHandle:a,fromPosition:l,to:c,toNode:d,toHandle:h,toPosition:u}=qa();if(!r)return;if(n)return v.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:u,connectionStatus:ai(o),toNode:d,toHandle:h});let f="";const p={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:u};switch(t){case je.Bezier:[f]=Fn(p);break;case je.SimpleBezier:[f]=Ta(p);break;case je.Step:[f]=Jo({...p,borderRadius:0});break;case je.SmoothStep:[f]=Jo(p);break;default:[f]=ki(p)}return v.jsx("path",{d:f,fill:"none",className:"react-flow__connection-path",style:e})};Ka.displayName="ConnectionLine";const hm={};function Qa(e=hm){const t=k.useRef(e),n=ie();k.useEffect(()=>{if(process.env.NODE_ENV==="development"){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",ye.error002());break}t.current=e}},[e])}function pm(){const e=ie(),t=k.useRef(!1);k.useEffect(()=>{if(process.env.NODE_ENV==="development"&&!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",ye.error013("react")),t.current=!0}},[])}function Ja({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:h,onSelectionStart:u,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:x,connectionLineContainerStyle:w,selectionKeyCode:C,selectionOnDrag:g,selectionMode:y,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:I,deleteKeyCode:E,onlyRenderVisibleElements:D,elementsSelectable:R,defaultViewport:L,translateExtent:z,minZoom:H,maxZoom:b,preventScrolling:P,defaultMarkerColor:M,zoomOnScroll:A,zoomOnPinch:O,panOnScroll:$,panOnScrollSpeed:S,panOnScrollMode:T,zoomOnDoubleClick:j,panOnDrag:B,onPaneClick:F,onPaneMouseEnter:Z,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneScroll:V,onPaneContextMenu:Y,paneClickDistance:J,nodeClickDistance:re,onEdgeContextMenu:q,onEdgeMouseEnter:ne,onEdgeMouseMove:Q,onEdgeMouseLeave:le,reconnectRadius:he,onReconnect:Ce,onReconnectStart:vt,onReconnectEnd:so,noDragClassName:io,noWheelClassName:ao,noPanClassName:en,disableKeyboardA11y:tn,nodeExtent:Er,rfId:lo,viewport:_t,onViewportChange:nn}){return Qa(e),Qa(t),pm(),im(n),lm(_t),v.jsx(Og,{onPaneClick:F,onPaneMouseEnter:Z,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneContextMenu:Y,onPaneScroll:V,paneClickDistance:J,deleteKeyCode:E,selectionKeyCode:C,selectionOnDrag:g,selectionMode:y,onSelectionStart:u,onSelectionEnd:f,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:I,elementsSelectable:R,zoomOnScroll:A,zoomOnPinch:O,zoomOnDoubleClick:j,panOnScroll:$,panOnScrollSpeed:S,panOnScrollMode:T,panOnDrag:B,defaultViewport:L,translateExtent:z,minZoom:H,maxZoom:b,onSelectionContextMenu:h,preventScrolling:P,noDragClassName:io,noWheelClassName:ao,noPanClassName:en,disableKeyboardA11y:tn,onViewportChange:nn,isControlledViewport:!!_t,children:v.jsxs(sm,{children:[v.jsx(om,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:i,onReconnect:Ce,onReconnectStart:vt,onReconnectEnd:so,onlyRenderVisibleElements:D,onEdgeContextMenu:q,onEdgeMouseEnter:ne,onEdgeMouseMove:Q,onEdgeMouseLeave:le,reconnectRadius:he,defaultMarkerColor:M,noPanClassName:en,disableKeyboardA11y:tn,rfId:lo}),v.jsx(fm,{style:m,type:p,component:x,containerStyle:w}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(Rg,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:re,onlyRenderVisibleElements:D,noPanClassName:en,noDragClassName:io,disableKeyboardA11y:tn,nodeExtent:Er,rfId:lo}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}Ja.displayName="GraphView";const gm=k.memo(Ja),el=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:h}={})=>{const u=new Map,f=new Map,p=new Map,m=new Map,x=o??t??[],w=n??e??[],C=d??[0,0],g=h??Vt;zi(p,m,x);const y=or(w,u,f,{nodeOrigin:C,nodeExtent:g,elevateNodesOnSelect:!1});let N=[0,0,1];if(i&&r&&s){const _=Ft(u,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:I,y:E,zoom:D}=Ko(_,r,s,l,c,a?.padding??.1);N=[I,E,D]}return{rfId:"1",width:0,height:0,transform:N,nodes:w,nodesInitialized:y,nodeLookup:u,parentLookup:f,edges:x,edgeLookup:m,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Vt,nodeExtent:g,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:dt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...ri},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gi,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:oi}},mm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:h})=>jp((u,f)=>{async function p(){const{nodeLookup:m,panZoom:x,fitViewOptions:w,fitViewResolver:C,width:g,height:y,minZoom:N,maxZoom:_}=f();x&&(await Oh({nodes:m,width:g,height:y,panZoom:x,minZoom:N,maxZoom:_},w),C?.resolve(!0),u({fitViewResolver:null}))}return{...el({nodes:e,edges:t,width:r,height:s,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:h,defaultNodes:n,defaultEdges:o}),setNodes:m=>{const{nodeLookup:x,parentLookup:w,nodeOrigin:C,elevateNodesOnSelect:g,fitViewQueued:y}=f(),N=or(m,x,w,{nodeOrigin:C,nodeExtent:h,elevateNodesOnSelect:g,checkEquality:!0});y&&N?(p(),u({nodes:m,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):u({nodes:m,nodesInitialized:N})},setEdges:m=>{const{connectionLookup:x,edgeLookup:w}=f();zi(x,w,m),u({edges:m})},setDefaultNodesAndEdges:(m,x)=>{if(m){const{setNodes:w}=f();w(m),u({hasDefaultNodes:!0})}if(x){const{setEdges:w}=f();w(x),u({hasDefaultEdges:!0})}},updateNodeInternals:m=>{const{triggerNodeChanges:x,nodeLookup:w,parentLookup:C,domNode:g,nodeOrigin:y,nodeExtent:N,debug:_,fitViewQueued:I}=f(),{changes:E,updatedInternals:D}=Qh(m,w,C,g,y,N);D&&(Uh(w,C,{nodeOrigin:y,nodeExtent:N}),I?(p(),u({fitViewQueued:!1,fitViewOptions:void 0})):u({}),E?.length>0&&(_&&console.log("React Flow: trigger node changes",E),x?.(E)))},updateNodePositions:(m,x=!1)=>{const w=[],C=[],{nodeLookup:g,triggerNodeChanges:y}=f();for(const[N,_]of m){const I=g.get(N),E=!!(I?.expandParent&&I?.parentId&&_?.position),D={id:N,type:"position",position:E?{x:Math.max(0,_.position.x),y:Math.max(0,_.position.y)}:_.position,dragging:x};E&&I.parentId&&w.push({id:N,parentId:I.parentId,rect:{..._.internals.positionAbsolute,width:_.measured.width??0,height:_.measured.height??0}}),C.push(D)}if(w.length>0){const{parentLookup:N,nodeOrigin:_}=f(),I=sr(w,g,N,_);C.push(...I)}y(C)},triggerNodeChanges:m=>{const{onNodesChange:x,setNodes:w,nodes:C,hasDefaultNodes:g,debug:y}=f();if(m?.length){if(g){const N=pa(m,C);w(N)}y&&console.log("React Flow: trigger node changes",m),x?.(m)}},triggerEdgeChanges:m=>{const{onEdgesChange:x,setEdges:w,edges:C,hasDefaultEdges:g,debug:y}=f();if(m?.length){if(g){const N=ga(m,C);w(N)}y&&console.log("React Flow: trigger edge changes",m),x?.(m)}},addSelectedNodes:m=>{const{multiSelectionActive:x,edgeLookup:w,nodeLookup:C,triggerNodeChanges:g,triggerEdgeChanges:y}=f();if(x){const N=m.map(_=>et(_,!0));g(N);return}g(xt(C,new Set([...m]),!0)),y(xt(w))},addSelectedEdges:m=>{const{multiSelectionActive:x,edgeLookup:w,nodeLookup:C,triggerNodeChanges:g,triggerEdgeChanges:y}=f();if(x){const N=m.map(_=>et(_,!0));y(N);return}y(xt(w,new Set([...m]))),g(xt(C,new Set,!0))},unselectNodesAndEdges:({nodes:m,edges:x}={})=>{const{edges:w,nodes:C,nodeLookup:g,triggerNodeChanges:y,triggerEdgeChanges:N}=f(),_=m||C,I=x||w,E=_.map(R=>{const L=g.get(R.id);return L&&(L.selected=!1),et(R.id,!1)}),D=I.map(R=>et(R.id,!1));y(E),N(D)},setMinZoom:m=>{const{panZoom:x,maxZoom:w}=f();x?.setScaleExtent([m,w]),u({minZoom:m})},setMaxZoom:m=>{const{panZoom:x,minZoom:w}=f();x?.setScaleExtent([w,m]),u({maxZoom:m})},setTranslateExtent:m=>{f().panZoom?.setTranslateExtent(m),u({translateExtent:m})},setPaneClickDistance:m=>{f().panZoom?.setClickDistance(m)},resetSelectedElements:()=>{const{edges:m,nodes:x,triggerNodeChanges:w,triggerEdgeChanges:C,elementsSelectable:g}=f();if(!g)return;const y=x.reduce((_,I)=>I.selected?[..._,et(I.id,!1)]:_,[]),N=m.reduce((_,I)=>I.selected?[..._,et(I.id,!1)]:_,[]);w(y),C(N)},setNodeExtent:m=>{const{nodes:x,nodeLookup:w,parentLookup:C,nodeOrigin:g,elevateNodesOnSelect:y,nodeExtent:N}=f();m[0][0]===N[0][0]&&m[0][1]===N[0][1]&&m[1][0]===N[1][0]&&m[1][1]===N[1][1]||(or(x,w,C,{nodeOrigin:g,nodeExtent:m,elevateNodesOnSelect:y,checkEquality:!1}),u({nodeExtent:m}))},panBy:m=>{const{transform:x,width:w,height:C,panZoom:g,translateExtent:y}=f();return Jh({delta:m,panZoom:g,transform:x,translateExtent:y,width:w,height:C})},setCenter:async(m,x,w)=>{const{width:C,height:g,maxZoom:y,panZoom:N}=f();if(!N)return Promise.resolve(!1);const _=typeof w?.zoom<"u"?w.zoom:y;return await N.setViewport({x:C/2-m*_,y:g/2-x*_,zoom:_},{duration:w?.duration,ease:w?.ease,interpolate:w?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{u({connection:{...ri}})},updateConnection:m=>{u({connection:m})},reset:()=>u({...el()})}},Object.is);function tl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:h,children:u}){const[f]=k.useState(()=>mm({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:c,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:h}));return v.jsx(Hp,{value:f,children:v.jsx(ag,{children:u})})}function ym({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:h,nodeExtent:u}){return k.useContext(Zn)?v.jsx(v.Fragment,{children:e}):v.jsx(tl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:h,nodeExtent:u,children:e})}const xm={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function wm({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:h,onMoveEnd:u,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:x,onClickConnectEnd:w,onNodeMouseEnter:C,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:N,onNodeDoubleClick:_,onNodeDragStart:I,onNodeDrag:E,onNodeDragStop:D,onNodesDelete:R,onEdgesDelete:L,onDelete:z,onSelectionChange:H,onSelectionDragStart:b,onSelectionDrag:P,onSelectionDragStop:M,onSelectionContextMenu:A,onSelectionStart:O,onSelectionEnd:$,onBeforeDelete:S,connectionMode:T,connectionLineType:j=je.Bezier,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:Z,deleteKeyCode:K="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:V=!1,selectionMode:Y=ft.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:re=Xt()?"Meta":"Control",zoomActivationKeyCode:q=Xt()?"Meta":"Control",snapToGrid:ne,snapGrid:Q,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:he,nodesDraggable:Ce,autoPanOnNodeFocus:vt,nodesConnectable:so,nodesFocusable:io,nodeOrigin:ao=ia,edgesFocusable:en,edgesReconnectable:tn,elementsSelectable:Er=!0,defaultViewport:lo=Qp,minZoom:_t=.5,maxZoom:nn=2,translateExtent:Cl=Vt,preventScrolling:fy=!0,nodeExtent:Cr,defaultMarkerColor:hy="#b1b1b7",zoomOnScroll:py=!0,zoomOnPinch:gy=!0,panOnScroll:my=!1,panOnScrollSpeed:yy=.5,panOnScrollMode:xy=Ke.Free,zoomOnDoubleClick:wy=!0,panOnDrag:by=!0,onPaneClick:vy,onPaneMouseEnter:_y,onPaneMouseMove:Sy,onPaneMouseLeave:Ey,onPaneScroll:Cy,onPaneContextMenu:Ny,paneClickDistance:Nl=0,nodeClickDistance:ky=0,children:My,onReconnect:Ay,onReconnectStart:Py,onReconnectEnd:Iy,onEdgeContextMenu:Oy,onEdgeDoubleClick:Ty,onEdgeMouseEnter:Dy,onEdgeMouseMove:zy,onEdgeMouseLeave:$y,reconnectRadius:Ly=10,onNodesChange:jy,onEdgesChange:Hy,noDragClassName:Ry="nodrag",noWheelClassName:Vy="nowheel",noPanClassName:kl="nopan",fitView:Ml,fitViewOptions:Al,connectOnClick:By,attributionPosition:Fy,proOptions:Wy,defaultEdgeOptions:Yy,elevateNodesOnSelect:Gy,elevateEdgesOnSelect:Xy,disableKeyboardA11y:Pl=!1,autoPanOnConnect:Zy,autoPanOnNodeDrag:Uy,autoPanSpeed:qy,connectionRadius:Ky,isValidConnection:Qy,onError:Jy,style:e0,id:Il,nodeDragThreshold:t0,connectionDragThreshold:n0,viewport:o0,onViewportChange:r0,width:s0,height:i0,colorMode:a0="light",debug:l0,onScroll:Ol,ariaLabelConfig:c0,...u0},d0){const Nr=Il||"1",f0=tg(a0),h0=k.useCallback(Tl=>{Tl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ol?.(Tl)},[Ol]);return v.jsx("div",{"data-testid":"rf__wrapper",...u0,onScroll:h0,style:{...e0,...xm},ref:d0,className:ue(["react-flow",r,f0]),id:Il,role:"application",children:v.jsxs(ym,{nodes:e,edges:t,width:s0,height:i0,fitView:Ml,fitViewOptions:Al,minZoom:_t,maxZoom:nn,nodeOrigin:ao,nodeExtent:Cr,children:[v.jsx(gm,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:C,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:N,onNodeDoubleClick:_,nodeTypes:s,edgeTypes:i,connectionLineType:j,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:Z,selectionKeyCode:W,selectionOnDrag:V,selectionMode:Y,deleteKeyCode:K,multiSelectionKeyCode:re,panActivationKeyCode:J,zoomActivationKeyCode:q,onlyRenderVisibleElements:le,defaultViewport:lo,translateExtent:Cl,minZoom:_t,maxZoom:nn,preventScrolling:fy,zoomOnScroll:py,zoomOnPinch:gy,zoomOnDoubleClick:wy,panOnScroll:my,panOnScrollSpeed:yy,panOnScrollMode:xy,panOnDrag:by,onPaneClick:vy,onPaneMouseEnter:_y,onPaneMouseMove:Sy,onPaneMouseLeave:Ey,onPaneScroll:Cy,onPaneContextMenu:Ny,paneClickDistance:Nl,nodeClickDistance:ky,onSelectionContextMenu:A,onSelectionStart:O,onSelectionEnd:$,onReconnect:Ay,onReconnectStart:Py,onReconnectEnd:Iy,onEdgeContextMenu:Oy,onEdgeDoubleClick:Ty,onEdgeMouseEnter:Dy,onEdgeMouseMove:zy,onEdgeMouseLeave:$y,reconnectRadius:Ly,defaultMarkerColor:hy,noDragClassName:Ry,noWheelClassName:Vy,noPanClassName:kl,rfId:Nr,disableKeyboardA11y:Pl,nodeExtent:Cr,viewport:o0,onViewportChange:r0}),v.jsx(eg,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:p,onConnectEnd:m,onClickConnectStart:x,onClickConnectEnd:w,nodesDraggable:Ce,autoPanOnNodeFocus:vt,nodesConnectable:so,nodesFocusable:io,edgesFocusable:en,edgesReconnectable:tn,elementsSelectable:Er,elevateNodesOnSelect:Gy,elevateEdgesOnSelect:Xy,minZoom:_t,maxZoom:nn,nodeExtent:Cr,onNodesChange:jy,onEdgesChange:Hy,snapToGrid:ne,snapGrid:Q,connectionMode:T,translateExtent:Cl,connectOnClick:By,defaultEdgeOptions:Yy,fitView:Ml,fitViewOptions:Al,onNodesDelete:R,onEdgesDelete:L,onDelete:z,onNodeDragStart:I,onNodeDrag:E,onNodeDragStop:D,onSelectionDrag:P,onSelectionDragStart:b,onSelectionDragStop:M,onMove:d,onMoveStart:h,onMoveEnd:u,noPanClassName:kl,nodeOrigin:ao,rfId:Nr,autoPanOnConnect:Zy,autoPanOnNodeDrag:Uy,autoPanSpeed:qy,onError:Jy,connectionRadius:Ky,isValidConnection:Qy,selectNodesOnDrag:he,nodeDragThreshold:t0,connectionDragThreshold:n0,onBeforeDelete:S,paneClickDistance:Nl,debug:l0,ariaLabelConfig:c0}),v.jsx(Kp,{onSelectionChange:H}),My,v.jsx(Gp,{proOptions:Wy,position:Fy}),v.jsx(Yp,{rfId:Nr,disableKeyboardA11y:Pl})]})})}var bm=wa(wm);function vm({onStart:e,onChange:t,onEnd:n}){const o=ie();k.useEffect(()=>{o.setState({onViewportChangeStart:e})},[e]),k.useEffect(()=>{o.setState({onViewportChange:t})},[t]),k.useEffect(()=>{o.setState({onViewportChangeEnd:n})},[n])}const _m=ye.error014();function Sm({id:e,handleType:t,handleId:n,onConnect:o,onDisconnect:r}={}){const s=Qn(),i=e??s;if(!i)throw new Error(_m);const a=k.useRef(null),l=oe(c=>c.connectionLookup.get(`${i}${t?n?`-${t}-${n}`:`-${t}`:""}`),kh);return k.useEffect(()=>{if(a.current&&a.current!==l){const c=l??new Map;ii(a.current,c,r),ii(c,a.current,o)}a.current=l??new Map},[l,o,r]),k.useMemo(()=>Array.from(l?.values()??[]),[l])}function yr(e){return oe(k.useCallback(n=>{const o=[],r=Array.isArray(e),s=r?e:[e];for(const i of s){const a=n.nodeLookup.get(i);a&&o.push({id:a.id,type:a.type,data:a.data})}return r?o:o[0]??null},[e]),ep)}function Em({dimensions:e,lineWidth:t,variant:n,className:o}){return v.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ue(["react-flow__background-pattern",n,o])})}function Cm({radius:e,className:t}){return v.jsx("circle",{cx:e,cy:e,r:e,className:ue(["react-flow__background-pattern","dots",t])})}var Ve;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ve||(Ve={}));const Nm={[Ve.Dots]:1,[Ve.Lines]:1,[Ve.Cross]:6},km=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function nl({id:e,variant:t=Ve.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=0,color:i,bgColor:a,style:l,className:c,patternClassName:d}){const h=k.useRef(null),{transform:u,patternId:f}=oe(km,ce),p=o||Nm[t],m=t===Ve.Dots,x=t===Ve.Cross,w=Array.isArray(n)?n:[n,n],C=[w[0]*u[2]||1,w[1]*u[2]||1],g=p*u[2],y=Array.isArray(s)?s:[s,s],N=x?[g,g]:C,_=[y[0]*u[2]||1+N[0]/2,y[1]*u[2]||1+N[1]/2],I=`${f}${e||""}`;return v.jsxs("svg",{className:ue(["react-flow__background",c]),style:{...l,...Kn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:h,"data-testid":"rf__background",children:[v.jsx("pattern",{id:I,x:u[0]%C[0],y:u[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:m?v.jsx(Cm,{radius:g/2,className:d}):v.jsx(Em,{dimensions:N,lineWidth:r,variant:t,className:d})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}nl.displayName="Background";const Mm=k.memo(nl);function Am(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Pm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Im(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Om(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Tm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function eo({children:e,className:t,...n}){return v.jsx("button",{type:"button",className:ue(["react-flow__controls-button",t]),...n,children:e})}const Dm=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ol({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:c,children:d,position:h="bottom-left",orientation:u="vertical","aria-label":f}){const p=ie(),{isInteractive:m,minZoomReached:x,maxZoomReached:w,ariaLabelConfig:C}=oe(Dm,ce),{zoomIn:g,zoomOut:y,fitView:N}=wt(),_=()=>{g(),s?.()},I=()=>{y(),i?.()},E=()=>{N(r),a?.()},D=()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),l?.(!m)},R=u==="horizontal"?"horizontal":"vertical";return v.jsxs(Un,{className:ue(["react-flow__controls",R,c]),position:h,style:e,"data-testid":"rf__controls","aria-label":f??C["controls.ariaLabel"],children:[t&&v.jsxs(v.Fragment,{children:[v.jsx(eo,{onClick:_,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:w,children:v.jsx(Am,{})}),v.jsx(eo,{onClick:I,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:x,children:v.jsx(Pm,{})})]}),n&&v.jsx(eo,{className:"react-flow__controls-fitview",onClick:E,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:v.jsx(Im,{})}),o&&v.jsx(eo,{className:"react-flow__controls-interactive",onClick:D,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:m?v.jsx(Tm,{}):v.jsx(Om,{})}),d]})}ol.displayName="Controls";const zm=k.memo(ol);function $m({id:e,x:t,y:n,width:o,height:r,style:s,color:i,strokeColor:a,strokeWidth:l,className:c,borderRadius:d,shapeRendering:h,selected:u,onClick:f}){const{background:p,backgroundColor:m}=s||{},x=i||p||m;return v.jsx("rect",{className:ue(["react-flow__minimap-node",{selected:u},c]),x:t,y:n,rx:d,ry:d,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:h,onClick:f?w=>f(w,e):void 0})}const Lm=k.memo($m),jm=e=>e.nodes.map(t=>t.id),xr=e=>e instanceof Function?e:()=>e;function Hm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:s=Lm,onClick:i}){const a=oe(jm,ce),l=xr(t),c=xr(e),d=xr(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:a.map(u=>v.jsx(Vm,{id:u,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:s,onClick:i,shapeRendering:h},u))})}function Rm({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:c,x:d,y:h,width:u,height:f}=oe(p=>{const{internals:m}=p.nodeLookup.get(e),x=m.userNode,{x:w,y:C}=m.positionAbsolute,{width:g,height:y}=$e(x);return{node:x,x:w,y:C,width:g,height:y}},ce);return!c||c.hidden||!mi(c)?null:v.jsx(a,{x:d,y:h,width:u,height:f,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:s,shapeRendering:i,onClick:l,id:c.id})}const Vm=k.memo(Rm);var Bm=k.memo(Hm);const Fm=200,Wm=150,Ym=e=>!e.hidden,Gm=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?hi(Ft(e.nodeLookup,{filter:Ym}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Xm="react-flow__minimap-desc";function rl({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:h,position:u="bottom-right",onClick:f,onNodeClick:p,pannable:m=!1,zoomable:x=!1,ariaLabel:w,inversePan:C,zoomStep:g=1,offsetScale:y=5}){const N=ie(),_=k.useRef(null),{boundingRect:I,viewBB:E,rfId:D,panZoom:R,translateExtent:L,flowWidth:z,flowHeight:H,ariaLabelConfig:b}=oe(Gm,ce),P=e?.width??Fm,M=e?.height??Wm,A=I.width/P,O=I.height/M,$=Math.max(A,O),S=$*P,T=$*M,j=y*$,B=I.x-(S-I.width)/2-j,F=I.y-(T-I.height)/2-j,Z=S+j*2,K=T+j*2,W=`${Xm}-${D}`,V=k.useRef(0),Y=k.useRef();V.current=$,k.useEffect(()=>{if(_.current&&R)return Y.current=cp({domNode:_.current,panZoom:R,getTransform:()=>N.getState().transform,getViewScale:()=>V.current}),()=>{Y.current?.destroy()}},[R]),k.useEffect(()=>{Y.current?.update({translateExtent:L,width:z,height:H,inversePan:C,pannable:m,zoomStep:g,zoomable:x})},[m,x,C,g,L,z,H]);const J=f?ne=>{const[Q,le]=Y.current?.pointer(ne)||[0,0];f(ne,{x:Q,y:le})}:void 0,re=p?k.useCallback((ne,Q)=>{const le=N.getState().nodeLookup.get(Q).internals.userNode;p(ne,le)},[]):void 0,q=w??b["minimap.ariaLabel"];return v.jsx(Un,{position:u,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*$:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:ue(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:P,height:M,viewBox:`${B} ${F} ${Z} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:_,onClick:J,children:[q&&v.jsx("title",{id:W,children:q}),v.jsx(Bm,{onClick:re,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:i,nodeComponent:a}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-j},${F-j}h${Z+j*2}v${K+j*2}h${-Z-j*2}z
60
- M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}rl.displayName="MiniMap";const Zm=k.memo(rl),Um=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,qm={[Je.Line]:"right",[Je.Handle]:"bottom-right"};function Km({nodeId:e,position:t,variant:n=Je.Handle,className:o,style:r=void 0,children:s,color:i,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:u,autoScale:f=!0,shouldResize:p,onResizeStart:m,onResize:x,onResizeEnd:w}){const C=Qn(),g=typeof e=="string"?e:C,y=ie(),N=k.useRef(null),_=n===Je.Handle,I=oe(k.useCallback(Um(_&&f),[_,f]),ce),E=k.useRef(null),D=t??qm[n];k.useEffect(()=>{if(!(!N.current||!g))return E.current||(E.current=Cp({domNode:N.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:L,transform:z,snapGrid:H,snapToGrid:b,nodeOrigin:P,domNode:M}=y.getState();return{nodeLookup:L,transform:z,snapGrid:H,snapToGrid:b,nodeOrigin:P,paneDomNode:M}},onChange:(L,z)=>{const{triggerNodeChanges:H,nodeLookup:b,parentLookup:P,nodeOrigin:M}=y.getState(),A=[],O={x:L.x,y:L.y},$=b.get(g);if($&&$.expandParent&&$.parentId){const S=$.origin??M,T=L.width??$.measured.width??0,j=L.height??$.measured.height??0,B={id:$.id,parentId:$.parentId,rect:{width:T,height:j,...yi({x:L.x??$.position.x,y:L.y??$.position.y},{width:T,height:j},$.parentId,b,S)}},F=sr([B],b,P,M);A.push(...F),O.x=L.x?Math.max(S[0]*T,L.x):void 0,O.y=L.y?Math.max(S[1]*j,L.y):void 0}if(O.x!==void 0&&O.y!==void 0){const S={id:g,type:"position",position:{...O}};A.push(S)}if(L.width!==void 0&&L.height!==void 0){const T={id:g,type:"dimensions",resizing:!0,setAttributes:u?u==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};A.push(T)}for(const S of z){const T={...S,type:"position"};A.push(T)}H(A)},onEnd:({width:L,height:z})=>{const H={id:g,type:"dimensions",resizing:!1,dimensions:{width:L,height:z}};y.getState().triggerNodeChanges([H])}})),E.current.update({controlPosition:D,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:h,resizeDirection:u,onResizeStart:m,onResize:x,onResizeEnd:w,shouldResize:p}),()=>{E.current?.destroy()}},[D,a,l,c,d,h,m,x,w,p]);const R=D.split("-");return v.jsx("div",{className:ue(["react-flow__resize-control","nodrag",...R,n,o]),ref:N,style:{...r,scale:I,...i&&{[_?"backgroundColor":"borderColor"]:i}},children:s})}const sl=k.memo(Km),wr=20;function to(e,t){const n=t[e.dataType];return n.underlyingType==="number"?{id:At(wr),name:e.name,handleColor:n.color,allowInput:e.allowInput,type:"number"}:{id:At(wr),name:e.name,handleColor:n.color,allowInput:e.allowInput,type:"string"}}function il(e,t){const n=At(wr),o=e.inputs.map(r=>to(r,t));return{id:n,name:e.name,inputs:o}}function al(e,t,n,o,r){const s=n[t],i=s.inputs.map(l=>"inputs"in l?il(l,e):to(l,e)),a=s.outputs.map(l=>to(l,e));return{id:o,position:r,sourcePosition:U.Right,targetPosition:U.Left,type:"configurableNode",width:400,data:{name:s.name,headerColor:s.headerColor,inputs:i,outputs:a}}}const ll=20,Ie=["ADD_NODE","UPDATE_NODE_BY_REACT_FLOW","UPDATE_EDGES_BY_REACT_FLOW","ADD_EDGE_BY_REACT_FLOW","UPDATE_INPUT_VALUE"],Be={[Ie[0]]:Ie[0],[Ie[1]]:Ie[1],[Ie[2]]:Ie[2],[Ie[3]]:Ie[3],[Ie[4]]:Ie[4]};function cl(e,t){return Gc(e,o=>{switch(t.type){case Be.ADD_NODE:const r=t.payload.type,s=At(ll),i=t.payload.position,a=al(o.dataTypes,r,o.typeOfNodes,s,i);o.nodes.push(a);break;case Be.UPDATE_NODE_BY_REACT_FLOW:const l=t.payload.changes;o.nodes=pa(l,o.nodes);break;case Be.UPDATE_EDGES_BY_REACT_FLOW:const c=t.payload.changes;o.edges=ga(c,o.edges);break;case Be.ADD_EDGE_BY_REACT_FLOW:const h={...t.payload.edge,type:"configurableEdge",id:At(ll)};o.edges=Ni(h,o.edges);break}})}const br=k.forwardRef(({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:s,targetPosition:i,...a},l)=>{const[c]=Fn({sourceX:t,sourceY:n,sourcePosition:s,targetX:o,targetY:r,targetPosition:i}),d=ie(),{flowToScreenPosition:h}=wt(),[u,f]=k.useState({viewportXDebounced:0,viewportYDebounced:0,viewportZoomDebounced:0});vm({onEnd:E=>{f({viewportXDebounced:E.x,viewportYDebounced:E.y,viewportZoomDebounced:E.zoom})}});const p=k.useMemo(()=>{const{domNode:E}=d.getState(),D=E?.getBoundingClientRect();if(!D)return!1;const R=h({x:t,y:n}),L=h({x:o,y:r});return an(R,D)||an(L,D)},[t,n,o,r,u.viewportXDebounced,u.viewportYDebounced,u.viewportZoomDebounced]),m=yr(a.source||""),x=k.useMemo(()=>!a.source||!m?void 0:mo(a.sourceHandleId||"",m?.data)?.handleColor??"#A1A1A1",[a.source,m]),w=yr(a.target||""),C=k.useMemo(()=>!a.target||!w?void 0:mo(a.targetHandleId||"",w?.data)?.handleColor??"#A1A1A1",[a.target,w]),{label:g,labelStyle:y,markerStart:N,markerEnd:_,interactionWidth:I}=a;return v.jsxs(v.Fragment,{children:[v.jsx("defs",{children:v.jsxs("linearGradient",{id:`linear-gradient-edge-${e}`,x1:t,y1:n,x2:o,y2:r,gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:x,offset:"0"}),v.jsx("stop",{stopColor:C,offset:"1"})]})}),v.jsx(bt,{id:e,path:c,label:g,labelStyle:y,markerEnd:_,markerStart:N,interactionWidth:I,className:se("!stroke-7 in-[g.selected]:brightness-150",!p&&"opacity-25"),style:{stroke:`url(#${`linear-gradient-edge-${e}`})`},focusable:!0})]})});br.displayName="ConfigurableEdge";function ul(e,t,n=!0,o=!1){const r=e!==null?"current"in e?e.current:e:null,s=k.useCallback(i=>{if(!r)return;let a=!0;if(n&&!r.contains(i.target))a=!1;else if(o){const l="clientX"in i?{x:i.clientX,y:i.clientY}:{x:i.touches[0].clientX,y:i.touches[0].clientY},c=r.getBoundingClientRect();an(l,c)||(a=!1)}a||t()},[r,t,n,o]);k.useEffect(()=>(document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}),[r,s])}const Qt=k.forwardRef(({placeholder:e="Input",className:t,...n},o)=>{const r=k.useMemo(()=>n.allowOnlyNumbers&&n.value!==void 0?xo(n.value,n.numberOfDecimals??5):n.value?.toString(),[n.value,n.allowOnlyNumbers,n.numberOfDecimals]),[s,i]=k.useState(r??""),[a,l]=k.useState(null),c=n.value??s,[d,h]=k.useState(c.toString());function u(p){n.allowOnlyNumbers&&/[^0-9\.\-]/.test(p)||h(p)}function f(){if(n.allowOnlyNumbers){const p=qr(d||c.toString()),m=xo(p,n.numberOfDecimals??5);i(m),n.onChange?.(p),h(m)}else i(d),n.onChange?.(d),h(d)}return ul(a,()=>f()),v.jsx("input",{type:"text",className:se("h-[44px] rounded-md text-primary-white bg-primary-black font-main px-4 text-[27px] leading-[27px] outline-none focus-visible:!outline-none border-secondary-dark-gray border w-max min-w-0 placeholder:text-[#6B6B6B]",t),placeholder:e,size:5,ref:p=>{l(p),typeof o=="function"?o(p):o&&(o.current=p)},value:d,onChange:p=>u(p.target.value),onKeyDown:p=>{p.key==="Enter"&&f()},onMouseMove:p=>{p.preventDefault(),p.stopPropagation()},onBlur:p=>{p.preventDefault(),p.stopPropagation(),f()}})});Qt.displayName="Input";function dl({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:r,lineStyle:s,color:i,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:h=!1,autoScale:u=!0,shouldResize:f,onResizeStart:p,onResize:m,onResizeEnd:x,linePosition:w=["left","right"],handlePosition:C=[],resizeDirection:g="horizontal"}){return t?v.jsxs(v.Fragment,{children:[w.map(y=>v.jsx(sl,{className:se("!border-none",y==="left"||y==="right"?"!w-4":"!h-4",r),style:s,nodeId:e,position:y,variant:Je.Line,color:i,minWidth:a,minHeight:l,maxWidth:c,maxHeight:d,onResizeStart:p,keepAspectRatio:h,autoScale:u,shouldResize:f,onResize:m,onResizeEnd:x,resizeDirection:g},y)),C.map(y=>v.jsx(sl,{className:n,style:o,nodeId:e,position:y,color:i,minWidth:a,minHeight:l,maxWidth:c,maxHeight:d,onResizeStart:p,keepAspectRatio:h,autoScale:u,shouldResize:f,onResize:m,onResizeEnd:x,resizeDirection:g},y))]}):null}function fl({onMove:e,onClick:t,clickThreshold:n=2,enabled:o=!0,preventDefaultAndStopPropagation:r=!0}={}){const[s,i]=k.useState(!1),[a,l]=k.useState(null),c=k.useRef(null),d=k.useRef(null),h=k.useCallback(u=>{l(u)},[]);return k.useEffect(()=>{if(!a||!o)return;const u=f=>{r&&(f.preventDefault(),f.stopPropagation()),c.current={x:f.clientX,y:f.clientY},d.current={width:a.clientWidth,height:a.clientHeight},i(!0);const p=x=>{r&&(x.preventDefault(),x.stopPropagation()),document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",m),i(!1),c.current&&Math.sqrt((x.clientX-c.current.x)**2+(x.clientY-c.current.y)**2)<n&&t?.()},m=x=>{r&&(x.preventDefault(),x.stopPropagation());const w=x.movementX,C=x.movementY,g=d.current?.width||1,y=d.current?.height||1,N=w/g,_=C/y;e?.(w,C,N,_,g,y)};document.addEventListener("mouseup",p),document.addEventListener("mousemove",m)};return a.addEventListener("mousedown",u),()=>{a.removeEventListener("mousedown",u)}},[a,o,e,t,n,r]),{isDragging:s,dragRef:h}}/**
59
+ `)),d=c.reduce((f,u)=>f.concat(...u),[]);return[c,d]}return[[],[]]},[e]);return T.useEffect(()=>{const l=t?.target??ma,c=t?.actInsideInputWithModifier??!0;if(e!==null){const d=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!c)&&ks(h))return!1;const g=xa(h.code,a);if(i.current.add(h[g]),ya(s,i.current,!1)){const y=h.composedPath?.()?.[0]||h.target,w=y?.nodeName==="BUTTON"||y?.nodeName==="A";t.preventDefault!==!1&&(r.current||!w)&&h.preventDefault(),o(!0)}},f=h=>{const p=xa(h.code,a);ya(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[p]),h.key==="Meta"&&i.current.clear(),r.current=!1},u=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",d),l?.addEventListener("keyup",f),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{l?.removeEventListener("keydown",d),l?.removeEventListener("keyup",f),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,o]),n}function ya(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function xa(e,t){return t.includes(e)?"code":"key"}const dg=()=>{const e=ae();return T.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=tr(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,f=n.snapToGrid??i;return Ut(c,o,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Yn(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function wa(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)fg(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function fg(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function ba(e,t){return wa(e,t)}function Jt(e,t){return wa(e,t)}function et(e,t){return{id:e,type:"select",selected:t}}function vt(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(et(i.id,s)))}return o}function va({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function _a(e){return{id:e.id,type:"remove"}}const Ea=e=>Hh(e),hg=e=>gs(e);function Sa(e){return T.forwardRef(e)}const pg=typeof window<"u"?T.useLayoutEffect:T.useEffect;function Na(e){const[t,n]=T.useState(BigInt(0)),[o]=T.useState(()=>gg(()=>n(r=>r+BigInt(1))));return pg(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function gg(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Ca=T.createContext(null);function mg({children:e}){const t=ae(),n=T.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:d,onNodesChange:f,nodeLookup:u,fitViewQueued:h}=t.getState();let p=l;for(const y of a)p=typeof y=="function"?y(p):y;const g=va({items:p,lookup:u});d&&c(p),g.length>0?f?.(g):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:w,setNodes:_}=t.getState();y&&_(w)})},[]),o=Na(n),r=T.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:u}=t.getState();let h=l;for(const p of a)h=typeof p=="function"?p(h):p;d?c(h):f&&f(va({items:h,lookup:u}))},[]),i=Na(r),s=T.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return v.jsx(Ca.Provider,{value:s,children:e})}function yg(){const e=T.useContext(Ca);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const xg=e=>!!e.panZoom;function en(){const e=dg(),t=ae(),n=yg(),o=oe(xg),r=T.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),s=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},l=f=>{const{nodeLookup:u,nodeOrigin:h}=t.getState(),p=Ea(f)?f:u.get(f.id),g=p.parentId?Ss(p.position,p.measured,p.parentId,u,h):p.position,y={...p,position:g,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return yt(y)},c=(f,u,h={replace:!1})=>{s(p=>p.map(g=>{if(g.id===f){const y=typeof u=="function"?u(g):u;return h.replace&&Ea(y)?y:{...g,...y}}return g}))},d=(f,u,h={replace:!1})=>{a(p=>p.map(g=>{if(g.id===f){const y=typeof u=="function"?u(g):u;return h.replace&&hg(y)?y:{...g,...y}}return g}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>i(f)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(u=>({...u}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:s,setEdges:a,addNodes:f=>{const u=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...u])},addEdges:f=>{const u=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...u])},toObject:()=>{const{nodes:f=[],edges:u=[],transform:h}=t.getState(),[p,g,y]=h;return{nodes:f.map(w=>({...w})),edges:u.map(w=>({...w})),viewport:{x:p,y:g,zoom:y}}},deleteElements:async({nodes:f=[],edges:u=[]})=>{const{nodes:h,edges:p,onNodesDelete:g,onEdgesDelete:y,triggerNodeChanges:w,triggerEdgeChanges:_,onDelete:m,onBeforeDelete:x}=t.getState(),{nodes:C,edges:E}=await Bh({nodesToRemove:f,edgesToRemove:u,nodes:h,edges:p,onBeforeDelete:x}),M=E.length>0,N=C.length>0;if(M){const z=E.map(_a);y?.(E),_(z)}if(N){const z=C.map(_a);g?.(C),w(z)}return(N||M)&&m?.({nodes:C,edges:E}),{deletedNodes:C,deletedEdges:E}},getIntersectingNodes:(f,u=!0,h)=>{const p=vs(f),g=p?f:l(f),y=h!==void 0;return g?(h||t.getState().nodes).filter(w=>{const _=t.getState().nodeLookup.get(w.id);if(_&&!p&&(w.id===f.id||!_.internals.positionAbsolute))return!1;const m=yt(y?w:_),x=Xt(m,g);return u&&x>0||x>=m.width*m.height||x>=g.width*g.height}):[]},isNodeIntersecting:(f,u,h=!0)=>{const g=vs(f)?f:l(f);if(!g)return!1;const y=Xt(g,u);return h&&y>0||y>=g.width*g.height},updateNode:c,updateNodeData:(f,u,h={replace:!1})=>{c(f,p=>{const g=typeof u=="function"?u(p):u;return h.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},h)},updateEdge:d,updateEdgeData:(f,u,h={replace:!1})=>{d(f,p=>{const g=typeof u=="function"?u(p):u;return h.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},h)},getNodesBounds:f=>{const{nodeLookup:u,nodeOrigin:h}=t.getState();return Lh(f,{nodeLookup:u,nodeOrigin:h})},getHandleConnections:({type:f,id:u,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${f}${u?`-${u}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:u,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${f?u?`-${f}-${u}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const u=t.getState().fitViewResolver??Yh();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:u}),n.nodeQueue.push(h=>[...h]),u.promise}}},[]);return T.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const ka=e=>e.selected,wg=typeof window<"u"?window:void 0;function bg({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ae(),{deleteElements:o}=en(),r=Qt(e,{actInsideInputWithModifier:!1}),i=Qt(t,{target:wg});T.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(ka),edges:s.filter(ka)}),n.setState({nodesSelectionActive:!1})}},[r]),T.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function vg(e){const t=ae();T.useEffect(()=>{const n=()=>{if(!e.current)return!1;const o=nr(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ye.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const no={position:"absolute",width:"100%",height:"100%",top:0,left:0},_g=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function Eg({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Ke.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:d,maxZoom:f,zoomActivationKeyCode:u,preventScrolling:h=!0,children:p,noWheelClassName:g,noPanClassName:y,onViewportChange:w,isControlledViewport:_,paneClickDistance:m}){const x=ae(),C=T.useRef(null),{userSelectionActive:E,lib:M}=oe(_g,ce),N=Qt(u),z=T.useRef();vg(C);const V=T.useCallback(j=>{w?.({x:j[0],y:j[1],zoom:j[2]}),_||x.setState({transform:j})},[w,_]);return T.useEffect(()=>{if(C.current){z.current=kp({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:c,viewport:l,paneClickDistance:m,onDraggingChange:b=>x.setState({paneDragging:b}),onPanZoomStart:(b,I)=>{const{onViewportChangeStart:k,onMoveStart:A}=x.getState();A?.(b,I),k?.(I)},onPanZoom:(b,I)=>{const{onViewportChange:k,onMove:A}=x.getState();A?.(b,I),k?.(I)},onPanZoomEnd:(b,I)=>{const{onViewportChangeEnd:k,onMoveEnd:A}=x.getState();A?.(b,I),k?.(I)}});const{x:j,y:D,zoom:L}=z.current.getViewport();return x.setState({panZoom:z.current,transform:[j,D,L],domNode:C.current.closest(".react-flow")}),()=>{z.current?.destroy()}}},[]),T.useEffect(()=>{z.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:N,preventScrolling:h,noPanClassName:y,userSelectionActive:E,noWheelClassName:g,lib:M,onTransformChange:V})},[e,t,n,o,r,i,s,a,N,h,y,E,g,M,V]),v.jsx("div",{className:"react-flow__renderer",ref:C,style:no,children:p})}const Sg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ng(){const{userSelectionActive:e,userSelectionRect:t}=oe(Sg,ce);return e&&t?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const xr=(e,t)=>n=>{n.target===t.current&&e?.(n)},Cg=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function kg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=gt.Full,panOnDrag:o,selectionOnDrag:r,onSelectionStart:i,onSelectionEnd:s,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:u,children:h}){const p=ae(),{userSelectionActive:g,elementsSelectable:y,dragging:w,connectionInProgress:_}=oe(Cg,ce),m=y&&(e||g),x=T.useRef(null),C=T.useRef(),E=T.useRef(new Set),M=T.useRef(new Set),N=T.useRef(!1),z=T.useRef(!1),V=A=>{if(N.current||_){N.current=!1;return}a?.(A),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},j=A=>{if(Array.isArray(o)&&o?.includes(2)){A.preventDefault();return}l?.(A)},D=c?A=>c(A):void 0,L=A=>{const{resetSelectedElements:P,domNode:$}=p.getState();if(C.current=$?.getBoundingClientRect(),!y||!e||A.button!==0||A.target!==x.current||!C.current)return;A.target?.setPointerCapture?.(A.pointerId),z.current=!0,N.current=!1;const{x:S,y:O}=Ie(A.nativeEvent,C.current);P(),p.setState({userSelectionRect:{width:0,height:0,startX:S,startY:O,x:S,y:O}}),i?.(A)},b=A=>{const{userSelectionRect:P,transform:$,nodeLookup:S,edgeLookup:O,connectionLookup:H,triggerNodeChanges:B,triggerEdgeChanges:F,defaultEdgeOptions:U}=p.getState();if(!C.current||!P)return;N.current=!0;const{x:K,y:W}=Ie(A.nativeEvent,C.current),{startX:R,startY:Y}=P,ee={startX:R,startY:Y,x:K<R?K:R,y:W<Y?W:Y,width:Math.abs(K-R),height:Math.abs(W-Y)},re=E.current,Z=M.current;E.current=new Set(Qo(S,ee,$,n===gt.Partial,!0).map(J=>J.id)),M.current=new Set;const ne=U?.selectable??!0;for(const J of E.current){const le=H.get(J);if(le)for(const{edgeId:he}of le.values()){const Ce=O.get(he);Ce&&(Ce.selectable??ne)&&M.current.add(he)}}if(!Ns(re,E.current)){const J=vt(S,E.current,!0);B(J)}if(!Ns(Z,M.current)){const J=vt(O,M.current);F(J)}p.setState({userSelectionRect:ee,userSelectionActive:!0,nodesSelectionActive:!1})},I=A=>{if(A.button!==0||!z.current)return;A.target?.releasePointerCapture?.(A.pointerId);const{userSelectionRect:P}=p.getState();!g&&P&&A.target===x.current&&V?.(A),p.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:E.current.size>0}),s?.(A),(t||r)&&(N.current=!1),z.current=!1},k=o===!0||Array.isArray(o)&&o.includes(0);return v.jsxs("div",{className:ue(["react-flow__pane",{draggable:k,dragging:w,selection:e}]),onClick:m?void 0:xr(V,x),onContextMenu:xr(j,x),onWheel:xr(D,x),onPointerEnter:m?void 0:d,onPointerDown:m?L:f,onPointerMove:m?b:f,onPointerUp:m?I:void 0,onPointerLeave:u,ref:x,style:no,children:[h,v.jsx(Ng,{})]})}function wr({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Ta({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ae(),[l,c]=T.useState(!1),d=T.useRef();return T.useEffect(()=>{d.current=fp({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{wr({id:f,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),T.useEffect(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{d.current?.destroy()}},[n,o,t,i,e,r]),l}const Tg=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ma(){const e=ae();return T.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:d}=e.getState(),f=new Map,u=Tg(s),h=r?i[0]:5,p=r?i[1]:5,g=n.direction.x*h*n.factor,y=n.direction.y*p*n.factor;for(const[,w]of c){if(!u(w))continue;let _={x:w.internals.positionAbsolute.x+g,y:w.internals.positionAbsolute.y+y};r&&(_=Gt(_,i));const{position:m,positionAbsolute:x}=ms({nodeId:w.id,nextPosition:_,nodeLookup:c,nodeExtent:o,nodeOrigin:d,onError:a});w.position=m,w.internals.positionAbsolute=x,f.set(w.id,w)}l(f)},[])}const br=T.createContext(null),Mg=br.Provider;br.Consumer;const oo=()=>T.useContext(br),Ag=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ig=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===pt.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}};function Pg({type:e="source",position:t=q.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:f,...u},h){const p=s||null,g=e==="target",y=ae(),w=oo(),{connectOnClick:_,noPanClassName:m,rfId:x}=oe(Ag,ce),{connectingFrom:C,connectingTo:E,clickConnecting:M,isPossibleEndHandle:N,connectionInProcess:z,clickConnectionInProcess:V,valid:j}=oe(Ig(w,p,e),ce);w||y.getState().onError?.("010",ye.error010());const D=I=>{const{defaultEdgeOptions:k,onConnect:A,hasDefaultEdges:P}=y.getState(),$={...k,...I};if(P){const{edges:S,setEdges:O}=y.getState();O(Un($,S))}A?.($),a?.($)},L=I=>{if(!w)return;const k=Ts(I.nativeEvent);if(r&&(k&&I.button===0||!k)){const A=y.getState();dr.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:g,handleId:p,nodeId:w,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:A.onConnectEnd,updateConnection:A.updateConnection,onConnect:D,isValidConnection:n||A.isValidConnection,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}k?d?.(I):f?.(I)},b=I=>{const{onClickConnectStart:k,onClickConnectEnd:A,connectionClickStartHandle:P,connectionMode:$,isValidConnection:S,lib:O,rfId:H,nodeLookup:B,connection:F}=y.getState();if(!w||!P&&!r)return;if(!P){k?.(I.nativeEvent,{nodeId:w,handleId:p,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:w,type:e,id:p}});return}const U=Cs(I.target),K=n||S,{connection:W,isValid:R}=dr.isValid(I.nativeEvent,{handle:{nodeId:w,id:p,type:e},connectionMode:$,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:K,flowId:H,doc:U,lib:O,nodeLookup:B});R&&W&&D(W);const Y=structuredClone(F);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,A?.(I,Y),y.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":p,"data-nodeid":w,"data-handlepos":t,"data-id":`${x}-${w}-${p}-${e}`,className:ue(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,c,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:i,clickconnecting:M,connectingfrom:C,connectingto:E,valid:j,connectionindicator:o&&(!z||N)&&(z||V?i:r)}]),onMouseDown:L,onTouchStart:L,onClick:_?b:void 0,ref:h,...u,children:l})}const tn=T.memo(Sa(Pg));function Og({data:e,isConnectable:t,sourcePosition:n=q.Bottom}){return v.jsxs(v.Fragment,{children:[e?.label,v.jsx(tn,{type:"source",position:n,isConnectable:t})]})}function Dg({data:e,isConnectable:t,targetPosition:n=q.Top,sourcePosition:o=q.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(tn,{type:"target",position:n,isConnectable:t}),e?.label,v.jsx(tn,{type:"source",position:o,isConnectable:t})]})}function zg(){return null}function $g({data:e,isConnectable:t,targetPosition:n=q.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(tn,{type:"target",position:n,isConnectable:t}),e?.label]})}const ro={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Aa={input:Og,default:Dg,output:$g,group:zg};function jg(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const Hg=e=>{const{width:t,height:n,x:o,y:r}=Yt(e.nodeLookup,{filter:i=>!!i.selected});return{width:Ne(t)?t:null,height:Ne(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Lg({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ae(),{width:r,height:i,transformString:s,userSelectionActive:a}=oe(Hg,ce),l=Ma(),c=T.useRef(null);if(T.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),Ta({nodeRef:c}),a||!r||!i)return null;const d=e?u=>{const h=o.getState().nodes.filter(p=>p.selected);e(u,h)}:void 0,f=u=>{Object.prototype.hasOwnProperty.call(ro,u.key)&&(u.preventDefault(),l({direction:ro[u.key],factor:u.shiftKey?4:1}))};return v.jsx("div",{className:ue(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:v.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:i}})})}const Ia=typeof window<"u"?window:void 0,Vg=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Pa({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:f,onSelectionStart:u,onSelectionEnd:h,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:y,elementsSelectable:w,zoomOnScroll:_,zoomOnPinch:m,panOnScroll:x,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:M,panOnDrag:N,defaultViewport:z,translateExtent:V,minZoom:j,maxZoom:D,preventScrolling:L,onSelectionContextMenu:b,noWheelClassName:I,noPanClassName:k,disableKeyboardA11y:A,onViewportChange:P,isControlledViewport:$}){const{nodesSelectionActive:S,userSelectionActive:O}=oe(Vg),H=Qt(c,{target:Ia}),B=Qt(g,{target:Ia}),F=B||N,U=B||x,K=d&&F!==!0,W=H||O||K;return bg({deleteKeyCode:l,multiSelectionKeyCode:p}),v.jsx(Eg,{onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:_,zoomOnPinch:m,panOnScroll:U,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:M,panOnDrag:!H&&F,defaultViewport:z,translateExtent:V,minZoom:j,maxZoom:D,zoomActivationKeyCode:y,preventScrolling:L,noWheelClassName:I,noPanClassName:k,onViewportChange:P,isControlledViewport:$,paneClickDistance:a,children:v.jsxs(kg,{onSelectionStart:u,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:F,isSelecting:!!W,selectionMode:f,selectionKeyPressed:H,selectionOnDrag:K,children:[e,S&&v.jsx(Lg,{onSelectionContextMenu:b,noPanClassName:k,disableKeyboardA11y:A})]})})}Pa.displayName="FlowRenderer";const Rg=T.memo(Pa),Bg=e=>t=>e?Qo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Fg(e){return oe(T.useCallback(Bg(e),[e]),ce)}const Wg=e=>e.updateNodeInternals;function Yg(){const e=oe(Wg),[t]=T.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return T.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Xg({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ae(),i=T.useRef(null),s=T.useRef(null),a=T.useRef(e.sourcePosition),l=T.useRef(e.targetPosition),c=T.useRef(t),d=n&&!!e.internals.handleBounds;return T.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[d,e.hidden]),T.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),T.useEffect(()=>{if(i.current){const f=c.current!==t,u=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(f||u||h)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Gg({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:f,noDragClassName:u,noPanClassName:h,disableKeyboardA11y:p,rfId:g,nodeTypes:y,nodeClickDistance:w,onError:_}){const{node:m,internals:x,isParent:C}=oe(R=>{const Y=R.nodeLookup.get(e),ee=R.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:ee}},ce);let E=m.type||"default",M=y?.[E]||Aa[E];M===void 0&&(_?.("003",ye.error003(E)),E="default",M=y?.default||Aa.default);const N=!!(m.draggable||a&&typeof m.draggable>"u"),z=!!(m.selectable||l&&typeof m.selectable>"u"),V=!!(m.connectable||c&&typeof m.connectable>"u"),j=!!(m.focusable||d&&typeof m.focusable>"u"),D=ae(),L=Es(m),b=Xg({node:m,nodeType:E,hasDimensions:L,resizeObserver:f}),I=Ta({nodeRef:b,disabled:m.hidden||!N,noDragClassName:u,handleSelector:m.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:w}),k=Ma();if(m.hidden)return null;const A=je(m),P=jg(m),$=z||N||t||n||o||r,S=n?R=>n(R,{...x.userNode}):void 0,O=o?R=>o(R,{...x.userNode}):void 0,H=r?R=>r(R,{...x.userNode}):void 0,B=i?R=>i(R,{...x.userNode}):void 0,F=s?R=>s(R,{...x.userNode}):void 0,U=R=>{const{selectNodesOnDrag:Y,nodeDragThreshold:ee}=D.getState();z&&(!Y||!N||ee>0)&&wr({id:e,store:D,nodeRef:b}),t&&t(R,{...x.userNode})},K=R=>{if(!(ks(R.nativeEvent)||p)){if(cs.includes(R.key)&&z){const Y=R.key==="Escape";wr({id:e,store:D,unselect:Y,nodeRef:b})}else if(N&&m.selected&&Object.prototype.hasOwnProperty.call(ro,R.key)){R.preventDefault();const{ariaLabelConfig:Y}=D.getState();D.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:R.key.replace("Arrow","").toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),k({direction:ro[R.key],factor:R.shiftKey?4:1})}}},W=()=>{if(p||!b.current?.matches(":focus-visible"))return;const{transform:R,width:Y,height:ee,autoPanOnNodeFocus:re,setCenter:Z}=D.getState();if(!re)return;Qo(new Map([[e,m]]),{x:0,y:0,width:Y,height:ee},R,!0).length>0||Z(m.position.x+A.width/2,m.position.y+A.height/2,{zoom:R[2]})};return v.jsx("div",{className:ue(["react-flow__node",`react-flow__node-${E}`,{[h]:N},m.className,{selected:m.selected,selectable:z,parent:C,draggable:N,dragging:I}]),ref:b,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:L?"visible":"hidden",...m.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:S,onMouseMove:O,onMouseLeave:H,onContextMenu:B,onClick:U,onDoubleClick:F,onKeyDown:j?K:void 0,tabIndex:j?0:void 0,onFocus:j?W:void 0,role:m.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${ua}-${g}`,"aria-label":m.ariaLabel,...m.domAttributes,children:v.jsx(Mg,{value:e,children:v.jsx(M,{id:e,data:m.data,type:E,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:m.selected??!1,selectable:z,draggable:N,deletable:m.deletable??!0,isConnectable:V,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:I,dragHandle:m.dragHandle,zIndex:x.z,parentId:m.parentId,...A})})})}const Ug=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Oa(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=oe(Ug,ce),s=Fg(e.onlyRenderVisibleElements),a=Yg();return v.jsx("div",{className:"react-flow__nodes",style:no,children:s.map(l=>v.jsx(Gg,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}Oa.displayName="NodeRenderer";const qg=T.memo(Oa);function Zg(e){return oe(T.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&qh({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),ce)}const Kg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return v.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Qg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return v.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Da={[Rn.Arrow]:Kg,[Rn.ArrowClosed]:Qg};function Jg(e){const t=ae();return T.useMemo(()=>Object.prototype.hasOwnProperty.call(Da,e)?Da[e]:(t.getState().onError?.("009",ye.error009(e)),null),[e])}const em=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Jg(t);return l?v.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:v.jsx(l,{color:n,strokeWidth:s})}):null},za=({defaultColor:e,rfId:t})=>{const n=oe(i=>i.edges),o=oe(i=>i.defaultEdgeOptions),r=T.useMemo(()=>np(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:r.map(i=>v.jsx(em,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};za.displayName="MarkerDefinitions";var tm=T.memo(za);function $a({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d}){const[f,u]=T.useState({x:1,y:0,width:0,height:0}),h=ue(["react-flow__edge-textwrapper",c]),p=T.useRef(null);return T.useEffect(()=>{if(p.current){const g=p.current.getBBox();u({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?v.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...d,children:[r&&v.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),v.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:p,style:o,children:n}),l]}):null}$a.displayName="EdgeText";const nm=T.memo($a);function _t({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...d,d:e,fill:"none",className:ue(["react-flow__edge-path",d.className])}),c?v.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&Ne(t)&&Ne(n)?v.jsx(nm,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function ja({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===q.Left||e===q.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Ha({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top}){const[s,a]=ja({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=ja({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,f,u,h]=As({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,f,u,h]}function La(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[_,m,x]=Ha({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),C=e.isInternal?void 0:t;return v.jsx(_t,{id:C,path:_,labelX:m,labelY:x,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:w})})}const om=La({isInternal:!1}),Va=La({isInternal:!0});om.displayName="SimpleBezierEdge",Va.displayName="SimpleBezierEdgeInternal";function Ra(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:f,style:u,sourcePosition:h=q.Bottom,targetPosition:p=q.Top,markerEnd:g,markerStart:y,pathOptions:w,interactionWidth:_})=>{const[m,x,C]=or({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:p,borderRadius:w?.borderRadius,offset:w?.offset,stepPosition:w?.stepPosition}),E=e.isInternal?void 0:t;return v.jsx(_t,{id:E,path:m,labelX:x,labelY:C,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:g,markerStart:y,interactionWidth:_})})}const Ba=Ra({isInternal:!1}),Fa=Ra({isInternal:!0});Ba.displayName="SmoothStepEdge",Fa.displayName="SmoothStepEdgeInternal";function Wa(e){return T.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return v.jsx(Ba,{...n,id:o,pathOptions:T.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const rm=Wa({isInternal:!1}),Ya=Wa({isInternal:!0});rm.displayName="StepEdge",Ya.displayName="StepEdgeInternal";function Xa(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:h,markerStart:p,interactionWidth:g})=>{const[y,w,_]=Os({sourceX:n,sourceY:o,targetX:r,targetY:i}),m=e.isInternal?void 0:t;return v.jsx(_t,{id:m,path:y,labelX:w,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:f,style:u,markerEnd:h,markerStart:p,interactionWidth:g})})}const im=Xa({isInternal:!1}),Ga=Xa({isInternal:!0});im.displayName="StraightEdge",Ga.displayName="StraightEdgeInternal";function Ua(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=q.Bottom,targetPosition:a=q.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,pathOptions:w,interactionWidth:_})=>{const[m,x,C]=Gn({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:w?.curvature}),E=e.isInternal?void 0:t;return v.jsx(_t,{id:E,path:m,labelX:x,labelY:C,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:_})})}const sm=Ua({isInternal:!1}),qa=Ua({isInternal:!0});sm.displayName="BezierEdge",qa.displayName="BezierEdgeInternal";const Za={default:qa,straight:Ga,step:Ya,smoothstep:Fa,simplebezier:Va},Ka={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},am=(e,t,n)=>n===q.Left?e-t:n===q.Right?e+t:e,lm=(e,t,n)=>n===q.Top?e-t:n===q.Bottom?e+t:e,Qa="react-flow__edgeupdater";function Ja({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return v.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ue([Qa,`${Qa}-${a}`]),cx:am(t,o,e),cy:lm(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function cm({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:f,setReconnecting:u,setUpdateHover:h}){const p=ae(),g=(x,C)=>{if(x.button!==0)return;const{autoPanOnConnect:E,domNode:M,isValidConnection:N,connectionMode:z,connectionRadius:V,lib:j,onConnectStart:D,onConnectEnd:L,cancelConnection:b,nodeLookup:I,rfId:k,panBy:A,updateConnection:P}=p.getState(),$=C.type==="target",S=(B,F)=>{u(!1),f?.(B,n,C.type,F)},O=B=>c?.(n,B),H=(B,F)=>{u(!0),d?.(x,n,C.type),D?.(B,F)};dr.onPointerDown(x.nativeEvent,{autoPanOnConnect:E,connectionMode:z,connectionRadius:V,domNode:M,handleId:C.id,nodeId:C.nodeId,nodeLookup:I,isTarget:$,edgeUpdaterType:C.type,lib:j,flowId:k,cancelConnection:b,panBy:A,isValidConnection:N,onConnect:O,onConnectStart:H,onConnectEnd:L,onReconnectEnd:S,updateConnection:P,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:x.currentTarget})},y=x=>g(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),w=x=>g(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>h(!0),m=()=>h(!1);return v.jsxs(v.Fragment,{children:[(e===!0||e==="source")&&v.jsx(Ja,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:y,onMouseEnter:_,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&v.jsx(Ja,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:w,onMouseEnter:_,onMouseOut:m,type:"target"})]})}function um({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:f,onReconnectStart:u,onReconnectEnd:h,rfId:p,edgeTypes:g,noPanClassName:y,onError:w,disableKeyboardA11y:_}){let m=oe(Z=>Z.edgeLookup.get(e));const x=oe(Z=>Z.defaultEdgeOptions);m=x?{...x,...m}:m;let C=m.type||"default",E=g?.[C]||Za[C];E===void 0&&(w?.("011",ye.error011(C)),C="default",E=g?.default||Za.default);const M=!!(m.focusable||t&&typeof m.focusable>"u"),N=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),z=!!(m.selectable||o&&typeof m.selectable>"u"),V=T.useRef(null),[j,D]=T.useState(!1),[L,b]=T.useState(!1),I=ae(),{zIndex:k,sourceX:A,sourceY:P,targetX:$,targetY:S,sourcePosition:O,targetPosition:H}=oe(T.useCallback(Z=>{const ne=Z.nodeLookup.get(m.source),J=Z.nodeLookup.get(m.target);if(!ne||!J)return{zIndex:m.zIndex,...Ka};const le=tp({id:e,sourceNode:ne,targetNode:J,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:Z.connectionMode,onError:w});return{zIndex:Uh({selected:m.selected,zIndex:m.zIndex,sourceNode:ne,targetNode:J,elevateOnSelect:Z.elevateEdgesOnSelect}),...le||Ka}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),ce),B=T.useMemo(()=>m.markerStart?`url('#${rr(m.markerStart,p)}')`:void 0,[m.markerStart,p]),F=T.useMemo(()=>m.markerEnd?`url('#${rr(m.markerEnd,p)}')`:void 0,[m.markerEnd,p]);if(m.hidden||A===null||P===null||$===null||S===null)return null;const U=Z=>{const{addSelectedEdges:ne,unselectNodesAndEdges:J,multiSelectionActive:le}=I.getState();z&&(I.setState({nodesSelectionActive:!1}),m.selected&&le?(J({nodes:[],edges:[m]}),V.current?.blur()):ne([e])),r&&r(Z,m)},K=i?Z=>{i(Z,{...m})}:void 0,W=s?Z=>{s(Z,{...m})}:void 0,R=a?Z=>{a(Z,{...m})}:void 0,Y=l?Z=>{l(Z,{...m})}:void 0,ee=c?Z=>{c(Z,{...m})}:void 0,re=Z=>{if(!_&&cs.includes(Z.key)&&z){const{unselectNodesAndEdges:ne,addSelectedEdges:J}=I.getState();Z.key==="Escape"?(V.current?.blur(),ne({edges:[m]})):J([e])}};return v.jsx("svg",{style:{zIndex:k},children:v.jsxs("g",{className:ue(["react-flow__edge",`react-flow__edge-${C}`,m.className,y,{selected:m.selected,animated:m.animated,inactive:!z&&!r,updating:j,selectable:z}]),onClick:U,onDoubleClick:K,onContextMenu:W,onMouseEnter:R,onMouseMove:Y,onMouseLeave:ee,onKeyDown:M?re:void 0,tabIndex:M?0:void 0,role:m.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":M?`${da}-${p}`:void 0,ref:V,...m.domAttributes,children:[!L&&v.jsx(E,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:z,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:A,sourceY:P,targetX:$,targetY:S,sourcePosition:O,targetPosition:H,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:B,markerEnd:F,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),N&&v.jsx(cm,{edge:m,isReconnectable:N,reconnectRadius:d,onReconnect:f,onReconnectStart:u,onReconnectEnd:h,sourceX:A,sourceY:P,targetX:$,targetY:S,sourcePosition:O,targetPosition:H,setUpdateHover:D,setReconnecting:b})]})})}const dm=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function el({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:u,onReconnectStart:h,onReconnectEnd:p,disableKeyboardA11y:g}){const{edgesFocusable:y,edgesReconnectable:w,elementsSelectable:_,onError:m}=oe(dm,ce),x=Zg(t);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(tm,{defaultColor:e,rfId:n}),x.map(C=>v.jsx(um,{id:C,edgesFocusable:y,edgesReconnectable:w,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:f,onDoubleClick:u,onReconnectStart:h,onReconnectEnd:p,rfId:n,onError:m,edgeTypes:o,disableKeyboardA11y:g},C))]})}el.displayName="EdgeRenderer";const fm=T.memo(el),hm=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function pm({children:e}){const t=oe(hm);return v.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function gm(e){const t=en(),n=T.useRef(!1);T.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const mm=e=>e.panZoom?.syncViewport;function ym(e){const t=oe(mm),n=ae();return T.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function xm(e){return e.connection.inProgress?{...e.connection,to:Ut(e.connection.to,e.transform)}:{...e.connection}}function wm(e){return xm}function tl(e){const t=wm();return oe(t,ce)}const bm=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function vm({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=oe(bm,ce);return!(i&&r&&l)?null:v.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:ue(["react-flow__connection",ps(a)]),children:v.jsx(nl,{style:t,type:n,CustomComponent:o,isValid:a})})})}const nl=({style:e,type:t=Le.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:d,toHandle:f,toPosition:u}=tl();if(!r)return;if(n)return v.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:u,connectionStatus:ps(o),toNode:d,toHandle:f});let h="";const p={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:u};switch(t){case Le.Bezier:[h]=Gn(p);break;case Le.SimpleBezier:[h]=Ha(p);break;case Le.Step:[h]=or({...p,borderRadius:0});break;case Le.SmoothStep:[h]=or(p);break;default:[h]=Os(p)}return v.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};nl.displayName="ConnectionLine";const _m={};function ol(e=_m){const t=T.useRef(e),n=ae();T.useEffect(()=>{if(process.env.NODE_ENV==="development"){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",ye.error002());break}t.current=e}},[e])}function Em(){const e=ae(),t=T.useRef(!1);T.useEffect(()=>{if(process.env.NODE_ENV==="development"&&!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",ye.error013("react")),t.current=!0}},[])}function rl({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:u,onSelectionEnd:h,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:y,connectionLineContainerStyle:w,selectionKeyCode:_,selectionOnDrag:m,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:M,deleteKeyCode:N,onlyRenderVisibleElements:z,elementsSelectable:V,defaultViewport:j,translateExtent:D,minZoom:L,maxZoom:b,preventScrolling:I,defaultMarkerColor:k,zoomOnScroll:A,zoomOnPinch:P,panOnScroll:$,panOnScrollSpeed:S,panOnScrollMode:O,zoomOnDoubleClick:H,panOnDrag:B,onPaneClick:F,onPaneMouseEnter:U,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneScroll:R,onPaneContextMenu:Y,paneClickDistance:ee,nodeClickDistance:re,onEdgeContextMenu:Z,onEdgeMouseEnter:ne,onEdgeMouseMove:J,onEdgeMouseLeave:le,reconnectRadius:he,onReconnect:Ce,onReconnectStart:St,onReconnectEnd:co,noDragClassName:uo,noWheelClassName:fo,noPanClassName:sn,disableKeyboardA11y:an,nodeExtent:Ir,rfId:ho,viewport:Nt,onViewportChange:ln}){return ol(e),ol(t),Em(),gm(n),ym(Nt),v.jsx(Rg,{onPaneClick:F,onPaneMouseEnter:U,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneContextMenu:Y,onPaneScroll:R,paneClickDistance:ee,deleteKeyCode:N,selectionKeyCode:_,selectionOnDrag:m,selectionMode:x,onSelectionStart:u,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:M,elementsSelectable:V,zoomOnScroll:A,zoomOnPinch:P,zoomOnDoubleClick:H,panOnScroll:$,panOnScrollSpeed:S,panOnScrollMode:O,panOnDrag:B,defaultViewport:j,translateExtent:D,minZoom:L,maxZoom:b,onSelectionContextMenu:f,preventScrolling:I,noDragClassName:uo,noWheelClassName:fo,noPanClassName:sn,disableKeyboardA11y:an,onViewportChange:ln,isControlledViewport:!!Nt,children:v.jsxs(pm,{children:[v.jsx(fm,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:Ce,onReconnectStart:St,onReconnectEnd:co,onlyRenderVisibleElements:z,onEdgeContextMenu:Z,onEdgeMouseEnter:ne,onEdgeMouseMove:J,onEdgeMouseLeave:le,reconnectRadius:he,defaultMarkerColor:k,noPanClassName:sn,disableKeyboardA11y:an,rfId:ho}),v.jsx(vm,{style:g,type:p,component:y,containerStyle:w}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(qg,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:re,onlyRenderVisibleElements:z,noPanClassName:sn,noDragClassName:uo,disableKeyboardA11y:an,nodeExtent:Ir,rfId:ho}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}rl.displayName="GraphView";const Sm=T.memo(rl),il=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:f}={})=>{const u=new Map,h=new Map,p=new Map,g=new Map,y=o??t??[],w=n??e??[],_=d??[0,0],m=f??Ft;Rs(p,g,y);const x=ar(w,u,h,{nodeOrigin:_,nodeExtent:m,elevateNodesOnSelect:!1});let C=[0,0,1];if(s&&r&&i){const E=Yt(u,{filter:V=>!!((V.width||V.initialWidth)&&(V.height||V.initialHeight))}),{x:M,y:N,zoom:z}=tr(E,r,i,l,c,a?.padding??.1);C=[M,N,z]}return{rfId:"1",width:0,height:0,transform:C,nodes:w,nodesInitialized:x,nodeLookup:u,parentLookup:h,edges:y,edgeLookup:g,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Ft,nodeExtent:m,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:pt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...ds},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_s,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:us}},Nm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:f})=>Gp((u,h)=>{async function p(){const{nodeLookup:g,panZoom:y,fitViewOptions:w,fitViewResolver:_,width:m,height:x,minZoom:C,maxZoom:E}=h();y&&(await Rh({nodes:g,width:m,height:x,panZoom:y,minZoom:C,maxZoom:E},w),_?.resolve(!0),u({fitViewResolver:null}))}return{...il({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:o}),setNodes:g=>{const{nodeLookup:y,parentLookup:w,nodeOrigin:_,elevateNodesOnSelect:m,fitViewQueued:x}=h(),C=ar(g,y,w,{nodeOrigin:_,nodeExtent:f,elevateNodesOnSelect:m,checkEquality:!0});x&&C?(p(),u({nodes:g,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0})):u({nodes:g,nodesInitialized:C})},setEdges:g=>{const{connectionLookup:y,edgeLookup:w}=h();Rs(y,w,g),u({edges:g})},setDefaultNodesAndEdges:(g,y)=>{if(g){const{setNodes:w}=h();w(g),u({hasDefaultNodes:!0})}if(y){const{setEdges:w}=h();w(y),u({hasDefaultEdges:!0})}},updateNodeInternals:g=>{const{triggerNodeChanges:y,nodeLookup:w,parentLookup:_,domNode:m,nodeOrigin:x,nodeExtent:C,debug:E,fitViewQueued:M}=h(),{changes:N,updatedInternals:z}=ap(g,w,_,m,x,C);z&&(rp(w,_,{nodeOrigin:x,nodeExtent:C}),M?(p(),u({fitViewQueued:!1,fitViewOptions:void 0})):u({}),N?.length>0&&(E&&console.log("React Flow: trigger node changes",N),y?.(N)))},updateNodePositions:(g,y=!1)=>{const w=[],_=[],{nodeLookup:m,triggerNodeChanges:x}=h();for(const[C,E]of g){const M=m.get(C),N=!!(M?.expandParent&&M?.parentId&&E?.position),z={id:C,type:"position",position:N?{x:Math.max(0,E.position.x),y:Math.max(0,E.position.y)}:E.position,dragging:y};N&&M.parentId&&w.push({id:C,parentId:M.parentId,rect:{...E.internals.positionAbsolute,width:E.measured.width??0,height:E.measured.height??0}}),_.push(z)}if(w.length>0){const{parentLookup:C,nodeOrigin:E}=h(),M=cr(w,m,C,E);_.push(...M)}x(_)},triggerNodeChanges:g=>{const{onNodesChange:y,setNodes:w,nodes:_,hasDefaultNodes:m,debug:x}=h();if(g?.length){if(m){const C=ba(g,_);w(C)}x&&console.log("React Flow: trigger node changes",g),y?.(g)}},triggerEdgeChanges:g=>{const{onEdgesChange:y,setEdges:w,edges:_,hasDefaultEdges:m,debug:x}=h();if(g?.length){if(m){const C=Jt(g,_);w(C)}x&&console.log("React Flow: trigger edge changes",g),y?.(g)}},addSelectedNodes:g=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:_,triggerNodeChanges:m,triggerEdgeChanges:x}=h();if(y){const C=g.map(E=>et(E,!0));m(C);return}m(vt(_,new Set([...g]),!0)),x(vt(w))},addSelectedEdges:g=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:_,triggerNodeChanges:m,triggerEdgeChanges:x}=h();if(y){const C=g.map(E=>et(E,!0));x(C);return}x(vt(w,new Set([...g]))),m(vt(_,new Set,!0))},unselectNodesAndEdges:({nodes:g,edges:y}={})=>{const{edges:w,nodes:_,nodeLookup:m,triggerNodeChanges:x,triggerEdgeChanges:C}=h(),E=g||_,M=y||w,N=E.map(V=>{const j=m.get(V.id);return j&&(j.selected=!1),et(V.id,!1)}),z=M.map(V=>et(V.id,!1));x(N),C(z)},setMinZoom:g=>{const{panZoom:y,maxZoom:w}=h();y?.setScaleExtent([g,w]),u({minZoom:g})},setMaxZoom:g=>{const{panZoom:y,minZoom:w}=h();y?.setScaleExtent([w,g]),u({maxZoom:g})},setTranslateExtent:g=>{h().panZoom?.setTranslateExtent(g),u({translateExtent:g})},setPaneClickDistance:g=>{h().panZoom?.setClickDistance(g)},resetSelectedElements:()=>{const{edges:g,nodes:y,triggerNodeChanges:w,triggerEdgeChanges:_,elementsSelectable:m}=h();if(!m)return;const x=y.reduce((E,M)=>M.selected?[...E,et(M.id,!1)]:E,[]),C=g.reduce((E,M)=>M.selected?[...E,et(M.id,!1)]:E,[]);w(x),_(C)},setNodeExtent:g=>{const{nodes:y,nodeLookup:w,parentLookup:_,nodeOrigin:m,elevateNodesOnSelect:x,nodeExtent:C}=h();g[0][0]===C[0][0]&&g[0][1]===C[0][1]&&g[1][0]===C[1][0]&&g[1][1]===C[1][1]||(ar(y,w,_,{nodeOrigin:m,nodeExtent:g,elevateNodesOnSelect:x,checkEquality:!1}),u({nodeExtent:g}))},panBy:g=>{const{transform:y,width:w,height:_,panZoom:m,translateExtent:x}=h();return lp({delta:g,panZoom:m,transform:y,translateExtent:x,width:w,height:_})},setCenter:async(g,y,w)=>{const{width:_,height:m,maxZoom:x,panZoom:C}=h();if(!C)return Promise.resolve(!1);const E=typeof w?.zoom<"u"?w.zoom:x;return await C.setViewport({x:_/2-g*E,y:m/2-y*E,zoom:E},{duration:w?.duration,ease:w?.ease,interpolate:w?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{u({connection:{...ds}})},updateConnection:g=>{u({connection:g})},reset:()=>u({...il()})}},Object.is);function sl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:f,children:u}){const[h]=T.useState(()=>Nm({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:f}));return v.jsx(Up,{value:h,children:v.jsx(mg,{children:u})})}function Cm({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u}){return T.useContext(Jn)?v.jsx(v.Fragment,{children:e}):v.jsx(sl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:f,nodeExtent:u,children:e})}const km={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Tm({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:f,onMoveEnd:u,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:w,onNodeMouseEnter:_,onNodeMouseMove:m,onNodeMouseLeave:x,onNodeContextMenu:C,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:N,onNodeDragStop:z,onNodesDelete:V,onEdgesDelete:j,onDelete:D,onSelectionChange:L,onSelectionDragStart:b,onSelectionDrag:I,onSelectionDragStop:k,onSelectionContextMenu:A,onSelectionStart:P,onSelectionEnd:$,onBeforeDelete:S,connectionMode:O,connectionLineType:H=Le.Bezier,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:U,deleteKeyCode:K="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:R=!1,selectionMode:Y=gt.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:re=qt()?"Meta":"Control",zoomActivationKeyCode:Z=qt()?"Meta":"Control",snapToGrid:ne,snapGrid:J,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:he,nodesDraggable:Ce,autoPanOnNodeFocus:St,nodesConnectable:co,nodesFocusable:uo,nodeOrigin:fo=fa,edgesFocusable:sn,edgesReconnectable:an,elementsSelectable:Ir=!0,defaultViewport:ho=ag,minZoom:Nt=.5,maxZoom:ln=2,translateExtent:Dl=Ft,preventScrolling:My=!0,nodeExtent:Pr,defaultMarkerColor:Ay="#b1b1b7",zoomOnScroll:Iy=!0,zoomOnPinch:Py=!0,panOnScroll:Oy=!1,panOnScrollSpeed:Dy=.5,panOnScrollMode:zy=Ke.Free,zoomOnDoubleClick:$y=!0,panOnDrag:jy=!0,onPaneClick:Hy,onPaneMouseEnter:Ly,onPaneMouseMove:Vy,onPaneMouseLeave:Ry,onPaneScroll:By,onPaneContextMenu:Fy,paneClickDistance:zl=0,nodeClickDistance:Wy=0,children:Yy,onReconnect:Xy,onReconnectStart:Gy,onReconnectEnd:Uy,onEdgeContextMenu:qy,onEdgeDoubleClick:Zy,onEdgeMouseEnter:Ky,onEdgeMouseMove:Qy,onEdgeMouseLeave:Jy,reconnectRadius:e0=10,onNodesChange:t0,onEdgesChange:n0,noDragClassName:o0="nodrag",noWheelClassName:r0="nowheel",noPanClassName:$l="nopan",fitView:jl,fitViewOptions:Hl,connectOnClick:i0,attributionPosition:s0,proOptions:a0,defaultEdgeOptions:l0,elevateNodesOnSelect:c0,elevateEdgesOnSelect:u0,disableKeyboardA11y:Ll=!1,autoPanOnConnect:d0,autoPanOnNodeDrag:f0,autoPanSpeed:h0,connectionRadius:p0,isValidConnection:g0,onError:m0,style:y0,id:Vl,nodeDragThreshold:x0,connectionDragThreshold:w0,viewport:b0,onViewportChange:v0,width:_0,height:E0,colorMode:S0="light",debug:N0,onScroll:Rl,ariaLabelConfig:C0,...k0},T0){const Or=Vl||"1",M0=ug(S0),A0=T.useCallback(Bl=>{Bl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Rl?.(Bl)},[Rl]);return v.jsx("div",{"data-testid":"rf__wrapper",...k0,onScroll:A0,style:{...y0,...km},ref:T0,className:ue(["react-flow",r,M0]),id:Vl,role:"application",children:v.jsxs(Cm,{nodes:e,edges:t,width:_0,height:E0,fitView:jl,fitViewOptions:Hl,minZoom:Nt,maxZoom:ln,nodeOrigin:fo,nodeExtent:Pr,children:[v.jsx(Sm,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:m,onNodeMouseLeave:x,onNodeContextMenu:C,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:s,connectionLineType:H,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:R,selectionMode:Y,deleteKeyCode:K,multiSelectionKeyCode:re,panActivationKeyCode:ee,zoomActivationKeyCode:Z,onlyRenderVisibleElements:le,defaultViewport:ho,translateExtent:Dl,minZoom:Nt,maxZoom:ln,preventScrolling:My,zoomOnScroll:Iy,zoomOnPinch:Py,zoomOnDoubleClick:$y,panOnScroll:Oy,panOnScrollSpeed:Dy,panOnScrollMode:zy,panOnDrag:jy,onPaneClick:Hy,onPaneMouseEnter:Ly,onPaneMouseMove:Vy,onPaneMouseLeave:Ry,onPaneScroll:By,onPaneContextMenu:Fy,paneClickDistance:zl,nodeClickDistance:Wy,onSelectionContextMenu:A,onSelectionStart:P,onSelectionEnd:$,onReconnect:Xy,onReconnectStart:Gy,onReconnectEnd:Uy,onEdgeContextMenu:qy,onEdgeDoubleClick:Zy,onEdgeMouseEnter:Ky,onEdgeMouseMove:Qy,onEdgeMouseLeave:Jy,reconnectRadius:e0,defaultMarkerColor:Ay,noDragClassName:o0,noWheelClassName:r0,noPanClassName:$l,rfId:Or,disableKeyboardA11y:Ll,nodeExtent:Pr,viewport:b0,onViewportChange:v0}),v.jsx(cg,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:p,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:w,nodesDraggable:Ce,autoPanOnNodeFocus:St,nodesConnectable:co,nodesFocusable:uo,edgesFocusable:sn,edgesReconnectable:an,elementsSelectable:Ir,elevateNodesOnSelect:c0,elevateEdgesOnSelect:u0,minZoom:Nt,maxZoom:ln,nodeExtent:Pr,onNodesChange:t0,onEdgesChange:n0,snapToGrid:ne,snapGrid:J,connectionMode:O,translateExtent:Dl,connectOnClick:i0,defaultEdgeOptions:l0,fitView:jl,fitViewOptions:Hl,onNodesDelete:V,onEdgesDelete:j,onDelete:D,onNodeDragStart:M,onNodeDrag:N,onNodeDragStop:z,onSelectionDrag:I,onSelectionDragStart:b,onSelectionDragStop:k,onMove:d,onMoveStart:f,onMoveEnd:u,noPanClassName:$l,nodeOrigin:fo,rfId:Or,autoPanOnConnect:d0,autoPanOnNodeDrag:f0,autoPanSpeed:h0,onError:m0,connectionRadius:p0,isValidConnection:g0,selectNodesOnDrag:he,nodeDragThreshold:x0,connectionDragThreshold:w0,onBeforeDelete:S,paneClickDistance:zl,debug:N0,ariaLabelConfig:C0}),v.jsx(sg,{onSelectionChange:L}),Yy,v.jsx(tg,{proOptions:a0,position:s0}),v.jsx(eg,{rfId:Or,disableKeyboardA11y:Ll})]})})}var Mm=Sa(Tm);const Am=ye.error014();function Im({id:e,handleType:t,handleId:n,onConnect:o,onDisconnect:r}={}){const i=oo(),s=e??i;if(!s)throw new Error(Am);const a=T.useRef(null),l=oe(c=>c.connectionLookup.get(`${s}${t?n?`-${t}-${n}`:`-${t}`:""}`),jh);return T.useEffect(()=>{if(a.current&&a.current!==l){const c=l??new Map;hs(a.current,c,r),hs(c,a.current,o)}a.current=l??new Map},[l,o,r]),T.useMemo(()=>Array.from(l?.values()??[]),[l])}function vr(e){return oe(T.useCallback(n=>{const o=[],r=Array.isArray(e),i=r?e:[e];for(const s of i){const a=n.nodeLookup.get(s);a&&o.push({id:a.id,type:a.type,data:a.data})}return r?o:o[0]??null},[e]),cp)}function Pm({dimensions:e,lineWidth:t,variant:n,className:o}){return v.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ue(["react-flow__background-pattern",n,o])})}function Om({radius:e,className:t}){return v.jsx("circle",{cx:e,cy:e,r:e,className:ue(["react-flow__background-pattern","dots",t])})}var Be;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Be||(Be={}));const Dm={[Be.Dots]:1,[Be.Lines]:1,[Be.Cross]:6},zm=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function al({id:e,variant:t=Be.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:d}){const f=T.useRef(null),{transform:u,patternId:h}=oe(zm,ce),p=o||Dm[t],g=t===Be.Dots,y=t===Be.Cross,w=Array.isArray(n)?n:[n,n],_=[w[0]*u[2]||1,w[1]*u[2]||1],m=p*u[2],x=Array.isArray(i)?i:[i,i],C=y?[m,m]:_,E=[x[0]*u[2]||1+C[0]/2,x[1]*u[2]||1+C[1]/2],M=`${h}${e||""}`;return v.jsxs("svg",{className:ue(["react-flow__background",c]),style:{...l,...no,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:f,"data-testid":"rf__background",children:[v.jsx("pattern",{id:M,x:u[0]%_[0],y:u[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:g?v.jsx(Om,{radius:m/2,className:d}):v.jsx(Pm,{dimensions:C,lineWidth:r,variant:t,className:d})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}al.displayName="Background";const $m=T.memo(al);function jm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Hm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Lm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Vm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Rm(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function io({children:e,className:t,...n}){return v.jsx("button",{type:"button",className:ue(["react-flow__controls-button",t]),...n,children:e})}const Bm=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ll({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:d,position:f="bottom-left",orientation:u="vertical","aria-label":h}){const p=ae(),{isInteractive:g,minZoomReached:y,maxZoomReached:w,ariaLabelConfig:_}=oe(Bm,ce),{zoomIn:m,zoomOut:x,fitView:C}=en(),E=()=>{m(),i?.()},M=()=>{x(),s?.()},N=()=>{C(r),a?.()},z=()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l?.(!g)},V=u==="horizontal"?"horizontal":"vertical";return v.jsxs(eo,{className:ue(["react-flow__controls",V,c]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??_["controls.ariaLabel"],children:[t&&v.jsxs(v.Fragment,{children:[v.jsx(io,{onClick:E,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:w,children:v.jsx(jm,{})}),v.jsx(io,{onClick:M,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:y,children:v.jsx(Hm,{})})]}),n&&v.jsx(io,{className:"react-flow__controls-fitview",onClick:N,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:v.jsx(Lm,{})}),o&&v.jsx(io,{className:"react-flow__controls-interactive",onClick:z,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:g?v.jsx(Rm,{}):v.jsx(Vm,{})}),d]})}ll.displayName="Controls";const Fm=T.memo(ll);function Wm({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:d,shapeRendering:f,selected:u,onClick:h}){const{background:p,backgroundColor:g}=i||{},y=s||p||g;return v.jsx("rect",{className:ue(["react-flow__minimap-node",{selected:u},c]),x:t,y:n,rx:d,ry:d,width:o,height:r,style:{fill:y,stroke:a,strokeWidth:l},shapeRendering:f,onClick:h?w=>h(w,e):void 0})}const Ym=T.memo(Wm),Xm=e=>e.nodes.map(t=>t.id),_r=e=>e instanceof Function?e:()=>e;function Gm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=Ym,onClick:s}){const a=oe(Xm,ce),l=_r(t),c=_r(e),d=_r(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:a.map(u=>v.jsx(qm,{id:u,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},u))})}function Um({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:d,y:f,width:u,height:h}=oe(p=>{const{internals:g}=p.nodeLookup.get(e),y=g.userNode,{x:w,y:_}=g.positionAbsolute,{width:m,height:x}=je(y);return{node:y,x:w,y:_,width:m,height:x}},ce);return!c||c.hidden||!Es(c)?null:v.jsx(a,{x:d,y:f,width:u,height:h,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const qm=T.memo(Um);var Zm=T.memo(Gm);const Km=200,Qm=150,Jm=e=>!e.hidden,ey=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?bs(Yt(e.nodeLookup,{filter:Jm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ty="react-flow__minimap-desc";function cl({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:f,position:u="bottom-right",onClick:h,onNodeClick:p,pannable:g=!1,zoomable:y=!1,ariaLabel:w,inversePan:_,zoomStep:m=1,offsetScale:x=5}){const C=ae(),E=T.useRef(null),{boundingRect:M,viewBB:N,rfId:z,panZoom:V,translateExtent:j,flowWidth:D,flowHeight:L,ariaLabelConfig:b}=oe(ey,ce),I=e?.width??Km,k=e?.height??Qm,A=M.width/I,P=M.height/k,$=Math.max(A,P),S=$*I,O=$*k,H=x*$,B=M.x-(S-M.width)/2-H,F=M.y-(O-M.height)/2-H,U=S+H*2,K=O+H*2,W=`${ty}-${z}`,R=T.useRef(0),Y=T.useRef();R.current=$,T.useEffect(()=>{if(E.current&&V)return Y.current=xp({domNode:E.current,panZoom:V,getTransform:()=>C.getState().transform,getViewScale:()=>R.current}),()=>{Y.current?.destroy()}},[V]),T.useEffect(()=>{Y.current?.update({translateExtent:j,width:D,height:L,inversePan:_,pannable:g,zoomStep:m,zoomable:y})},[g,y,_,m,j,D,L]);const ee=h?ne=>{const[J,le]=Y.current?.pointer(ne)||[0,0];h(ne,{x:J,y:le})}:void 0,re=p?T.useCallback((ne,J)=>{const le=C.getState().nodeLookup.get(J).internals.userNode;p(ne,le)},[]):void 0,Z=w??b["minimap.ariaLabel"];return v.jsx(eo,{position:u,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*$:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ue(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:I,height:k,viewBox:`${B} ${F} ${U} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:E,onClick:ee,children:[Z&&v.jsx("title",{id:W,children:Z}),v.jsx(Zm,{onClick:re,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-H},${F-H}h${U+H*2}v${K+H*2}h${-U-H*2}z
60
+ M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}cl.displayName="MiniMap";const ny=T.memo(cl),oy=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,ry={[Je.Line]:"right",[Je.Handle]:"bottom-right"};function iy({nodeId:e,position:t,variant:n=Je.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:u,autoScale:h=!0,shouldResize:p,onResizeStart:g,onResize:y,onResizeEnd:w}){const _=oo(),m=typeof e=="string"?e:_,x=ae(),C=T.useRef(null),E=n===Je.Handle,M=oe(T.useCallback(oy(E&&h),[E,h]),ce),N=T.useRef(null),z=t??ry[n];T.useEffect(()=>{if(!(!C.current||!m))return N.current||(N.current=Dp({domNode:C.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:j,transform:D,snapGrid:L,snapToGrid:b,nodeOrigin:I,domNode:k}=x.getState();return{nodeLookup:j,transform:D,snapGrid:L,snapToGrid:b,nodeOrigin:I,paneDomNode:k}},onChange:(j,D)=>{const{triggerNodeChanges:L,nodeLookup:b,parentLookup:I,nodeOrigin:k}=x.getState(),A=[],P={x:j.x,y:j.y},$=b.get(m);if($&&$.expandParent&&$.parentId){const S=$.origin??k,O=j.width??$.measured.width??0,H=j.height??$.measured.height??0,B={id:$.id,parentId:$.parentId,rect:{width:O,height:H,...Ss({x:j.x??$.position.x,y:j.y??$.position.y},{width:O,height:H},$.parentId,b,S)}},F=cr([B],b,I,k);A.push(...F),P.x=j.x?Math.max(S[0]*O,j.x):void 0,P.y=j.y?Math.max(S[1]*H,j.y):void 0}if(P.x!==void 0&&P.y!==void 0){const S={id:m,type:"position",position:{...P}};A.push(S)}if(j.width!==void 0&&j.height!==void 0){const O={id:m,type:"dimensions",resizing:!0,setAttributes:u?u==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};A.push(O)}for(const S of D){const O={...S,type:"position"};A.push(O)}L(A)},onEnd:({width:j,height:D})=>{const L={id:m,type:"dimensions",resizing:!1,dimensions:{width:j,height:D}};x.getState().triggerNodeChanges([L])}})),N.current.update({controlPosition:z,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:f,resizeDirection:u,onResizeStart:g,onResize:y,onResizeEnd:w,shouldResize:p}),()=>{N.current?.destroy()}},[z,a,l,c,d,f,g,y,w,p]);const V=z.split("-");return v.jsx("div",{className:ue(["react-flow__resize-control","nodrag",...V,n,o]),ref:C,style:{...r,scale:M,...s&&{[E?"backgroundColor":"borderColor"]:s}},children:i})}const ul=T.memo(iy),Er=20;function tt(e,t){const n=t[e.dataType],o=e.allowInput??n.allowInput;return n.underlyingType==="number"?{id:ct(Er),name:e.name,handleColor:n.color,allowInput:o,type:"number",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:{id:ct(Er),name:e.name,handleColor:n.color,allowInput:n.underlyingType==="string"?o:!1,type:"string",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}}function dl(e,t){const n=ct(Er),o=e.inputs.map(r=>tt(r,t));return{id:n,name:e.name,inputs:o}}function Sr(e,t,n,o,r){const i=n[t],s=i.inputs.map(l=>"inputs"in l?dl(l,e):tt(l,e)),a=i.outputs.map(l=>tt(l,e));return{id:o,position:r,sourcePosition:q.Right,targetPosition:q.Left,type:"configurableNode",width:400,data:{name:i.name,headerColor:i.headerColor,inputs:s,outputs:a}}}function fl(e,t,n,o){const r=n[t];if(o)if(o.type==="input"){const i=r?.inputs?.[o.index1];if(!i)return;if(o.index2!==void 0&&"inputs"in i)return tt(i.inputs?.[o.index2],e);if(o.index2===void 0&&!("inputs"in i))return tt(i,e)}else return tt(r?.outputs?.[o.index1],e)}function sy(e,t,n,o,r,i){if(!i.sourceHandle||!i.targetHandle)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle not found"}};const s=nt(o,e.nodes[t].data),a=nt(r,e.nodes[n].data),l=s?.dataType,c=a?.dataType,d=s?.inferredDataType,f=a?.inferredDataType;if(!l||!c)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(l.dataTypeObject.underlyingType!=="inferFromConnection"&&c.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};if(l.dataTypeObject.underlyingType==="inferFromConnection"&&c.dataTypeObject.underlyingType==="inferFromConnection"){if(!d&&!f)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"None of the handles are inferred, inference has no information to work with"}};if(d&&f)return{updatedNodes:e.nodes,validation:{isValid:!0}};if(d){const u=[...e.nodes];return u[n]={...e.nodes[n],data:Et(e.nodes[n].data,o,l.dataTypeUniqueId,{dataTypeToInferAs:d.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:u,validation:{isValid:!0}}}if(f){const u=[...e.nodes];return u[t]={...e.nodes[t],data:Et(e.nodes[t].data,r,c.dataTypeUniqueId,{dataTypeToInferAs:f.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:u,validation:{isValid:!0}}}}if(l.dataTypeObject.underlyingType==="inferFromConnection"){if(d)return{updatedNodes:e.nodes,validation:{isValid:!0}};const u=[...e.nodes];return u[t]={...e.nodes[t],data:Et(e.nodes[t].data,r,l.dataTypeUniqueId,{dataTypeToInferAs:c.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:u,validation:{isValid:!0}}}if(c.dataTypeObject.underlyingType==="inferFromConnection"){if(f)return{updatedNodes:e.nodes,validation:{isValid:!0}};const u=[...e.nodes];return u[n]={...e.nodes[n],data:Et(e.nodes[n].data,o,c.dataTypeUniqueId,{dataTypeToInferAs:l.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:u,validation:{isValid:!0}}}return{updatedNodes:e.nodes,validation:{isValid:!0}}}function ay(e,t,n,o,r,i){const s=e.nodes[t],a=e.nodes[n],l=nt(o,s.data),c=nt(r,a.data),d=l?.dataType,f=c?.dataType;if(!d||!f)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(d.dataTypeObject.underlyingType!=="inferFromConnection"&&f.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};let u=e.nodes;if(d.dataTypeObject.underlyingType==="inferFromConnection"){const h=Jo([s],e.edges),{inputsAndIndices:p,outputsAndIndices:g}=Cr(s.data),y={};for(const _ of p)_.input.dataType?.dataTypeUniqueId===d.dataTypeUniqueId&&(y[_.input.id]=!0);for(const _ of g)_.output.dataType?.dataTypeUniqueId===d.dataTypeUniqueId&&(y[_.output.id]=!0);let w=!1;for(const _ of h)if(_.id!==i.id&&!(!_.sourceHandle||!_.targetHandle)){if(y[_.sourceHandle]){w=!0;break}if(y[_.targetHandle]){w=!0;break}}w||(u=[...e.nodes],u[t]={...e.nodes[t],data:Et(e.nodes[t].data,o,d.dataTypeUniqueId,{dataTypeToInferAs:d.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!0},e.dataTypes,e.typeOfNodes)})}if(f.dataTypeObject.underlyingType==="inferFromConnection"){const h=Jo([a],e.edges),{inputsAndIndices:p,outputsAndIndices:g}=Cr(a.data),y={};for(const _ of p)_.input.dataType?.dataTypeUniqueId===f.dataTypeUniqueId&&(y[_.input.id]=!0);for(const _ of g)_.output.dataType?.dataTypeUniqueId===f.dataTypeUniqueId&&(y[_.output.id]=!0);let w=!1;for(const _ of h)if(_.id!==i.id&&!(!_.sourceHandle||!_.targetHandle)){if(y[_.sourceHandle]){w=!0;break}if(y[_.targetHandle]){w=!0;break}}w||(u=[...e.nodes],u[n]={...e.nodes[n],data:Et(e.nodes[n].data,r,f.dataTypeUniqueId,{dataTypeToInferAs:f.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!0},e.dataTypes,e.typeOfNodes)})}return{updatedNodes:u,validation:{isValid:!0}}}const ly=20;function hl(e,t,n,o,r){const i={id:ct(ly),source:e,target:n,sourceHandle:t,targetHandle:o,type:"configurableEdge"};if(Un(i,r.edges)===r.edges)return{updatedNodes:r.nodes,updatedEdges:r.edges,validation:{isValid:!1,reason:"Edge already exists or was rejected by reactflow"}};if(!(r.enableTypeInference||r.enableComplexTypeChecking||r.allowedConversionsBetweenDataTypes))return{updatedNodes:r.nodes,updatedEdges:Un(i,r.edges),validation:{isValid:!0}};const a=r.nodes.findIndex(g=>g.id===e),l=r.nodes.findIndex(g=>g.id===n);if(a===-1||l===-1)return{updatedNodes:r.nodes,updatedEdges:r.edges,validation:{isValid:!1,reason:"Source or target node not found"}};const c=r.nodes[a],d=r.nodes[l],f=nn(t,c.data),u=nn(o,d.data);if(!f||!u)return{updatedNodes:r.nodes,updatedEdges:r.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let h=r.nodes,p={isValid:!0};if(r.enableTypeInference){const{updatedNodes:g,validation:y}=sy(r,a,l,f,u,i);h=g,p=y}return{updatedNodes:h,updatedEdges:Un(i,r.edges),validation:p}}function pl(e,t,n){if(Jt([n],t.edges)===t.edges)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Edge already exists or was rejected by reactflow"}};if(!(t.enableTypeInference||t.enableComplexTypeChecking||t.allowedConversionsBetweenDataTypes))return{updatedNodes:t.nodes,updatedEdges:Jt([n],t.edges),validation:{isValid:!0}};const r=t.nodes.findIndex(u=>u.id===e.source),i=t.nodes.findIndex(u=>u.id===e.target);if(r===-1||i===-1)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target node not found"}};if(!e.sourceHandle||!e.targetHandle)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};const s=t.nodes[r],a=t.nodes[i],l=nn(e.sourceHandle,s.data),c=nn(e.targetHandle,a.data);if(!l||!c)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let d=t.nodes,f={isValid:!0};if(t.enableTypeInference){const{updatedNodes:u,validation:h}=ay(t,r,i,l,c,e);d=u,f=h}return{updatedNodes:d,updatedEdges:Jt([n],t.edges),validation:f}}const gl=20,ve=["ADD_NODE","ADD_NODE_AND_SELECT","UPDATE_NODE_BY_REACT_FLOW","UPDATE_EDGES_BY_REACT_FLOW","ADD_EDGE_BY_REACT_FLOW","UPDATE_INPUT_VALUE"],Pe={[ve[0]]:ve[0],[ve[1]]:ve[1],[ve[2]]:ve[2],[ve[3]]:ve[3],[ve[4]]:ve[4],[ve[5]]:ve[5]};function ml(e,t){return nu(e,o=>{switch(t.type){case Pe.ADD_NODE:const r=t.payload.type,i=ct(gl),s=t.payload.position,a=Sr(o.dataTypes,r,o.typeOfNodes,i,s);o.nodes.push(a),o.nodeIdToNodeType[i]=r;break;case Pe.ADD_NODE_AND_SELECT:const l=t.payload.type,c=ct(gl),d=t.payload.position,f=Sr(o.dataTypes,l,o.typeOfNodes,c,d);o.nodes=o.nodes.map(x=>({...x,selected:!1})),o.nodes.push({...f,selected:!0}),o.nodeIdToNodeType[c]=l;break;case Pe.UPDATE_NODE_BY_REACT_FLOW:const u=t.payload.changes;o.nodes=ba(u,o.nodes);break;case Pe.UPDATE_EDGES_BY_REACT_FLOW:const h=t.payload.changes;for(const x of h){if(x.type!=="remove"){o.edges=Jt([x],o.edges);continue}const{id:C}=x,E=o.edges.find(N=>N.id===C);if(!E)continue;const M=pl(E,o,x);M.validation.isValid&&(o.edges=M.updatedEdges,o.nodes=M.updatedNodes)}break;case Pe.ADD_EDGE_BY_REACT_FLOW:const p=t.payload.edge,{sourceHandle:g,targetHandle:y,source:w,target:_}=p;if(!w||!_||!g||!y)break;const m=hl(w,g,_,y,o);if(!m.validation.isValid)break;o.edges=m.updatedEdges,o.nodes=m.updatedNodes;break}})}function nn(e,t){const n=t?.inputs instanceof Array?t?.inputs:[],r=(t?.outputs instanceof Array?t?.outputs:[]).findIndex(a=>a.id===e);if(r!==-1)return{type:"output",index1:r,index2:void 0};let i;const s=n.findIndex(a=>{if("inputs"in a){const l=a.inputs.findIndex(c=>c.id===e);return l!==-1?(i=l,!0):!1}else return a.id===e});if(s!==-1)return{type:"input",index1:s,index2:i}}function nt(e,t){if(e)if(e.type==="input"){const n=t?.inputs?.[e.index1];if(!n)return;if(e.index2!==void 0&&"inputs"in n)return n.inputs?.[e.index2];if(e.index2===void 0&&!("inputs"in n))return n}else return t?.outputs?.[e.index1]}function Nr(e,t){const n=nn(e,t);return nt(n,t)}function cy(e,t,n){return t.map(o=>o.id===e?{...o,...n}:o)}function uy(e,t,n){return"inputs"in t?{...t,inputs:cy(e,t.inputs,n)}:t.id===e?{...t,...n}:t}function yl(e,t,n){return{...t,inputs:(t.inputs||[]).map(r=>uy(e,r,n))}}function dy(e,t,n){if(e.type!="input")return t;const o=nt(e,t);if(!o)return t;const r={...o,...n},i=[...t.inputs||[]],s=t?.inputs?.[e.index1];if(!s)return t;if(e.index2!==void 0&&"inputs"in s){const l=[...s.inputs||[]];l[e.index2]=r,i[e.index1]={...s,inputs:l}}else e.index2===void 0&&!("inputs"in s)&&(i[e.index1]=r);return{...t,inputs:i}}function fy(e,t,n){if(e.type!="output")return t;const o=nt(e,t);if(!o)return t;const r={...o,...n},i=[...t.outputs||[]];return i[e.index1]=r,{...t,outputs:i}}function hy(e){let t=[];return e.inputs?.forEach((n,o)=>{"inputs"in n?n.inputs.forEach((r,i)=>{t.push({input:r,handleIndices:{type:"input",index1:o,index2:i}})}):t.push({input:n,handleIndices:{type:"input",index1:o,index2:void 0}})}),t}function py(e){let t=[];return e.outputs?.forEach((n,o)=>{t.push({output:n,handleIndices:{type:"output",index1:o,index2:void 0}})}),t}function Cr(e){return{inputsAndIndices:hy(e),outputsAndIndices:py(e)}}function xl(e,t,n,o,r,i){const s=o?fl(r,o.connectedNodeType,i,n):void 0;let a;if(s){const{id:l,name:c,dataType:d,...f}=s;a=f}return t.type==="input"?dy(t,e,{inferredDataType:o?.dataTypeToInferAs&&!o.resetInferredType?{dataTypeObject:r[o.dataTypeToInferAs],dataTypeUniqueId:o.dataTypeToInferAs}:void 0,...o?.dataTypeToInferAs&&a?a:{}}):fy(t,e,{inferredDataType:o?.dataTypeToInferAs&&!o.resetInferredType?{dataTypeObject:r[o.dataTypeToInferAs],dataTypeUniqueId:o.dataTypeToInferAs}:void 0,...o?.dataTypeToInferAs&&a?a:{}})}function Et(e,t,n,o,r,i){const{inputsAndIndices:s,outputsAndIndices:a}=Cr(e);let l=e;for(const c of s)c.input.dataType?.dataTypeUniqueId===n&&(l=xl(l,c.handleIndices,t,o,r,i));for(const c of a)c.output.dataType?.dataTypeUniqueId===n&&(l=xl(l,c.handleIndices,t,o,r,i));return l}const kr=T.forwardRef(({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,...a},l)=>{const[c]=Gn({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s}),d=ae(),[f,u]=T.useState(!0),h=T.useRef(null);T.useEffect(()=>{const M=d.getState().domNode;if(!M)return;const N=document.getElementById(e);if(!N)return;const z=new IntersectionObserver(V=>{const j=V.find(D=>D.target.id===e);j&&u(D=>j.isIntersecting)},{root:M,threshold:1,rootMargin:"20px"});return z.observe(N),h.current=z,()=>{h.current&&(h.current.disconnect(),h.current=null)}},[d.getState().domNode]);const p=vr(a.source||""),g=T.useMemo(()=>!a.source||!p?void 0:Nr(a.sourceHandleId||"",p?.data)?.handleColor??"#A1A1A1",[a.source,p]),y=vr(a.target||""),w=T.useMemo(()=>!a.target||!y?void 0:Nr(a.targetHandleId||"",y?.data)?.handleColor??"#A1A1A1",[a.target,y]),{label:_,labelStyle:m,markerStart:x,markerEnd:C,interactionWidth:E}=a;return v.jsxs(v.Fragment,{children:[v.jsx("defs",{children:v.jsxs("linearGradient",{id:`linear-gradient-edge-${e}`,x1:t,y1:n,x2:o,y2:r,gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:g,offset:"0"}),v.jsx("stop",{stopColor:w,offset:"1"})]})}),v.jsx(_t,{id:e,path:c,label:_,labelStyle:m,markerEnd:C,markerStart:x,interactionWidth:E,className:ie("!stroke-7 in-[g.selected]:brightness-150",!f&&"opacity-25"),style:{stroke:`url(#${`linear-gradient-edge-${e}`})`},focusable:!0})]})});kr.displayName="ConfigurableEdge";function wl(e,t,n=!0,o=!1){const r=e!==null?"current"in e?e.current:e:null,i=T.useCallback(s=>{if(!r)return;let a=!0;if(n&&s.target instanceof Node&&!r.contains(s.target))a=!1;else if(o){const l="clientX"in s?{x:s.clientX,y:s.clientY}:{x:s.touches[0].clientX,y:s.touches[0].clientY},c=r.getBoundingClientRect();ni(l,c)||(a=!1)}a||t()},[r,t,n,o]);T.useEffect(()=>(document.addEventListener("mousedown",i),document.addEventListener("touchstart",i),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("touchstart",i)}),[r,i])}const on=T.forwardRef(({placeholder:e="Input",className:t,...n},o)=>{const r=T.useMemo(()=>n.allowOnlyNumbers&&n.value!==void 0?vo(n.value,n.numberOfDecimals??5):n.value?.toString(),[n.value,n.allowOnlyNumbers,n.numberOfDecimals]),[i,s]=T.useState(r??""),[a,l]=T.useState(null),c=n.value??i,[d,f]=T.useState(c.toString());function u(p){n.allowOnlyNumbers&&/[^0-9\.\-]/.test(p)||f(p)}function h(){if(n.allowOnlyNumbers){const p=oi(d||c.toString()),g=vo(p,n.numberOfDecimals??5);s(g),n.onChange?.(p),f(g)}else s(d),n.onChange?.(d),f(d)}return wl(a,()=>h()),v.jsx("input",{type:"text",className:ie("h-[44px] rounded-md text-primary-white bg-primary-black font-main px-4 text-[27px] leading-[27px] outline-none focus-visible:!outline-none border-secondary-dark-gray border w-max min-w-0 placeholder:text-[#6B6B6B]",t),placeholder:e,size:5,ref:p=>{l(p),typeof o=="function"?o(p):o&&(o.current=p)},value:d,onChange:p=>u(p.target.value),onKeyDown:p=>{p.key==="Enter"&&h()},onMouseMove:p=>{p.preventDefault(),p.stopPropagation()},onBlur:p=>{p.preventDefault(),p.stopPropagation(),h()}})});on.displayName="Input";function bl({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:r,lineStyle:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,autoScale:u=!0,shouldResize:h,onResizeStart:p,onResize:g,onResizeEnd:y,linePosition:w=["left","right"],handlePosition:_=[],resizeDirection:m="horizontal"}){return t?v.jsxs(v.Fragment,{children:[w.map(x=>v.jsx(ul,{className:ie("!border-none",x==="left"||x==="right"?"!w-4":"!h-4",r),style:i,nodeId:e,position:x,variant:Je.Line,color:s,minWidth:a,minHeight:l,maxWidth:c,maxHeight:d,onResizeStart:p,keepAspectRatio:f,autoScale:u,shouldResize:h,onResize:g,onResizeEnd:y,resizeDirection:m},x)),_.map(x=>v.jsx(ul,{className:n,style:o,nodeId:e,position:x,color:s,minWidth:a,minHeight:l,maxWidth:c,maxHeight:d,onResizeStart:p,keepAspectRatio:f,autoScale:u,shouldResize:h,onResize:g,onResizeEnd:y,resizeDirection:m},x))]}):null}function vl({onMove:e,onClick:t,clickThreshold:n=2,enabled:o=!0,preventDefaultAndStopPropagation:r=!0}={}){const[i,s]=T.useState(!1),[a,l]=T.useState(null),c=T.useRef(null),d=T.useRef(null),f=T.useCallback(u=>{l(u)},[]);return T.useEffect(()=>{if(!a||!o)return;const u=h=>{r&&(h.preventDefault(),h.stopPropagation()),c.current={x:h.clientX,y:h.clientY},d.current={width:a.clientWidth,height:a.clientHeight},s(!0);const p=y=>{r&&(y.preventDefault(),y.stopPropagation()),document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",g),s(!1),c.current&&Math.sqrt((y.clientX-c.current.x)**2+(y.clientY-c.current.y)**2)<n&&t?.()},g=y=>{r&&(y.preventDefault(),y.stopPropagation());const w=y.movementX,_=y.movementY,m=d.current?.width||1,x=d.current?.height||1,C=w/m,E=_/x;e?.(w,_,C,E,m,x)};document.addEventListener("mouseup",p),document.addEventListener("mousemove",g)};return a.addEventListener("mousedown",u),()=>{a.removeEventListener("mousedown",u)}},[a,o,e,t,n,r]),{isDragging:i,dragRef:f}}/**
61
61
  * @license lucide-react v0.542.0 - ISC
62
62
  *
63
63
  * This source code is licensed under the ISC license.
64
64
  * See the LICENSE file in the root directory of this source tree.
65
- */const Qm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),hl=e=>{const t=Jm(e);return t.charAt(0).toUpperCase()+t.slice(1)},pl=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),ey=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
65
+ */const gy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),my=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),_l=e=>{const t=my(e);return t.charAt(0).toUpperCase()+t.slice(1)},El=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),yy=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
66
66
  * @license lucide-react v0.542.0 - ISC
67
67
  *
68
68
  * This source code is licensed under the ISC license.
69
69
  * See the LICENSE file in the root directory of this source tree.
70
- */var ty={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
70
+ */var xy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
71
  * @license lucide-react v0.542.0 - ISC
72
72
  *
73
73
  * This source code is licensed under the ISC license.
74
74
  * See the LICENSE file in the root directory of this source tree.
75
- */const ny=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:s,iconNode:i,...a},l)=>k.createElement("svg",{ref:l,...ty,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:pl("lucide",r),...!s&&!ey(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,d])=>k.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
75
+ */const wy=T.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:i,iconNode:s,...a},l)=>T.createElement("svg",{ref:l,...xy,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:El("lucide",r),...!i&&!yy(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,d])=>T.createElement(c,d)),...Array.isArray(i)?i:[i]]));/**
76
76
  * @license lucide-react v0.542.0 - ISC
77
77
  *
78
78
  * This source code is licensed under the ISC license.
79
79
  * See the LICENSE file in the root directory of this source tree.
80
- */const Jt=(e,t)=>{const n=k.forwardRef(({className:o,...r},s)=>k.createElement(ny,{ref:s,iconNode:t,className:pl(`lucide-${Qm(hl(e))}`,`lucide-${e}`,o),...r}));return n.displayName=hl(e),n};/**
80
+ */const rn=(e,t)=>{const n=T.forwardRef(({className:o,...r},i)=>T.createElement(wy,{ref:i,iconNode:t,className:El(`lucide-${gy(_l(e))}`,`lucide-${e}`,o),...r}));return n.displayName=_l(e),n};/**
81
81
  * @license lucide-react v0.542.0 - ISC
82
82
  *
83
83
  * This source code is licensed under the ISC license.
84
84
  * See the LICENSE file in the root directory of this source tree.
85
- */const oy=Jt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
85
+ */const by=rn("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
86
86
  * @license lucide-react v0.542.0 - ISC
87
87
  *
88
88
  * This source code is licensed under the ISC license.
89
89
  * See the LICENSE file in the root directory of this source tree.
90
- */const ry=Jt("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
90
+ */const vy=rn("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
91
91
  * @license lucide-react v0.542.0 - ISC
92
92
  *
93
93
  * This source code is licensed under the ISC license.
94
94
  * See the LICENSE file in the root directory of this source tree.
95
- */const gl=Jt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
95
+ */const Sl=rn("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
96
96
  * @license lucide-react v0.542.0 - ISC
97
97
  *
98
98
  * This source code is licensed under the ISC license.
99
99
  * See the LICENSE file in the root directory of this source tree.
100
- */const sy=Jt("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
100
+ */const _y=rn("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
101
101
  * @license lucide-react v0.542.0 - ISC
102
102
  *
103
103
  * This source code is licensed under the ISC license.
104
104
  * See the LICENSE file in the root directory of this source tree.
105
- */const iy=Jt("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),no=k.forwardRef(({name:e="Input",value:t,onChange:n=()=>{},className:o,min:r,max:s,step:i},a)=>{const[l,c]=k.useState(t??0),[d,h]=k.useState(!1),u=k.useRef(0),f=k.useRef(0),p=t??l,m=k.useRef(0);k.useEffect(()=>{m.current=Math.abs(i??parseFloat(s===void 0||r===void 0?(p||1).toString():(s-r).toString()))},[p,i,s,r]);const{isDragging:x,dragRef:w}=fl({onMove:(R,L,z,H,b)=>{const P=R/(b+60);u.current+=P,Math.abs(u.current)>.05&&Date.now()-f.current>50&&(f.current=Date.now(),C(m.current*u.current),u.current=0)},onClick:N,clickThreshold:2});function C(R){c(L=>{let z=L+R;return r!==void 0&&z<=r?z=r:s!==void 0&&z>=s&&(z=s),n(z),z})}function g(R=.1){C(m.current*R)}function y(R=.1){C(-m.current*R)}function N(){h(!0)}function _(R){C(R-p),h(!1)}const I=x,E=r!==void 0&&s!==void 0&&p!==void 0&&s!==r?(p-r)/(s-r)*100:-1,D=E!==-1?`linear-gradient(90deg,#4772b3 ${E}%, #545454 ${E}%)`:"";return d?v.jsx(Qt,{className:"w-full",placeholder:e,value:p,allowOnlyNumbers:!0,onChange:R=>_(R),ref:a}):v.jsxs("div",{className:se("flex items-center gap-0 group/lightParentGroupBasedHover w-max rounded-md bg-primary-gray",o),style:D!==""?{background:D}:{},ref:a,children:[v.jsx(rt,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-r-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>y(.1),"aria-label":`Decrement ${e}`,applyHoverStyles:!I,children:v.jsx(ry,{})}),v.jsxs(rt,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-none pl-1.5 pr-0 flex-1 justify-between grid grid-cols-[repeat(2,auto)] bg-transparent",applyHoverStyles:!I,ref:w,children:[v.jsx("span",{className:"truncate text-left",children:e}),v.jsx("span",{className:"truncate",children:p.toFixed(4)})]}),v.jsx(rt,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-l-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>g(.1),"aria-label":`Increment ${e}`,applyHoverStyles:!I,children:v.jsx(gl,{})})]})});no.displayName="SliderNumberInput";const ml=({subItems:e,onItemClick:t,className:n})=>{const[o,r]=k.useState(null),s=i=>{i.onClick&&i.onClick(),t&&t(i)};return v.jsx("ul",{className:se("min-w-48 bg-[#181818] border border-none rounded-md shadow-lg py-1",n),children:e.map((i,a)=>v.jsxs("li",{className:"relative",children:[i.separator&&a>0&&v.jsx("div",{className:"border-t border-gray-600 m-0"}),v.jsxs("div",{className:se("flex items-center justify-between gap-2 px-3 py-1.25 hover:bg-[#3F3F3F] cursor-pointer","transition-colors duration-150"),onClick:()=>s(i),onMouseEnter:()=>r(i.id),onMouseLeave:()=>r(null),children:[v.jsxs("div",{className:"flex items-center gap-2",children:[i.icon&&v.jsx("span",{className:"text-primary-white w-3 h-3 flex items-center justify-center",children:i.icon}),v.jsx("span",{className:"text-sm leading-3.5 text-primary-white font-main",children:i.label})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[i.shortcut&&v.jsx("span",{className:"text-sm leading-3.5 text-gray-400 font-mono",children:i.shortcut}),i.subItems&&i.subItems.length>0&&v.jsx(gl,{className:"w-3 h-3 text-gray-400"})]})]}),i.subItems&&i.subItems.length>0&&o===i.id&&v.jsx("div",{className:"absolute left-full top-0 z-50",onMouseEnter:()=>r(i.id),onMouseLeave:()=>r(null),children:v.jsx(ml,{subItems:i.subItems,onItemClick:t,className:"ml-1"})})]},i.id))})},yl=({subItems:e,className:t,onItemClick:n})=>v.jsx("div",{className:se("relative",t),children:v.jsx(ml,{subItems:e,onItemClick:n})});function xl({typeOfNodes:e,dispatch:t,setContextMenu:n,contextMenuPosition:o}){const r=Object.keys(e);if(r.length===0)return[];const s=r.map(i=>({id:`add-${i}`,label:e[i].name,onClick:()=>{t({type:"ADD_NODE",payload:{type:i,position:o}}),n({isOpen:!1,position:{x:0,y:0}})}}));return[{id:"add-node",label:"Add Node",icon:k.createElement(iy,{className:"w-4 h-4"}),subItems:s}]}const ae=["circle","square","rectangle","list","grid","diamond","trapezium","hexagon","star","cross","zigzag","sparkle","parallelogram"],fe={[ae[0]]:ae[0],[ae[1]]:ae[1],[ae[2]]:ae[2],[ae[3]]:ae[3],[ae[4]]:ae[4],[ae[5]]:ae[5],[ae[6]]:ae[6],[ae[7]]:ae[7],[ae[8]]:ae[8],[ae[9]]:ae[9],[ae[10]]:ae[10],[ae[11]]:ae[11],[ae[12]]:ae[12]},oo=(e,t,n,o="black",r=2)=>v.jsxs("div",{className:se("relative",n),children:[v.jsx("div",{className:"absolute",style:{top:-r,left:-r,right:-r,bottom:-r,backgroundColor:o,clipPath:e}}),v.jsx("div",{className:"absolute inset-0",style:{backgroundColor:t,clipPath:e}})]}),wl=(e=fe.circle,t="#A1A1A1",n)=>{const o="border-2 border-black",r="border-1 border-black",s={backgroundColor:t};switch(e){case fe.circle:return v.jsx("div",{className:se("w-6 h-6 rounded-full",o,n),style:s});case fe.square:return v.jsx("div",{className:se("w-6 h-6",o,n),style:s});case fe.rectangle:return v.jsx("div",{className:se("w-4 h-8",o,n),style:s});case fe.list:return v.jsx("div",{className:se("w-6 h-6 flex flex-col justify-center gap-0.5",n),children:[0,1,2].map(i=>v.jsx("div",{className:se("w-full h-2",r),style:s},i))});case fe.grid:return v.jsx("div",{className:se("w-6 h-6 grid grid-cols-2 gap-0.5",n),children:[0,1,2,3].map(i=>v.jsx("div",{className:se("w-full h-full",r),style:s},i))});case fe.diamond:return v.jsx("div",{className:se("w-6 h-6 rotate-45",o,n),style:s});case fe.trapezium:return oo("polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%)",t,se("w-6 h-6",n));case fe.hexagon:return oo("polygon(-50% 50%,50% 100%,150% 50%,50% 0)",t,se("w-5 h-6",n));case fe.star:return oo("polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)",t,se("w-6 h-6",n));case fe.cross:return v.jsxs("div",{className:se("w-6 h-6 relative",n),children:[v.jsx("div",{className:se("absolute top-1/2 left-0 w-full h-2 -translate-y-1/2",r),style:s}),v.jsx("div",{className:se("absolute left-1/2 top-0 w-2 h-full -translate-x-1/2",r),style:s})]});case fe.zigzag:return v.jsx("div",{className:se("w-6 h-6",n),style:{...s,"--a":"90deg","--s":"24px","--b":"4px",width:"calc(var(--b) + var(--s)/(2*tan(var(--a)/2)))",minHeight:"24px","--_g":"100% var(--s) repeat-y conic-gradient(from calc(90deg - var(--a)/2) at left, #0000, #000 1deg calc(var(--a) - 1deg), #0000 var(--a))",mask:"var(--b) 50%/var(--_g) exclude, 0 50%/var(--_g)",border:"2px solid black"}});case fe.sparkle:return v.jsx("div",{className:se("w-6 h-6",n),style:{...s,mask:"radial-gradient(#0000 71%, #000 72%) 10000% 10000%/99.5% 99.5%",border:"2px solid black"}});case fe.parallelogram:return oo("polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)",t,se("w-6 h-6",n));default:return v.jsx("div",{className:se("w-6 h-6 rounded-full",o,n),style:s})}},ro=k.forwardRef(({type:e,position:t,id:n,color:o,shape:r=fe.circle,isCurrentlyInsideReactFlow:s=!1,className:i,...a},l)=>s?v.jsx(Kt,{type:e,position:t,id:n,className:se("!w-6 !h-6 !border-none !bg-transparent !pointer-events-auto",i),style:{backgroundColor:"transparent"},...a,ref:l,children:v.jsx("div",{className:"pointer-events-none",children:wl(r,o||"#A1A1A1",i)})}):v.jsx("div",{className:se("absolute",t===U.Right&&"right-0 top-1/2 -translate-y-1/2 translate-x-1/2",t===U.Left&&"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2"),...a,ref:l,children:wl(r,o||"#A1A1A1",i)}));ro.displayName="ContextAwareHandle";const bl=({input:e})=>{const t=wt(),n=Qn();return e.type==="string"?v.jsx(Qt,{placeholder:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(s=>s.id===n?{...s,data:Ur(e.id,s.data,o)}:s))},allowOnlyNumbers:!1,className:"w-full"}):v.jsx(no,{name:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(s=>s.id===n?{...s,data:Ur(e.id,s.data,o)}:s))},className:"w-full"})},vl=({input:e,isCurrentlyInsideReactFlow:t})=>t?v.jsx(bl,{input:e}):e.type==="string"?v.jsx(Qt,{placeholder:e.name,value:e.value,onChange:e.onChange,allowOnlyNumbers:!1,className:"w-full"}):v.jsx(no,{name:e.name,value:e.value,onChange:e.onChange,className:"w-full"}),vr=k.forwardRef(({input:e,isCurrentlyInsideReactFlow:t,hide:n=!1},o)=>{const r=t?Sm({handleId:e.id}):[],s=t&&r.some(a=>a.targetHandle===e.id),i=e.allowInput&&!s;return v.jsxs("div",{ref:o,className:se("text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row py-3",n&&"h-0 overflow-hidden py-0",i&&"py-1"),children:[v.jsx(ro,{type:"target",position:U.Left,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t}),v.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[!i&&v.jsx("div",{className:"truncate",children:e.name}),i&&v.jsx("div",{className:"flex-1 w-full",children:v.jsx(vl,{input:e,isCurrentlyInsideReactFlow:t})})]})]},e.id)});vr.displayName="RenderInput";const _l=k.forwardRef(({output:e,isCurrentlyInsideReactFlow:t},n)=>v.jsxs("div",{ref:n,className:"text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row justify-end py-3",children:[v.jsx("div",{className:"truncate text-right",children:e.name}),v.jsx(ro,{type:"source",position:U.Right,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t})]},e.id));_l.displayName="RenderOutput";const Sl=k.forwardRef(({panel:e,isCurrentlyInsideReactFlow:t,isOpen:n,onToggle:o},r)=>v.jsxs("div",{ref:r,className:"flex flex-col",children:[v.jsxs(rt,{onClick:s=>{s.stopPropagation(),s.preventDefault(),o()},className:"bg-transparent border-none hover:bg-primary-gray rounded-none justify-start",children:[n?v.jsx(sy,{className:"w-6 h-6 flex-shrink-0 mr-2"}):v.jsx(oy,{className:"w-6 h-6 flex-shrink-0 mr-2"}),v.jsx("span",{className:"truncate",children:e.name})]}),v.jsx("div",{className:se("flex flex-col bg-[#272727]",!n&&"h-0 overflow-hidden"),children:e.inputs.map(s=>v.jsx(vr,{input:s,isCurrentlyInsideReactFlow:t,hide:!n},s.id))})]},e.id));Sl.displayName="RenderInputPanel";const _r=k.forwardRef(({name:e="Node",headerColor:t="#79461D",inputs:n=[],outputs:o=[],isCurrentlyInsideReactFlow:r=!1,className:s,nodeResizerProps:i={},...a},l)=>{const[c,d]=k.useState(new Set),h=u=>{d(f=>{const p=new Set(f);return p.has(u)?p.delete(u):p.add(u),p})};return v.jsxs("div",{tabIndex:0,className:se("flex flex-col gap-0 rounded-md w-max border-[1.5px] border-transparent focus:border-white",s),...a,ref:l,children:[v.jsx("div",{className:`text-primary-white text-left text-[27px] leading-[27px] font-main \\
106
- py-2 px-4 transition-all rounded-t-md truncate`,style:{backgroundColor:t},children:e}),v.jsxs("div",{className:"min-h-[50px] rounded-b-md bg-primary-dark-gray",children:[r&&v.jsx(dl,{...i}),v.jsx("div",{className:"flex flex-col py-4",children:o.map(u=>v.jsx(_l,{output:u,isCurrentlyInsideReactFlow:r},u.id))}),v.jsx("div",{className:"flex flex-col py-4",children:n.map(u=>{if("inputs"in u){const f=c.has(u.id);return v.jsx(Sl,{panel:u,isCurrentlyInsideReactFlow:r,isOpen:f,onToggle:()=>h(u.id)},u.id)}else return v.jsx(vr,{input:u,isCurrentlyInsideReactFlow:r},u.id)})})]})]})});_r.displayName="ConfigurableNode";const Sr=k.forwardRef(({data:e={}},t)=>v.jsx(_r,{isCurrentlyInsideReactFlow:!0,className:"w-full",...e,ref:t}));Sr.displayName="ConfigurableNodeReactFlowWrapper";const El=({fromX:e,fromY:t,toX:n,toY:o,fromPosition:r,toPosition:s})=>{const{fromHandle:i}=qa(),a=yr(i?.nodeId||""),l=k.useMemo(()=>!i?.id||!a?.data?void 0:mo(i?.id,a?.data)?.handleColor??"#A1A1A1",[i?.id,a?.data]),[c]=Fn({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return v.jsx(bt,{path:c,className:"!stroke-7 in-[g.selected]:brightness-150",style:{stroke:l||"#A1A1A1"},focusable:!0})};El.displayName="ConfigurableConnection";const ay={configurableNode:Sr},ly={configurableEdge:br};function cy(e){const[t,n]=k.useReducer(cl,e);return{state:t,dispatch:n}}function uy({state:e,dispatch:t}){const[n,o]=k.useState({isOpen:!1,position:{x:0,y:0}}),{screenToFlowPosition:r}=wt(),s=xl({typeOfNodes:e.typeOfNodes,dispatch:t,setContextMenu:o,contextMenuPosition:r(n.position)}),i=k.useCallback(l=>{l.preventDefault(),o({isOpen:!0,position:{x:l.clientX,y:l.clientY}})},[]),a=k.useCallback(()=>{o({isOpen:!1,position:{x:0,y:0}})},[]);return v.jsxs("div",{style:{width:"100%",height:"100%"},children:[v.jsxs(bm,{nodes:e.nodes,edges:e.edges,onNodesChange:l=>t({type:Be.UPDATE_NODE_BY_REACT_FLOW,payload:{changes:l}}),onEdgesChange:l=>t({type:Be.UPDATE_EDGES_BY_REACT_FLOW,payload:{changes:l}}),onConnect:l=>t({type:Be.ADD_EDGE_BY_REACT_FLOW,payload:{edge:l}}),fitView:!0,fitViewOptions:{maxZoom:.5,minZoom:.1},maxZoom:1,minZoom:.1,proOptions:{hideAttribution:!0},colorMode:"dark",selectNodesOnDrag:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectionMode:ft.Partial,nodeTypes:ay,edgeTypes:ly,deleteKeyCode:["Backspace","Delete","x"],connectionLineComponent:El,onContextMenu:i,onClick:a,children:[v.jsx(zm,{}),v.jsx(Mm,{}),v.jsx(Zm,{pannable:!0})]}),n.isOpen&&v.jsx("div",{style:{position:"absolute",top:n.position.y,left:n.position.x,zIndex:10},onClick:l=>l.stopPropagation(),children:v.jsx(yl,{subItems:s})})]})}function dy({state:e,dispatch:t}){return v.jsx(tl,{children:v.jsx(uy,{state:e,dispatch:t})})}ee.Button=rt,ee.ConfigurableEdge=br,ee.ConfigurableNode=_r,ee.ConfigurableNodeReactFlowWrapper=Sr,ee.ContextAwareHandle=ro,ee.ContextAwareInput=vl,ee.ContextMenu=yl,ee.FullGraph=dy,ee.Input=Qt,ee.NodeResizerWithMoreControls=dl,ee.ReactFlowAwareInput=bl,ee.SliderNumberInput=no,ee.actionTypesMap=Be,ee.cn=se,ee.constructInputOrOutputOfType=to,ee.constructInputPanelOfType=il,ee.constructNodeOfType=al,ee.convertStringToNumber=qr,ee.createNodeContextMenu=xl,ee.handleShapesMap=fe,ee.isCoordinateInBox=an,ee.isNumberInRange=yo,ee.isSupportedUnderlyingType=Pc,ee.mainReducer=cl,ee.makeDataTypeWithAutoInfer=Ic,ee.makeNodeIdToNodeTypeWithAutoInfer=Tc,ee.makeStateWithAutoInfer=Dc,ee.makeTypeOfNodeWithAutoInfer=Oc,ee.sanitizeNumberToShowAsText=xo,ee.supportedUnderlyingTypesMap=Kr,ee.useClickedOutside=ul,ee.useDrag=fl,ee.useFullGraph=cy,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
105
+ */const Ey=rn("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),so=T.forwardRef(({name:e="Input",value:t,onChange:n=()=>{},className:o,min:r,max:i,step:s},a)=>{const[l,c]=T.useState(t??0),[d,f]=T.useState(!1),u=T.useRef(0),h=T.useRef(0),p=t??l,g=T.useRef(0);T.useEffect(()=>{g.current=Math.abs(s??parseFloat(i===void 0||r===void 0?(p||1).toString():(i-r).toString()))},[p,s,i,r]);const{isDragging:y,dragRef:w}=vl({onMove:(V,j,D,L,b)=>{const I=V/(b+60);u.current+=I,Math.abs(u.current)>.05&&Date.now()-h.current>50&&(h.current=Date.now(),_(g.current*u.current),u.current=0)},onClick:C,clickThreshold:2});function _(V){c(j=>{let D=j+V;return r!==void 0&&D<=r?D=r:i!==void 0&&D>=i&&(D=i),n(D),D})}function m(V=.1){_(g.current*V)}function x(V=.1){_(-g.current*V)}function C(){f(!0)}function E(V){_(V-p),f(!1)}const M=y,N=r!==void 0&&i!==void 0&&p!==void 0&&i!==r?(p-r)/(i-r)*100:-1,z=N!==-1?`linear-gradient(90deg,#4772b3 ${N}%, #545454 ${N}%)`:"";return d?v.jsx(on,{className:"w-full",placeholder:e,value:p,allowOnlyNumbers:!0,onChange:V=>E(V),ref:a}):v.jsxs("div",{className:ie("flex items-center gap-0 group/lightParentGroupBasedHover w-max rounded-md bg-primary-gray",o),style:z!==""?{background:z}:{},ref:a,children:[v.jsx(st,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-r-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>x(.1),"aria-label":`Decrement ${e}`,applyHoverStyles:!M,children:v.jsx(vy,{})}),v.jsxs(st,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-none pl-1.5 pr-0 flex-1 justify-between grid grid-cols-[repeat(2,auto)] bg-transparent",applyHoverStyles:!M,ref:w,children:[v.jsx("span",{className:"truncate text-left",children:e}),v.jsx("span",{className:"truncate",children:p.toFixed(4)})]}),v.jsx(st,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-l-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>m(.1),"aria-label":`Increment ${e}`,applyHoverStyles:!M,children:v.jsx(Sl,{})})]})});so.displayName="SliderNumberInput";const Nl=({subItems:e,onItemClick:t,className:n})=>{const[o,r]=T.useState(null),i=s=>{s.onClick&&s.onClick(),t&&t(s)};return v.jsx("ul",{className:ie("min-w-48 bg-[#181818] border border-none rounded-md shadow-lg py-1",n),children:e.map((s,a)=>v.jsxs("li",{className:"relative",children:[s.separator&&a>0&&v.jsx("div",{className:"border-t border-gray-600 m-0"}),v.jsxs("div",{className:ie("flex items-center justify-between gap-2 px-3 py-1.25 hover:bg-[#3F3F3F] cursor-pointer","transition-colors duration-150"),onClick:()=>i(s),onMouseEnter:()=>r(s.id),onMouseLeave:()=>r(null),children:[v.jsxs("div",{className:"flex items-center gap-2",children:[s.icon&&v.jsx("span",{className:"text-primary-white w-3 h-3 flex items-center justify-center",children:s.icon}),v.jsx("span",{className:"text-sm leading-3.5 text-primary-white font-main",children:s.label})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[s.shortcut&&v.jsx("span",{className:"text-sm leading-3.5 text-gray-400 font-mono",children:s.shortcut}),s.subItems&&s.subItems.length>0&&v.jsx(Sl,{className:"w-3 h-3 text-gray-400"})]})]}),s.subItems&&s.subItems.length>0&&o===s.id&&v.jsx("div",{className:"absolute left-full top-0 z-50",onMouseEnter:()=>r(s.id),onMouseLeave:()=>r(null),children:v.jsx(Nl,{subItems:s.subItems,onItemClick:t,className:"ml-1"})})]},s.id))})},Cl=({subItems:e,className:t,onItemClick:n})=>v.jsx("div",{className:ie("relative",t),children:v.jsx(Nl,{subItems:e,onItemClick:n})});function kl({typeOfNodes:e,dispatch:t,setContextMenu:n,contextMenuPosition:o}){const r=Object.keys(e);if(r.length===0)return[];const i=r.map(s=>({id:`add-${s}`,label:e[s].name,onClick:()=>{t({type:Pe.ADD_NODE_AND_SELECT,payload:{type:s,position:o}}),n({isOpen:!1,position:{x:0,y:0}})}}));return[{id:"add-node",label:"Add Node",icon:T.createElement(Ey,{className:"w-4 h-4"}),subItems:i}]}const se=["circle","square","rectangle","list","grid","diamond","trapezium","hexagon","star","cross","zigzag","sparkle","parallelogram"],fe={[se[0]]:se[0],[se[1]]:se[1],[se[2]]:se[2],[se[3]]:se[3],[se[4]]:se[4],[se[5]]:se[5],[se[6]]:se[6],[se[7]]:se[7],[se[8]]:se[8],[se[9]]:se[9],[se[10]]:se[10],[se[11]]:se[11],[se[12]]:se[12]},ao=(e,t,n,o="black",r=2)=>v.jsxs("div",{className:ie("relative",n),children:[v.jsx("div",{className:"absolute",style:{top:-r,left:-r,right:-r,bottom:-r,backgroundColor:o,clipPath:e}}),v.jsx("div",{className:"absolute inset-0",style:{backgroundColor:t,clipPath:e}})]}),Tl=(e=fe.circle,t="#A1A1A1",n)=>{const o="border-2 border-black",r="border-1 border-black",i={backgroundColor:t};switch(e){case fe.circle:return v.jsx("div",{className:ie("w-6 h-6 rounded-full",o,n),style:i});case fe.square:return v.jsx("div",{className:ie("w-6 h-6",o,n),style:i});case fe.rectangle:return v.jsx("div",{className:ie("w-4 h-8",o,n),style:i});case fe.list:return v.jsx("div",{className:ie("w-6 h-6 flex flex-col justify-center gap-0.5",n),children:[0,1,2].map(s=>v.jsx("div",{className:ie("w-full h-2",r),style:i},s))});case fe.grid:return v.jsx("div",{className:ie("w-6 h-6 grid grid-cols-2 gap-0.5",n),children:[0,1,2,3].map(s=>v.jsx("div",{className:ie("w-full h-full",r),style:i},s))});case fe.diamond:return v.jsx("div",{className:ie("w-6 h-6 rotate-45",o,n),style:i});case fe.trapezium:return ao("polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%)",t,ie("w-6 h-6",n));case fe.hexagon:return ao("polygon(-50% 50%,50% 100%,150% 50%,50% 0)",t,ie("w-5 h-6",n));case fe.star:return ao("polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)",t,ie("w-6 h-6",n));case fe.cross:return v.jsxs("div",{className:ie("w-6 h-6 relative",n),children:[v.jsx("div",{className:ie("absolute top-1/2 left-0 w-full h-2 -translate-y-1/2",r),style:i}),v.jsx("div",{className:ie("absolute left-1/2 top-0 w-2 h-full -translate-x-1/2",r),style:i})]});case fe.zigzag:return v.jsx("div",{className:ie("w-6 h-6",n),style:{...i,width:"calc(4px + 24px/(2*tan(90deg/2)))",minHeight:"24px",mask:"4px 50%/100% 24px repeat-y conic-gradient(from calc(90deg - 90deg/2) at left, #0000, #000 1deg calc(90deg - 1deg), #0000 90deg) exclude, 0 50%/100% 24px repeat-y conic-gradient(from calc(90deg - 90deg/2) at left, #0000, #000 1deg calc(90deg - 1deg), #0000 90deg)",border:"2px solid black"}});case fe.sparkle:return v.jsx("div",{className:ie("w-6 h-6",n),style:{...i,mask:"radial-gradient(#0000 71%, #000 72%) 10000% 10000%/99.5% 99.5%",border:"2px solid black"}});case fe.parallelogram:return ao("polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)",t,ie("w-6 h-6",n));default:return v.jsx("div",{className:ie("w-6 h-6 rounded-full",o,n),style:i})}},lo=T.forwardRef(({type:e,position:t,id:n,color:o,shape:r=fe.circle,isCurrentlyInsideReactFlow:i=!1,className:s,...a},l)=>i?v.jsx(tn,{type:e,position:t,id:n,className:ie("!w-6 !h-6 !border-none !bg-transparent !pointer-events-auto",s),style:{backgroundColor:"transparent"},...a,ref:l,children:v.jsx("div",{className:ie("pointer-events-none flex justify-center"),children:Tl(r,o||"#A1A1A1",s)})}):v.jsx("div",{className:ie("absolute",t===q.Right&&"right-0 top-1/2 -translate-y-1/2 translate-x-1/2",t===q.Left&&"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2"),...a,ref:l,children:Tl(r,o||"#A1A1A1",s)}));lo.displayName="ContextAwareHandle";const Ml=({input:e})=>{const t=en(),n=oo();return e.type==="string"?v.jsx(on,{placeholder:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(i=>i.id===n?{...i,data:yl(e.id,i.data,{value:o})}:i))},allowOnlyNumbers:!1,className:"w-full"}):v.jsx(so,{name:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(i=>i.id===n?{...i,data:yl(e.id,i.data,{value:o})}:i))},className:"w-full"})},Al=({input:e,isCurrentlyInsideReactFlow:t})=>t?v.jsx(Ml,{input:e}):e.type==="string"?v.jsx(on,{placeholder:e.name,value:e.value,onChange:e.onChange,allowOnlyNumbers:!1,className:"w-full"}):v.jsx(so,{name:e.name,value:e.value,onChange:e.onChange,className:"w-full"}),Tr=T.forwardRef(({input:e,isCurrentlyInsideReactFlow:t,hide:n=!1},o)=>{const r=t?Im({handleId:e.id}):[],i=t&&r.some(a=>a.targetHandle===e.id),s=e.allowInput&&!i;return v.jsxs("div",{ref:o,className:ie("text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row py-3",n&&"h-0 overflow-hidden py-0",s&&"py-1"),children:[v.jsx(lo,{type:"target",position:q.Left,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t}),v.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[!s&&v.jsx("div",{className:"truncate",children:e.name}),s&&v.jsx("div",{className:"flex-1 w-full",children:v.jsx(Al,{input:e,isCurrentlyInsideReactFlow:t})})]})]},e.id)});Tr.displayName="RenderInput";const Il=T.forwardRef(({output:e,isCurrentlyInsideReactFlow:t},n)=>v.jsxs("div",{ref:n,className:"text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row justify-end py-3",children:[v.jsx("div",{className:"truncate text-right",children:e.name}),v.jsx(lo,{type:"source",position:q.Right,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t})]},e.id));Il.displayName="RenderOutput";const Pl=T.forwardRef(({panel:e,isCurrentlyInsideReactFlow:t,isOpen:n,onToggle:o},r)=>v.jsxs("div",{ref:r,className:"flex flex-col",children:[v.jsxs(st,{onClick:i=>{i.stopPropagation(),i.preventDefault(),o()},className:"bg-transparent border-none hover:bg-primary-gray rounded-none justify-start",children:[n?v.jsx(_y,{className:"w-6 h-6 flex-shrink-0 mr-2"}):v.jsx(by,{className:"w-6 h-6 flex-shrink-0 mr-2"}),v.jsx("span",{className:"truncate",children:e.name})]}),v.jsx("div",{className:ie("flex flex-col bg-[#272727]",!n&&"h-0 overflow-hidden"),children:e.inputs.map(i=>v.jsx(Tr,{input:i,isCurrentlyInsideReactFlow:t,hide:!n},i.id))})]},e.id));Pl.displayName="RenderInputPanel";const Mr=T.forwardRef(({name:e="Node",headerColor:t="#79461D",inputs:n=[],outputs:o=[],isCurrentlyInsideReactFlow:r=!1,className:i,nodeResizerProps:s={},...a},l)=>{const[c,d]=T.useState(new Set),f=u=>{d(h=>{const p=new Set(h);return p.has(u)?p.delete(u):p.add(u),p})};return v.jsxs("div",{tabIndex:0,className:ie("flex flex-col gap-0 rounded-md w-max border-[1.5px] border-transparent focus:border-white","in-[.selected]:border-white",i),...a,ref:l,children:[v.jsx("div",{className:`text-primary-white text-left text-[27px] leading-[27px] font-main \\
106
+ py-2 px-4 transition-all rounded-t-md truncate`,style:{backgroundColor:t},children:e}),v.jsxs("div",{className:"min-h-[50px] rounded-b-md bg-primary-dark-gray",children:[r&&v.jsx(bl,{...s}),v.jsx("div",{className:"flex flex-col py-4",children:o.map(u=>v.jsx(Il,{output:u,isCurrentlyInsideReactFlow:r},u.id))}),v.jsx("div",{className:"flex flex-col py-4",children:n.map(u=>{if("inputs"in u){const h=c.has(u.id);return v.jsx(Pl,{panel:u,isCurrentlyInsideReactFlow:r,isOpen:h,onToggle:()=>f(u.id)},u.id)}else return v.jsx(Tr,{input:u,isCurrentlyInsideReactFlow:r},u.id)})})]})]})});Mr.displayName="ConfigurableNode";const Ar=T.forwardRef(({data:e={}},t)=>v.jsx(Mr,{isCurrentlyInsideReactFlow:!0,className:"w-full",...e,ref:t}));Ar.displayName="ConfigurableNodeReactFlowWrapper";const Ol=({fromX:e,fromY:t,toX:n,toY:o,fromPosition:r,toPosition:i})=>{const{fromHandle:s}=tl(),a=vr(s?.nodeId||""),l=T.useMemo(()=>!s?.id||!a?.data?void 0:Nr(s?.id,a?.data)?.handleColor??"#A1A1A1",[s?.id,a?.data]),[c]=Gn({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:i});return v.jsx(_t,{path:c,className:"!stroke-7 in-[g.selected]:brightness-150",style:{stroke:l||"#A1A1A1"},focusable:!0})};Ol.displayName="ConfigurableConnection";const Sy={configurableNode:Ar},Ny={configurableEdge:kr};function Cy(e){const[t,n]=T.useReducer(ml,e);return{state:t,dispatch:n}}function ky({state:e,dispatch:t}){const[n,o]=T.useState({isOpen:!1,position:{x:0,y:0}}),{screenToFlowPosition:r}=en(),i=kl({typeOfNodes:e.typeOfNodes,dispatch:t,setContextMenu:o,contextMenuPosition:r(n.position)}),s=T.useCallback(l=>{l.preventDefault(),o({isOpen:!0,position:{x:l.clientX,y:l.clientY}})},[]),a=T.useCallback(()=>{o({isOpen:!1,position:{x:0,y:0}})},[]);return v.jsxs("div",{style:{width:"100%",height:"100%"},children:[v.jsxs(Mm,{nodes:e.nodes,edges:e.edges,onNodesChange:l=>t({type:Pe.UPDATE_NODE_BY_REACT_FLOW,payload:{changes:l}}),onEdgesChange:l=>t({type:Pe.UPDATE_EDGES_BY_REACT_FLOW,payload:{changes:l}}),onConnect:l=>t({type:Pe.ADD_EDGE_BY_REACT_FLOW,payload:{edge:l}}),fitView:!0,fitViewOptions:{maxZoom:.5,minZoom:.1},maxZoom:1,minZoom:.1,proOptions:{hideAttribution:!0},colorMode:"dark",selectNodesOnDrag:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectionMode:gt.Partial,nodeTypes:Sy,edgeTypes:Ny,deleteKeyCode:["Backspace","Delete","x"],connectionLineComponent:Ol,onContextMenu:s,onClick:a,children:[v.jsx(Fm,{}),v.jsx($m,{}),v.jsx(ny,{pannable:!0})]}),n.isOpen&&v.jsx("div",{style:{position:"absolute",top:n.position.y,left:n.position.x,zIndex:10},onClick:l=>l.stopPropagation(),children:v.jsx(Cl,{subItems:i})})]})}function Ty({state:e,dispatch:t}){return v.jsx(sl,{children:v.jsx(ky,{state:e,dispatch:t})})}Q.Button=st,Q.ConfigurableEdge=kr,Q.ConfigurableNode=Mr,Q.ConfigurableNodeReactFlowWrapper=Ar,Q.ContextAwareHandle=lo,Q.ContextAwareInput=Al,Q.ContextMenu=Cl,Q.FullGraph=Ty,Q.Input=on,Q.NodeResizerWithMoreControls=bl,Q.ReactFlowAwareInput=Ml,Q.SliderNumberInput=so,Q.actionTypesMap=Pe,Q.addEdgeWithTypeChecking=hl,Q.cn=ie,Q.constructInputOrOutputOfType=tt,Q.constructInputPanelOfType=dl,Q.constructNodeOfType=Sr,Q.constructTypeOfHandleFromIndices=fl,Q.convertStringToNumber=oi,Q.createNodeContextMenu=kl,Q.handleShapesMap=fe,Q.isCoordinateInBox=ni,Q.isNumberInRange=bo,Q.isSupportedUnderlyingType=jc,Q.isValidDataTypeId=Lc,Q.isValidNodeTypeUniqueId=Rc,Q.mainReducer=ml,Q.makeAllowedConversionsBetweenDataTypesWithAutoInfer=Fc,Q.makeDataTypeWithAutoInfer=Hc,Q.makeNodeIdToNodeTypeWithAutoInfer=Bc,Q.makeStateWithAutoInfer=Wc,Q.makeTypeOfNodeWithAutoInfer=Vc,Q.removeEdgeWithTypeChecking=pl,Q.sanitizeNumberToShowAsText=vo,Q.supportedUnderlyingTypesMap=ri,Q.useClickedOutside=wl,Q.useDrag=vl,Q.useFullGraph=Cy,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
107
107
  //# sourceMappingURL=react-blender-nodes.umd.js.map