@theclearsky/react-blender-nodes 0.0.3 → 0.0.5

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(ee,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],O):(ee=typeof globalThis<"u"?globalThis:ee||self,O(ee["react-blender-nodes"]={},ee.React,ee.ReactDOM))})(this,function(ee,O,Tu){"use strict";function Di(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 U=Di(O),Mu=Di(Tu);function Au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var In={exports:{}},Yt={};/**
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 Ri;function Iu(){if(Ri)return Yt;Ri=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 Yt.Fragment=t,Yt.jsx=n,Yt.jsxs=n,Yt}var Xt={};/**
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 Li;function Pu(){return Li||(Li=1,process.env.NODE_ENV!=="production"&&function(){function e(_){if(_==null)return null;if(typeof _=="function")return _.$$typeof===H?null:_.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case g:return"Fragment";case b:return"Profiler";case x:return"StrictMode";case k:return"Suspense";case N:return"SuspenseList";case L:return"Activity"}if(typeof _=="object")switch(typeof _.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),_.$$typeof){case p:return"Portal";case m:return(_.displayName||"Context")+".Provider";case v:return(_._context.displayName||"Context")+".Consumer";case w:var D=_.render;return _=_.displayName,_||(_=D.displayName||D.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case I:return D=_.displayName||null,D!==null?D:e(_.type)||"Memo";case M:D=_._payload,_=_._init;try{return e(_(D))}catch{}}return null}function t(_){return""+_}function n(_){try{t(_);var D=!1}catch{D=!0}if(D){D=console;var z=D.error,F=typeof Symbol=="function"&&Symbol.toStringTag&&_[Symbol.toStringTag]||_.constructor.name||"Object";return z.call(D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",F),t(_)}}function o(_){if(_===g)return"<>";if(typeof _=="object"&&_!==null&&_.$$typeof===M)return"<...>";try{var D=e(_);return D?"<"+D+">":"<...>"}catch{return"<...>"}}function r(){var _=j.A;return _===null?null:_.getOwner()}function i(){return Error("react-stack-top-frame")}function s(_){if(R.call(_,"key")){var D=Object.getOwnPropertyDescriptor(_,"key").get;if(D&&D.isReactWarning)return!1}return _.key!==void 0}function a(_,D){function z(){A||(A=!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)",D))}z.isReactWarning=!0,Object.defineProperty(_,"key",{get:z,configurable:!0})}function c(){var _=e(this.type);return T[_]||(T[_]=!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.")),_=this.props.ref,_!==void 0?_:null}function l(_,D,z,F,B,Y,K,W){return z=Y.ref,_={$$typeof:f,type:_,key:D,props:Y,_owner:B},(z!==void 0?z:null)!==null?Object.defineProperty(_,"ref",{enumerable:!1,get:c}):Object.defineProperty(_,"ref",{enumerable:!1,value:null}),_._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(_,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(_,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(_,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_}function u(_,D,z,F,B,Y,K,W){var V=D.children;if(V!==void 0)if(F)if($(V)){for(F=0;F<V.length;F++)h(V[F]);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(R.call(D,"key")){V=e(_);var X=Object.keys(D).filter(function(te){return te!=="key"});F=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",P[V+F]||(X=0<X.length?"{"+X.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} />`,F,V,X,V),P[V+F]=!0)}if(V=null,z!==void 0&&(n(z),V=""+z),s(D)&&(n(D.key),V=""+D.key),"key"in D){z={};for(var J in D)J!=="key"&&(z[J]=D[J])}else z=D;return V&&a(z,typeof _=="function"?_.displayName||_.name||"Unknown":_),l(_,V,Y,B,r(),z,K,W)}function h(_){typeof _=="object"&&_!==null&&_.$$typeof===f&&_._store&&(_._store.validated=1)}var d=O,f=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),m=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),j=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=Object.prototype.hasOwnProperty,$=Array.isArray,y=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(_){return _()}};var A,T={},S=d.react_stack_bottom_frame.bind(d,i)(),E=y(o(i)),P={};Xt.Fragment=g,Xt.jsx=function(_,D,z,F,B){var Y=1e4>j.recentlyCreatedOwnerStacks++;return u(_,D,z,!1,F,B,Y?Error("react-stack-top-frame"):S,Y?y(o(_)):E)},Xt.jsxs=function(_,D,z,F,B){var Y=1e4>j.recentlyCreatedOwnerStacks++;return u(_,D,z,!0,F,B,Y?Error("react-stack-top-frame"):S,Y?y(o(_)):E)}}()),Xt}var $i;function Ou(){return $i||($i=1,process.env.NODE_ENV==="production"?In.exports=Iu():In.exports=Pu()),In.exports}var C=Ou();function zi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Du(...e){return t=>{let n=!1;const o=e.map(r=>{const i=zi(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():zi(e[r],null)}}}}function Ru(e){const t=$u(e),n=U.forwardRef((o,r)=>{const{children:i,...s}=o,a=U.Children.toArray(i),c=a.find(Hu);if(c){const l=c.props.children,u=a.map(h=>h===c?U.Children.count(l)>1?U.Children.only(null):U.isValidElement(l)?l.props.children:null:h);return C.jsx(t,{...s,ref:r,children:U.isValidElement(l)?U.cloneElement(l,void 0,u):null})}return C.jsx(t,{...s,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var Lu=Ru("Slot");function $u(e){const t=U.forwardRef((n,o)=>{const{children:r,...i}=n;if(U.isValidElement(r)){const s=Vu(r),a=ju(i,r.props);return r.type!==U.Fragment&&(a.ref=o?Du(o,s):s),U.cloneElement(r,a)}return U.Children.count(r)>1?U.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zu=Symbol("radix.slottable");function Hu(e){return U.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zu}function ju(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 c=i(...a);return r(...a),c}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Vu(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 Hi(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=Hi(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function ji(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Hi(e))&&(o&&(o+=" "),o+=t);return o}const Vi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fi=ji,Fu=(e,t)=>n=>{var o;if(t?.variants==null)return Fi(e,n?.class,n?.className);const{variants:r,defaultVariants:i}=t,s=Object.keys(r).map(l=>{const u=n?.[l],h=i?.[l];if(u===null)return null;const d=Vi(u)||Vi(h);return r[l][d]}),a=n&&Object.entries(n).reduce((l,u)=>{let[h,d]=u;return d===void 0||(l[h]=d),l},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:h,className:d,...f}=u;return Object.entries(f).every(p=>{let[g,x]=p;return Array.isArray(x)?x.includes({...i,...a}[g]):{...i,...a}[g]===x})?[...l,h,d]:l},[]);return Fi(e,s,c,n?.class,n?.className)},Jo="-",Bu=e=>{const t=Yu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{const a=s.split(Jo);return a[0]===""&&a.length!==1&&a.shift(),Bi(a,t)||Wu(s)},getConflictingClassGroupIds:(s,a)=>{const c=n[s]||[];return a&&o[s]?[...c,...o[s]]:c}}},Bi=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),r=o?Bi(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;const i=e.join(Jo);return t.validators.find(({validator:s})=>s(i))?.classGroupId},Wi=/^\[(.+)\]$/,Wu=e=>{if(Wi.test(e)){const t=Wi.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Yu=e=>{const{theme:t,classGroups:n}=e,o={nextPart:new Map,validators:[]};for(const r in n)er(n[r],o,r,t);return o},er=(e,t,n,o)=>{e.forEach(r=>{if(typeof r=="string"){const i=r===""?t:Yi(t,r);i.classGroupId=n;return}if(typeof r=="function"){if(Xu(r)){er(r(o),t,n,o);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,s])=>{er(s,Yi(t,i),n,o)})})},Yi=(e,t)=>{let n=e;return t.split(Jo).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},Xu=e=>e.isThemeGetter,Uu=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)}}},tr="!",nr=":",Gu=nr.length,qu=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const i=[];let s=0,a=0,c=0,l;for(let p=0;p<r.length;p++){let g=r[p];if(s===0&&a===0){if(g===nr){i.push(r.slice(c,p)),c=p+Gu;continue}if(g==="/"){l=p;continue}}g==="["?s++:g==="]"?s--:g==="("?a++:g===")"&&a--}const u=i.length===0?r:r.substring(c),h=Zu(u),d=h!==u,f=l&&l>c?l-c:void 0;return{modifiers:i,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:f}};if(t){const r=t+nr,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},Zu=e=>e.endsWith(tr)?e.substring(0,e.length-1):e.startsWith(tr)?e.substring(1):e,Ku=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}},Qu=e=>({cache:Uu(e.cacheSize),parseClassName:qu(e),sortModifiers:Ku(e),...Bu(e)}),Ju=/\s+/,ed=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:i}=t,s=[],a=e.trim().split(Ju);let c="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{isExternal:h,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:g}=n(u);if(h){c=u+(c.length>0?" "+c:c);continue}let x=!!g,b=o(x?p.substring(0,g):p);if(!b){if(!x){c=u+(c.length>0?" "+c:c);continue}if(b=o(p),!b){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=i(d).join(":"),m=f?v+tr:v,w=m+b;if(s.includes(w))continue;s.push(w);const k=r(b,x);for(let N=0;N<k.length;++N){const I=k[N];s.push(m+I)}c=u+(c.length>0?" "+c:c)}return c};function td(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Xi(t))&&(o&&(o+=" "),o+=n);return o}const Xi=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Xi(e[o]))&&(n&&(n+=" "),n+=t);return n};function nd(e,...t){let n,o,r,i=s;function s(c){const l=t.reduce((u,h)=>h(u),e());return n=Qu(l),o=n.cache.get,r=n.cache.set,i=a,a(c)}function a(c){const l=o(c);if(l)return l;const u=ed(c,n);return r(c,u),u}return function(){return i(td.apply(null,arguments))}}const he=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ui=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gi=/^\((?:(\w[\w-]*):)?(.+)\)$/i,od=/^\d+\/\d+$/,rd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,id=/\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$/,sd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ad=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xt=e=>od.test(e),re=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),or=e=>e.endsWith("%")&&re(e.slice(0,-1)),Fe=e=>rd.test(e),ld=()=>!0,ud=e=>id.test(e)&&!sd.test(e),qi=()=>!1,dd=e=>ad.test(e),fd=e=>cd.test(e),hd=e=>!G(e)&&!q(e),pd=e=>wt(e,es,qi),G=e=>Ui.test(e),nt=e=>wt(e,ts,ud),rr=e=>wt(e,wd,re),Zi=e=>wt(e,Qi,qi),gd=e=>wt(e,Ji,fd),Pn=e=>wt(e,ns,dd),q=e=>Gi.test(e),Ut=e=>bt(e,ts),md=e=>bt(e,bd),Ki=e=>bt(e,Qi),yd=e=>bt(e,es),xd=e=>bt(e,Ji),On=e=>bt(e,ns,!0),wt=(e,t,n)=>{const o=Ui.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},bt=(e,t,n=!1)=>{const o=Gi.exec(e);return o?o[1]?t(o[1]):n:!1},Qi=e=>e==="position"||e==="percentage",Ji=e=>e==="image"||e==="url",es=e=>e==="length"||e==="size"||e==="bg-size",ts=e=>e==="length",wd=e=>e==="number",bd=e=>e==="family-name",ns=e=>e==="shadow",vd=nd(()=>{const e=he("color"),t=he("font"),n=he("text"),o=he("font-weight"),r=he("tracking"),i=he("leading"),s=he("breakpoint"),a=he("container"),c=he("spacing"),l=he("radius"),u=he("shadow"),h=he("inset-shadow"),d=he("text-shadow"),f=he("drop-shadow"),p=he("blur"),g=he("perspective"),x=he("aspect"),b=he("ease"),v=he("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...w(),q,G],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],M=()=>[q,G,c],L=()=>[xt,"full","auto",...M()],H=()=>[qe,"none","subgrid",q,G],j=()=>["auto",{span:["full",qe,q,G]},qe,q,G],R=()=>[qe,"auto",q,G],$=()=>["auto","min","max","fr",q,G],y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...M()],S=()=>[xt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],E=()=>[e,q,G],P=()=>[...w(),Ki,Zi,{position:[q,G]}],_=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",yd,pd,{size:[q,G]}],z=()=>[or,Ut,nt],F=()=>["","none","full",l,q,G],B=()=>["",re,Ut,nt],Y=()=>["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=()=>[re,or,Ki,Zi],V=()=>["","none",p,q,G],X=()=>["none",re,q,G],J=()=>["none",re,q,G],te=()=>[re,q,G],Z=()=>[xt,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[ld],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[hd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",re],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xt,G,q,x]}],container:["container"],columns:[{columns:[re,G,q,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:k()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[qe,"auto",q,G]}],basis:[{basis:[xt,"full","auto",a,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[re,xt,"auto","initial","none",G]}],grow:[{grow:["",re,q,G]}],shrink:[{shrink:["",re,q,G]}],order:[{order:[qe,"first","last","none",q,G]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...y(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...y()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":y()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],w:[{w:[a,"screen",...S()]}],"min-w":[{"min-w":[a,"screen","none",...S()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,Ut,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,q,rr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",or,G]}],"font-family":[{font:[md,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,q,G]}],"line-clamp":[{"line-clamp":[re,"none",q,rr]}],leading:[{leading:[i,...M()]}],"list-image":[{"list-image":["none",q,G]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",q,G]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[re,"from-font","auto",q,nt]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[re,"auto",q,G]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",q,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",q,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:P()}],"bg-repeat":[{bg:_()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,q,G],radial:["",q,G],conic:[qe,q,G]},xd,gd]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[re,q,G]}],"outline-w":[{outline:["",re,Ut,nt]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",u,On,Pn]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",h,On,Pn]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[re,nt]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",d,On,Pn]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[re,q,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":[re]}],"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":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"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":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"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":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"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":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"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":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"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":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"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":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[q,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":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[re]}],"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":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:_()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",q,G]}],filter:[{filter:["","none",q,G]}],blur:[{blur:V()}],brightness:[{brightness:[re,q,G]}],contrast:[{contrast:[re,q,G]}],"drop-shadow":[{"drop-shadow":["","none",f,On,Pn]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",re,q,G]}],"hue-rotate":[{"hue-rotate":[re,q,G]}],invert:[{invert:["",re,q,G]}],saturate:[{saturate:[re,q,G]}],sepia:[{sepia:["",re,q,G]}],"backdrop-filter":[{"backdrop-filter":["","none",q,G]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[re,q,G]}],"backdrop-contrast":[{"backdrop-contrast":[re,q,G]}],"backdrop-grayscale":[{"backdrop-grayscale":["",re,q,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[re,q,G]}],"backdrop-invert":[{"backdrop-invert":["",re,q,G]}],"backdrop-opacity":[{"backdrop-opacity":[re,q,G]}],"backdrop-saturate":[{"backdrop-saturate":[re,q,G]}],"backdrop-sepia":[{"backdrop-sepia":["",re,q,G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",q,G]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[re,"initial",q,G]}],ease:[{ease:["linear","initial",b,q,G]}],delay:[{delay:[re,q,G]}],animate:[{animate:["none",v,q,G]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,q,G]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[q,G,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"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:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"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",q,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":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",q,G]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[re,Ut,nt,rr]}],stroke:[{stroke:["none",...E()]}],"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 vd(ji(e))}const Ed=Fu("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"}]}),vt=O.forwardRef(({className:e,color:t,asChild:n=!1,applyHoverStyles:o,...r},i)=>{const s=n?Lu:"button";return C.jsx(s,{ref:i,"data-slot":"button",className:se(Ed({color:t,className:e,applyHoverStyles:o})),...r})});vt.displayName="Button";function ir(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 os(e,t,n=!1,o=!1){return ir(e.x,t.left,t.right,n)&&ir(e.y,t.top,t.bottom,o)}function rs(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 sr(e,t){return e.toFixed(t).replace(/[0]+$/,"").replace(/\.$/,"")}const Oe=["string","number","complex","noEquivalent","inferFromConnection"],is={[Oe[0]]:Oe[0],[Oe[1]]:Oe[1],[Oe[2]]:Oe[2],[Oe[3]]:Oe[3],[Oe[4]]:Oe[4]};function _d(e){return!!is[e]}function Sd(e){return e}function Cd(e,t){return e in t}function Nd(e){return e}function kd(e,t){return e in t}function Td(e){return e}function Md(e){return e}function Ad(e){return e}var ss=Symbol.for("immer-nothing"),as=Symbol.for("immer-draftable"),we=Symbol.for("immer-state"),Id=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 me(e,...t){if(process.env.NODE_ENV!=="production"){const n=Id[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 Et=Object.getPrototypeOf;function _t(e){return!!e&&!!e[we]}function ot(e){return e?cs(e)||Array.isArray(e)||!!e[as]||!!e.constructor?.[as]||Gt(e)||Ln(e):!1}var Pd=Object.prototype.constructor.toString();function cs(e){if(!e||typeof e!="object")return!1;const t=Et(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)===Pd}function Dn(e,t){Rn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function Rn(e){const t=e[we];return t?t.type_:Array.isArray(e)?1:Gt(e)?2:Ln(e)?3:0}function ar(e,t){return Rn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ls(e,t,n){const o=Rn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Od(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Gt(e){return e instanceof Map}function Ln(e){return e instanceof Set}function rt(e){return e.copy_||e.base_}function cr(e,t){if(Gt(e))return new Map(e);if(Ln(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=cs(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[we];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(Et(e),o)}else{const o=Et(e);if(o!==null&&n)return{...e};const r=Object.create(o);return Object.assign(r,e)}}function lr(e,t=!1){return zn(e)||_t(e)||!ot(e)||(Rn(e)>1&&Object.defineProperties(e,{set:{value:$n},add:{value:$n},clear:{value:$n},delete:{value:$n}}),Object.freeze(e),t&&Object.values(e).forEach(n=>lr(n,!0))),e}function $n(){me(2)}function zn(e){return Object.isFrozen(e)}var Dd={};function it(e){const t=Dd[e];return t||me(0,e),t}var qt;function us(){return qt}function Rd(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ds(e,t){t&&(it("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ur(e){dr(e),e.drafts_.forEach(Ld),e.drafts_=null}function dr(e){e===qt&&(qt=e.parent_)}function fs(e){return qt=Rd(qt,e)}function Ld(e){const t=e[we];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function hs(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[we].modified_&&(ur(t),me(4)),ot(e)&&(e=Hn(t,e),t.parent_||jn(t,e)),t.patches_&&it("Patches").generateReplacementPatches_(n[we].base_,e,t.patches_,t.inversePatches_)):e=Hn(t,n,[]),ur(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ss?e:void 0}function Hn(e,t,n){if(zn(t))return t;const o=t[we];if(!o)return Dn(t,(r,i)=>ps(e,o,t,r,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return jn(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),Dn(i,(a,c)=>ps(e,o,r,a,c,n,s)),jn(e,r,!1),n&&e.patches_&&it("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function ps(e,t,n,o,r,i,s){if(process.env.NODE_ENV!=="production"&&r===n&&me(5),_t(r)){const a=i&&t&&t.type_!==3&&!ar(t.assigned_,o)?i.concat(o):void 0,c=Hn(e,r,a);if(ls(n,o,c),_t(c))e.canAutoFreeze_=!1;else return}else s&&n.add(r);if(ot(r)&&!zn(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Hn(e,r),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(Gt(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&jn(e,r)}}function jn(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&lr(t,n)}function $d(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:us(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=fr;n&&(r=[o],i=Zt);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}var fr={get(e,t){if(t===we)return e;const n=rt(e);if(!ar(n,t))return zd(e,n,t);const o=n[t];return e.finalized_||!ot(o)?o:o===hr(e.base_,t)?(gr(e),e.copy_[t]=mr(o,e)):o},has(e,t){return t in rt(e)},ownKeys(e){return Reflect.ownKeys(rt(e))},set(e,t,n){const o=gs(rt(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const r=hr(rt(e),t),i=r?.[we];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Od(n,r)&&(n!==void 0||ar(e.base_,t)))return!0;gr(e),pr(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 hr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,gr(e),pr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=rt(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){me(11)},getPrototypeOf(e){return Et(e.base_)},setPrototypeOf(){me(12)}},Zt={};Dn(fr,(e,t)=>{Zt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Zt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&me(13),Zt.set.call(this,e,t,void 0)},Zt.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&me(14),fr.set.call(this,e[0],t,n,e[0])};function hr(e,t){const n=e[we];return(n?rt(n):e)[t]}function zd(e,t,n){const o=gs(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}function gs(e,t){if(!(t in e))return;let n=Et(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Et(n)}}function pr(e){e.modified_||(e.modified_=!0,e.parent_&&pr(e.parent_))}function gr(e){e.copy_||(e.copy_=cr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Hd=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(c=i,...l){return s.produce(c,u=>n.call(this,u,...l))}}typeof n!="function"&&me(6),o!==void 0&&typeof o!="function"&&me(7);let r;if(ot(t)){const i=fs(this),s=mr(t,void 0);let a=!0;try{r=n(s),a=!1}finally{a?ur(i):dr(i)}return ds(i,o),hs(r,i)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===ss&&(r=void 0),this.autoFreeze_&&lr(r,!0),o){const i=[],s=[];it("Patches").generateReplacementPatches_(t,r,i,s),o(i,s)}return r}else me(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...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){ot(e)||me(8),_t(e)&&(e=jd(e));const t=fs(this),n=mr(e,void 0);return n[we].isManual_=!0,dr(t),n}finishDraft(e,t){const n=e&&e[we];(!n||!n.isManual_)&&me(9);const{scope_:o}=n;return ds(o,t),hs(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=it("Patches").applyPatches_;return _t(e)?o(e,t):this.produce(e,r=>o(r,t))}};function mr(e,t){const n=Gt(e)?it("MapSet").proxyMap_(e,t):Ln(e)?it("MapSet").proxySet_(e,t):$d(e,t);return(t?t.scope_:us()).drafts_.push(n),n}function jd(e){return _t(e)||me(10,e),ms(e)}function ms(e){if(!ot(e)||zn(e))return e;const t=e[we];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=cr(e,t.scope_.immer_.useStrictShallowCopy_)}else n=cr(e,!0);return Dn(n,(o,r)=>{ls(n,o,ms(r))}),t&&(t.finalized_=!1),n}var Vd=new Hd,Fd=Vd.produce;function St(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 fe(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=fe(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Bd={value:()=>{}};function Vn(){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 Fn(n)}function Fn(e){this._=e}function Wd(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}})}Fn.prototype=Vn.prototype={constructor:Fn,on:function(e,t){var n=this._,o=Wd(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Yd(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]=ys(n[r],e.name,t);else if(t==null)for(r in n)n[r]=ys(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 Fn(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 Yd(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function ys(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Bd,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var yr="http://www.w3.org/1999/xhtml";const xs={svg:"http://www.w3.org/2000/svg",xhtml:yr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xs.hasOwnProperty(t)?{space:xs[t],local:e}:e}function Xd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===yr&&t.documentElement.namespaceURI===yr?t.createElement(e):t.createElementNS(n,e)}}function Ud(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ws(e){var t=Bn(e);return(t.local?Ud:Xd)(t)}function Gd(){}function xr(e){return e==null?Gd:function(){return this.querySelector(e)}}function qd(e){typeof e!="function"&&(e=xr(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),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new be(o,this._parents)}function Zd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Kd(){return[]}function bs(e){return e==null?Kd:function(){return this.querySelectorAll(e)}}function Qd(e){return function(){return Zd(e.apply(this,arguments))}}function Jd(e){typeof e=="function"?e=Qd(e):e=bs(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new be(o,r)}function vs(e){return function(){return this.matches(e)}}function Es(e){return function(t){return t.matches(e)}}var ef=Array.prototype.find;function tf(e){return function(){return ef.call(this.children,e)}}function nf(){return this.firstElementChild}function of(e){return this.select(e==null?nf:tf(typeof e=="function"?e:Es(e)))}var rf=Array.prototype.filter;function sf(){return Array.from(this.children)}function af(e){return function(){return rf.call(this.children,e)}}function cf(e){return this.selectAll(e==null?sf:af(typeof e=="function"?e:Es(e)))}function lf(e){typeof e!="function"&&(e=vs(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new be(o,this._parents)}function _s(e){return new Array(e.length)}function uf(){return new be(this._enter||this._groups.map(_s),this._parents)}function Wn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wn.prototype={constructor:Wn,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 df(e){return function(){return e}}function ff(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Wn(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function hf(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,h=i.length,d=new Array(u),f;for(a=0;a<u;++a)(c=t[a])&&(d[a]=f=s.call(c,c.__data__,a,t)+"",l.has(f)?r[a]=c:l.set(f,c));for(a=0;a<h;++a)f=s.call(e,i[a],a,i)+"",(c=l.get(f))?(o[a]=c,c.__data__=i[a],l.delete(f)):n[a]=new Wn(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function pf(e){return e.__data__}function gf(e,t){if(!arguments.length)return Array.from(this,pf);var n=t?hf:ff,o=this._parents,r=this._groups;typeof e!="function"&&(e=df(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],h=r[l],d=h.length,f=mf(e.call(u,u&&u.__data__,l,o)),p=f.length,g=a[l]=new Array(p),x=s[l]=new Array(p),b=c[l]=new Array(d);n(u,h,g,x,b,f,t);for(var v=0,m=0,w,k;v<p;++v)if(w=g[v]){for(v>=m&&(m=v+1);!(k=x[m])&&++m<p;);w._next=k||null}}return s=new be(s,o),s._enter=a,s._exit=c,s}function mf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yf(){return new be(this._exit||this._groups.map(_s),this._parents)}function xf(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 wf(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),c=0;c<s;++c)for(var l=n[c],u=o[c],h=l.length,d=a[c]=new Array(h),f,p=0;p<h;++p)(f=l[p]||u[p])&&(d[p]=f);for(;c<r;++c)a[c]=n[c];return new be(a,this._parents)}function bf(){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 vf(e){e||(e=Ef);function t(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new be(r,this._parents).order()}function Ef(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _f(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sf(){return Array.from(this)}function Cf(){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 Nf(){let e=0;for(const t of this)++e;return e}function kf(){return!this.node()}function Tf(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 Mf(e){return function(){this.removeAttribute(e)}}function Af(e){return function(){this.removeAttributeNS(e.space,e.local)}}function If(e,t){return function(){this.setAttribute(e,t)}}function Pf(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Of(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Df(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 Rf(e,t){var n=Bn(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?Af:Mf:typeof t=="function"?n.local?Df:Of:n.local?Pf:If)(n,t))}function Ss(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Lf(e){return function(){this.style.removeProperty(e)}}function $f(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zf(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Hf(e,t,n){return arguments.length>1?this.each((t==null?Lf:typeof t=="function"?zf:$f)(e,t,n??"")):Ct(this.node(),e)}function Ct(e,t){return e.style.getPropertyValue(t)||Ss(e).getComputedStyle(e,null).getPropertyValue(t)}function jf(e){return function(){delete this[e]}}function Vf(e,t){return function(){this[e]=t}}function Ff(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Bf(e,t){return arguments.length>1?this.each((t==null?jf:typeof t=="function"?Ff:Vf)(e,t)):this.node()[e]}function Cs(e){return e.trim().split(/^|\s+/)}function wr(e){return e.classList||new Ns(e)}function Ns(e){this._node=e,this._names=Cs(e.getAttribute("class")||"")}Ns.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 ks(e,t){for(var n=wr(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ts(e,t){for(var n=wr(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Wf(e){return function(){ks(this,e)}}function Yf(e){return function(){Ts(this,e)}}function Xf(e,t){return function(){(t.apply(this,arguments)?ks:Ts)(this,e)}}function Uf(e,t){var n=Cs(e+"");if(arguments.length<2){for(var o=wr(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Xf:t?Wf:Yf)(n,t))}function Gf(){this.textContent=""}function qf(e){return function(){this.textContent=e}}function Zf(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Kf(e){return arguments.length?this.each(e==null?Gf:(typeof e=="function"?Zf:qf)(e)):this.node().textContent}function Qf(){this.innerHTML=""}function Jf(e){return function(){this.innerHTML=e}}function eh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function th(e){return arguments.length?this.each(e==null?Qf:(typeof e=="function"?eh:Jf)(e)):this.node().innerHTML}function nh(){this.nextSibling&&this.parentNode.appendChild(this)}function oh(){return this.each(nh)}function rh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ih(){return this.each(rh)}function sh(e){var t=typeof e=="function"?e:ws(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ah(){return null}function ch(e,t){var n=typeof e=="function"?e:ws(e),o=t==null?ah:typeof t=="function"?t:xr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function lh(){var e=this.parentNode;e&&e.removeChild(this)}function uh(){return this.each(lh)}function dh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hh(e){return this.select(e?fh:dh)}function ph(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gh(e){return function(t){e.call(this,t,this.__data__)}}function mh(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 yh(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 xh(e,t,n){return function(){var o=this.__on,r,i=gh(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 wh(e,t,n){var o=mh(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?xh:yh,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Ms(e,t,n){var o=Ss(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 bh(e,t){return function(){return Ms(this,e,t)}}function vh(e,t){return function(){return Ms(this,e,t.apply(this,arguments))}}function Eh(e,t){return this.each((typeof t=="function"?vh:bh)(e,t))}function*_h(){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 As=[null];function be(e,t){this._groups=e,this._parents=t}function Kt(){return new be([[document.documentElement]],As)}function Sh(){return this}be.prototype=Kt.prototype={constructor:be,select:qd,selectAll:Jd,selectChild:of,selectChildren:cf,filter:lf,data:gf,enter:uf,exit:yf,join:xf,merge:wf,selection:Sh,order:bf,sort:vf,call:_f,nodes:Sf,node:Cf,size:Nf,empty:kf,each:Tf,attr:Rf,style:Hf,property:Bf,classed:Uf,text:Kf,html:th,raise:oh,lower:ih,append:sh,insert:ch,remove:uh,clone:hh,datum:ph,on:wh,dispatch:Eh,[Symbol.iterator]:_h};function ve(e){return typeof e=="string"?new be([[document.querySelector(e)]],[document.documentElement]):new be([[e]],As)}function Ch(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ne(e,t){if(e=Ch(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 Nh={passive:!1},Qt={capture:!0,passive:!1};function br(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function Is(e){var t=e.document.documentElement,n=ve(e).on("dragstart.drag",Nt,Qt);"onselectstart"in t?n.on("selectstart.drag",Nt,Qt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ps(e,t){var n=e.document.documentElement,o=ve(e).on("dragstart.drag",null);t&&(o.on("click.drag",Nt,Qt),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 Yn=e=>()=>e;function vr(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}vr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kh(e){return!e.ctrlKey&&!e.button}function Th(){return this.parentNode}function Mh(e,t){return t??{x:e.x,y:e.y}}function Ah(){return navigator.maxTouchPoints||"ontouchstart"in this}function Os(){var e=kh,t=Th,n=Mh,o=Ah,r={},i=Vn("start","drag","end"),s=0,a,c,l,u,h=0;function d(w){w.on("mousedown.drag",f).filter(o).on("touchstart.drag",x).on("touchmove.drag",b,Nh).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(w,k){if(!(u||!e.call(this,w,k))){var N=m(this,t.call(this,w,k),w,k,"mouse");N&&(ve(w.view).on("mousemove.drag",p,Qt).on("mouseup.drag",g,Qt),Is(w.view),br(w),l=!1,a=w.clientX,c=w.clientY,N("start",w))}}function p(w){if(Nt(w),!l){var k=w.clientX-a,N=w.clientY-c;l=k*k+N*N>h}r.mouse("drag",w)}function g(w){ve(w.view).on("mousemove.drag mouseup.drag",null),Ps(w.view,l),Nt(w),r.mouse("end",w)}function x(w,k){if(e.call(this,w,k)){var N=w.changedTouches,I=t.call(this,w,k),M=N.length,L,H;for(L=0;L<M;++L)(H=m(this,I,w,k,N[L].identifier,N[L]))&&(br(w),H("start",w,N[L]))}}function b(w){var k=w.changedTouches,N=k.length,I,M;for(I=0;I<N;++I)(M=r[k[I].identifier])&&(Nt(w),M("drag",w,k[I]))}function v(w){var k=w.changedTouches,N=k.length,I,M;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),I=0;I<N;++I)(M=r[k[I].identifier])&&(br(w),M("end",w,k[I]))}function m(w,k,N,I,M,L){var H=i.copy(),j=Ne(L||N,k),R,$,y;if((y=n.call(w,new vr("beforestart",{sourceEvent:N,target:d,identifier:M,active:s,x:j[0],y:j[1],dx:0,dy:0,dispatch:H}),I))!=null)return R=y.x-j[0]||0,$=y.y-j[1]||0,function A(T,S,E){var P=j,_;switch(T){case"start":r[M]=A,_=s++;break;case"end":delete r[M],--s;case"drag":j=Ne(E||S,k),_=s;break}H.call(T,w,new vr(T,{sourceEvent:S,subject:y,target:d,identifier:M,active:_,x:j[0]+R,y:j[1]+$,dx:j[0]-P[0],dy:j[1]-P[1],dispatch:H}),I)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Yn(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:Yn(w),d):t},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Yn(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Yn(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(h=(w=+w)*w,d):Math.sqrt(h)},d}function Er(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ds(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Jt(){}var en=.7,Xn=1/en,kt="\\s*([+-]?\\d+)\\s*",tn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",De="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ih=/^#([0-9a-f]{3,8})$/,Ph=new RegExp(`^rgb\\(${kt},${kt},${kt}\\)$`),Oh=new RegExp(`^rgb\\(${De},${De},${De}\\)$`),Dh=new RegExp(`^rgba\\(${kt},${kt},${kt},${tn}\\)$`),Rh=new RegExp(`^rgba\\(${De},${De},${De},${tn}\\)$`),Lh=new RegExp(`^hsl\\(${tn},${De},${De}\\)$`),$h=new RegExp(`^hsla\\(${tn},${De},${De},${tn}\\)$`),Rs={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};Er(Jt,st,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ls,formatHex:Ls,formatHex8:zh,formatHsl:Hh,formatRgb:$s,toString:$s});function Ls(){return this.rgb().formatHex()}function zh(){return this.rgb().formatHex8()}function Hh(){return Fs(this).formatHsl()}function $s(){return this.rgb().formatRgb()}function st(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ih.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?zs(t):n===3?new ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Un(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Un(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=Ph.exec(e))?new ye(t[1],t[2],t[3],1):(t=Oh.exec(e))?new ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Dh.exec(e))?Un(t[1],t[2],t[3],t[4]):(t=Rh.exec(e))?Un(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Lh.exec(e))?Vs(t[1],t[2]/100,t[3]/100,1):(t=$h.exec(e))?Vs(t[1],t[2]/100,t[3]/100,t[4]):Rs.hasOwnProperty(e)?zs(Rs[e]):e==="transparent"?new ye(NaN,NaN,NaN,0):null}function zs(e){return new ye(e>>16&255,e>>8&255,e&255,1)}function Un(e,t,n,o){return o<=0&&(e=t=n=NaN),new ye(e,t,n,o)}function jh(e){return e instanceof Jt||(e=st(e)),e?(e=e.rgb(),new ye(e.r,e.g,e.b,e.opacity)):new ye}function _r(e,t,n,o){return arguments.length===1?jh(e):new ye(e,t,n,o??1)}function ye(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Er(ye,_r,Ds(Jt,{brighter(e){return e=e==null?Xn:Math.pow(Xn,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?en:Math.pow(en,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ye(at(this.r),at(this.g),at(this.b),Gn(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:Hs,formatHex:Hs,formatHex8:Vh,formatRgb:js,toString:js}));function Hs(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}`}function Vh(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}${ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function js(){const e=Gn(this.opacity);return`${e===1?"rgb(":"rgba("}${at(this.r)}, ${at(this.g)}, ${at(this.b)}${e===1?")":`, ${e})`}`}function Gn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function at(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ct(e){return e=at(e),(e<16?"0":"")+e.toString(16)}function Vs(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ke(e,t,n,o)}function Fs(e){if(e instanceof ke)return new ke(e.h,e.s,e.l,e.opacity);if(e instanceof Jt||(e=st(e)),!e)return new ke;if(e instanceof ke)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,c=(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/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new ke(s,a,c,e.opacity)}function Fh(e,t,n,o){return arguments.length===1?Fs(e):new ke(e,t,n,o??1)}function ke(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Er(ke,Fh,Ds(Jt,{brighter(e){return e=e==null?Xn:Math.pow(Xn,e),new ke(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?en:Math.pow(en,e),new ke(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 ye(Sr(e>=240?e-240:e+120,r,o),Sr(e,r,o),Sr(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ke(Bs(this.h),qn(this.s),qn(this.l),Gn(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=Gn(this.opacity);return`${e===1?"hsl(":"hsla("}${Bs(this.h)}, ${qn(this.s)*100}%, ${qn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bs(e){return e=(e||0)%360,e<0?e+360:e}function qn(e){return Math.max(0,Math.min(1,e||0))}function Sr(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 Cr=e=>()=>e;function Bh(e,t){return function(n){return e+n*t}}function Wh(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 Yh(e){return(e=+e)==1?Ws:function(t,n){return n-t?Wh(t,n,e):Cr(isNaN(t)?n:t)}}function Ws(e,t){var n=t-e;return n?Bh(e,n):Cr(isNaN(e)?t:e)}const Zn=function e(t){var n=Yh(t);function o(r,i){var s=n((r=_r(r)).r,(i=_r(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Ws(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=c(u),r.opacity=l(u),r+""}}return o.gamma=e,o}(1);function Xh(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 Uh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gh(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]=nn(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 qh(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Re(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Zh(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]=nn(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Nr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kr=new RegExp(Nr.source,"g");function Kh(e){return function(){return e}}function Qh(e){return function(t){return e(t)+""}}function Ys(e,t){var n=Nr.lastIndex=kr.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=Nr.exec(e))&&(r=kr.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,c.push({i:s,x:Re(o,r)})),n=kr.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Qh(c[0].x):Kh(t):(t=c.length,function(l){for(var u=0,h;u<t;++u)a[(h=c[u]).i]=h.x(l);return a.join("")})}function nn(e,t){var n=typeof t,o;return t==null||n==="boolean"?Cr(t):(n==="number"?Re:n==="string"?(o=st(t))?(t=o,Zn):Ys:t instanceof st?Zn:t instanceof Date?qh:Uh(t)?Xh:Array.isArray(t)?Gh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Zh:Re)(e,t)}var Xs=180/Math.PI,Tr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Us(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Xs,skewX:Math.atan(c)*Xs,scaleX:s,scaleY:a}}var Kn;function Jh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Tr:Us(t.a,t.b,t.c,t.d,t.e,t.f)}function ep(e){return e==null||(Kn||(Kn=document.createElementNS("http://www.w3.org/2000/svg","g")),Kn.setAttribute("transform",e),!(e=Kn.transform.baseVal.consolidate()))?Tr:(e=e.matrix,Us(e.a,e.b,e.c,e.d,e.e,e.f))}function Gs(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,u,h,d,f,p){if(l!==h||u!==d){var g=f.push("translate(",null,t,null,n);p.push({i:g-4,x:Re(l,h)},{i:g-2,x:Re(u,d)})}else(h||d)&&f.push("translate("+h+t+d+n)}function s(l,u,h,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:h.push(r(h)+"rotate(",null,o)-2,x:Re(l,u)})):u&&h.push(r(h)+"rotate("+u+o)}function a(l,u,h,d){l!==u?d.push({i:h.push(r(h)+"skewX(",null,o)-2,x:Re(l,u)}):u&&h.push(r(h)+"skewX("+u+o)}function c(l,u,h,d,f,p){if(l!==h||u!==d){var g=f.push(r(f)+"scale(",null,",",null,")");p.push({i:g-4,x:Re(l,h)},{i:g-2,x:Re(u,d)})}else(h!==1||d!==1)&&f.push(r(f)+"scale("+h+","+d+")")}return function(l,u){var h=[],d=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,h,d),s(l.rotate,u.rotate,h,d),a(l.skewX,u.skewX,h,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,h,d),l=u=null,function(f){for(var p=-1,g=d.length,x;++p<g;)h[(x=d[p]).i]=x.x(f);return h.join("")}}}var tp=Gs(Jh,"px, ","px)","deg)"),np=Gs(ep,", ",")",")"),op=1e-12;function qs(e){return((e=Math.exp(e))+1/e)/2}function rp(e){return((e=Math.exp(e))-1/e)/2}function ip(e){return((e=Math.exp(2*e))-1)/(e+1)}const Qn=function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],h=s[1],d=s[2],f=u-a,p=h-c,g=f*f+p*p,x,b;if(g<op)b=Math.log(d/l)/t,x=function(I){return[a+I*f,c+I*p,l*Math.exp(t*I*b)]};else{var v=Math.sqrt(g),m=(d*d-l*l+o*g)/(2*l*n*v),w=(d*d-l*l-o*g)/(2*d*n*v),k=Math.log(Math.sqrt(m*m+1)-m),N=Math.log(Math.sqrt(w*w+1)-w);b=(N-k)/t,x=function(I){var M=I*b,L=qs(k),H=l/(n*v)*(L*ip(t*M+k)-rp(k));return[a+H*f,c+H*p,l*L/qs(t*M+k)]}}return x.duration=b*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r}(Math.SQRT2,2,4);var Tt=0,on=0,rn=0,Zs=1e3,Jn,sn,eo=0,lt=0,to=0,an=typeof performance=="object"&&performance.now?performance:Date,Ks=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mr(){return lt||(Ks(sp),lt=an.now()+to)}function sp(){lt=0}function no(){this._call=this._time=this._next=null}no.prototype=Qs.prototype={constructor:no,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Mr():+n)+(t==null?0:+t),!this._next&&sn!==this&&(sn?sn._next=this:Jn=this,sn=this),this._call=e,this._time=n,Ar()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ar())}};function Qs(e,t,n){var o=new no;return o.restart(e,t,n),o}function ap(){Mr(),++Tt;for(var e=Jn,t;e;)(t=lt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tt}function Js(){lt=(eo=an.now())+to,Tt=on=0;try{ap()}finally{Tt=0,lp(),lt=0}}function cp(){var e=an.now(),t=e-eo;t>Zs&&(to-=t,eo=e)}function lp(){for(var e,t=Jn,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:Jn=n);sn=e,Ar(o)}function Ar(e){if(!Tt){on&&(on=clearTimeout(on));var t=e-lt;t>24?(e<1/0&&(on=setTimeout(Js,e-an.now()-to)),rn&&(rn=clearInterval(rn))):(rn||(eo=an.now(),rn=setInterval(cp,Zs)),Tt=1,Ks(Js))}}function ea(e,t,n){var o=new no;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var up=Vn("start","end","cancel","interrupt"),dp=[],ta=0,na=1,Ir=2,oo=3,oa=4,Pr=5,ro=6;function io(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;fp(e,n,{name:t,index:o,group:r,on:up,tween:dp,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ta})}function Or(e,t){var n=Te(e,t);if(n.state>ta)throw new Error("too late; already scheduled");return n}function Le(e,t){var n=Te(e,t);if(n.state>oo)throw new Error("too late; already running");return n}function Te(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fp(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Qs(i,0,n.time);function i(l){n.state=na,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,h,d,f;if(n.state!==na)return c();for(u in o)if(f=o[u],f.name===n.name){if(f.state===oo)return ea(s);f.state===oa?(f.state=ro,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[u]):+u<t&&(f.state=ro,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[u])}if(ea(function(){n.state===oo&&(n.state=oa,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ir,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ir){for(n.state=oo,r=new Array(d=n.tween.length),u=0,h=-1;u<d;++u)(f=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++h]=f);r.length=h+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Pr,1),h=-1,d=r.length;++h<d;)r[h].call(e,u);n.state===Pr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ro,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function so(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>Ir&&o.state<Pr,o.state=ro,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function hp(e){return this.each(function(){so(this,e)})}function pp(e,t){var n,o;return function(){var r=Le(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 gp(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Le(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function mp(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Te(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?pp:gp)(n,e,t))}function Dr(e,t,n){var o=e._id;return e.each(function(){var r=Le(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Te(r,o).value[t]}}function ra(e,t){var n;return(typeof t=="number"?Re:t instanceof st?Zn:(n=st(t))?(t=n,Zn):Ys)(e,t)}function yp(e){return function(){this.removeAttribute(e)}}function xp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wp(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 bp(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 vp(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ep(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function _p(e,t){var n=Bn(e),o=n==="transform"?np:ra;return this.attrTween(e,typeof t=="function"?(n.local?Ep:vp)(n,o,Dr(this,"attr."+e,t)):t==null?(n.local?xp:yp)(n):(n.local?bp:wp)(n,o,t))}function Sp(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Cp(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Np(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Cp(e,i)),n}return r._value=t,r}function kp(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Sp(e,i)),n}return r._value=t,r}function Tp(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=Bn(e);return this.tween(n,(o.local?Np:kp)(o,t))}function Mp(e,t){return function(){Or(this,e).delay=+t.apply(this,arguments)}}function Ap(e,t){return t=+t,function(){Or(this,e).delay=t}}function Ip(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Mp:Ap)(t,e)):Te(this.node(),t).delay}function Pp(e,t){return function(){Le(this,e).duration=+t.apply(this,arguments)}}function Op(e,t){return t=+t,function(){Le(this,e).duration=t}}function Dp(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Pp:Op)(t,e)):Te(this.node(),t).duration}function Rp(e,t){if(typeof t!="function")throw new Error;return function(){Le(this,e).ease=t}}function Lp(e){var t=this._id;return arguments.length?this.each(Rp(t,e)):Te(this.node(),t).ease}function $p(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Le(this,e).ease=n}}function zp(e){if(typeof e!="function")throw new Error;return this.each($p(this._id,e))}function Hp(e){typeof e!="function"&&(e=vs(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Be(o,this._parents,this._name,this._id)}function jp(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 c=t[a],l=n[a],u=c.length,h=s[a]=new Array(u),d,f=0;f<u;++f)(d=c[f]||l[f])&&(h[f]=d);for(;a<o;++a)s[a]=t[a];return new Be(s,this._parents,this._name,this._id)}function Vp(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 Fp(e,t,n){var o,r,i=Vp(t)?Or:Le;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Bp(e,t){var n=this._id;return arguments.length<2?Te(this.node(),n).on.on(e):this.each(Fp(n,e,t))}function Wp(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Yp(){return this.on("end.remove",Wp(this._id))}function Xp(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xr(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,h,d=0;d<c;++d)(u=a[d])&&(h=e.call(u,u.__data__,d,a))&&("__data__"in u&&(h.__data__=u.__data__),l[d]=h,io(l[d],t,n,d,l,Te(u,n)));return new Be(i,this._parents,t,n)}function Up(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bs(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,h=0;h<l;++h)if(u=c[h]){for(var d=e.call(u,u.__data__,h,c),f,p=Te(u,n),g=0,x=d.length;g<x;++g)(f=d[g])&&io(f,t,n,g,d,p);i.push(d),s.push(u)}return new Be(i,s,t,n)}var Gp=Kt.prototype.constructor;function qp(){return new Gp(this._groups,this._parents)}function Zp(e,t){var n,o,r;return function(){var i=Ct(this,e),s=(this.style.removeProperty(e),Ct(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ia(e){return function(){this.style.removeProperty(e)}}function Kp(e,t,n){var o,r=n+"",i;return function(){var s=Ct(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Qp(e,t,n){var o,r,i;return function(){var s=Ct(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ct(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Jp(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=Le(this,e),l=c.on,u=c.value[i]==null?a||(a=ia(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function eg(e,t,n){var o=(e+="")=="transform"?tp:ra;return t==null?this.styleTween(e,Zp(e,o)).on("end.style."+e,ia(e)):typeof t=="function"?this.styleTween(e,Qp(e,o,Dr(this,"style."+e,t))).each(Jp(this._id,e)):this.styleTween(e,Kp(e,o,t),n).on("end.style."+e,null)}function tg(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ng(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&tg(e,s,n)),o}return i._value=t,i}function og(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,ng(e,t,n??""))}function rg(e){return function(){this.textContent=e}}function ig(e){return function(){var t=e(this);this.textContent=t??""}}function sg(e){return this.tween("text",typeof e=="function"?ig(Dr(this,"text",e)):rg(e==null?"":e+""))}function ag(e){return function(t){this.textContent=e.call(this,t)}}function cg(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ag(r)),t}return o._value=e,o}function lg(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,cg(e))}function ug(){for(var e=this._name,t=this._id,n=sa(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=Te(c,t);io(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Be(o,this._parents,e,n)}function dg(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=Le(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var fg=0;function Be(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function sa(){return++fg}var We=Kt.prototype;Be.prototype={constructor:Be,select:Xp,selectAll:Up,selectChild:We.selectChild,selectChildren:We.selectChildren,filter:Hp,merge:jp,selection:qp,transition:ug,call:We.call,nodes:We.nodes,node:We.node,size:We.size,empty:We.empty,each:We.each,on:Bp,attr:_p,attrTween:Tp,style:eg,styleTween:og,text:sg,textTween:lg,remove:Yp,tween:mp,delay:Ip,duration:Dp,ease:Lp,easeVarying:zp,end:dg,[Symbol.iterator]:We[Symbol.iterator]};function hg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var pg={time:null,delay:0,duration:250,ease:hg};function gg(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 mg(e){var t,n;e instanceof Be?(t=e._id,e=e._name):(t=sa(),(n=pg).time=Mr(),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,c,l=0;l<a;++l)(c=s[l])&&io(c,e,t,l,s,n||gg(c,t));return new Be(o,this._parents,e,t)}Kt.prototype.interrupt=hp,Kt.prototype.transition=mg;const ao=e=>()=>e;function yg(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 Ye(e,t,n){this.k=e,this.x=t,this.y=n}Ye.prototype={constructor:Ye,scale:function(e){return e===1?this:new Ye(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ye(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 co=new Ye(1,0,0);aa.prototype=Ye.prototype;function aa(e){for(;!e.__zoom;)if(!(e=e.parentNode))return co;return e.__zoom}function Rr(e){e.stopImmediatePropagation()}function cn(e){e.preventDefault(),e.stopImmediatePropagation()}function xg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wg(){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 ca(){return this.__zoom||co}function bg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vg(){return navigator.maxTouchPoints||"ontouchstart"in this}function Eg(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 la(){var e=xg,t=wg,n=Eg,o=bg,r=vg,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Qn,l=Vn("start","zoom","end"),u,h,d,f=500,p=150,g=0,x=10;function b(y){y.property("__zoom",ca).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",H).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,A,T,S){var E=y.selection?y.selection():y;E.property("__zoom",ca),y!==E?k(y,A,T,S):E.interrupt().each(function(){N(this,arguments).event(S).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(y,A,T,S){b.scaleTo(y,function(){var E=this.__zoom.k,P=typeof A=="function"?A.apply(this,arguments):A;return E*P},T,S)},b.scaleTo=function(y,A,T,S){b.transform(y,function(){var E=t.apply(this,arguments),P=this.__zoom,_=T==null?w(E):typeof T=="function"?T.apply(this,arguments):T,D=P.invert(_),z=typeof A=="function"?A.apply(this,arguments):A;return n(m(v(P,z),_,D),E,s)},T,S)},b.translateBy=function(y,A,T,S){b.transform(y,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),s)},null,S)},b.translateTo=function(y,A,T,S,E){b.transform(y,function(){var P=t.apply(this,arguments),_=this.__zoom,D=S==null?w(P):typeof S=="function"?S.apply(this,arguments):S;return n(co.translate(D[0],D[1]).scale(_.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof T=="function"?-T.apply(this,arguments):-T),P,s)},S,E)};function v(y,A){return A=Math.max(i[0],Math.min(i[1],A)),A===y.k?y:new Ye(A,y.x,y.y)}function m(y,A,T){var S=A[0]-T[0]*y.k,E=A[1]-T[1]*y.k;return S===y.x&&E===y.y?y:new Ye(y.k,S,E)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function k(y,A,T,S){y.on("start.zoom",function(){N(this,arguments).event(S).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(S).end()}).tween("zoom",function(){var E=this,P=arguments,_=N(E,P).event(S),D=t.apply(E,P),z=T==null?w(D):typeof T=="function"?T.apply(E,P):T,F=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),B=E.__zoom,Y=typeof A=="function"?A.apply(E,P):A,K=c(B.invert(z).concat(F/B.k),Y.invert(z).concat(F/Y.k));return function(W){if(W===1)W=Y;else{var V=K(W),X=F/V[2];W=new Ye(X,z[0]-V[0]*X,z[1]-V[1]*X)}_.zoom(null,W)}})}function N(y,A,T){return!T&&y.__zooming||new I(y,A)}function I(y,A){this.that=y,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,A),this.taps=0}I.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,A){return this.mouse&&y!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var A=ve(this.that).datum();l.call(y,this.that,new yg(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),A)}};function M(y,...A){if(!e.apply(this,arguments))return;var T=N(this,A).event(y),S=this.__zoom,E=Math.max(i[0],Math.min(i[1],S.k*Math.pow(2,o.apply(this,arguments)))),P=Ne(y);if(T.wheel)(T.mouse[0][0]!==P[0]||T.mouse[0][1]!==P[1])&&(T.mouse[1]=S.invert(T.mouse[0]=P)),clearTimeout(T.wheel);else{if(S.k===E)return;T.mouse=[P,S.invert(P)],so(this),T.start()}cn(y),T.wheel=setTimeout(_,p),T.zoom("mouse",n(m(v(S,E),T.mouse[0],T.mouse[1]),T.extent,s));function _(){T.wheel=null,T.end()}}function L(y,...A){if(d||!e.apply(this,arguments))return;var T=y.currentTarget,S=N(this,A,!0).event(y),E=ve(y.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",F,!0),P=Ne(y,T),_=y.clientX,D=y.clientY;Is(y.view),Rr(y),S.mouse=[P,this.__zoom.invert(P)],so(this),S.start();function z(B){if(cn(B),!S.moved){var Y=B.clientX-_,K=B.clientY-D;S.moved=Y*Y+K*K>g}S.event(B).zoom("mouse",n(m(S.that.__zoom,S.mouse[0]=Ne(B,T),S.mouse[1]),S.extent,s))}function F(B){E.on("mousemove.zoom mouseup.zoom",null),Ps(B.view,S.moved),cn(B),S.event(B).end()}}function H(y,...A){if(e.apply(this,arguments)){var T=this.__zoom,S=Ne(y.changedTouches?y.changedTouches[0]:y,this),E=T.invert(S),P=T.k*(y.shiftKey?.5:2),_=n(m(v(T,P),S,E),t.apply(this,A),s);cn(y),a>0?ve(this).transition().duration(a).call(k,_,S,y):ve(this).call(b.transform,_,S,y)}}function j(y,...A){if(e.apply(this,arguments)){var T=y.touches,S=T.length,E=N(this,A,y.changedTouches.length===S).event(y),P,_,D,z;for(Rr(y),_=0;_<S;++_)D=T[_],z=Ne(D,this),z=[z,this.__zoom.invert(z),D.identifier],E.touch0?!E.touch1&&E.touch0[2]!==z[2]&&(E.touch1=z,E.taps=0):(E.touch0=z,P=!0,E.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(E.taps<2&&(h=z[0],u=setTimeout(function(){u=null},f)),so(this),E.start())}}function R(y,...A){if(this.__zooming){var T=N(this,A).event(y),S=y.changedTouches,E=S.length,P,_,D,z;for(cn(y),P=0;P<E;++P)_=S[P],D=Ne(_,this),T.touch0&&T.touch0[2]===_.identifier?T.touch0[0]=D:T.touch1&&T.touch1[2]===_.identifier&&(T.touch1[0]=D);if(_=T.that.__zoom,T.touch1){var F=T.touch0[0],B=T.touch0[1],Y=T.touch1[0],K=T.touch1[1],W=(W=Y[0]-F[0])*W+(W=Y[1]-F[1])*W,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;_=v(_,Math.sqrt(W/V)),D=[(F[0]+Y[0])/2,(F[1]+Y[1])/2],z=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(T.touch0)D=T.touch0[0],z=T.touch0[1];else return;T.zoom("touch",n(m(_,D,z),T.extent,s))}}function $(y,...A){if(this.__zooming){var T=N(this,A).event(y),S=y.changedTouches,E=S.length,P,_;for(Rr(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},f),P=0;P<E;++P)_=S[P],T.touch0&&T.touch0[2]===_.identifier?delete T.touch0:T.touch1&&T.touch1[2]===_.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(_=Ne(_,this),Math.hypot(h[0]-_[0],h[1]-_[1])<x)){var D=ve(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return b.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:ao(+y),b):o},b.filter=function(y){return arguments.length?(e=typeof y=="function"?y:ao(!!y),b):e},b.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:ao(!!y),b):r},b.extent=function(y){return arguments.length?(t=typeof y=="function"?y:ao([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),b):t},b.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],b):[i[0],i[1]]},b.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],b):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},b.constrain=function(y){return arguments.length?(n=y,b):n},b.duration=function(y){return arguments.length?(a=+y,b):a},b.interpolate=function(y){return arguments.length?(c=y,b):c},b.on=function(){var y=l.on.apply(l,arguments);return y===l?b:y},b.clickDistance=function(y){return arguments.length?(g=(y=+y)*y,b):Math.sqrt(g)},b.tapDistance=function(y){return arguments.length?(x=+y,b):x},b}const xe={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."},ln=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ua=["Enter"," ","Escape"],da={"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 Mt;(function(e){e.Strict="strict",e.Loose="loose"})(Mt||(Mt={}));var ut;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ut||(ut={}));var At;(function(e){e.Partial="partial",e.Full="full"})(At||(At={}));const fa={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Ze;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ze||(Ze={}));var lo;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(lo||(lo={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const ha={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function _g(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 pa(e,t,n){if(!n)return;const o=[];e.forEach((r,i)=>{t?.has(i)||o.push(r)}),o.length&&n(o)}function ga(e){return e===null?null:e?"valid":"invalid"}const ma=e=>"id"in e&&"source"in e&&"target"in e,Sg=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Lr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Cg=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach(r=>{r.source===e.id&&o.add(r.target)}),t.filter(r=>o.has(r.id))},un=(e,t=[0,0])=>{const{width:n,height:o}=Xe(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ng=(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):Lr(r)?r:t.nodeLookup.get(r.id));const a=s?ho(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return uo(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fo(n)},dn=(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=ho(o);n=uo(n,r)}}),fo(n)},$r=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...pn(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const l of e.values()){const{measured:u,selectable:h=!0,hidden:d=!1}=l;if(s&&!h||d)continue;const f=u.width??l.width??l.initialWidth??null,p=u.height??l.height??l.initialHeight??null,g=fn(a,Pt(l)),x=(f??0)*(p??0),b=i&&g>0;(!l.internals.handleBounds||b||g>=x||l.dragging)&&c.push(l)}return c},zr=(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 kg(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 Tg({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=kg(e,s),c=dn(a),l=jr(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function ya({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:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let h=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",xe.error005());else{const f=a.measured.width,p=a.measured.height;f&&p&&(h=[[c,l],[c+f,l+p]])}else a&&Dt(s.extent)&&(h=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Dt(h)?dt(t,h,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Mg({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const f=i.has(d.id),p=!f&&d.parentId&&s.find(g=>g.id===d.parentId);(f||p)&&s.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=zr(s,c);for(const d of c)a.has(d.id)&&!u.find(p=>p.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const h=await r({nodes:s,edges:u});return typeof h=="boolean"?h?{edges:u,nodes:s}:{edges:[],nodes:[]}:h}const It=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),dt=(e={x:0,y:0},t,n)=>({x:It(e.x,t[0][0],t[1][0]-(n?.width??0)),y:It(e.y,t[0][1],t[1][1]-(n?.height??0))});function xa(e,t,n){const{width:o,height:r}=Xe(n),{x:i,y:s}=n.internals.positionAbsolute;return dt(e,[[i,s],[i+o,s+r]],t)}const wa=(e,t,n)=>e<t?It(Math.abs(e-t),1,t)/t:e>n?-It(Math.abs(e-n),1,t)/t:0,ba=(e,t,n=15,o=40)=>{const r=wa(e.x,o,t.width-o)*n,i=wa(e.y,o,t.height-o)*n;return[r,i]},uo=(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)}),Hr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fo=({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}=Lr(e)?e.internals.positionAbsolute:un(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}},ho=(e,t=[0,0])=>{const{x:n,y:o}=Lr(e)?e.internals.positionAbsolute:un(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)}},va=(e,t)=>fo(uo(Hr(e),Hr(t))),fn=(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)},Ea=e=>Me(e.width)&&Me(e.height)&&Me(e.x)&&Me(e.y),Me=e=>!isNaN(e)&&isFinite(e),_a=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},hn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),pn=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?hn(a,s):a},po=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ot(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 Ag(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ot(e,n),r=Ot(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ot(e.top??e.y??0,n),r=Ot(e.bottom??e.y??0,n),i=Ot(e.left??e.x??0,t),s=Ot(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 Ig(e,t,n,o,r,i){const{x:s,y:a}=po(e,[t,n,o]),{x:c,y:l}=po({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,h=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(h)}}const jr=(e,t,n,o,r,i)=>{const s=Ag(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=It(l,o,r),h=e.x+e.width/2,d=e.y+e.height/2,f=t/2-h*u,p=n/2-d*u,g=Ig(e,f,p,u,t,n),x={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:f-x.left+x.right,y:p-x.top+x.bottom,zoom:u}},gn=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Dt(e){return e!=null&&e!=="parent"}function Xe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Sa(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ca(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 Na(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Pg(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Og(e){return{...da,...e||{}}}function mn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=$e(e),a=pn({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?hn(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Vr=e=>({width:e.offsetWidth,height:e.offsetHeight}),ka=e=>e?.getRootNode?.()||window?.document,Dg=["INPUT","SELECT","TEXTAREA"];function Ta(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Dg.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ma=e=>"clientX"in e,$e=(e,t)=>{const n=Ma(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)}},Aa=(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,...Vr(s)}})};function Ia({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),h=Math.abs(l-t);return[c,l,u,h]}function go(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Pa({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Q.Left:return[t-go(t-o,i),n];case Q.Right:return[t+go(o-t,i),n];case Q.Top:return[t,n-go(n-r,i)];case Q.Bottom:return[t,n+go(r-n,i)]}}function mo({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:o,targetY:r,targetPosition:i=Q.Top,curvature:s=.25}){const[a,c]=Pa({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=Pa({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[h,d,f,p]=Ia({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,h,d,f,p]}function Oa({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 Rg({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 Lg({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=uo(ho(e),ho(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 fn(s,fo(i))>0}const $g=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,zg=(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)),yo=(e,t)=>{if(!e.source||!e.target)return _a("006",xe.error006()),t;let n;return ma(e)?n={...e}:n={...e,id:$g(e)},zg(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Da({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Oa({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ra={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Hg=({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},La=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function jg({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:o=Q.Top,center:r,offset:i,stepPosition:s}){const a=Ra[t],c=Ra[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},h=Hg({source:l,sourcePosition:t,target:u}),d=h.x!==0?"x":"y",f=h[d];let p=[],g,x;const b={x:0,y:0},v={x:0,y:0},[,,m,w]=Oa({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(g=r.x??l.x+(u.x-l.x)*s,x=r.y??(l.y+u.y)/2):(g=r.x??(l.x+u.x)/2,x=r.y??l.y+(u.y-l.y)*s);const N=[{x:g,y:l.y},{x:g,y:u.y}],I=[{x:l.x,y:x},{x:u.x,y:x}];a[d]===f?p=d==="x"?N:I:p=d==="x"?I:N}else{const N=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(d==="x"?p=a.x===f?I:N:p=a.y===f?N:I,t===o){const R=Math.abs(e[d]-n[d]);if(R<=i){const $=Math.min(i-1,i-R);a[d]===f?b[d]=(l[d]>e[d]?-1:1)*$:v[d]=(u[d]>n[d]?-1:1)*$}}if(t!==o){const R=d==="x"?"y":"x",$=a[d]===c[R],y=l[R]>u[R],A=l[R]<u[R];(a[d]===1&&(!$&&y||$&&A)||a[d]!==1&&(!$&&A||$&&y))&&(p=d==="x"?N:I)}const M={x:l.x+b.x,y:l.y+b.y},L={x:u.x+v.x,y:u.y+v.y},H=Math.max(Math.abs(M.x-p[0].x),Math.abs(L.x-p[0].x)),j=Math.max(Math.abs(M.y-p[0].y),Math.abs(L.y-p[0].y));H>=j?(g=(M.x+L.x)/2,x=p[0].y):(g=p[0].x,x=(M.y+L.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...p,{x:u.x+v.x,y:u.y+v.y},n],g,x,m,w]}function Vg(e,t,n,o){const r=Math.min(La(e,t)/2,La(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 l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Fr({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:o,targetY:r,targetPosition:i=Q.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[h,d,f,p,g]=jg({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});return[h.reduce((b,v,m)=>{let w="";return m>0&&m<h.length-1?w=Vg(h[m-1],v,h[m+1],s):w=`${m===0?"M":"L"}${v.x} ${v.y}`,b+=w,b},""),d,f,p,g]}function $a(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Fg(e){const{sourceNode:t,targetNode:n}=e;if(!$a(t)||!$a(n))return null;const o=t.internals.handleBounds||za(t.handles),r=n.internals.handleBounds||za(n.handles),i=Ha(o?.source??[],e.sourceHandle),s=Ha(e.connectionMode===Mt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Q.Bottom,c=s?.position||Q.Top,l=yn(t,i,a),u=yn(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function za(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 yn(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??Xe(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 Ha(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Br(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Bg(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(c=>{if(c&&typeof c=="object"){const l=Br(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Wr={nodeOrigin:[0,0],nodeExtent:ln,elevateNodesOnSelect:!0,defaults:{}},Wg={...Wr,checkEquality:!0};function Yr(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Yg(e,t,n){const o=Yr(Wr,n);for(const r of e.values())if(r.parentId)Ur(r,e,t,o);else{const i=un(r,o.nodeOrigin),s=Dt(r.extent)?r.extent:o.nodeExtent,a=dt(i,s,Xe(r));r.internals.positionAbsolute=a}}function Xr(e,t,n,o){const r=Yr(Wg,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const c of e){let l=s.get(c.id);if(r.checkEquality&&c===l?.internals.userNode)t.set(c.id,l);else{const u=un(c,r.nodeOrigin),h=Dt(c.extent)?c.extent:r.nodeExtent,d=dt(u,h,Xe(c));l={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:d,handleBounds:c.measured?l?.internals.handleBounds:void 0,z:ja(c,a),userNode:c}},t.set(c.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(i=!1),c.parentId&&Ur(l,t,n,o)}return i}function Xg(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 Ur(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Yr(Wr,o),a=e.parentId,c=t.get(a);if(!c){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}Xg(e,n);const l=r?1e3:0,{x:u,y:h,z:d}=Ug(e,c,i,s,l),{positionAbsolute:f}=e.internals,p=u!==f.x||h!==f.y;(p||d!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:u,y:h}:f,z:d}})}function ja(e,t){return(Me(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ug(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=Xe(e),c=un(e,n),l=Dt(e.extent)?dt(c,e.extent,a):c;let u=dt({x:i+l.x,y:s+l.y},o,a);e.extent==="parent"&&(u=xa(u,a,t));const h=ja(e,r),d=t.internals.z??0;return{x:u.x,y:u.y,z:d>=h?d+1:h}}function Gr(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 c=i.get(s.parentId)?.expandedRect??Pt(a),l=va(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,u=Xe(a),h=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,f=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,p=Math.max(u.width,Math.round(s.width)),g=Math.max(u.height,Math.round(s.height)),x=(p-u.width)*h[0],b=(g-u.height)*h[1];(d>0||f>0||x||b)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+x,y:a.position.y-f+b}}),n.get(c)?.forEach(v=>{e.some(m=>m.id===v.id)||r.push({id:v.id,type:"position",position:{x:v.position.x+d,y:v.position.y+f}})})),(u.width<s.width||u.height<s.height||d||f)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?h[0]*d-x:0),height:g+(f?h[1]*f-b:0)}})}),r}function Gg(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],l=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(l.transform),h=[];for(const d of e.values()){const f=t.get(d.id);if(!f)continue;if(f.hidden){t.set(f.id,{...f,internals:{...f.internals,handleBounds:void 0}}),a=!0;continue}const p=Vr(d.nodeElement),g=f.measured.width!==p.width||f.measured.height!==p.height;if(!!(p.width&&p.height&&(g||!f.internals.handleBounds||d.force))){const b=d.nodeElement.getBoundingClientRect(),v=Dt(f.extent)?f.extent:i;let{positionAbsolute:m}=f.internals;f.parentId&&f.extent==="parent"?m=xa(m,p,t.get(f.parentId)):v&&(m=dt(m,v,p));const w={...f,measured:p,internals:{...f.internals,positionAbsolute:m,handleBounds:{source:Aa("source",d.nodeElement,b,u,f.id),target:Aa("target",d.nodeElement,b,u,f.id)}}};t.set(f.id,w),f.parentId&&Ur(w,t,n,{nodeOrigin:r}),a=!0,g&&(c.push({id:f.id,type:"dimensions",dimensions:p}),f.expandParent&&f.parentId&&h.push({id:f.id,parentId:f.parentId,rect:Pt(w,r)}))}}if(h.length>0){const d=Gr(h,t,n,r);c.push(...d)}return{changes:c,updatedInternals:a}}async function qg({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 Va(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 c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function Fa(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Va("source",c,u,e,r,s),Va("target",c,l,e,i,a),t.set(o.id,o)}}function Zg(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 Ba(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ba(n,t):!1}function Wa(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 Kg(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ba(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 qr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,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 Qg({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=hn(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Jg({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,h=!1,d=null,f=!1,p=!1,g=null;function x({noDragClassName:v,handleSelector:m,domNode:w,isSelectable:k,nodeId:N,nodeClickDistance:I=0}){d=ve(w);function M({x:R,y:$}){const{nodeLookup:y,nodeExtent:A,snapGrid:T,snapToGrid:S,nodeOrigin:E,onNodeDrag:P,onSelectionDrag:_,onError:D,updateNodePositions:z}=t();i={x:R,y:$};let F=!1;const B=a.size>1,Y=B&&A?Hr(dn(a)):null,K=B&&S?Qg({dragItems:a,snapGrid:T,x:R,y:$}):null;for(const[W,V]of a){if(!y.has(W))continue;let X={x:R-V.distance.x,y:$-V.distance.y};S&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:hn(X,T));let J=null;if(B&&A&&!V.extent&&Y){const{positionAbsolute:oe}=V.internals,ne=oe.x-Y.x+A[0][0],ue=oe.x+V.measured.width-Y.x2+A[1][0],ge=oe.y-Y.y+A[0][1],Pe=oe.y+V.measured.height-Y.y2+A[1][1];J=[[ne,ge],[ue,Pe]]}const{position:te,positionAbsolute:Z}=ya({nodeId:W,nextPosition:X,nodeLookup:y,nodeExtent:J||A,nodeOrigin:E,onError:D});F=F||V.position.x!==te.x||V.position.y!==te.y,V.position=te,V.internals.positionAbsolute=Z}if(p=p||F,!!F&&(z(a,!0),g&&(o||P||!N&&_))){const[W,V]=qr({nodeId:N,dragItems:a,nodeLookup:y});o?.(g,a,W,V),P?.(g,W,V),N||_?.(g,V)}}async function L(){if(!u)return;const{transform:R,panBy:$,autoPanSpeed:y,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(s);return}const[T,S]=ba(l,u,y);(T!==0||S!==0)&&(i.x=(i.x??0)-T/R[2],i.y=(i.y??0)-S/R[2],await $({x:T,y:S})&&M(i)),s=requestAnimationFrame(L)}function H(R){const{nodeLookup:$,multiSelectionActive:y,nodesDraggable:A,transform:T,snapGrid:S,snapToGrid:E,selectNodesOnDrag:P,onNodeDragStart:_,onSelectionDragStart:D,unselectNodesAndEdges:z}=t();h=!0,(!P||!k)&&!y&&N&&($.get(N)?.selected||z()),k&&P&&N&&e?.(N);const F=mn(R.sourceEvent,{transform:T,snapGrid:S,snapToGrid:E,containerBounds:u});if(i=F,a=Kg($,A,F,N),a.size>0&&(n||_||!N&&D)){const[B,Y]=qr({nodeId:N,dragItems:a,nodeLookup:$});n?.(R.sourceEvent,a,B,Y),_?.(R.sourceEvent,B,Y),N||D?.(R.sourceEvent,Y)}}const j=Os().clickDistance(I).on("start",R=>{const{domNode:$,nodeDragThreshold:y,transform:A,snapGrid:T,snapToGrid:S}=t();u=$?.getBoundingClientRect()||null,f=!1,p=!1,g=R.sourceEvent,y===0&&H(R),i=mn(R.sourceEvent,{transform:A,snapGrid:T,snapToGrid:S,containerBounds:u}),l=$e(R.sourceEvent,u)}).on("drag",R=>{const{autoPanOnNodeDrag:$,transform:y,snapGrid:A,snapToGrid:T,nodeDragThreshold:S,nodeLookup:E}=t(),P=mn(R.sourceEvent,{transform:y,snapGrid:A,snapToGrid:T,containerBounds:u});if(g=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||N&&!E.has(N))&&(f=!0),!f){if(!c&&$&&h&&(c=!0,L()),!h){const _=P.xSnapped-(i.x??0),D=P.ySnapped-(i.y??0);Math.sqrt(_*_+D*D)>S&&H(R)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&h&&(l=$e(R.sourceEvent,u),M(P))}}).on("end",R=>{if(!(!h||f)&&(c=!1,h=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:$,updateNodePositions:y,onNodeDragStop:A,onSelectionDragStop:T}=t();if(p&&(y(a,!1),p=!1),r||A||!N&&T){const[S,E]=qr({nodeId:N,dragItems:a,nodeLookup:$,dragging:!1});r?.(R.sourceEvent,a,S,E),A?.(R.sourceEvent,S,E),N||T?.(R.sourceEvent,E)}}}).filter(R=>{const $=R.target;return!R.button&&(!v||!Wa($,`.${v}`,w))&&(!m||Wa($,m,w))});d.call(j)}function b(){d?.on(".drag",null)}return{update:x,destroy:b}}function em(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())fn(r,Pt(i))>0&&o.push(i);return o}const tm=250;function nm(e,t,n,o){let r=[],i=1/0;const s=em(e,n,t+tm);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:h}=yn(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(h-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:h}],i=d):d===i&&r.push({...l,x:u,y:h}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ya(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??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...yn(s,c,c.position,!0)}:c}function Xa(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function om(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ua=()=>!0;function rm(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:h,panBy:d,cancelConnection:f,onConnectStart:p,onConnect:g,onConnectEnd:x,isValidConnection:b=Ua,onReconnectEnd:v,updateConnection:m,getTransform:w,getFromHandle:k,autoPanSpeed:N,dragThreshold:I=1,handleDomNode:M}){const L=ka(e.target);let H=0,j;const{x:R,y:$}=$e(e),y=Xa(i,M),A=a?.getBoundingClientRect();let T=!1;if(!A||!y)return;const S=Ya(r,y,o,c,t);if(!S)return;let E=$e(e,A),P=!1,_=null,D=!1,z=null;function F(){if(!u||!A)return;const[te,Z]=ba(E,A,N);d({x:te,y:Z}),H=requestAnimationFrame(F)}const B={...S,nodeId:r,type:y,position:S.position},Y=c.get(r);let W={inProgress:!0,isValid:null,from:yn(Y,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Y,to:E,toHandle:null,toPosition:ha[B.position],toNode:null};function V(){T=!0,m(W),p?.(e,{nodeId:r,handleId:o,handleType:y})}I===0&&V();function X(te){if(!T){const{x:ue,y:ge}=$e(te),Pe=ue-R,Bt=ge-$;if(!(Pe*Pe+Bt*Bt>I*I))return;V()}if(!k()||!B){J(te);return}const Z=w();E=$e(te,A),j=nm(pn(E,Z,!1,[1,1]),n,c,B),P||(F(),P=!0);const oe=Ga(te,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:L,lib:l,flowId:h,nodeLookup:c});z=oe.handleDomNode,_=oe.connection,D=om(!!j,oe.isValid);const ne={...W,isValid:D,to:oe.toHandle&&D?po({x:oe.toHandle.x,y:oe.toHandle.y},Z):E,toHandle:oe.toHandle,toPosition:D&&oe.toHandle?oe.toHandle.position:ha[B.position],toNode:oe.toHandle?c.get(oe.toHandle.nodeId):null};D&&j&&W.toHandle&&ne.toHandle&&W.toHandle.type===ne.toHandle.type&&W.toHandle.nodeId===ne.toHandle.nodeId&&W.toHandle.id===ne.toHandle.id&&W.to.x===ne.to.x&&W.to.y===ne.to.y||(m(ne),W=ne)}function J(te){if(T){(j||z)&&_&&D&&g?.(_);const{inProgress:Z,...oe}=W,ne={...oe,toPosition:W.toHandle?W.toPosition:null};x?.(te,ne),i&&v?.(te,ne)}f(),cancelAnimationFrame(H),P=!1,D=!1,_=null,z=null,L.removeEventListener("mousemove",X),L.removeEventListener("mouseup",J),L.removeEventListener("touchmove",X),L.removeEventListener("touchend",J)}L.addEventListener("mousemove",X),L.addEventListener("mouseup",J),L.addEventListener("touchmove",X),L.addEventListener("touchend",J)}function Ga(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Ua,nodeLookup:u}){const h=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:p}=$e(e),g=s.elementFromPoint(f,p),x=g?.classList.contains(`${a}-flow__handle`)?g:d,b={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const v=Xa(void 0,x),m=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),k=x.classList.contains("connectable"),N=x.classList.contains("connectableend");if(!m||!v)return b;const I={source:h?m:o,sourceHandle:h?w:r,target:h?o:m,targetHandle:h?r:w};b.connection=I;const L=k&&N&&(n===Mt.Strict?h&&v==="source"||!h&&v==="target":m!==o||w!==r);b.isValid=L&&l(I),b.toHandle=Ya(m,v,w,u,n,!0)}return b}const Zr={onPointerDown:rm,isValid:Ga};function im({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ve(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:h=!0,zoomable:d=!0,inversePan:f=!1}){const p=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const w=n(),k=m.sourceEvent.ctrlKey&&gn()?10:1,N=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*u,I=w[2]*Math.pow(2,N*k);t.scaleTo(I)};let g=[0,0];const x=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])},b=m=>{const w=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const k=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],N=[k[0]-g[0],k[1]-g[1]];g=k;const I=o()*Math.max(w[2],Math.log(w[2]))*(f?-1:1),M={x:w[0]-N[0]*I,y:w[1]-N[1]*I},L=[[0,0],[c,l]];t.setViewportConstrained({x:M.x,y:M.y,zoom:w[2]},L,a)},v=la().on("start",x).on("zoom",h?b:null).on("zoom.wheel",d?p:null);r.call(v,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:Ne}}const sm=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,xo=e=>({x:e.x,y:e.y,zoom:e.k}),Kr=({x:e,y:t,zoom:n})=>co.translate(e,t).scale(n),Rt=(e,t)=>e.target.closest(`.${t}`),qa=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),am=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Qr=(e,t=0,n=am,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Za=e=>{const t=e.ctrlKey&&gn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cm({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Rt(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(u.ctrlKey&&s){const x=Ne(u),b=Za(u),v=h*Math.pow(2,b);o.scaleTo(n,v,x,u);return}const d=u.deltaMode===1?20:1;let f=r===ut.Vertical?0:u.deltaX*d,p=r===ut.Horizontal?0:u.deltaY*d;!gn()&&u.shiftKey&&r!==ut.Vertical&&(f=u.deltaY*d,p=0),o.translateBy(n,-(f/h)*i,-(p/h)*i,{internal:!0});const g=xo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a?.(u,g)),e.isPanScrolling&&(c?.(u,g),e.panScrollTimeout=setTimeout(()=>{l?.(u,g),e.isPanScrolling=!1},150))}}function lm({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Rt(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function um({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=xo(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 dm({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&qa(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,xo(i.transform))}}function fm({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&qa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&sm(e.prevViewport,s.transform))){const a=xo(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function hm({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l}){return u=>{const h=e||t,d=n&&u.ctrlKey;if(u.button===1&&u.type==="mousedown"&&(Rt(u,`${l}-flow__node`)||Rt(u,`${l}-flow__edge`)))return!0;if(!o&&!h&&!r&&!i&&!n||s||Rt(u,a)&&u.type==="wheel"||Rt(u,c)&&(u.type!=="wheel"||r&&u.type==="wheel"&&!e)||!n&&u.ctrlKey&&u.type==="wheel")return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!h&&!r&&!d&&u.type==="wheel"||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const f=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||u.type==="wheel")&&f}}function pm({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),d=la().clickDistance(!Me(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),f=ve(e).call(d);m({x:i.x,y:i.y,zoom:It(i.zoom,t,n)},[[0,0],[h.width,h.height]],r);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(Za);function x(R,$){return f?new Promise(y=>{d?.interpolate($?.interpolate==="linear"?nn:Qn).transform(Qr(f,$?.duration,$?.ease,()=>y(!0)),R)}):Promise.resolve(!1)}function b({noWheelClassName:R,noPanClassName:$,onPaneContextMenu:y,userSelectionActive:A,panOnScroll:T,panOnDrag:S,panOnScrollMode:E,panOnScrollSpeed:P,preventScrolling:_,zoomOnPinch:D,zoomOnScroll:z,zoomOnDoubleClick:F,zoomActivationKeyPressed:B,lib:Y,onTransformChange:K}){A&&!u.isZoomingOrPanning&&v();const V=T&&!B&&!A?cm({zoomPanValues:u,noWheelClassName:R,d3Selection:f,d3Zoom:d,panOnScrollMode:E,panOnScrollSpeed:P,zoomOnPinch:D,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):lm({noWheelClassName:R,preventScrolling:_,d3ZoomHandler:p});if(f.on("wheel.zoom",V,{passive:!1}),!A){const J=um({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});d.on("start",J);const te=dm({zoomPanValues:u,panOnDrag:S,onPaneContextMenu:!!y,onPanZoom:s,onTransformChange:K});d.on("zoom",te);const Z=fm({zoomPanValues:u,panOnDrag:S,panOnScroll:T,onPaneContextMenu:y,onPanZoomEnd:c,onDraggingChange:l});d.on("end",Z)}const X=hm({zoomActivationKeyPressed:B,panOnDrag:S,zoomOnScroll:z,panOnScroll:T,zoomOnDoubleClick:F,zoomOnPinch:D,userSelectionActive:A,noPanClassName:$,noWheelClassName:R,lib:Y});d.filter(X),F?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function v(){d.on("zoom",null)}async function m(R,$,y){const A=Kr(R),T=d?.constrain()(A,$,y);return T&&await x(T),new Promise(S=>S(T))}async function w(R,$){const y=Kr(R);return await x(y,$),new Promise(A=>A(y))}function k(R){if(f){const $=Kr(R),y=f.property("__zoom");(y.k!==R.zoom||y.x!==R.x||y.y!==R.y)&&d?.transform(f,$,null,{sync:!0})}}function N(){const R=f?aa(f.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}function I(R,$){return f?new Promise(y=>{d?.interpolate($?.interpolate==="linear"?nn:Qn).scaleTo(Qr(f,$?.duration,$?.ease,()=>y(!0)),R)}):Promise.resolve(!1)}function M(R,$){return f?new Promise(y=>{d?.interpolate($?.interpolate==="linear"?nn:Qn).scaleBy(Qr(f,$?.duration,$?.ease,()=>y(!0)),R)}):Promise.resolve(!1)}function L(R){d?.scaleExtent(R)}function H(R){d?.translateExtent(R)}function j(R){const $=!Me(R)||R<0?0:R;d?.clickDistance($)}return{update:b,destroy:v,setViewport:w,setViewportConstrained:m,getViewport:N,scaleTo:I,scaleBy:M,setScaleExtent:L,setTranslateExtent:H,syncViewport:k,setClickDistance:j}}var ft;(function(e){e.Line="line",e.Handle="handle"})(ft||(ft={}));function gm({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function mm(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 Ke(e,t){return Math.max(0,t-e)}function Qe(e,t){return Math.max(0,e-t)}function wo(e,t,n){return Math.max(0,t-e,e-n)}function Ka(e,t){return e?!t:t}function ym(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:h}=t,d=u&&h,{xSnapped:f,ySnapped:p}=n,{minWidth:g,maxWidth:x,minHeight:b,maxHeight:v}=o,{x:m,y:w,width:k,height:N,aspectRatio:I}=e;let M=Math.floor(u?f-e.pointerX:0),L=Math.floor(h?p-e.pointerY:0);const H=k+(c?-M:M),j=N+(l?-L:L),R=-i[0]*k,$=-i[1]*N;let y=wo(H,g,x),A=wo(j,b,v);if(s){let E=0,P=0;c&&M<0?E=Ke(m+M+R,s[0][0]):!c&&M>0&&(E=Qe(m+H+R,s[1][0])),l&&L<0?P=Ke(w+L+$,s[0][1]):!l&&L>0&&(P=Qe(w+j+$,s[1][1])),y=Math.max(y,E),A=Math.max(A,P)}if(a){let E=0,P=0;c&&M>0?E=Qe(m+M,a[0][0]):!c&&M<0&&(E=Ke(m+H,a[1][0])),l&&L>0?P=Qe(w+L,a[0][1]):!l&&L<0&&(P=Ke(w+j,a[1][1])),y=Math.max(y,E),A=Math.max(A,P)}if(r){if(u){const E=wo(H/I,b,v)*I;if(y=Math.max(y,E),s){let P=0;!c&&!l||c&&!l&&d?P=Qe(w+$+H/I,s[1][1])*I:P=Ke(w+$+(c?M:-M)/I,s[0][1])*I,y=Math.max(y,P)}if(a){let P=0;!c&&!l||c&&!l&&d?P=Ke(w+H/I,a[1][1])*I:P=Qe(w+(c?M:-M)/I,a[0][1])*I,y=Math.max(y,P)}}if(h){const E=wo(j*I,g,x)/I;if(A=Math.max(A,E),s){let P=0;!c&&!l||l&&!c&&d?P=Qe(m+j*I+R,s[1][0])/I:P=Ke(m+(l?L:-L)*I+R,s[0][0])/I,A=Math.max(A,P)}if(a){let P=0;!c&&!l||l&&!c&&d?P=Ke(m+j*I,a[1][0])/I:P=Qe(m+(l?L:-L)*I,a[0][0])/I,A=Math.max(A,P)}}}L=L+(L<0?A:-A),M=M+(M<0?y:-y),r&&(d?H>j*I?L=(Ka(c,l)?-M:M)/I:M=(Ka(c,l)?-L:L)*I:u?(L=M/I,l=c):(M=L*I,c=l));const T=c?m+M:m,S=l?w+L:w;return{width:k+(c?-M:M),height:N+(l?-L:L),x:i[0]*M*(c?-1:1)+T,y:i[1]*L*(l?-1:1)+S}}const Qa={width:0,height:0,x:0,y:0},xm={...Qa,pointerX:0,pointerY:0,aspectRatio:1};function wm(e){return[[0,0],[e.measured.width,e.measured.height]]}function bm(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,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function vm({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ve(e);function s({controlPosition:c,boundaries:l,keepAspectRatio:u,resizeDirection:h,onResizeStart:d,onResize:f,onResizeEnd:p,shouldResize:g}){let x={...Qa},b={...xm};const v=mm(c);let m,w=null,k=[],N,I,M;const L=Os().on("start",H=>{const{nodeLookup:j,transform:R,snapGrid:$,snapToGrid:y,nodeOrigin:A,paneDomNode:T}=n();if(m=j.get(t),!m)return;w=T?.getBoundingClientRect()??null;const{xSnapped:S,ySnapped:E}=mn(H.sourceEvent,{transform:R,snapGrid:$,snapToGrid:y,containerBounds:w});x={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},b={...x,pointerX:S,pointerY:E,aspectRatio:x.width/x.height},N=void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(N=j.get(m.parentId),I=N&&m.extent==="parent"?wm(N):void 0),k=[],M=void 0;for(const[P,_]of j)if(_.parentId===t&&(k.push({id:P,position:{..._.position},extent:_.extent}),_.extent==="parent"||_.expandParent)){const D=bm(_,m,_.origin??A);M?M=[[Math.min(D[0][0],M[0][0]),Math.min(D[0][1],M[0][1])],[Math.max(D[1][0],M[1][0]),Math.max(D[1][1],M[1][1])]]:M=D}d?.(H,{...x})}).on("drag",H=>{const{transform:j,snapGrid:R,snapToGrid:$,nodeOrigin:y}=n(),A=mn(H.sourceEvent,{transform:j,snapGrid:R,snapToGrid:$,containerBounds:w}),T=[];if(!m)return;const{x:S,y:E,width:P,height:_}=x,D={},z=m.origin??y,{width:F,height:B,x:Y,y:K}=ym(b,v,A,l,u,z,I,M),W=F!==P,V=B!==_,X=Y!==S&&W,J=K!==E&&V;if(!X&&!J&&!W&&!V)return;if((X||J||z[0]===1||z[1]===1)&&(D.x=X?Y:x.x,D.y=J?K:x.y,x.x=D.x,x.y=D.y,k.length>0)){const ne=Y-S,ue=K-E;for(const ge of k)ge.position={x:ge.position.x-ne+z[0]*(F-P),y:ge.position.y-ue+z[1]*(B-_)},T.push(ge)}if((W||V)&&(D.width=W&&(!h||h==="horizontal")?F:x.width,D.height=V&&(!h||h==="vertical")?B:x.height,x.width=D.width,x.height=D.height),N&&m.expandParent){const ne=z[0]*(D.width??0);D.x&&D.x<ne&&(x.x=ne,b.x=b.x-(D.x-ne));const ue=z[1]*(D.height??0);D.y&&D.y<ue&&(x.y=ue,b.y=b.y-(D.y-ue))}const te=gm({width:x.width,prevWidth:P,height:x.height,prevHeight:_,affectsX:v.affectsX,affectsY:v.affectsY}),Z={...x,direction:te};g?.(H,Z)!==!1&&(f?.(H,Z),o(D,T))}).on("end",H=>{p?.(H,{...x}),r?.({...x})});i.call(L)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}var bo={exports:{}},Jr={},vo={exports:{}},ei={};/**
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 Ja;function Em(){if(Ja)return ei;Ja=1;var e=O;function t(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(h,d){var f=d(),p=o({inst:{value:f,getSnapshot:d}}),g=p[0].inst,x=p[1];return i(function(){g.value=f,g.getSnapshot=d,c(g)&&x({inst:g})},[h,f,d]),r(function(){return c(g)&&x({inst:g}),h(function(){c(g)&&x({inst:g})})},[h]),s(f),f}function c(h){var d=h.getSnapshot;h=h.value;try{var f=d();return!n(h,f)}catch{return!0}}function l(h,d){return d()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return ei.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,ei}var ti={};/**
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 ec;function _m(){return ec||(ec=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){u||r.startTransition===void 0||(u=!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(!h){var x=p();i(g,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}x=s({inst:{value:g,getSnapshot:p}});var b=x[0].inst,v=x[1];return c(function(){b.value=g,b.getSnapshot=p,n(b)&&v({inst:b})},[f,g,p]),a(function(){return n(b)&&v({inst:b}),f(function(){n(b)&&v({inst:b})})},[f]),l(g),g}function n(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!i(f,g)}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=O,i=typeof Object.is=="function"?Object.is:e,s=r.useState,a=r.useEffect,c=r.useLayoutEffect,l=r.useDebugValue,u=!1,h=!1,d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;ti.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ti}var tc;function nc(){return tc||(tc=1,process.env.NODE_ENV==="production"?vo.exports=Em():vo.exports=_m()),vo.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 oc;function Sm(){if(oc)return Jr;oc=1;var e=O,t=nc();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Jr.useSyncExternalStoreWithSelector=function(l,u,h,d,f){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 b(N){if(!v){if(v=!0,m=N,N=d(N),f!==void 0&&g.hasValue){var I=g.value;if(f(I,N))return w=I}return w=N}if(I=w,o(m,N))return I;var M=d(N);return f!==void 0&&f(I,M)?(m=N,I):(m=N,w=M)}var v=!1,m,w,k=h===void 0?null:h;return[function(){return b(u())},k===null?void 0:function(){return b(k())}]},[u,h,d,f]);var x=r(l,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=x},[x]),c(x),x},Jr}var ni={};/**
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 rc;function Cm(){return rc||(rc=1,process.env.NODE_ENV!=="production"&&function(){function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=O,n=nc(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,c=t.useDebugValue;ni.useSyncExternalStoreWithSelector=function(l,u,h,d,f){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 b(N){if(!v){if(v=!0,m=N,N=d(N),f!==void 0&&g.hasValue){var I=g.value;if(f(I,N))return w=I}return w=N}if(I=w,o(m,N))return I;var M=d(N);return f!==void 0&&f(I,M)?(m=N,I):(m=N,w=M)}var v=!1,m,w,k=h===void 0?null:h;return[function(){return b(u())},k===null?void 0:function(){return b(k())}]},[u,h,d,f]);var x=r(l,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=x},[x]),c(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ni}var ic;function Nm(){return ic||(ic=1,process.env.NODE_ENV==="production"?bo.exports=Sm():bo.exports=Cm()),bo.exports}var km=Nm();const Tm=Au(km),Mm={},sc=e=>{let t;const n=new Set,o=(u,h)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=h??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,f))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Mm?"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()}},l=t=e(o,r,c);return c},Am=e=>e?sc(e):sc,{useDebugValue:Im}=O,{useSyncExternalStoreWithSelector:Pm}=Tm,Om=e=>e;function ac(e,t=Om,n){const o=Pm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Im(o),o}const cc=(e,t)=>{const n=Am(e),o=(r,i=t)=>ac(n,r,i);return Object.assign(o,n),o},Dm=(e,t)=>e?cc(e,t):cc;function de(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 Eo=O.createContext(null),Rm=Eo.Provider,lc=xe.error001();function ie(e,t){const n=O.useContext(Eo);if(n===null)throw new Error(lc);return ac(n,e,t)}function ce(){const e=O.useContext(Eo);if(e===null)throw new Error(lc);return O.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const uc={display:"none"},Lm={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dc="react-flow__node-desc",fc="react-flow__edge-desc",$m="react-flow__aria-live",zm=e=>e.ariaLiveMessage,Hm=e=>e.ariaLabelConfig;function jm({rfId:e}){const t=ie(zm);return C.jsx("div",{id:`${$m}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Lm,children:t})}function Vm({rfId:e,disableKeyboardA11y:t}){const n=ie(Hm);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${dc}-${e}`,style:uc,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${fc}-${e}`,style:uc,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(jm,{rfId:e})]})}const _o=O.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return C.jsx("div",{className:fe(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});_o.displayName="Panel";function Fm({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:C.jsx(_o,{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:C.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Bm=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}},So=e=>e.id;function Wm(e,t){return de(e.selectedNodes.map(So),t.selectedNodes.map(So))&&de(e.selectedEdges.map(So),t.selectedEdges.map(So))}function Ym({onSelectionChange:e}){const t=ce(),{selectedNodes:n,selectedEdges:o}=ie(Bm,Wm);return O.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Xm=e=>!!e.onSelectionChangeHandlers;function Um({onSelectionChange:e}){const t=ie(Xm);return e||t?C.jsx(Ym,{onSelectionChange:e}):null}const hc=[0,0],Gm={x:0,y:0,zoom:1},pc=[...["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"],qm=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}),gc={translateExtent:ln,nodeOrigin:hc,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Zm(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:l}=ie(qm,de),u=ce();O.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=gc,a()}),[]);const h=O.useRef(gc);return O.useEffect(()=>{for(const d of pc){const f=e[d],p=h.current[d];f!==p&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="paneClickDistance"?l(f):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:Og(f)}):d==="fitView"?u.setState({fitViewQueued:f}):d==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[d]:f})))}h.current=e},pc.map(d=>e[d])),null}function mc(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Km(e){const[t,n]=O.useState(e==="system"?null:e);return O.useEffect(()=>{if(e!=="system"){n(e);return}const o=mc(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:mc()?.matches?"dark":"light"}const yc=typeof document<"u"?document:null;function xn(e=null,t={target:yc,actInsideInputWithModifier:!0}){const[n,o]=O.useState(!1),r=O.useRef(!1),i=O.useRef(new Set([])),[s,a]=O.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.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
+ `)),u=l.reduce((h,d)=>h.concat(...d),[]);return[l,u]}return[[],[]]},[e]);return O.useEffect(()=>{const c=t?.target??yc,l=t?.actInsideInputWithModifier??!0;if(e!==null){const u=f=>{if(r.current=f.ctrlKey||f.metaKey||f.shiftKey||f.altKey,(!r.current||r.current&&!l)&&Ta(f))return!1;const g=wc(f.code,a);if(i.current.add(f[g]),xc(s,i.current,!1)){const x=f.composedPath?.()?.[0]||f.target,b=x?.nodeName==="BUTTON"||x?.nodeName==="A";t.preventDefault!==!1&&(r.current||!b)&&f.preventDefault(),o(!0)}},h=f=>{const p=wc(f.code,a);xc(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(f[p]),f.key==="Meta"&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return c?.addEventListener("keydown",u),c?.addEventListener("keyup",h),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c?.removeEventListener("keydown",u),c?.removeEventListener("keyup",h),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function xc(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function wc(e,t){return t.includes(e)?"code":"key"}const Qm=()=>{const e=ce();return O.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(),c=jr(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(c,{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:c}=s.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},u=n.snapGrid??r,h=n.snapToGrid??i;return pn(l,o,h,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=po(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function bc(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 c of s)Jm(c,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 Jm(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 vc(e,t){return bc(e,t)}function wn(e,t){return bc(e,t)}function ht(e,t){return{id:e,type:"select",selected:t}}function Lt(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(ht(i.id,s)))}return o}function Ec({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 _c(e){return{id:e.id,type:"remove"}}const Sc=e=>Sg(e),ey=e=>ma(e);function Cc(e){return O.forwardRef(e)}const ty=typeof window<"u"?O.useLayoutEffect:O.useEffect;function Nc(e){const[t,n]=O.useState(BigInt(0)),[o]=O.useState(()=>ny(()=>n(r=>r+BigInt(1))));return ty(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function ny(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const kc=O.createContext(null);function oy({children:e}){const t=ce(),n=O.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:u,onNodesChange:h,nodeLookup:d,fitViewQueued:f}=t.getState();let p=c;for(const x of a)p=typeof x=="function"?x(p):x;const g=Ec({items:p,lookup:d});u&&l(p),g.length>0?h?.(g):f&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:b,setNodes:v}=t.getState();x&&v(b)})},[]),o=Nc(n),r=O.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:u,onEdgesChange:h,edgeLookup:d}=t.getState();let f=c;for(const p of a)f=typeof p=="function"?p(f):p;u?l(f):h&&h(Ec({items:f,lookup:d}))},[]),i=Nc(r),s=O.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return C.jsx(kc.Provider,{value:s,children:e})}function ry(){const e=O.useContext(kc);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const iy=e=>!!e.panZoom;function bn(){const e=Qm(),t=ce(),n=ry(),o=ie(iy),r=O.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),s=h=>{n.nodeQueue.push(h)},a=h=>{n.edgeQueue.push(h)},c=h=>{const{nodeLookup:d,nodeOrigin:f}=t.getState(),p=Sc(h)?h:d.get(h.id),g=p.parentId?Ca(p.position,p.measured,p.parentId,d,f):p.position,x={...p,position:g,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return Pt(x)},l=(h,d,f={replace:!1})=>{s(p=>p.map(g=>{if(g.id===h){const x=typeof d=="function"?d(g):d;return f.replace&&Sc(x)?x:{...g,...x}}return g}))},u=(h,d,f={replace:!1})=>{a(p=>p.map(g=>{if(g.id===h){const x=typeof d=="function"?d(g):d;return f.replace&&ey(x)?x:{...g,...x}}return g}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>i(h)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(d=>({...d}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:s,setEdges:a,addNodes:h=>{const d=Array.isArray(h)?h:[h];n.nodeQueue.push(f=>[...f,...d])},addEdges:h=>{const d=Array.isArray(h)?h:[h];n.edgeQueue.push(f=>[...f,...d])},toObject:()=>{const{nodes:h=[],edges:d=[],transform:f}=t.getState(),[p,g,x]=f;return{nodes:h.map(b=>({...b})),edges:d.map(b=>({...b})),viewport:{x:p,y:g,zoom:x}}},deleteElements:async({nodes:h=[],edges:d=[]})=>{const{nodes:f,edges:p,onNodesDelete:g,onEdgesDelete:x,triggerNodeChanges:b,triggerEdgeChanges:v,onDelete:m,onBeforeDelete:w}=t.getState(),{nodes:k,edges:N}=await Mg({nodesToRemove:h,edgesToRemove:d,nodes:f,edges:p,onBeforeDelete:w}),I=N.length>0,M=k.length>0;if(I){const L=N.map(_c);x?.(N),v(L)}if(M){const L=k.map(_c);g?.(k),b(L)}return(M||I)&&m?.({nodes:k,edges:N}),{deletedNodes:k,deletedEdges:N}},getIntersectingNodes:(h,d=!0,f)=>{const p=Ea(h),g=p?h:c(h),x=f!==void 0;return g?(f||t.getState().nodes).filter(b=>{const v=t.getState().nodeLookup.get(b.id);if(v&&!p&&(b.id===h.id||!v.internals.positionAbsolute))return!1;const m=Pt(x?b:v),w=fn(m,g);return d&&w>0||w>=m.width*m.height||w>=g.width*g.height}):[]},isNodeIntersecting:(h,d,f=!0)=>{const g=Ea(h)?h:c(h);if(!g)return!1;const x=fn(g,d);return f&&x>0||x>=g.width*g.height},updateNode:l,updateNodeData:(h,d,f={replace:!1})=>{l(h,p=>{const g=typeof d=="function"?d(p):d;return f.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},f)},updateEdge:u,updateEdgeData:(h,d,f={replace:!1})=>{u(h,p=>{const g=typeof d=="function"?d(p):d;return f.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},f)},getNodesBounds:h=>{const{nodeLookup:d,nodeOrigin:f}=t.getState();return Ng(h,{nodeLookup:d,nodeOrigin:f})},getHandleConnections:({type:h,id:d,nodeId:f})=>Array.from(t.getState().connectionLookup.get(`${f}-${h}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:h,handleId:d,nodeId:f})=>Array.from(t.getState().connectionLookup.get(`${f}${h?d?`-${h}-${d}`:`-${h}`:""}`)?.values()??[]),fitView:async h=>{const d=t.getState().fitViewResolver??Pg();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:d}),n.nodeQueue.push(f=>[...f]),d.promise}}},[]);return O.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Tc=e=>e.selected,sy=typeof window<"u"?window:void 0;function ay({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ce(),{deleteElements:o}=bn(),r=xn(e,{actInsideInputWithModifier:!1}),i=xn(t,{target:sy});O.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(Tc),edges:s.filter(Tc)}),n.setState({nodesSelectionActive:!1})}},[r]),O.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function cy(e){const t=ce();O.useEffect(()=>{const n=()=>{if(!e.current)return!1;const o=Vr(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",xe.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 Co={position:"absolute",width:"100%",height:"100%",top:0,left:0},ly=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function uy({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=ut.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:h,zoomActivationKeyCode:d,preventScrolling:f=!0,children:p,noWheelClassName:g,noPanClassName:x,onViewportChange:b,isControlledViewport:v,paneClickDistance:m}){const w=ce(),k=O.useRef(null),{userSelectionActive:N,lib:I}=ie(ly,de),M=xn(d),L=O.useRef();cy(k);const H=O.useCallback(j=>{b?.({x:j[0],y:j[1],zoom:j[2]}),v||w.setState({transform:j})},[b,v]);return O.useEffect(()=>{if(k.current){L.current=pm({domNode:k.current,minZoom:u,maxZoom:h,translateExtent:l,viewport:c,paneClickDistance:m,onDraggingChange:y=>w.setState({paneDragging:y}),onPanZoomStart:(y,A)=>{const{onViewportChangeStart:T,onMoveStart:S}=w.getState();S?.(y,A),T?.(A)},onPanZoom:(y,A)=>{const{onViewportChange:T,onMove:S}=w.getState();S?.(y,A),T?.(A)},onPanZoomEnd:(y,A)=>{const{onViewportChangeEnd:T,onMoveEnd:S}=w.getState();S?.(y,A),T?.(A)}});const{x:j,y:R,zoom:$}=L.current.getViewport();return w.setState({panZoom:L.current,transform:[j,R,$],domNode:k.current.closest(".react-flow")}),()=>{L.current?.destroy()}}},[]),O.useEffect(()=>{L.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:M,preventScrolling:f,noPanClassName:x,userSelectionActive:N,noWheelClassName:g,lib:I,onTransformChange:H})},[e,t,n,o,r,i,s,a,M,f,x,N,g,I,H]),C.jsx("div",{className:"react-flow__renderer",ref:k,style:Co,children:p})}const dy=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fy(){const{userSelectionActive:e,userSelectionRect:t}=ie(dy,de);return e&&t?C.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 oi=(e,t)=>n=>{n.target===t.current&&e?.(n)},hy=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function py({isSelecting:e,selectionKeyPressed:t,selectionMode:n=At.Full,panOnDrag:o,selectionOnDrag:r,onSelectionStart:i,onSelectionEnd:s,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:l,onPaneMouseEnter:u,onPaneMouseMove:h,onPaneMouseLeave:d,children:f}){const p=ce(),{userSelectionActive:g,elementsSelectable:x,dragging:b,connectionInProgress:v}=ie(hy,de),m=x&&(e||g),w=O.useRef(null),k=O.useRef(),N=O.useRef(new Set),I=O.useRef(new Set),M=O.useRef(!1),L=O.useRef(!1),H=S=>{if(M.current||v){M.current=!1;return}a?.(S),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},j=S=>{if(Array.isArray(o)&&o?.includes(2)){S.preventDefault();return}c?.(S)},R=l?S=>l(S):void 0,$=S=>{const{resetSelectedElements:E,domNode:P}=p.getState();if(k.current=P?.getBoundingClientRect(),!x||!e||S.button!==0||S.target!==w.current||!k.current)return;S.target?.setPointerCapture?.(S.pointerId),L.current=!0,M.current=!1;const{x:_,y:D}=$e(S.nativeEvent,k.current);E(),p.setState({userSelectionRect:{width:0,height:0,startX:_,startY:D,x:_,y:D}}),i?.(S)},y=S=>{const{userSelectionRect:E,transform:P,nodeLookup:_,edgeLookup:D,connectionLookup:z,triggerNodeChanges:F,triggerEdgeChanges:B,defaultEdgeOptions:Y}=p.getState();if(!k.current||!E)return;M.current=!0;const{x:K,y:W}=$e(S.nativeEvent,k.current),{startX:V,startY:X}=E,J={startX:V,startY:X,x:K<V?K:V,y:W<X?W:X,width:Math.abs(K-V),height:Math.abs(W-X)},te=N.current,Z=I.current;N.current=new Set($r(_,J,P,n===At.Partial,!0).map(ne=>ne.id)),I.current=new Set;const oe=Y?.selectable??!0;for(const ne of N.current){const ue=z.get(ne);if(ue)for(const{edgeId:ge}of ue.values()){const Pe=D.get(ge);Pe&&(Pe.selectable??oe)&&I.current.add(ge)}}if(!Na(te,N.current)){const ne=Lt(_,N.current,!0);F(ne)}if(!Na(Z,I.current)){const ne=Lt(D,I.current);B(ne)}p.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},A=S=>{if(S.button!==0||!L.current)return;S.target?.releasePointerCapture?.(S.pointerId);const{userSelectionRect:E}=p.getState();!g&&E&&S.target===w.current&&H?.(S),p.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:N.current.size>0}),s?.(S),(t||r)&&(M.current=!1),L.current=!1},T=o===!0||Array.isArray(o)&&o.includes(0);return C.jsxs("div",{className:fe(["react-flow__pane",{draggable:T,dragging:b,selection:e}]),onClick:m?void 0:oi(H,w),onContextMenu:oi(j,w),onWheel:oi(R,w),onPointerEnter:m?void 0:u,onPointerDown:m?$:h,onPointerMove:m?y:h,onPointerUp:m?A:void 0,onPointerLeave:d,ref:w,style:Co,children:[f,C.jsx(fy,{})]})}function ri({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c?.("012",xe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Mc({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ce(),[c,l]=O.useState(!1),u=O.useRef();return O.useEffect(()=>{u.current=Jg({getStoreItems:()=>a.getState(),onNodeMouseDown:h=>{ri({id:h,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),O.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{u.current?.destroy()}},[n,o,t,i,e,r]),c}const gy=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ac(){const e=ce();return O.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:u}=e.getState(),h=new Map,d=gy(s),f=r?i[0]:5,p=r?i[1]:5,g=n.direction.x*f*n.factor,x=n.direction.y*p*n.factor;for(const[,b]of l){if(!d(b))continue;let v={x:b.internals.positionAbsolute.x+g,y:b.internals.positionAbsolute.y+x};r&&(v=hn(v,i));const{position:m,positionAbsolute:w}=ya({nodeId:b.id,nextPosition:v,nodeLookup:l,nodeExtent:o,nodeOrigin:u,onError:a});b.position=m,b.internals.positionAbsolute=w,h.set(b.id,b)}c(h)},[])}const ii=O.createContext(null),my=ii.Provider;ii.Consumer;const No=()=>O.useContext(ii),yy=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),xy=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:c,isValid:l}=s,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===Mt.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&l}};function wy({type:e="source",position:t=Q.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:l,onMouseDown:u,onTouchStart:h,...d},f){const p=s||null,g=e==="target",x=ce(),b=No(),{connectOnClick:v,noPanClassName:m,rfId:w}=ie(yy,de),{connectingFrom:k,connectingTo:N,clickConnecting:I,isPossibleEndHandle:M,connectionInProcess:L,clickConnectionInProcess:H,valid:j}=ie(xy(b,p,e),de);b||x.getState().onError?.("010",xe.error010());const R=A=>{const{defaultEdgeOptions:T,onConnect:S,hasDefaultEdges:E}=x.getState(),P={...T,...A};if(E){const{edges:_,setEdges:D}=x.getState();D(yo(P,_))}S?.(P),a?.(P)},$=A=>{if(!b)return;const T=Ma(A.nativeEvent);if(r&&(T&&A.button===0||!T)){const S=x.getState();Zr.onPointerDown(A.nativeEvent,{handleDomNode:A.currentTarget,autoPanOnConnect:S.autoPanOnConnect,connectionMode:S.connectionMode,connectionRadius:S.connectionRadius,domNode:S.domNode,nodeLookup:S.nodeLookup,lib:S.lib,isTarget:g,handleId:p,nodeId:b,flowId:S.rfId,panBy:S.panBy,cancelConnection:S.cancelConnection,onConnectStart:S.onConnectStart,onConnectEnd:S.onConnectEnd,updateConnection:S.updateConnection,onConnect:R,isValidConnection:n||S.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:S.autoPanSpeed,dragThreshold:S.connectionDragThreshold})}T?u?.(A):h?.(A)},y=A=>{const{onClickConnectStart:T,onClickConnectEnd:S,connectionClickStartHandle:E,connectionMode:P,isValidConnection:_,lib:D,rfId:z,nodeLookup:F,connection:B}=x.getState();if(!b||!E&&!r)return;if(!E){T?.(A.nativeEvent,{nodeId:b,handleId:p,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:b,type:e,id:p}});return}const Y=ka(A.target),K=n||_,{connection:W,isValid:V}=Zr.isValid(A.nativeEvent,{handle:{nodeId:b,id:p,type:e},connectionMode:P,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:K,flowId:z,doc:Y,lib:D,nodeLookup:F});V&&W&&R(W);const X=structuredClone(B);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,S?.(A,X),x.setState({connectionClickStartHandle:null})};return C.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${w}-${b}-${p}-${e}`,className:fe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,l,{source:!g,target:g,connectable:o,connectablestart:r,connectableend:i,clickconnecting:I,connectingfrom:k,connectingto:N,valid:j,connectionindicator:o&&(!L||M)&&(L||H?i:r)}]),onMouseDown:$,onTouchStart:$,onClick:v?y:void 0,ref:f,...d,children:c})}const vn=O.memo(Cc(wy));function by({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return C.jsxs(C.Fragment,{children:[e?.label,C.jsx(vn,{type:"source",position:n,isConnectable:t})]})}function vy({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:o=Q.Bottom}){return C.jsxs(C.Fragment,{children:[C.jsx(vn,{type:"target",position:n,isConnectable:t}),e?.label,C.jsx(vn,{type:"source",position:o,isConnectable:t})]})}function Ey(){return null}function _y({data:e,isConnectable:t,targetPosition:n=Q.Top}){return C.jsxs(C.Fragment,{children:[C.jsx(vn,{type:"target",position:n,isConnectable:t}),e?.label]})}const ko={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ic={input:by,default:vy,output:_y,group:Ey};function Sy(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 Cy=e=>{const{width:t,height:n,x:o,y:r}=dn(e.nodeLookup,{filter:i=>!!i.selected});return{width:Me(t)?t:null,height:Me(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Ny({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ce(),{width:r,height:i,transformString:s,userSelectionActive:a}=ie(Cy,de),c=Ac(),l=O.useRef(null);if(O.useEffect(()=>{n||l.current?.focus({preventScroll:!0})},[n]),Mc({nodeRef:l}),a||!r||!i)return null;const u=e?d=>{const f=o.getState().nodes.filter(p=>p.selected);e(d,f)}:void 0,h=d=>{Object.prototype.hasOwnProperty.call(ko,d.key)&&(d.preventDefault(),c({direction:ko[d.key],factor:d.shiftKey?4:1}))};return C.jsx("div",{className:fe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:C.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:i}})})}const Pc=typeof window<"u"?window:void 0,ky=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Oc({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:h,onSelectionStart:d,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:x,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:m,panOnScroll:w,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:M,defaultViewport:L,translateExtent:H,minZoom:j,maxZoom:R,preventScrolling:$,onSelectionContextMenu:y,noWheelClassName:A,noPanClassName:T,disableKeyboardA11y:S,onViewportChange:E,isControlledViewport:P}){const{nodesSelectionActive:_,userSelectionActive:D}=ie(ky),z=xn(l,{target:Pc}),F=xn(g,{target:Pc}),B=F||M,Y=F||w,K=u&&B!==!0,W=z||D||K;return ay({deleteKeyCode:c,multiSelectionKeyCode:p}),C.jsx(uy,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:m,panOnScroll:Y,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:I,panOnDrag:!z&&B,defaultViewport:L,translateExtent:H,minZoom:j,maxZoom:R,zoomActivationKeyCode:x,preventScrolling:$,noWheelClassName:A,noPanClassName:T,onViewportChange:E,isControlledViewport:P,paneClickDistance:a,children:C.jsxs(py,{onSelectionStart:d,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:B,isSelecting:!!W,selectionMode:h,selectionKeyPressed:z,selectionOnDrag:K,children:[e,_&&C.jsx(Ny,{onSelectionContextMenu:y,noPanClassName:T,disableKeyboardA11y:S})]})})}Oc.displayName="FlowRenderer";const Ty=O.memo(Oc),My=e=>t=>e?$r(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 Ay(e){return ie(O.useCallback(My(e),[e]),de)}const Iy=e=>e.updateNodeInternals;function Py(){const e=ie(Iy),[t]=O.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 O.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Oy({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ce(),i=O.useRef(null),s=O.useRef(null),a=O.useRef(e.sourcePosition),c=O.useRef(e.targetPosition),l=O.useRef(t),u=n&&!!e.internals.handleBounds;return O.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),O.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),O.useEffect(()=>{if(i.current){const h=l.current!==t,d=a.current!==e.sourcePosition,f=c.current!==e.targetPosition;(h||d||f)&&(l.current=t,a.current=e.sourcePosition,c.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 Dy({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:h,noDragClassName:d,noPanClassName:f,disableKeyboardA11y:p,rfId:g,nodeTypes:x,nodeClickDistance:b,onError:v}){const{node:m,internals:w,isParent:k}=ie(V=>{const X=V.nodeLookup.get(e),J=V.parentLookup.has(e);return{node:X,internals:X.internals,isParent:J}},de);let N=m.type||"default",I=x?.[N]||Ic[N];I===void 0&&(v?.("003",xe.error003(N)),N="default",I=x?.default||Ic.default);const M=!!(m.draggable||a&&typeof m.draggable>"u"),L=!!(m.selectable||c&&typeof m.selectable>"u"),H=!!(m.connectable||l&&typeof m.connectable>"u"),j=!!(m.focusable||u&&typeof m.focusable>"u"),R=ce(),$=Sa(m),y=Oy({node:m,nodeType:N,hasDimensions:$,resizeObserver:h}),A=Mc({nodeRef:y,disabled:m.hidden||!M,noDragClassName:d,handleSelector:m.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:b}),T=Ac();if(m.hidden)return null;const S=Xe(m),E=Sy(m),P=L||M||t||n||o||r,_=n?V=>n(V,{...w.userNode}):void 0,D=o?V=>o(V,{...w.userNode}):void 0,z=r?V=>r(V,{...w.userNode}):void 0,F=i?V=>i(V,{...w.userNode}):void 0,B=s?V=>s(V,{...w.userNode}):void 0,Y=V=>{const{selectNodesOnDrag:X,nodeDragThreshold:J}=R.getState();L&&(!X||!M||J>0)&&ri({id:e,store:R,nodeRef:y}),t&&t(V,{...w.userNode})},K=V=>{if(!(Ta(V.nativeEvent)||p)){if(ua.includes(V.key)&&L){const X=V.key==="Escape";ri({id:e,store:R,unselect:X,nodeRef:y})}else if(M&&m.selected&&Object.prototype.hasOwnProperty.call(ko,V.key)){V.preventDefault();const{ariaLabelConfig:X}=R.getState();R.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),T({direction:ko[V.key],factor:V.shiftKey?4:1})}}},W=()=>{if(p||!y.current?.matches(":focus-visible"))return;const{transform:V,width:X,height:J,autoPanOnNodeFocus:te,setCenter:Z}=R.getState();if(!te)return;$r(new Map([[e,m]]),{x:0,y:0,width:X,height:J},V,!0).length>0||Z(m.position.x+S.width/2,m.position.y+S.height/2,{zoom:V[2]})};return C.jsx("div",{className:fe(["react-flow__node",`react-flow__node-${N}`,{[f]:M},m.className,{selected:m.selected,selectable:L,parent:k,draggable:M,dragging:A}]),ref:y,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:$?"visible":"hidden",...m.style,...E},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:D,onMouseLeave:z,onContextMenu:F,onClick:Y,onDoubleClick:B,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:`${dc}-${g}`,"aria-label":m.ariaLabel,...m.domAttributes,children:C.jsx(my,{value:e,children:C.jsx(I,{id:e,data:m.data,type:N,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:m.selected??!1,selectable:L,draggable:M,deletable:m.deletable??!0,isConnectable:H,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:A,dragHandle:m.dragHandle,zIndex:w.z,parentId:m.parentId,...S})})})}const Ry=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Dc(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=ie(Ry,de),s=Ay(e.onlyRenderVisibleElements),a=Py();return C.jsx("div",{className:"react-flow__nodes",style:Co,children:s.map(c=>C.jsx(Dy,{id:c,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},c))})}Dc.displayName="NodeRenderer";const Ly=O.memo(Dc);function $y(e){return ie(O.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&&Lg({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),de)}const zy=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return C.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Hy=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return C.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Rc={[lo.Arrow]:zy,[lo.ArrowClosed]:Hy};function jy(e){const t=ce();return O.useMemo(()=>Object.prototype.hasOwnProperty.call(Rc,e)?Rc[e]:(t.getState().onError?.("009",xe.error009(e)),null),[e])}const Vy=({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 c=jy(t);return c?C.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:C.jsx(c,{color:n,strokeWidth:s})}):null},Lc=({defaultColor:e,rfId:t})=>{const n=ie(i=>i.edges),o=ie(i=>i.defaultEdgeOptions),r=O.useMemo(()=>Bg(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?C.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:C.jsx("defs",{children:r.map(i=>C.jsx(Vy,{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};Lc.displayName="MarkerDefinitions";var Fy=O.memo(Lc);function $c({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...u}){const[h,d]=O.useState({x:1,y:0,width:0,height:0}),f=fe(["react-flow__edge-textwrapper",l]),p=O.useRef(null);return O.useEffect(()=>{if(p.current){const g=p.current.getBBox();d({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?C.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:f,visibility:h.width?"visible":"hidden",...u,children:[r&&C.jsx("rect",{width:h.width+2*s[0],x:-s[0],y:-s[1],height:h.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),C.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:p,style:o,children:n}),c]}):null}$c.displayName="EdgeText";const By=O.memo($c);function $t({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return C.jsxs(C.Fragment,{children:[C.jsx("path",{...u,d:e,fill:"none",className:fe(["react-flow__edge-path",u.className])}),l?C.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,o&&Me(t)&&Me(n)?C.jsx(By,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function zc({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 Hc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:o,targetY:r,targetPosition:i=Q.Top}){const[s,a]=zc({pos:n,x1:e,y1:t,x2:o,y2:r}),[c,l]=zc({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,h,d,f]=Ia({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${s},${a} ${c},${l} ${o},${r}`,u,h,d,f]}function jc(e){return O.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,interactionWidth:b})=>{const[v,m,w]=Hc({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),k=e.isInternal?void 0:t;return C.jsx($t,{id:k,path:v,labelX:m,labelY:w,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,interactionWidth:b})})}const Wy=jc({isInternal:!1}),Vc=jc({isInternal:!0});Wy.displayName="SimpleBezierEdge",Vc.displayName="SimpleBezierEdgeInternal";function Fc(e){return O.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:h,style:d,sourcePosition:f=Q.Bottom,targetPosition:p=Q.Top,markerEnd:g,markerStart:x,pathOptions:b,interactionWidth:v})=>{const[m,w,k]=Fr({sourceX:n,sourceY:o,sourcePosition:f,targetX:r,targetY:i,targetPosition:p,borderRadius:b?.borderRadius,offset:b?.offset,stepPosition:b?.stepPosition}),N=e.isInternal?void 0:t;return C.jsx($t,{id:N,path:m,labelX:w,labelY:k,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:g,markerStart:x,interactionWidth:v})})}const Bc=Fc({isInternal:!1}),Wc=Fc({isInternal:!0});Bc.displayName="SmoothStepEdge",Wc.displayName="SmoothStepEdgeInternal";function Yc(e){return O.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return C.jsx(Bc,{...n,id:o,pathOptions:O.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Yy=Yc({isInternal:!1}),Xc=Yc({isInternal:!0});Yy.displayName="StepEdge",Xc.displayName="StepEdgeInternal";function Uc(e){return O.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[x,b,v]=Da({sourceX:n,sourceY:o,targetX:r,targetY:i}),m=e.isInternal?void 0:t;return C.jsx($t,{id:m,path:x,labelX:b,labelY:v,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:f,markerStart:p,interactionWidth:g})})}const Xy=Uc({isInternal:!1}),Gc=Uc({isInternal:!0});Xy.displayName="StraightEdge",Gc.displayName="StraightEdgeInternal";function qc(e){return O.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Q.Bottom,targetPosition:a=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,pathOptions:b,interactionWidth:v})=>{const[m,w,k]=mo({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:b?.curvature}),N=e.isInternal?void 0:t;return C.jsx($t,{id:N,path:m,labelX:w,labelY:k,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,interactionWidth:v})})}const Uy=qc({isInternal:!1}),Zc=qc({isInternal:!0});Uy.displayName="BezierEdge",Zc.displayName="BezierEdgeInternal";const Kc={default:Zc,straight:Gc,step:Xc,smoothstep:Wc,simplebezier:Vc},Qc={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Gy=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,qy=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Jc="react-flow__edgeupdater";function el({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return C.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:fe([Jc,`${Jc}-${a}`]),cx:Gy(t,o,e),cy:qy(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Zy({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:h,setReconnecting:d,setUpdateHover:f}){const p=ce(),g=(w,k)=>{if(w.button!==0)return;const{autoPanOnConnect:N,domNode:I,isValidConnection:M,connectionMode:L,connectionRadius:H,lib:j,onConnectStart:R,onConnectEnd:$,cancelConnection:y,nodeLookup:A,rfId:T,panBy:S,updateConnection:E}=p.getState(),P=k.type==="target",_=(F,B)=>{d(!1),h?.(F,n,k.type,B)},D=F=>l?.(n,F),z=(F,B)=>{d(!0),u?.(w,n,k.type),R?.(F,B)};Zr.onPointerDown(w.nativeEvent,{autoPanOnConnect:N,connectionMode:L,connectionRadius:H,domNode:I,handleId:k.id,nodeId:k.nodeId,nodeLookup:A,isTarget:P,edgeUpdaterType:k.type,lib:j,flowId:T,cancelConnection:y,panBy:S,isValidConnection:M,onConnect:D,onConnectStart:z,onConnectEnd:$,onReconnectEnd:_,updateConnection:E,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},x=w=>g(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),b=w=>g(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>f(!0),m=()=>f(!1);return C.jsxs(C.Fragment,{children:[(e===!0||e==="source")&&C.jsx(el,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:x,onMouseEnter:v,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&C.jsx(el,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:b,onMouseEnter:v,onMouseOut:m,type:"target"})]})}function Ky({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:h,onReconnectStart:d,onReconnectEnd:f,rfId:p,edgeTypes:g,noPanClassName:x,onError:b,disableKeyboardA11y:v}){let m=ie(Z=>Z.edgeLookup.get(e));const w=ie(Z=>Z.defaultEdgeOptions);m=w?{...w,...m}:m;let k=m.type||"default",N=g?.[k]||Kc[k];N===void 0&&(b?.("011",xe.error011(k)),k="default",N=g?.default||Kc.default);const I=!!(m.focusable||t&&typeof m.focusable>"u"),M=typeof h<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),L=!!(m.selectable||o&&typeof m.selectable>"u"),H=O.useRef(null),[j,R]=O.useState(!1),[$,y]=O.useState(!1),A=ce(),{zIndex:T,sourceX:S,sourceY:E,targetX:P,targetY:_,sourcePosition:D,targetPosition:z}=ie(O.useCallback(Z=>{const oe=Z.nodeLookup.get(m.source),ne=Z.nodeLookup.get(m.target);if(!oe||!ne)return{zIndex:m.zIndex,...Qc};const ue=Fg({id:e,sourceNode:oe,targetNode:ne,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:Z.connectionMode,onError:b});return{zIndex:Rg({selected:m.selected,zIndex:m.zIndex,sourceNode:oe,targetNode:ne,elevateOnSelect:Z.elevateEdgesOnSelect}),...ue||Qc}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),de),F=O.useMemo(()=>m.markerStart?`url('#${Br(m.markerStart,p)}')`:void 0,[m.markerStart,p]),B=O.useMemo(()=>m.markerEnd?`url('#${Br(m.markerEnd,p)}')`:void 0,[m.markerEnd,p]);if(m.hidden||S===null||E===null||P===null||_===null)return null;const Y=Z=>{const{addSelectedEdges:oe,unselectNodesAndEdges:ne,multiSelectionActive:ue}=A.getState();L&&(A.setState({nodesSelectionActive:!1}),m.selected&&ue?(ne({nodes:[],edges:[m]}),H.current?.blur()):oe([e])),r&&r(Z,m)},K=i?Z=>{i(Z,{...m})}:void 0,W=s?Z=>{s(Z,{...m})}:void 0,V=a?Z=>{a(Z,{...m})}:void 0,X=c?Z=>{c(Z,{...m})}:void 0,J=l?Z=>{l(Z,{...m})}:void 0,te=Z=>{if(!v&&ua.includes(Z.key)&&L){const{unselectNodesAndEdges:oe,addSelectedEdges:ne}=A.getState();Z.key==="Escape"?(H.current?.blur(),oe({edges:[m]})):ne([e])}};return C.jsx("svg",{style:{zIndex:T},children:C.jsxs("g",{className:fe(["react-flow__edge",`react-flow__edge-${k}`,m.className,x,{selected:m.selected,animated:m.animated,inactive:!L&&!r,updating:j,selectable:L}]),onClick:Y,onDoubleClick:K,onContextMenu:W,onMouseEnter:V,onMouseMove:X,onMouseLeave:J,onKeyDown:I?te:void 0,tabIndex:I?0:void 0,role:m.ariaRole??(I?"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":I?`${fc}-${p}`:void 0,ref:H,...m.domAttributes,children:[!$&&C.jsx(N,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:L,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:S,sourceY:E,targetX:P,targetY:_,sourcePosition:D,targetPosition:z,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),M&&C.jsx(Zy,{edge:m,isReconnectable:M,reconnectRadius:u,onReconnect:h,onReconnectStart:d,onReconnectEnd:f,sourceX:S,sourceY:E,targetX:P,targetY:_,sourcePosition:D,targetPosition:z,setUpdateHover:R,setReconnecting:y})]})})}const Qy=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function tl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:h,onEdgeDoubleClick:d,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:g}){const{edgesFocusable:x,edgesReconnectable:b,elementsSelectable:v,onError:m}=ie(Qy,de),w=$y(t);return C.jsxs("div",{className:"react-flow__edges",children:[C.jsx(Fy,{defaultColor:e,rfId:n}),w.map(k=>C.jsx(Ky,{id:k,edgesFocusable:x,edgesReconnectable:b,elementsSelectable:v,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:h,onDoubleClick:d,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:m,edgeTypes:o,disableKeyboardA11y:g},k))]})}tl.displayName="EdgeRenderer";const Jy=O.memo(tl),e0=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function t0({children:e}){const t=ie(e0);return C.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function n0(e){const t=bn(),n=O.useRef(!1);O.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const o0=e=>e.panZoom?.syncViewport;function r0(e){const t=ie(o0),n=ce();return O.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function i0(e){return e.connection.inProgress?{...e.connection,to:pn(e.connection.to,e.transform)}:{...e.connection}}function s0(e){return i0}function nl(e){const t=s0();return ie(t,de)}const a0=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function c0({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:c}=ie(a0,de);return!(i&&r&&c)?null:C.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:C.jsx("g",{className:fe(["react-flow__connection",ga(a)]),children:C.jsx(ol,{style:t,type:n,CustomComponent:o,isValid:a})})})}const ol=({style:e,type:t=Ze.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:l,toNode:u,toHandle:h,toPosition:d}=nl();if(!r)return;if(n)return C.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:d,connectionStatus:ga(o),toNode:u,toHandle:h});let f="";const p={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:d};switch(t){case Ze.Bezier:[f]=mo(p);break;case Ze.SimpleBezier:[f]=Hc(p);break;case Ze.Step:[f]=Fr({...p,borderRadius:0});break;case Ze.SmoothStep:[f]=Fr(p);break;default:[f]=Da(p)}return C.jsx("path",{d:f,fill:"none",className:"react-flow__connection-path",style:e})};ol.displayName="ConnectionLine";const l0={};function rl(e=l0){const t=O.useRef(e),n=ce();O.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",xe.error002());break}t.current=e}},[e])}function u0(){const e=ce(),t=O.useRef(!1);O.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",xe.error013("react")),t.current=!0}},[])}function il({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:h,onSelectionStart:d,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:x,connectionLineContainerStyle:b,selectionKeyCode:v,selectionOnDrag:m,selectionMode:w,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:I,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:H,defaultViewport:j,translateExtent:R,minZoom:$,maxZoom:y,preventScrolling:A,defaultMarkerColor:T,zoomOnScroll:S,zoomOnPinch:E,panOnScroll:P,panOnScrollSpeed:_,panOnScrollMode:D,zoomOnDoubleClick:z,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:Y,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneScroll:V,onPaneContextMenu:X,paneClickDistance:J,nodeClickDistance:te,onEdgeContextMenu:Z,onEdgeMouseEnter:oe,onEdgeMouseMove:ne,onEdgeMouseLeave:ue,reconnectRadius:ge,onReconnect:Pe,onReconnectStart:Bt,onReconnectEnd:qo,noDragClassName:Zo,noWheelClassName:Ko,noPanClassName:Tn,disableKeyboardA11y:Mn,nodeExtent:Ii,rfId:Qo,viewport:Wt,onViewportChange:An}){return rl(e),rl(t),u0(),n0(n),r0(Wt),C.jsx(Ty,{onPaneClick:B,onPaneMouseEnter:Y,onPaneMouseMove:K,onPaneMouseLeave:W,onPaneContextMenu:X,onPaneScroll:V,paneClickDistance:J,deleteKeyCode:M,selectionKeyCode:v,selectionOnDrag:m,selectionMode:w,onSelectionStart:d,onSelectionEnd:f,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:I,elementsSelectable:H,zoomOnScroll:S,zoomOnPinch:E,zoomOnDoubleClick:z,panOnScroll:P,panOnScrollSpeed:_,panOnScrollMode:D,panOnDrag:F,defaultViewport:j,translateExtent:R,minZoom:$,maxZoom:y,onSelectionContextMenu:h,preventScrolling:A,noDragClassName:Zo,noWheelClassName:Ko,noPanClassName:Tn,disableKeyboardA11y:Mn,onViewportChange:An,isControlledViewport:!!Wt,children:C.jsxs(t0,{children:[C.jsx(Jy,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:Pe,onReconnectStart:Bt,onReconnectEnd:qo,onlyRenderVisibleElements:L,onEdgeContextMenu:Z,onEdgeMouseEnter:oe,onEdgeMouseMove:ne,onEdgeMouseLeave:ue,reconnectRadius:ge,defaultMarkerColor:T,noPanClassName:Tn,disableKeyboardA11y:Mn,rfId:Qo}),C.jsx(c0,{style:g,type:p,component:x,containerStyle:b}),C.jsx("div",{className:"react-flow__edgelabel-renderer"}),C.jsx(Ly,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:te,onlyRenderVisibleElements:L,noPanClassName:Tn,noDragClassName:Zo,disableKeyboardA11y:Mn,nodeExtent:Ii,rfId:Qo}),C.jsx("div",{className:"react-flow__viewport-portal"})]})})}il.displayName="GraphView";const d0=O.memo(il),sl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:h}={})=>{const d=new Map,f=new Map,p=new Map,g=new Map,x=o??t??[],b=n??e??[],v=u??[0,0],m=h??ln;Fa(p,g,x);const w=Xr(b,d,f,{nodeOrigin:v,nodeExtent:m,elevateNodesOnSelect:!1});let k=[0,0,1];if(s&&r&&i){const N=dn(d,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:I,y:M,zoom:L}=jr(N,r,i,c,l,a?.padding??.1);k=[I,M,L]}return{rfId:"1",width:0,height:0,transform:k,nodes:b,nodesInitialized:w,nodeLookup:d,parentLookup:f,edges:x,edgeLookup:g,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:ln,nodeExtent:m,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Mt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,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:{...fa},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:_a,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:da}},f0=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:h})=>Dm((d,f)=>{async function p(){const{nodeLookup:g,panZoom:x,fitViewOptions:b,fitViewResolver:v,width:m,height:w,minZoom:k,maxZoom:N}=f();x&&(await Tg({nodes:g,width:m,height:w,panZoom:x,minZoom:k,maxZoom:N},b),v?.resolve(!0),d({fitViewResolver:null}))}return{...sl({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:h,defaultNodes:n,defaultEdges:o}),setNodes:g=>{const{nodeLookup:x,parentLookup:b,nodeOrigin:v,elevateNodesOnSelect:m,fitViewQueued:w}=f(),k=Xr(g,x,b,{nodeOrigin:v,nodeExtent:h,elevateNodesOnSelect:m,checkEquality:!0});w&&k?(p(),d({nodes:g,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0})):d({nodes:g,nodesInitialized:k})},setEdges:g=>{const{connectionLookup:x,edgeLookup:b}=f();Fa(x,b,g),d({edges:g})},setDefaultNodesAndEdges:(g,x)=>{if(g){const{setNodes:b}=f();b(g),d({hasDefaultNodes:!0})}if(x){const{setEdges:b}=f();b(x),d({hasDefaultEdges:!0})}},updateNodeInternals:g=>{const{triggerNodeChanges:x,nodeLookup:b,parentLookup:v,domNode:m,nodeOrigin:w,nodeExtent:k,debug:N,fitViewQueued:I}=f(),{changes:M,updatedInternals:L}=Gg(g,b,v,m,w,k);L&&(Yg(b,v,{nodeOrigin:w,nodeExtent:k}),I?(p(),d({fitViewQueued:!1,fitViewOptions:void 0})):d({}),M?.length>0&&(N&&console.log("React Flow: trigger node changes",M),x?.(M)))},updateNodePositions:(g,x=!1)=>{const b=[],v=[],{nodeLookup:m,triggerNodeChanges:w}=f();for(const[k,N]of g){const I=m.get(k),M=!!(I?.expandParent&&I?.parentId&&N?.position),L={id:k,type:"position",position:M?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:x};M&&I.parentId&&b.push({id:k,parentId:I.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width??0,height:N.measured.height??0}}),v.push(L)}if(b.length>0){const{parentLookup:k,nodeOrigin:N}=f(),I=Gr(b,m,k,N);v.push(...I)}w(v)},triggerNodeChanges:g=>{const{onNodesChange:x,setNodes:b,nodes:v,hasDefaultNodes:m,debug:w}=f();if(g?.length){if(m){const k=vc(g,v);b(k)}w&&console.log("React Flow: trigger node changes",g),x?.(g)}},triggerEdgeChanges:g=>{const{onEdgesChange:x,setEdges:b,edges:v,hasDefaultEdges:m,debug:w}=f();if(g?.length){if(m){const k=wn(g,v);b(k)}w&&console.log("React Flow: trigger edge changes",g),x?.(g)}},addSelectedNodes:g=>{const{multiSelectionActive:x,edgeLookup:b,nodeLookup:v,triggerNodeChanges:m,triggerEdgeChanges:w}=f();if(x){const k=g.map(N=>ht(N,!0));m(k);return}m(Lt(v,new Set([...g]),!0)),w(Lt(b))},addSelectedEdges:g=>{const{multiSelectionActive:x,edgeLookup:b,nodeLookup:v,triggerNodeChanges:m,triggerEdgeChanges:w}=f();if(x){const k=g.map(N=>ht(N,!0));w(k);return}w(Lt(b,new Set([...g]))),m(Lt(v,new Set,!0))},unselectNodesAndEdges:({nodes:g,edges:x}={})=>{const{edges:b,nodes:v,nodeLookup:m,triggerNodeChanges:w,triggerEdgeChanges:k}=f(),N=g||v,I=x||b,M=N.map(H=>{const j=m.get(H.id);return j&&(j.selected=!1),ht(H.id,!1)}),L=I.map(H=>ht(H.id,!1));w(M),k(L)},setMinZoom:g=>{const{panZoom:x,maxZoom:b}=f();x?.setScaleExtent([g,b]),d({minZoom:g})},setMaxZoom:g=>{const{panZoom:x,minZoom:b}=f();x?.setScaleExtent([b,g]),d({maxZoom:g})},setTranslateExtent:g=>{f().panZoom?.setTranslateExtent(g),d({translateExtent:g})},setPaneClickDistance:g=>{f().panZoom?.setClickDistance(g)},resetSelectedElements:()=>{const{edges:g,nodes:x,triggerNodeChanges:b,triggerEdgeChanges:v,elementsSelectable:m}=f();if(!m)return;const w=x.reduce((N,I)=>I.selected?[...N,ht(I.id,!1)]:N,[]),k=g.reduce((N,I)=>I.selected?[...N,ht(I.id,!1)]:N,[]);b(w),v(k)},setNodeExtent:g=>{const{nodes:x,nodeLookup:b,parentLookup:v,nodeOrigin:m,elevateNodesOnSelect:w,nodeExtent:k}=f();g[0][0]===k[0][0]&&g[0][1]===k[0][1]&&g[1][0]===k[1][0]&&g[1][1]===k[1][1]||(Xr(x,b,v,{nodeOrigin:m,nodeExtent:g,elevateNodesOnSelect:w,checkEquality:!1}),d({nodeExtent:g}))},panBy:g=>{const{transform:x,width:b,height:v,panZoom:m,translateExtent:w}=f();return qg({delta:g,panZoom:m,transform:x,translateExtent:w,width:b,height:v})},setCenter:async(g,x,b)=>{const{width:v,height:m,maxZoom:w,panZoom:k}=f();if(!k)return Promise.resolve(!1);const N=typeof b?.zoom<"u"?b.zoom:w;return await k.setViewport({x:v/2-g*N,y:m/2-x*N,zoom:N},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{d({connection:{...fa}})},updateConnection:g=>{d({connection:g})},reset:()=>d({...sl()})}},Object.is);function al({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:h,children:d}){const[f]=O.useState(()=>f0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:l,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:u,nodeExtent:h}));return C.jsx(Rm,{value:f,children:C.jsx(oy,{children:d})})}function h0({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:h,nodeExtent:d}){return O.useContext(Eo)?C.jsx(C.Fragment,{children:e}):C.jsx(al,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:h,nodeExtent:d,children:e})}const p0={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function g0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:h,onMoveEnd:d,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:m,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:I,onNodeDrag:M,onNodeDragStop:L,onNodesDelete:H,onEdgesDelete:j,onDelete:R,onSelectionChange:$,onSelectionDragStart:y,onSelectionDrag:A,onSelectionDragStop:T,onSelectionContextMenu:S,onSelectionStart:E,onSelectionEnd:P,onBeforeDelete:_,connectionMode:D,connectionLineType:z=Ze.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:Y,deleteKeyCode:K="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:V=!1,selectionMode:X=At.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:te=gn()?"Meta":"Control",zoomActivationKeyCode:Z=gn()?"Meta":"Control",snapToGrid:oe,snapGrid:ne,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:ge,nodesDraggable:Pe,autoPanOnNodeFocus:Bt,nodesConnectable:qo,nodesFocusable:Zo,nodeOrigin:Ko=hc,edgesFocusable:Tn,edgesReconnectable:Mn,elementsSelectable:Ii=!0,defaultViewport:Qo=Gm,minZoom:Wt=.5,maxZoom:An=2,translateExtent:wu=ln,preventScrolling:$w=!0,nodeExtent:Pi,defaultMarkerColor:zw="#b1b1b7",zoomOnScroll:Hw=!0,zoomOnPinch:jw=!0,panOnScroll:Vw=!1,panOnScrollSpeed:Fw=.5,panOnScrollMode:Bw=ut.Free,zoomOnDoubleClick:Ww=!0,panOnDrag:Yw=!0,onPaneClick:Xw,onPaneMouseEnter:Uw,onPaneMouseMove:Gw,onPaneMouseLeave:qw,onPaneScroll:Zw,onPaneContextMenu:Kw,paneClickDistance:bu=0,nodeClickDistance:Qw=0,children:Jw,onReconnect:eb,onReconnectStart:tb,onReconnectEnd:nb,onEdgeContextMenu:ob,onEdgeDoubleClick:rb,onEdgeMouseEnter:ib,onEdgeMouseMove:sb,onEdgeMouseLeave:ab,reconnectRadius:cb=10,onNodesChange:lb,onEdgesChange:ub,noDragClassName:db="nodrag",noWheelClassName:fb="nowheel",noPanClassName:vu="nopan",fitView:Eu,fitViewOptions:_u,connectOnClick:hb,attributionPosition:pb,proOptions:gb,defaultEdgeOptions:mb,elevateNodesOnSelect:yb,elevateEdgesOnSelect:xb,disableKeyboardA11y:Su=!1,autoPanOnConnect:wb,autoPanOnNodeDrag:bb,autoPanSpeed:vb,connectionRadius:Eb,isValidConnection:_b,onError:Sb,style:Cb,id:Cu,nodeDragThreshold:Nb,connectionDragThreshold:kb,viewport:Tb,onViewportChange:Mb,width:Ab,height:Ib,colorMode:Pb="light",debug:Ob,onScroll:Nu,ariaLabelConfig:Db,...Rb},Lb){const Oi=Cu||"1",$b=Km(Pb),zb=O.useCallback(ku=>{ku.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Nu?.(ku)},[Nu]);return C.jsx("div",{"data-testid":"rf__wrapper",...Rb,onScroll:zb,style:{...Cb,...p0},ref:Lb,className:fe(["react-flow",r,$b]),id:Cu,role:"application",children:C.jsxs(h0,{nodes:e,edges:t,width:Ab,height:Ib,fitView:Eu,fitViewOptions:_u,minZoom:Wt,maxZoom:An,nodeOrigin:Ko,nodeExtent:Pi,children:[C.jsx(d0,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:m,onNodeMouseLeave:w,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:s,connectionLineType:z,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:Y,selectionKeyCode:W,selectionOnDrag:V,selectionMode:X,deleteKeyCode:K,multiSelectionKeyCode:te,panActivationKeyCode:J,zoomActivationKeyCode:Z,onlyRenderVisibleElements:ue,defaultViewport:Qo,translateExtent:wu,minZoom:Wt,maxZoom:An,preventScrolling:$w,zoomOnScroll:Hw,zoomOnPinch:jw,zoomOnDoubleClick:Ww,panOnScroll:Vw,panOnScrollSpeed:Fw,panOnScrollMode:Bw,panOnDrag:Yw,onPaneClick:Xw,onPaneMouseEnter:Uw,onPaneMouseMove:Gw,onPaneMouseLeave:qw,onPaneScroll:Zw,onPaneContextMenu:Kw,paneClickDistance:bu,nodeClickDistance:Qw,onSelectionContextMenu:S,onSelectionStart:E,onSelectionEnd:P,onReconnect:eb,onReconnectStart:tb,onReconnectEnd:nb,onEdgeContextMenu:ob,onEdgeDoubleClick:rb,onEdgeMouseEnter:ib,onEdgeMouseMove:sb,onEdgeMouseLeave:ab,reconnectRadius:cb,defaultMarkerColor:zw,noDragClassName:db,noWheelClassName:fb,noPanClassName:vu,rfId:Oi,disableKeyboardA11y:Su,nodeExtent:Pi,viewport:Tb,onViewportChange:Mb}),C.jsx(Zm,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:b,nodesDraggable:Pe,autoPanOnNodeFocus:Bt,nodesConnectable:qo,nodesFocusable:Zo,edgesFocusable:Tn,edgesReconnectable:Mn,elementsSelectable:Ii,elevateNodesOnSelect:yb,elevateEdgesOnSelect:xb,minZoom:Wt,maxZoom:An,nodeExtent:Pi,onNodesChange:lb,onEdgesChange:ub,snapToGrid:oe,snapGrid:ne,connectionMode:D,translateExtent:wu,connectOnClick:hb,defaultEdgeOptions:mb,fitView:Eu,fitViewOptions:_u,onNodesDelete:H,onEdgesDelete:j,onDelete:R,onNodeDragStart:I,onNodeDrag:M,onNodeDragStop:L,onSelectionDrag:A,onSelectionDragStart:y,onSelectionDragStop:T,onMove:u,onMoveStart:h,onMoveEnd:d,noPanClassName:vu,nodeOrigin:Ko,rfId:Oi,autoPanOnConnect:wb,autoPanOnNodeDrag:bb,autoPanSpeed:vb,onError:Sb,connectionRadius:Eb,isValidConnection:_b,selectNodesOnDrag:ge,nodeDragThreshold:Nb,connectionDragThreshold:kb,onBeforeDelete:_,paneClickDistance:bu,debug:Ob,ariaLabelConfig:Db}),C.jsx(Um,{onSelectionChange:$}),Jw,C.jsx(Fm,{proOptions:gb,position:pb}),C.jsx(Vm,{rfId:Oi,disableKeyboardA11y:Su})]})})}var m0=Cc(g0);const y0=xe.error014();function x0({id:e,handleType:t,handleId:n,onConnect:o,onDisconnect:r}={}){const i=No(),s=e??i;if(!s)throw new Error(y0);const a=O.useRef(null),c=ie(l=>l.connectionLookup.get(`${s}${t?n?`-${t}-${n}`:`-${t}`:""}`),_g);return O.useEffect(()=>{if(a.current&&a.current!==c){const l=c??new Map;pa(a.current,l,r),pa(l,a.current,o)}a.current=c??new Map},[c,o,r]),O.useMemo(()=>Array.from(c?.values()??[]),[c])}function si(e){return ie(O.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]),Zg)}function w0({dimensions:e,lineWidth:t,variant:n,className:o}){return C.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:fe(["react-flow__background-pattern",n,o])})}function b0({radius:e,className:t}){return C.jsx("circle",{cx:e,cy:e,r:e,className:fe(["react-flow__background-pattern","dots",t])})}var Je;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Je||(Je={}));const v0={[Je.Dots]:1,[Je.Lines]:1,[Je.Cross]:6},E0=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cl({id:e,variant:t=Je.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:c,className:l,patternClassName:u}){const h=O.useRef(null),{transform:d,patternId:f}=ie(E0,de),p=o||v0[t],g=t===Je.Dots,x=t===Je.Cross,b=Array.isArray(n)?n:[n,n],v=[b[0]*d[2]||1,b[1]*d[2]||1],m=p*d[2],w=Array.isArray(i)?i:[i,i],k=x?[m,m]:v,N=[w[0]*d[2]||1+k[0]/2,w[1]*d[2]||1+k[1]/2],I=`${f}${e||""}`;return C.jsxs("svg",{className:fe(["react-flow__background",l]),style:{...c,...Co,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:h,"data-testid":"rf__background",children:[C.jsx("pattern",{id:I,x:d[0]%v[0],y:d[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:g?C.jsx(b0,{radius:m/2,className:u}):C.jsx(w0,{dimensions:k,lineWidth:r,variant:t,className:u})}),C.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}cl.displayName="Background";const _0=O.memo(cl);function S0(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:C.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function C0(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:C.jsx("path",{d:"M0 0h32v4.2H0z"})})}function N0(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:C.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 k0(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 T0(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 To({children:e,className:t,...n}){return C.jsx("button",{type:"button",className:fe(["react-flow__controls-button",t]),...n,children:e})}const M0=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:c,className:l,children:u,position:h="bottom-left",orientation:d="vertical","aria-label":f}){const p=ce(),{isInteractive:g,minZoomReached:x,maxZoomReached:b,ariaLabelConfig:v}=ie(M0,de),{zoomIn:m,zoomOut:w,fitView:k}=bn(),N=()=>{m(),i?.()},I=()=>{w(),s?.()},M=()=>{k(r),a?.()},L=()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c?.(!g)},H=d==="horizontal"?"horizontal":"vertical";return C.jsxs(_o,{className:fe(["react-flow__controls",H,l]),position:h,style:e,"data-testid":"rf__controls","aria-label":f??v["controls.ariaLabel"],children:[t&&C.jsxs(C.Fragment,{children:[C.jsx(To,{onClick:N,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:b,children:C.jsx(S0,{})}),C.jsx(To,{onClick:I,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:x,children:C.jsx(C0,{})})]}),n&&C.jsx(To,{className:"react-flow__controls-fitview",onClick:M,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:C.jsx(N0,{})}),o&&C.jsx(To,{className:"react-flow__controls-interactive",onClick:L,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:g?C.jsx(T0,{}):C.jsx(k0,{})}),u]})}ll.displayName="Controls";const A0=O.memo(ll);function I0({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:c,className:l,borderRadius:u,shapeRendering:h,selected:d,onClick:f}){const{background:p,backgroundColor:g}=i||{},x=s||p||g;return C.jsx("rect",{className:fe(["react-flow__minimap-node",{selected:d},l]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:c},shapeRendering:h,onClick:f?b=>f(b,e):void 0})}const P0=O.memo(I0),O0=e=>e.nodes.map(t=>t.id),ai=e=>e instanceof Function?e:()=>e;function D0({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=P0,onClick:s}){const a=ie(O0,de),c=ai(t),l=ai(e),u=ai(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return C.jsx(C.Fragment,{children:a.map(d=>C.jsx(L0,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:h},d))})}function R0({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:l,x:u,y:h,width:d,height:f}=ie(p=>{const{internals:g}=p.nodeLookup.get(e),x=g.userNode,{x:b,y:v}=g.positionAbsolute,{width:m,height:w}=Xe(x);return{node:x,x:b,y:v,width:m,height:w}},de);return!l||l.hidden||!Sa(l)?null:C.jsx(a,{x:u,y:h,width:d,height:f,style:l.style,selected:!!l.selected,className:o(l),color:t(l),borderRadius:r,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:c,id:l.id})}const L0=O.memo(R0);var $0=O.memo(D0);const z0=200,H0=150,j0=e=>!e.hidden,V0=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?va(dn(e.nodeLookup,{filter:j0}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},F0="react-flow__minimap-desc";function ul({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:h,position:d="bottom-right",onClick:f,onNodeClick:p,pannable:g=!1,zoomable:x=!1,ariaLabel:b,inversePan:v,zoomStep:m=1,offsetScale:w=5}){const k=ce(),N=O.useRef(null),{boundingRect:I,viewBB:M,rfId:L,panZoom:H,translateExtent:j,flowWidth:R,flowHeight:$,ariaLabelConfig:y}=ie(V0,de),A=e?.width??z0,T=e?.height??H0,S=I.width/A,E=I.height/T,P=Math.max(S,E),_=P*A,D=P*T,z=w*P,F=I.x-(_-I.width)/2-z,B=I.y-(D-I.height)/2-z,Y=_+z*2,K=D+z*2,W=`${F0}-${L}`,V=O.useRef(0),X=O.useRef();V.current=P,O.useEffect(()=>{if(N.current&&H)return X.current=im({domNode:N.current,panZoom:H,getTransform:()=>k.getState().transform,getViewScale:()=>V.current}),()=>{X.current?.destroy()}},[H]),O.useEffect(()=>{X.current?.update({translateExtent:j,width:R,height:$,inversePan:v,pannable:g,zoomStep:m,zoomable:x})},[g,x,v,m,j,R,$]);const J=f?oe=>{const[ne,ue]=X.current?.pointer(oe)||[0,0];f(oe,{x:ne,y:ue})}:void 0,te=p?O.useCallback((oe,ne)=>{const ue=k.getState().nodeLookup.get(ne).internals.userNode;p(oe,ue)},[]):void 0,Z=b??y["minimap.ariaLabel"];return C.jsx(_o,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*P: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:fe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:C.jsxs("svg",{width:A,height:T,viewBox:`${F} ${B} ${Y} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:N,onClick:J,children:[Z&&C.jsx("title",{id:W,children:Z}),C.jsx($0,{onClick:te,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),C.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-z},${B-z}h${Y+z*2}v${K+z*2}h${-Y-z*2}z
60
+ M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ul.displayName="MiniMap";const B0=O.memo(ul),W0=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Y0={[ft.Line]:"right",[ft.Handle]:"bottom-right"};function X0({nodeId:e,position:t,variant:n=ft.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:d,autoScale:f=!0,shouldResize:p,onResizeStart:g,onResize:x,onResizeEnd:b}){const v=No(),m=typeof e=="string"?e:v,w=ce(),k=O.useRef(null),N=n===ft.Handle,I=ie(O.useCallback(W0(N&&f),[N,f]),de),M=O.useRef(null),L=t??Y0[n];O.useEffect(()=>{if(!(!k.current||!m))return M.current||(M.current=vm({domNode:k.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:j,transform:R,snapGrid:$,snapToGrid:y,nodeOrigin:A,domNode:T}=w.getState();return{nodeLookup:j,transform:R,snapGrid:$,snapToGrid:y,nodeOrigin:A,paneDomNode:T}},onChange:(j,R)=>{const{triggerNodeChanges:$,nodeLookup:y,parentLookup:A,nodeOrigin:T}=w.getState(),S=[],E={x:j.x,y:j.y},P=y.get(m);if(P&&P.expandParent&&P.parentId){const _=P.origin??T,D=j.width??P.measured.width??0,z=j.height??P.measured.height??0,F={id:P.id,parentId:P.parentId,rect:{width:D,height:z,...Ca({x:j.x??P.position.x,y:j.y??P.position.y},{width:D,height:z},P.parentId,y,_)}},B=Gr([F],y,A,T);S.push(...B),E.x=j.x?Math.max(_[0]*D,j.x):void 0,E.y=j.y?Math.max(_[1]*z,j.y):void 0}if(E.x!==void 0&&E.y!==void 0){const _={id:m,type:"position",position:{...E}};S.push(_)}if(j.width!==void 0&&j.height!==void 0){const D={id:m,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};S.push(D)}for(const _ of R){const D={..._,type:"position"};S.push(D)}$(S)},onEnd:({width:j,height:R})=>{const $={id:m,type:"dimensions",resizing:!1,dimensions:{width:j,height:R}};w.getState().triggerNodeChanges([$])}})),M.current.update({controlPosition:L,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:h,resizeDirection:d,onResizeStart:g,onResize:x,onResizeEnd:b,shouldResize:p}),()=>{M.current?.destroy()}},[L,a,c,l,u,h,g,x,b,p]);const H=L.split("-");return C.jsx("div",{className:fe(["react-flow__resize-control","nodrag",...H,n,o]),ref:k,style:{...r,scale:I,...s&&{[N?"backgroundColor":"borderColor"]:s}},children:i})}const dl=O.memo(X0),ci=20;function pt(e,t){const n=t[e.dataType],o=e.allowInput??n.allowInput;return n.underlyingType==="number"?{id:St(ci),name:e.name,handleColor:n.color,allowInput:o,type:"number",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:{id:St(ci),name:e.name,handleColor:n.color,allowInput:n.underlyingType==="string"?o:!1,type:"string",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}}function fl(e,t){const n=St(ci),o=e.inputs.map(r=>pt(r,t));return{id:n,name:e.name,inputs:o}}function li(e,t,n,o,r){const i=n[t],s=i.inputs.map(c=>"inputs"in c?fl(c,e):pt(c,e)),a=i.outputs.map(c=>pt(c,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 hl(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 pt(i.inputs?.[o.index2],e);if(o.index2===void 0&&!("inputs"in i))return pt(i,e)}else return pt(r?.outputs?.[o.index1],e)}function U0(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=Ae(o,e.nodes[t].data),a=Ae(r,e.nodes[n].data),c=s?.dataType,l=a?.dataType,u=s?.inferredDataType,h=a?.inferredDataType;if(!c||!l)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(c.dataTypeObject.underlyingType!=="inferFromConnection"&&l.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};if(c.dataTypeObject.underlyingType==="inferFromConnection"&&l.dataTypeObject.underlyingType==="inferFromConnection"){if(!u&&!h)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"None of the handles are inferred, inference has no information to work with"}};if(u&&h)return{updatedNodes:e.nodes,validation:{isValid:!0}};if(u){const d=[...e.nodes];return d[n]={...e.nodes[n],data:zt(e.nodes[n].data,o,c.dataTypeUniqueId,{dataTypeToInferAs:u.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:d,validation:{isValid:!0}}}if(h){const d=[...e.nodes];return d[t]={...e.nodes[t],data:zt(e.nodes[t].data,r,l.dataTypeUniqueId,{dataTypeToInferAs:h.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:d,validation:{isValid:!0}}}}if(c.dataTypeObject.underlyingType==="inferFromConnection"){if(u)return{updatedNodes:e.nodes,validation:{isValid:!0}};const d=[...e.nodes];return d[t]={...e.nodes[t],data:zt(e.nodes[t].data,r,c.dataTypeUniqueId,{dataTypeToInferAs:l.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:d,validation:{isValid:!0}}}if(l.dataTypeObject.underlyingType==="inferFromConnection"){if(h)return{updatedNodes:e.nodes,validation:{isValid:!0}};const d=[...e.nodes];return d[n]={...e.nodes[n],data:zt(e.nodes[n].data,o,l.dataTypeUniqueId,{dataTypeToInferAs:c.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!1},e.dataTypes,e.typeOfNodes)},{updatedNodes:d,validation:{isValid:!0}}}return{updatedNodes:e.nodes,validation:{isValid:!0}}}function G0(e,t,n,o,r,i){if(!i.sourceHandle||!i.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const s=Ae(o,e.nodes[t].data),a=Ae(r,e.nodes[n].data),c=En(s),l=En(a);if(!c||!l)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const u=c?.dataTypeObject.underlyingType==="complex",h=l?.dataTypeObject.underlyingType==="complex";return!u&&!h?{validation:{isValid:!0}}:u!==h?{validation:{isValid:!1,reason:"Can't connect complex types with non-complex types"}}:u&&h?c.dataTypeUniqueId===l.dataTypeUniqueId||JSON.stringify(c.dataTypeObject.complexSchema)===JSON.stringify(l.dataTypeObject.complexSchema)?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:"Can't connect complex types with different types"}}:{validation:{isValid:!0}}}function q0(e,t,n,o,r,i){if(!i.sourceHandle||!i.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const s=Ae(o,e.nodes[t].data),a=Ae(r,e.nodes[n].data),c=En(s),l=En(a);if(!c||!l)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(c.dataTypeUniqueId===l.dataTypeUniqueId)return{validation:{isValid:!0}};const h=e.allowedConversionsBetweenDataTypes?.[c.dataTypeUniqueId]?.[l.dataTypeUniqueId],d=c.dataTypeObject.underlyingType==="complex"&&l.dataTypeObject.underlyingType==="complex";return h||d&&e.allowConversionBetweenComplexTypesUnlessDisallowedByComplexTypeChecking?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:`${c.dataTypeUniqueId} to ${l.dataTypeUniqueId} conversion is not allowed`}}}function Z0(e,t,n,o,r,i){const s=e.nodes[t],a=e.nodes[n],c=Ae(o,s.data),l=Ae(r,a.data),u=c?.dataType,h=l?.dataType;if(!u||!h)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(u.dataTypeObject.underlyingType!=="inferFromConnection"&&h.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};let d=e.nodes;if(u.dataTypeObject.underlyingType==="inferFromConnection"){const f=zr([s],e.edges),{inputsAndIndices:p,outputsAndIndices:g}=di(s.data),x={};for(const v of p)v.input.dataType?.dataTypeUniqueId===u.dataTypeUniqueId&&(x[v.input.id]=!0);for(const v of g)v.output.dataType?.dataTypeUniqueId===u.dataTypeUniqueId&&(x[v.output.id]=!0);let b=!1;for(const v of f)if(v.id!==i.id&&!(!v.sourceHandle||!v.targetHandle)){if(x[v.sourceHandle]){b=!0;break}if(x[v.targetHandle]){b=!0;break}}b||(d=[...e.nodes],d[t]={...e.nodes[t],data:zt(e.nodes[t].data,o,u.dataTypeUniqueId,{dataTypeToInferAs:u.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[t].id],resetInferredType:!0},e.dataTypes,e.typeOfNodes)})}if(h.dataTypeObject.underlyingType==="inferFromConnection"){const f=zr([a],e.edges),{inputsAndIndices:p,outputsAndIndices:g}=di(a.data),x={};for(const v of p)v.input.dataType?.dataTypeUniqueId===h.dataTypeUniqueId&&(x[v.input.id]=!0);for(const v of g)v.output.dataType?.dataTypeUniqueId===h.dataTypeUniqueId&&(x[v.output.id]=!0);let b=!1;for(const v of f)if(v.id!==i.id&&!(!v.sourceHandle||!v.targetHandle)){if(x[v.sourceHandle]){b=!0;break}if(x[v.targetHandle]){b=!0;break}}b||(d=[...e.nodes],d[n]={...e.nodes[n],data:zt(e.nodes[n].data,r,h.dataTypeUniqueId,{dataTypeToInferAs:h.dataTypeUniqueId,connectedNodeType:e.nodeIdToNodeType[e.nodes[n].id],resetInferredType:!0},e.dataTypes,e.typeOfNodes)})}return{updatedNodes:d,validation:{isValid:!0}}}const K0=20;function pl(e,t,n,o,r){const i={id:St(K0),source:e,target:n,sourceHandle:t,targetHandle:o,type:"configurableEdge"};if(yo(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:yo(i,r.edges),validation:{isValid:!0}};const a=r.nodes.findIndex(g=>g.id===e),c=r.nodes.findIndex(g=>g.id===n);if(a===-1||c===-1)return{updatedNodes:r.nodes,updatedEdges:r.edges,validation:{isValid:!1,reason:"Source or target node not found"}};const l=r.nodes[a],u=r.nodes[c],h=_n(t,l.data),d=_n(o,u.data);if(!h||!d)return{updatedNodes:r.nodes,updatedEdges:r.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let f=r.nodes,p={isValid:!0};if(r.enableTypeInference){const{updatedNodes:g,validation:x}=U0(r,a,c,h,d,i);f=g,p=x}if(r.enableComplexTypeChecking&&p.isValid){const{validation:g}=G0({...r,nodes:f},a,c,h,d,i);p=g}if(r.allowedConversionsBetweenDataTypes&&p.isValid){const{validation:g}=q0({...r,nodes:f},a,c,h,d,i);p=g}return console.log("validation",p),{updatedNodes:f,updatedEdges:yo(i,r.edges),validation:p}}function gl(e,t,n){if(wn([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:wn([n],t.edges),validation:{isValid:!0}};const r=t.nodes.findIndex(d=>d.id===e.source),i=t.nodes.findIndex(d=>d.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],c=_n(e.sourceHandle,s.data),l=_n(e.targetHandle,a.data);if(!c||!l)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let u=t.nodes,h={isValid:!0};if(t.enableTypeInference){const{updatedNodes:d,validation:f}=Z0(t,r,i,c,l,e);u=d,h=f}return{updatedNodes:u,updatedEdges:wn([n],t.edges),validation:h}}function En(e){const t=e?.dataType,n=e?.inferredDataType;if(t)return t.dataTypeObject.underlyingType!=="inferFromConnection"?t:n||void 0}function ml(e,t,n){const o=e.nodes.find(i=>i.id===n);if(!o)return!1;if(o.id===t)return!0;const r=(i,s=new Set)=>{if(s.has(i.id))return!1;s.add(i.id);for(const a of Cg(i,e.nodes,e.edges))if(a.id===t||r(a,s))return!0;return!1};return r(o)}const yl=20,Se=["ADD_NODE","ADD_NODE_AND_SELECT","UPDATE_NODE_BY_REACT_FLOW","UPDATE_EDGES_BY_REACT_FLOW","ADD_EDGE_BY_REACT_FLOW","UPDATE_INPUT_VALUE"],ze={[Se[0]]:Se[0],[Se[1]]:Se[1],[Se[2]]:Se[2],[Se[3]]:Se[3],[Se[4]]:Se[4],[Se[5]]:Se[5]};function xl(e,t){return Fd(e,o=>{switch(t.type){case ze.ADD_NODE:const r=t.payload.type,i=St(yl),s=t.payload.position,a=li(o.dataTypes,r,o.typeOfNodes,i,s);o.nodes.push(a),o.nodeIdToNodeType[i]=r;break;case ze.ADD_NODE_AND_SELECT:const c=t.payload.type,l=St(yl),u=t.payload.position,h=li(o.dataTypes,c,o.typeOfNodes,l,u);o.nodes=o.nodes.map(w=>({...w,selected:!1})),o.nodes.push({...h,selected:!0}),o.nodeIdToNodeType[l]=c;break;case ze.UPDATE_NODE_BY_REACT_FLOW:const d=t.payload.changes;o.nodes=vc(d,o.nodes);break;case ze.UPDATE_EDGES_BY_REACT_FLOW:const f=t.payload.changes;for(const w of f){if(w.type!=="remove"){o.edges=wn([w],o.edges);continue}const{id:k}=w,N=o.edges.find(M=>M.id===k);if(!N)continue;const I=gl(N,o,w);I.validation.isValid&&(o.edges=I.updatedEdges,o.nodes=I.updatedNodes)}break;case ze.ADD_EDGE_BY_REACT_FLOW:const p=t.payload.edge,{sourceHandle:g,targetHandle:x,source:b,target:v}=p;if(o.enableCycleChecking&&ml(o,b,v)||!b||!v||!g||!x)break;const m=pl(b,g,v,x,o);if(!m.validation.isValid)break;o.edges=m.updatedEdges,o.nodes=m.updatedNodes;break}})}function _n(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 c=a.inputs.findIndex(l=>l.id===e);return c!==-1?(i=c,!0):!1}else return a.id===e});if(s!==-1)return{type:"input",index1:s,index2:i}}function Ae(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 ui(e,t){const n=_n(e,t);return Ae(n,t)}function Q0(e,t,n){return t.map(o=>o.id===e?{...o,...n}:o)}function J0(e,t,n){return"inputs"in t?{...t,inputs:Q0(e,t.inputs,n)}:t.id===e?{...t,...n}:t}function wl(e,t,n){return{...t,inputs:(t.inputs||[]).map(r=>J0(e,r,n))}}function ex(e,t,n){if(e.type!="input")return t;const o=Ae(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 c=[...s.inputs||[]];c[e.index2]=r,i[e.index1]={...s,inputs:c}}else e.index2===void 0&&!("inputs"in s)&&(i[e.index1]=r);return{...t,inputs:i}}function tx(e,t,n){if(e.type!="output")return t;const o=Ae(e,t);if(!o)return t;const r={...o,...n},i=[...t.outputs||[]];return i[e.index1]=r,{...t,outputs:i}}function nx(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 ox(e){let t=[];return e.outputs?.forEach((n,o)=>{t.push({output:n,handleIndices:{type:"output",index1:o,index2:void 0}})}),t}function di(e){return{inputsAndIndices:nx(e),outputsAndIndices:ox(e)}}function bl(e,t,n,o,r,i){const s=o?hl(r,o.connectedNodeType,i,n):void 0;let a;if(s){const{id:c,name:l,dataType:u,...h}=s;a=h}return t.type==="input"?ex(t,e,{inferredDataType:o?.dataTypeToInferAs&&!o.resetInferredType?{dataTypeObject:r[o.dataTypeToInferAs],dataTypeUniqueId:o.dataTypeToInferAs}:void 0,...o?.dataTypeToInferAs&&a?a:{}}):tx(t,e,{inferredDataType:o?.dataTypeToInferAs&&!o.resetInferredType?{dataTypeObject:r[o.dataTypeToInferAs],dataTypeUniqueId:o.dataTypeToInferAs}:void 0,...o?.dataTypeToInferAs&&a?a:{}})}function zt(e,t,n,o,r,i){const{inputsAndIndices:s,outputsAndIndices:a}=di(e);let c=e;for(const l of s)l.input.dataType?.dataTypeUniqueId===n&&(c=bl(c,l.handleIndices,t,o,r,i));for(const l of a)l.output.dataType?.dataTypeUniqueId===n&&(c=bl(c,l.handleIndices,t,o,r,i));return c}const fi=O.forwardRef(({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,...a},c)=>{const[l]=mo({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s}),u=ce(),[h,d]=O.useState(!0),f=O.useRef(null);O.useEffect(()=>{const I=u.getState().domNode;if(!I)return;const M=document.getElementById(e);if(!M)return;const L=new IntersectionObserver(H=>{const j=H.find(R=>R.target.id===e);j&&d(R=>j.isIntersecting)},{root:I,threshold:1,rootMargin:"20px"});return L.observe(M),f.current=L,()=>{f.current&&(f.current.disconnect(),f.current=null)}},[u.getState().domNode]);const p=si(a.source||""),g=O.useMemo(()=>!a.source||!p?void 0:ui(a.sourceHandleId||"",p?.data)?.handleColor??"#A1A1A1",[a.source,p]),x=si(a.target||""),b=O.useMemo(()=>!a.target||!x?void 0:ui(a.targetHandleId||"",x?.data)?.handleColor??"#A1A1A1",[a.target,x]),{label:v,labelStyle:m,markerStart:w,markerEnd:k,interactionWidth:N}=a;return C.jsxs(C.Fragment,{children:[C.jsx("defs",{children:C.jsxs("linearGradient",{id:`linear-gradient-edge-${e}`,x1:t,y1:n,x2:o,y2:r,gradientUnits:"userSpaceOnUse",children:[C.jsx("stop",{stopColor:g,offset:"0"}),C.jsx("stop",{stopColor:b,offset:"1"})]})}),C.jsx($t,{id:e,path:l,label:v,labelStyle:m,markerEnd:k,markerStart:w,interactionWidth:N,className:se("!stroke-7 in-[g.selected]:brightness-150",!h&&"opacity-25"),style:{stroke:`url(#${`linear-gradient-edge-${e}`})`},focusable:!0})]})});fi.displayName="ConfigurableEdge";function vl(e,t,n=!0,o=!1){const r=e!==null?"current"in e?e.current:e:null,i=O.useCallback(s=>{if(!r)return;let a=!0;if(n&&s.target instanceof Node&&!r.contains(s.target))a=!1;else if(o){const c="clientX"in s?{x:s.clientX,y:s.clientY}:{x:s.touches[0].clientX,y:s.touches[0].clientY},l=r.getBoundingClientRect();os(c,l)||(a=!1)}a||t()},[r,t,n,o]);O.useEffect(()=>(document.addEventListener("mousedown",i),document.addEventListener("touchstart",i),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("touchstart",i)}),[r,i])}const Sn=O.forwardRef(({placeholder:e="Input",className:t,...n},o)=>{const r=O.useMemo(()=>n.allowOnlyNumbers&&n.value!==void 0?sr(n.value,n.numberOfDecimals??5):n.value?.toString(),[n.value,n.allowOnlyNumbers,n.numberOfDecimals]),[i,s]=O.useState(r??""),[a,c]=O.useState(null),l=n.value??i,[u,h]=O.useState(l.toString());function d(p){n.allowOnlyNumbers&&/[^0-9\.\-]/.test(p)||h(p)}function f(){if(n.allowOnlyNumbers){const p=rs(u||l.toString()),g=sr(p,n.numberOfDecimals??5);s(g),n.onChange?.(p),h(g)}else s(u),n.onChange?.(u),h(u)}return vl(a,()=>f()),C.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=>{c(p),typeof o=="function"?o(p):o&&(o.current=p)},value:u,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&f()},onMouseMove:p=>{p.preventDefault(),p.stopPropagation()},onBlur:p=>{p.preventDefault(),p.stopPropagation(),f()}})});Sn.displayName="Input";function El({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:r,lineStyle:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:h=!1,autoScale:d=!0,shouldResize:f,onResizeStart:p,onResize:g,onResizeEnd:x,linePosition:b=["left","right"],handlePosition:v=[],resizeDirection:m="horizontal"}){return t?C.jsxs(C.Fragment,{children:[b.map(w=>C.jsx(dl,{className:se("!border-none",w==="left"||w==="right"?"!w-4":"!h-4",r),style:i,nodeId:e,position:w,variant:ft.Line,color:s,minWidth:a,minHeight:c,maxWidth:l,maxHeight:u,onResizeStart:p,keepAspectRatio:h,autoScale:d,shouldResize:f,onResize:g,onResizeEnd:x,resizeDirection:m},w)),v.map(w=>C.jsx(dl,{className:n,style:o,nodeId:e,position:w,color:s,minWidth:a,minHeight:c,maxWidth:l,maxHeight:u,onResizeStart:p,keepAspectRatio:h,autoScale:d,shouldResize:f,onResize:g,onResizeEnd:x,resizeDirection:m},w))]}):null}function _l({onMove:e,onClick:t,clickThreshold:n=2,enabled:o=!0,preventDefaultAndStopPropagation:r=!0}={}){const[i,s]=O.useState(!1),[a,c]=O.useState(null),l=O.useRef(null),u=O.useRef(null),h=O.useCallback(d=>{c(d)},[]);return O.useEffect(()=>{if(!a||!o)return;const d=f=>{r&&(f.preventDefault(),f.stopPropagation()),l.current={x:f.clientX,y:f.clientY},u.current={width:a.clientWidth,height:a.clientHeight},s(!0);const p=x=>{r&&(x.preventDefault(),x.stopPropagation()),document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",g),s(!1),l.current&&Math.sqrt((x.clientX-l.current.x)**2+(x.clientY-l.current.y)**2)<n&&t?.()},g=x=>{r&&(x.preventDefault(),x.stopPropagation());const b=x.movementX,v=x.movementY,m=u.current?.width||1,w=u.current?.height||1,k=b/m,N=v/w;e?.(b,v,k,N,m,w)};document.addEventListener("mouseup",p),document.addEventListener("mousemove",g)};return a.addEventListener("mousedown",d),()=>{a.removeEventListener("mousedown",d)}},[a,o,e,t,n,r]),{isDragging:i,dragRef:h}}/**
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 rx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ix=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),Sl=e=>{const t=ix(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cl=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),sx=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 ax={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 cx=O.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:i,iconNode:s,...a},c)=>O.createElement("svg",{ref:c,...ax,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Cl("lucide",r),...!i&&!sx(a)&&{"aria-hidden":"true"},...a},[...s.map(([l,u])=>O.createElement(l,u)),...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 Cn=(e,t)=>{const n=O.forwardRef(({className:o,...r},i)=>O.createElement(cx,{ref:i,iconNode:t,className:Cl(`lucide-${rx(Sl(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Sl(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 lx=Cn("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 ux=Cn("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 Nl=Cn("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 dx=Cn("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 fx=Cn("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Mo=O.forwardRef(({name:e="Input",value:t,onChange:n=()=>{},className:o,min:r,max:i,step:s},a)=>{const[c,l]=O.useState(t??0),[u,h]=O.useState(!1),d=O.useRef(0),f=O.useRef(0),p=t??c,g=O.useRef(0);O.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:x,dragRef:b}=_l({onMove:(H,j,R,$,y)=>{const A=H/(y+60);d.current+=A,Math.abs(d.current)>.05&&Date.now()-f.current>50&&(f.current=Date.now(),v(g.current*d.current),d.current=0)},onClick:k,clickThreshold:2});function v(H){l(j=>{let R=j+H;return r!==void 0&&R<=r?R=r:i!==void 0&&R>=i&&(R=i),n(R),R})}function m(H=.1){v(g.current*H)}function w(H=.1){v(-g.current*H)}function k(){h(!0)}function N(H){v(H-p),h(!1)}const I=x,M=r!==void 0&&i!==void 0&&p!==void 0&&i!==r?(p-r)/(i-r)*100:-1,L=M!==-1?`linear-gradient(90deg,#4772b3 ${M}%, #545454 ${M}%)`:"";return u?C.jsx(Sn,{className:"w-full",placeholder:e,value:p,allowOnlyNumbers:!0,onChange:H=>N(H),ref:a}):C.jsxs("div",{className:se("flex items-center gap-0 group/lightParentGroupBasedHover w-max rounded-md bg-primary-gray",o),style:L!==""?{background:L}:{},ref:a,children:[C.jsx(vt,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-r-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>w(.1),"aria-label":`Decrement ${e}`,applyHoverStyles:!I,children:C.jsx(ux,{})}),C.jsxs(vt,{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:b,children:[C.jsx("span",{className:"truncate text-left",children:e}),C.jsx("span",{className:"truncate",children:p.toFixed(4)})]}),C.jsx(vt,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-l-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>m(.1),"aria-label":`Increment ${e}`,applyHoverStyles:!I,children:C.jsx(Nl,{})})]})});Mo.displayName="SliderNumberInput";function Ao(){return typeof window<"u"}function Ht(e){return kl(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function He(e){var t;return(t=(kl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kl(e){return Ao()?e instanceof Node||e instanceof Ee(e).Node:!1}function le(e){return Ao()?e instanceof Element||e instanceof Ee(e).Element:!1}function Ie(e){return Ao()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function Io(e){return!Ao()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}const hx=new Set(["inline","contents"]);function Nn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ce(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!hx.has(r)}const px=new Set(["table","td","th"]);function gx(e){return px.has(Ht(e))}const mx=[":popover-open",":modal"];function Po(e){return mx.some(t=>{try{return e.matches(t)}catch{return!1}})}const yx=["transform","translate","scale","rotate","perspective"],xx=["transform","translate","scale","rotate","perspective","filter"],wx=["paint","layout","strict","content"];function hi(e){const t=Oo(),n=le(e)?Ce(e):e;return yx.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||xx.some(o=>(n.willChange||"").includes(o))||wx.some(o=>(n.contain||"").includes(o))}function bx(e){let t=Ge(e);for(;Ie(t)&&!Ue(t);){if(hi(t))return t;if(Po(t))return null;t=Ge(t)}return null}function Oo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const vx=new Set(["html","body","#document"]);function Ue(e){return vx.has(Ht(e))}function Ce(e){return Ee(e).getComputedStyle(e)}function Do(e){return le(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ge(e){if(Ht(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Io(e)&&e.host||He(e);return Io(t)?t.host:t}function Tl(e){const t=Ge(e);return Ue(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ie(t)&&Nn(t)?t:Tl(t)}function et(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Tl(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),s=Ee(r);if(i){const a=pi(s);return t.concat(s,s.visualViewport||[],Nn(r)?r:[],a&&n?et(a):[])}return t.concat(r,et(r,[],n))}function pi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ro=Math.min,gt=Math.max,Lo=Math.round,$o=Math.floor,je=e=>({x:e,y:e}),Ex={left:"right",right:"left",bottom:"top",top:"bottom"},_x={start:"end",end:"start"};function Ml(e,t,n){return gt(e,Ro(t,n))}function zo(e,t){return typeof e=="function"?e(t):e}function mt(e){return e.split("-")[0]}function Ho(e){return e.split("-")[1]}function Al(e){return e==="x"?"y":"x"}function Il(e){return e==="y"?"height":"width"}const Sx=new Set(["top","bottom"]);function tt(e){return Sx.has(mt(e))?"y":"x"}function Pl(e){return Al(tt(e))}function Cx(e,t,n){n===void 0&&(n=!1);const o=Ho(e),r=Pl(e),i=Il(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=jo(s)),[s,jo(s)]}function Nx(e){const t=jo(e);return[gi(e),t,gi(t)]}function gi(e){return e.replace(/start|end/g,t=>_x[t])}const Ol=["left","right"],Dl=["right","left"],kx=["top","bottom"],Tx=["bottom","top"];function Mx(e,t,n){switch(e){case"top":case"bottom":return n?t?Dl:Ol:t?Ol:Dl;case"left":case"right":return t?kx:Tx;default:return[]}}function Ax(e,t,n,o){const r=Ho(e);let i=Mx(mt(e),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),t&&(i=i.concat(i.map(gi)))),i}function jo(e){return e.replace(/left|right|bottom|top/g,t=>Ex[t])}function Ix(e){return{top:0,right:0,bottom:0,left:0,...e}}function Px(e){return typeof e!="number"?Ix(e):{top:e,right:e,bottom:e,left:e}}function Vo(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function mi(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Io(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function kn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function yi(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Ox(e){return e.matches("html,body")}function jt(e){return e?.ownerDocument||document}function Fo(e,t,n){return n===void 0&&(n=!0),e.filter(r=>{var i;return r.parentId===t&&(!n||((i=r.context)==null?void 0:i.open))}).flatMap(r=>[r,...Fo(e,r.id,n)])}function Dx(e){return"nativeEvent"in e}function xi(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var Rx=typeof document<"u",Lx=function(){},Vt=Rx?O.useLayoutEffect:Lx;const $x={...U};function Bo(e){const t=U.useRef(e);return Vt(()=>{t.current=e}),t}const zx=$x.useInsertionEffect||(e=>e());function Ve(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return zx(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function Rl(e,t,n){let{reference:o,floating:r}=e;const i=tt(t),s=Pl(t),a=Il(s),c=mt(t),l=i==="y",u=o.x+o.width/2-r.width/2,h=o.y+o.height/2-r.height/2,d=o[a]/2-r[a]/2;let f;switch(c){case"top":f={x:u,y:o.y-r.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-r.width,y:h};break;default:f={x:o.x,y:o.y}}switch(Ho(t)){case"start":f[s]-=d*(n&&l?-1:1);break;case"end":f[s]+=d*(n&&l?-1:1);break}return f}const Hx=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=Rl(l,o,c),d=o,f={},p=0;for(let g=0;g<a.length;g++){const{name:x,fn:b}=a[g],{x:v,y:m,data:w,reset:k}=await b({x:u,y:h,initialPlacement:o,placement:d,strategy:r,middlewareData:f,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,h=m??h,f={...f,[x]:{...f[x],...w}},k&&p<=50&&(p++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(l=k.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:u,y:h}=Rl(l,d,c)),g=-1)}return{x:u,y:h,placement:d,strategy:r,middlewareData:f}};async function Ll(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=zo(t,e),p=Px(f),x=a[d?h==="floating"?"reference":"floating":h],b=Vo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),v=h==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,m=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(m))?await(i.getScale==null?void 0:i.getScale(m))||{x:1,y:1}:{x:1,y:1},k=Vo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:m,strategy:c}):v);return{top:(b.top-k.top+p.top)/w.y,bottom:(k.bottom-b.bottom+p.bottom)/w.y,left:(b.left-k.left+p.left)/w.x,right:(k.right-b.right+p.right)/w.x}}const jx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...x}=zo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=mt(r),v=tt(a),m=mt(a)===a,w=await(c.isRTL==null?void 0:c.isRTL(l.floating)),k=d||(m||!g?[jo(a)]:Nx(a)),N=p!=="none";!d&&N&&k.push(...Ax(a,g,p,w));const I=[a,...k],M=await Ll(t,x),L=[];let H=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&L.push(M[b]),h){const y=Cx(r,s,w);L.push(M[y[0]],M[y[1]])}if(H=[...H,{placement:r,overflows:L}],!L.every(y=>y<=0)){var j,R;const y=(((j=i.flip)==null?void 0:j.index)||0)+1,A=I[y];if(A&&(!(h==="alignment"?v!==tt(A):!1)||H.every(E=>tt(E.placement)===v?E.overflows[0]>0:!0)))return{data:{index:y,overflows:H},reset:{placement:A}};let T=(R=H.filter(S=>S.overflows[0]<=0).sort((S,E)=>S.overflows[1]-E.overflows[1])[0])==null?void 0:R.placement;if(!T)switch(f){case"bestFit":{var $;const S=($=H.filter(E=>{if(N){const P=tt(E.placement);return P===v||P==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(P=>P>0).reduce((P,_)=>P+_,0)]).sort((E,P)=>E[1]-P[1])[0])==null?void 0:$[0];S&&(T=S);break}case"initialPlacement":T=a;break}if(r!==T)return{reset:{placement:T}}}return{}}}},Vx=new Set(["left","top"]);async function Fx(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=mt(n),a=Ho(n),c=tt(n)==="y",l=Vx.has(s)?-1:1,u=i&&c?-1:1,h=zo(t,e);let{mainAxis:d,crossAxis:f,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),c?{x:f*u,y:d*l}:{x:d*l,y:f*u}}const Bx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:a}=t,c=await Fx(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:s}}}}},Wx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:b,y:v}=x;return{x:b,y:v}}},...c}=zo(e,t),l={x:n,y:o},u=await Ll(t,c),h=tt(mt(r)),d=Al(h);let f=l[d],p=l[h];if(i){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=f+u[x],m=f-u[b];f=Ml(v,f,m)}if(s){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=p+u[x],m=p-u[b];p=Ml(v,p,m)}const g=a.fn({...t,[d]:f,[h]:p});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[d]:i,[h]:s}}}}}};function $l(e){const t=Ce(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Ie(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,a=Lo(n)!==i||Lo(o)!==s;return a&&(n=i,o=s),{width:n,height:o,$:a}}function wi(e){return le(e)?e:e.contextElement}function Ft(e){const t=wi(e);if(!Ie(t))return je(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=$l(t);let s=(i?Lo(n.width):n.width)/o,a=(i?Lo(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Yx=je(0);function zl(e){const t=Ee(e);return!Oo()||!t.visualViewport?Yx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ee(e)?!1:t}function yt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=wi(e);let s=je(1);t&&(o?le(o)&&(s=Ft(o)):s=Ft(e));const a=Xx(i,n,o)?zl(i):je(0);let c=(r.left+a.x)/s.x,l=(r.top+a.y)/s.y,u=r.width/s.x,h=r.height/s.y;if(i){const d=Ee(i),f=o&&le(o)?Ee(o):o;let p=d,g=pi(p);for(;g&&o&&f!==p;){const x=Ft(g),b=g.getBoundingClientRect(),v=Ce(g),m=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*x.x,w=b.top+(g.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,l*=x.y,u*=x.x,h*=x.y,c+=m,l+=w,p=Ee(g),g=pi(p)}}return Vo({width:u,height:h,x:c,y:l})}function Wo(e,t){const n=Do(e).scrollLeft;return t?t.left+n:yt(He(e)).left+n}function Hl(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Wo(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Ux(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=r==="fixed",s=He(o),a=t?Po(t.floating):!1;if(o===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},l=je(1);const u=je(0),h=Ie(o);if((h||!h&&!i)&&((Ht(o)!=="body"||Nn(s))&&(c=Do(o)),Ie(o))){const f=yt(o);l=Ft(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const d=s&&!h&&!i?Hl(s,c):je(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+d.x,y:n.y*l.y-c.scrollTop*l.y+u.y+d.y}}function Gx(e){return Array.from(e.getClientRects())}function qx(e){const t=He(e),n=Do(e),o=e.ownerDocument.body,r=gt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=gt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Wo(e);const a=-n.scrollTop;return Ce(o).direction==="rtl"&&(s+=gt(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}const jl=25;function Zx(e,t){const n=Ee(e),o=He(e),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;const u=Oo();(!u||u&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}const l=Wo(o);if(l<=0){const u=o.ownerDocument,h=u.body,d=getComputedStyle(h),f=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,p=Math.abs(o.clientWidth-h.clientWidth-f);p<=jl&&(i-=p)}else l<=jl&&(i+=l);return{width:i,height:s,x:a,y:c}}const Kx=new Set(["absolute","fixed"]);function Qx(e,t){const n=yt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Ie(e)?Ft(e):je(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=r*i.x,l=o*i.y;return{width:s,height:a,x:c,y:l}}function Vl(e,t,n){let o;if(t==="viewport")o=Zx(e,n);else if(t==="document")o=qx(He(e));else if(le(t))o=Qx(t,n);else{const r=zl(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Vo(o)}function Fl(e,t){const n=Ge(e);return n===t||!le(n)||Ue(n)?!1:Ce(n).position==="fixed"||Fl(n,t)}function Jx(e,t){const n=t.get(e);if(n)return n;let o=et(e,[],!1).filter(a=>le(a)&&Ht(a)!=="body"),r=null;const i=Ce(e).position==="fixed";let s=i?Ge(e):e;for(;le(s)&&!Ue(s);){const a=Ce(s),c=hi(s);!c&&a.position==="fixed"&&(r=null),(i?!c&&!r:!c&&a.position==="static"&&!!r&&Kx.has(r.position)||Nn(s)&&!c&&Fl(e,s))?o=o.filter(u=>u!==s):r=a,s=Ge(s)}return t.set(e,o),o}function ew(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const s=[...n==="clippingAncestors"?Po(t)?[]:Jx(t,this._c):[].concat(n),o],a=s[0],c=s.reduce((l,u)=>{const h=Vl(t,u,r);return l.top=gt(h.top,l.top),l.right=Ro(h.right,l.right),l.bottom=Ro(h.bottom,l.bottom),l.left=gt(h.left,l.left),l},Vl(t,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function tw(e){const{width:t,height:n}=$l(e);return{width:t,height:n}}function nw(e,t,n){const o=Ie(t),r=He(t),i=n==="fixed",s=yt(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=je(0);function l(){c.x=Wo(r)}if(o||!o&&!i)if((Ht(t)!=="body"||Nn(r))&&(a=Do(t)),o){const f=yt(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else r&&l();i&&!o&&r&&l();const u=r&&!o&&!i?Hl(r,a):je(0),h=s.left+a.scrollLeft-c.x-u.x,d=s.top+a.scrollTop-c.y-u.y;return{x:h,y:d,width:s.width,height:s.height}}function bi(e){return Ce(e).position==="static"}function Bl(e,t){if(!Ie(e)||Ce(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return He(e)===n&&(n=n.ownerDocument.body),n}function Wl(e,t){const n=Ee(e);if(Po(e))return n;if(!Ie(e)){let r=Ge(e);for(;r&&!Ue(r);){if(le(r)&&!bi(r))return r;r=Ge(r)}return n}let o=Bl(e,t);for(;o&&gx(o)&&bi(o);)o=Bl(o,t);return o&&Ue(o)&&bi(o)&&!hi(o)?n:o||bx(e)||n}const ow=async function(e){const t=this.getOffsetParent||Wl,n=this.getDimensions,o=await n(e.floating);return{reference:nw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function rw(e){return Ce(e).direction==="rtl"}const iw={convertOffsetParentRelativeRectToViewportRelativeRect:Ux,getDocumentElement:He,getClippingRect:ew,getOffsetParent:Wl,getElementRects:ow,getClientRects:Gx,getDimensions:tw,getScale:Ft,isElement:le,isRTL:rw};function Yl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sw(e,t){let n=null,o;const r=He(e);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const l=e.getBoundingClientRect(),{left:u,top:h,width:d,height:f}=l;if(a||t(),!d||!f)return;const p=$o(h),g=$o(r.clientWidth-(u+d)),x=$o(r.clientHeight-(h+f)),b=$o(u),m={rootMargin:-p+"px "+-g+"px "+-x+"px "+-b+"px",threshold:gt(0,Ro(1,c))||1};let w=!0;function k(N){const I=N[0].intersectionRatio;if(I!==c){if(!w)return s();I?s(!1,I):o=setTimeout(()=>{s(!1,1e-7)},1e3)}I===1&&!Yl(l,e.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(k,{...m,root:r.ownerDocument})}catch{n=new IntersectionObserver(k,m)}n.observe(e)}return s(!0),i}function Xl(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=wi(e),u=r||i?[...l?et(l):[],...et(t)]:[];u.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=l&&a?sw(l,n):null;let d=-1,f=null;s&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var m;(m=f)==null||m.observe(t)})),n()}),l&&!c&&f.observe(l),f.observe(t));let p,g=c?yt(e):null;c&&x();function x(){const b=yt(e);g&&!Yl(g,b)&&n(),g=b,p=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),h?.(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(p)}}const aw=Bx,cw=Wx,lw=jx,uw=(e,t,n)=>{const o=new Map,r={platform:iw,...n},i={...r.platform,_c:o};return Hx(e,t,{...r,platform:i})};var dw=typeof document<"u",fw=function(){},Yo=dw?O.useLayoutEffect:fw;function Xo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Xo(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!Xo(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Ul(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gl(e,t){const n=Ul(e);return Math.round(t*n)/n}function vi(e){const t=U.useRef(e);return Yo(()=>{t.current=e}),t}function hw(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,h]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,f]=U.useState(o);Xo(d,o)||f(o);const[p,g]=U.useState(null),[x,b]=U.useState(null),v=U.useCallback(E=>{E!==N.current&&(N.current=E,g(E))},[]),m=U.useCallback(E=>{E!==I.current&&(I.current=E,b(E))},[]),w=i||p,k=s||x,N=U.useRef(null),I=U.useRef(null),M=U.useRef(u),L=c!=null,H=vi(c),j=vi(r),R=vi(l),$=U.useCallback(()=>{if(!N.current||!I.current)return;const E={placement:t,strategy:n,middleware:d};j.current&&(E.platform=j.current),uw(N.current,I.current,E).then(P=>{const _={...P,isPositioned:R.current!==!1};y.current&&!Xo(M.current,_)&&(M.current=_,Mu.flushSync(()=>{h(_)}))})},[d,t,n,j,R]);Yo(()=>{l===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,h(E=>({...E,isPositioned:!1})))},[l]);const y=U.useRef(!1);Yo(()=>(y.current=!0,()=>{y.current=!1}),[]),Yo(()=>{if(w&&(N.current=w),k&&(I.current=k),w&&k){if(H.current)return H.current(w,k,$);$()}},[w,k,$,H,L]);const A=U.useMemo(()=>({reference:N,floating:I,setReference:v,setFloating:m}),[v,m]),T=U.useMemo(()=>({reference:w,floating:k}),[w,k]),S=U.useMemo(()=>{const E={position:n,left:0,top:0};if(!T.floating)return E;const P=Gl(T.floating,u.x),_=Gl(T.floating,u.y);return a?{...E,transform:"translate("+P+"px, "+_+"px)",...Ul(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:_}},[n,a,T.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:$,refs:A,elements:T,floatingStyles:S}),[u,$,A,T,S])}const ql=(e,t)=>({...aw(e),options:[e,t]}),Zl=(e,t)=>({...cw(e),options:[e,t]}),Kl=(e,t)=>({...lw(e),options:[e,t]}),pw="data-floating-ui-focusable",Ql="active",Jl="selected",gw={...U};let eu=!1,mw=0;const tu=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+mw++;function yw(){const[e,t]=U.useState(()=>eu?tu():void 0);return Vt(()=>{e==null&&t(tu())},[]),U.useEffect(()=>{eu=!0},[]),e}const xw=gw.useId||yw;let Ei;process.env.NODE_ENV!=="production"&&(Ei=new Set);function ww(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];const r="Floating UI: "+n.join(" ");if(!((e=Ei)!=null&&e.has(r))){var i;(i=Ei)==null||i.add(r),console.error(r)}}function bw(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var o;(o=e.get(t))==null||o.delete(n)}}}const vw=U.createContext(null),Ew=U.createContext(null),nu=()=>{var e;return((e=U.useContext(vw))==null?void 0:e.id)||null},_i=()=>U.useContext(Ew);function ou(e){return"data-floating-ui-"+e}function _e(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const ru=ou("safe-polygon");function Si(e,t,n){if(n&&!xi(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function Ci(e){return typeof e=="function"?e():e}function _w(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:r,events:i,elements:s}=e,{enabled:a=!0,delay:c=0,handleClose:l=null,mouseOnly:u=!1,restMs:h=0,move:d=!0}=t,f=_i(),p=nu(),g=Bo(l),x=Bo(c),b=Bo(n),v=Bo(h),m=U.useRef(),w=U.useRef(-1),k=U.useRef(),N=U.useRef(-1),I=U.useRef(!0),M=U.useRef(!1),L=U.useRef(()=>{}),H=U.useRef(!1),j=Ve(()=>{var S;const E=(S=r.current.openEvent)==null?void 0:S.type;return E?.includes("mouse")&&E!=="mousedown"});U.useEffect(()=>{if(!a)return;function S(E){let{open:P}=E;P||(_e(w),_e(N),I.current=!0,H.current=!1)}return i.on("openchange",S),()=>{i.off("openchange",S)}},[a,i]),U.useEffect(()=>{if(!a||!g.current||!n)return;function S(P){j()&&o(!1,P,"hover")}const E=jt(s.floating).documentElement;return E.addEventListener("mouseleave",S),()=>{E.removeEventListener("mouseleave",S)}},[s.floating,n,o,a,g,j]);const R=U.useCallback(function(S,E,P){E===void 0&&(E=!0),P===void 0&&(P="hover");const _=Si(x.current,"close",m.current);_&&!k.current?(_e(w),w.current=window.setTimeout(()=>o(!1,S,P),_)):E&&(_e(w),o(!1,S,P))},[x,o]),$=Ve(()=>{L.current(),k.current=void 0}),y=Ve(()=>{if(M.current){const S=jt(s.floating).body;S.style.pointerEvents="",S.removeAttribute(ru),M.current=!1}}),A=Ve(()=>r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1);U.useEffect(()=>{if(!a)return;function S(z){if(_e(w),I.current=!1,u&&!xi(m.current)||Ci(v.current)>0&&!Si(x.current,"open"))return;const F=Si(x.current,"open",m.current);F?w.current=window.setTimeout(()=>{b.current||o(!0,z,"hover")},F):n||o(!0,z,"hover")}function E(z){if(A()){y();return}L.current();const F=jt(s.floating);if(_e(N),H.current=!1,g.current&&r.current.floatingContext){n||_e(w),k.current=g.current({...r.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){y(),$(),A()||R(z,!0,"safe-polygon")}});const Y=k.current;F.addEventListener("mousemove",Y),L.current=()=>{F.removeEventListener("mousemove",Y)};return}(m.current==="touch"?!mi(s.floating,z.relatedTarget):!0)&&R(z)}function P(z){A()||r.current.floatingContext&&(g.current==null||g.current({...r.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){y(),$(),A()||R(z)}})(z))}function _(){_e(w)}function D(z){A()||R(z,!1)}if(le(s.domReference)){const z=s.domReference,F=s.floating;return n&&z.addEventListener("mouseleave",P),d&&z.addEventListener("mousemove",S,{once:!0}),z.addEventListener("mouseenter",S),z.addEventListener("mouseleave",E),F&&(F.addEventListener("mouseleave",P),F.addEventListener("mouseenter",_),F.addEventListener("mouseleave",D)),()=>{n&&z.removeEventListener("mouseleave",P),d&&z.removeEventListener("mousemove",S),z.removeEventListener("mouseenter",S),z.removeEventListener("mouseleave",E),F&&(F.removeEventListener("mouseleave",P),F.removeEventListener("mouseenter",_),F.removeEventListener("mouseleave",D))}}},[s,a,e,u,d,R,$,y,o,n,b,f,x,g,r,A,v]),Vt(()=>{var S;if(a&&n&&(S=g.current)!=null&&(S=S.__options)!=null&&S.blockPointerEvents&&j()){M.current=!0;const P=s.floating;if(le(s.domReference)&&P){var E;const _=jt(s.floating).body;_.setAttribute(ru,"");const D=s.domReference,z=f==null||(E=f.nodesRef.current.find(F=>F.id===p))==null||(E=E.context)==null?void 0:E.elements.floating;return z&&(z.style.pointerEvents=""),_.style.pointerEvents="none",D.style.pointerEvents="auto",P.style.pointerEvents="auto",()=>{_.style.pointerEvents="",D.style.pointerEvents="",P.style.pointerEvents=""}}}},[a,n,p,s,f,g,j]),Vt(()=>{n||(m.current=void 0,H.current=!1,$(),y())},[n,$,y]),U.useEffect(()=>()=>{$(),_e(w),_e(N),y()},[a,s.domReference,$,y]);const T=U.useMemo(()=>{function S(E){m.current=E.pointerType}return{onPointerDown:S,onPointerEnter:S,onMouseMove(E){const{nativeEvent:P}=E;function _(){!I.current&&!b.current&&o(!0,P,"hover")}u&&!xi(m.current)||n||Ci(v.current)===0||H.current&&E.movementX**2+E.movementY**2<2||(_e(N),m.current==="touch"?_():(H.current=!0,N.current=window.setTimeout(_,Ci(v.current))))}}},[u,o,n,b,v]);return U.useMemo(()=>a?{reference:T}:{},[a,T])}function Ni(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Io(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Sw(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Cw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Nw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},iu=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function kw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,elements:r,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:l="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:d=!1,bubbles:f,capture:p}=t,g=_i(),x=Ve(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=U.useRef(!1),{escapeKey:m,outsidePress:w}=iu(f),{escapeKey:k,outsidePress:N}=iu(p),I=U.useRef(!1),M=Ve(y=>{var A;if(!n||!s||!a||y.key!=="Escape"||I.current)return;const T=(A=i.current.floatingContext)==null?void 0:A.nodeId,S=g?Fo(g.nodesRef.current,T):[];if(!m&&(y.stopPropagation(),S.length>0)){let E=!0;if(S.forEach(P=>{var _;if((_=P.context)!=null&&_.open&&!P.context.dataRef.current.__escapeKeyBubbles){E=!1;return}}),!E)return}o(!1,Dx(y)?y.nativeEvent:y,"escape-key")}),L=Ve(y=>{var A;const T=()=>{var S;M(y),(S=kn(y))==null||S.removeEventListener("keydown",T)};(A=kn(y))==null||A.addEventListener("keydown",T)}),H=Ve(y=>{var A;const T=i.current.insideReactTree;i.current.insideReactTree=!1;const S=v.current;if(v.current=!1,l==="click"&&S||T||typeof b=="function"&&!b(y))return;const E=kn(y),P="["+ou("inert")+"]",_=jt(r.floating).querySelectorAll(P);let D=le(E)?E:null;for(;D&&!Ue(D);){const Y=Ge(D);if(Ue(Y)||!le(Y))break;D=Y}if(_.length&&le(E)&&!Ox(E)&&!mi(E,r.floating)&&Array.from(_).every(Y=>!mi(D,Y)))return;if(Ie(E)&&$){const Y=Ue(E),K=Ce(E),W=/auto|scroll/,V=Y||W.test(K.overflowX),X=Y||W.test(K.overflowY),J=V&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,te=X&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,Z=K.direction==="rtl",oe=te&&(Z?y.offsetX<=E.offsetWidth-E.clientWidth:y.offsetX>E.clientWidth),ne=J&&y.offsetY>E.clientHeight;if(oe||ne)return}const z=(A=i.current.floatingContext)==null?void 0:A.nodeId,F=g&&Fo(g.nodesRef.current,z).some(Y=>{var K;return yi(y,(K=Y.context)==null?void 0:K.elements.floating)});if(yi(y,r.floating)||yi(y,r.domReference)||F)return;const B=g?Fo(g.nodesRef.current,z):[];if(B.length>0){let Y=!0;if(B.forEach(K=>{var W;if((W=K.context)!=null&&W.open&&!K.context.dataRef.current.__outsidePressBubbles){Y=!1;return}}),!Y)return}o(!1,y,"outside-press")}),j=Ve(y=>{var A;const T=()=>{var S;H(y),(S=kn(y))==null||S.removeEventListener(l,T)};(A=kn(y))==null||A.addEventListener(l,T)});U.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=m,i.current.__outsidePressBubbles=w;let y=-1;function A(_){o(!1,_,"ancestor-scroll")}function T(){window.clearTimeout(y),I.current=!0}function S(){y=window.setTimeout(()=>{I.current=!1},Oo()?5:0)}const E=jt(r.floating);a&&(E.addEventListener("keydown",k?L:M,k),E.addEventListener("compositionstart",T),E.addEventListener("compositionend",S)),b&&E.addEventListener(l,N?j:H,N);let P=[];return d&&(le(r.domReference)&&(P=et(r.domReference)),le(r.floating)&&(P=P.concat(et(r.floating))),!le(r.reference)&&r.reference&&r.reference.contextElement&&(P=P.concat(et(r.reference.contextElement)))),P=P.filter(_=>{var D;return _!==((D=E.defaultView)==null?void 0:D.visualViewport)}),P.forEach(_=>{_.addEventListener("scroll",A,{passive:!0})}),()=>{a&&(E.removeEventListener("keydown",k?L:M,k),E.removeEventListener("compositionstart",T),E.removeEventListener("compositionend",S)),b&&E.removeEventListener(l,N?j:H,N),P.forEach(_=>{_.removeEventListener("scroll",A)}),window.clearTimeout(y)}},[i,r,a,b,l,n,o,d,s,m,w,M,k,L,H,N,j]),U.useEffect(()=>{i.current.insideReactTree=!1},[i,b,l]);const R=U.useMemo(()=>({onKeyDown:M,...u&&{[Cw[h]]:y=>{o(!1,y.nativeEvent,"reference-press")},...h!=="click"&&{onClick(y){o(!1,y.nativeEvent,"reference-press")}}}}),[M,o,u,h]),$=U.useMemo(()=>({onKeyDown:M,onMouseDown(){v.current=!0},onMouseUp(){v.current=!0},[Nw[l]]:()=>{i.current.insideReactTree=!0}}),[M,l,i]);return U.useMemo(()=>s?{reference:R,floating:$}:{},[s,R,$])}function Tw(e){const{open:t=!1,onOpenChange:n,elements:o}=e,r=xw(),i=U.useRef({}),[s]=U.useState(()=>bw()),a=nu()!=null;if(process.env.NODE_ENV!=="production"){const f=o.reference;f&&!le(f)&&ww("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[c,l]=U.useState(o.reference),u=Ve((f,p,g)=>{i.current.openEvent=f?p:void 0,s.emit("openchange",{open:f,event:p,reason:g,nested:a}),n?.(f,p,g)}),h=U.useMemo(()=>({setPositionReference:l}),[]),d=U.useMemo(()=>({reference:c||o.reference||null,floating:o.floating||null,domReference:o.reference}),[c,o.reference,o.floating]);return U.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:d,events:s,floatingId:r,refs:h}),[t,u,d,s,r,h])}function su(e){e===void 0&&(e={});const{nodeId:t}=e,n=Tw({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,r=o.elements,[i,s]=U.useState(null),[a,c]=U.useState(null),u=r?.domReference||i,h=U.useRef(null),d=_i();Vt(()=>{u&&(h.current=u)},[u]);const f=hw({...e,elements:{...r,...a&&{reference:a}}}),p=U.useCallback(m=>{const w=le(m)?{getBoundingClientRect:()=>m.getBoundingClientRect(),getClientRects:()=>m.getClientRects(),contextElement:m}:m;c(w),f.refs.setReference(w)},[f.refs]),g=U.useCallback(m=>{(le(m)||m===null)&&(h.current=m,s(m)),(le(f.refs.reference.current)||f.refs.reference.current===null||m!==null&&!le(m))&&f.refs.setReference(m)},[f.refs]),x=U.useMemo(()=>({...f.refs,setReference:g,setPositionReference:p,domReference:h}),[f.refs,g,p]),b=U.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),v=U.useMemo(()=>({...f,...o,refs:x,elements:b,nodeId:t}),[f,x,b,t,o]);return Vt(()=>{o.dataRef.current.floatingContext=v;const m=d?.nodesRef.current.find(w=>w.id===t);m&&(m.context=v)}),U.useMemo(()=>({...f,context:v,refs:x,elements:b}),[f,x,b,v])}function ki(e,t,n){const o=new Map,r=n==="item";let i=e;if(r&&e){const{[Ql]:s,[Jl]:a,...c}=e;i=c}return{...n==="floating"&&{tabIndex:-1,[pw]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(c=>{let[l,u]=c;if(!(r&&[Ql,Jl].includes(l)))if(l.indexOf("on")===0){if(o.has(l)||o.set(l,[]),typeof u=="function"){var h;(h=o.get(l))==null||h.push(u),s[l]=function(){for(var d,f=arguments.length,p=new Array(f),g=0;g<f;g++)p[g]=arguments[g];return(d=o.get(l))==null?void 0:d.map(x=>x(...p)).find(x=>x!==void 0)}}}else s[l]=u}),s),{})}}function au(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),o=e.map(a=>a?.item),r=U.useCallback(a=>ki(a,e,"reference"),t),i=U.useCallback(a=>ki(a,e,"floating"),n),s=U.useCallback(a=>ki(a,e,"item"),o);return U.useMemo(()=>({getReferenceProps:r,getFloatingProps:i,getItemProps:s}),[r,i,s])}function cu(e,t,n){return n===void 0&&(n=!0),e.filter(r=>{var i;return r.parentId===t&&(!n||((i=r.context)==null?void 0:i.open))}).flatMap(r=>[r,...cu(e,r.id,n)])}function lu(e,t){const[n,o]=e;let r=!1;const i=t.length;for(let s=0,a=i-1;s<i;a=s++){const[c,l]=t[s]||[0,0],[u,h]=t[a]||[0,0];l>=o!=h>=o&&n<=(u-c)*(o-l)/(h-l)+c&&(r=!r)}return r}function Mw(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Aw(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r={current:-1};let i=!1,s=null,a=null,c=typeof performance<"u"?performance.now():0;function l(h,d){const f=performance.now(),p=f-c;if(s===null||a===null||p===0)return s=h,a=d,c=f,null;const g=h-s,x=d-a,v=Math.sqrt(g*g+x*x)/p;return s=h,a=d,c=f,v}const u=h=>{let{x:d,y:f,placement:p,elements:g,onClose:x,nodeId:b,tree:v}=h;return function(w){function k(){_e(r),x()}if(_e(r),!g.domReference||!g.floating||p==null||d==null||f==null)return;const{clientX:N,clientY:I}=w,M=[N,I],L=Sw(w),H=w.type==="mouseleave",j=Ni(g.floating,L),R=Ni(g.domReference,L),$=g.domReference.getBoundingClientRect(),y=g.floating.getBoundingClientRect(),A=p.split("-")[0],T=d>y.right-y.width/2,S=f>y.bottom-y.height/2,E=Mw(M,$),P=y.width>$.width,_=y.height>$.height,D=(P?$:y).left,z=(P?$:y).right,F=(_?$:y).top,B=(_?$:y).bottom;if(j&&(i=!0,!H))return;if(R&&(i=!1),R&&!H){i=!0;return}if(H&&le(w.relatedTarget)&&Ni(g.floating,w.relatedTarget)||v&&cu(v.nodesRef.current,b).length)return;if(A==="top"&&f>=$.bottom-1||A==="bottom"&&f<=$.top+1||A==="left"&&d>=$.right-1||A==="right"&&d<=$.left+1)return k();let Y=[];switch(A){case"top":Y=[[D,$.top+1],[D,y.bottom-1],[z,y.bottom-1],[z,$.top+1]];break;case"bottom":Y=[[D,y.top+1],[D,$.bottom-1],[z,$.bottom-1],[z,y.top+1]];break;case"left":Y=[[y.right-1,B],[y.right-1,F],[$.left+1,F],[$.left+1,B]];break;case"right":Y=[[$.right-1,B],[$.right-1,F],[y.left+1,F],[y.left+1,B]];break}function K(W){let[V,X]=W;switch(A){case"top":{const J=[P?V+t/2:T?V+t*4:V-t*4,X+t+1],te=[P?V-t/2:T?V+t*4:V-t*4,X+t+1],Z=[[y.left,T||P?y.bottom-t:y.top],[y.right,T?P?y.bottom-t:y.top:y.bottom-t]];return[J,te,...Z]}case"bottom":{const J=[P?V+t/2:T?V+t*4:V-t*4,X-t],te=[P?V-t/2:T?V+t*4:V-t*4,X-t],Z=[[y.left,T||P?y.top+t:y.bottom],[y.right,T?P?y.top+t:y.bottom:y.top+t]];return[J,te,...Z]}case"left":{const J=[V+t+1,_?X+t/2:S?X+t*4:X-t*4],te=[V+t+1,_?X-t/2:S?X+t*4:X-t*4];return[...[[S||_?y.right-t:y.left,y.top],[S?_?y.right-t:y.left:y.right-t,y.bottom]],J,te]}case"right":{const J=[V-t,_?X+t/2:S?X+t*4:X-t*4],te=[V-t,_?X-t/2:S?X+t*4:X-t*4],Z=[[S||_?y.left+t:y.right,y.top],[S?_?y.left+t:y.right:y.left+t,y.bottom]];return[J,te,...Z]}}}if(!lu([N,I],Y)){if(i&&!E)return k();if(!H&&o){const W=l(w.clientX,w.clientY);if(W!==null&&W<.1)return k()}lu([N,I],K([d,f]))?!i&&o&&(r.current=window.setTimeout(k,40)):k()}}};return u.__options={blockPointerEvents:n},u}const uu=({subItems:e,onItemClick:t,className:n})=>{const[,o]=O.useState(null),r=i=>{i.onClick&&i.onClick(),t&&t(i)};return C.jsx("ul",{className:se("min-w-48 bg-[#181818] border border-none rounded-md shadow-lg py-1",n),children:e.map((i,s)=>C.jsx(Iw,{item:i,index:s,onItemClick:r,onItemClickCallback:t,setHoveredItemId:o},i.id))})},Iw=({item:e,index:t,onItemClick:n,onItemClickCallback:o,setHoveredItemId:r})=>{const[i,s]=O.useState(!1),{refs:a,floatingStyles:c,context:l}=su({open:i,onOpenChange:s,placement:"right-start",middleware:[ql(5),Kl({fallbackPlacements:["left-start"]}),Zl({padding:8})],whileElementsMounted:Xl}),u=_w(l,{handleClose:Aw(),delay:{open:75,close:75}}),{getReferenceProps:h,getFloatingProps:d}=au([u]),f=()=>{r(e.id),e.subItems&&e.subItems.length>0&&s(!0)},p=()=>{};return C.jsxs("li",{className:"relative",children:[e.separator&&t>0&&C.jsx("div",{className:"border-t border-gray-600 m-0"}),C.jsxs("div",{ref:a.setReference,className:se("flex items-center justify-between gap-2 px-3 py-1.25 hover:bg-[#3F3F3F] cursor-pointer","transition-colors duration-150"),onClick:()=>n(e),onMouseEnter:f,onMouseLeave:p,...h(),children:[C.jsxs("div",{className:"flex items-center gap-2",children:[e.icon&&C.jsx("span",{className:"text-primary-white w-3 h-3 flex items-center justify-center",children:e.icon}),C.jsx("span",{className:"text-sm leading-3.5 text-primary-white font-main",children:e.label})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[e.shortcut&&C.jsx("span",{className:"text-sm leading-3.5 text-gray-400 font-mono",children:e.shortcut}),e.subItems&&e.subItems.length>0&&C.jsx(Nl,{className:"w-3 h-3 text-gray-400"})]})]}),e.subItems&&e.subItems.length>0&&i&&C.jsx("div",{ref:a.setFloating,style:{...c,contain:"layout",willChange:"transform"},className:"z-50",...d(),children:C.jsx(uu,{subItems:e.subItems,onItemClick:o,className:"ml-1"})})]})},du=({subItems:e,className:t,onItemClick:n})=>C.jsx("div",{className:se("relative",t),children:C.jsx(uu,{subItems:e,onItemClick:n})});function fu({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:ze.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:O.createElement(fx,{className:"w-4 h-4"}),subItems:i}]}const ae=["circle","square","rectangle","list","grid","diamond","trapezium","hexagon","star","cross","zigzag","sparkle","parallelogram"],pe={[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]},Uo=(e,t,n,o="black",r=2)=>C.jsxs("div",{className:se("relative",n),children:[C.jsx("div",{className:"absolute",style:{top:-r,left:-r,right:-r,bottom:-r,backgroundColor:o,clipPath:e}}),C.jsx("div",{className:"absolute inset-0",style:{backgroundColor:t,clipPath:e}})]}),hu=(e=pe.circle,t="#A1A1A1",n)=>{const o="border-2 border-black",r="border-1 border-black",i={backgroundColor:t};switch(e){case pe.circle:return C.jsx("div",{className:se("w-6 h-6 rounded-full",o,n),style:i});case pe.square:return C.jsx("div",{className:se("w-6 h-6",o,n),style:i});case pe.rectangle:return C.jsx("div",{className:se("w-4 h-8",o,n),style:i});case pe.list:return C.jsx("div",{className:se("w-6 h-6 flex flex-col justify-center gap-0.5",n),children:[0,1,2].map(s=>C.jsx("div",{className:se("w-full h-2",r),style:i},s))});case pe.grid:return C.jsx("div",{className:se("w-6 h-6 grid grid-cols-2 gap-0.5",n),children:[0,1,2,3].map(s=>C.jsx("div",{className:se("w-full h-full",r),style:i},s))});case pe.diamond:return C.jsx("div",{className:se("w-6 h-6 rotate-45",o,n),style:i});case pe.trapezium:return Uo("polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%)",t,se("w-6 h-6",n));case pe.hexagon:return Uo("polygon(-50% 50%,50% 100%,150% 50%,50% 0)",t,se("w-5 h-6",n));case pe.star:return Uo("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 pe.cross:return C.jsxs("div",{className:se("w-6 h-6 relative",n),children:[C.jsx("div",{className:se("absolute top-1/2 left-0 w-full h-2 -translate-y-1/2",r),style:i}),C.jsx("div",{className:se("absolute left-1/2 top-0 w-2 h-full -translate-x-1/2",r),style:i})]});case pe.zigzag:return C.jsx("div",{className:se("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 pe.sparkle:return C.jsx("div",{className:se("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 pe.parallelogram:return Uo("polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)",t,se("w-6 h-6",n));default:return C.jsx("div",{className:se("w-6 h-6 rounded-full",o,n),style:i})}},Go=O.forwardRef(({type:e,position:t,id:n,color:o,shape:r=pe.circle,isCurrentlyInsideReactFlow:i=!1,className:s,...a},c)=>i?C.jsx(vn,{type:e,position:t,id:n,className:se("!w-6 !h-6 !border-none !bg-transparent !pointer-events-auto",s),style:{backgroundColor:"transparent"},...a,ref:c,children:C.jsx("div",{className:se("pointer-events-none flex justify-center"),children:hu(r,o||"#A1A1A1",s)})}):C.jsx("div",{className:se("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:c,children:hu(r,o||"#A1A1A1",s)}));Go.displayName="ContextAwareHandle";const pu=({input:e})=>{const t=bn(),n=No();return e.type==="string"?C.jsx(Sn,{placeholder:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(i=>i.id===n?{...i,data:wl(e.id,i.data,{value:o})}:i))},allowOnlyNumbers:!1,className:"w-full"}):C.jsx(Mo,{name:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(r=>r.map(i=>i.id===n?{...i,data:wl(e.id,i.data,{value:o})}:i))},className:"w-full"})},gu=({input:e,isCurrentlyInsideReactFlow:t})=>t?C.jsx(pu,{input:e}):e.type==="string"?C.jsx(Sn,{placeholder:e.name,value:e.value,onChange:e.onChange,allowOnlyNumbers:!1,className:"w-full"}):C.jsx(Mo,{name:e.name,value:e.value,onChange:e.onChange,className:"w-full"}),Ti=O.forwardRef(({input:e,isCurrentlyInsideReactFlow:t,hide:n=!1},o)=>{const r=t?x0({handleId:e.id}):[],i=t&&r.some(a=>a.targetHandle===e.id),s=e.allowInput&&!i;return C.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",s&&"py-1"),children:[C.jsx(Go,{type:"target",position:Q.Left,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t}),C.jsxs("div",{className:"flex-1 flex items-center gap-3 w-full",children:[!s&&C.jsx("div",{className:"truncate",children:e.name}),s&&C.jsx("div",{className:"flex-1 w-full",children:C.jsx(gu,{input:e,isCurrentlyInsideReactFlow:t})})]})]},e.id)});Ti.displayName="RenderInput";const mu=O.forwardRef(({output:e,isCurrentlyInsideReactFlow:t},n)=>C.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:[C.jsx("div",{className:"truncate text-right",children:e.name}),C.jsx(Go,{type:"source",position:Q.Right,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t})]},e.id));mu.displayName="RenderOutput";const yu=O.forwardRef(({panel:e,isCurrentlyInsideReactFlow:t,isOpen:n,onToggle:o},r)=>C.jsxs("div",{ref:r,className:"flex flex-col",children:[C.jsxs(vt,{onClick:i=>{i.stopPropagation(),i.preventDefault(),o()},className:"bg-transparent border-none hover:bg-primary-gray rounded-none justify-start",children:[n?C.jsx(dx,{className:"w-6 h-6 flex-shrink-0 mr-2"}):C.jsx(lx,{className:"w-6 h-6 flex-shrink-0 mr-2"}),C.jsx("span",{className:"truncate",children:e.name})]}),C.jsx("div",{className:se("flex flex-col bg-[#272727]",!n&&"h-0 overflow-hidden"),children:e.inputs.map(i=>C.jsx(Ti,{input:i,isCurrentlyInsideReactFlow:t,hide:!n},i.id))})]},e.id));yu.displayName="RenderInputPanel";const Mi=O.forwardRef(({name:e="Node",headerColor:t="#79461D",inputs:n=[],outputs:o=[],isCurrentlyInsideReactFlow:r=!1,className:i,nodeResizerProps:s={},...a},c)=>{const[l,u]=O.useState(new Set),h=d=>{u(f=>{const p=new Set(f);return p.has(d)?p.delete(d):p.add(d),p})};return C.jsxs("div",{tabIndex:0,className:se("flex flex-col gap-0 rounded-md w-max border-[1.5px] border-transparent focus:border-white","in-[.selected]:border-white",i),...a,ref:c,children:[C.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}),C.jsxs("div",{className:"min-h-[50px] rounded-b-md bg-primary-dark-gray",children:[r&&C.jsx(El,{...s}),C.jsx("div",{className:"flex flex-col py-4",children:o.map(d=>C.jsx(mu,{output:d,isCurrentlyInsideReactFlow:r},d.id))}),C.jsx("div",{className:"flex flex-col py-4",children:n.map(d=>{if("inputs"in d){const f=l.has(d.id);return C.jsx(yu,{panel:d,isCurrentlyInsideReactFlow:r,isOpen:f,onToggle:()=>h(d.id)},d.id)}else return C.jsx(Ti,{input:d,isCurrentlyInsideReactFlow:r},d.id)})})]})]})});Mi.displayName="ConfigurableNode";const Ai=O.forwardRef(({data:e={}},t)=>C.jsx(Mi,{isCurrentlyInsideReactFlow:!0,className:"w-full",...e,ref:t}));Ai.displayName="ConfigurableNodeReactFlowWrapper";const xu=({fromX:e,fromY:t,toX:n,toY:o,fromPosition:r,toPosition:i})=>{const{fromHandle:s}=nl(),a=si(s?.nodeId||""),c=O.useMemo(()=>!s?.id||!a?.data?void 0:ui(s?.id,a?.data)?.handleColor??"#A1A1A1",[s?.id,a?.data]),[l]=mo({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:i});return C.jsx($t,{path:l,className:"!stroke-7 in-[g.selected]:brightness-150",style:{stroke:c||"#A1A1A1"},focusable:!0})};xu.displayName="ConfigurableConnection";const Pw={configurableNode:Ai},Ow={configurableEdge:fi};function Dw(e){const[t,n]=O.useReducer(xl,e);return{state:t,dispatch:n}}function Rw({state:e,dispatch:t}){const[n,o]=O.useState({isOpen:!1,position:{x:0,y:0}}),{screenToFlowPosition:r}=bn(),{refs:i,floatingStyles:s,context:a}=su({open:n.isOpen,onOpenChange:f=>{f||o({isOpen:!1,position:{x:0,y:0}})},placement:"bottom-start",middleware:[ql(5),Kl({fallbackPlacements:["top-start"]}),Zl({padding:8})],whileElementsMounted:Xl}),c=kw(a),{getFloatingProps:l}=au([c]),u=fu({typeOfNodes:e.typeOfNodes,dispatch:t,setContextMenu:o,contextMenuPosition:r(n.position)}),h=O.useCallback(f=>{f.preventDefault();const p={x:f.clientX,y:f.clientY};i.setReference&&i.setReference({getBoundingClientRect:()=>({x:p.x,y:p.y,width:1,height:1,top:p.y,right:p.x+1,bottom:p.y+1,left:p.x})}),o({isOpen:!0,position:p})},[i]),d=O.useCallback(()=>{o({isOpen:!1,position:{x:0,y:0}})},[]);return C.jsxs("div",{style:{width:"100%",height:"100%"},children:[C.jsxs(m0,{nodes:e.nodes,edges:e.edges,onNodesChange:f=>t({type:ze.UPDATE_NODE_BY_REACT_FLOW,payload:{changes:f}}),onEdgesChange:f=>t({type:ze.UPDATE_EDGES_BY_REACT_FLOW,payload:{changes:f}}),onConnect:f=>t({type:ze.ADD_EDGE_BY_REACT_FLOW,payload:{edge:f}}),fitView:!0,fitViewOptions:{maxZoom:.5,minZoom:.1},maxZoom:1,minZoom:.1,proOptions:{hideAttribution:!0},colorMode:"dark",selectNodesOnDrag:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectionMode:At.Partial,nodeTypes:Pw,edgeTypes:Ow,deleteKeyCode:["Backspace","Delete","x"],connectionLineComponent:xu,onContextMenu:h,onClick:d,children:[C.jsx(A0,{}),C.jsx(_0,{}),C.jsx(B0,{pannable:!0})]}),n.isOpen&&C.jsx("div",{ref:i.setFloating,style:{...s,contain:"layout",willChange:"transform"},className:"z-50",onClick:f=>f.stopPropagation(),...l(),children:C.jsx(du,{subItems:u})})]})}function Lw({state:e,dispatch:t}){return C.jsx(al,{children:C.jsx(Rw,{state:e,dispatch:t})})}ee.Button=vt,ee.ConfigurableEdge=fi,ee.ConfigurableNode=Mi,ee.ConfigurableNodeReactFlowWrapper=Ai,ee.ContextAwareHandle=Go,ee.ContextAwareInput=gu,ee.ContextMenu=du,ee.FullGraph=Lw,ee.Input=Sn,ee.NodeResizerWithMoreControls=El,ee.ReactFlowAwareInput=pu,ee.SliderNumberInput=Mo,ee.actionTypesMap=ze,ee.addEdgeWithTypeChecking=pl,ee.cn=se,ee.constructInputOrOutputOfType=pt,ee.constructInputPanelOfType=fl,ee.constructNodeOfType=li,ee.constructTypeOfHandleFromIndices=hl,ee.convertStringToNumber=rs,ee.createNodeContextMenu=fu,ee.getResultantDataTypeOfHandleConsideringInferredType=En,ee.handleShapesMap=pe,ee.isCoordinateInBox=os,ee.isNumberInRange=ir,ee.isSupportedUnderlyingType=_d,ee.isValidDataTypeId=Cd,ee.isValidNodeTypeUniqueId=kd,ee.mainReducer=xl,ee.makeAllowedConversionsBetweenDataTypesWithAutoInfer=Md,ee.makeDataTypeWithAutoInfer=Sd,ee.makeNodeIdToNodeTypeWithAutoInfer=Td,ee.makeStateWithAutoInfer=Ad,ee.makeTypeOfNodeWithAutoInfer=Nd,ee.removeEdgeWithTypeChecking=gl,ee.sanitizeNumberToShowAsText=sr,ee.supportedUnderlyingTypesMap=is,ee.useClickedOutside=vl,ee.useDrag=_l,ee.useFullGraph=Dw,ee.willAddingEdgeCreateCycle=ml,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
107
107
  //# sourceMappingURL=react-blender-nodes.umd.js.map