@theclearsky/react-blender-nodes 0.0.8 → 0.0.10

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(pe,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],z):(pe=typeof globalThis<"u"?globalThis:pe||self,z(pe["react-blender-nodes"]={},pe.React,pe.ReactDOM))})(this,function(pe,z,Hd){"use strict";function zd(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 L=zd(z),cs=zd(Hd);var us=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fs={exports:{}},Ho={};/**
1
+ (function(fe,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],T):(fe=typeof globalThis<"u"?globalThis:fe||self,T(fe["react-blender-nodes"]={},fe.React,fe.ReactDOM))})(this,function(fe,T,Fh){"use strict";function zh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=zh(T),_o=zh(Fh);var oa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ia={exports:{}},Ni={};/**
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 Wd;function Ew(){if(Wd)return Ho;Wd=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var c in s)c!=="key"&&(a[c]=s[c])}else a=s;return s=a.ref,{$$typeof:e,type:o,key:l,ref:s!==void 0?s:null,props:a}}return Ho.Fragment=t,Ho.jsx=n,Ho.jsxs=n,Ho}var zo={};/**
9
+ */var Wh;function S_(){if(Wh)return Ni;Wh=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,s){var a=null;if(s!==void 0&&(a=""+s),i.key!==void 0&&(a=""+i.key),"key"in i){s={};for(var l in i)l!=="key"&&(s[l]=i[l])}else s=i;return i=s.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:s}}return Ni.Fragment=t,Ni.jsx=n,Ni.jsxs=n,Ni}var Ii={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,176 +14,292 @@
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 jd;function Cw(){return jd||(jd=1,process.env.NODE_ENV!=="production"&&function(){function e($){if($==null)return null;if(typeof $=="function")return $.$$typeof===K?null:$.displayName||$.name||null;if(typeof $=="string")return $;switch($){case v:return"Fragment";case _:return"Profiler";case b:return"StrictMode";case O:return"Suspense";case k:return"SuspenseList";case V: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 x:return"Portal";case w:return($.displayName||"Context")+".Provider";case N:return($._context.displayName||"Context")+".Consumer";case E:var G=$.render;return $=$.displayName,$||($=G.displayName||G.name||"",$=$!==""?"ForwardRef("+$+")":"ForwardRef"),$;case M:return G=$.displayName||null,G!==null?G:e($.type)||"Memo";case D:G=$._payload,$=$._init;try{return e($(G))}catch{}}return null}function t($){return""+$}function n($){try{t($);var G=!1}catch{G=!0}if(G){G=console;var J=G.error,re=typeof Symbol=="function"&&Symbol.toStringTag&&$[Symbol.toStringTag]||$.constructor.name||"Object";return J.call(G,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",re),t($)}}function o($){if($===v)return"<>";if(typeof $=="object"&&$!==null&&$.$$typeof===D)return"<...>";try{var G=e($);return G?"<"+G+">":"<...>"}catch{return"<...>"}}function s(){var $=Z.A;return $===null?null:$.getOwner()}function a(){return Error("react-stack-top-frame")}function l($){if(U.call($,"key")){var G=Object.getOwnPropertyDescriptor($,"key").get;if(G&&G.isReactWarning)return!1}return $.key!==void 0}function c($,G){function J(){H||(H=!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)",G))}J.isReactWarning=!0,Object.defineProperty($,"key",{get:J,configurable:!0})}function f(){var $=e(this.type);return B[$]||(B[$]=!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 d($,G,J,re,se,ce,ge,te){return J=ce.ref,$={$$typeof:m,type:$,key:G,props:ce,_owner:se},(J!==void 0?J:null)!==null?Object.defineProperty($,"ref",{enumerable:!1,get:f}):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:ge}),Object.defineProperty($,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze($.props),Object.freeze($)),$}function h($,G,J,re,se,ce,ge,te){var Q=G.children;if(Q!==void 0)if(re)if(q(Q)){for(re=0;re<Q.length;re++)g(Q[re]);Object.freeze&&Object.freeze(Q)}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 g(Q);if(U.call(G,"key")){Q=e($);var ae=Object.keys(G).filter(function(de){return de!=="key"});re=0<ae.length?"{key: someKey, "+ae.join(": ..., ")+": ...}":"{key: someKey}",W[Q+re]||(ae=0<ae.length?"{"+ae.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Gh;function __(){return Gh||(Gh=1,process.env.NODE_ENV!=="production"&&function(){function e(z){if(z==null)return null;if(typeof z=="function")return z.$$typeof===q?null:z.displayName||z.name||null;if(typeof z=="string")return z;switch(z){case v:return"Fragment";case S:return"Profiler";case b:return"StrictMode";case k:return"Suspense";case A:return"SuspenseList";case U:return"Activity"}if(typeof z=="object")switch(typeof z.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),z.$$typeof){case x:return"Portal";case w:return(z.displayName||"Context")+".Provider";case N:return(z._context.displayName||"Context")+".Consumer";case I:var Y=z.render;return z=z.displayName,z||(z=Y.displayName||Y.name||"",z=z!==""?"ForwardRef("+z+")":"ForwardRef"),z;case M:return Y=z.displayName||null,Y!==null?Y:e(z.type)||"Memo";case B:Y=z._payload,z=z._init;try{return e(z(Y))}catch{}}return null}function t(z){return""+z}function n(z){try{t(z);var Y=!1}catch{Y=!0}if(Y){Y=console;var J=Y.error,ie=typeof Symbol=="function"&&Symbol.toStringTag&&z[Symbol.toStringTag]||z.constructor.name||"Object";return J.call(Y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ie),t(z)}}function r(z){if(z===v)return"<>";if(typeof z=="object"&&z!==null&&z.$$typeof===B)return"<...>";try{var Y=e(z);return Y?"<"+Y+">":"<...>"}catch{return"<...>"}}function i(){var z=D.A;return z===null?null:z.getOwner()}function s(){return Error("react-stack-top-frame")}function a(z){if($.call(z,"key")){var Y=Object.getOwnPropertyDescriptor(z,"key").get;if(Y&&Y.isReactWarning)return!1}return z.key!==void 0}function l(z,Y){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)",Y))}J.isReactWarning=!0,Object.defineProperty(z,"key",{get:J,configurable:!0})}function u(){var z=e(this.type);return L[z]||(L[z]=!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.")),z=this.props.ref,z!==void 0?z:null}function d(z,Y,J,ie,ee,ce,ge,Q){return J=ce.ref,z={$$typeof:m,type:z,key:Y,props:ce,_owner:ee},(J!==void 0?J:null)!==null?Object.defineProperty(z,"ref",{enumerable:!1,get:u}):Object.defineProperty(z,"ref",{enumerable:!1,value:null}),z._store={},Object.defineProperty(z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(z,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(z,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ge}),Object.defineProperty(z,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(z.props),Object.freeze(z)),z}function f(z,Y,J,ie,ee,ce,ge,Q){var te=Y.children;if(te!==void 0)if(ie)if(F(te)){for(ie=0;ie<te.length;ie++)g(te[ie]);Object.freeze&&Object.freeze(te)}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 g(te);if($.call(Y,"key")){te=e(z);var ne=Object.keys(Y).filter(function(pe){return pe!=="key"});ie=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",W[te+ie]||(ne=0<ne.length?"{"+ne.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} />`,re,Q,ae,Q),W[Q+re]=!0)}if(Q=null,J!==void 0&&(n(J),Q=""+J),l(G)&&(n(G.key),Q=""+G.key),"key"in G){J={};for(var fe in G)fe!=="key"&&(J[fe]=G[fe])}else J=G;return Q&&c(J,typeof $=="function"?$.displayName||$.name||"Unknown":$),d($,Q,ce,se,s(),J,ge,te)}function g($){typeof $=="object"&&$!==null&&$.$$typeof===m&&$._store&&($._store.validated=1)}var p=z,m=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),w=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),Z=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,q=Array.isArray,C=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function($){return $()}};var H,B={},R=p.react_stack_bottom_frame.bind(p,a)(),P=C(o(a)),W={};zo.Fragment=v,zo.jsx=function($,G,J,re,se){var ce=1e4>Z.recentlyCreatedOwnerStacks++;return h($,G,J,!1,re,se,ce?Error("react-stack-top-frame"):R,ce?C(o($)):P)},zo.jsxs=function($,G,J,re,se){var ce=1e4>Z.recentlyCreatedOwnerStacks++;return h($,G,J,!0,re,se,ce?Error("react-stack-top-frame"):R,ce?C(o($)):P)}}()),zo}var Ud;function Nw(){return Ud||(Ud=1,process.env.NODE_ENV==="production"?fs.exports=Ew():fs.exports=Cw()),fs.exports}var T=Nw();function Gd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yd(...e){return t=>{let n=!1;const o=e.map(s=>{const a=Gd(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<o.length;s++){const a=o[s];typeof a=="function"?a():Gd(e[s],null)}}}}function ut(...e){return L.useCallback(Yd(...e),e)}function Vo(e){const t=Aw(e),n=L.forwardRef((o,s)=>{const{children:a,...l}=o,c=L.Children.toArray(a),f=c.find(Ow);if(f){const d=f.props.children,h=c.map(g=>g===f?L.Children.count(d)>1?L.Children.only(null):L.isValidElement(d)?d.props.children:null:g);return T.jsx(t,{...l,ref:s,children:L.isValidElement(d)?L.cloneElement(d,void 0,h):null})}return T.jsx(t,{...l,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}var Tw=Vo("Slot");function Aw(e){const t=L.forwardRef((n,o)=>{const{children:s,...a}=n;if(L.isValidElement(s)){const l=kw(s),c=Pw(a,s.props);return s.type!==L.Fragment&&(c.ref=o?Yd(o,l):l),L.cloneElement(s,c)}return L.Children.count(s)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Iw=Symbol("radix.slottable");function Ow(e){return L.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Iw}function Pw(e,t){const n={...t};for(const o in t){const s=e[o],a=t[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...c)=>{const f=a(...c);return s(...c),f}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function kw(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 Xd(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Xd(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function qd(){for(var e,t,n=0,o="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Xd(e))&&(o&&(o+=" "),o+=t);return o}const Kd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Zd=qd,Mw=(e,t)=>n=>{var o;if(t?.variants==null)return Zd(e,n?.class,n?.className);const{variants:s,defaultVariants:a}=t,l=Object.keys(s).map(d=>{const h=n?.[d],g=a?.[d];if(h===null)return null;const p=Kd(h)||Kd(g);return s[d][p]}),c=n&&Object.entries(n).reduce((d,h)=>{let[g,p]=h;return p===void 0||(d[g]=p),d},{}),f=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,h)=>{let{class:g,className:p,...m}=h;return Object.entries(m).every(x=>{let[v,b]=x;return Array.isArray(b)?b.includes({...a,...c}[v]):{...a,...c}[v]===b})?[...d,g,p]:d},[]);return Zd(e,l,f,n?.class,n?.className)},Hl="-",Rw=e=>{const t=Lw(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:l=>{const c=l.split(Hl);return c[0]===""&&c.length!==1&&c.shift(),Qd(c,t)||Dw(l)},getConflictingClassGroupIds:(l,c)=>{const f=n[l]||[];return c&&o[l]?[...f,...o[l]]:f}}},Qd=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),s=o?Qd(e.slice(1),o):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(Hl);return t.validators.find(({validator:l})=>l(a))?.classGroupId},Jd=/^\[(.+)\]$/,Dw=e=>{if(Jd.test(e)){const t=Jd.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Lw=e=>{const{theme:t,classGroups:n}=e,o={nextPart:new Map,validators:[]};for(const s in n)zl(n[s],o,s,t);return o},zl=(e,t,n,o)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:eh(t,s);a.classGroupId=n;return}if(typeof s=="function"){if($w(s)){zl(s(o),t,n,o);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([a,l])=>{zl(l,eh(t,a),n,o)})})},eh=(e,t)=>{let n=e;return t.split(Hl).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},$w=e=>e.isThemeGetter,Bw=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const s=(a,l)=>{n.set(a,l),t++,t>e&&(t=0,o=n,n=new Map)};return{get(a){let l=n.get(a);if(l!==void 0)return l;if((l=o.get(a))!==void 0)return s(a,l),l},set(a,l){n.has(a)?n.set(a,l):s(a,l)}}},Vl="!",Wl=":",Fw=Wl.length,Hw=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=s=>{const a=[];let l=0,c=0,f=0,d;for(let x=0;x<s.length;x++){let v=s[x];if(l===0&&c===0){if(v===Wl){a.push(s.slice(f,x)),f=x+Fw;continue}if(v==="/"){d=x;continue}}v==="["?l++:v==="]"?l--:v==="("?c++:v===")"&&c--}const h=a.length===0?s:s.substring(f),g=zw(h),p=g!==h,m=d&&d>f?d-f:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};if(t){const s=t+Wl,a=o;o=l=>l.startsWith(s)?a(l.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(n){const s=o;o=a=>n({className:a,parseClassName:s})}return o},zw=e=>e.endsWith(Vl)?e.substring(0,e.length-1):e.startsWith(Vl)?e.substring(1):e,Vw=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(o=>[o,!0]));return o=>{if(o.length<=1)return o;const s=[];let a=[];return o.forEach(l=>{l[0]==="["||t[l]?(s.push(...a.sort(),l),a=[]):a.push(l)}),s.push(...a.sort()),s}},Ww=e=>({cache:Bw(e.cacheSize),parseClassName:Hw(e),sortModifiers:Vw(e),...Rw(e)}),jw=/\s+/,Uw=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],c=e.trim().split(jw);let f="";for(let d=c.length-1;d>=0;d-=1){const h=c[d],{isExternal:g,modifiers:p,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:v}=n(h);if(g){f=h+(f.length>0?" "+f:f);continue}let b=!!v,_=o(b?x.substring(0,v):x);if(!_){if(!b){f=h+(f.length>0?" "+f:f);continue}if(_=o(x),!_){f=h+(f.length>0?" "+f:f);continue}b=!1}const N=a(p).join(":"),w=m?N+Vl:N,E=w+_;if(l.includes(E))continue;l.push(E);const O=s(_,b);for(let k=0;k<O.length;++k){const M=O[k];l.push(w+M)}f=h+(f.length>0?" "+f:f)}return f};function Gw(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=th(t))&&(o&&(o+=" "),o+=n);return o}const th=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=th(e[o]))&&(n&&(n+=" "),n+=t);return n};function Yw(e,...t){let n,o,s,a=l;function l(f){const d=t.reduce((h,g)=>g(h),e());return n=Ww(d),o=n.cache.get,s=n.cache.set,a=c,c(f)}function c(f){const d=o(f);if(d)return d;const h=Uw(f,n);return s(f,h),h}return function(){return a(Gw.apply(null,arguments))}}const it=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},nh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Xw=/^\d+\/\d+$/,qw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Kw=/\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$/,Zw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Qw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gr=e=>Xw.test(e),Pe=e=>!!e&&!Number.isNaN(Number(e)),Kn=e=>!!e&&Number.isInteger(Number(e)),jl=e=>e.endsWith("%")&&Pe(e.slice(0,-1)),Tn=e=>qw.test(e),eb=()=>!0,tb=e=>Kw.test(e)&&!Zw.test(e),oh=()=>!1,nb=e=>Qw.test(e),rb=e=>Jw.test(e),ob=e=>!ve(e)&&!xe(e),ib=e=>Yr(e,ch,oh),ve=e=>nh.test(e),vr=e=>Yr(e,uh,tb),Ul=e=>Yr(e,ub,Pe),ih=e=>Yr(e,ah,oh),sb=e=>Yr(e,lh,rb),ds=e=>Yr(e,fh,nb),xe=e=>rh.test(e),Wo=e=>Xr(e,uh),ab=e=>Xr(e,fb),sh=e=>Xr(e,ah),lb=e=>Xr(e,ch),cb=e=>Xr(e,lh),hs=e=>Xr(e,fh,!0),Yr=(e,t,n)=>{const o=nh.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Xr=(e,t,n=!1)=>{const o=rh.exec(e);return o?o[1]?t(o[1]):n:!1},ah=e=>e==="position"||e==="percentage",lh=e=>e==="image"||e==="url",ch=e=>e==="length"||e==="size"||e==="bg-size",uh=e=>e==="length",ub=e=>e==="number",fb=e=>e==="family-name",fh=e=>e==="shadow",db=Yw(()=>{const e=it("color"),t=it("font"),n=it("text"),o=it("font-weight"),s=it("tracking"),a=it("leading"),l=it("breakpoint"),c=it("container"),f=it("spacing"),d=it("radius"),h=it("shadow"),g=it("inset-shadow"),p=it("text-shadow"),m=it("drop-shadow"),x=it("blur"),v=it("perspective"),b=it("aspect"),_=it("ease"),N=it("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...E(),xe,ve],k=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],D=()=>[xe,ve,f],V=()=>[Gr,"full","auto",...D()],K=()=>[Kn,"none","subgrid",xe,ve],Z=()=>["auto",{span:["full",Kn,xe,ve]},Kn,xe,ve],U=()=>[Kn,"auto",xe,ve],q=()=>["auto","min","max","fr",xe,ve],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...D()],R=()=>[Gr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],P=()=>[e,xe,ve],W=()=>[...E(),sh,ih,{position:[xe,ve]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",lb,ib,{size:[xe,ve]}],J=()=>[jl,Wo,vr],re=()=>["","none","full",d,xe,ve],se=()=>["",Pe,Wo,vr],ce=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Pe,jl,sh,ih],Q=()=>["","none",x,xe,ve],ae=()=>["none",Pe,xe,ve],fe=()=>["none",Pe,xe,ve],de=()=>[Pe,xe,ve],ue=()=>[Gr,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tn],breakpoint:[Tn],color:[eb],container:[Tn],"drop-shadow":[Tn],ease:["in","out","in-out"],font:[ob],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tn],shadow:[Tn],spacing:["px",Pe],text:[Tn],"text-shadow":[Tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gr,ve,xe,b]}],container:["container"],columns:[{columns:[Pe,ve,xe,c]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:O()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Kn,"auto",xe,ve]}],basis:[{basis:[Gr,"full","auto",c,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pe,Gr,"auto","initial","none",ve]}],grow:[{grow:["",Pe,xe,ve]}],shrink:[{shrink:["",Pe,xe,ve]}],order:[{order:[Kn,"first","last","none",xe,ve]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[c,"screen",...R()]}],"min-w":[{"min-w":[c,"screen","none",...R()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Wo,vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,xe,Ul]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jl,ve]}],"font-family":[{font:[ab,ve,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:[s,xe,ve]}],"line-clamp":[{"line-clamp":[Pe,"none",xe,Ul]}],leading:[{leading:[a,...D()]}],"list-image":[{"list-image":["none",xe,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pe,"from-font","auto",xe,vr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Pe,"auto",xe,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,ve]}],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",xe,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Kn,xe,ve],radial:["",xe,ve],conic:[Kn,xe,ve]},cb,sb]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pe,xe,ve]}],"outline-w":[{outline:["",Pe,Wo,vr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",h,hs,ds]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",g,hs,ds]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Pe,vr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,hs,ds]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Pe,xe,ve]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[Pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[xe,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[Pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,ve]}],filter:[{filter:["","none",xe,ve]}],blur:[{blur:Q()}],brightness:[{brightness:[Pe,xe,ve]}],contrast:[{contrast:[Pe,xe,ve]}],"drop-shadow":[{"drop-shadow":["","none",m,hs,ds]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Pe,xe,ve]}],"hue-rotate":[{"hue-rotate":[Pe,xe,ve]}],invert:[{invert:["",Pe,xe,ve]}],saturate:[{saturate:[Pe,xe,ve]}],sepia:[{sepia:["",Pe,xe,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,ve]}],"backdrop-blur":[{"backdrop-blur":Q()}],"backdrop-brightness":[{"backdrop-brightness":[Pe,xe,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Pe,xe,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pe,xe,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pe,xe,ve]}],"backdrop-invert":[{"backdrop-invert":["",Pe,xe,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Pe,xe,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Pe,xe,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Pe,xe,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pe,"initial",xe,ve]}],ease:[{ease:["linear","initial",_,xe,ve]}],delay:[{delay:[Pe,xe,ve]}],animate:[{animate:["none",N,xe,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,xe,ve]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[xe,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,ve]}],"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":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",xe,ve]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Pe,Wo,vr,Ul]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ne(...e){return db(qd(e))}const hb=Mw("inline-flex items-center justify-center gap-2 cursor-pointer py-2 px-4 rounded-md transition-all text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white disabled:cursor-not-allowed disabled:bg-secondary-dark-gray disabled:opacity-50 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"}]}),An=z.forwardRef(({className:e,color:t,asChild:n=!1,applyHoverStyles:o,...s},a)=>{const l=n?Tw:"button";return T.jsx(l,{ref:a,"data-slot":"button",className:Ne(hb({color:t,className:e,applyHoverStyles:o})),...s})});An.displayName="Button";function Gl(e,t,n,o=!1,s=!1){if(t>n){const a=t;t=n,n=a}return(o?e>=t:e>t)&&(s?e<=n:e<n)}function dh(e,t,n=!1,o=!1){return Gl(e.x,t.left,t.right,n)&&Gl(e.y,t.top,t.bottom,o)}function hh(e){const t=e.startsWith("-"),n=e.replaceAll(/[^0-9\.]/g,""),o=n.indexOf(".");let s=0;if(o===-1)s=Number(n);else{const a=n.substring(0,o).replaceAll(/[^0-9]/g,""),l=n.substring(o+1).replaceAll(/[^0-9]/g,"");s=+(a+"."+l)}return t&&(s=-s),s}function Yl(e,t){return e.toFixed(t).replace(/[0]+$/,"").replace(/\.$/,"")}const cn=["string","number","complex","noEquivalent","inferFromConnection"],ph={[cn[0]]:cn[0],[cn[1]]:cn[1],[cn[2]]:cn[2],[cn[3]]:cn[3],[cn[4]]:cn[4]};function pb(e){return!!ph[e]}function gb(e){return e}function mb(e,t){return e in t}function yb(e){return e}function vb(e){return e}function xb(e){return e}var gh=Symbol.for("immer-nothing"),mh=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),wb=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=wb[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 qr=Object.getPrototypeOf;function Kr(e){return!!e&&!!e[At]}function xr(e){return e?yh(e)||Array.isArray(e)||!!e[mh]||!!e.constructor?.[mh]||jo(e)||ms(e):!1}var bb=Object.prototype.constructor.toString();function yh(e){if(!e||typeof e!="object")return!1;const t=qr(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)===bb}function ps(e,t){gs(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function gs(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:jo(e)?2:ms(e)?3:0}function Xl(e,t){return gs(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function vh(e,t,n){const o=gs(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function _b(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function jo(e){return e instanceof Map}function ms(e){return e instanceof Set}function wr(e){return e.copy_||e.base_}function ql(e,t){if(jo(e))return new Map(e);if(ms(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yh(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[At];let s=Reflect.ownKeys(o);for(let a=0;a<s.length;a++){const l=s[a],c=o[l];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(o[l]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[l]})}return Object.create(qr(e),o)}else{const o=qr(e);if(o!==null&&n)return{...e};const s=Object.create(o);return Object.assign(s,e)}}function Kl(e,t=!1){return vs(e)||Kr(e)||!xr(e)||(gs(e)>1&&Object.defineProperties(e,{set:{value:ys},add:{value:ys},clear:{value:ys},delete:{value:ys}}),Object.freeze(e),t&&Object.values(e).forEach(n=>Kl(n,!0))),e}function ys(){wt(2)}function vs(e){return Object.isFrozen(e)}var Sb={};function br(e){const t=Sb[e];return t||wt(0,e),t}var Uo;function xh(){return Uo}function Eb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function wh(e,t){t&&(br("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Zl(e){Ql(e),e.drafts_.forEach(Cb),e.drafts_=null}function Ql(e){e===Uo&&(Uo=e.parent_)}function bh(e){return Uo=Eb(Uo,e)}function Cb(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function _h(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&(Zl(t),wt(4)),xr(e)&&(e=xs(t,e),t.parent_||ws(t,e)),t.patches_&&br("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=xs(t,n,[]),Zl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gh?e:void 0}function xs(e,t,n){if(vs(t))return t;const o=t[At];if(!o)return ps(t,(s,a)=>Sh(e,o,t,s,a,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return ws(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const s=o.copy_;let a=s,l=!1;o.type_===3&&(a=new Set(s),s.clear(),l=!0),ps(a,(c,f)=>Sh(e,o,s,c,f,n,l)),ws(e,s,!1),n&&e.patches_&&br("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Sh(e,t,n,o,s,a,l){if(process.env.NODE_ENV!=="production"&&s===n&&wt(5),Kr(s)){const c=a&&t&&t.type_!==3&&!Xl(t.assigned_,o)?a.concat(o):void 0,f=xs(e,s,c);if(vh(n,o,f),Kr(f))e.canAutoFreeze_=!1;else return}else l&&n.add(s);if(xr(s)&&!vs(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;xs(e,s),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(jo(n)?n.has(o):Object.prototype.propertyIsEnumerable.call(n,o))&&ws(e,s)}}function ws(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Kl(t,n)}function Nb(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:xh(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=o,a=Jl;n&&(s=[o],a=Go);const{revoke:l,proxy:c}=Proxy.revocable(s,a);return o.draft_=c,o.revoke_=l,c}var Jl={get(e,t){if(t===At)return e;const n=wr(e);if(!Xl(n,t))return Tb(e,n,t);const o=n[t];return e.finalized_||!xr(o)?o:o===ec(e.base_,t)?(nc(e),e.copy_[t]=rc(o,e)):o},has(e,t){return t in wr(e)},ownKeys(e){return Reflect.ownKeys(wr(e))},set(e,t,n){const o=Eh(wr(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const s=ec(wr(e),t),a=s?.[At];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(_b(n,s)&&(n!==void 0||Xl(e.base_,t)))return!0;nc(e),tc(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 ec(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,nc(e),tc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=wr(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return qr(e.base_)},setPrototypeOf(){wt(12)}},Go={};ps(Jl,(e,t)=>{Go[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Go.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),Go.set.call(this,e,t,void 0)},Go.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),Jl.set.call(this,e[0],t,n,e[0])};function ec(e,t){const n=e[At];return(n?wr(n):e)[t]}function Tb(e,t,n){const o=Eh(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}function Eh(e,t){if(!(t in e))return;let n=qr(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=qr(n)}}function tc(e){e.modified_||(e.modified_=!0,e.parent_&&tc(e.parent_))}function nc(e){e.copy_||(e.copy_=ql(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ab=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const l=this;return function(f=a,...d){return l.produce(f,h=>n.call(this,h,...d))}}typeof n!="function"&&wt(6),o!==void 0&&typeof o!="function"&&wt(7);let s;if(xr(t)){const a=bh(this),l=rc(t,void 0);let c=!0;try{s=n(l),c=!1}finally{c?Zl(a):Ql(a)}return wh(a,o),_h(s,a)}else if(!t||typeof t!="object"){if(s=n(t),s===void 0&&(s=t),s===gh&&(s=void 0),this.autoFreeze_&&Kl(s,!0),o){const a=[],l=[];br("Patches").generateReplacementPatches_(t,s,a,l),o(a,l)}return s}else wt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(l,...c)=>this.produceWithPatches(l,f=>t(f,...c));let o,s;return[this.produce(t,n,(l,c)=>{o=l,s=c}),o,s]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){xr(e)||wt(8),Kr(e)&&(e=Ib(e));const t=bh(this),n=rc(e,void 0);return n[At].isManual_=!0,Ql(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&wt(9);const{scope_:o}=n;return wh(o,t),_h(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 s=t[n];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}n>-1&&(t=t.slice(n+1));const o=br("Patches").applyPatches_;return Kr(e)?o(e,t):this.produce(e,s=>o(s,t))}};function rc(e,t){const n=jo(e)?br("MapSet").proxyMap_(e,t):ms(e)?br("MapSet").proxySet_(e,t):Nb(e,t);return(t?t.scope_:xh()).drafts_.push(n),n}function Ib(e){return Kr(e)||wt(10,e),Ch(e)}function Ch(e){if(!xr(e)||vs(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ql(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ql(e,!0);return ps(n,(o,s)=>{vh(n,o,Ch(s))}),t&&(t.finalized_=!1),n}var Ob=new Ab,Yo=Ob.produce;function un(e){const t=[];for(let o=0;o<Math.floor(e/8);o++)t.push(Math.random().toString(36).substring(2,10));return e%8>0&&t.push(Math.random().toString(36).substring(2,e%8+2)),t.join("")}function nt(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=nt(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Pb={value:()=>{}};function bs(){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 _s(n)}function _s(e){this._=e}function kb(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",s=n.indexOf(".");if(s>=0&&(o=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}_s.prototype=bs.prototype={constructor:_s,on:function(e,t){var n=this._,o=kb(e+"",n),s,a=-1,l=o.length;if(arguments.length<2){for(;++a<l;)if((s=(e=o[a]).type)&&(s=Mb(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(s=(e=o[a]).type)n[s]=Nh(n[s],e.name,t);else if(t==null)for(s in n)n[s]=Nh(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new _s(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),o=0,s,a;o<s;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],o=0,s=a.length;o<s;++o)a[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],s=0,a=o.length;s<a;++s)o[s].value.apply(t,n)}};function Mb(e,t){for(var n=0,o=e.length,s;n<o;++n)if((s=e[n]).name===t)return s.value}function Nh(e,t,n){for(var o=0,s=e.length;o<s;++o)if(e[o].name===t){e[o]=Pb,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var oc="http://www.w3.org/1999/xhtml";const Th={svg:"http://www.w3.org/2000/svg",xhtml:oc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ss(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Th.hasOwnProperty(t)?{space:Th[t],local:e}:e}function Rb(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===oc&&t.documentElement.namespaceURI===oc?t.createElement(e):t.createElementNS(n,e)}}function Db(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ah(e){var t=Ss(e);return(t.local?Db:Rb)(t)}function Lb(){}function ic(e){return e==null?Lb:function(){return this.querySelector(e)}}function $b(e){typeof e!="function"&&(e=ic(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var a=t[s],l=a.length,c=o[s]=new Array(l),f,d,h=0;h<l;++h)(f=a[h])&&(d=e.call(f,f.__data__,h,a))&&("__data__"in f&&(d.__data__=f.__data__),c[h]=d);return new It(o,this._parents)}function Bb(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fb(){return[]}function Ih(e){return e==null?Fb:function(){return this.querySelectorAll(e)}}function Hb(e){return function(){return Bb(e.apply(this,arguments))}}function zb(e){typeof e=="function"?e=Hb(e):e=Ih(e);for(var t=this._groups,n=t.length,o=[],s=[],a=0;a<n;++a)for(var l=t[a],c=l.length,f,d=0;d<c;++d)(f=l[d])&&(o.push(e.call(f,f.__data__,d,l)),s.push(f));return new It(o,s)}function Oh(e){return function(){return this.matches(e)}}function Ph(e){return function(t){return t.matches(e)}}var Vb=Array.prototype.find;function Wb(e){return function(){return Vb.call(this.children,e)}}function jb(){return this.firstElementChild}function Ub(e){return this.select(e==null?jb:Wb(typeof e=="function"?e:Ph(e)))}var Gb=Array.prototype.filter;function Yb(){return Array.from(this.children)}function Xb(e){return function(){return Gb.call(this.children,e)}}function qb(e){return this.selectAll(e==null?Yb:Xb(typeof e=="function"?e:Ph(e)))}function Kb(e){typeof e!="function"&&(e=Oh(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var a=t[s],l=a.length,c=o[s]=[],f,d=0;d<l;++d)(f=a[d])&&e.call(f,f.__data__,d,a)&&c.push(f);return new It(o,this._parents)}function kh(e){return new Array(e.length)}function Zb(){return new It(this._enter||this._groups.map(kh),this._parents)}function Es(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Es.prototype={constructor:Es,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 Qb(e){return function(){return e}}function Jb(e,t,n,o,s,a){for(var l=0,c,f=t.length,d=a.length;l<d;++l)(c=t[l])?(c.__data__=a[l],o[l]=c):n[l]=new Es(e,a[l]);for(;l<f;++l)(c=t[l])&&(s[l]=c)}function e_(e,t,n,o,s,a,l){var c,f,d=new Map,h=t.length,g=a.length,p=new Array(h),m;for(c=0;c<h;++c)(f=t[c])&&(p[c]=m=l.call(f,f.__data__,c,t)+"",d.has(m)?s[c]=f:d.set(m,f));for(c=0;c<g;++c)m=l.call(e,a[c],c,a)+"",(f=d.get(m))?(o[c]=f,f.__data__=a[c],d.delete(m)):n[c]=new Es(e,a[c]);for(c=0;c<h;++c)(f=t[c])&&d.get(p[c])===f&&(s[c]=f)}function t_(e){return e.__data__}function n_(e,t){if(!arguments.length)return Array.from(this,t_);var n=t?e_:Jb,o=this._parents,s=this._groups;typeof e!="function"&&(e=Qb(e));for(var a=s.length,l=new Array(a),c=new Array(a),f=new Array(a),d=0;d<a;++d){var h=o[d],g=s[d],p=g.length,m=r_(e.call(h,h&&h.__data__,d,o)),x=m.length,v=c[d]=new Array(x),b=l[d]=new Array(x),_=f[d]=new Array(p);n(h,g,v,b,_,m,t);for(var N=0,w=0,E,O;N<x;++N)if(E=v[N]){for(N>=w&&(w=N+1);!(O=b[w])&&++w<x;);E._next=O||null}}return l=new It(l,o),l._enter=c,l._exit=f,l}function r_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function o_(){return new It(this._exit||this._groups.map(kh),this._parents)}function i_(e,t,n){var o=this.enter(),s=this,a=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?a.remove():n(a),o&&s?o.merge(s).order():s}function s_(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,s=n.length,a=o.length,l=Math.min(s,a),c=new Array(s),f=0;f<l;++f)for(var d=n[f],h=o[f],g=d.length,p=c[f]=new Array(g),m,x=0;x<g;++x)(m=d[x]||h[x])&&(p[x]=m);for(;f<s;++f)c[f]=n[f];return new It(c,this._parents)}function a_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],s=o.length-1,a=o[s],l;--s>=0;)(l=o[s])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function l_(e){e||(e=c_);function t(g,p){return g&&p?e(g.__data__,p.__data__):!g-!p}for(var n=this._groups,o=n.length,s=new Array(o),a=0;a<o;++a){for(var l=n[a],c=l.length,f=s[a]=new Array(c),d,h=0;h<c;++h)(d=l[h])&&(f[h]=d);f.sort(t)}return new It(s,this._parents).order()}function c_(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function u_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f_(){return Array.from(this)}function d_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],s=0,a=o.length;s<a;++s){var l=o[s];if(l)return l}return null}function h_(){let e=0;for(const t of this)++e;return e}function p_(){return!this.node()}function g_(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var s=t[n],a=0,l=s.length,c;a<l;++a)(c=s[a])&&e.call(c,c.__data__,a,s);return this}function m_(e){return function(){this.removeAttribute(e)}}function y_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function v_(e,t){return function(){this.setAttribute(e,t)}}function x_(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function w_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function b_(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 __(e,t){var n=Ss(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?y_:m_:typeof t=="function"?n.local?b_:w_:n.local?x_:v_)(n,t))}function Mh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function S_(e){return function(){this.style.removeProperty(e)}}function E_(e,t,n){return function(){this.style.setProperty(e,t,n)}}function C_(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function N_(e,t,n){return arguments.length>1?this.each((t==null?S_:typeof t=="function"?C_:E_)(e,t,n??"")):Zr(this.node(),e)}function Zr(e,t){return e.style.getPropertyValue(t)||Mh(e).getComputedStyle(e,null).getPropertyValue(t)}function T_(e){return function(){delete this[e]}}function A_(e,t){return function(){this[e]=t}}function I_(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function O_(e,t){return arguments.length>1?this.each((t==null?T_:typeof t=="function"?I_:A_)(e,t)):this.node()[e]}function Rh(e){return e.trim().split(/^|\s+/)}function sc(e){return e.classList||new Dh(e)}function Dh(e){this._node=e,this._names=Rh(e.getAttribute("class")||"")}Dh.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 Lh(e,t){for(var n=sc(e),o=-1,s=t.length;++o<s;)n.add(t[o])}function $h(e,t){for(var n=sc(e),o=-1,s=t.length;++o<s;)n.remove(t[o])}function P_(e){return function(){Lh(this,e)}}function k_(e){return function(){$h(this,e)}}function M_(e,t){return function(){(t.apply(this,arguments)?Lh:$h)(this,e)}}function R_(e,t){var n=Rh(e+"");if(arguments.length<2){for(var o=sc(this.node()),s=-1,a=n.length;++s<a;)if(!o.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?M_:t?P_:k_)(n,t))}function D_(){this.textContent=""}function L_(e){return function(){this.textContent=e}}function $_(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function B_(e){return arguments.length?this.each(e==null?D_:(typeof e=="function"?$_:L_)(e)):this.node().textContent}function F_(){this.innerHTML=""}function H_(e){return function(){this.innerHTML=e}}function z_(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function V_(e){return arguments.length?this.each(e==null?F_:(typeof e=="function"?z_:H_)(e)):this.node().innerHTML}function W_(){this.nextSibling&&this.parentNode.appendChild(this)}function j_(){return this.each(W_)}function U_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function G_(){return this.each(U_)}function Y_(e){var t=typeof e=="function"?e:Ah(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function X_(){return null}function q_(e,t){var n=typeof e=="function"?e:Ah(e),o=t==null?X_:typeof t=="function"?t:ic(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function K_(){var e=this.parentNode;e&&e.removeChild(this)}function Z_(){return this.each(K_)}function Q_(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function J_(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function e1(e){return this.select(e?J_:Q_)}function t1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function n1(e){return function(t){e.call(this,t,this.__data__)}}function r1(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 o1(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,s=t.length,a;n<s;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++o]=a;++o?t.length=o:delete this.__on}}}function i1(e,t,n){return function(){var o=this.__on,s,a=n1(t);if(o){for(var l=0,c=o.length;l<c;++l)if((s=o[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=n),s.value=t;return}}this.addEventListener(e.type,a,n),s={type:e.type,name:e.name,value:t,listener:a,options:n},o?o.push(s):this.__on=[s]}}function s1(e,t,n){var o=r1(e+""),s,a=o.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var f=0,d=c.length,h;f<d;++f)for(s=0,h=c[f];s<a;++s)if((l=o[s]).type===h.type&&l.name===h.name)return h.value}return}for(c=t?i1:o1,s=0;s<a;++s)this.each(c(o[s],t,n));return this}function Bh(e,t,n){var o=Mh(e),s=o.CustomEvent;typeof s=="function"?s=new s(t,n):(s=o.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function a1(e,t){return function(){return Bh(this,e,t)}}function l1(e,t){return function(){return Bh(this,e,t.apply(this,arguments))}}function c1(e,t){return this.each((typeof t=="function"?l1:a1)(e,t))}function*u1(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],s=0,a=o.length,l;s<a;++s)(l=o[s])&&(yield l)}var Fh=[null];function It(e,t){this._groups=e,this._parents=t}function Xo(){return new It([[document.documentElement]],Fh)}function f1(){return this}It.prototype=Xo.prototype={constructor:It,select:$b,selectAll:zb,selectChild:Ub,selectChildren:qb,filter:Kb,data:n_,enter:Zb,exit:o_,join:i_,merge:s_,selection:f1,order:a_,sort:l_,call:u_,nodes:f_,node:d_,size:h_,empty:p_,each:g_,attr:__,style:N_,property:O_,classed:R_,text:B_,html:V_,raise:j_,lower:G_,append:Y_,insert:q_,remove:Z_,clone:e1,datum:t1,on:s1,dispatch:c1,[Symbol.iterator]:u1};function Ot(e){return typeof e=="string"?new It([[document.querySelector(e)]],[document.documentElement]):new It([[e]],Fh)}function d1(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kt(e,t){if(e=d1(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const h1={passive:!1},qo={capture:!0,passive:!1};function ac(e){e.stopImmediatePropagation()}function Qr(e){e.preventDefault(),e.stopImmediatePropagation()}function Hh(e){var t=e.document.documentElement,n=Ot(e).on("dragstart.drag",Qr,qo);"onselectstart"in t?n.on("selectstart.drag",Qr,qo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zh(e,t){var n=e.document.documentElement,o=Ot(e).on("dragstart.drag",null);t&&(o.on("click.drag",Qr,qo),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 Cs=e=>()=>e;function lc(e,{sourceEvent:t,subject:n,target:o,identifier:s,active:a,x:l,y:c,dx:f,dy:d,dispatch:h}){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:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}lc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function p1(e){return!e.ctrlKey&&!e.button}function g1(){return this.parentNode}function m1(e,t){return t??{x:e.x,y:e.y}}function y1(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vh(){var e=p1,t=g1,n=m1,o=y1,s={},a=bs("start","drag","end"),l=0,c,f,d,h,g=0;function p(E){E.on("mousedown.drag",m).filter(o).on("touchstart.drag",b).on("touchmove.drag",_,h1).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(E,O){if(!(h||!e.call(this,E,O))){var k=w(this,t.call(this,E,O),E,O,"mouse");k&&(Ot(E.view).on("mousemove.drag",x,qo).on("mouseup.drag",v,qo),Hh(E.view),ac(E),d=!1,c=E.clientX,f=E.clientY,k("start",E))}}function x(E){if(Qr(E),!d){var O=E.clientX-c,k=E.clientY-f;d=O*O+k*k>g}s.mouse("drag",E)}function v(E){Ot(E.view).on("mousemove.drag mouseup.drag",null),zh(E.view,d),Qr(E),s.mouse("end",E)}function b(E,O){if(e.call(this,E,O)){var k=E.changedTouches,M=t.call(this,E,O),D=k.length,V,K;for(V=0;V<D;++V)(K=w(this,M,E,O,k[V].identifier,k[V]))&&(ac(E),K("start",E,k[V]))}}function _(E){var O=E.changedTouches,k=O.length,M,D;for(M=0;M<k;++M)(D=s[O[M].identifier])&&(Qr(E),D("drag",E,O[M]))}function N(E){var O=E.changedTouches,k=O.length,M,D;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),M=0;M<k;++M)(D=s[O[M].identifier])&&(ac(E),D("end",E,O[M]))}function w(E,O,k,M,D,V){var K=a.copy(),Z=Kt(V||k,O),U,q,C;if((C=n.call(E,new lc("beforestart",{sourceEvent:k,target:p,identifier:D,active:l,x:Z[0],y:Z[1],dx:0,dy:0,dispatch:K}),M))!=null)return U=C.x-Z[0]||0,q=C.y-Z[1]||0,function H(B,R,P){var W=Z,$;switch(B){case"start":s[D]=H,$=l++;break;case"end":delete s[D],--l;case"drag":Z=Kt(P||R,O),$=l;break}K.call(B,E,new lc(B,{sourceEvent:R,subject:C,target:p,identifier:D,active:$,x:Z[0]+U,y:Z[1]+q,dx:Z[0]-W[0],dy:Z[1]-W[1],dispatch:K}),M)}}return p.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Cs(!!E),p):e},p.container=function(E){return arguments.length?(t=typeof E=="function"?E:Cs(E),p):t},p.subject=function(E){return arguments.length?(n=typeof E=="function"?E:Cs(E),p):n},p.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Cs(!!E),p):o},p.on=function(){var E=a.on.apply(a,arguments);return E===a?p:E},p.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,p):Math.sqrt(g)},p}function cc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Wh(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ko(){}var Zo=.7,Ns=1/Zo,Jr="\\s*([+-]?\\d+)\\s*",Qo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",v1=/^#([0-9a-f]{3,8})$/,x1=new RegExp(`^rgb\\(${Jr},${Jr},${Jr}\\)$`),w1=new RegExp(`^rgb\\(${fn},${fn},${fn}\\)$`),b1=new RegExp(`^rgba\\(${Jr},${Jr},${Jr},${Qo}\\)$`),_1=new RegExp(`^rgba\\(${fn},${fn},${fn},${Qo}\\)$`),S1=new RegExp(`^hsl\\(${Qo},${fn},${fn}\\)$`),E1=new RegExp(`^hsla\\(${Qo},${fn},${fn},${Qo}\\)$`),jh={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};cc(Ko,_r,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Uh,formatHex:Uh,formatHex8:C1,formatHsl:N1,formatRgb:Gh,toString:Gh});function Uh(){return this.rgb().formatHex()}function C1(){return this.rgb().formatHex8()}function N1(){return Zh(this).formatHsl()}function Gh(){return this.rgb().formatRgb()}function _r(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=v1.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Yh(t):n===3?new bt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ts(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ts(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=x1.exec(e))?new bt(t[1],t[2],t[3],1):(t=w1.exec(e))?new bt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=b1.exec(e))?Ts(t[1],t[2],t[3],t[4]):(t=_1.exec(e))?Ts(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=S1.exec(e))?Kh(t[1],t[2]/100,t[3]/100,1):(t=E1.exec(e))?Kh(t[1],t[2]/100,t[3]/100,t[4]):jh.hasOwnProperty(e)?Yh(jh[e]):e==="transparent"?new bt(NaN,NaN,NaN,0):null}function Yh(e){return new bt(e>>16&255,e>>8&255,e&255,1)}function Ts(e,t,n,o){return o<=0&&(e=t=n=NaN),new bt(e,t,n,o)}function T1(e){return e instanceof Ko||(e=_r(e)),e?(e=e.rgb(),new bt(e.r,e.g,e.b,e.opacity)):new bt}function uc(e,t,n,o){return arguments.length===1?T1(e):new bt(e,t,n,o??1)}function bt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}cc(bt,uc,Wh(Ko,{brighter(e){return e=e==null?Ns:Math.pow(Ns,e),new bt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zo:Math.pow(Zo,e),new bt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new bt(Sr(this.r),Sr(this.g),Sr(this.b),As(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:Xh,formatHex:Xh,formatHex8:A1,formatRgb:qh,toString:qh}));function Xh(){return`#${Er(this.r)}${Er(this.g)}${Er(this.b)}`}function A1(){return`#${Er(this.r)}${Er(this.g)}${Er(this.b)}${Er((isNaN(this.opacity)?1:this.opacity)*255)}`}function qh(){const e=As(this.opacity);return`${e===1?"rgb(":"rgba("}${Sr(this.r)}, ${Sr(this.g)}, ${Sr(this.b)}${e===1?")":`, ${e})`}`}function As(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Er(e){return e=Sr(e),(e<16?"0":"")+e.toString(16)}function Kh(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Zt(e,t,n,o)}function Zh(e){if(e instanceof Zt)return new Zt(e.h,e.s,e.l,e.opacity);if(e instanceof Ko||(e=_r(e)),!e)return new Zt;if(e instanceof Zt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,s=Math.min(t,n,o),a=Math.max(t,n,o),l=NaN,c=a-s,f=(a+s)/2;return c?(t===a?l=(n-o)/c+(n<o)*6:n===a?l=(o-t)/c+2:l=(t-n)/c+4,c/=f<.5?a+s:2-a-s,l*=60):c=f>0&&f<1?0:l,new Zt(l,c,f,e.opacity)}function I1(e,t,n,o){return arguments.length===1?Zh(e):new Zt(e,t,n,o??1)}function Zt(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}cc(Zt,I1,Wh(Ko,{brighter(e){return e=e==null?Ns:Math.pow(Ns,e),new Zt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zo:Math.pow(Zo,e),new Zt(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,s=2*n-o;return new bt(fc(e>=240?e-240:e+120,s,o),fc(e,s,o),fc(e<120?e+240:e-120,s,o),this.opacity)},clamp(){return new Zt(Qh(this.h),Is(this.s),Is(this.l),As(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=As(this.opacity);return`${e===1?"hsl(":"hsla("}${Qh(this.h)}, ${Is(this.s)*100}%, ${Is(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Qh(e){return e=(e||0)%360,e<0?e+360:e}function Is(e){return Math.max(0,Math.min(1,e||0))}function fc(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 dc=e=>()=>e;function O1(e,t){return function(n){return e+n*t}}function P1(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 k1(e){return(e=+e)==1?Jh:function(t,n){return n-t?P1(t,n,e):dc(isNaN(t)?n:t)}}function Jh(e,t){var n=t-e;return n?O1(e,n):dc(isNaN(e)?t:e)}const Os=function e(t){var n=k1(t);function o(s,a){var l=n((s=uc(s)).r,(a=uc(a)).r),c=n(s.g,a.g),f=n(s.b,a.b),d=Jh(s.opacity,a.opacity);return function(h){return s.r=l(h),s.g=c(h),s.b=f(h),s.opacity=d(h),s+""}}return o.gamma=e,o}(1);function M1(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),s;return function(a){for(s=0;s<n;++s)o[s]=e[s]*(1-a)+t[s]*a;return o}}function R1(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function D1(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,s=new Array(o),a=new Array(n),l;for(l=0;l<o;++l)s[l]=Jo(e[l],t[l]);for(;l<n;++l)a[l]=t[l];return function(c){for(l=0;l<o;++l)a[l]=s[l](c);return a}}function L1(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function dn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function $1(e,t){var n={},o={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=Jo(e[s],t[s]):o[s]=t[s];return function(a){for(s in n)o[s]=n[s](a);return o}}var hc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pc=new RegExp(hc.source,"g");function B1(e){return function(){return e}}function F1(e){return function(t){return e(t)+""}}function ep(e,t){var n=hc.lastIndex=pc.lastIndex=0,o,s,a,l=-1,c=[],f=[];for(e=e+"",t=t+"";(o=hc.exec(e))&&(s=pc.exec(t));)(a=s.index)>n&&(a=t.slice(n,a),c[l]?c[l]+=a:c[++l]=a),(o=o[0])===(s=s[0])?c[l]?c[l]+=s:c[++l]=s:(c[++l]=null,f.push({i:l,x:dn(o,s)})),n=pc.lastIndex;return n<t.length&&(a=t.slice(n),c[l]?c[l]+=a:c[++l]=a),c.length<2?f[0]?F1(f[0].x):B1(t):(t=f.length,function(d){for(var h=0,g;h<t;++h)c[(g=f[h]).i]=g.x(d);return c.join("")})}function Jo(e,t){var n=typeof t,o;return t==null||n==="boolean"?dc(t):(n==="number"?dn:n==="string"?(o=_r(t))?(t=o,Os):ep:t instanceof _r?Os:t instanceof Date?L1:R1(t)?M1:Array.isArray(t)?D1:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?$1:dn)(e,t)}var tp=180/Math.PI,gc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function np(e,t,n,o,s,a){var l,c,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*o)&&(n-=e*f,o-=t*f),(c=Math.sqrt(n*n+o*o))&&(n/=c,o/=c,f/=c),e*o<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:s,translateY:a,rotate:Math.atan2(t,e)*tp,skewX:Math.atan(f)*tp,scaleX:l,scaleY:c}}var Ps;function H1(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?gc:np(t.a,t.b,t.c,t.d,t.e,t.f)}function z1(e){return e==null||(Ps||(Ps=document.createElementNS("http://www.w3.org/2000/svg","g")),Ps.setAttribute("transform",e),!(e=Ps.transform.baseVal.consolidate()))?gc:(e=e.matrix,np(e.a,e.b,e.c,e.d,e.e,e.f))}function rp(e,t,n,o){function s(d){return d.length?d.pop()+" ":""}function a(d,h,g,p,m,x){if(d!==g||h!==p){var v=m.push("translate(",null,t,null,n);x.push({i:v-4,x:dn(d,g)},{i:v-2,x:dn(h,p)})}else(g||p)&&m.push("translate("+g+t+p+n)}function l(d,h,g,p){d!==h?(d-h>180?h+=360:h-d>180&&(d+=360),p.push({i:g.push(s(g)+"rotate(",null,o)-2,x:dn(d,h)})):h&&g.push(s(g)+"rotate("+h+o)}function c(d,h,g,p){d!==h?p.push({i:g.push(s(g)+"skewX(",null,o)-2,x:dn(d,h)}):h&&g.push(s(g)+"skewX("+h+o)}function f(d,h,g,p,m,x){if(d!==g||h!==p){var v=m.push(s(m)+"scale(",null,",",null,")");x.push({i:v-4,x:dn(d,g)},{i:v-2,x:dn(h,p)})}else(g!==1||p!==1)&&m.push(s(m)+"scale("+g+","+p+")")}return function(d,h){var g=[],p=[];return d=e(d),h=e(h),a(d.translateX,d.translateY,h.translateX,h.translateY,g,p),l(d.rotate,h.rotate,g,p),c(d.skewX,h.skewX,g,p),f(d.scaleX,d.scaleY,h.scaleX,h.scaleY,g,p),d=h=null,function(m){for(var x=-1,v=p.length,b;++x<v;)g[(b=p[x]).i]=b.x(m);return g.join("")}}}var V1=rp(H1,"px, ","px)","deg)"),W1=rp(z1,", ",")",")"),j1=1e-12;function op(e){return((e=Math.exp(e))+1/e)/2}function U1(e){return((e=Math.exp(e))-1/e)/2}function G1(e){return((e=Math.exp(2*e))-1)/(e+1)}const ks=function e(t,n,o){function s(a,l){var c=a[0],f=a[1],d=a[2],h=l[0],g=l[1],p=l[2],m=h-c,x=g-f,v=m*m+x*x,b,_;if(v<j1)_=Math.log(p/d)/t,b=function(M){return[c+M*m,f+M*x,d*Math.exp(t*M*_)]};else{var N=Math.sqrt(v),w=(p*p-d*d+o*v)/(2*d*n*N),E=(p*p-d*d-o*v)/(2*p*n*N),O=Math.log(Math.sqrt(w*w+1)-w),k=Math.log(Math.sqrt(E*E+1)-E);_=(k-O)/t,b=function(M){var D=M*_,V=op(O),K=d/(n*N)*(V*G1(t*D+O)-U1(O));return[c+K*m,f+K*x,d*V/op(t*D+O)]}}return b.duration=_*1e3*t/Math.SQRT2,b}return s.rho=function(a){var l=Math.max(.001,+a),c=l*l,f=c*c;return e(l,c,f)},s}(Math.SQRT2,2,4);var eo=0,ei=0,ti=0,ip=1e3,Ms,ni,Rs=0,Cr=0,Ds=0,ri=typeof performance=="object"&&performance.now?performance:Date,sp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mc(){return Cr||(sp(Y1),Cr=ri.now()+Ds)}function Y1(){Cr=0}function Ls(){this._call=this._time=this._next=null}Ls.prototype=ap.prototype={constructor:Ls,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mc():+n)+(t==null?0:+t),!this._next&&ni!==this&&(ni?ni._next=this:Ms=this,ni=this),this._call=e,this._time=n,yc()},stop:function(){this._call&&(this._call=null,this._time=1/0,yc())}};function ap(e,t,n){var o=new Ls;return o.restart(e,t,n),o}function X1(){mc(),++eo;for(var e=Ms,t;e;)(t=Cr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--eo}function lp(){Cr=(Rs=ri.now())+Ds,eo=ei=0;try{X1()}finally{eo=0,K1(),Cr=0}}function q1(){var e=ri.now(),t=e-Rs;t>ip&&(Ds-=t,Rs=e)}function K1(){for(var e,t=Ms,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:Ms=n);ni=e,yc(o)}function yc(e){if(!eo){ei&&(ei=clearTimeout(ei));var t=e-Cr;t>24?(e<1/0&&(ei=setTimeout(lp,e-ri.now()-Ds)),ti&&(ti=clearInterval(ti))):(ti||(Rs=ri.now(),ti=setInterval(q1,ip)),eo=1,sp(lp))}}function cp(e,t,n){var o=new Ls;return t=t==null?0:+t,o.restart(s=>{o.stop(),e(s+t)},t,n),o}var Z1=bs("start","end","cancel","interrupt"),Q1=[],up=0,fp=1,vc=2,$s=3,dp=4,xc=5,Bs=6;function Fs(e,t,n,o,s,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;J1(e,n,{name:t,index:o,group:s,on:Z1,tween:Q1,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:up})}function wc(e,t){var n=Qt(e,t);if(n.state>up)throw new Error("too late; already scheduled");return n}function hn(e,t){var n=Qt(e,t);if(n.state>$s)throw new Error("too late; already running");return n}function Qt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function J1(e,t,n){var o=e.__transition,s;o[t]=n,n.timer=ap(a,0,n.time);function a(d){n.state=fp,n.timer.restart(l,n.delay,n.time),n.delay<=d&&l(d-n.delay)}function l(d){var h,g,p,m;if(n.state!==fp)return f();for(h in o)if(m=o[h],m.name===n.name){if(m.state===$s)return cp(l);m.state===dp?(m.state=Bs,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[h]):+h<t&&(m.state=Bs,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[h])}if(cp(function(){n.state===$s&&(n.state=dp,n.timer.restart(c,n.delay,n.time),c(d))}),n.state=vc,n.on.call("start",e,e.__data__,n.index,n.group),n.state===vc){for(n.state=$s,s=new Array(p=n.tween.length),h=0,g=-1;h<p;++h)(m=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++g]=m);s.length=g+1}}function c(d){for(var h=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(f),n.state=xc,1),g=-1,p=s.length;++g<p;)s[g].call(e,h);n.state===xc&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Bs,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function Hs(e,t){var n=e.__transition,o,s,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){a=!1;continue}s=o.state>vc&&o.state<xc,o.state=Bs,o.timer.stop(),o.on.call(s?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}a&&delete e.__transition}}function eS(e){return this.each(function(){Hs(this,e)})}function tS(e,t){var n,o;return function(){var s=hn(this,e),a=s.tween;if(a!==n){o=n=a;for(var l=0,c=o.length;l<c;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}s.tween=o}}function nS(e,t,n){var o,s;if(typeof n!="function")throw new Error;return function(){var a=hn(this,e),l=a.tween;if(l!==o){s=(o=l).slice();for(var c={name:t,value:n},f=0,d=s.length;f<d;++f)if(s[f].name===t){s[f]=c;break}f===d&&s.push(c)}a.tween=s}}function rS(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Qt(this.node(),n).tween,s=0,a=o.length,l;s<a;++s)if((l=o[s]).name===e)return l.value;return null}return this.each((t==null?tS:nS)(n,e,t))}function bc(e,t,n){var o=e._id;return e.each(function(){var s=hn(this,o);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Qt(s,o).value[t]}}function hp(e,t){var n;return(typeof t=="number"?dn:t instanceof _r?Os:(n=_r(t))?(t=n,Os):ep)(e,t)}function oS(e){return function(){this.removeAttribute(e)}}function iS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sS(e,t,n){var o,s=n+"",a;return function(){var l=this.getAttribute(e);return l===s?null:l===o?a:a=t(o=l,n)}}function aS(e,t,n){var o,s=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===o?a:a=t(o=l,n)}}function lS(e,t,n){var o,s,a;return function(){var l,c=n(this),f;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=c+"",l===f?null:l===o&&f===s?a:(s=f,a=t(o=l,c)))}}function cS(e,t,n){var o,s,a;return function(){var l,c=n(this),f;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=c+"",l===f?null:l===o&&f===s?a:(s=f,a=t(o=l,c)))}}function uS(e,t){var n=Ss(e),o=n==="transform"?W1:hp;return this.attrTween(e,typeof t=="function"?(n.local?cS:lS)(n,o,bc(this,"attr."+e,t)):t==null?(n.local?iS:oS)(n):(n.local?aS:sS)(n,o,t))}function fS(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dS(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hS(e,t){var n,o;function s(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&dS(e,a)),n}return s._value=t,s}function pS(e,t){var n,o;function s(){var a=t.apply(this,arguments);return a!==o&&(n=(o=a)&&fS(e,a)),n}return s._value=t,s}function gS(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=Ss(e);return this.tween(n,(o.local?hS:pS)(o,t))}function mS(e,t){return function(){wc(this,e).delay=+t.apply(this,arguments)}}function yS(e,t){return t=+t,function(){wc(this,e).delay=t}}function vS(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mS:yS)(t,e)):Qt(this.node(),t).delay}function xS(e,t){return function(){hn(this,e).duration=+t.apply(this,arguments)}}function wS(e,t){return t=+t,function(){hn(this,e).duration=t}}function bS(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xS:wS)(t,e)):Qt(this.node(),t).duration}function _S(e,t){if(typeof t!="function")throw new Error;return function(){hn(this,e).ease=t}}function SS(e){var t=this._id;return arguments.length?this.each(_S(t,e)):Qt(this.node(),t).ease}function ES(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;hn(this,e).ease=n}}function CS(e){if(typeof e!="function")throw new Error;return this.each(ES(this._id,e))}function NS(e){typeof e!="function"&&(e=Oh(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var a=t[s],l=a.length,c=o[s]=[],f,d=0;d<l;++d)(f=a[d])&&e.call(f,f.__data__,d,a)&&c.push(f);return new In(o,this._parents,this._name,this._id)}function TS(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,s=n.length,a=Math.min(o,s),l=new Array(o),c=0;c<a;++c)for(var f=t[c],d=n[c],h=f.length,g=l[c]=new Array(h),p,m=0;m<h;++m)(p=f[m]||d[m])&&(g[m]=p);for(;c<o;++c)l[c]=t[c];return new In(l,this._parents,this._name,this._id)}function AS(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 IS(e,t,n){var o,s,a=AS(t)?wc:hn;return function(){var l=a(this,e),c=l.on;c!==o&&(s=(o=c).copy()).on(t,n),l.on=s}}function OS(e,t){var n=this._id;return arguments.length<2?Qt(this.node(),n).on.on(e):this.each(IS(n,e,t))}function PS(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function kS(){return this.on("end.remove",PS(this._id))}function MS(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ic(e));for(var o=this._groups,s=o.length,a=new Array(s),l=0;l<s;++l)for(var c=o[l],f=c.length,d=a[l]=new Array(f),h,g,p=0;p<f;++p)(h=c[p])&&(g=e.call(h,h.__data__,p,c))&&("__data__"in h&&(g.__data__=h.__data__),d[p]=g,Fs(d[p],t,n,p,d,Qt(h,n)));return new In(a,this._parents,t,n)}function RS(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ih(e));for(var o=this._groups,s=o.length,a=[],l=[],c=0;c<s;++c)for(var f=o[c],d=f.length,h,g=0;g<d;++g)if(h=f[g]){for(var p=e.call(h,h.__data__,g,f),m,x=Qt(h,n),v=0,b=p.length;v<b;++v)(m=p[v])&&Fs(m,t,n,v,p,x);a.push(p),l.push(h)}return new In(a,l,t,n)}var DS=Xo.prototype.constructor;function LS(){return new DS(this._groups,this._parents)}function $S(e,t){var n,o,s;return function(){var a=Zr(this,e),l=(this.style.removeProperty(e),Zr(this,e));return a===l?null:a===n&&l===o?s:s=t(n=a,o=l)}}function pp(e){return function(){this.style.removeProperty(e)}}function BS(e,t,n){var o,s=n+"",a;return function(){var l=Zr(this,e);return l===s?null:l===o?a:a=t(o=l,n)}}function FS(e,t,n){var o,s,a;return function(){var l=Zr(this,e),c=n(this),f=c+"";return c==null&&(f=c=(this.style.removeProperty(e),Zr(this,e))),l===f?null:l===o&&f===s?a:(s=f,a=t(o=l,c))}}function HS(e,t){var n,o,s,a="style."+t,l="end."+a,c;return function(){var f=hn(this,e),d=f.on,h=f.value[a]==null?c||(c=pp(t)):void 0;(d!==n||s!==h)&&(o=(n=d).copy()).on(l,s=h),f.on=o}}function zS(e,t,n){var o=(e+="")=="transform"?V1:hp;return t==null?this.styleTween(e,$S(e,o)).on("end.style."+e,pp(e)):typeof t=="function"?this.styleTween(e,FS(e,o,bc(this,"style."+e,t))).each(HS(this._id,e)):this.styleTween(e,BS(e,o,t),n).on("end.style."+e,null)}function VS(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function WS(e,t,n){var o,s;function a(){var l=t.apply(this,arguments);return l!==s&&(o=(s=l)&&VS(e,l,n)),o}return a._value=t,a}function jS(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,WS(e,t,n??""))}function US(e){return function(){this.textContent=e}}function GS(e){return function(){var t=e(this);this.textContent=t??""}}function YS(e){return this.tween("text",typeof e=="function"?GS(bc(this,"text",e)):US(e==null?"":e+""))}function XS(e){return function(t){this.textContent=e.call(this,t)}}function qS(e){var t,n;function o(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&XS(s)),t}return o._value=e,o}function KS(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,qS(e))}function ZS(){for(var e=this._name,t=this._id,n=gp(),o=this._groups,s=o.length,a=0;a<s;++a)for(var l=o[a],c=l.length,f,d=0;d<c;++d)if(f=l[d]){var h=Qt(f,t);Fs(f,e,n,d,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new In(o,this._parents,e,n)}function QS(){var e,t,n=this,o=n._id,s=n.size();return new Promise(function(a,l){var c={value:l},f={value:function(){--s===0&&a()}};n.each(function(){var d=hn(this,o),h=d.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(f)),d.on=t}),s===0&&a()})}var JS=0;function In(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function gp(){return++JS}var On=Xo.prototype;In.prototype={constructor:In,select:MS,selectAll:RS,selectChild:On.selectChild,selectChildren:On.selectChildren,filter:NS,merge:TS,selection:LS,transition:ZS,call:On.call,nodes:On.nodes,node:On.node,size:On.size,empty:On.empty,each:On.each,on:OS,attr:uS,attrTween:gS,style:zS,styleTween:jS,text:YS,textTween:KS,remove:kS,tween:rS,delay:vS,duration:bS,ease:SS,easeVarying:CS,end:QS,[Symbol.iterator]:On[Symbol.iterator]};function eE(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tE={time:null,delay:0,duration:250,ease:eE};function nE(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 rE(e){var t,n;e instanceof In?(t=e._id,e=e._name):(t=gp(),(n=tE).time=mc(),e=e==null?null:e+"");for(var o=this._groups,s=o.length,a=0;a<s;++a)for(var l=o[a],c=l.length,f,d=0;d<c;++d)(f=l[d])&&Fs(f,e,t,d,l,n||nE(f,t));return new In(o,this._parents,e,t)}Xo.prototype.interrupt=eS,Xo.prototype.transition=rE;const zs=e=>()=>e;function oE(e,{sourceEvent:t,target:n,transform:o,dispatch:s}){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:s}})}function Pn(e,t,n){this.k=e,this.x=t,this.y=n}Pn.prototype={constructor:Pn,scale:function(e){return e===1?this:new Pn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pn(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 Vs=new Pn(1,0,0);mp.prototype=Pn.prototype;function mp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vs;return e.__zoom}function _c(e){e.stopImmediatePropagation()}function oi(e){e.preventDefault(),e.stopImmediatePropagation()}function iE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function sE(){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 yp(){return this.__zoom||Vs}function aE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lE(){return navigator.maxTouchPoints||"ontouchstart"in this}function cE(e,t,n){var o=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function vp(){var e=iE,t=sE,n=cE,o=aE,s=lE,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,f=ks,d=bs("start","zoom","end"),h,g,p,m=500,x=150,v=0,b=10;function _(C){C.property("__zoom",yp).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",K).filter(s).on("touchstart.zoom",Z).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(C,H,B,R){var P=C.selection?C.selection():C;P.property("__zoom",yp),C!==P?O(C,H,B,R):P.interrupt().each(function(){k(this,arguments).event(R).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},_.scaleBy=function(C,H,B,R){_.scaleTo(C,function(){var P=this.__zoom.k,W=typeof H=="function"?H.apply(this,arguments):H;return P*W},B,R)},_.scaleTo=function(C,H,B,R){_.transform(C,function(){var P=t.apply(this,arguments),W=this.__zoom,$=B==null?E(P):typeof B=="function"?B.apply(this,arguments):B,G=W.invert($),J=typeof H=="function"?H.apply(this,arguments):H;return n(w(N(W,J),$,G),P,l)},B,R)},_.translateBy=function(C,H,B,R){_.transform(C,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,R)},_.translateTo=function(C,H,B,R,P){_.transform(C,function(){var W=t.apply(this,arguments),$=this.__zoom,G=R==null?E(W):typeof R=="function"?R.apply(this,arguments):R;return n(Vs.translate(G[0],G[1]).scale($.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof B=="function"?-B.apply(this,arguments):-B),W,l)},R,P)};function N(C,H){return H=Math.max(a[0],Math.min(a[1],H)),H===C.k?C:new Pn(H,C.x,C.y)}function w(C,H,B){var R=H[0]-B[0]*C.k,P=H[1]-B[1]*C.k;return R===C.x&&P===C.y?C:new Pn(C.k,R,P)}function E(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function O(C,H,B,R){C.on("start.zoom",function(){k(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(R).end()}).tween("zoom",function(){var P=this,W=arguments,$=k(P,W).event(R),G=t.apply(P,W),J=B==null?E(G):typeof B=="function"?B.apply(P,W):B,re=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),se=P.__zoom,ce=typeof H=="function"?H.apply(P,W):H,ge=f(se.invert(J).concat(re/se.k),ce.invert(J).concat(re/ce.k));return function(te){if(te===1)te=ce;else{var Q=ge(te),ae=re/Q[2];te=new Pn(ae,J[0]-Q[0]*ae,J[1]-Q[1]*ae)}$.zoom(null,te)}})}function k(C,H,B){return!B&&C.__zooming||new M(C,H)}function M(C,H){this.that=C,this.args=H,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,H),this.taps=0}M.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,H){return this.mouse&&C!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var H=Ot(this.that).datum();d.call(C,this.that,new oE(C,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),H)}};function D(C,...H){if(!e.apply(this,arguments))return;var B=k(this,H).event(C),R=this.__zoom,P=Math.max(a[0],Math.min(a[1],R.k*Math.pow(2,o.apply(this,arguments)))),W=Kt(C);if(B.wheel)(B.mouse[0][0]!==W[0]||B.mouse[0][1]!==W[1])&&(B.mouse[1]=R.invert(B.mouse[0]=W)),clearTimeout(B.wheel);else{if(R.k===P)return;B.mouse=[W,R.invert(W)],Hs(this),B.start()}oi(C),B.wheel=setTimeout($,x),B.zoom("mouse",n(w(N(R,P),B.mouse[0],B.mouse[1]),B.extent,l));function $(){B.wheel=null,B.end()}}function V(C,...H){if(p||!e.apply(this,arguments))return;var B=C.currentTarget,R=k(this,H,!0).event(C),P=Ot(C.view).on("mousemove.zoom",J,!0).on("mouseup.zoom",re,!0),W=Kt(C,B),$=C.clientX,G=C.clientY;Hh(C.view),_c(C),R.mouse=[W,this.__zoom.invert(W)],Hs(this),R.start();function J(se){if(oi(se),!R.moved){var ce=se.clientX-$,ge=se.clientY-G;R.moved=ce*ce+ge*ge>v}R.event(se).zoom("mouse",n(w(R.that.__zoom,R.mouse[0]=Kt(se,B),R.mouse[1]),R.extent,l))}function re(se){P.on("mousemove.zoom mouseup.zoom",null),zh(se.view,R.moved),oi(se),R.event(se).end()}}function K(C,...H){if(e.apply(this,arguments)){var B=this.__zoom,R=Kt(C.changedTouches?C.changedTouches[0]:C,this),P=B.invert(R),W=B.k*(C.shiftKey?.5:2),$=n(w(N(B,W),R,P),t.apply(this,H),l);oi(C),c>0?Ot(this).transition().duration(c).call(O,$,R,C):Ot(this).call(_.transform,$,R,C)}}function Z(C,...H){if(e.apply(this,arguments)){var B=C.touches,R=B.length,P=k(this,H,C.changedTouches.length===R).event(C),W,$,G,J;for(_c(C),$=0;$<R;++$)G=B[$],J=Kt(G,this),J=[J,this.__zoom.invert(J),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==J[2]&&(P.touch1=J,P.taps=0):(P.touch0=J,W=!0,P.taps=1+!!h);h&&(h=clearTimeout(h)),W&&(P.taps<2&&(g=J[0],h=setTimeout(function(){h=null},m)),Hs(this),P.start())}}function U(C,...H){if(this.__zooming){var B=k(this,H).event(C),R=C.changedTouches,P=R.length,W,$,G,J;for(oi(C),W=0;W<P;++W)$=R[W],G=Kt($,this),B.touch0&&B.touch0[2]===$.identifier?B.touch0[0]=G:B.touch1&&B.touch1[2]===$.identifier&&(B.touch1[0]=G);if($=B.that.__zoom,B.touch1){var re=B.touch0[0],se=B.touch0[1],ce=B.touch1[0],ge=B.touch1[1],te=(te=ce[0]-re[0])*te+(te=ce[1]-re[1])*te,Q=(Q=ge[0]-se[0])*Q+(Q=ge[1]-se[1])*Q;$=N($,Math.sqrt(te/Q)),G=[(re[0]+ce[0])/2,(re[1]+ce[1])/2],J=[(se[0]+ge[0])/2,(se[1]+ge[1])/2]}else if(B.touch0)G=B.touch0[0],J=B.touch0[1];else return;B.zoom("touch",n(w($,G,J),B.extent,l))}}function q(C,...H){if(this.__zooming){var B=k(this,H).event(C),R=C.changedTouches,P=R.length,W,$;for(_c(C),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),W=0;W<P;++W)$=R[W],B.touch0&&B.touch0[2]===$.identifier?delete B.touch0:B.touch1&&B.touch1[2]===$.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&($=Kt($,this),Math.hypot(g[0]-$[0],g[1]-$[1])<b)){var G=Ot(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return _.wheelDelta=function(C){return arguments.length?(o=typeof C=="function"?C:zs(+C),_):o},_.filter=function(C){return arguments.length?(e=typeof C=="function"?C:zs(!!C),_):e},_.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:zs(!!C),_):s},_.extent=function(C){return arguments.length?(t=typeof C=="function"?C:zs([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),_):t},_.scaleExtent=function(C){return arguments.length?(a[0]=+C[0],a[1]=+C[1],_):[a[0],a[1]]},_.translateExtent=function(C){return arguments.length?(l[0][0]=+C[0][0],l[1][0]=+C[1][0],l[0][1]=+C[0][1],l[1][1]=+C[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(C){return arguments.length?(n=C,_):n},_.duration=function(C){return arguments.length?(c=+C,_):c},_.interpolate=function(C){return arguments.length?(f=C,_):f},_.on=function(){var C=d.on.apply(d,arguments);return C===d?_:C},_.clickDistance=function(C){return arguments.length?(v=(C=+C)*C,_):Math.sqrt(v)},_.tapDistance=function(C){return arguments.length?(b=+C,_):b},_}const _t={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."},ii=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xp=["Enter"," ","Escape"],wp={"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 to;(function(e){e.Strict="strict",e.Loose="loose"})(to||(to={}));var Nr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Nr||(Nr={}));var no;(function(e){e.Partial="partial",e.Full="full"})(no||(no={}));const bp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Zn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Zn||(Zn={}));var Ws;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ws||(Ws={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));const _p={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};function uE(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 Sp(e,t,n){if(!n)return;const o=[];e.forEach((s,a)=>{t?.has(a)||o.push(s)}),o.length&&n(o)}function Ep(e){return e===null?null:e?"valid":"invalid"}const Cp=e=>"id"in e&&"source"in e&&"target"in e,fE=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Sc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),dE=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach(s=>{s.source===e.id&&o.add(s.target)}),t.filter(s=>o.has(s.id))},si=(e,t=[0,0])=>{const{width:n,height:o}=kn(e),s=e.origin??t,a=n*s[0],l=o*s[1];return{x:e.position.x-a,y:e.position.y-l}},hE=(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,s)=>{const a=typeof s=="string";let l=!t.nodeLookup&&!a?s:void 0;t.nodeLookup&&(l=a?t.nodeLookup.get(s):Sc(s)?s:t.nodeLookup.get(s.id));const c=l?Gs(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return js(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Us(n)},ai=(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 s=Gs(o);n=js(n,s)}}),Us(n)},Ec=(e,t,[n,o,s]=[0,0,1],a=!1,l=!1)=>{const c={...ui(t,[n,o,s]),width:t.width/s,height:t.height/s},f=[];for(const d of e.values()){const{measured:h,selectable:g=!0,hidden:p=!1}=d;if(l&&!g||p)continue;const m=h.width??d.width??d.initialWidth??null,x=h.height??d.height??d.initialHeight??null,v=li(c,oo(d)),b=(m??0)*(x??0),_=a&&v>0;(!d.internals.handleBounds||_||v>=b||d.dragging)&&f.push(d)}return f},Cc=(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 pE(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&(t?.includeHiddenNodes||!s.hidden)&&(!o||o.has(s.id))&&n.set(s.id,s)}),n}async function gE({nodes:e,width:t,height:n,panZoom:o,minZoom:s,maxZoom:a},l){if(e.size===0)return Promise.resolve(!0);const c=pE(e,l),f=ai(c),d=Tc(f,t,n,l?.minZoom??s,l?.maxZoom??a,l?.padding??.1);return await o.setViewport(d,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),Promise.resolve(!0)}function Np({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:s,onError:a}){const l=n.get(e),c=l.parentId?n.get(l.parentId):void 0,{x:f,y:d}=c?c.internals.positionAbsolute:{x:0,y:0},h=l.origin??o;let g=l.extent||s;if(l.extent==="parent"&&!l.expandParent)if(!c)a?.("005",_t.error005());else{const m=c.measured.width,x=c.measured.height;m&&x&&(g=[[f,d],[f+m,d+x]])}else c&&so(l.extent)&&(g=[[l.extent[0][0]+f,l.extent[0][1]+d],[l.extent[1][0]+f,l.extent[1][1]+d]]);const p=so(g)?Tr(t,g,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&a?.("015",_t.error015()),{position:{x:p.x-f+(l.measured.width??0)*h[0],y:p.y-d+(l.measured.height??0)*h[1]},positionAbsolute:p}}async function mE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:s}){const a=new Set(e.map(p=>p.id)),l=[];for(const p of n){if(p.deletable===!1)continue;const m=a.has(p.id),x=!m&&p.parentId&&l.find(v=>v.id===p.parentId);(m||x)&&l.push(p)}const c=new Set(t.map(p=>p.id)),f=o.filter(p=>p.deletable!==!1),h=Cc(l,f);for(const p of f)c.has(p.id)&&!h.find(x=>x.id===p.id)&&h.push(p);if(!s)return{edges:h,nodes:l};const g=await s({nodes:l,edges:h});return typeof g=="boolean"?g?{edges:h,nodes:l}:{edges:[],nodes:[]}:g}const ro=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tr=(e={x:0,y:0},t,n)=>({x:ro(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ro(e.y,t[0][1],t[1][1]-(n?.height??0))});function Tp(e,t,n){const{width:o,height:s}=kn(n),{x:a,y:l}=n.internals.positionAbsolute;return Tr(e,[[a,l],[a+o,l+s]],t)}const Ap=(e,t,n)=>e<t?ro(Math.abs(e-t),1,t)/t:e>n?-ro(Math.abs(e-n),1,t)/t:0,Ip=(e,t,n=15,o=40)=>{const s=Ap(e.x,o,t.width-o)*n,a=Ap(e.y,o,t.height-o)*n;return[s,a]},js=(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)}),Nc=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Us=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),oo=(e,t=[0,0])=>{const{x:n,y:o}=Sc(e)?e.internals.positionAbsolute:si(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}},Gs=(e,t=[0,0])=>{const{x:n,y:o}=Sc(e)?e.internals.positionAbsolute:si(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)}},Op=(e,t)=>Us(js(Nc(e),Nc(t))),li=(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)},Pp=e=>Jt(e.width)&&Jt(e.height)&&Jt(e.x)&&Jt(e.y),Jt=e=>!isNaN(e)&&isFinite(e),kp=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},ci=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ui=({x:e,y:t},[n,o,s],a=!1,l=[1,1])=>{const c={x:(e-n)/s,y:(t-o)/s};return a?ci(c,l):c},Ys=({x:e,y:t},[n,o,s])=>({x:e*s+n,y:t*s+o});function io(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 yE(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=io(e,n),s=io(e,t);return{top:o,right:s,bottom:o,left:s,x:s*2,y:o*2}}if(typeof e=="object"){const o=io(e.top??e.y??0,n),s=io(e.bottom??e.y??0,n),a=io(e.left??e.x??0,t),l=io(e.right??e.x??0,t);return{top:o,right:l,bottom:s,left:a,x:a+l,y:o+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vE(e,t,n,o,s,a){const{x:l,y:c}=Ys(e,[t,n,o]),{x:f,y:d}=Ys({x:e.x+e.width,y:e.y+e.height},[t,n,o]),h=s-f,g=a-d;return{left:Math.floor(l),top:Math.floor(c),right:Math.floor(h),bottom:Math.floor(g)}}const Tc=(e,t,n,o,s,a)=>{const l=yE(a,t,n),c=(t-l.x)/e.width,f=(n-l.y)/e.height,d=Math.min(c,f),h=ro(d,o,s),g=e.x+e.width/2,p=e.y+e.height/2,m=t/2-g*h,x=n/2-p*h,v=vE(e,m,x,h,t,n),b={left:Math.min(v.left-l.left,0),top:Math.min(v.top-l.top,0),right:Math.min(v.right-l.right,0),bottom:Math.min(v.bottom-l.bottom,0)};return{x:m-b.left+b.right,y:x-b.top+b.bottom,zoom:h}},fi=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function so(e){return e!=null&&e!=="parent"}function kn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Mp(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Rp(e,t={width:0,height:0},n,o,s){const a={...e},l=o.get(n);if(l){const c=l.origin||s;a.x+=l.internals.positionAbsolute.x-(t.width??0)*c[0],a.y+=l.internals.positionAbsolute.y-(t.height??0)*c[1]}return a}function Dp(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xE(){let e,t;return{promise:new Promise((o,s)=>{e=o,t=s}),resolve:e,reject:t}}function wE(e){return{...wp,...e||{}}}function di(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:s}){const{x:a,y:l}=pn(e),c=ui({x:a-(s?.left??0),y:l-(s?.top??0)},o),{x:f,y:d}=n?ci(c,t):c;return{xSnapped:f,ySnapped:d,...c}}const Ac=e=>({width:e.offsetWidth,height:e.offsetHeight}),Lp=e=>e?.getRootNode?.()||window?.document,bE=["INPUT","SELECT","TEXTAREA"];function $p(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:bE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Bp=e=>"clientX"in e,pn=(e,t)=>{const n=Bp(e),o=n?e.clientX:e.touches?.[0].clientX,s=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:s-(t?.top??0)}},Fp=(e,t,n,o,s)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:s,position:l.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...Ac(l)}})};function Hp({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c}){const f=e*.125+s*.375+l*.375+n*.125,d=t*.125+a*.375+c*.375+o*.125,h=Math.abs(f-e),g=Math.abs(d-t);return[f,d,h,g]}function Xs(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function zp({pos:e,x1:t,y1:n,x2:o,y2:s,c:a}){switch(e){case be.Left:return[t-Xs(t-o,a),n];case be.Right:return[t+Xs(o-t,a),n];case be.Top:return[t,n-Xs(n-s,a)];case be.Bottom:return[t,n+Xs(s-n,a)]}}function qs({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:o,targetY:s,targetPosition:a=be.Top,curvature:l=.25}){const[c,f]=zp({pos:n,x1:e,y1:t,x2:o,y2:s,c:l}),[d,h]=zp({pos:a,x1:o,y1:s,x2:e,y2:t,c:l}),[g,p,m,x]=Hp({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:c,sourceControlY:f,targetControlX:d,targetControlY:h});return[`M${e},${t} C${c},${f} ${d},${h} ${o},${s}`,g,p,m,x]}function Vp({sourceX:e,sourceY:t,targetX:n,targetY:o}){const s=Math.abs(n-e)/2,a=n<e?n+s:n-s,l=Math.abs(o-t)/2,c=o<t?o+l:o-l;return[a,c,s,l]}function _E({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:s=!1}){if(o!==void 0)return o;const a=s&&n?1e3:0,l=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return a+l}function SE({sourceNode:e,targetNode:t,width:n,height:o,transform:s}){const a=js(Gs(e),Gs(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const l={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:o/s[2]};return li(l,Us(a))>0}const EE=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,CE=(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)),Wp=(e,t)=>{if(!e.source||!e.target)return kp("006",_t.error006()),t;let n;return Cp(e)?n={...e}:n={...e,id:EE(e)},CE(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function jp({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[s,a,l,c]=Vp({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,s,a,l,c]}const Up={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}},NE=({source:e,sourcePosition:t=be.Bottom,target:n})=>t===be.Left||t===be.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},Gp=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function TE({source:e,sourcePosition:t=be.Bottom,target:n,targetPosition:o=be.Top,center:s,offset:a,stepPosition:l}){const c=Up[t],f=Up[o],d={x:e.x+c.x*a,y:e.y+c.y*a},h={x:n.x+f.x*a,y:n.y+f.y*a},g=NE({source:d,sourcePosition:t,target:h}),p=g.x!==0?"x":"y",m=g[p];let x=[],v,b;const _={x:0,y:0},N={x:0,y:0},[,,w,E]=Vp({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[p]*f[p]===-1){p==="x"?(v=s.x??d.x+(h.x-d.x)*l,b=s.y??(d.y+h.y)/2):(v=s.x??(d.x+h.x)/2,b=s.y??d.y+(h.y-d.y)*l);const k=[{x:v,y:d.y},{x:v,y:h.y}],M=[{x:d.x,y:b},{x:h.x,y:b}];c[p]===m?x=p==="x"?k:M:x=p==="x"?M:k}else{const k=[{x:d.x,y:h.y}],M=[{x:h.x,y:d.y}];if(p==="x"?x=c.x===m?M:k:x=c.y===m?k:M,t===o){const U=Math.abs(e[p]-n[p]);if(U<=a){const q=Math.min(a-1,a-U);c[p]===m?_[p]=(d[p]>e[p]?-1:1)*q:N[p]=(h[p]>n[p]?-1:1)*q}}if(t!==o){const U=p==="x"?"y":"x",q=c[p]===f[U],C=d[U]>h[U],H=d[U]<h[U];(c[p]===1&&(!q&&C||q&&H)||c[p]!==1&&(!q&&H||q&&C))&&(x=p==="x"?k:M)}const D={x:d.x+_.x,y:d.y+_.y},V={x:h.x+N.x,y:h.y+N.y},K=Math.max(Math.abs(D.x-x[0].x),Math.abs(V.x-x[0].x)),Z=Math.max(Math.abs(D.y-x[0].y),Math.abs(V.y-x[0].y));K>=Z?(v=(D.x+V.x)/2,b=x[0].y):(v=x[0].x,b=(D.y+V.y)/2)}return[[e,{x:d.x+_.x,y:d.y+_.y},...x,{x:h.x+N.x,y:h.y+N.y},n],v,b,w,E]}function AE(e,t,n,o){const s=Math.min(Gp(e,t)/2,Gp(t,n)/2,o),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${a+s*d},${l}Q ${a},${l} ${a},${l+s*h}`}const c=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${a},${l+s*f}Q ${a},${l} ${a+s*c},${l}`}function Ic({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:o,targetY:s,targetPosition:a=be.Top,borderRadius:l=5,centerX:c,centerY:f,offset:d=20,stepPosition:h=.5}){const[g,p,m,x,v]=TE({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:s},targetPosition:a,center:{x:c,y:f},offset:d,stepPosition:h});return[g.reduce((_,N,w)=>{let E="";return w>0&&w<g.length-1?E=AE(g[w-1],N,g[w+1],l):E=`${w===0?"M":"L"}${N.x} ${N.y}`,_+=E,_},""),p,m,x,v]}function Yp(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function IE(e){const{sourceNode:t,targetNode:n}=e;if(!Yp(t)||!Yp(n))return null;const o=t.internals.handleBounds||Xp(t.handles),s=n.internals.handleBounds||Xp(n.handles),a=qp(o?.source??[],e.sourceHandle),l=qp(e.connectionMode===to.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),e.targetHandle);if(!a||!l)return e.onError?.("008",_t.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=a?.position||be.Bottom,f=l?.position||be.Top,d=hi(t,a,c),h=hi(n,l,f);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:c,targetPosition:f}}function Xp(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 hi(e,t,n=be.Left,o=!1){const s=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:l,height:c}=t??kn(e);if(o)return{x:s+l/2,y:a+c/2};switch(t?.position??n){case be.Top:return{x:s+l/2,y:a};case be.Right:return{x:s+l,y:a+c/2};case be.Bottom:return{x:s+l/2,y:a+c};case be.Left:return{x:s,y:a+c/2}}}function qp(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Oc(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function OE(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:s}){const a=new Set;return e.reduce((l,c)=>([c.markerStart||o,c.markerEnd||s].forEach(f=>{if(f&&typeof f=="object"){const d=Oc(f,t);a.has(d)||(l.push({id:d,color:f.color||n,...f}),a.add(d))}}),l),[]).sort((l,c)=>l.id.localeCompare(c.id))}const Pc={nodeOrigin:[0,0],nodeExtent:ii,elevateNodesOnSelect:!0,defaults:{}},PE={...Pc,checkEquality:!0};function kc(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function kE(e,t,n){const o=kc(Pc,n);for(const s of e.values())if(s.parentId)Rc(s,e,t,o);else{const a=si(s,o.nodeOrigin),l=so(s.extent)?s.extent:o.nodeExtent,c=Tr(a,l,kn(s));s.internals.positionAbsolute=c}}function Mc(e,t,n,o){const s=kc(PE,o);let a=e.length>0;const l=new Map(t),c=s?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const f of e){let d=l.get(f.id);if(s.checkEquality&&f===d?.internals.userNode)t.set(f.id,d);else{const h=si(f,s.nodeOrigin),g=so(f.extent)?f.extent:s.nodeExtent,p=Tr(h,g,kn(f));d={...s.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:p,handleBounds:f.measured?d?.internals.handleBounds:void 0,z:Kp(f,c),userNode:f}},t.set(f.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(a=!1),f.parentId&&Rc(d,t,n,o)}return a}function ME(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 Rc(e,t,n,o){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l}=kc(Pc,o),c=e.parentId,f=t.get(c);if(!f){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ME(e,n);const d=s?1e3:0,{x:h,y:g,z:p}=RE(e,f,a,l,d),{positionAbsolute:m}=e.internals,x=h!==m.x||g!==m.y;(x||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:h,y:g}:m,z:p}})}function Kp(e,t){return(Jt(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function RE(e,t,n,o,s){const{x:a,y:l}=t.internals.positionAbsolute,c=kn(e),f=si(e,n),d=so(e.extent)?Tr(f,e.extent,c):f;let h=Tr({x:a+d.x,y:l+d.y},o,c);e.extent==="parent"&&(h=Tp(h,c,t));const g=Kp(e,s),p=t.internals.z??0;return{x:h.x,y:h.y,z:p>=g?p+1:g}}function Dc(e,t,n,o=[0,0]){const s=[],a=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const f=a.get(l.parentId)?.expandedRect??oo(c),d=Op(f,l.rect);a.set(l.parentId,{expandedRect:d,parent:c})}return a.size>0&&a.forEach(({expandedRect:l,parent:c},f)=>{const d=c.internals.positionAbsolute,h=kn(c),g=c.origin??o,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,m=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,x=Math.max(h.width,Math.round(l.width)),v=Math.max(h.height,Math.round(l.height)),b=(x-h.width)*g[0],_=(v-h.height)*g[1];(p>0||m>0||b||_)&&(s.push({id:f,type:"position",position:{x:c.position.x-p+b,y:c.position.y-m+_}}),n.get(f)?.forEach(N=>{e.some(w=>w.id===N.id)||s.push({id:N.id,type:"position",position:{x:N.position.x+p,y:N.position.y+m}})})),(h.width<l.width||h.height<l.height||p||m)&&s.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?g[0]*p-b:0),height:v+(m?g[1]*m-_:0)}})}),s}function DE(e,t,n,o,s,a){const l=o?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const f=[],d=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(d.transform),g=[];for(const p of e.values()){const m=t.get(p.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}const x=Ac(p.nodeElement),v=m.measured.width!==x.width||m.measured.height!==x.height;if(!!(x.width&&x.height&&(v||!m.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),N=so(m.extent)?m.extent:a;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Tp(w,x,t.get(m.parentId)):N&&(w=Tr(w,N,x));const E={...m,measured:x,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:Fp("source",p.nodeElement,_,h,m.id),target:Fp("target",p.nodeElement,_,h,m.id)}}};t.set(m.id,E),m.parentId&&Rc(E,t,n,{nodeOrigin:s}),c=!0,v&&(f.push({id:m.id,type:"dimensions",dimensions:x}),m.expandParent&&m.parentId&&g.push({id:m.id,parentId:m.parentId,rect:oo(E,s)}))}}if(g.length>0){const p=Dc(g,t,n,s);f.push(...p)}return{changes:f,updatedInternals:c}}async function LE({delta:e,panZoom:t,transform:n,translateExtent:o,width:s,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,a]],o),c=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(c)}function Zp(e,t,n,o,s,a){let l=s;const c=o.get(l)||new Map;o.set(l,c.set(n,t)),l=`${s}-${e}`;const f=o.get(l)||new Map;if(o.set(l,f.set(n,t)),a){l=`${s}-${e}-${a}`;const d=o.get(l)||new Map;o.set(l,d.set(n,t))}}function Qp(e,t,n){e.clear(),t.clear();for(const o of n){const{source:s,target:a,sourceHandle:l=null,targetHandle:c=null}=o,f={edgeId:o.id,source:s,target:a,sourceHandle:l,targetHandle:c},d=`${s}-${l}--${a}-${c}`,h=`${a}-${c}--${s}-${l}`;Zp("source",f,h,e,s,l),Zp("target",f,d,e,a,c),t.set(o.id,o)}}function $E(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 s=0;s<n.length;s++)if(n[s].id!==o[s].id||n[s].type!==o[s].type||!Object.is(n[s].data,o[s].data))return!1;return!0}function Jp(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Jp(n,t):!1}function eg(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 BE(e,t,n,o){const s=new Map;for(const[a,l]of e)if((l.selected||l.id===o)&&(!l.parentId||!Jp(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const c=e.get(a);c&&s.set(a,{id:a,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return s}function Lc({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const s=[];for(const[l,c]of t){const f=n.get(l)?.internals.userNode;f&&s.push({...f,position:c.position,dragging:o})}if(!e)return[s[0],s];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:o}:s[0],s]}function FE({dragItems:e,snapGrid:t,x:n,y:o}){const s=e.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:o-s.distance.y},l=ci(a,t);return{x:l.x-a.x,y:l.y-a.y}}function HE({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:s}){let a={x:null,y:null},l=0,c=new Map,f=!1,d={x:0,y:0},h=null,g=!1,p=null,m=!1,x=!1,v=null;function b({noDragClassName:N,handleSelector:w,domNode:E,isSelectable:O,nodeId:k,nodeClickDistance:M=0}){p=Ot(E);function D({x:U,y:q}){const{nodeLookup:C,nodeExtent:H,snapGrid:B,snapToGrid:R,nodeOrigin:P,onNodeDrag:W,onSelectionDrag:$,onError:G,updateNodePositions:J}=t();a={x:U,y:q};let re=!1;const se=c.size>1,ce=se&&H?Nc(ai(c)):null,ge=se&&R?FE({dragItems:c,snapGrid:B,x:U,y:q}):null;for(const[te,Q]of c){if(!C.has(te))continue;let ae={x:U-Q.distance.x,y:q-Q.distance.y};R&&(ae=ge?{x:Math.round(ae.x+ge.x),y:Math.round(ae.y+ge.y)}:ci(ae,B));let fe=null;if(se&&H&&!Q.extent&&ce){const{positionAbsolute:_e}=Q.internals,ye=_e.x-ce.x+H[0][0],Le=_e.x+Q.measured.width-ce.x2+H[1][0],Ze=_e.y-ce.y+H[0][1],Ge=_e.y+Q.measured.height-ce.y2+H[1][1];fe=[[ye,Ze],[Le,Ge]]}const{position:de,positionAbsolute:ue}=Np({nodeId:te,nextPosition:ae,nodeLookup:C,nodeExtent:fe||H,nodeOrigin:P,onError:G});re=re||Q.position.x!==de.x||Q.position.y!==de.y,Q.position=de,Q.internals.positionAbsolute=ue}if(x=x||re,!!re&&(J(c,!0),v&&(o||W||!k&&$))){const[te,Q]=Lc({nodeId:k,dragItems:c,nodeLookup:C});o?.(v,c,te,Q),W?.(v,te,Q),k||$?.(v,Q)}}async function V(){if(!h)return;const{transform:U,panBy:q,autoPanSpeed:C,autoPanOnNodeDrag:H}=t();if(!H){f=!1,cancelAnimationFrame(l);return}const[B,R]=Ip(d,h,C);(B!==0||R!==0)&&(a.x=(a.x??0)-B/U[2],a.y=(a.y??0)-R/U[2],await q({x:B,y:R})&&D(a)),l=requestAnimationFrame(V)}function K(U){const{nodeLookup:q,multiSelectionActive:C,nodesDraggable:H,transform:B,snapGrid:R,snapToGrid:P,selectNodesOnDrag:W,onNodeDragStart:$,onSelectionDragStart:G,unselectNodesAndEdges:J}=t();g=!0,(!W||!O)&&!C&&k&&(q.get(k)?.selected||J()),O&&W&&k&&e?.(k);const re=di(U.sourceEvent,{transform:B,snapGrid:R,snapToGrid:P,containerBounds:h});if(a=re,c=BE(q,H,re,k),c.size>0&&(n||$||!k&&G)){const[se,ce]=Lc({nodeId:k,dragItems:c,nodeLookup:q});n?.(U.sourceEvent,c,se,ce),$?.(U.sourceEvent,se,ce),k||G?.(U.sourceEvent,ce)}}const Z=Vh().clickDistance(M).on("start",U=>{const{domNode:q,nodeDragThreshold:C,transform:H,snapGrid:B,snapToGrid:R}=t();h=q?.getBoundingClientRect()||null,m=!1,x=!1,v=U.sourceEvent,C===0&&K(U),a=di(U.sourceEvent,{transform:H,snapGrid:B,snapToGrid:R,containerBounds:h}),d=pn(U.sourceEvent,h)}).on("drag",U=>{const{autoPanOnNodeDrag:q,transform:C,snapGrid:H,snapToGrid:B,nodeDragThreshold:R,nodeLookup:P}=t(),W=di(U.sourceEvent,{transform:C,snapGrid:H,snapToGrid:B,containerBounds:h});if(v=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||k&&!P.has(k))&&(m=!0),!m){if(!f&&q&&g&&(f=!0,V()),!g){const $=W.xSnapped-(a.x??0),G=W.ySnapped-(a.y??0);Math.sqrt($*$+G*G)>R&&K(U)}(a.x!==W.xSnapped||a.y!==W.ySnapped)&&c&&g&&(d=pn(U.sourceEvent,h),D(W))}}).on("end",U=>{if(!(!g||m)&&(f=!1,g=!1,cancelAnimationFrame(l),c.size>0)){const{nodeLookup:q,updateNodePositions:C,onNodeDragStop:H,onSelectionDragStop:B}=t();if(x&&(C(c,!1),x=!1),s||H||!k&&B){const[R,P]=Lc({nodeId:k,dragItems:c,nodeLookup:q,dragging:!1});s?.(U.sourceEvent,c,R,P),H?.(U.sourceEvent,R,P),k||B?.(U.sourceEvent,P)}}}).filter(U=>{const q=U.target;return!U.button&&(!N||!eg(q,`.${N}`,E))&&(!w||eg(q,w,E))});p.call(Z)}function _(){p?.on(".drag",null)}return{update:b,destroy:_}}function zE(e,t,n){const o=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())li(s,oo(a))>0&&o.push(a);return o}const VE=250;function WE(e,t,n,o){let s=[],a=1/0;const l=zE(e,n,t+VE);for(const c of l){const f=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const d of f){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:h,y:g}=hi(c,d,d.position,!0),p=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(g-e.y,2));p>t||(p<a?(s=[{...d,x:h,y:g}],a=p):p===a&&s.push({...d,x:h,y:g}))}}if(!s.length)return null;if(s.length>1){const c=o.type==="source"?"target":"source";return s.find(f=>f.type===c)??s[0]}return s[0]}function tg(e,t,n,o,s,a=!1){const l=o.get(e);if(!l)return null;const c=s==="strict"?l.internals.handleBounds?.[t]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],f=(n?c?.find(d=>d.id===n):c?.[0])??null;return f&&a?{...f,...hi(l,f,f.position,!0)}:f}function ng(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function jE(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rg=()=>!0;function UE(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:s,edgeUpdaterType:a,isTarget:l,domNode:c,nodeLookup:f,lib:d,autoPanOnConnect:h,flowId:g,panBy:p,cancelConnection:m,onConnectStart:x,onConnect:v,onConnectEnd:b,isValidConnection:_=rg,onReconnectEnd:N,updateConnection:w,getTransform:E,getFromHandle:O,autoPanSpeed:k,dragThreshold:M=1,handleDomNode:D}){const V=Lp(e.target);let K=0,Z;const{x:U,y:q}=pn(e),C=ng(a,D),H=c?.getBoundingClientRect();let B=!1;if(!H||!C)return;const R=tg(s,C,o,f,t);if(!R)return;let P=pn(e,H),W=!1,$=null,G=!1,J=null;function re(){if(!h||!H)return;const[de,ue]=Ip(P,H,k);p({x:de,y:ue}),K=requestAnimationFrame(re)}const se={...R,nodeId:s,type:C,position:R.position},ce=f.get(s);let te={inProgress:!0,isValid:null,from:hi(ce,se,be.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:ce,to:P,toHandle:null,toPosition:_p[se.position],toNode:null};function Q(){B=!0,w(te),x?.(e,{nodeId:s,handleId:o,handleType:C})}M===0&&Q();function ae(de){if(!B){const{x:Le,y:Ze}=pn(de),Ge=Le-U,Fn=Ze-q;if(!(Ge*Ge+Fn*Fn>M*M))return;Q()}if(!O()||!se){fe(de);return}const ue=E();P=pn(de,H),Z=WE(ui(P,ue,!1,[1,1]),n,f,se),W||(re(),W=!0);const _e=og(de,{handle:Z,connectionMode:t,fromNodeId:s,fromHandleId:o,fromType:l?"target":"source",isValidConnection:_,doc:V,lib:d,flowId:g,nodeLookup:f});J=_e.handleDomNode,$=_e.connection,G=jE(!!Z,_e.isValid);const ye={...te,isValid:G,to:_e.toHandle&&G?Ys({x:_e.toHandle.x,y:_e.toHandle.y},ue):P,toHandle:_e.toHandle,toPosition:G&&_e.toHandle?_e.toHandle.position:_p[se.position],toNode:_e.toHandle?f.get(_e.toHandle.nodeId):null};G&&Z&&te.toHandle&&ye.toHandle&&te.toHandle.type===ye.toHandle.type&&te.toHandle.nodeId===ye.toHandle.nodeId&&te.toHandle.id===ye.toHandle.id&&te.to.x===ye.to.x&&te.to.y===ye.to.y||(w(ye),te=ye)}function fe(de){if(B){(Z||J)&&$&&G&&v?.($);const{inProgress:ue,..._e}=te,ye={..._e,toPosition:te.toHandle?te.toPosition:null};b?.(de,ye),a&&N?.(de,ye)}m(),cancelAnimationFrame(K),W=!1,G=!1,$=null,J=null,V.removeEventListener("mousemove",ae),V.removeEventListener("mouseup",fe),V.removeEventListener("touchmove",ae),V.removeEventListener("touchend",fe)}V.addEventListener("mousemove",ae),V.addEventListener("mouseup",fe),V.addEventListener("touchmove",ae),V.addEventListener("touchend",fe)}function og(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:s,fromType:a,doc:l,lib:c,flowId:f,isValidConnection:d=rg,nodeLookup:h}){const g=a==="target",p=t?l.querySelector(`.${c}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:x}=pn(e),v=l.elementFromPoint(m,x),b=v?.classList.contains(`${c}-flow__handle`)?v:p,_={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=ng(void 0,b),w=b.getAttribute("data-nodeid"),E=b.getAttribute("data-handleid"),O=b.classList.contains("connectable"),k=b.classList.contains("connectableend");if(!w||!N)return _;const M={source:g?w:o,sourceHandle:g?E:s,target:g?o:w,targetHandle:g?s:E};_.connection=M;const V=O&&k&&(n===to.Strict?g&&N==="source"||!g&&N==="target":w!==o||E!==s);_.isValid=V&&d(M),_.toHandle=tg(w,N,E,h,n,!0)}return _}const $c={onPointerDown:UE,isValid:og};function GE({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const s=Ot(e);function a({translateExtent:c,width:f,height:d,zoomStep:h=1,pannable:g=!0,zoomable:p=!0,inversePan:m=!1}){const x=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const E=n(),O=w.sourceEvent.ctrlKey&&fi()?10:1,k=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*h,M=E[2]*Math.pow(2,k*O);t.scaleTo(M)};let v=[0,0];const b=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(v=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},_=w=>{const E=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const O=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],k=[O[0]-v[0],O[1]-v[1]];v=O;const M=o()*Math.max(E[2],Math.log(E[2]))*(m?-1:1),D={x:E[0]-k[0]*M,y:E[1]-k[1]*M},V=[[0,0],[f,d]];t.setViewportConstrained({x:D.x,y:D.y,zoom:E[2]},V,c)},N=vp().on("start",b).on("zoom",g?_:null).on("zoom.wheel",p?x:null);s.call(N,{})}function l(){s.on("zoom",null)}return{update:a,destroy:l,pointer:Kt}}const YE=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Ks=e=>({x:e.x,y:e.y,zoom:e.k}),Bc=({x:e,y:t,zoom:n})=>Vs.translate(e,t).scale(n),ao=(e,t)=>e.target.closest(`.${t}`),ig=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),XE=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fc=(e,t=0,n=XE,o=()=>{})=>{const s=typeof t=="number"&&t>0;return s||o(),s?e.transition().duration(t).ease(n).on("end",o):e},sg=e=>{const t=e.ctrlKey&&fi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qE({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:l,onPanZoomStart:c,onPanZoom:f,onPanZoomEnd:d}){return h=>{if(ao(h,t))return!1;h.preventDefault(),h.stopImmediatePropagation();const g=n.property("__zoom").k||1;if(h.ctrlKey&&l){const b=Kt(h),_=sg(h),N=g*Math.pow(2,_);o.scaleTo(n,N,b,h);return}const p=h.deltaMode===1?20:1;let m=s===Nr.Vertical?0:h.deltaX*p,x=s===Nr.Horizontal?0:h.deltaY*p;!fi()&&h.shiftKey&&s!==Nr.Vertical&&(m=h.deltaY*p,x=0),o.translateBy(n,-(m/g)*a,-(x/g)*a,{internal:!0});const v=Ks(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,c?.(h,v)),e.isPanScrolling&&(f?.(h,v),e.panScrollTimeout=setTimeout(()=>{d?.(h,v),e.isPanScrolling=!1},150))}}function KE({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,s){const a=o.type==="wheel",l=!t&&a&&!o.ctrlKey,c=ao(o,e);if(o.ctrlKey&&a&&c&&o.preventDefault(),l||c)return null;o.preventDefault(),n.call(this,o,s)}}function ZE({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const s=Ks(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=s,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,s)}}function QE({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:s}){return a=>{e.usedRightMouseButton=!!(n&&ig(t,e.mouseButton??0)),a.sourceEvent?.sync||o([a.transform.x,a.transform.y,a.transform.k]),s&&!a.sourceEvent?.internal&&s?.(a.sourceEvent,Ks(a.transform))}}function JE({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:a}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ig(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&a(l.sourceEvent),e.usedRightMouseButton=!1,o(!1),s&&YE(e.prevViewport,l.transform))){const c=Ks(l.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s?.(l.sourceEvent,c)},n?150:0)}}}function eC({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:l,noWheelClassName:c,noPanClassName:f,lib:d}){return h=>{const g=e||t,p=n&&h.ctrlKey;if(h.button===1&&h.type==="mousedown"&&(ao(h,`${d}-flow__node`)||ao(h,`${d}-flow__edge`)))return!0;if(!o&&!g&&!s&&!a&&!n||l||ao(h,c)&&h.type==="wheel"||ao(h,f)&&(h.type!=="wheel"||s&&h.type==="wheel"&&!e)||!n&&h.ctrlKey&&h.type==="wheel")return!1;if(!n&&h.type==="touchstart"&&h.touches?.length>1)return h.preventDefault(),!1;if(!g&&!s&&!p&&h.type==="wheel"||!o&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(o)&&!o.includes(h.button)&&h.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||h.type==="wheel")&&m}}function tC({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:s,viewport:a,onPanZoom:l,onPanZoomStart:c,onPanZoomEnd:f,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),p=vp().clickDistance(!Jt(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(s),m=Ot(e).call(p);w({x:a.x,y:a.y,zoom:ro(a.zoom,t,n)},[[0,0],[g.width,g.height]],s);const x=m.on("wheel.zoom"),v=m.on("dblclick.zoom");p.wheelDelta(sg);function b(U,q){return m?new Promise(C=>{p?.interpolate(q?.interpolate==="linear"?Jo:ks).transform(Fc(m,q?.duration,q?.ease,()=>C(!0)),U)}):Promise.resolve(!1)}function _({noWheelClassName:U,noPanClassName:q,onPaneContextMenu:C,userSelectionActive:H,panOnScroll:B,panOnDrag:R,panOnScrollMode:P,panOnScrollSpeed:W,preventScrolling:$,zoomOnPinch:G,zoomOnScroll:J,zoomOnDoubleClick:re,zoomActivationKeyPressed:se,lib:ce,onTransformChange:ge}){H&&!h.isZoomingOrPanning&&N();const Q=B&&!se&&!H?qE({zoomPanValues:h,noWheelClassName:U,d3Selection:m,d3Zoom:p,panOnScrollMode:P,panOnScrollSpeed:W,zoomOnPinch:G,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:f}):KE({noWheelClassName:U,preventScrolling:$,d3ZoomHandler:x});if(m.on("wheel.zoom",Q,{passive:!1}),!H){const fe=ZE({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:c});p.on("start",fe);const de=QE({zoomPanValues:h,panOnDrag:R,onPaneContextMenu:!!C,onPanZoom:l,onTransformChange:ge});p.on("zoom",de);const ue=JE({zoomPanValues:h,panOnDrag:R,panOnScroll:B,onPaneContextMenu:C,onPanZoomEnd:f,onDraggingChange:d});p.on("end",ue)}const ae=eC({zoomActivationKeyPressed:se,panOnDrag:R,zoomOnScroll:J,panOnScroll:B,zoomOnDoubleClick:re,zoomOnPinch:G,userSelectionActive:H,noPanClassName:q,noWheelClassName:U,lib:ce});p.filter(ae),re?m.on("dblclick.zoom",v):m.on("dblclick.zoom",null)}function N(){p.on("zoom",null)}async function w(U,q,C){const H=Bc(U),B=p?.constrain()(H,q,C);return B&&await b(B),new Promise(R=>R(B))}async function E(U,q){const C=Bc(U);return await b(C,q),new Promise(H=>H(C))}function O(U){if(m){const q=Bc(U),C=m.property("__zoom");(C.k!==U.zoom||C.x!==U.x||C.y!==U.y)&&p?.transform(m,q,null,{sync:!0})}}function k(){const U=m?mp(m.node()):{x:0,y:0,k:1};return{x:U.x,y:U.y,zoom:U.k}}function M(U,q){return m?new Promise(C=>{p?.interpolate(q?.interpolate==="linear"?Jo:ks).scaleTo(Fc(m,q?.duration,q?.ease,()=>C(!0)),U)}):Promise.resolve(!1)}function D(U,q){return m?new Promise(C=>{p?.interpolate(q?.interpolate==="linear"?Jo:ks).scaleBy(Fc(m,q?.duration,q?.ease,()=>C(!0)),U)}):Promise.resolve(!1)}function V(U){p?.scaleExtent(U)}function K(U){p?.translateExtent(U)}function Z(U){const q=!Jt(U)||U<0?0:U;p?.clickDistance(q)}return{update:_,destroy:N,setViewport:E,setViewportConstrained:w,getViewport:k,scaleTo:M,scaleBy:D,setScaleExtent:V,setTranslateExtent:K,syncViewport:O,setClickDistance:Z}}var Ar;(function(e){e.Line="line",e.Handle="handle"})(Ar||(Ar={}));function nC({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:s,affectsY:a}){const l=e-t,c=n-o,f=[l>0?1:l<0?-1:0,c>0?1:c<0?-1:0];return l&&s&&(f[0]=f[0]*-1),c&&a&&(f[1]=f[1]*-1),f}function rC(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:s}}function Qn(e,t){return Math.max(0,t-e)}function Jn(e,t){return Math.max(0,e-t)}function Zs(e,t,n){return Math.max(0,t-e,e-n)}function ag(e,t){return e?!t:t}function oC(e,t,n,o,s,a,l,c){let{affectsX:f,affectsY:d}=t;const{isHorizontal:h,isVertical:g}=t,p=h&&g,{xSnapped:m,ySnapped:x}=n,{minWidth:v,maxWidth:b,minHeight:_,maxHeight:N}=o,{x:w,y:E,width:O,height:k,aspectRatio:M}=e;let D=Math.floor(h?m-e.pointerX:0),V=Math.floor(g?x-e.pointerY:0);const K=O+(f?-D:D),Z=k+(d?-V:V),U=-a[0]*O,q=-a[1]*k;let C=Zs(K,v,b),H=Zs(Z,_,N);if(l){let P=0,W=0;f&&D<0?P=Qn(w+D+U,l[0][0]):!f&&D>0&&(P=Jn(w+K+U,l[1][0])),d&&V<0?W=Qn(E+V+q,l[0][1]):!d&&V>0&&(W=Jn(E+Z+q,l[1][1])),C=Math.max(C,P),H=Math.max(H,W)}if(c){let P=0,W=0;f&&D>0?P=Jn(w+D,c[0][0]):!f&&D<0&&(P=Qn(w+K,c[1][0])),d&&V>0?W=Jn(E+V,c[0][1]):!d&&V<0&&(W=Qn(E+Z,c[1][1])),C=Math.max(C,P),H=Math.max(H,W)}if(s){if(h){const P=Zs(K/M,_,N)*M;if(C=Math.max(C,P),l){let W=0;!f&&!d||f&&!d&&p?W=Jn(E+q+K/M,l[1][1])*M:W=Qn(E+q+(f?D:-D)/M,l[0][1])*M,C=Math.max(C,W)}if(c){let W=0;!f&&!d||f&&!d&&p?W=Qn(E+K/M,c[1][1])*M:W=Jn(E+(f?D:-D)/M,c[0][1])*M,C=Math.max(C,W)}}if(g){const P=Zs(Z*M,v,b)/M;if(H=Math.max(H,P),l){let W=0;!f&&!d||d&&!f&&p?W=Jn(w+Z*M+U,l[1][0])/M:W=Qn(w+(d?V:-V)*M+U,l[0][0])/M,H=Math.max(H,W)}if(c){let W=0;!f&&!d||d&&!f&&p?W=Qn(w+Z*M,c[1][0])/M:W=Jn(w+(d?V:-V)*M,c[0][0])/M,H=Math.max(H,W)}}}V=V+(V<0?H:-H),D=D+(D<0?C:-C),s&&(p?K>Z*M?V=(ag(f,d)?-D:D)/M:D=(ag(f,d)?-V:V)*M:h?(V=D/M,d=f):(D=V*M,f=d));const B=f?w+D:w,R=d?E+V:E;return{width:O+(f?-D:D),height:k+(d?-V:V),x:a[0]*D*(f?-1:1)+B,y:a[1]*V*(d?-1:1)+R}}const lg={width:0,height:0,x:0,y:0},iC={...lg,pointerX:0,pointerY:0,aspectRatio:1};function sC(e){return[[0,0],[e.measured.width,e.measured.height]]}function aC(e,t,n){const o=t.position.x+e.position.x,s=t.position.y+e.position.y,a=e.measured.width??0,l=e.measured.height??0,c=n[0]*a,f=n[1]*l;return[[o-c,s-f],[o+a-c,s+l-f]]}function lC({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:s}){const a=Ot(e);function l({controlPosition:f,boundaries:d,keepAspectRatio:h,resizeDirection:g,onResizeStart:p,onResize:m,onResizeEnd:x,shouldResize:v}){let b={...lg},_={...iC};const N=rC(f);let w,E=null,O=[],k,M,D;const V=Vh().on("start",K=>{const{nodeLookup:Z,transform:U,snapGrid:q,snapToGrid:C,nodeOrigin:H,paneDomNode:B}=n();if(w=Z.get(t),!w)return;E=B?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:P}=di(K.sourceEvent,{transform:U,snapGrid:q,snapToGrid:C,containerBounds:E});b={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},_={...b,pointerX:R,pointerY:P,aspectRatio:b.width/b.height},k=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(k=Z.get(w.parentId),M=k&&w.extent==="parent"?sC(k):void 0),O=[],D=void 0;for(const[W,$]of Z)if($.parentId===t&&(O.push({id:W,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const G=aC($,w,$.origin??H);D?D=[[Math.min(G[0][0],D[0][0]),Math.min(G[0][1],D[0][1])],[Math.max(G[1][0],D[1][0]),Math.max(G[1][1],D[1][1])]]:D=G}p?.(K,{...b})}).on("drag",K=>{const{transform:Z,snapGrid:U,snapToGrid:q,nodeOrigin:C}=n(),H=di(K.sourceEvent,{transform:Z,snapGrid:U,snapToGrid:q,containerBounds:E}),B=[];if(!w)return;const{x:R,y:P,width:W,height:$}=b,G={},J=w.origin??C,{width:re,height:se,x:ce,y:ge}=oC(_,N,H,d,h,J,M,D),te=re!==W,Q=se!==$,ae=ce!==R&&te,fe=ge!==P&&Q;if(!ae&&!fe&&!te&&!Q)return;if((ae||fe||J[0]===1||J[1]===1)&&(G.x=ae?ce:b.x,G.y=fe?ge:b.y,b.x=G.x,b.y=G.y,O.length>0)){const ye=ce-R,Le=ge-P;for(const Ze of O)Ze.position={x:Ze.position.x-ye+J[0]*(re-W),y:Ze.position.y-Le+J[1]*(se-$)},B.push(Ze)}if((te||Q)&&(G.width=te&&(!g||g==="horizontal")?re:b.width,G.height=Q&&(!g||g==="vertical")?se:b.height,b.width=G.width,b.height=G.height),k&&w.expandParent){const ye=J[0]*(G.width??0);G.x&&G.x<ye&&(b.x=ye,_.x=_.x-(G.x-ye));const Le=J[1]*(G.height??0);G.y&&G.y<Le&&(b.y=Le,_.y=_.y-(G.y-Le))}const de=nC({width:b.width,prevWidth:W,height:b.height,prevHeight:$,affectsX:N.affectsX,affectsY:N.affectsY}),ue={...b,direction:de};v?.(K,ue)!==!1&&(m?.(K,ue),o(G,B))}).on("end",K=>{x?.(K,{...b}),s?.({...b})});a.call(V)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var Qs={exports:{}},Hc={},Js={exports:{}},zc={};/**
23
- * @license React
24
- * use-sync-external-store-shim.production.js
22
+ <%s key={someKey} {...props} />`,ie,te,ne,te),W[te+ie]=!0)}if(te=null,J!==void 0&&(n(J),te=""+J),a(Y)&&(n(Y.key),te=""+Y.key),"key"in Y){J={};for(var oe in Y)oe!=="key"&&(J[oe]=Y[oe])}else J=Y;return te&&l(J,typeof z=="function"?z.displayName||z.name||"Unknown":z),d(z,te,ce,ee,i(),J,ge,Q)}function g(z){typeof z=="object"&&z!==null&&z.$$typeof===m&&z._store&&(z._store.validated=1)}var h=T,m=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),w=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),D=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,F=Array.isArray,E=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(z){return z()}};var P,L={},j=h.react_stack_bottom_frame.bind(h,s)(),O=E(r(s)),W={};Ii.Fragment=v,Ii.jsx=function(z,Y,J,ie,ee){var ce=1e4>D.recentlyCreatedOwnerStacks++;return f(z,Y,J,!1,ie,ee,ce?Error("react-stack-top-frame"):j,ce?E(r(z)):O)},Ii.jsxs=function(z,Y,J,ie,ee){var ce=1e4>D.recentlyCreatedOwnerStacks++;return f(z,Y,J,!0,ie,ee,ce?Error("react-stack-top-frame"):j,ce?E(r(z)):O)}}()),Ii}var qh;function N_(){return qh||(qh=1,process.env.NODE_ENV==="production"?ia.exports=S_():ia.exports=__()),ia.exports}var y=N_();/**
23
+ * @license lucide-react v0.542.0 - ISC
25
24
  *
26
- * Copyright (c) Meta Platforms, Inc. and affiliates.
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const I_=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),E_=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Yh=e=>{const t=E_(e);return t.charAt(0).toUpperCase()+t.slice(1)},Xh=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),T_=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
28
+ * @license lucide-react v0.542.0 - ISC
27
29
  *
28
- * This source code is licensed under the MIT license found in the
29
- * LICENSE file in the root directory of this source tree.
30
- */var cg;function cC(){if(cg)return zc;cg=1;var e=z;function t(g,p){return g===p&&(g!==0||1/g===1/p)||g!==g&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,s=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function c(g,p){var m=p(),x=o({inst:{value:m,getSnapshot:p}}),v=x[0].inst,b=x[1];return a(function(){v.value=m,v.getSnapshot=p,f(v)&&b({inst:v})},[g,m,p]),s(function(){return f(v)&&b({inst:v}),g(function(){f(v)&&b({inst:v})})},[g]),l(m),m}function f(g){var p=g.getSnapshot;g=g.value;try{var m=p();return!n(g,m)}catch{return!0}}function d(g,p){return p()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return zc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,zc}var Vc={};/**
31
- * @license React
32
- * use-sync-external-store-shim.development.js
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */var C_={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"};/**
33
+ * @license lucide-react v0.542.0 - ISC
33
34
  *
34
- * Copyright (c) Meta Platforms, Inc. and affiliates.
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const A_=T.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},u)=>T.createElement("svg",{ref:u,...C_,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Xh("lucide",i),...!s&&!T_(l)&&{"aria-hidden":"true"},...l},[...a.map(([d,f])=>T.createElement(d,f)),...Array.isArray(s)?s:[s]]));/**
38
+ * @license lucide-react v0.542.0 - ISC
35
39
  *
36
- * This source code is licensed under the MIT license found in the
37
- * LICENSE file in the root directory of this source tree.
38
- */var ug;function uC(){return ug||(ug=1,process.env.NODE_ENV!=="production"&&function(){function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}function t(m,x){h||s.startTransition===void 0||(h=!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 v=x();if(!g){var b=x();a(v,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}b=l({inst:{value:v,getSnapshot:x}});var _=b[0].inst,N=b[1];return f(function(){_.value=v,_.getSnapshot=x,n(_)&&N({inst:_})},[m,v,x]),c(function(){return n(_)&&N({inst:_}),m(function(){n(_)&&N({inst:_})})},[m]),d(v),v}function n(m){var x=m.getSnapshot;m=m.value;try{var v=x();return!a(m,v)}catch{return!0}}function o(m,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=z,a=typeof Object.is=="function"?Object.is:e,l=s.useState,c=s.useEffect,f=s.useLayoutEffect,d=s.useDebugValue,h=!1,g=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;Vc.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Vc}var fg;function dg(){return fg||(fg=1,process.env.NODE_ENV==="production"?Js.exports=cC():Js.exports=uC()),Js.exports}/**
39
- * @license React
40
- * use-sync-external-store-shim/with-selector.production.js
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const Ye=(e,t)=>{const n=T.forwardRef(({className:r,...i},s)=>T.createElement(A_,{ref:s,iconNode:t,className:Xh(`lucide-${I_(Yh(e))}`,`lucide-${e}`,r),...i}));return n.displayName=Yh(e),n};/**
43
+ * @license lucide-react v0.542.0 - ISC
41
44
  *
42
- * Copyright (c) Meta Platforms, Inc. and affiliates.
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const k_=Ye("arrow-down-up",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
48
+ * @license lucide-react v0.542.0 - ISC
43
49
  *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */var hg;function fC(){if(hg)return Hc;hg=1;var e=z,t=dg();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var o=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,c=e.useMemo,f=e.useDebugValue;return Hc.useSyncExternalStoreWithSelector=function(d,h,g,p,m){var x=a(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=c(function(){function _(k){if(!N){if(N=!0,w=k,k=p(k),m!==void 0&&v.hasValue){var M=v.value;if(m(M,k))return E=M}return E=k}if(M=E,o(w,k))return M;var D=p(k);return m!==void 0&&m(M,D)?(w=k,M):(w=k,E=D)}var N=!1,w,E,O=g===void 0?null:g;return[function(){return _(h())},O===null?void 0:function(){return _(O())}]},[h,g,p,m]);var b=s(d,x[0],x[1]);return l(function(){v.hasValue=!0,v.value=b},[b]),f(b),b},Hc}var Wc={};/**
47
- * @license React
48
- * use-sync-external-store-shim/with-selector.development.js
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const M_=Ye("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
53
+ * @license lucide-react v0.542.0 - ISC
49
54
  *
50
- * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const sa=Ye("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
58
+ * @license lucide-react v0.542.0 - ISC
51
59
  *
52
- * This source code is licensed under the MIT license found in the
53
- * LICENSE file in the root directory of this source tree.
54
- */var pg;function dC(){return pg||(pg=1,process.env.NODE_ENV!=="production"&&function(){function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=z,n=dg(),o=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,a=t.useRef,l=t.useEffect,c=t.useMemo,f=t.useDebugValue;Wc.useSyncExternalStoreWithSelector=function(d,h,g,p,m){var x=a(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=c(function(){function _(k){if(!N){if(N=!0,w=k,k=p(k),m!==void 0&&v.hasValue){var M=v.value;if(m(M,k))return E=M}return E=k}if(M=E,o(w,k))return M;var D=p(k);return m!==void 0&&m(M,D)?(w=k,M):(w=k,E=D)}var N=!1,w,E,O=g===void 0?null:g;return[function(){return _(h())},O===null?void 0:function(){return _(O())}]},[h,g,p,m]);var b=s(d,x[0],x[1]);return l(function(){v.hasValue=!0,v.value=b},[b]),f(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Wc}var gg;function hC(){return gg||(gg=1,process.env.NODE_ENV==="production"?Qs.exports=fC():Qs.exports=dC()),Qs.exports}var pC=hC();const gC=Vd(pC),mC={},mg=e=>{let t;const n=new Set,o=(h,g)=>{const p=typeof h=="function"?h(t):h;if(!Object.is(p,t)){const m=t;t=g??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,m))}},s=()=>t,f={setState:o,getState:s,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(mC?"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()}},d=t=e(o,s,f);return f},yC=e=>e?mg(e):mg,{useDebugValue:vC}=z,{useSyncExternalStoreWithSelector:xC}=gC,wC=e=>e;function yg(e,t=wC,n){const o=xC(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vC(o),o}const vg=(e,t)=>{const n=yC(e),o=(s,a=t)=>yg(n,s,a);return Object.assign(o,n),o},bC=(e,t)=>e?vg(e,t):vg;function qe(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,s]of e)if(!Object.is(s,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 ea=z.createContext(null),_C=ea.Provider,xg=_t.error001();function Re(e,t){const n=z.useContext(ea);if(n===null)throw new Error(xg);return yg(n,e,t)}function je(){const e=z.useContext(ea);if(e===null)throw new Error(xg);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const wg={display:"none"},SC={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bg="react-flow__node-desc",_g="react-flow__edge-desc",EC="react-flow__aria-live",CC=e=>e.ariaLiveMessage,NC=e=>e.ariaLabelConfig;function TC({rfId:e}){const t=Re(CC);return T.jsx("div",{id:`${EC}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:SC,children:t})}function AC({rfId:e,disableKeyboardA11y:t}){const n=Re(NC);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${bg}-${e}`,style:wg,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${_g}-${e}`,style:wg,children:n["edge.a11yDescription.default"]}),!t&&T.jsx(TC,{rfId:e})]})}const ta=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...s},a)=>{const l=`${e}`.split("-");return T.jsx("div",{className:nt(["react-flow__panel",n,...l]),style:o,ref:a,...s,children:t})});ta.displayName="Panel";function IC({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T.jsx(ta,{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:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const OC=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}},na=e=>e.id;function PC(e,t){return qe(e.selectedNodes.map(na),t.selectedNodes.map(na))&&qe(e.selectedEdges.map(na),t.selectedEdges.map(na))}function kC({onSelectionChange:e}){const t=je(),{selectedNodes:n,selectedEdges:o}=Re(OC,PC);return z.useEffect(()=>{const s={nodes:n,edges:o};e?.(s),t.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,o,e]),null}const MC=e=>!!e.onSelectionChangeHandlers;function RC({onSelectionChange:e}){const t=Re(MC);return e||t?T.jsx(kC,{onSelectionChange:e}):null}const Sg=[0,0],DC={x:0,y:0,zoom:1},Eg=[...["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"],LC=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}),Cg={translateExtent:ii,nodeOrigin:Sg,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function $C(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:f,setPaneClickDistance:d}=Re(LC,qe),h=je();z.useEffect(()=>(f(e.defaultNodes,e.defaultEdges),()=>{g.current=Cg,c()}),[]);const g=z.useRef(Cg);return z.useEffect(()=>{for(const p of Eg){const m=e[p],x=g.current[p];m!==x&&(typeof e[p]>"u"||(p==="nodes"?t(m):p==="edges"?n(m):p==="minZoom"?o(m):p==="maxZoom"?s(m):p==="translateExtent"?a(m):p==="nodeExtent"?l(m):p==="paneClickDistance"?d(m):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:wE(m)}):p==="fitView"?h.setState({fitViewQueued:m}):p==="fitViewOptions"?h.setState({fitViewOptions:m}):h.setState({[p]:m})))}g.current=e},Eg.map(p=>e[p])),null}function Ng(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function BC(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=Ng(),s=()=>n(o?.matches?"dark":"light");return s(),o?.addEventListener("change",s),()=>{o?.removeEventListener("change",s)}},[e]),t!==null?t:Ng()?.matches?"dark":"light"}const Tg=typeof document<"u"?document:null;function pi(e=null,t={target:Tg,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),s=z.useRef(!1),a=z.useRef(new Set([])),[l,c]=z.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
55
- `).replace(`
56
-
57
- `,`
58
- +`).split(`
59
- `)),h=d.reduce((g,p)=>g.concat(...p),[]);return[d,h]}return[[],[]]},[e]);return z.useEffect(()=>{const f=t?.target??Tg,d=t?.actInsideInputWithModifier??!0;if(e!==null){const h=m=>{if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!d)&&$p(m))return!1;const v=Ig(m.code,c);if(a.current.add(m[v]),Ag(l,a.current,!1)){const b=m.composedPath?.()?.[0]||m.target,_=b?.nodeName==="BUTTON"||b?.nodeName==="A";t.preventDefault!==!1&&(s.current||!_)&&m.preventDefault(),o(!0)}},g=m=>{const x=Ig(m.code,c);Ag(l,a.current,!0)?(o(!1),a.current.clear()):a.current.delete(m[x]),m.key==="Meta"&&a.current.clear(),s.current=!1},p=()=>{a.current.clear(),o(!1)};return f?.addEventListener("keydown",h),f?.addEventListener("keyup",g),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{f?.removeEventListener("keydown",h),f?.removeEventListener("keyup",g),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,o]),n}function Ag(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(s=>t.has(s)))}function Ig(e,t){return t.includes(e)?"code":"key"}const FC=()=>{const e=je();return z.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,s,a],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??o,y:t.y??s,zoom:t.zoom??a},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:s,minZoom:a,maxZoom:l,panZoom:c}=e.getState(),f=Tc(t,o,s,a,l,n?.padding??.1);return c?(await c.setViewport(f,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:s,snapToGrid:a,domNode:l}=e.getState();if(!l)return t;const{x:c,y:f}=l.getBoundingClientRect(),d={x:t.x-c,y:t.y-f},h=n.snapGrid??s,g=n.snapToGrid??a;return ui(d,o,g,h)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:s,y:a}=o.getBoundingClientRect(),l=Ys(t,n);return{x:l.x+s,y:l.y+a}}}),[])};function Og(e,t){const n=[],o=new Map,s=[];for(const a of e)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")o.set(a.id,[a]);else{const l=o.get(a.id);l?l.push(a):o.set(a.id,[a])}for(const a of t){const l=o.get(a.id);if(!l){n.push(a);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const c={...a};for(const f of l)HC(f,c);n.push(c)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function HC(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 Pg(e,t){return Og(e,t)}function gi(e,t){return Og(e,t)}function Ir(e,t){return{id:e,type:"select",selected:t}}function lo(e,t=new Set,n=!1){const o=[];for(const[s,a]of e){const l=t.has(s);!(a.selected===void 0&&!l)&&a.selected!==l&&(n&&(a.selected=l),o.push(Ir(a.id,l)))}return o}function kg({items:e=[],lookup:t}){const n=[],o=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=t.get(a.id),c=l?.internals?.userNode??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)o.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Mg(e){return{id:e.id,type:"remove"}}const Rg=e=>fE(e),zC=e=>Cp(e);function Dg(e){return z.forwardRef(e)}const VC=typeof window<"u"?z.useLayoutEffect:z.useEffect;function Lg(e){const[t,n]=z.useState(BigInt(0)),[o]=z.useState(()=>WC(()=>n(s=>s+BigInt(1))));return VC(()=>{const s=o.get();s.length&&(e(s),o.reset())},[t]),o}function WC(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const $g=z.createContext(null);function jC({children:e}){const t=je(),n=z.useCallback(c=>{const{nodes:f=[],setNodes:d,hasDefaultNodes:h,onNodesChange:g,nodeLookup:p,fitViewQueued:m}=t.getState();let x=f;for(const b of c)x=typeof b=="function"?b(x):b;const v=kg({items:x,lookup:p});h&&d(x),v.length>0?g?.(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:_,setNodes:N}=t.getState();b&&N(_)})},[]),o=Lg(n),s=z.useCallback(c=>{const{edges:f=[],setEdges:d,hasDefaultEdges:h,onEdgesChange:g,edgeLookup:p}=t.getState();let m=f;for(const x of c)m=typeof x=="function"?x(m):x;h?d(m):g&&g(kg({items:m,lookup:p}))},[]),a=Lg(s),l=z.useMemo(()=>({nodeQueue:o,edgeQueue:a}),[]);return T.jsx($g.Provider,{value:l,children:e})}function UC(){const e=z.useContext($g);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const GC=e=>!!e.panZoom;function mi(){const e=FC(),t=je(),n=UC(),o=Re(GC),s=z.useMemo(()=>{const a=g=>t.getState().nodeLookup.get(g),l=g=>{n.nodeQueue.push(g)},c=g=>{n.edgeQueue.push(g)},f=g=>{const{nodeLookup:p,nodeOrigin:m}=t.getState(),x=Rg(g)?g:p.get(g.id),v=x.parentId?Rp(x.position,x.measured,x.parentId,p,m):x.position,b={...x,position:v,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return oo(b)},d=(g,p,m={replace:!1})=>{l(x=>x.map(v=>{if(v.id===g){const b=typeof p=="function"?p(v):p;return m.replace&&Rg(b)?b:{...v,...b}}return v}))},h=(g,p,m={replace:!1})=>{c(x=>x.map(v=>{if(v.id===g){const b=typeof p=="function"?p(v):p;return m.replace&&zC(b)?b:{...v,...b}}return v}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>a(g)?.internals.userNode,getInternalNode:a,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(p=>({...p}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:l,setEdges:c,addNodes:g=>{const p=Array.isArray(g)?g:[g];n.nodeQueue.push(m=>[...m,...p])},addEdges:g=>{const p=Array.isArray(g)?g:[g];n.edgeQueue.push(m=>[...m,...p])},toObject:()=>{const{nodes:g=[],edges:p=[],transform:m}=t.getState(),[x,v,b]=m;return{nodes:g.map(_=>({..._})),edges:p.map(_=>({..._})),viewport:{x,y:v,zoom:b}}},deleteElements:async({nodes:g=[],edges:p=[]})=>{const{nodes:m,edges:x,onNodesDelete:v,onEdgesDelete:b,triggerNodeChanges:_,triggerEdgeChanges:N,onDelete:w,onBeforeDelete:E}=t.getState(),{nodes:O,edges:k}=await mE({nodesToRemove:g,edgesToRemove:p,nodes:m,edges:x,onBeforeDelete:E}),M=k.length>0,D=O.length>0;if(M){const V=k.map(Mg);b?.(k),N(V)}if(D){const V=O.map(Mg);v?.(O),_(V)}return(D||M)&&w?.({nodes:O,edges:k}),{deletedNodes:O,deletedEdges:k}},getIntersectingNodes:(g,p=!0,m)=>{const x=Pp(g),v=x?g:f(g),b=m!==void 0;return v?(m||t.getState().nodes).filter(_=>{const N=t.getState().nodeLookup.get(_.id);if(N&&!x&&(_.id===g.id||!N.internals.positionAbsolute))return!1;const w=oo(b?_:N),E=li(w,v);return p&&E>0||E>=w.width*w.height||E>=v.width*v.height}):[]},isNodeIntersecting:(g,p,m=!0)=>{const v=Pp(g)?g:f(g);if(!v)return!1;const b=li(v,p);return m&&b>0||b>=v.width*v.height},updateNode:d,updateNodeData:(g,p,m={replace:!1})=>{d(g,x=>{const v=typeof p=="function"?p(x):p;return m.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},m)},updateEdge:h,updateEdgeData:(g,p,m={replace:!1})=>{h(g,x=>{const v=typeof p=="function"?p(x):p;return m.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},m)},getNodesBounds:g=>{const{nodeLookup:p,nodeOrigin:m}=t.getState();return hE(g,{nodeLookup:p,nodeOrigin:m})},getHandleConnections:({type:g,id:p,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}-${g}${p?`-${p}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:p,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}${g?p?`-${g}-${p}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const p=t.getState().fitViewResolver??xE();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:p}),n.nodeQueue.push(m=>[...m]),p.promise}}},[]);return z.useMemo(()=>({...s,...e,viewportInitialized:o}),[o])}const Bg=e=>e.selected,YC=typeof window<"u"?window:void 0;function XC({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=je(),{deleteElements:o}=mi(),s=pi(e,{actInsideInputWithModifier:!1}),a=pi(t,{target:YC});z.useEffect(()=>{if(s){const{edges:l,nodes:c}=n.getState();o({nodes:c.filter(Bg),edges:l.filter(Bg)}),n.setState({nodesSelectionActive:!1})}},[s]),z.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function qC(e){const t=je();z.useEffect(()=>{const n=()=>{if(!e.current)return!1;const o=Ac(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",_t.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 ra={position:"absolute",width:"100%",height:"100%",top:0,left:0},KC=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function ZC({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=Nr.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:f,translateExtent:d,minZoom:h,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:m=!0,children:x,noWheelClassName:v,noPanClassName:b,onViewportChange:_,isControlledViewport:N,paneClickDistance:w}){const E=je(),O=z.useRef(null),{userSelectionActive:k,lib:M}=Re(KC,qe),D=pi(p),V=z.useRef();qC(O);const K=z.useCallback(Z=>{_?.({x:Z[0],y:Z[1],zoom:Z[2]}),N||E.setState({transform:Z})},[_,N]);return z.useEffect(()=>{if(O.current){V.current=tC({domNode:O.current,minZoom:h,maxZoom:g,translateExtent:d,viewport:f,paneClickDistance:w,onDraggingChange:C=>E.setState({paneDragging:C}),onPanZoomStart:(C,H)=>{const{onViewportChangeStart:B,onMoveStart:R}=E.getState();R?.(C,H),B?.(H)},onPanZoom:(C,H)=>{const{onViewportChange:B,onMove:R}=E.getState();R?.(C,H),B?.(H)},onPanZoomEnd:(C,H)=>{const{onViewportChangeEnd:B,onMoveEnd:R}=E.getState();R?.(C,H),B?.(H)}});const{x:Z,y:U,zoom:q}=V.current.getViewport();return E.setState({panZoom:V.current,transform:[Z,U,q],domNode:O.current.closest(".react-flow")}),()=>{V.current?.destroy()}}},[]),z.useEffect(()=>{V.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:b,userSelectionActive:k,noWheelClassName:v,lib:M,onTransformChange:K})},[e,t,n,o,s,a,l,c,D,m,b,k,v,M,K]),T.jsx("div",{className:"react-flow__renderer",ref:O,style:ra,children:x})}const QC=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function JC(){const{userSelectionActive:e,userSelectionRect:t}=Re(QC,qe);return e&&t?T.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const jc=(e,t)=>n=>{n.target===t.current&&e?.(n)},eN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function tN({isSelecting:e,selectionKeyPressed:t,selectionMode:n=no.Full,panOnDrag:o,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:f,onPaneScroll:d,onPaneMouseEnter:h,onPaneMouseMove:g,onPaneMouseLeave:p,children:m}){const x=je(),{userSelectionActive:v,elementsSelectable:b,dragging:_,connectionInProgress:N}=Re(eN,qe),w=b&&(e||v),E=z.useRef(null),O=z.useRef(),k=z.useRef(new Set),M=z.useRef(new Set),D=z.useRef(!1),V=z.useRef(!1),K=R=>{if(D.current||N){D.current=!1;return}c?.(R),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},Z=R=>{if(Array.isArray(o)&&o?.includes(2)){R.preventDefault();return}f?.(R)},U=d?R=>d(R):void 0,q=R=>{const{resetSelectedElements:P,domNode:W}=x.getState();if(O.current=W?.getBoundingClientRect(),!b||!e||R.button!==0||R.target!==E.current||!O.current)return;R.target?.setPointerCapture?.(R.pointerId),V.current=!0,D.current=!1;const{x:$,y:G}=pn(R.nativeEvent,O.current);P(),x.setState({userSelectionRect:{width:0,height:0,startX:$,startY:G,x:$,y:G}}),a?.(R)},C=R=>{const{userSelectionRect:P,transform:W,nodeLookup:$,edgeLookup:G,connectionLookup:J,triggerNodeChanges:re,triggerEdgeChanges:se,defaultEdgeOptions:ce}=x.getState();if(!O.current||!P)return;D.current=!0;const{x:ge,y:te}=pn(R.nativeEvent,O.current),{startX:Q,startY:ae}=P,fe={startX:Q,startY:ae,x:ge<Q?ge:Q,y:te<ae?te:ae,width:Math.abs(ge-Q),height:Math.abs(te-ae)},de=k.current,ue=M.current;k.current=new Set(Ec($,fe,W,n===no.Partial,!0).map(ye=>ye.id)),M.current=new Set;const _e=ce?.selectable??!0;for(const ye of k.current){const Le=J.get(ye);if(Le)for(const{edgeId:Ze}of Le.values()){const Ge=G.get(Ze);Ge&&(Ge.selectable??_e)&&M.current.add(Ze)}}if(!Dp(de,k.current)){const ye=lo($,k.current,!0);re(ye)}if(!Dp(ue,M.current)){const ye=lo(G,M.current);se(ye)}x.setState({userSelectionRect:fe,userSelectionActive:!0,nodesSelectionActive:!1})},H=R=>{if(R.button!==0||!V.current)return;R.target?.releasePointerCapture?.(R.pointerId);const{userSelectionRect:P}=x.getState();!v&&P&&R.target===E.current&&K?.(R),x.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:k.current.size>0}),l?.(R),(t||s)&&(D.current=!1),V.current=!1},B=o===!0||Array.isArray(o)&&o.includes(0);return T.jsxs("div",{className:nt(["react-flow__pane",{draggable:B,dragging:_,selection:e}]),onClick:w?void 0:jc(K,E),onContextMenu:jc(Z,E),onWheel:jc(U,E),onPointerEnter:w?void 0:h,onPointerDown:w?q:g,onPointerMove:w?C:g,onPointerUp:w?H:void 0,onPointerLeave:p,ref:E,style:ra,children:[m,T.jsx(JC,{})]})}function Uc({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:c,onError:f}=t.getState(),d=c.get(e);if(!d){f?.("012",_t.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&l)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):s([e])}function Fg({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:s,isSelectable:a,nodeClickDistance:l}){const c=je(),[f,d]=z.useState(!1),h=z.useRef();return z.useEffect(()=>{h.current=HE({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{Uc({id:g,store:c,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),z.useEffect(()=>{if(t)h.current?.destroy();else if(e.current)return h.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:a,nodeId:s,nodeClickDistance:l}),()=>{h.current?.destroy()}},[n,o,t,a,e,s]),f}const nN=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Hg(){const e=je();return z.useCallback(n=>{const{nodeExtent:o,snapToGrid:s,snapGrid:a,nodesDraggable:l,onError:c,updateNodePositions:f,nodeLookup:d,nodeOrigin:h}=e.getState(),g=new Map,p=nN(l),m=s?a[0]:5,x=s?a[1]:5,v=n.direction.x*m*n.factor,b=n.direction.y*x*n.factor;for(const[,_]of d){if(!p(_))continue;let N={x:_.internals.positionAbsolute.x+v,y:_.internals.positionAbsolute.y+b};s&&(N=ci(N,a));const{position:w,positionAbsolute:E}=Np({nodeId:_.id,nextPosition:N,nodeLookup:d,nodeExtent:o,nodeOrigin:h,onError:c});_.position=w,_.internals.positionAbsolute=E,g.set(_.id,_)}f(g)},[])}const Gc=z.createContext(null),rN=Gc.Provider;Gc.Consumer;const yi=()=>z.useContext(Gc),oN=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),iN=(e,t,n)=>o=>{const{connectionClickStartHandle:s,connectionMode:a,connection:l}=o,{fromHandle:c,toHandle:f,isValid:d}=l,h=f?.nodeId===e&&f?.id===t&&f?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:h,clickConnecting:s?.nodeId===e&&s?.id===t&&s?.type===n,isPossibleEndHandle:a===to.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!s,valid:h&&d}};function sN({type:e="source",position:t=be.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:l,onConnect:c,children:f,className:d,onMouseDown:h,onTouchStart:g,...p},m){const x=l||null,v=e==="target",b=je(),_=yi(),{connectOnClick:N,noPanClassName:w,rfId:E}=Re(oN,qe),{connectingFrom:O,connectingTo:k,clickConnecting:M,isPossibleEndHandle:D,connectionInProcess:V,clickConnectionInProcess:K,valid:Z}=Re(iN(_,x,e),qe);_||b.getState().onError?.("010",_t.error010());const U=H=>{const{defaultEdgeOptions:B,onConnect:R,hasDefaultEdges:P}=b.getState(),W={...B,...H};if(P){const{edges:$,setEdges:G}=b.getState();G(Wp(W,$))}R?.(W),c?.(W)},q=H=>{if(!_)return;const B=Bp(H.nativeEvent);if(s&&(B&&H.button===0||!B)){const R=b.getState();$c.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:v,handleId:x,nodeId:_,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:R.onConnectEnd,updateConnection:R.updateConnection,onConnect:U,isValidConnection:n||R.isValidConnection,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}B?h?.(H):g?.(H)},C=H=>{const{onClickConnectStart:B,onClickConnectEnd:R,connectionClickStartHandle:P,connectionMode:W,isValidConnection:$,lib:G,rfId:J,nodeLookup:re,connection:se}=b.getState();if(!_||!P&&!s)return;if(!P){B?.(H.nativeEvent,{nodeId:_,handleId:x,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:_,type:e,id:x}});return}const ce=Lp(H.target),ge=n||$,{connection:te,isValid:Q}=$c.isValid(H.nativeEvent,{handle:{nodeId:_,id:x,type:e},connectionMode:W,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:ge,flowId:J,doc:ce,lib:G,nodeLookup:re});Q&&te&&U(te);const ae=structuredClone(se);delete ae.inProgress,ae.toPosition=ae.toHandle?ae.toHandle.position:null,R?.(H,ae),b.setState({connectionClickStartHandle:null})};return T.jsx("div",{"data-handleid":x,"data-nodeid":_,"data-handlepos":t,"data-id":`${E}-${_}-${x}-${e}`,className:nt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!v,target:v,connectable:o,connectablestart:s,connectableend:a,clickconnecting:M,connectingfrom:O,connectingto:k,valid:Z,connectionindicator:o&&(!V||D)&&(V||K?a:s)}]),onMouseDown:q,onTouchStart:q,onClick:N?C:void 0,ref:m,...p,children:f})}const vi=z.memo(Dg(sN));function aN({data:e,isConnectable:t,sourcePosition:n=be.Bottom}){return T.jsxs(T.Fragment,{children:[e?.label,T.jsx(vi,{type:"source",position:n,isConnectable:t})]})}function lN({data:e,isConnectable:t,targetPosition:n=be.Top,sourcePosition:o=be.Bottom}){return T.jsxs(T.Fragment,{children:[T.jsx(vi,{type:"target",position:n,isConnectable:t}),e?.label,T.jsx(vi,{type:"source",position:o,isConnectable:t})]})}function cN(){return null}function uN({data:e,isConnectable:t,targetPosition:n=be.Top}){return T.jsxs(T.Fragment,{children:[T.jsx(vi,{type:"target",position:n,isConnectable:t}),e?.label]})}const oa={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zg={input:aN,default:lN,output:uN,group:cN};function fN(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 dN=e=>{const{width:t,height:n,x:o,y:s}=ai(e.nodeLookup,{filter:a=>!!a.selected});return{width:Jt(t)?t:null,height:Jt(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${s}px)`}};function hN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=je(),{width:s,height:a,transformString:l,userSelectionActive:c}=Re(dN,qe),f=Hg(),d=z.useRef(null);if(z.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]),Fg({nodeRef:d}),c||!s||!a)return null;const h=e?p=>{const m=o.getState().nodes.filter(x=>x.selected);e(p,m)}:void 0,g=p=>{Object.prototype.hasOwnProperty.call(oa,p.key)&&(p.preventDefault(),f({direction:oa[p.key],factor:p.shiftKey?4:1}))};return T.jsx("div",{className:nt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:T.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:s,height:a}})})}const Vg=typeof window<"u"?window:void 0,pN=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Wg({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:f,selectionKeyCode:d,selectionOnDrag:h,selectionMode:g,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:x,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:_,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:E,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:D,defaultViewport:V,translateExtent:K,minZoom:Z,maxZoom:U,preventScrolling:q,onSelectionContextMenu:C,noWheelClassName:H,noPanClassName:B,disableKeyboardA11y:R,onViewportChange:P,isControlledViewport:W}){const{nodesSelectionActive:$,userSelectionActive:G}=Re(pN),J=pi(d,{target:Vg}),re=pi(v,{target:Vg}),se=re||D,ce=re||E,ge=h&&se!==!0,te=J||G||ge;return XC({deleteKeyCode:f,multiSelectionKeyCode:x}),T.jsx(ZC,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:ce,panOnScrollSpeed:O,panOnScrollMode:k,zoomOnDoubleClick:M,panOnDrag:!J&&se,defaultViewport:V,translateExtent:K,minZoom:Z,maxZoom:U,zoomActivationKeyCode:b,preventScrolling:q,noWheelClassName:H,noPanClassName:B,onViewportChange:P,isControlledViewport:W,paneClickDistance:c,children:T.jsxs(tN,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:se,isSelecting:!!te,selectionMode:g,selectionKeyPressed:J,selectionOnDrag:ge,children:[e,$&&T.jsx(hN,{onSelectionContextMenu:C,noPanClassName:B,disableKeyboardA11y:R})]})})}Wg.displayName="FlowRenderer";const gN=z.memo(Wg),mN=e=>t=>e?Ec(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 yN(e){return Re(z.useCallback(mN(e),[e]),qe)}const vN=e=>e.updateNodeInternals;function xN(){const e=Re(vN),[t]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");o.set(a,{id:a,nodeElement:s.target,force:!0})}),e(o)}));return z.useEffect(()=>()=>{t?.disconnect()},[t]),t}function wN({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const s=je(),a=z.useRef(null),l=z.useRef(null),c=z.useRef(e.sourcePosition),f=z.useRef(e.targetPosition),d=z.useRef(t),h=n&&!!e.internals.handleBounds;return z.useEffect(()=>{a.current&&!e.hidden&&(!h||l.current!==a.current)&&(l.current&&o?.unobserve(l.current),o?.observe(a.current),l.current=a.current)},[h,e.hidden]),z.useEffect(()=>()=>{l.current&&(o?.unobserve(l.current),l.current=null)},[]),z.useEffect(()=>{if(a.current){const g=d.current!==t,p=c.current!==e.sourcePosition,m=f.current!==e.targetPosition;(g||p||m)&&(d.current=t,c.current=e.sourcePosition,f.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function bN({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:s,onContextMenu:a,onDoubleClick:l,nodesDraggable:c,elementsSelectable:f,nodesConnectable:d,nodesFocusable:h,resizeObserver:g,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:x,rfId:v,nodeTypes:b,nodeClickDistance:_,onError:N}){const{node:w,internals:E,isParent:O}=Re(Q=>{const ae=Q.nodeLookup.get(e),fe=Q.parentLookup.has(e);return{node:ae,internals:ae.internals,isParent:fe}},qe);let k=w.type||"default",M=b?.[k]||zg[k];M===void 0&&(N?.("003",_t.error003(k)),k="default",M=b?.default||zg.default);const D=!!(w.draggable||c&&typeof w.draggable>"u"),V=!!(w.selectable||f&&typeof w.selectable>"u"),K=!!(w.connectable||d&&typeof w.connectable>"u"),Z=!!(w.focusable||h&&typeof w.focusable>"u"),U=je(),q=Mp(w),C=wN({node:w,nodeType:k,hasDimensions:q,resizeObserver:g}),H=Fg({nodeRef:C,disabled:w.hidden||!D,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:V,nodeClickDistance:_}),B=Hg();if(w.hidden)return null;const R=kn(w),P=fN(w),W=V||D||t||n||o||s,$=n?Q=>n(Q,{...E.userNode}):void 0,G=o?Q=>o(Q,{...E.userNode}):void 0,J=s?Q=>s(Q,{...E.userNode}):void 0,re=a?Q=>a(Q,{...E.userNode}):void 0,se=l?Q=>l(Q,{...E.userNode}):void 0,ce=Q=>{const{selectNodesOnDrag:ae,nodeDragThreshold:fe}=U.getState();V&&(!ae||!D||fe>0)&&Uc({id:e,store:U,nodeRef:C}),t&&t(Q,{...E.userNode})},ge=Q=>{if(!($p(Q.nativeEvent)||x)){if(xp.includes(Q.key)&&V){const ae=Q.key==="Escape";Uc({id:e,store:U,unselect:ae,nodeRef:C})}else if(D&&w.selected&&Object.prototype.hasOwnProperty.call(oa,Q.key)){Q.preventDefault();const{ariaLabelConfig:ae}=U.getState();U.setState({ariaLiveMessage:ae["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),B({direction:oa[Q.key],factor:Q.shiftKey?4:1})}}},te=()=>{if(x||!C.current?.matches(":focus-visible"))return;const{transform:Q,width:ae,height:fe,autoPanOnNodeFocus:de,setCenter:ue}=U.getState();if(!de)return;Ec(new Map([[e,w]]),{x:0,y:0,width:ae,height:fe},Q,!0).length>0||ue(w.position.x+R.width/2,w.position.y+R.height/2,{zoom:Q[2]})};return T.jsx("div",{className:nt(["react-flow__node",`react-flow__node-${k}`,{[m]:D},w.className,{selected:w.selected,selectable:V,parent:O,draggable:D,dragging:H}]),ref:C,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:q?"visible":"hidden",...w.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:$,onMouseMove:G,onMouseLeave:J,onContextMenu:re,onClick:ce,onDoubleClick:se,onKeyDown:Z?ge:void 0,tabIndex:Z?0:void 0,onFocus:Z?te:void 0,role:w.ariaRole??(Z?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${bg}-${v}`,"aria-label":w.ariaLabel,...w.domAttributes,children:T.jsx(rN,{value:e,children:T.jsx(M,{id:e,data:w.data,type:k,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:w.selected??!1,selectable:V,draggable:D,deletable:w.deletable??!0,isConnectable:K,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:H,dragHandle:w.dragHandle,zIndex:E.z,parentId:w.parentId,...R})})})}const _N=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jg(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,onError:a}=Re(_N,qe),l=yN(e.onlyRenderVisibleElements),c=xN();return T.jsx("div",{className:"react-flow__nodes",style:ra,children:l.map(f=>T.jsx(bN,{id:f,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:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},f))})}jg.displayName="NodeRenderer";const SN=z.memo(jg);function EN(e){return Re(z.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const o=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),l=n.nodeLookup.get(s.target);a&&l&&SE({sourceNode:a,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&o.push(s.id)}return o},[e]),qe)}const CN=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return T.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},NN=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return T.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ug={[Ws.Arrow]:CN,[Ws.ArrowClosed]:NN};function TN(e){const t=je();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(Ug,e)?Ug[e]:(t.getState().onError?.("009",_t.error009(e)),null),[e])}const AN=({id:e,type:t,color:n,width:o=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const f=TN(t);return f?T.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:T.jsx(f,{color:n,strokeWidth:l})}):null},Gg=({defaultColor:e,rfId:t})=>{const n=Re(a=>a.edges),o=Re(a=>a.defaultEdgeOptions),s=z.useMemo(()=>OE(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return s.length?T.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:T.jsx("defs",{children:s.map(a=>T.jsx(AN,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};Gg.displayName="MarkerDefinitions";var IN=z.memo(Gg);function Yg({x:e,y:t,label:n,labelStyle:o,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:f,className:d,...h}){const[g,p]=z.useState({x:1,y:0,width:0,height:0}),m=nt(["react-flow__edge-textwrapper",d]),x=z.useRef(null);return z.useEffect(()=>{if(x.current){const v=x.current.getBBox();p({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?T.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...h,children:[s&&T.jsx("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:c,ry:c}),T.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:x,style:o,children:n}),f]}):null}Yg.displayName="EdgeText";const ON=z.memo(Yg);function co({path:e,labelX:t,labelY:n,label:o,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,interactionWidth:d=20,...h}){return T.jsxs(T.Fragment,{children:[T.jsx("path",{...h,d:e,fill:"none",className:nt(["react-flow__edge-path",h.className])}),d?T.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,o&&Jt(t)&&Jt(n)?T.jsx(ON,{x:t,y:n,label:o,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f}):null]})}function Xg({pos:e,x1:t,y1:n,x2:o,y2:s}){return e===be.Left||e===be.Right?[.5*(t+o),n]:[t,.5*(n+s)]}function qg({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:o,targetY:s,targetPosition:a=be.Top}){const[l,c]=Xg({pos:n,x1:e,y1:t,x2:o,y2:s}),[f,d]=Xg({pos:a,x1:o,y1:s,x2:e,y2:t}),[h,g,p,m]=Hp({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:f,targetControlY:d});return[`M${e},${t} C${l},${c} ${f},${d} ${o},${s}`,h,g,p,m]}function Kg(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:g,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:_})=>{const[N,w,E]=qg({sourceX:n,sourceY:o,sourcePosition:l,targetX:s,targetY:a,targetPosition:c}),O=e.isInternal?void 0:t;return T.jsx(co,{id:O,path:N,labelX:w,labelY:E,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:g,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:_})})}const PN=Kg({isInternal:!1}),Zg=Kg({isInternal:!0});PN.displayName="SimpleBezierEdge",Zg.displayName="SimpleBezierEdgeInternal";function Qg(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:a,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:p,sourcePosition:m=be.Bottom,targetPosition:x=be.Top,markerEnd:v,markerStart:b,pathOptions:_,interactionWidth:N})=>{const[w,E,O]=Ic({sourceX:n,sourceY:o,sourcePosition:m,targetX:s,targetY:a,targetPosition:x,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),k=e.isInternal?void 0:t;return T.jsx(co,{id:k,path:w,labelX:E,labelY:O,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:p,markerEnd:v,markerStart:b,interactionWidth:N})})}const Jg=Qg({isInternal:!1}),em=Qg({isInternal:!0});Jg.displayName="SmoothStepEdge",em.displayName="SmoothStepEdgeInternal";function tm(e){return z.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return T.jsx(Jg,{...n,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const kN=tm({isInternal:!1}),nm=tm({isInternal:!0});kN.displayName="StepEdge",nm.displayName="StepEdgeInternal";function rm(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:a,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:x,interactionWidth:v})=>{const[b,_,N]=jp({sourceX:n,sourceY:o,targetX:s,targetY:a}),w=e.isInternal?void 0:t;return T.jsx(co,{id:w,path:b,labelX:_,labelY:N,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:x,interactionWidth:v})})}const MN=rm({isInternal:!1}),om=rm({isInternal:!0});MN.displayName="StraightEdge",om.displayName="StraightEdgeInternal";function im(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:a,sourcePosition:l=be.Bottom,targetPosition:c=be.Top,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:g,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,pathOptions:_,interactionWidth:N})=>{const[w,E,O]=qs({sourceX:n,sourceY:o,sourcePosition:l,targetX:s,targetY:a,targetPosition:c,curvature:_?.curvature}),k=e.isInternal?void 0:t;return T.jsx(co,{id:k,path:w,labelX:E,labelY:O,label:f,labelStyle:d,labelShowBg:h,labelBgStyle:g,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:N})})}const RN=im({isInternal:!1}),sm=im({isInternal:!0});RN.displayName="BezierEdge",sm.displayName="BezierEdgeInternal";const am={default:sm,straight:om,step:nm,smoothstep:em,simplebezier:Zg},lm={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},DN=(e,t,n)=>n===be.Left?e-t:n===be.Right?e+t:e,LN=(e,t,n)=>n===be.Top?e-t:n===be.Bottom?e+t:e,cm="react-flow__edgeupdater";function um({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:s,onMouseEnter:a,onMouseOut:l,type:c}){return T.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:l,className:nt([cm,`${cm}-${c}`]),cx:DN(t,o,e),cy:LN(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function $N({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:s,targetX:a,targetY:l,sourcePosition:c,targetPosition:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:g,setReconnecting:p,setUpdateHover:m}){const x=je(),v=(E,O)=>{if(E.button!==0)return;const{autoPanOnConnect:k,domNode:M,isValidConnection:D,connectionMode:V,connectionRadius:K,lib:Z,onConnectStart:U,onConnectEnd:q,cancelConnection:C,nodeLookup:H,rfId:B,panBy:R,updateConnection:P}=x.getState(),W=O.type==="target",$=(re,se)=>{p(!1),g?.(re,n,O.type,se)},G=re=>d?.(n,re),J=(re,se)=>{p(!0),h?.(E,n,O.type),U?.(re,se)};$c.onPointerDown(E.nativeEvent,{autoPanOnConnect:k,connectionMode:V,connectionRadius:K,domNode:M,handleId:O.id,nodeId:O.nodeId,nodeLookup:H,isTarget:W,edgeUpdaterType:O.type,lib:Z,flowId:B,cancelConnection:C,panBy:R,isValidConnection:D,onConnect:G,onConnectStart:J,onConnectEnd:q,onReconnectEnd:$,updateConnection:P,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},b=E=>v(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),_=E=>v(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>m(!0),w=()=>m(!1);return T.jsxs(T.Fragment,{children:[(e===!0||e==="source")&&T.jsx(um,{position:c,centerX:o,centerY:s,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&T.jsx(um,{position:f,centerX:a,centerY:l,radius:t,onMouseDown:_,onMouseEnter:N,onMouseOut:w,type:"target"})]})}function BN({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:s,onDoubleClick:a,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:d,reconnectRadius:h,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,rfId:x,edgeTypes:v,noPanClassName:b,onError:_,disableKeyboardA11y:N}){let w=Re(ue=>ue.edgeLookup.get(e));const E=Re(ue=>ue.defaultEdgeOptions);w=E?{...E,...w}:w;let O=w.type||"default",k=v?.[O]||am[O];k===void 0&&(_?.("011",_t.error011(O)),O="default",k=v?.default||am.default);const M=!!(w.focusable||t&&typeof w.focusable>"u"),D=typeof g<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),V=!!(w.selectable||o&&typeof w.selectable>"u"),K=z.useRef(null),[Z,U]=z.useState(!1),[q,C]=z.useState(!1),H=je(),{zIndex:B,sourceX:R,sourceY:P,targetX:W,targetY:$,sourcePosition:G,targetPosition:J}=Re(z.useCallback(ue=>{const _e=ue.nodeLookup.get(w.source),ye=ue.nodeLookup.get(w.target);if(!_e||!ye)return{zIndex:w.zIndex,...lm};const Le=IE({id:e,sourceNode:_e,targetNode:ye,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:ue.connectionMode,onError:_});return{zIndex:_E({selected:w.selected,zIndex:w.zIndex,sourceNode:_e,targetNode:ye,elevateOnSelect:ue.elevateEdgesOnSelect}),...Le||lm}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),qe),re=z.useMemo(()=>w.markerStart?`url('#${Oc(w.markerStart,x)}')`:void 0,[w.markerStart,x]),se=z.useMemo(()=>w.markerEnd?`url('#${Oc(w.markerEnd,x)}')`:void 0,[w.markerEnd,x]);if(w.hidden||R===null||P===null||W===null||$===null)return null;const ce=ue=>{const{addSelectedEdges:_e,unselectNodesAndEdges:ye,multiSelectionActive:Le}=H.getState();V&&(H.setState({nodesSelectionActive:!1}),w.selected&&Le?(ye({nodes:[],edges:[w]}),K.current?.blur()):_e([e])),s&&s(ue,w)},ge=a?ue=>{a(ue,{...w})}:void 0,te=l?ue=>{l(ue,{...w})}:void 0,Q=c?ue=>{c(ue,{...w})}:void 0,ae=f?ue=>{f(ue,{...w})}:void 0,fe=d?ue=>{d(ue,{...w})}:void 0,de=ue=>{if(!N&&xp.includes(ue.key)&&V){const{unselectNodesAndEdges:_e,addSelectedEdges:ye}=H.getState();ue.key==="Escape"?(K.current?.blur(),_e({edges:[w]})):ye([e])}};return T.jsx("svg",{style:{zIndex:B},children:T.jsxs("g",{className:nt(["react-flow__edge",`react-flow__edge-${O}`,w.className,b,{selected:w.selected,animated:w.animated,inactive:!V&&!s,updating:Z,selectable:V}]),onClick:ce,onDoubleClick:ge,onContextMenu:te,onMouseEnter:Q,onMouseMove:ae,onMouseLeave:fe,onKeyDown:M?de:void 0,tabIndex:M?0:void 0,role:w.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":M?`${_g}-${x}`:void 0,ref:K,...w.domAttributes,children:[!q&&T.jsx(k,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:V,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:R,sourceY:P,targetX:W,targetY:$,sourcePosition:G,targetPosition:J,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:re,markerEnd:se,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),D&&T.jsx($N,{edge:w,isReconnectable:D,reconnectRadius:h,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,sourceX:R,sourceY:P,targetX:W,targetY:$,sourcePosition:G,targetPosition:J,setUpdateHover:U,setReconnecting:C})]})})}const FN=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function fm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:s,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:g,onEdgeDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:_,elementsSelectable:N,onError:w}=Re(FN,qe),E=EN(t);return T.jsxs("div",{className:"react-flow__edges",children:[T.jsx(IN,{defaultColor:e,rfId:n}),E.map(O=>T.jsx(BN,{id:O,edgesFocusable:b,edgesReconnectable:_,elementsSelectable:N,noPanClassName:s,onReconnect:a,onContextMenu:l,onMouseEnter:c,onMouseMove:f,onMouseLeave:d,onClick:h,reconnectRadius:g,onDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,rfId:n,onError:w,edgeTypes:o,disableKeyboardA11y:v},O))]})}fm.displayName="EdgeRenderer";const HN=z.memo(fm),zN=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function VN({children:e}){const t=Re(zN);return T.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function WN(e){const t=mi(),n=z.useRef(!1);z.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const jN=e=>e.panZoom?.syncViewport;function UN(e){const t=Re(jN),n=je();return z.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function GN(e){return e.connection.inProgress?{...e.connection,to:ui(e.connection.to,e.transform)}:{...e.connection}}function YN(e){return GN}function dm(e){const t=YN();return Re(t,qe)}const XN=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function qN({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:s,width:a,height:l,isValid:c,inProgress:f}=Re(XN,qe);return!(a&&s&&f)?null:T.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:T.jsx("g",{className:nt(["react-flow__connection",Ep(c)]),children:T.jsx(hm,{style:t,type:n,CustomComponent:o,isValid:c})})})}const hm=({style:e,type:t=Zn.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:s,from:a,fromNode:l,fromHandle:c,fromPosition:f,to:d,toNode:h,toHandle:g,toPosition:p}=dm();if(!s)return;if(n)return T.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:f,toPosition:p,connectionStatus:Ep(o),toNode:h,toHandle:g});let m="";const x={sourceX:a.x,sourceY:a.y,sourcePosition:f,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case Zn.Bezier:[m]=qs(x);break;case Zn.SimpleBezier:[m]=qg(x);break;case Zn.Step:[m]=Ic({...x,borderRadius:0});break;case Zn.SmoothStep:[m]=Ic(x);break;default:[m]=jp(x)}return T.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};hm.displayName="ConnectionLine";const KN={};function pm(e=KN){const t=z.useRef(e),n=je();z.useEffect(()=>{if(process.env.NODE_ENV==="development"){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const s of o)if(t.current[s]!==e[s]){n.getState().onError?.("002",_t.error002());break}t.current=e}},[e])}function ZN(){const e=je(),t=z.useRef(!1);z.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",_t.error013("react")),t.current=!0}},[])}function gm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:g,onSelectionStart:p,onSelectionEnd:m,connectionLineType:x,connectionLineStyle:v,connectionLineComponent:b,connectionLineContainerStyle:_,selectionKeyCode:N,selectionOnDrag:w,selectionMode:E,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:M,deleteKeyCode:D,onlyRenderVisibleElements:V,elementsSelectable:K,defaultViewport:Z,translateExtent:U,minZoom:q,maxZoom:C,preventScrolling:H,defaultMarkerColor:B,zoomOnScroll:R,zoomOnPinch:P,panOnScroll:W,panOnScrollSpeed:$,panOnScrollMode:G,zoomOnDoubleClick:J,panOnDrag:re,onPaneClick:se,onPaneMouseEnter:ce,onPaneMouseMove:ge,onPaneMouseLeave:te,onPaneScroll:Q,onPaneContextMenu:ae,paneClickDistance:fe,nodeClickDistance:de,onEdgeContextMenu:ue,onEdgeMouseEnter:_e,onEdgeMouseMove:ye,onEdgeMouseLeave:Le,reconnectRadius:Ze,onReconnect:Ge,onReconnectStart:Fn,onReconnectEnd:bo,noDragClassName:bn,noWheelClassName:pt,noPanClassName:nn,disableKeyboardA11y:_n,nodeExtent:Mi,rfId:Sn,viewport:lr,onViewportChange:rn}){return pm(e),pm(t),ZN(),WN(n),UN(lr),T.jsx(gN,{onPaneClick:se,onPaneMouseEnter:ce,onPaneMouseMove:ge,onPaneMouseLeave:te,onPaneContextMenu:ae,onPaneScroll:Q,paneClickDistance:fe,deleteKeyCode:D,selectionKeyCode:N,selectionOnDrag:w,selectionMode:E,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:O,panActivationKeyCode:k,zoomActivationKeyCode:M,elementsSelectable:K,zoomOnScroll:R,zoomOnPinch:P,zoomOnDoubleClick:J,panOnScroll:W,panOnScrollSpeed:$,panOnScrollMode:G,panOnDrag:re,defaultViewport:Z,translateExtent:U,minZoom:q,maxZoom:C,onSelectionContextMenu:g,preventScrolling:H,noDragClassName:bn,noWheelClassName:pt,noPanClassName:nn,disableKeyboardA11y:_n,onViewportChange:rn,isControlledViewport:!!lr,children:T.jsxs(VN,{children:[T.jsx(HN,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:Ge,onReconnectStart:Fn,onReconnectEnd:bo,onlyRenderVisibleElements:V,onEdgeContextMenu:ue,onEdgeMouseEnter:_e,onEdgeMouseMove:ye,onEdgeMouseLeave:Le,reconnectRadius:Ze,defaultMarkerColor:B,noPanClassName:nn,disableKeyboardA11y:_n,rfId:Sn}),T.jsx(qN,{style:v,type:x,component:b,containerStyle:_}),T.jsx("div",{className:"react-flow__edgelabel-renderer"}),T.jsx(SN,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:de,onlyRenderVisibleElements:V,noPanClassName:nn,noDragClassName:bn,disableKeyboardA11y:_n,nodeExtent:Mi,rfId:Sn}),T.jsx("div",{className:"react-flow__viewport-portal"})]})})}gm.displayName="GraphView";const QN=z.memo(gm),mm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:f=.5,maxZoom:d=2,nodeOrigin:h,nodeExtent:g}={})=>{const p=new Map,m=new Map,x=new Map,v=new Map,b=o??t??[],_=n??e??[],N=h??[0,0],w=g??ii;Qp(x,v,b);const E=Mc(_,p,m,{nodeOrigin:N,nodeExtent:w,elevateNodesOnSelect:!1});let O=[0,0,1];if(l&&s&&a){const k=ai(p,{filter:K=>!!((K.width||K.initialWidth)&&(K.height||K.initialHeight))}),{x:M,y:D,zoom:V}=Tc(k,s,a,f,d,c?.padding??.1);O=[M,D,V]}return{rfId:"1",width:0,height:0,transform:O,nodes:_,nodesInitialized:E,nodeLookup:p,parentLookup:m,edges:b,edgeLookup:v,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:f,maxZoom:d,translateExtent:ii,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:to.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,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:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...bp},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:kp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wp}},JN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:d,nodeOrigin:h,nodeExtent:g})=>bC((p,m)=>{async function x(){const{nodeLookup:v,panZoom:b,fitViewOptions:_,fitViewResolver:N,width:w,height:E,minZoom:O,maxZoom:k}=m();b&&(await gE({nodes:v,width:w,height:E,panZoom:b,minZoom:O,maxZoom:k},_),N?.resolve(!0),p({fitViewResolver:null}))}return{...mm({nodes:e,edges:t,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:f,maxZoom:d,nodeOrigin:h,nodeExtent:g,defaultNodes:n,defaultEdges:o}),setNodes:v=>{const{nodeLookup:b,parentLookup:_,nodeOrigin:N,elevateNodesOnSelect:w,fitViewQueued:E}=m(),O=Mc(v,b,_,{nodeOrigin:N,nodeExtent:g,elevateNodesOnSelect:w,checkEquality:!0});E&&O?(x(),p({nodes:v,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:v,nodesInitialized:O})},setEdges:v=>{const{connectionLookup:b,edgeLookup:_}=m();Qp(b,_,v),p({edges:v})},setDefaultNodesAndEdges:(v,b)=>{if(v){const{setNodes:_}=m();_(v),p({hasDefaultNodes:!0})}if(b){const{setEdges:_}=m();_(b),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:b,nodeLookup:_,parentLookup:N,domNode:w,nodeOrigin:E,nodeExtent:O,debug:k,fitViewQueued:M}=m(),{changes:D,updatedInternals:V}=DE(v,_,N,w,E,O);V&&(kE(_,N,{nodeOrigin:E,nodeExtent:O}),M?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),D?.length>0&&(k&&console.log("React Flow: trigger node changes",D),b?.(D)))},updateNodePositions:(v,b=!1)=>{const _=[],N=[],{nodeLookup:w,triggerNodeChanges:E}=m();for(const[O,k]of v){const M=w.get(O),D=!!(M?.expandParent&&M?.parentId&&k?.position),V={id:O,type:"position",position:D?{x:Math.max(0,k.position.x),y:Math.max(0,k.position.y)}:k.position,dragging:b};D&&M.parentId&&_.push({id:O,parentId:M.parentId,rect:{...k.internals.positionAbsolute,width:k.measured.width??0,height:k.measured.height??0}}),N.push(V)}if(_.length>0){const{parentLookup:O,nodeOrigin:k}=m(),M=Dc(_,w,O,k);N.push(...M)}E(N)},triggerNodeChanges:v=>{const{onNodesChange:b,setNodes:_,nodes:N,hasDefaultNodes:w,debug:E}=m();if(v?.length){if(w){const O=Pg(v,N);_(O)}E&&console.log("React Flow: trigger node changes",v),b?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:b,setEdges:_,edges:N,hasDefaultEdges:w,debug:E}=m();if(v?.length){if(w){const O=gi(v,N);_(O)}E&&console.log("React Flow: trigger edge changes",v),b?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:b,edgeLookup:_,nodeLookup:N,triggerNodeChanges:w,triggerEdgeChanges:E}=m();if(b){const O=v.map(k=>Ir(k,!0));w(O);return}w(lo(N,new Set([...v]),!0)),E(lo(_))},addSelectedEdges:v=>{const{multiSelectionActive:b,edgeLookup:_,nodeLookup:N,triggerNodeChanges:w,triggerEdgeChanges:E}=m();if(b){const O=v.map(k=>Ir(k,!0));E(O);return}E(lo(_,new Set([...v]))),w(lo(N,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:b}={})=>{const{edges:_,nodes:N,nodeLookup:w,triggerNodeChanges:E,triggerEdgeChanges:O}=m(),k=v||N,M=b||_,D=k.map(K=>{const Z=w.get(K.id);return Z&&(Z.selected=!1),Ir(K.id,!1)}),V=M.map(K=>Ir(K.id,!1));E(D),O(V)},setMinZoom:v=>{const{panZoom:b,maxZoom:_}=m();b?.setScaleExtent([v,_]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:b,minZoom:_}=m();b?.setScaleExtent([_,v]),p({maxZoom:v})},setTranslateExtent:v=>{m().panZoom?.setTranslateExtent(v),p({translateExtent:v})},setPaneClickDistance:v=>{m().panZoom?.setClickDistance(v)},resetSelectedElements:()=>{const{edges:v,nodes:b,triggerNodeChanges:_,triggerEdgeChanges:N,elementsSelectable:w}=m();if(!w)return;const E=b.reduce((k,M)=>M.selected?[...k,Ir(M.id,!1)]:k,[]),O=v.reduce((k,M)=>M.selected?[...k,Ir(M.id,!1)]:k,[]);_(E),N(O)},setNodeExtent:v=>{const{nodes:b,nodeLookup:_,parentLookup:N,nodeOrigin:w,elevateNodesOnSelect:E,nodeExtent:O}=m();v[0][0]===O[0][0]&&v[0][1]===O[0][1]&&v[1][0]===O[1][0]&&v[1][1]===O[1][1]||(Mc(b,_,N,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:E,checkEquality:!1}),p({nodeExtent:v}))},panBy:v=>{const{transform:b,width:_,height:N,panZoom:w,translateExtent:E}=m();return LE({delta:v,panZoom:w,transform:b,translateExtent:E,width:_,height:N})},setCenter:async(v,b,_)=>{const{width:N,height:w,maxZoom:E,panZoom:O}=m();if(!O)return Promise.resolve(!1);const k=typeof _?.zoom<"u"?_.zoom:E;return await O.setViewport({x:N/2-v*k,y:w/2-b*k,zoom:k},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...bp}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...mm()})}},Object.is);function ym({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:s,initialHeight:a,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:f,fitView:d,nodeOrigin:h,nodeExtent:g,children:p}){const[m]=z.useState(()=>JN({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:f,nodeOrigin:h,nodeExtent:g}));return T.jsx(_C,{value:m,children:T.jsx(jC,{children:p})})}function eT({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:s,width:a,height:l,fitView:c,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:g,nodeExtent:p}){return z.useContext(ea)?T.jsx(T.Fragment,{children:e}):T.jsx(ym,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:s,initialWidth:a,initialHeight:l,fitView:c,initialFitViewOptions:f,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:g,nodeExtent:p,children:e})}const tT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function nT({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:s,nodeTypes:a,edgeTypes:l,onNodeClick:c,onEdgeClick:f,onInit:d,onMove:h,onMoveStart:g,onMoveEnd:p,onConnect:m,onConnectStart:x,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:E,onNodeContextMenu:O,onNodeDoubleClick:k,onNodeDragStart:M,onNodeDrag:D,onNodeDragStop:V,onNodesDelete:K,onEdgesDelete:Z,onDelete:U,onSelectionChange:q,onSelectionDragStart:C,onSelectionDrag:H,onSelectionDragStop:B,onSelectionContextMenu:R,onSelectionStart:P,onSelectionEnd:W,onBeforeDelete:$,connectionMode:G,connectionLineType:J=Zn.Bezier,connectionLineStyle:re,connectionLineComponent:se,connectionLineContainerStyle:ce,deleteKeyCode:ge="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:Q=!1,selectionMode:ae=no.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:de=fi()?"Meta":"Control",zoomActivationKeyCode:ue=fi()?"Meta":"Control",snapToGrid:_e,snapGrid:ye,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:Ze,nodesDraggable:Ge,autoPanOnNodeFocus:Fn,nodesConnectable:bo,nodesFocusable:bn,nodeOrigin:pt=Sg,edgesFocusable:nn,edgesReconnectable:_n,elementsSelectable:Mi=!0,defaultViewport:Sn=DC,minZoom:lr=.5,maxZoom:rn=2,translateExtent:Hn=ii,preventScrolling:Ri=!0,nodeExtent:Lr,defaultMarkerColor:Di="#b1b1b7",zoomOnScroll:Li=!0,zoomOnPinch:$i=!0,panOnScroll:Bi=!1,panOnScrollSpeed:Fi=.5,panOnScrollMode:Hi=Nr.Free,zoomOnDoubleClick:zi=!0,panOnDrag:tf=!0,onPaneClick:nf,onPaneMouseEnter:rf,onPaneMouseMove:Ba,onPaneMouseLeave:Fa,onPaneScroll:of,onPaneContextMenu:sf,paneClickDistance:Ha=0,nodeClickDistance:af=0,children:za,onReconnect:lf,onReconnectStart:cf,onReconnectEnd:uf,onEdgeContextMenu:Vi,onEdgeDoubleClick:ff,onEdgeMouseEnter:Wi,onEdgeMouseMove:df,onEdgeMouseLeave:hf,reconnectRadius:pf=10,onNodesChange:gf,onEdgesChange:mf,noDragClassName:yf="nodrag",noWheelClassName:vf="nowheel",noPanClassName:Va="nopan",fitView:ji,fitViewOptions:Wa,connectOnClick:xf,attributionPosition:wf,proOptions:bf,defaultEdgeOptions:_f,elevateNodesOnSelect:Sf,elevateEdgesOnSelect:_o,disableKeyboardA11y:ja=!1,autoPanOnConnect:So,autoPanOnNodeDrag:Ef,autoPanSpeed:Cf,connectionRadius:Nf,isValidConnection:Ua,onError:Ga,style:Ya,id:Xa,nodeDragThreshold:Tf,connectionDragThreshold:Af,viewport:If,onViewportChange:qa,width:Ka,height:Za,colorMode:Ui="light",debug:Of,onScroll:Gi,ariaLabelConfig:Eo,...Qa},Pf){const Co=Xa||"1",Ja=BC(Ui),Yi=z.useCallback(el=>{el.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Gi?.(el)},[Gi]);return T.jsx("div",{"data-testid":"rf__wrapper",...Qa,onScroll:Yi,style:{...Ya,...tT},ref:Pf,className:nt(["react-flow",s,Ja]),id:Xa,role:"application",children:T.jsxs(eT,{nodes:e,edges:t,width:Ka,height:Za,fitView:ji,fitViewOptions:Wa,minZoom:lr,maxZoom:rn,nodeOrigin:pt,nodeExtent:Lr,children:[T.jsx(QN,{onInit:d,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:E,onNodeContextMenu:O,onNodeDoubleClick:k,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:re,connectionLineComponent:se,connectionLineContainerStyle:ce,selectionKeyCode:te,selectionOnDrag:Q,selectionMode:ae,deleteKeyCode:ge,multiSelectionKeyCode:de,panActivationKeyCode:fe,zoomActivationKeyCode:ue,onlyRenderVisibleElements:Le,defaultViewport:Sn,translateExtent:Hn,minZoom:lr,maxZoom:rn,preventScrolling:Ri,zoomOnScroll:Li,zoomOnPinch:$i,zoomOnDoubleClick:zi,panOnScroll:Bi,panOnScrollSpeed:Fi,panOnScrollMode:Hi,panOnDrag:tf,onPaneClick:nf,onPaneMouseEnter:rf,onPaneMouseMove:Ba,onPaneMouseLeave:Fa,onPaneScroll:of,onPaneContextMenu:sf,paneClickDistance:Ha,nodeClickDistance:af,onSelectionContextMenu:R,onSelectionStart:P,onSelectionEnd:W,onReconnect:lf,onReconnectStart:cf,onReconnectEnd:uf,onEdgeContextMenu:Vi,onEdgeDoubleClick:ff,onEdgeMouseEnter:Wi,onEdgeMouseMove:df,onEdgeMouseLeave:hf,reconnectRadius:pf,defaultMarkerColor:Di,noDragClassName:yf,noWheelClassName:vf,noPanClassName:Va,rfId:Co,disableKeyboardA11y:ja,nodeExtent:Lr,viewport:If,onViewportChange:qa}),T.jsx($C,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:x,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:_,nodesDraggable:Ge,autoPanOnNodeFocus:Fn,nodesConnectable:bo,nodesFocusable:bn,edgesFocusable:nn,edgesReconnectable:_n,elementsSelectable:Mi,elevateNodesOnSelect:Sf,elevateEdgesOnSelect:_o,minZoom:lr,maxZoom:rn,nodeExtent:Lr,onNodesChange:gf,onEdgesChange:mf,snapToGrid:_e,snapGrid:ye,connectionMode:G,translateExtent:Hn,connectOnClick:xf,defaultEdgeOptions:_f,fitView:ji,fitViewOptions:Wa,onNodesDelete:K,onEdgesDelete:Z,onDelete:U,onNodeDragStart:M,onNodeDrag:D,onNodeDragStop:V,onSelectionDrag:H,onSelectionDragStart:C,onSelectionDragStop:B,onMove:h,onMoveStart:g,onMoveEnd:p,noPanClassName:Va,nodeOrigin:pt,rfId:Co,autoPanOnConnect:So,autoPanOnNodeDrag:Ef,autoPanSpeed:Cf,onError:Ga,connectionRadius:Nf,isValidConnection:Ua,selectNodesOnDrag:Ze,nodeDragThreshold:Tf,connectionDragThreshold:Af,onBeforeDelete:$,paneClickDistance:Ha,debug:Of,ariaLabelConfig:Eo}),T.jsx(RC,{onSelectionChange:q}),za,T.jsx(IC,{proOptions:bf,position:wf}),T.jsx(AC,{rfId:Co,disableKeyboardA11y:ja})]})})}var rT=Dg(nT);const oT=_t.error014();function iT({id:e,handleType:t,handleId:n,onConnect:o,onDisconnect:s}={}){const a=yi(),l=e??a;if(!l)throw new Error(oT);const c=z.useRef(null),f=Re(d=>d.connectionLookup.get(`${l}${t?n?`-${t}-${n}`:`-${t}`:""}`),uE);return z.useEffect(()=>{if(c.current&&c.current!==f){const d=f??new Map;Sp(c.current,d,s),Sp(d,c.current,o)}c.current=f??new Map},[f,o,s]),z.useMemo(()=>Array.from(f?.values()??[]),[f])}function Yc(e){return Re(z.useCallback(n=>{const o=[],s=Array.isArray(e),a=s?e:[e];for(const l of a){const c=n.nodeLookup.get(l);c&&o.push({id:c.id,type:c.type,data:c.data})}return s?o:o[0]??null},[e]),$E)}function sT({dimensions:e,lineWidth:t,variant:n,className:o}){return T.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:nt(["react-flow__background-pattern",n,o])})}function aT({radius:e,className:t}){return T.jsx("circle",{cx:e,cy:e,r:e,className:nt(["react-flow__background-pattern","dots",t])})}var er;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(er||(er={}));const lT={[er.Dots]:1,[er.Lines]:1,[er.Cross]:6},cT=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function vm({id:e,variant:t=er.Dots,gap:n=20,size:o,lineWidth:s=1,offset:a=0,color:l,bgColor:c,style:f,className:d,patternClassName:h}){const g=z.useRef(null),{transform:p,patternId:m}=Re(cT,qe),x=o||lT[t],v=t===er.Dots,b=t===er.Cross,_=Array.isArray(n)?n:[n,n],N=[_[0]*p[2]||1,_[1]*p[2]||1],w=x*p[2],E=Array.isArray(a)?a:[a,a],O=b?[w,w]:N,k=[E[0]*p[2]||1+O[0]/2,E[1]*p[2]||1+O[1]/2],M=`${m}${e||""}`;return T.jsxs("svg",{className:nt(["react-flow__background",d]),style:{...f,...ra,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[T.jsx("pattern",{id:M,x:p[0]%N[0],y:p[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:v?T.jsx(aT,{radius:w/2,className:h}):T.jsx(sT,{dimensions:O,lineWidth:s,variant:t,className:h})}),T.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}vm.displayName="Background";const uT=z.memo(vm);function fT(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function dT(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T.jsx("path",{d:"M0 0h32v4.2H0z"})})}function hT(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T.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 pT(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.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 gT(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.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 ia({children:e,className:t,...n}){return T.jsx("button",{type:"button",className:nt(["react-flow__controls-button",t]),...n,children:e})}const mT=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function xm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:l,onFitView:c,onInteractiveChange:f,className:d,children:h,position:g="bottom-left",orientation:p="vertical","aria-label":m}){const x=je(),{isInteractive:v,minZoomReached:b,maxZoomReached:_,ariaLabelConfig:N}=Re(mT,qe),{zoomIn:w,zoomOut:E,fitView:O}=mi(),k=()=>{w(),a?.()},M=()=>{E(),l?.()},D=()=>{O(s),c?.()},V=()=>{x.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),f?.(!v)},K=p==="horizontal"?"horizontal":"vertical";return T.jsxs(ta,{className:nt(["react-flow__controls",K,d]),position:g,style:e,"data-testid":"rf__controls","aria-label":m??N["controls.ariaLabel"],children:[t&&T.jsxs(T.Fragment,{children:[T.jsx(ia,{onClick:k,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:_,children:T.jsx(fT,{})}),T.jsx(ia,{onClick:M,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:b,children:T.jsx(dT,{})})]}),n&&T.jsx(ia,{className:"react-flow__controls-fitview",onClick:D,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:T.jsx(hT,{})}),o&&T.jsx(ia,{className:"react-flow__controls-interactive",onClick:V,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:v?T.jsx(gT,{}):T.jsx(pT,{})}),h]})}xm.displayName="Controls";const yT=z.memo(xm);function vT({id:e,x:t,y:n,width:o,height:s,style:a,color:l,strokeColor:c,strokeWidth:f,className:d,borderRadius:h,shapeRendering:g,selected:p,onClick:m}){const{background:x,backgroundColor:v}=a||{},b=l||x||v;return T.jsx("rect",{className:nt(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:h,ry:h,width:o,height:s,style:{fill:b,stroke:c,strokeWidth:f},shapeRendering:g,onClick:m?_=>m(_,e):void 0})}const xT=z.memo(vT),wT=e=>e.nodes.map(t=>t.id),Xc=e=>e instanceof Function?e:()=>e;function bT({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:s,nodeComponent:a=xT,onClick:l}){const c=Re(wT,qe),f=Xc(t),d=Xc(e),h=Xc(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return T.jsx(T.Fragment,{children:c.map(p=>T.jsx(ST,{id:p,nodeColorFunc:f,nodeStrokeColorFunc:d,nodeClassNameFunc:h,nodeBorderRadius:o,nodeStrokeWidth:s,NodeComponent:a,onClick:l,shapeRendering:g},p))})}function _T({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:l,NodeComponent:c,onClick:f}){const{node:d,x:h,y:g,width:p,height:m}=Re(x=>{const{internals:v}=x.nodeLookup.get(e),b=v.userNode,{x:_,y:N}=v.positionAbsolute,{width:w,height:E}=kn(b);return{node:b,x:_,y:N,width:w,height:E}},qe);return!d||d.hidden||!Mp(d)?null:T.jsx(c,{x:h,y:g,width:p,height:m,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:a,shapeRendering:l,onClick:f,id:d.id})}const ST=z.memo(_T);var ET=z.memo(bT);const CT=200,NT=150,TT=e=>!e.hidden,AT=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?Op(ai(e.nodeLookup,{filter:TT}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},IT="react-flow__minimap-desc";function wm({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:f,maskColor:d,maskStrokeColor:h,maskStrokeWidth:g,position:p="bottom-right",onClick:m,onNodeClick:x,pannable:v=!1,zoomable:b=!1,ariaLabel:_,inversePan:N,zoomStep:w=1,offsetScale:E=5}){const O=je(),k=z.useRef(null),{boundingRect:M,viewBB:D,rfId:V,panZoom:K,translateExtent:Z,flowWidth:U,flowHeight:q,ariaLabelConfig:C}=Re(AT,qe),H=e?.width??CT,B=e?.height??NT,R=M.width/H,P=M.height/B,W=Math.max(R,P),$=W*H,G=W*B,J=E*W,re=M.x-($-M.width)/2-J,se=M.y-(G-M.height)/2-J,ce=$+J*2,ge=G+J*2,te=`${IT}-${V}`,Q=z.useRef(0),ae=z.useRef();Q.current=W,z.useEffect(()=>{if(k.current&&K)return ae.current=GE({domNode:k.current,panZoom:K,getTransform:()=>O.getState().transform,getViewScale:()=>Q.current}),()=>{ae.current?.destroy()}},[K]),z.useEffect(()=>{ae.current?.update({translateExtent:Z,width:U,height:q,inversePan:N,pannable:v,zoomStep:w,zoomable:b})},[v,b,N,w,Z,U,q]);const fe=m?_e=>{const[ye,Le]=ae.current?.pointer(_e)||[0,0];m(_e,{x:ye,y:Le})}:void 0,de=x?z.useCallback((_e,ye)=>{const Le=O.getState().nodeLookup.get(ye).internals.userNode;x(_e,Le)},[]):void 0,ue=_??C["minimap.ariaLabel"];return T.jsx(ta,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*W: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 l=="number"?l:void 0},className:nt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:T.jsxs("svg",{width:H,height:B,viewBox:`${re} ${se} ${ce} ${ge}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":te,ref:k,onClick:fe,children:[ue&&T.jsx("title",{id:te,children:ue}),T.jsx(ET,{onClick:de,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:c}),T.jsx("path",{className:"react-flow__minimap-mask",d:`M${re-J},${se-J}h${ce+J*2}v${ge+J*2}h${-ce-J*2}z
60
- M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}wm.displayName="MiniMap";const OT=z.memo(wm),PT=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,kT={[Ar.Line]:"right",[Ar.Handle]:"bottom-right"};function MT({nodeId:e,position:t,variant:n=Ar.Handle,className:o,style:s=void 0,children:a,color:l,minWidth:c=10,minHeight:f=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:p,autoScale:m=!0,shouldResize:x,onResizeStart:v,onResize:b,onResizeEnd:_}){const N=yi(),w=typeof e=="string"?e:N,E=je(),O=z.useRef(null),k=n===Ar.Handle,M=Re(z.useCallback(PT(k&&m),[k,m]),qe),D=z.useRef(null),V=t??kT[n];z.useEffect(()=>{if(!(!O.current||!w))return D.current||(D.current=lC({domNode:O.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:Z,transform:U,snapGrid:q,snapToGrid:C,nodeOrigin:H,domNode:B}=E.getState();return{nodeLookup:Z,transform:U,snapGrid:q,snapToGrid:C,nodeOrigin:H,paneDomNode:B}},onChange:(Z,U)=>{const{triggerNodeChanges:q,nodeLookup:C,parentLookup:H,nodeOrigin:B}=E.getState(),R=[],P={x:Z.x,y:Z.y},W=C.get(w);if(W&&W.expandParent&&W.parentId){const $=W.origin??B,G=Z.width??W.measured.width??0,J=Z.height??W.measured.height??0,re={id:W.id,parentId:W.parentId,rect:{width:G,height:J,...Rp({x:Z.x??W.position.x,y:Z.y??W.position.y},{width:G,height:J},W.parentId,C,$)}},se=Dc([re],C,H,B);R.push(...se),P.x=Z.x?Math.max($[0]*G,Z.x):void 0,P.y=Z.y?Math.max($[1]*J,Z.y):void 0}if(P.x!==void 0&&P.y!==void 0){const $={id:w,type:"position",position:{...P}};R.push($)}if(Z.width!==void 0&&Z.height!==void 0){const G={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:Z.width,height:Z.height}};R.push(G)}for(const $ of U){const G={...$,type:"position"};R.push(G)}q(R)},onEnd:({width:Z,height:U})=>{const q={id:w,type:"dimensions",resizing:!1,dimensions:{width:Z,height:U}};E.getState().triggerNodeChanges([q])}})),D.current.update({controlPosition:V,boundaries:{minWidth:c,minHeight:f,maxWidth:d,maxHeight:h},keepAspectRatio:g,resizeDirection:p,onResizeStart:v,onResize:b,onResizeEnd:_,shouldResize:x}),()=>{D.current?.destroy()}},[V,c,f,d,h,g,v,b,_,x]);const K=V.split("-");return T.jsx("div",{className:nt(["react-flow__resize-control","nodrag",...K,n,o]),ref:O,style:{...s,scale:M,...l&&{[k?"backgroundColor":"borderColor"]:l}},children:a})}const bm=z.memo(MT),qc=20;function tr(e,t){const n=t[e.dataType],o=e.allowInput??n.allowInput;return n.underlyingType==="number"?{id:un(qc),name:e.name,handleColor:n.color,allowInput:o,type:"number",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:{id:un(qc),name:e.name,handleColor:n.color,allowInput:n.underlyingType==="string"?o:!1,type:"string",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}}function _m(e,t){const n=un(qc),o=e.inputs.map(s=>tr(s,t));return{id:n,name:e.name,inputs:o}}function xi(e,t,n,o,s){const a=n[t],l=a.inputs.map(f=>"inputs"in f?_m(f,e):tr(f,e)),c=a.outputs.map(f=>tr(f,e));return{id:o,position:s,sourcePosition:be.Right,targetPosition:be.Left,type:"configurableNode",width:400,data:{name:a.name,headerColor:a.headerColor,inputs:l,outputs:c,nodeTypeUniqueId:t,showNodeOpenButton:a.subtree!==void 0}}}function sa(e,t,n,o){const s=n[t];if(o)if(o.type==="input"){const a=s?.inputs?.[o.index1];if(!a)return;if(o.index2!==void 0&&"inputs"in a)return tr(a.inputs?.[o.index2],e);if(o.index2===void 0&&!("inputs"in a))return tr(a,e)}else return tr(s?.outputs?.[o.index1],e)}function Pt(e){const t=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!t)return{nodes:e.nodes,edges:e.edges};const n=e.typeOfNodes[t.nodeType].subtree;return n?{nodes:n.nodes,edges:n.edges,inputNodeId:n.inputNodeId,outputNodeId:n.outputNodeId}:{nodes:e.nodes,edges:e.edges}}function Or(e,t,n){const o=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!o)return t&&(e.nodes=[...t]),n&&(e.edges=[...n]),e;const s=e.typeOfNodes[o.nodeType].subtree,a=e.typeOfNodes[o.nodeType].subtree?.numberOfReferences;return!s||a!==0?(t&&(e.nodes=[...t]),n&&(e.edges=[...n]),e):(t&&(s.nodes=[...t]),n&&(s.edges=[...n]),e)}function wi(e){const t={},n={};for(const o of Object.keys(e.typeOfNodes)){const a=e.typeOfNodes[o].subtree;if(!(!a||a.nodes.length===0))for(const l of a.nodes){const c=l.data.nodeTypeUniqueId;c&&(n[o]=n[o]||new Set,n[o]?.add(c),t[c]=t[c]||new Set,t[c]?.add(o))}}return{nodeToNodeDependents:t,nodeToNodeDependencies:n}}function Kc(e,t){return("typeOfNodes"in e?wi(e).nodeToNodeDependents:e)[t]||new Set}function Sm(e,t){return("typeOfNodes"in e?wi(e).nodeToNodeDependencies:e)[t]||new Set}function Em(e,t){const n="typeOfNodes"in e?wi(e).nodeToNodeDependents:e,o=new Set,s=[t];for(;s.length>0;){const a=s.shift();if(!a)continue;o.add(a);const l=Kc(n,a);for(const c of l)o.has(c)||s.push(c)}return o}function RT(e,t){const n="typeOfNodes"in e?wi(e).nodeToNodeDependencies:e,o=new Set,s=[t];for(;s.length>0;){const a=s.shift();if(!a)continue;o.add(a);const l=Sm(n,a);for(const c of l)o.has(c)||s.push(c)}return o}function Mn(e,t){return e>=0?e:e+t}function Zc(e){return e>=0?e+1:e-1}function Qc(e,t){const n=Mn(e,t);return n>=0&&n<t}function Pr(e,t,n=void 0){let o=n?.index1??0,s=n?.index2??0;return Iterator.from({next:function(){if(!Qc(o,e.length))return{value:{value:void 0,handleIndices:{type:t,index1:o,index2:void 0},parentArray:e,parentArrayIndex:o},done:!0};const l=e[Mn(o,e.length)];if("inputs"in l){if(!Qc(s,l.inputs.length))return{value:{value:void 0,handleIndices:{type:"input",index1:o,index2:s},parentArray:l.inputs,parentArrayIndex:s},done:!0};const c=l.inputs[Mn(s,l.inputs.length)],f=o,d=s;let h=!1;for(;;){h?(s=s>=0?0:-1,h=!1):s=Zc(s);const m=e[Mn(o,e.length)];if(!m||!("inputs"in m)){s=0;break}if(Qc(s,m.inputs.length))break;o=Zc(o),h=!0}const g=c,p=e[Mn(f,e.length)];return{value:{value:g,handleIndices:{type:"input",index1:f,index2:d},parentArray:p,parentArrayIndex:d},done:!1}}else{const c=o;return o=Zc(o),s=0,{value:{value:l,handleIndices:{type:t,index1:c,index2:void 0},parentArray:e,parentArrayIndex:c},done:!1}}}})}function Cm(e,t,n=!0,o=!0){if(n){const s=e?.inputs instanceof Array?e?.inputs:[];Pr(s,"input").every(({value:l,handleIndices:c})=>t(l,c)!==!1)}if(o){const s=e?.outputs instanceof Array?e?.outputs:[];Pr(s,"output").forEach(({value:l,handleIndices:c})=>{t(l,c)})}return e}function Nm(e,t,n,o=!0,s=!0,a=!0){if(a){const l=Rn(t,e,o,s)?.value;return l&&Object.assign(l,n),e}else return Yo(e,l=>{const c=Rn(t,l,o,s)?.value;return c&&Object.assign(c,n),l})}function Jc(e,t,n=0,o,s=!0,a="before"){if(s){const l=gn(t,e);if(l){const c=l.parentArray,f=a==="before"?Mn(l.parentArrayIndex,c.length):Mn(l.parentArrayIndex,c.length)+1;c.splice(f,n,o)}return e}else return Yo(e,l=>{const c=gn(t,l);if(c){const f=c.parentArray,d=a==="before"?Mn(c.parentArrayIndex,f.length):Mn(c.parentArrayIndex,f.length)+1;f.splice(d,n,o)}return l})}var bi={exports:{}};/**
61
- * @license
62
- * Lodash <https://lodash.com/>
63
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
64
- * Released under MIT license <https://lodash.com/license>
65
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
66
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
67
- */var DT=bi.exports,Tm;function LT(){return Tm||(Tm=1,function(e,t){(function(){var n,o="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",d=500,h="__lodash_placeholder__",g=1,p=2,m=4,x=1,v=2,b=1,_=2,N=4,w=8,E=16,O=32,k=64,M=128,D=256,V=512,K=30,Z="...",U=800,q=16,C=1,H=2,B=3,R=1/0,P=9007199254740991,W=17976931348623157e292,$=NaN,G=4294967295,J=G-1,re=G>>>1,se=[["ary",M],["bind",b],["bindKey",_],["curry",w],["curryRight",E],["flip",V],["partial",O],["partialRight",k],["rearg",D]],ce="[object Arguments]",ge="[object Array]",te="[object AsyncFunction]",Q="[object Boolean]",ae="[object Date]",fe="[object DOMException]",de="[object Error]",ue="[object Function]",_e="[object GeneratorFunction]",ye="[object Map]",Le="[object Number]",Ze="[object Null]",Ge="[object Object]",Fn="[object Promise]",bo="[object Proxy]",bn="[object RegExp]",pt="[object Set]",nn="[object String]",_n="[object Symbol]",Mi="[object Undefined]",Sn="[object WeakMap]",lr="[object WeakSet]",rn="[object ArrayBuffer]",Hn="[object DataView]",Ri="[object Float32Array]",Lr="[object Float64Array]",Di="[object Int8Array]",Li="[object Int16Array]",$i="[object Int32Array]",Bi="[object Uint8Array]",Fi="[object Uint8ClampedArray]",Hi="[object Uint16Array]",zi="[object Uint32Array]",tf=/\b__p \+= '';/g,nf=/\b(__p \+=) '' \+/g,rf=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ba=/&(?:amp|lt|gt|quot|#39);/g,Fa=/[&<>"']/g,of=RegExp(Ba.source),sf=RegExp(Fa.source),Ha=/<%-([\s\S]+?)%>/g,af=/<%([\s\S]+?)%>/g,za=/<%=([\s\S]+?)%>/g,lf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cf=/^\w*$/,uf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Vi=/[\\^$.*+?()[\]{}|]/g,ff=RegExp(Vi.source),Wi=/^\s+/,df=/\s/,hf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,pf=/\{\n\/\* \[wrapped with (.+)\] \*/,gf=/,? & /,mf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yf=/[()=,{}\[\]\/\s]/,vf=/\\(\\)?/g,Va=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ji=/\w*$/,Wa=/^[-+]0x[0-9a-f]+$/i,xf=/^0b[01]+$/i,wf=/^\[object .+?Constructor\]$/,bf=/^0o[0-7]+$/i,_f=/^(?:0|[1-9]\d*)$/,Sf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_o=/($^)/,ja=/['\n\r\u2028\u2029\\]/g,So="\\ud800-\\udfff",Ef="\\u0300-\\u036f",Cf="\\ufe20-\\ufe2f",Nf="\\u20d0-\\u20ff",Ua=Ef+Cf+Nf,Ga="\\u2700-\\u27bf",Ya="a-z\\xdf-\\xf6\\xf8-\\xff",Xa="\\xac\\xb1\\xd7\\xf7",Tf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Af="\\u2000-\\u206f",If=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",qa="A-Z\\xc0-\\xd6\\xd8-\\xde",Ka="\\ufe0e\\ufe0f",Za=Xa+Tf+Af+If,Ui="['’]",Of="["+So+"]",Gi="["+Za+"]",Eo="["+Ua+"]",Qa="\\d+",Pf="["+Ga+"]",Co="["+Ya+"]",Ja="[^"+So+Za+Qa+Ga+Ya+qa+"]",Yi="\\ud83c[\\udffb-\\udfff]",el="(?:"+Eo+"|"+Yi+")",cv="[^"+So+"]",kf="(?:\\ud83c[\\udde6-\\uddff]){2}",Mf="[\\ud800-\\udbff][\\udc00-\\udfff]",No="["+qa+"]",uv="\\u200d",fv="(?:"+Co+"|"+Ja+")",FP="(?:"+No+"|"+Ja+")",dv="(?:"+Ui+"(?:d|ll|m|re|s|t|ve))?",hv="(?:"+Ui+"(?:D|LL|M|RE|S|T|VE))?",pv=el+"?",gv="["+Ka+"]?",HP="(?:"+uv+"(?:"+[cv,kf,Mf].join("|")+")"+gv+pv+")*",zP="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",VP="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",mv=gv+pv+HP,WP="(?:"+[Pf,kf,Mf].join("|")+")"+mv,jP="(?:"+[cv+Eo+"?",Eo,kf,Mf,Of].join("|")+")",UP=RegExp(Ui,"g"),GP=RegExp(Eo,"g"),Rf=RegExp(Yi+"(?="+Yi+")|"+jP+mv,"g"),YP=RegExp([No+"?"+Co+"+"+dv+"(?="+[Gi,No,"$"].join("|")+")",FP+"+"+hv+"(?="+[Gi,No+fv,"$"].join("|")+")",No+"?"+fv+"+"+dv,No+"+"+hv,VP,zP,Qa,WP].join("|"),"g"),XP=RegExp("["+uv+So+Ua+Ka+"]"),qP=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,KP=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ZP=-1,Ye={};Ye[Ri]=Ye[Lr]=Ye[Di]=Ye[Li]=Ye[$i]=Ye[Bi]=Ye[Fi]=Ye[Hi]=Ye[zi]=!0,Ye[ce]=Ye[ge]=Ye[rn]=Ye[Q]=Ye[Hn]=Ye[ae]=Ye[de]=Ye[ue]=Ye[ye]=Ye[Le]=Ye[Ge]=Ye[bn]=Ye[pt]=Ye[nn]=Ye[Sn]=!1;var We={};We[ce]=We[ge]=We[rn]=We[Hn]=We[Q]=We[ae]=We[Ri]=We[Lr]=We[Di]=We[Li]=We[$i]=We[ye]=We[Le]=We[Ge]=We[bn]=We[pt]=We[nn]=We[_n]=We[Bi]=We[Fi]=We[Hi]=We[zi]=!0,We[de]=We[ue]=We[Sn]=!1;var QP={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},JP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ek={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},tk={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nk=parseFloat,rk=parseInt,yv=typeof us=="object"&&us&&us.Object===Object&&us,ok=typeof self=="object"&&self&&self.Object===Object&&self,ft=yv||ok||Function("return this")(),Df=t&&!t.nodeType&&t,$r=Df&&!0&&e&&!e.nodeType&&e,vv=$r&&$r.exports===Df,Lf=vv&&yv.process,Vt=function(){try{var Y=$r&&$r.require&&$r.require("util").types;return Y||Lf&&Lf.binding&&Lf.binding("util")}catch{}}(),xv=Vt&&Vt.isArrayBuffer,wv=Vt&&Vt.isDate,bv=Vt&&Vt.isMap,_v=Vt&&Vt.isRegExp,Sv=Vt&&Vt.isSet,Ev=Vt&&Vt.isTypedArray;function Dt(Y,ne,ee){switch(ee.length){case 0:return Y.call(ne);case 1:return Y.call(ne,ee[0]);case 2:return Y.call(ne,ee[0],ee[1]);case 3:return Y.call(ne,ee[0],ee[1],ee[2])}return Y.apply(ne,ee)}function ik(Y,ne,ee,me){for(var Te=-1,Be=Y==null?0:Y.length;++Te<Be;){var at=Y[Te];ne(me,at,ee(at),Y)}return me}function Wt(Y,ne){for(var ee=-1,me=Y==null?0:Y.length;++ee<me&&ne(Y[ee],ee,Y)!==!1;);return Y}function sk(Y,ne){for(var ee=Y==null?0:Y.length;ee--&&ne(Y[ee],ee,Y)!==!1;);return Y}function Cv(Y,ne){for(var ee=-1,me=Y==null?0:Y.length;++ee<me;)if(!ne(Y[ee],ee,Y))return!1;return!0}function cr(Y,ne){for(var ee=-1,me=Y==null?0:Y.length,Te=0,Be=[];++ee<me;){var at=Y[ee];ne(at,ee,Y)&&(Be[Te++]=at)}return Be}function tl(Y,ne){var ee=Y==null?0:Y.length;return!!ee&&To(Y,ne,0)>-1}function $f(Y,ne,ee){for(var me=-1,Te=Y==null?0:Y.length;++me<Te;)if(ee(ne,Y[me]))return!0;return!1}function Xe(Y,ne){for(var ee=-1,me=Y==null?0:Y.length,Te=Array(me);++ee<me;)Te[ee]=ne(Y[ee],ee,Y);return Te}function ur(Y,ne){for(var ee=-1,me=ne.length,Te=Y.length;++ee<me;)Y[Te+ee]=ne[ee];return Y}function Bf(Y,ne,ee,me){var Te=-1,Be=Y==null?0:Y.length;for(me&&Be&&(ee=Y[++Te]);++Te<Be;)ee=ne(ee,Y[Te],Te,Y);return ee}function ak(Y,ne,ee,me){var Te=Y==null?0:Y.length;for(me&&Te&&(ee=Y[--Te]);Te--;)ee=ne(ee,Y[Te],Te,Y);return ee}function Ff(Y,ne){for(var ee=-1,me=Y==null?0:Y.length;++ee<me;)if(ne(Y[ee],ee,Y))return!0;return!1}var lk=Hf("length");function ck(Y){return Y.split("")}function uk(Y){return Y.match(mf)||[]}function Nv(Y,ne,ee){var me;return ee(Y,function(Te,Be,at){if(ne(Te,Be,at))return me=Be,!1}),me}function nl(Y,ne,ee,me){for(var Te=Y.length,Be=ee+(me?1:-1);me?Be--:++Be<Te;)if(ne(Y[Be],Be,Y))return Be;return-1}function To(Y,ne,ee){return ne===ne?_k(Y,ne,ee):nl(Y,Tv,ee)}function fk(Y,ne,ee,me){for(var Te=ee-1,Be=Y.length;++Te<Be;)if(me(Y[Te],ne))return Te;return-1}function Tv(Y){return Y!==Y}function Av(Y,ne){var ee=Y==null?0:Y.length;return ee?Vf(Y,ne)/ee:$}function Hf(Y){return function(ne){return ne==null?n:ne[Y]}}function zf(Y){return function(ne){return Y==null?n:Y[ne]}}function Iv(Y,ne,ee,me,Te){return Te(Y,function(Be,at,ze){ee=me?(me=!1,Be):ne(ee,Be,at,ze)}),ee}function dk(Y,ne){var ee=Y.length;for(Y.sort(ne);ee--;)Y[ee]=Y[ee].value;return Y}function Vf(Y,ne){for(var ee,me=-1,Te=Y.length;++me<Te;){var Be=ne(Y[me]);Be!==n&&(ee=ee===n?Be:ee+Be)}return ee}function Wf(Y,ne){for(var ee=-1,me=Array(Y);++ee<Y;)me[ee]=ne(ee);return me}function hk(Y,ne){return Xe(ne,function(ee){return[ee,Y[ee]]})}function Ov(Y){return Y&&Y.slice(0,Rv(Y)+1).replace(Wi,"")}function Lt(Y){return function(ne){return Y(ne)}}function jf(Y,ne){return Xe(ne,function(ee){return Y[ee]})}function Xi(Y,ne){return Y.has(ne)}function Pv(Y,ne){for(var ee=-1,me=Y.length;++ee<me&&To(ne,Y[ee],0)>-1;);return ee}function kv(Y,ne){for(var ee=Y.length;ee--&&To(ne,Y[ee],0)>-1;);return ee}function pk(Y,ne){for(var ee=Y.length,me=0;ee--;)Y[ee]===ne&&++me;return me}var gk=zf(QP),mk=zf(JP);function yk(Y){return"\\"+tk[Y]}function vk(Y,ne){return Y==null?n:Y[ne]}function Ao(Y){return XP.test(Y)}function xk(Y){return qP.test(Y)}function wk(Y){for(var ne,ee=[];!(ne=Y.next()).done;)ee.push(ne.value);return ee}function Uf(Y){var ne=-1,ee=Array(Y.size);return Y.forEach(function(me,Te){ee[++ne]=[Te,me]}),ee}function Mv(Y,ne){return function(ee){return Y(ne(ee))}}function fr(Y,ne){for(var ee=-1,me=Y.length,Te=0,Be=[];++ee<me;){var at=Y[ee];(at===ne||at===h)&&(Y[ee]=h,Be[Te++]=ee)}return Be}function rl(Y){var ne=-1,ee=Array(Y.size);return Y.forEach(function(me){ee[++ne]=me}),ee}function bk(Y){var ne=-1,ee=Array(Y.size);return Y.forEach(function(me){ee[++ne]=[me,me]}),ee}function _k(Y,ne,ee){for(var me=ee-1,Te=Y.length;++me<Te;)if(Y[me]===ne)return me;return-1}function Sk(Y,ne,ee){for(var me=ee+1;me--;)if(Y[me]===ne)return me;return me}function Io(Y){return Ao(Y)?Ck(Y):lk(Y)}function on(Y){return Ao(Y)?Nk(Y):ck(Y)}function Rv(Y){for(var ne=Y.length;ne--&&df.test(Y.charAt(ne)););return ne}var Ek=zf(ek);function Ck(Y){for(var ne=Rf.lastIndex=0;Rf.test(Y);)++ne;return ne}function Nk(Y){return Y.match(Rf)||[]}function Tk(Y){return Y.match(YP)||[]}var Ak=function Y(ne){ne=ne==null?ft:Oo.defaults(ft.Object(),ne,Oo.pick(ft,KP));var ee=ne.Array,me=ne.Date,Te=ne.Error,Be=ne.Function,at=ne.Math,ze=ne.Object,Gf=ne.RegExp,Ik=ne.String,jt=ne.TypeError,ol=ee.prototype,Ok=Be.prototype,Po=ze.prototype,il=ne["__core-js_shared__"],sl=Ok.toString,He=Po.hasOwnProperty,Pk=0,Dv=function(){var r=/[^.]+$/.exec(il&&il.keys&&il.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),al=Po.toString,kk=sl.call(ze),Mk=ft._,Rk=Gf("^"+sl.call(He).replace(Vi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ll=vv?ne.Buffer:n,dr=ne.Symbol,cl=ne.Uint8Array,Lv=ll?ll.allocUnsafe:n,ul=Mv(ze.getPrototypeOf,ze),$v=ze.create,Bv=Po.propertyIsEnumerable,fl=ol.splice,Fv=dr?dr.isConcatSpreadable:n,qi=dr?dr.iterator:n,Br=dr?dr.toStringTag:n,dl=function(){try{var r=Wr(ze,"defineProperty");return r({},"",{}),r}catch{}}(),Dk=ne.clearTimeout!==ft.clearTimeout&&ne.clearTimeout,Lk=me&&me.now!==ft.Date.now&&me.now,$k=ne.setTimeout!==ft.setTimeout&&ne.setTimeout,hl=at.ceil,pl=at.floor,Yf=ze.getOwnPropertySymbols,Bk=ll?ll.isBuffer:n,Hv=ne.isFinite,Fk=ol.join,Hk=Mv(ze.keys,ze),lt=at.max,gt=at.min,zk=me.now,Vk=ne.parseInt,zv=at.random,Wk=ol.reverse,Xf=Wr(ne,"DataView"),Ki=Wr(ne,"Map"),qf=Wr(ne,"Promise"),ko=Wr(ne,"Set"),Zi=Wr(ne,"WeakMap"),Qi=Wr(ze,"create"),gl=Zi&&new Zi,Mo={},jk=jr(Xf),Uk=jr(Ki),Gk=jr(qf),Yk=jr(ko),Xk=jr(Zi),ml=dr?dr.prototype:n,Ji=ml?ml.valueOf:n,Vv=ml?ml.toString:n;function A(r){if(Qe(r)&&!Ae(r)&&!(r instanceof De)){if(r instanceof Ut)return r;if(He.call(r,"__wrapped__"))return Wx(r)}return new Ut(r)}var Ro=function(){function r(){}return function(i){if(!Ke(i))return{};if($v)return $v(i);r.prototype=i;var u=new r;return r.prototype=n,u}}();function yl(){}function Ut(r,i){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!i,this.__index__=0,this.__values__=n}A.templateSettings={escape:Ha,evaluate:af,interpolate:za,variable:"",imports:{_:A}},A.prototype=yl.prototype,A.prototype.constructor=A,Ut.prototype=Ro(yl.prototype),Ut.prototype.constructor=Ut;function De(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=G,this.__views__=[]}function qk(){var r=new De(this.__wrapped__);return r.__actions__=Et(this.__actions__),r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=Et(this.__iteratees__),r.__takeCount__=this.__takeCount__,r.__views__=Et(this.__views__),r}function Kk(){if(this.__filtered__){var r=new De(this);r.__dir__=-1,r.__filtered__=!0}else r=this.clone(),r.__dir__*=-1;return r}function Zk(){var r=this.__wrapped__.value(),i=this.__dir__,u=Ae(r),y=i<0,S=u?r.length:0,I=cR(0,S,this.__views__),F=I.start,j=I.end,X=j-F,oe=y?j:F-1,ie=this.__iteratees__,le=ie.length,he=0,we=gt(X,this.__takeCount__);if(!u||!y&&S==X&&we==X)return dx(r,this.__actions__);var Ee=[];e:for(;X--&&he<we;){oe+=i;for(var Oe=-1,Ce=r[oe];++Oe<le;){var Me=ie[Oe],$e=Me.iteratee,Ft=Me.type,xt=$e(Ce);if(Ft==H)Ce=xt;else if(!xt){if(Ft==C)continue e;break e}}Ee[he++]=Ce}return Ee}De.prototype=Ro(yl.prototype),De.prototype.constructor=De;function Fr(r){var i=-1,u=r==null?0:r.length;for(this.clear();++i<u;){var y=r[i];this.set(y[0],y[1])}}function Qk(){this.__data__=Qi?Qi(null):{},this.size=0}function Jk(r){var i=this.has(r)&&delete this.__data__[r];return this.size-=i?1:0,i}function eM(r){var i=this.__data__;if(Qi){var u=i[r];return u===f?n:u}return He.call(i,r)?i[r]:n}function tM(r){var i=this.__data__;return Qi?i[r]!==n:He.call(i,r)}function nM(r,i){var u=this.__data__;return this.size+=this.has(r)?0:1,u[r]=Qi&&i===n?f:i,this}Fr.prototype.clear=Qk,Fr.prototype.delete=Jk,Fr.prototype.get=eM,Fr.prototype.has=tM,Fr.prototype.set=nM;function zn(r){var i=-1,u=r==null?0:r.length;for(this.clear();++i<u;){var y=r[i];this.set(y[0],y[1])}}function rM(){this.__data__=[],this.size=0}function oM(r){var i=this.__data__,u=vl(i,r);if(u<0)return!1;var y=i.length-1;return u==y?i.pop():fl.call(i,u,1),--this.size,!0}function iM(r){var i=this.__data__,u=vl(i,r);return u<0?n:i[u][1]}function sM(r){return vl(this.__data__,r)>-1}function aM(r,i){var u=this.__data__,y=vl(u,r);return y<0?(++this.size,u.push([r,i])):u[y][1]=i,this}zn.prototype.clear=rM,zn.prototype.delete=oM,zn.prototype.get=iM,zn.prototype.has=sM,zn.prototype.set=aM;function Vn(r){var i=-1,u=r==null?0:r.length;for(this.clear();++i<u;){var y=r[i];this.set(y[0],y[1])}}function lM(){this.size=0,this.__data__={hash:new Fr,map:new(Ki||zn),string:new Fr}}function cM(r){var i=Ol(this,r).delete(r);return this.size-=i?1:0,i}function uM(r){return Ol(this,r).get(r)}function fM(r){return Ol(this,r).has(r)}function dM(r,i){var u=Ol(this,r),y=u.size;return u.set(r,i),this.size+=u.size==y?0:1,this}Vn.prototype.clear=lM,Vn.prototype.delete=cM,Vn.prototype.get=uM,Vn.prototype.has=fM,Vn.prototype.set=dM;function Hr(r){var i=-1,u=r==null?0:r.length;for(this.__data__=new Vn;++i<u;)this.add(r[i])}function hM(r){return this.__data__.set(r,f),this}function pM(r){return this.__data__.has(r)}Hr.prototype.add=Hr.prototype.push=hM,Hr.prototype.has=pM;function sn(r){var i=this.__data__=new zn(r);this.size=i.size}function gM(){this.__data__=new zn,this.size=0}function mM(r){var i=this.__data__,u=i.delete(r);return this.size=i.size,u}function yM(r){return this.__data__.get(r)}function vM(r){return this.__data__.has(r)}function xM(r,i){var u=this.__data__;if(u instanceof zn){var y=u.__data__;if(!Ki||y.length<s-1)return y.push([r,i]),this.size=++u.size,this;u=this.__data__=new Vn(y)}return u.set(r,i),this.size=u.size,this}sn.prototype.clear=gM,sn.prototype.delete=mM,sn.prototype.get=yM,sn.prototype.has=vM,sn.prototype.set=xM;function Wv(r,i){var u=Ae(r),y=!u&&Ur(r),S=!u&&!y&&yr(r),I=!u&&!y&&!S&&Bo(r),F=u||y||S||I,j=F?Wf(r.length,Ik):[],X=j.length;for(var oe in r)(i||He.call(r,oe))&&!(F&&(oe=="length"||S&&(oe=="offset"||oe=="parent")||I&&(oe=="buffer"||oe=="byteLength"||oe=="byteOffset")||Gn(oe,X)))&&j.push(oe);return j}function jv(r){var i=r.length;return i?r[sd(0,i-1)]:n}function wM(r,i){return Pl(Et(r),zr(i,0,r.length))}function bM(r){return Pl(Et(r))}function Kf(r,i,u){(u!==n&&!an(r[i],u)||u===n&&!(i in r))&&Wn(r,i,u)}function es(r,i,u){var y=r[i];(!(He.call(r,i)&&an(y,u))||u===n&&!(i in r))&&Wn(r,i,u)}function vl(r,i){for(var u=r.length;u--;)if(an(r[u][0],i))return u;return-1}function _M(r,i,u,y){return hr(r,function(S,I,F){i(y,S,u(S),F)}),y}function Uv(r,i){return r&&Cn(i,ct(i),r)}function SM(r,i){return r&&Cn(i,Nt(i),r)}function Wn(r,i,u){i=="__proto__"&&dl?dl(r,i,{configurable:!0,enumerable:!0,value:u,writable:!0}):r[i]=u}function Zf(r,i){for(var u=-1,y=i.length,S=ee(y),I=r==null;++u<y;)S[u]=I?n:Pd(r,i[u]);return S}function zr(r,i,u){return r===r&&(u!==n&&(r=r<=u?r:u),i!==n&&(r=r>=i?r:i)),r}function Gt(r,i,u,y,S,I){var F,j=i&g,X=i&p,oe=i&m;if(u&&(F=S?u(r,y,S,I):u(r)),F!==n)return F;if(!Ke(r))return r;var ie=Ae(r);if(ie){if(F=fR(r),!j)return Et(r,F)}else{var le=mt(r),he=le==ue||le==_e;if(yr(r))return gx(r,j);if(le==Ge||le==ce||he&&!S){if(F=X||he?{}:Rx(r),!j)return X?eR(r,SM(F,r)):JM(r,Uv(F,r))}else{if(!We[le])return S?r:{};F=dR(r,le,j)}}I||(I=new sn);var we=I.get(r);if(we)return we;I.set(r,F),cw(r)?r.forEach(function(Ce){F.add(Gt(Ce,i,u,Ce,r,I))}):aw(r)&&r.forEach(function(Ce,Me){F.set(Me,Gt(Ce,i,u,Me,r,I))});var Ee=oe?X?yd:md:X?Nt:ct,Oe=ie?n:Ee(r);return Wt(Oe||r,function(Ce,Me){Oe&&(Me=Ce,Ce=r[Me]),es(F,Me,Gt(Ce,i,u,Me,r,I))}),F}function EM(r){var i=ct(r);return function(u){return Gv(u,r,i)}}function Gv(r,i,u){var y=u.length;if(r==null)return!y;for(r=ze(r);y--;){var S=u[y],I=i[S],F=r[S];if(F===n&&!(S in r)||!I(F))return!1}return!0}function Yv(r,i,u){if(typeof r!="function")throw new jt(l);return as(function(){r.apply(n,u)},i)}function ts(r,i,u,y){var S=-1,I=tl,F=!0,j=r.length,X=[],oe=i.length;if(!j)return X;u&&(i=Xe(i,Lt(u))),y?(I=$f,F=!1):i.length>=s&&(I=Xi,F=!1,i=new Hr(i));e:for(;++S<j;){var ie=r[S],le=u==null?ie:u(ie);if(ie=y||ie!==0?ie:0,F&&le===le){for(var he=oe;he--;)if(i[he]===le)continue e;X.push(ie)}else I(i,le,y)||X.push(ie)}return X}var hr=wx(En),Xv=wx(Jf,!0);function CM(r,i){var u=!0;return hr(r,function(y,S,I){return u=!!i(y,S,I),u}),u}function xl(r,i,u){for(var y=-1,S=r.length;++y<S;){var I=r[y],F=i(I);if(F!=null&&(j===n?F===F&&!Bt(F):u(F,j)))var j=F,X=I}return X}function NM(r,i,u,y){var S=r.length;for(u=Ie(u),u<0&&(u=-u>S?0:S+u),y=y===n||y>S?S:Ie(y),y<0&&(y+=S),y=u>y?0:fw(y);u<y;)r[u++]=i;return r}function qv(r,i){var u=[];return hr(r,function(y,S,I){i(y,S,I)&&u.push(y)}),u}function dt(r,i,u,y,S){var I=-1,F=r.length;for(u||(u=pR),S||(S=[]);++I<F;){var j=r[I];i>0&&u(j)?i>1?dt(j,i-1,u,y,S):ur(S,j):y||(S[S.length]=j)}return S}var Qf=bx(),Kv=bx(!0);function En(r,i){return r&&Qf(r,i,ct)}function Jf(r,i){return r&&Kv(r,i,ct)}function wl(r,i){return cr(i,function(u){return Yn(r[u])})}function Vr(r,i){i=gr(i,r);for(var u=0,y=i.length;r!=null&&u<y;)r=r[Nn(i[u++])];return u&&u==y?r:n}function Zv(r,i,u){var y=i(r);return Ae(r)?y:ur(y,u(r))}function yt(r){return r==null?r===n?Mi:Ze:Br&&Br in ze(r)?lR(r):bR(r)}function ed(r,i){return r>i}function TM(r,i){return r!=null&&He.call(r,i)}function AM(r,i){return r!=null&&i in ze(r)}function IM(r,i,u){return r>=gt(i,u)&&r<lt(i,u)}function td(r,i,u){for(var y=u?$f:tl,S=r[0].length,I=r.length,F=I,j=ee(I),X=1/0,oe=[];F--;){var ie=r[F];F&&i&&(ie=Xe(ie,Lt(i))),X=gt(ie.length,X),j[F]=!u&&(i||S>=120&&ie.length>=120)?new Hr(F&&ie):n}ie=r[0];var le=-1,he=j[0];e:for(;++le<S&&oe.length<X;){var we=ie[le],Ee=i?i(we):we;if(we=u||we!==0?we:0,!(he?Xi(he,Ee):y(oe,Ee,u))){for(F=I;--F;){var Oe=j[F];if(!(Oe?Xi(Oe,Ee):y(r[F],Ee,u)))continue e}he&&he.push(Ee),oe.push(we)}}return oe}function OM(r,i,u,y){return En(r,function(S,I,F){i(y,u(S),I,F)}),y}function ns(r,i,u){i=gr(i,r),r=Bx(r,i);var y=r==null?r:r[Nn(Xt(i))];return y==null?n:Dt(y,r,u)}function Qv(r){return Qe(r)&&yt(r)==ce}function PM(r){return Qe(r)&&yt(r)==rn}function kM(r){return Qe(r)&&yt(r)==ae}function rs(r,i,u,y,S){return r===i?!0:r==null||i==null||!Qe(r)&&!Qe(i)?r!==r&&i!==i:MM(r,i,u,y,rs,S)}function MM(r,i,u,y,S,I){var F=Ae(r),j=Ae(i),X=F?ge:mt(r),oe=j?ge:mt(i);X=X==ce?Ge:X,oe=oe==ce?Ge:oe;var ie=X==Ge,le=oe==Ge,he=X==oe;if(he&&yr(r)){if(!yr(i))return!1;F=!0,ie=!1}if(he&&!ie)return I||(I=new sn),F||Bo(r)?Px(r,i,u,y,S,I):sR(r,i,X,u,y,S,I);if(!(u&x)){var we=ie&&He.call(r,"__wrapped__"),Ee=le&&He.call(i,"__wrapped__");if(we||Ee){var Oe=we?r.value():r,Ce=Ee?i.value():i;return I||(I=new sn),S(Oe,Ce,u,y,I)}}return he?(I||(I=new sn),aR(r,i,u,y,S,I)):!1}function RM(r){return Qe(r)&&mt(r)==ye}function nd(r,i,u,y){var S=u.length,I=S,F=!y;if(r==null)return!I;for(r=ze(r);S--;){var j=u[S];if(F&&j[2]?j[1]!==r[j[0]]:!(j[0]in r))return!1}for(;++S<I;){j=u[S];var X=j[0],oe=r[X],ie=j[1];if(F&&j[2]){if(oe===n&&!(X in r))return!1}else{var le=new sn;if(y)var he=y(oe,ie,X,r,i,le);if(!(he===n?rs(ie,oe,x|v,y,le):he))return!1}}return!0}function Jv(r){if(!Ke(r)||mR(r))return!1;var i=Yn(r)?Rk:wf;return i.test(jr(r))}function DM(r){return Qe(r)&&yt(r)==bn}function LM(r){return Qe(r)&&mt(r)==pt}function $M(r){return Qe(r)&&$l(r.length)&&!!Ye[yt(r)]}function ex(r){return typeof r=="function"?r:r==null?Tt:typeof r=="object"?Ae(r)?rx(r[0],r[1]):nx(r):_w(r)}function rd(r){if(!ss(r))return Hk(r);var i=[];for(var u in ze(r))He.call(r,u)&&u!="constructor"&&i.push(u);return i}function BM(r){if(!Ke(r))return wR(r);var i=ss(r),u=[];for(var y in r)y=="constructor"&&(i||!He.call(r,y))||u.push(y);return u}function od(r,i){return r<i}function tx(r,i){var u=-1,y=Ct(r)?ee(r.length):[];return hr(r,function(S,I,F){y[++u]=i(S,I,F)}),y}function nx(r){var i=xd(r);return i.length==1&&i[0][2]?Lx(i[0][0],i[0][1]):function(u){return u===r||nd(u,r,i)}}function rx(r,i){return bd(r)&&Dx(i)?Lx(Nn(r),i):function(u){var y=Pd(u,r);return y===n&&y===i?kd(u,r):rs(i,y,x|v)}}function bl(r,i,u,y,S){r!==i&&Qf(i,function(I,F){if(S||(S=new sn),Ke(I))FM(r,i,F,u,bl,y,S);else{var j=y?y(Sd(r,F),I,F+"",r,i,S):n;j===n&&(j=I),Kf(r,F,j)}},Nt)}function FM(r,i,u,y,S,I,F){var j=Sd(r,u),X=Sd(i,u),oe=F.get(X);if(oe){Kf(r,u,oe);return}var ie=I?I(j,X,u+"",r,i,F):n,le=ie===n;if(le){var he=Ae(X),we=!he&&yr(X),Ee=!he&&!we&&Bo(X);ie=X,he||we||Ee?Ae(j)?ie=j:et(j)?ie=Et(j):we?(le=!1,ie=gx(X,!0)):Ee?(le=!1,ie=mx(X,!0)):ie=[]:ls(X)||Ur(X)?(ie=j,Ur(j)?ie=dw(j):(!Ke(j)||Yn(j))&&(ie=Rx(X))):le=!1}le&&(F.set(X,ie),S(ie,X,y,I,F),F.delete(X)),Kf(r,u,ie)}function ox(r,i){var u=r.length;if(u)return i+=i<0?u:0,Gn(i,u)?r[i]:n}function ix(r,i,u){i.length?i=Xe(i,function(I){return Ae(I)?function(F){return Vr(F,I.length===1?I[0]:I)}:I}):i=[Tt];var y=-1;i=Xe(i,Lt(Se()));var S=tx(r,function(I,F,j){var X=Xe(i,function(oe){return oe(I)});return{criteria:X,index:++y,value:I}});return dk(S,function(I,F){return QM(I,F,u)})}function HM(r,i){return sx(r,i,function(u,y){return kd(r,y)})}function sx(r,i,u){for(var y=-1,S=i.length,I={};++y<S;){var F=i[y],j=Vr(r,F);u(j,F)&&os(I,gr(F,r),j)}return I}function zM(r){return function(i){return Vr(i,r)}}function id(r,i,u,y){var S=y?fk:To,I=-1,F=i.length,j=r;for(r===i&&(i=Et(i)),u&&(j=Xe(r,Lt(u)));++I<F;)for(var X=0,oe=i[I],ie=u?u(oe):oe;(X=S(j,ie,X,y))>-1;)j!==r&&fl.call(j,X,1),fl.call(r,X,1);return r}function ax(r,i){for(var u=r?i.length:0,y=u-1;u--;){var S=i[u];if(u==y||S!==I){var I=S;Gn(S)?fl.call(r,S,1):cd(r,S)}}return r}function sd(r,i){return r+pl(zv()*(i-r+1))}function VM(r,i,u,y){for(var S=-1,I=lt(hl((i-r)/(u||1)),0),F=ee(I);I--;)F[y?I:++S]=r,r+=u;return F}function ad(r,i){var u="";if(!r||i<1||i>P)return u;do i%2&&(u+=r),i=pl(i/2),i&&(r+=r);while(i);return u}function ke(r,i){return Ed($x(r,i,Tt),r+"")}function WM(r){return jv(Fo(r))}function jM(r,i){var u=Fo(r);return Pl(u,zr(i,0,u.length))}function os(r,i,u,y){if(!Ke(r))return r;i=gr(i,r);for(var S=-1,I=i.length,F=I-1,j=r;j!=null&&++S<I;){var X=Nn(i[S]),oe=u;if(X==="__proto__"||X==="constructor"||X==="prototype")return r;if(S!=F){var ie=j[X];oe=y?y(ie,X,j):n,oe===n&&(oe=Ke(ie)?ie:Gn(i[S+1])?[]:{})}es(j,X,oe),j=j[X]}return r}var lx=gl?function(r,i){return gl.set(r,i),r}:Tt,UM=dl?function(r,i){return dl(r,"toString",{configurable:!0,enumerable:!1,value:Rd(i),writable:!0})}:Tt;function GM(r){return Pl(Fo(r))}function Yt(r,i,u){var y=-1,S=r.length;i<0&&(i=-i>S?0:S+i),u=u>S?S:u,u<0&&(u+=S),S=i>u?0:u-i>>>0,i>>>=0;for(var I=ee(S);++y<S;)I[y]=r[y+i];return I}function YM(r,i){var u;return hr(r,function(y,S,I){return u=i(y,S,I),!u}),!!u}function _l(r,i,u){var y=0,S=r==null?y:r.length;if(typeof i=="number"&&i===i&&S<=re){for(;y<S;){var I=y+S>>>1,F=r[I];F!==null&&!Bt(F)&&(u?F<=i:F<i)?y=I+1:S=I}return S}return ld(r,i,Tt,u)}function ld(r,i,u,y){var S=0,I=r==null?0:r.length;if(I===0)return 0;i=u(i);for(var F=i!==i,j=i===null,X=Bt(i),oe=i===n;S<I;){var ie=pl((S+I)/2),le=u(r[ie]),he=le!==n,we=le===null,Ee=le===le,Oe=Bt(le);if(F)var Ce=y||Ee;else oe?Ce=Ee&&(y||he):j?Ce=Ee&&he&&(y||!we):X?Ce=Ee&&he&&!we&&(y||!Oe):we||Oe?Ce=!1:Ce=y?le<=i:le<i;Ce?S=ie+1:I=ie}return gt(I,J)}function cx(r,i){for(var u=-1,y=r.length,S=0,I=[];++u<y;){var F=r[u],j=i?i(F):F;if(!u||!an(j,X)){var X=j;I[S++]=F===0?0:F}}return I}function ux(r){return typeof r=="number"?r:Bt(r)?$:+r}function $t(r){if(typeof r=="string")return r;if(Ae(r))return Xe(r,$t)+"";if(Bt(r))return Vv?Vv.call(r):"";var i=r+"";return i=="0"&&1/r==-R?"-0":i}function pr(r,i,u){var y=-1,S=tl,I=r.length,F=!0,j=[],X=j;if(u)F=!1,S=$f;else if(I>=s){var oe=i?null:oR(r);if(oe)return rl(oe);F=!1,S=Xi,X=new Hr}else X=i?[]:j;e:for(;++y<I;){var ie=r[y],le=i?i(ie):ie;if(ie=u||ie!==0?ie:0,F&&le===le){for(var he=X.length;he--;)if(X[he]===le)continue e;i&&X.push(le),j.push(ie)}else S(X,le,u)||(X!==j&&X.push(le),j.push(ie))}return j}function cd(r,i){return i=gr(i,r),r=Bx(r,i),r==null||delete r[Nn(Xt(i))]}function fx(r,i,u,y){return os(r,i,u(Vr(r,i)),y)}function Sl(r,i,u,y){for(var S=r.length,I=y?S:-1;(y?I--:++I<S)&&i(r[I],I,r););return u?Yt(r,y?0:I,y?I+1:S):Yt(r,y?I+1:0,y?S:I)}function dx(r,i){var u=r;return u instanceof De&&(u=u.value()),Bf(i,function(y,S){return S.func.apply(S.thisArg,ur([y],S.args))},u)}function ud(r,i,u){var y=r.length;if(y<2)return y?pr(r[0]):[];for(var S=-1,I=ee(y);++S<y;)for(var F=r[S],j=-1;++j<y;)j!=S&&(I[S]=ts(I[S]||F,r[j],i,u));return pr(dt(I,1),i,u)}function hx(r,i,u){for(var y=-1,S=r.length,I=i.length,F={};++y<S;){var j=y<I?i[y]:n;u(F,r[y],j)}return F}function fd(r){return et(r)?r:[]}function dd(r){return typeof r=="function"?r:Tt}function gr(r,i){return Ae(r)?r:bd(r,i)?[r]:Vx(Fe(r))}var XM=ke;function mr(r,i,u){var y=r.length;return u=u===n?y:u,!i&&u>=y?r:Yt(r,i,u)}var px=Dk||function(r){return ft.clearTimeout(r)};function gx(r,i){if(i)return r.slice();var u=r.length,y=Lv?Lv(u):new r.constructor(u);return r.copy(y),y}function hd(r){var i=new r.constructor(r.byteLength);return new cl(i).set(new cl(r)),i}function qM(r,i){var u=i?hd(r.buffer):r.buffer;return new r.constructor(u,r.byteOffset,r.byteLength)}function KM(r){var i=new r.constructor(r.source,ji.exec(r));return i.lastIndex=r.lastIndex,i}function ZM(r){return Ji?ze(Ji.call(r)):{}}function mx(r,i){var u=i?hd(r.buffer):r.buffer;return new r.constructor(u,r.byteOffset,r.length)}function yx(r,i){if(r!==i){var u=r!==n,y=r===null,S=r===r,I=Bt(r),F=i!==n,j=i===null,X=i===i,oe=Bt(i);if(!j&&!oe&&!I&&r>i||I&&F&&X&&!j&&!oe||y&&F&&X||!u&&X||!S)return 1;if(!y&&!I&&!oe&&r<i||oe&&u&&S&&!y&&!I||j&&u&&S||!F&&S||!X)return-1}return 0}function QM(r,i,u){for(var y=-1,S=r.criteria,I=i.criteria,F=S.length,j=u.length;++y<F;){var X=yx(S[y],I[y]);if(X){if(y>=j)return X;var oe=u[y];return X*(oe=="desc"?-1:1)}}return r.index-i.index}function vx(r,i,u,y){for(var S=-1,I=r.length,F=u.length,j=-1,X=i.length,oe=lt(I-F,0),ie=ee(X+oe),le=!y;++j<X;)ie[j]=i[j];for(;++S<F;)(le||S<I)&&(ie[u[S]]=r[S]);for(;oe--;)ie[j++]=r[S++];return ie}function xx(r,i,u,y){for(var S=-1,I=r.length,F=-1,j=u.length,X=-1,oe=i.length,ie=lt(I-j,0),le=ee(ie+oe),he=!y;++S<ie;)le[S]=r[S];for(var we=S;++X<oe;)le[we+X]=i[X];for(;++F<j;)(he||S<I)&&(le[we+u[F]]=r[S++]);return le}function Et(r,i){var u=-1,y=r.length;for(i||(i=ee(y));++u<y;)i[u]=r[u];return i}function Cn(r,i,u,y){var S=!u;u||(u={});for(var I=-1,F=i.length;++I<F;){var j=i[I],X=y?y(u[j],r[j],j,u,r):n;X===n&&(X=r[j]),S?Wn(u,j,X):es(u,j,X)}return u}function JM(r,i){return Cn(r,wd(r),i)}function eR(r,i){return Cn(r,kx(r),i)}function El(r,i){return function(u,y){var S=Ae(u)?ik:_M,I=i?i():{};return S(u,r,Se(y,2),I)}}function Do(r){return ke(function(i,u){var y=-1,S=u.length,I=S>1?u[S-1]:n,F=S>2?u[2]:n;for(I=r.length>3&&typeof I=="function"?(S--,I):n,F&&vt(u[0],u[1],F)&&(I=S<3?n:I,S=1),i=ze(i);++y<S;){var j=u[y];j&&r(i,j,y,I)}return i})}function wx(r,i){return function(u,y){if(u==null)return u;if(!Ct(u))return r(u,y);for(var S=u.length,I=i?S:-1,F=ze(u);(i?I--:++I<S)&&y(F[I],I,F)!==!1;);return u}}function bx(r){return function(i,u,y){for(var S=-1,I=ze(i),F=y(i),j=F.length;j--;){var X=F[r?j:++S];if(u(I[X],X,I)===!1)break}return i}}function tR(r,i,u){var y=i&b,S=is(r);function I(){var F=this&&this!==ft&&this instanceof I?S:r;return F.apply(y?u:this,arguments)}return I}function _x(r){return function(i){i=Fe(i);var u=Ao(i)?on(i):n,y=u?u[0]:i.charAt(0),S=u?mr(u,1).join(""):i.slice(1);return y[r]()+S}}function Lo(r){return function(i){return Bf(ww(xw(i).replace(UP,"")),r,"")}}function is(r){return function(){var i=arguments;switch(i.length){case 0:return new r;case 1:return new r(i[0]);case 2:return new r(i[0],i[1]);case 3:return new r(i[0],i[1],i[2]);case 4:return new r(i[0],i[1],i[2],i[3]);case 5:return new r(i[0],i[1],i[2],i[3],i[4]);case 6:return new r(i[0],i[1],i[2],i[3],i[4],i[5]);case 7:return new r(i[0],i[1],i[2],i[3],i[4],i[5],i[6])}var u=Ro(r.prototype),y=r.apply(u,i);return Ke(y)?y:u}}function nR(r,i,u){var y=is(r);function S(){for(var I=arguments.length,F=ee(I),j=I,X=$o(S);j--;)F[j]=arguments[j];var oe=I<3&&F[0]!==X&&F[I-1]!==X?[]:fr(F,X);if(I-=oe.length,I<u)return Tx(r,i,Cl,S.placeholder,n,F,oe,n,n,u-I);var ie=this&&this!==ft&&this instanceof S?y:r;return Dt(ie,this,F)}return S}function Sx(r){return function(i,u,y){var S=ze(i);if(!Ct(i)){var I=Se(u,3);i=ct(i),u=function(j){return I(S[j],j,S)}}var F=r(i,u,y);return F>-1?S[I?i[F]:F]:n}}function Ex(r){return Un(function(i){var u=i.length,y=u,S=Ut.prototype.thru;for(r&&i.reverse();y--;){var I=i[y];if(typeof I!="function")throw new jt(l);if(S&&!F&&Il(I)=="wrapper")var F=new Ut([],!0)}for(y=F?y:u;++y<u;){I=i[y];var j=Il(I),X=j=="wrapper"?vd(I):n;X&&_d(X[0])&&X[1]==(M|w|O|D)&&!X[4].length&&X[9]==1?F=F[Il(X[0])].apply(F,X[3]):F=I.length==1&&_d(I)?F[j]():F.thru(I)}return function(){var oe=arguments,ie=oe[0];if(F&&oe.length==1&&Ae(ie))return F.plant(ie).value();for(var le=0,he=u?i[le].apply(this,oe):ie;++le<u;)he=i[le].call(this,he);return he}})}function Cl(r,i,u,y,S,I,F,j,X,oe){var ie=i&M,le=i&b,he=i&_,we=i&(w|E),Ee=i&V,Oe=he?n:is(r);function Ce(){for(var Me=arguments.length,$e=ee(Me),Ft=Me;Ft--;)$e[Ft]=arguments[Ft];if(we)var xt=$o(Ce),Ht=pk($e,xt);if(y&&($e=vx($e,y,S,we)),I&&($e=xx($e,I,F,we)),Me-=Ht,we&&Me<oe){var tt=fr($e,xt);return Tx(r,i,Cl,Ce.placeholder,u,$e,tt,j,X,oe-Me)}var ln=le?u:this,qn=he?ln[r]:r;return Me=$e.length,j?$e=_R($e,j):Ee&&Me>1&&$e.reverse(),ie&&X<Me&&($e.length=X),this&&this!==ft&&this instanceof Ce&&(qn=Oe||is(qn)),qn.apply(ln,$e)}return Ce}function Cx(r,i){return function(u,y){return OM(u,r,i(y),{})}}function Nl(r,i){return function(u,y){var S;if(u===n&&y===n)return i;if(u!==n&&(S=u),y!==n){if(S===n)return y;typeof u=="string"||typeof y=="string"?(u=$t(u),y=$t(y)):(u=ux(u),y=ux(y)),S=r(u,y)}return S}}function pd(r){return Un(function(i){return i=Xe(i,Lt(Se())),ke(function(u){var y=this;return r(i,function(S){return Dt(S,y,u)})})})}function Tl(r,i){i=i===n?" ":$t(i);var u=i.length;if(u<2)return u?ad(i,r):i;var y=ad(i,hl(r/Io(i)));return Ao(i)?mr(on(y),0,r).join(""):y.slice(0,r)}function rR(r,i,u,y){var S=i&b,I=is(r);function F(){for(var j=-1,X=arguments.length,oe=-1,ie=y.length,le=ee(ie+X),he=this&&this!==ft&&this instanceof F?I:r;++oe<ie;)le[oe]=y[oe];for(;X--;)le[oe++]=arguments[++j];return Dt(he,S?u:this,le)}return F}function Nx(r){return function(i,u,y){return y&&typeof y!="number"&&vt(i,u,y)&&(u=y=n),i=Xn(i),u===n?(u=i,i=0):u=Xn(u),y=y===n?i<u?1:-1:Xn(y),VM(i,u,y,r)}}function Al(r){return function(i,u){return typeof i=="string"&&typeof u=="string"||(i=qt(i),u=qt(u)),r(i,u)}}function Tx(r,i,u,y,S,I,F,j,X,oe){var ie=i&w,le=ie?F:n,he=ie?n:F,we=ie?I:n,Ee=ie?n:I;i|=ie?O:k,i&=~(ie?k:O),i&N||(i&=-4);var Oe=[r,i,S,we,le,Ee,he,j,X,oe],Ce=u.apply(n,Oe);return _d(r)&&Fx(Ce,Oe),Ce.placeholder=y,Hx(Ce,r,i)}function gd(r){var i=at[r];return function(u,y){if(u=qt(u),y=y==null?0:gt(Ie(y),292),y&&Hv(u)){var S=(Fe(u)+"e").split("e"),I=i(S[0]+"e"+(+S[1]+y));return S=(Fe(I)+"e").split("e"),+(S[0]+"e"+(+S[1]-y))}return i(u)}}var oR=ko&&1/rl(new ko([,-0]))[1]==R?function(r){return new ko(r)}:$d;function Ax(r){return function(i){var u=mt(i);return u==ye?Uf(i):u==pt?bk(i):hk(i,r(i))}}function jn(r,i,u,y,S,I,F,j){var X=i&_;if(!X&&typeof r!="function")throw new jt(l);var oe=y?y.length:0;if(oe||(i&=-97,y=S=n),F=F===n?F:lt(Ie(F),0),j=j===n?j:Ie(j),oe-=S?S.length:0,i&k){var ie=y,le=S;y=S=n}var he=X?n:vd(r),we=[r,i,u,y,S,ie,le,I,F,j];if(he&&xR(we,he),r=we[0],i=we[1],u=we[2],y=we[3],S=we[4],j=we[9]=we[9]===n?X?0:r.length:lt(we[9]-oe,0),!j&&i&(w|E)&&(i&=-25),!i||i==b)var Ee=tR(r,i,u);else i==w||i==E?Ee=nR(r,i,j):(i==O||i==(b|O))&&!S.length?Ee=rR(r,i,u,y):Ee=Cl.apply(n,we);var Oe=he?lx:Fx;return Hx(Oe(Ee,we),r,i)}function Ix(r,i,u,y){return r===n||an(r,Po[u])&&!He.call(y,u)?i:r}function Ox(r,i,u,y,S,I){return Ke(r)&&Ke(i)&&(I.set(i,r),bl(r,i,n,Ox,I),I.delete(i)),r}function iR(r){return ls(r)?n:r}function Px(r,i,u,y,S,I){var F=u&x,j=r.length,X=i.length;if(j!=X&&!(F&&X>j))return!1;var oe=I.get(r),ie=I.get(i);if(oe&&ie)return oe==i&&ie==r;var le=-1,he=!0,we=u&v?new Hr:n;for(I.set(r,i),I.set(i,r);++le<j;){var Ee=r[le],Oe=i[le];if(y)var Ce=F?y(Oe,Ee,le,i,r,I):y(Ee,Oe,le,r,i,I);if(Ce!==n){if(Ce)continue;he=!1;break}if(we){if(!Ff(i,function(Me,$e){if(!Xi(we,$e)&&(Ee===Me||S(Ee,Me,u,y,I)))return we.push($e)})){he=!1;break}}else if(!(Ee===Oe||S(Ee,Oe,u,y,I))){he=!1;break}}return I.delete(r),I.delete(i),he}function sR(r,i,u,y,S,I,F){switch(u){case Hn:if(r.byteLength!=i.byteLength||r.byteOffset!=i.byteOffset)return!1;r=r.buffer,i=i.buffer;case rn:return!(r.byteLength!=i.byteLength||!I(new cl(r),new cl(i)));case Q:case ae:case Le:return an(+r,+i);case de:return r.name==i.name&&r.message==i.message;case bn:case nn:return r==i+"";case ye:var j=Uf;case pt:var X=y&x;if(j||(j=rl),r.size!=i.size&&!X)return!1;var oe=F.get(r);if(oe)return oe==i;y|=v,F.set(r,i);var ie=Px(j(r),j(i),y,S,I,F);return F.delete(r),ie;case _n:if(Ji)return Ji.call(r)==Ji.call(i)}return!1}function aR(r,i,u,y,S,I){var F=u&x,j=md(r),X=j.length,oe=md(i),ie=oe.length;if(X!=ie&&!F)return!1;for(var le=X;le--;){var he=j[le];if(!(F?he in i:He.call(i,he)))return!1}var we=I.get(r),Ee=I.get(i);if(we&&Ee)return we==i&&Ee==r;var Oe=!0;I.set(r,i),I.set(i,r);for(var Ce=F;++le<X;){he=j[le];var Me=r[he],$e=i[he];if(y)var Ft=F?y($e,Me,he,i,r,I):y(Me,$e,he,r,i,I);if(!(Ft===n?Me===$e||S(Me,$e,u,y,I):Ft)){Oe=!1;break}Ce||(Ce=he=="constructor")}if(Oe&&!Ce){var xt=r.constructor,Ht=i.constructor;xt!=Ht&&"constructor"in r&&"constructor"in i&&!(typeof xt=="function"&&xt instanceof xt&&typeof Ht=="function"&&Ht instanceof Ht)&&(Oe=!1)}return I.delete(r),I.delete(i),Oe}function Un(r){return Ed($x(r,n,Gx),r+"")}function md(r){return Zv(r,ct,wd)}function yd(r){return Zv(r,Nt,kx)}var vd=gl?function(r){return gl.get(r)}:$d;function Il(r){for(var i=r.name+"",u=Mo[i],y=He.call(Mo,i)?u.length:0;y--;){var S=u[y],I=S.func;if(I==null||I==r)return S.name}return i}function $o(r){var i=He.call(A,"placeholder")?A:r;return i.placeholder}function Se(){var r=A.iteratee||Dd;return r=r===Dd?ex:r,arguments.length?r(arguments[0],arguments[1]):r}function Ol(r,i){var u=r.__data__;return gR(i)?u[typeof i=="string"?"string":"hash"]:u.map}function xd(r){for(var i=ct(r),u=i.length;u--;){var y=i[u],S=r[y];i[u]=[y,S,Dx(S)]}return i}function Wr(r,i){var u=vk(r,i);return Jv(u)?u:n}function lR(r){var i=He.call(r,Br),u=r[Br];try{r[Br]=n;var y=!0}catch{}var S=al.call(r);return y&&(i?r[Br]=u:delete r[Br]),S}var wd=Yf?function(r){return r==null?[]:(r=ze(r),cr(Yf(r),function(i){return Bv.call(r,i)}))}:Bd,kx=Yf?function(r){for(var i=[];r;)ur(i,wd(r)),r=ul(r);return i}:Bd,mt=yt;(Xf&&mt(new Xf(new ArrayBuffer(1)))!=Hn||Ki&&mt(new Ki)!=ye||qf&&mt(qf.resolve())!=Fn||ko&&mt(new ko)!=pt||Zi&&mt(new Zi)!=Sn)&&(mt=function(r){var i=yt(r),u=i==Ge?r.constructor:n,y=u?jr(u):"";if(y)switch(y){case jk:return Hn;case Uk:return ye;case Gk:return Fn;case Yk:return pt;case Xk:return Sn}return i});function cR(r,i,u){for(var y=-1,S=u.length;++y<S;){var I=u[y],F=I.size;switch(I.type){case"drop":r+=F;break;case"dropRight":i-=F;break;case"take":i=gt(i,r+F);break;case"takeRight":r=lt(r,i-F);break}}return{start:r,end:i}}function uR(r){var i=r.match(pf);return i?i[1].split(gf):[]}function Mx(r,i,u){i=gr(i,r);for(var y=-1,S=i.length,I=!1;++y<S;){var F=Nn(i[y]);if(!(I=r!=null&&u(r,F)))break;r=r[F]}return I||++y!=S?I:(S=r==null?0:r.length,!!S&&$l(S)&&Gn(F,S)&&(Ae(r)||Ur(r)))}function fR(r){var i=r.length,u=new r.constructor(i);return i&&typeof r[0]=="string"&&He.call(r,"index")&&(u.index=r.index,u.input=r.input),u}function Rx(r){return typeof r.constructor=="function"&&!ss(r)?Ro(ul(r)):{}}function dR(r,i,u){var y=r.constructor;switch(i){case rn:return hd(r);case Q:case ae:return new y(+r);case Hn:return qM(r,u);case Ri:case Lr:case Di:case Li:case $i:case Bi:case Fi:case Hi:case zi:return mx(r,u);case ye:return new y;case Le:case nn:return new y(r);case bn:return KM(r);case pt:return new y;case _n:return ZM(r)}}function hR(r,i){var u=i.length;if(!u)return r;var y=u-1;return i[y]=(u>1?"& ":"")+i[y],i=i.join(u>2?", ":" "),r.replace(hf,`{
68
- /* [wrapped with `+i+`] */
69
- `)}function pR(r){return Ae(r)||Ur(r)||!!(Fv&&r&&r[Fv])}function Gn(r,i){var u=typeof r;return i=i??P,!!i&&(u=="number"||u!="symbol"&&_f.test(r))&&r>-1&&r%1==0&&r<i}function vt(r,i,u){if(!Ke(u))return!1;var y=typeof i;return(y=="number"?Ct(u)&&Gn(i,u.length):y=="string"&&i in u)?an(u[i],r):!1}function bd(r,i){if(Ae(r))return!1;var u=typeof r;return u=="number"||u=="symbol"||u=="boolean"||r==null||Bt(r)?!0:cf.test(r)||!lf.test(r)||i!=null&&r in ze(i)}function gR(r){var i=typeof r;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?r!=="__proto__":r===null}function _d(r){var i=Il(r),u=A[i];if(typeof u!="function"||!(i in De.prototype))return!1;if(r===u)return!0;var y=vd(u);return!!y&&r===y[0]}function mR(r){return!!Dv&&Dv in r}var yR=il?Yn:Fd;function ss(r){var i=r&&r.constructor,u=typeof i=="function"&&i.prototype||Po;return r===u}function Dx(r){return r===r&&!Ke(r)}function Lx(r,i){return function(u){return u==null?!1:u[r]===i&&(i!==n||r in ze(u))}}function vR(r){var i=Dl(r,function(y){return u.size===d&&u.clear(),y}),u=i.cache;return i}function xR(r,i){var u=r[1],y=i[1],S=u|y,I=S<(b|_|M),F=y==M&&u==w||y==M&&u==D&&r[7].length<=i[8]||y==(M|D)&&i[7].length<=i[8]&&u==w;if(!(I||F))return r;y&b&&(r[2]=i[2],S|=u&b?0:N);var j=i[3];if(j){var X=r[3];r[3]=X?vx(X,j,i[4]):j,r[4]=X?fr(r[3],h):i[4]}return j=i[5],j&&(X=r[5],r[5]=X?xx(X,j,i[6]):j,r[6]=X?fr(r[5],h):i[6]),j=i[7],j&&(r[7]=j),y&M&&(r[8]=r[8]==null?i[8]:gt(r[8],i[8])),r[9]==null&&(r[9]=i[9]),r[0]=i[0],r[1]=S,r}function wR(r){var i=[];if(r!=null)for(var u in ze(r))i.push(u);return i}function bR(r){return al.call(r)}function $x(r,i,u){return i=lt(i===n?r.length-1:i,0),function(){for(var y=arguments,S=-1,I=lt(y.length-i,0),F=ee(I);++S<I;)F[S]=y[i+S];S=-1;for(var j=ee(i+1);++S<i;)j[S]=y[S];return j[i]=u(F),Dt(r,this,j)}}function Bx(r,i){return i.length<2?r:Vr(r,Yt(i,0,-1))}function _R(r,i){for(var u=r.length,y=gt(i.length,u),S=Et(r);y--;){var I=i[y];r[y]=Gn(I,u)?S[I]:n}return r}function Sd(r,i){if(!(i==="constructor"&&typeof r[i]=="function")&&i!="__proto__")return r[i]}var Fx=zx(lx),as=$k||function(r,i){return ft.setTimeout(r,i)},Ed=zx(UM);function Hx(r,i,u){var y=i+"";return Ed(r,hR(y,SR(uR(y),u)))}function zx(r){var i=0,u=0;return function(){var y=zk(),S=q-(y-u);if(u=y,S>0){if(++i>=U)return arguments[0]}else i=0;return r.apply(n,arguments)}}function Pl(r,i){var u=-1,y=r.length,S=y-1;for(i=i===n?y:i;++u<i;){var I=sd(u,S),F=r[I];r[I]=r[u],r[u]=F}return r.length=i,r}var Vx=vR(function(r){var i=[];return r.charCodeAt(0)===46&&i.push(""),r.replace(uf,function(u,y,S,I){i.push(S?I.replace(vf,"$1"):y||u)}),i});function Nn(r){if(typeof r=="string"||Bt(r))return r;var i=r+"";return i=="0"&&1/r==-R?"-0":i}function jr(r){if(r!=null){try{return sl.call(r)}catch{}try{return r+""}catch{}}return""}function SR(r,i){return Wt(se,function(u){var y="_."+u[0];i&u[1]&&!tl(r,y)&&r.push(y)}),r.sort()}function Wx(r){if(r instanceof De)return r.clone();var i=new Ut(r.__wrapped__,r.__chain__);return i.__actions__=Et(r.__actions__),i.__index__=r.__index__,i.__values__=r.__values__,i}function ER(r,i,u){(u?vt(r,i,u):i===n)?i=1:i=lt(Ie(i),0);var y=r==null?0:r.length;if(!y||i<1)return[];for(var S=0,I=0,F=ee(hl(y/i));S<y;)F[I++]=Yt(r,S,S+=i);return F}function CR(r){for(var i=-1,u=r==null?0:r.length,y=0,S=[];++i<u;){var I=r[i];I&&(S[y++]=I)}return S}function NR(){var r=arguments.length;if(!r)return[];for(var i=ee(r-1),u=arguments[0],y=r;y--;)i[y-1]=arguments[y];return ur(Ae(u)?Et(u):[u],dt(i,1))}var TR=ke(function(r,i){return et(r)?ts(r,dt(i,1,et,!0)):[]}),AR=ke(function(r,i){var u=Xt(i);return et(u)&&(u=n),et(r)?ts(r,dt(i,1,et,!0),Se(u,2)):[]}),IR=ke(function(r,i){var u=Xt(i);return et(u)&&(u=n),et(r)?ts(r,dt(i,1,et,!0),n,u):[]});function OR(r,i,u){var y=r==null?0:r.length;return y?(i=u||i===n?1:Ie(i),Yt(r,i<0?0:i,y)):[]}function PR(r,i,u){var y=r==null?0:r.length;return y?(i=u||i===n?1:Ie(i),i=y-i,Yt(r,0,i<0?0:i)):[]}function kR(r,i){return r&&r.length?Sl(r,Se(i,3),!0,!0):[]}function MR(r,i){return r&&r.length?Sl(r,Se(i,3),!0):[]}function RR(r,i,u,y){var S=r==null?0:r.length;return S?(u&&typeof u!="number"&&vt(r,i,u)&&(u=0,y=S),NM(r,i,u,y)):[]}function jx(r,i,u){var y=r==null?0:r.length;if(!y)return-1;var S=u==null?0:Ie(u);return S<0&&(S=lt(y+S,0)),nl(r,Se(i,3),S)}function Ux(r,i,u){var y=r==null?0:r.length;if(!y)return-1;var S=y-1;return u!==n&&(S=Ie(u),S=u<0?lt(y+S,0):gt(S,y-1)),nl(r,Se(i,3),S,!0)}function Gx(r){var i=r==null?0:r.length;return i?dt(r,1):[]}function DR(r){var i=r==null?0:r.length;return i?dt(r,R):[]}function LR(r,i){var u=r==null?0:r.length;return u?(i=i===n?1:Ie(i),dt(r,i)):[]}function $R(r){for(var i=-1,u=r==null?0:r.length,y={};++i<u;){var S=r[i];y[S[0]]=S[1]}return y}function Yx(r){return r&&r.length?r[0]:n}function BR(r,i,u){var y=r==null?0:r.length;if(!y)return-1;var S=u==null?0:Ie(u);return S<0&&(S=lt(y+S,0)),To(r,i,S)}function FR(r){var i=r==null?0:r.length;return i?Yt(r,0,-1):[]}var HR=ke(function(r){var i=Xe(r,fd);return i.length&&i[0]===r[0]?td(i):[]}),zR=ke(function(r){var i=Xt(r),u=Xe(r,fd);return i===Xt(u)?i=n:u.pop(),u.length&&u[0]===r[0]?td(u,Se(i,2)):[]}),VR=ke(function(r){var i=Xt(r),u=Xe(r,fd);return i=typeof i=="function"?i:n,i&&u.pop(),u.length&&u[0]===r[0]?td(u,n,i):[]});function WR(r,i){return r==null?"":Fk.call(r,i)}function Xt(r){var i=r==null?0:r.length;return i?r[i-1]:n}function jR(r,i,u){var y=r==null?0:r.length;if(!y)return-1;var S=y;return u!==n&&(S=Ie(u),S=S<0?lt(y+S,0):gt(S,y-1)),i===i?Sk(r,i,S):nl(r,Tv,S,!0)}function UR(r,i){return r&&r.length?ox(r,Ie(i)):n}var GR=ke(Xx);function Xx(r,i){return r&&r.length&&i&&i.length?id(r,i):r}function YR(r,i,u){return r&&r.length&&i&&i.length?id(r,i,Se(u,2)):r}function XR(r,i,u){return r&&r.length&&i&&i.length?id(r,i,n,u):r}var qR=Un(function(r,i){var u=r==null?0:r.length,y=Zf(r,i);return ax(r,Xe(i,function(S){return Gn(S,u)?+S:S}).sort(yx)),y});function KR(r,i){var u=[];if(!(r&&r.length))return u;var y=-1,S=[],I=r.length;for(i=Se(i,3);++y<I;){var F=r[y];i(F,y,r)&&(u.push(F),S.push(y))}return ax(r,S),u}function Cd(r){return r==null?r:Wk.call(r)}function ZR(r,i,u){var y=r==null?0:r.length;return y?(u&&typeof u!="number"&&vt(r,i,u)?(i=0,u=y):(i=i==null?0:Ie(i),u=u===n?y:Ie(u)),Yt(r,i,u)):[]}function QR(r,i){return _l(r,i)}function JR(r,i,u){return ld(r,i,Se(u,2))}function eD(r,i){var u=r==null?0:r.length;if(u){var y=_l(r,i);if(y<u&&an(r[y],i))return y}return-1}function tD(r,i){return _l(r,i,!0)}function nD(r,i,u){return ld(r,i,Se(u,2),!0)}function rD(r,i){var u=r==null?0:r.length;if(u){var y=_l(r,i,!0)-1;if(an(r[y],i))return y}return-1}function oD(r){return r&&r.length?cx(r):[]}function iD(r,i){return r&&r.length?cx(r,Se(i,2)):[]}function sD(r){var i=r==null?0:r.length;return i?Yt(r,1,i):[]}function aD(r,i,u){return r&&r.length?(i=u||i===n?1:Ie(i),Yt(r,0,i<0?0:i)):[]}function lD(r,i,u){var y=r==null?0:r.length;return y?(i=u||i===n?1:Ie(i),i=y-i,Yt(r,i<0?0:i,y)):[]}function cD(r,i){return r&&r.length?Sl(r,Se(i,3),!1,!0):[]}function uD(r,i){return r&&r.length?Sl(r,Se(i,3)):[]}var fD=ke(function(r){return pr(dt(r,1,et,!0))}),dD=ke(function(r){var i=Xt(r);return et(i)&&(i=n),pr(dt(r,1,et,!0),Se(i,2))}),hD=ke(function(r){var i=Xt(r);return i=typeof i=="function"?i:n,pr(dt(r,1,et,!0),n,i)});function pD(r){return r&&r.length?pr(r):[]}function gD(r,i){return r&&r.length?pr(r,Se(i,2)):[]}function mD(r,i){return i=typeof i=="function"?i:n,r&&r.length?pr(r,n,i):[]}function Nd(r){if(!(r&&r.length))return[];var i=0;return r=cr(r,function(u){if(et(u))return i=lt(u.length,i),!0}),Wf(i,function(u){return Xe(r,Hf(u))})}function qx(r,i){if(!(r&&r.length))return[];var u=Nd(r);return i==null?u:Xe(u,function(y){return Dt(i,n,y)})}var yD=ke(function(r,i){return et(r)?ts(r,i):[]}),vD=ke(function(r){return ud(cr(r,et))}),xD=ke(function(r){var i=Xt(r);return et(i)&&(i=n),ud(cr(r,et),Se(i,2))}),wD=ke(function(r){var i=Xt(r);return i=typeof i=="function"?i:n,ud(cr(r,et),n,i)}),bD=ke(Nd);function _D(r,i){return hx(r||[],i||[],es)}function SD(r,i){return hx(r||[],i||[],os)}var ED=ke(function(r){var i=r.length,u=i>1?r[i-1]:n;return u=typeof u=="function"?(r.pop(),u):n,qx(r,u)});function Kx(r){var i=A(r);return i.__chain__=!0,i}function CD(r,i){return i(r),r}function kl(r,i){return i(r)}var ND=Un(function(r){var i=r.length,u=i?r[0]:0,y=this.__wrapped__,S=function(I){return Zf(I,r)};return i>1||this.__actions__.length||!(y instanceof De)||!Gn(u)?this.thru(S):(y=y.slice(u,+u+(i?1:0)),y.__actions__.push({func:kl,args:[S],thisArg:n}),new Ut(y,this.__chain__).thru(function(I){return i&&!I.length&&I.push(n),I}))});function TD(){return Kx(this)}function AD(){return new Ut(this.value(),this.__chain__)}function ID(){this.__values__===n&&(this.__values__=uw(this.value()));var r=this.__index__>=this.__values__.length,i=r?n:this.__values__[this.__index__++];return{done:r,value:i}}function OD(){return this}function PD(r){for(var i,u=this;u instanceof yl;){var y=Wx(u);y.__index__=0,y.__values__=n,i?S.__wrapped__=y:i=y;var S=y;u=u.__wrapped__}return S.__wrapped__=r,i}function kD(){var r=this.__wrapped__;if(r instanceof De){var i=r;return this.__actions__.length&&(i=new De(this)),i=i.reverse(),i.__actions__.push({func:kl,args:[Cd],thisArg:n}),new Ut(i,this.__chain__)}return this.thru(Cd)}function MD(){return dx(this.__wrapped__,this.__actions__)}var RD=El(function(r,i,u){He.call(r,u)?++r[u]:Wn(r,u,1)});function DD(r,i,u){var y=Ae(r)?Cv:CM;return u&&vt(r,i,u)&&(i=n),y(r,Se(i,3))}function LD(r,i){var u=Ae(r)?cr:qv;return u(r,Se(i,3))}var $D=Sx(jx),BD=Sx(Ux);function FD(r,i){return dt(Ml(r,i),1)}function HD(r,i){return dt(Ml(r,i),R)}function zD(r,i,u){return u=u===n?1:Ie(u),dt(Ml(r,i),u)}function Zx(r,i){var u=Ae(r)?Wt:hr;return u(r,Se(i,3))}function Qx(r,i){var u=Ae(r)?sk:Xv;return u(r,Se(i,3))}var VD=El(function(r,i,u){He.call(r,u)?r[u].push(i):Wn(r,u,[i])});function WD(r,i,u,y){r=Ct(r)?r:Fo(r),u=u&&!y?Ie(u):0;var S=r.length;return u<0&&(u=lt(S+u,0)),Bl(r)?u<=S&&r.indexOf(i,u)>-1:!!S&&To(r,i,u)>-1}var jD=ke(function(r,i,u){var y=-1,S=typeof i=="function",I=Ct(r)?ee(r.length):[];return hr(r,function(F){I[++y]=S?Dt(i,F,u):ns(F,i,u)}),I}),UD=El(function(r,i,u){Wn(r,u,i)});function Ml(r,i){var u=Ae(r)?Xe:tx;return u(r,Se(i,3))}function GD(r,i,u,y){return r==null?[]:(Ae(i)||(i=i==null?[]:[i]),u=y?n:u,Ae(u)||(u=u==null?[]:[u]),ix(r,i,u))}var YD=El(function(r,i,u){r[u?0:1].push(i)},function(){return[[],[]]});function XD(r,i,u){var y=Ae(r)?Bf:Iv,S=arguments.length<3;return y(r,Se(i,4),u,S,hr)}function qD(r,i,u){var y=Ae(r)?ak:Iv,S=arguments.length<3;return y(r,Se(i,4),u,S,Xv)}function KD(r,i){var u=Ae(r)?cr:qv;return u(r,Ll(Se(i,3)))}function ZD(r){var i=Ae(r)?jv:WM;return i(r)}function QD(r,i,u){(u?vt(r,i,u):i===n)?i=1:i=Ie(i);var y=Ae(r)?wM:jM;return y(r,i)}function JD(r){var i=Ae(r)?bM:GM;return i(r)}function e2(r){if(r==null)return 0;if(Ct(r))return Bl(r)?Io(r):r.length;var i=mt(r);return i==ye||i==pt?r.size:rd(r).length}function t2(r,i,u){var y=Ae(r)?Ff:YM;return u&&vt(r,i,u)&&(i=n),y(r,Se(i,3))}var n2=ke(function(r,i){if(r==null)return[];var u=i.length;return u>1&&vt(r,i[0],i[1])?i=[]:u>2&&vt(i[0],i[1],i[2])&&(i=[i[0]]),ix(r,dt(i,1),[])}),Rl=Lk||function(){return ft.Date.now()};function r2(r,i){if(typeof i!="function")throw new jt(l);return r=Ie(r),function(){if(--r<1)return i.apply(this,arguments)}}function Jx(r,i,u){return i=u?n:i,i=r&&i==null?r.length:i,jn(r,M,n,n,n,n,i)}function ew(r,i){var u;if(typeof i!="function")throw new jt(l);return r=Ie(r),function(){return--r>0&&(u=i.apply(this,arguments)),r<=1&&(i=n),u}}var Td=ke(function(r,i,u){var y=b;if(u.length){var S=fr(u,$o(Td));y|=O}return jn(r,y,i,u,S)}),tw=ke(function(r,i,u){var y=b|_;if(u.length){var S=fr(u,$o(tw));y|=O}return jn(i,y,r,u,S)});function nw(r,i,u){i=u?n:i;var y=jn(r,w,n,n,n,n,n,i);return y.placeholder=nw.placeholder,y}function rw(r,i,u){i=u?n:i;var y=jn(r,E,n,n,n,n,n,i);return y.placeholder=rw.placeholder,y}function ow(r,i,u){var y,S,I,F,j,X,oe=0,ie=!1,le=!1,he=!0;if(typeof r!="function")throw new jt(l);i=qt(i)||0,Ke(u)&&(ie=!!u.leading,le="maxWait"in u,I=le?lt(qt(u.maxWait)||0,i):I,he="trailing"in u?!!u.trailing:he);function we(tt){var ln=y,qn=S;return y=S=n,oe=tt,F=r.apply(qn,ln),F}function Ee(tt){return oe=tt,j=as(Me,i),ie?we(tt):F}function Oe(tt){var ln=tt-X,qn=tt-oe,Sw=i-ln;return le?gt(Sw,I-qn):Sw}function Ce(tt){var ln=tt-X,qn=tt-oe;return X===n||ln>=i||ln<0||le&&qn>=I}function Me(){var tt=Rl();if(Ce(tt))return $e(tt);j=as(Me,Oe(tt))}function $e(tt){return j=n,he&&y?we(tt):(y=S=n,F)}function Ft(){j!==n&&px(j),oe=0,y=X=S=j=n}function xt(){return j===n?F:$e(Rl())}function Ht(){var tt=Rl(),ln=Ce(tt);if(y=arguments,S=this,X=tt,ln){if(j===n)return Ee(X);if(le)return px(j),j=as(Me,i),we(X)}return j===n&&(j=as(Me,i)),F}return Ht.cancel=Ft,Ht.flush=xt,Ht}var o2=ke(function(r,i){return Yv(r,1,i)}),i2=ke(function(r,i,u){return Yv(r,qt(i)||0,u)});function s2(r){return jn(r,V)}function Dl(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new jt(l);var u=function(){var y=arguments,S=i?i.apply(this,y):y[0],I=u.cache;if(I.has(S))return I.get(S);var F=r.apply(this,y);return u.cache=I.set(S,F)||I,F};return u.cache=new(Dl.Cache||Vn),u}Dl.Cache=Vn;function Ll(r){if(typeof r!="function")throw new jt(l);return function(){var i=arguments;switch(i.length){case 0:return!r.call(this);case 1:return!r.call(this,i[0]);case 2:return!r.call(this,i[0],i[1]);case 3:return!r.call(this,i[0],i[1],i[2])}return!r.apply(this,i)}}function a2(r){return ew(2,r)}var l2=XM(function(r,i){i=i.length==1&&Ae(i[0])?Xe(i[0],Lt(Se())):Xe(dt(i,1),Lt(Se()));var u=i.length;return ke(function(y){for(var S=-1,I=gt(y.length,u);++S<I;)y[S]=i[S].call(this,y[S]);return Dt(r,this,y)})}),Ad=ke(function(r,i){var u=fr(i,$o(Ad));return jn(r,O,n,i,u)}),iw=ke(function(r,i){var u=fr(i,$o(iw));return jn(r,k,n,i,u)}),c2=Un(function(r,i){return jn(r,D,n,n,n,i)});function u2(r,i){if(typeof r!="function")throw new jt(l);return i=i===n?i:Ie(i),ke(r,i)}function f2(r,i){if(typeof r!="function")throw new jt(l);return i=i==null?0:lt(Ie(i),0),ke(function(u){var y=u[i],S=mr(u,0,i);return y&&ur(S,y),Dt(r,this,S)})}function d2(r,i,u){var y=!0,S=!0;if(typeof r!="function")throw new jt(l);return Ke(u)&&(y="leading"in u?!!u.leading:y,S="trailing"in u?!!u.trailing:S),ow(r,i,{leading:y,maxWait:i,trailing:S})}function h2(r){return Jx(r,1)}function p2(r,i){return Ad(dd(i),r)}function g2(){if(!arguments.length)return[];var r=arguments[0];return Ae(r)?r:[r]}function m2(r){return Gt(r,m)}function y2(r,i){return i=typeof i=="function"?i:n,Gt(r,m,i)}function v2(r){return Gt(r,g|m)}function x2(r,i){return i=typeof i=="function"?i:n,Gt(r,g|m,i)}function w2(r,i){return i==null||Gv(r,i,ct(i))}function an(r,i){return r===i||r!==r&&i!==i}var b2=Al(ed),_2=Al(function(r,i){return r>=i}),Ur=Qv(function(){return arguments}())?Qv:function(r){return Qe(r)&&He.call(r,"callee")&&!Bv.call(r,"callee")},Ae=ee.isArray,S2=xv?Lt(xv):PM;function Ct(r){return r!=null&&$l(r.length)&&!Yn(r)}function et(r){return Qe(r)&&Ct(r)}function E2(r){return r===!0||r===!1||Qe(r)&&yt(r)==Q}var yr=Bk||Fd,C2=wv?Lt(wv):kM;function N2(r){return Qe(r)&&r.nodeType===1&&!ls(r)}function T2(r){if(r==null)return!0;if(Ct(r)&&(Ae(r)||typeof r=="string"||typeof r.splice=="function"||yr(r)||Bo(r)||Ur(r)))return!r.length;var i=mt(r);if(i==ye||i==pt)return!r.size;if(ss(r))return!rd(r).length;for(var u in r)if(He.call(r,u))return!1;return!0}function A2(r,i){return rs(r,i)}function I2(r,i,u){u=typeof u=="function"?u:n;var y=u?u(r,i):n;return y===n?rs(r,i,n,u):!!y}function Id(r){if(!Qe(r))return!1;var i=yt(r);return i==de||i==fe||typeof r.message=="string"&&typeof r.name=="string"&&!ls(r)}function O2(r){return typeof r=="number"&&Hv(r)}function Yn(r){if(!Ke(r))return!1;var i=yt(r);return i==ue||i==_e||i==te||i==bo}function sw(r){return typeof r=="number"&&r==Ie(r)}function $l(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=P}function Ke(r){var i=typeof r;return r!=null&&(i=="object"||i=="function")}function Qe(r){return r!=null&&typeof r=="object"}var aw=bv?Lt(bv):RM;function P2(r,i){return r===i||nd(r,i,xd(i))}function k2(r,i,u){return u=typeof u=="function"?u:n,nd(r,i,xd(i),u)}function M2(r){return lw(r)&&r!=+r}function R2(r){if(yR(r))throw new Te(a);return Jv(r)}function D2(r){return r===null}function L2(r){return r==null}function lw(r){return typeof r=="number"||Qe(r)&&yt(r)==Le}function ls(r){if(!Qe(r)||yt(r)!=Ge)return!1;var i=ul(r);if(i===null)return!0;var u=He.call(i,"constructor")&&i.constructor;return typeof u=="function"&&u instanceof u&&sl.call(u)==kk}var Od=_v?Lt(_v):DM;function $2(r){return sw(r)&&r>=-P&&r<=P}var cw=Sv?Lt(Sv):LM;function Bl(r){return typeof r=="string"||!Ae(r)&&Qe(r)&&yt(r)==nn}function Bt(r){return typeof r=="symbol"||Qe(r)&&yt(r)==_n}var Bo=Ev?Lt(Ev):$M;function B2(r){return r===n}function F2(r){return Qe(r)&&mt(r)==Sn}function H2(r){return Qe(r)&&yt(r)==lr}var z2=Al(od),V2=Al(function(r,i){return r<=i});function uw(r){if(!r)return[];if(Ct(r))return Bl(r)?on(r):Et(r);if(qi&&r[qi])return wk(r[qi]());var i=mt(r),u=i==ye?Uf:i==pt?rl:Fo;return u(r)}function Xn(r){if(!r)return r===0?r:0;if(r=qt(r),r===R||r===-R){var i=r<0?-1:1;return i*W}return r===r?r:0}function Ie(r){var i=Xn(r),u=i%1;return i===i?u?i-u:i:0}function fw(r){return r?zr(Ie(r),0,G):0}function qt(r){if(typeof r=="number")return r;if(Bt(r))return $;if(Ke(r)){var i=typeof r.valueOf=="function"?r.valueOf():r;r=Ke(i)?i+"":i}if(typeof r!="string")return r===0?r:+r;r=Ov(r);var u=xf.test(r);return u||bf.test(r)?rk(r.slice(2),u?2:8):Wa.test(r)?$:+r}function dw(r){return Cn(r,Nt(r))}function W2(r){return r?zr(Ie(r),-P,P):r===0?r:0}function Fe(r){return r==null?"":$t(r)}var j2=Do(function(r,i){if(ss(i)||Ct(i)){Cn(i,ct(i),r);return}for(var u in i)He.call(i,u)&&es(r,u,i[u])}),hw=Do(function(r,i){Cn(i,Nt(i),r)}),Fl=Do(function(r,i,u,y){Cn(i,Nt(i),r,y)}),U2=Do(function(r,i,u,y){Cn(i,ct(i),r,y)}),G2=Un(Zf);function Y2(r,i){var u=Ro(r);return i==null?u:Uv(u,i)}var X2=ke(function(r,i){r=ze(r);var u=-1,y=i.length,S=y>2?i[2]:n;for(S&&vt(i[0],i[1],S)&&(y=1);++u<y;)for(var I=i[u],F=Nt(I),j=-1,X=F.length;++j<X;){var oe=F[j],ie=r[oe];(ie===n||an(ie,Po[oe])&&!He.call(r,oe))&&(r[oe]=I[oe])}return r}),q2=ke(function(r){return r.push(n,Ox),Dt(pw,n,r)});function K2(r,i){return Nv(r,Se(i,3),En)}function Z2(r,i){return Nv(r,Se(i,3),Jf)}function Q2(r,i){return r==null?r:Qf(r,Se(i,3),Nt)}function J2(r,i){return r==null?r:Kv(r,Se(i,3),Nt)}function eL(r,i){return r&&En(r,Se(i,3))}function tL(r,i){return r&&Jf(r,Se(i,3))}function nL(r){return r==null?[]:wl(r,ct(r))}function rL(r){return r==null?[]:wl(r,Nt(r))}function Pd(r,i,u){var y=r==null?n:Vr(r,i);return y===n?u:y}function oL(r,i){return r!=null&&Mx(r,i,TM)}function kd(r,i){return r!=null&&Mx(r,i,AM)}var iL=Cx(function(r,i,u){i!=null&&typeof i.toString!="function"&&(i=al.call(i)),r[i]=u},Rd(Tt)),sL=Cx(function(r,i,u){i!=null&&typeof i.toString!="function"&&(i=al.call(i)),He.call(r,i)?r[i].push(u):r[i]=[u]},Se),aL=ke(ns);function ct(r){return Ct(r)?Wv(r):rd(r)}function Nt(r){return Ct(r)?Wv(r,!0):BM(r)}function lL(r,i){var u={};return i=Se(i,3),En(r,function(y,S,I){Wn(u,i(y,S,I),y)}),u}function cL(r,i){var u={};return i=Se(i,3),En(r,function(y,S,I){Wn(u,S,i(y,S,I))}),u}var uL=Do(function(r,i,u){bl(r,i,u)}),pw=Do(function(r,i,u,y){bl(r,i,u,y)}),fL=Un(function(r,i){var u={};if(r==null)return u;var y=!1;i=Xe(i,function(I){return I=gr(I,r),y||(y=I.length>1),I}),Cn(r,yd(r),u),y&&(u=Gt(u,g|p|m,iR));for(var S=i.length;S--;)cd(u,i[S]);return u});function dL(r,i){return gw(r,Ll(Se(i)))}var hL=Un(function(r,i){return r==null?{}:HM(r,i)});function gw(r,i){if(r==null)return{};var u=Xe(yd(r),function(y){return[y]});return i=Se(i),sx(r,u,function(y,S){return i(y,S[0])})}function pL(r,i,u){i=gr(i,r);var y=-1,S=i.length;for(S||(S=1,r=n);++y<S;){var I=r==null?n:r[Nn(i[y])];I===n&&(y=S,I=u),r=Yn(I)?I.call(r):I}return r}function gL(r,i,u){return r==null?r:os(r,i,u)}function mL(r,i,u,y){return y=typeof y=="function"?y:n,r==null?r:os(r,i,u,y)}var mw=Ax(ct),yw=Ax(Nt);function yL(r,i,u){var y=Ae(r),S=y||yr(r)||Bo(r);if(i=Se(i,4),u==null){var I=r&&r.constructor;S?u=y?new I:[]:Ke(r)?u=Yn(I)?Ro(ul(r)):{}:u={}}return(S?Wt:En)(r,function(F,j,X){return i(u,F,j,X)}),u}function vL(r,i){return r==null?!0:cd(r,i)}function xL(r,i,u){return r==null?r:fx(r,i,dd(u))}function wL(r,i,u,y){return y=typeof y=="function"?y:n,r==null?r:fx(r,i,dd(u),y)}function Fo(r){return r==null?[]:jf(r,ct(r))}function bL(r){return r==null?[]:jf(r,Nt(r))}function _L(r,i,u){return u===n&&(u=i,i=n),u!==n&&(u=qt(u),u=u===u?u:0),i!==n&&(i=qt(i),i=i===i?i:0),zr(qt(r),i,u)}function SL(r,i,u){return i=Xn(i),u===n?(u=i,i=0):u=Xn(u),r=qt(r),IM(r,i,u)}function EL(r,i,u){if(u&&typeof u!="boolean"&&vt(r,i,u)&&(i=u=n),u===n&&(typeof i=="boolean"?(u=i,i=n):typeof r=="boolean"&&(u=r,r=n)),r===n&&i===n?(r=0,i=1):(r=Xn(r),i===n?(i=r,r=0):i=Xn(i)),r>i){var y=r;r=i,i=y}if(u||r%1||i%1){var S=zv();return gt(r+S*(i-r+nk("1e-"+((S+"").length-1))),i)}return sd(r,i)}var CL=Lo(function(r,i,u){return i=i.toLowerCase(),r+(u?vw(i):i)});function vw(r){return Md(Fe(r).toLowerCase())}function xw(r){return r=Fe(r),r&&r.replace(Sf,gk).replace(GP,"")}function NL(r,i,u){r=Fe(r),i=$t(i);var y=r.length;u=u===n?y:zr(Ie(u),0,y);var S=u;return u-=i.length,u>=0&&r.slice(u,S)==i}function TL(r){return r=Fe(r),r&&sf.test(r)?r.replace(Fa,mk):r}function AL(r){return r=Fe(r),r&&ff.test(r)?r.replace(Vi,"\\$&"):r}var IL=Lo(function(r,i,u){return r+(u?"-":"")+i.toLowerCase()}),OL=Lo(function(r,i,u){return r+(u?" ":"")+i.toLowerCase()}),PL=_x("toLowerCase");function kL(r,i,u){r=Fe(r),i=Ie(i);var y=i?Io(r):0;if(!i||y>=i)return r;var S=(i-y)/2;return Tl(pl(S),u)+r+Tl(hl(S),u)}function ML(r,i,u){r=Fe(r),i=Ie(i);var y=i?Io(r):0;return i&&y<i?r+Tl(i-y,u):r}function RL(r,i,u){r=Fe(r),i=Ie(i);var y=i?Io(r):0;return i&&y<i?Tl(i-y,u)+r:r}function DL(r,i,u){return u||i==null?i=0:i&&(i=+i),Vk(Fe(r).replace(Wi,""),i||0)}function LL(r,i,u){return(u?vt(r,i,u):i===n)?i=1:i=Ie(i),ad(Fe(r),i)}function $L(){var r=arguments,i=Fe(r[0]);return r.length<3?i:i.replace(r[1],r[2])}var BL=Lo(function(r,i,u){return r+(u?"_":"")+i.toLowerCase()});function FL(r,i,u){return u&&typeof u!="number"&&vt(r,i,u)&&(i=u=n),u=u===n?G:u>>>0,u?(r=Fe(r),r&&(typeof i=="string"||i!=null&&!Od(i))&&(i=$t(i),!i&&Ao(r))?mr(on(r),0,u):r.split(i,u)):[]}var HL=Lo(function(r,i,u){return r+(u?" ":"")+Md(i)});function zL(r,i,u){return r=Fe(r),u=u==null?0:zr(Ie(u),0,r.length),i=$t(i),r.slice(u,u+i.length)==i}function VL(r,i,u){var y=A.templateSettings;u&&vt(r,i,u)&&(i=n),r=Fe(r),i=Fl({},i,y,Ix);var S=Fl({},i.imports,y.imports,Ix),I=ct(S),F=jf(S,I),j,X,oe=0,ie=i.interpolate||_o,le="__p += '",he=Gf((i.escape||_o).source+"|"+ie.source+"|"+(ie===za?Va:_o).source+"|"+(i.evaluate||_o).source+"|$","g"),we="//# sourceURL="+(He.call(i,"sourceURL")?(i.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ZP+"]")+`
70
- `;r.replace(he,function(Ce,Me,$e,Ft,xt,Ht){return $e||($e=Ft),le+=r.slice(oe,Ht).replace(ja,yk),Me&&(j=!0,le+=`' +
71
- __e(`+Me+`) +
72
- '`),xt&&(X=!0,le+=`';
73
- `+xt+`;
74
- __p += '`),$e&&(le+=`' +
75
- ((__t = (`+$e+`)) == null ? '' : __t) +
76
- '`),oe=Ht+Ce.length,Ce}),le+=`';
77
- `;var Ee=He.call(i,"variable")&&i.variable;if(!Ee)le=`with (obj) {
78
- `+le+`
79
- }
80
- `;else if(yf.test(Ee))throw new Te(c);le=(X?le.replace(tf,""):le).replace(nf,"$1").replace(rf,"$1;"),le="function("+(Ee||"obj")+`) {
81
- `+(Ee?"":`obj || (obj = {});
82
- `)+"var __t, __p = ''"+(j?", __e = _.escape":"")+(X?`, __j = Array.prototype.join;
83
- function print() { __p += __j.call(arguments, '') }
84
- `:`;
85
- `)+le+`return __p
86
- }`;var Oe=bw(function(){return Be(I,we+"return "+le).apply(n,F)});if(Oe.source=le,Id(Oe))throw Oe;return Oe}function WL(r){return Fe(r).toLowerCase()}function jL(r){return Fe(r).toUpperCase()}function UL(r,i,u){if(r=Fe(r),r&&(u||i===n))return Ov(r);if(!r||!(i=$t(i)))return r;var y=on(r),S=on(i),I=Pv(y,S),F=kv(y,S)+1;return mr(y,I,F).join("")}function GL(r,i,u){if(r=Fe(r),r&&(u||i===n))return r.slice(0,Rv(r)+1);if(!r||!(i=$t(i)))return r;var y=on(r),S=kv(y,on(i))+1;return mr(y,0,S).join("")}function YL(r,i,u){if(r=Fe(r),r&&(u||i===n))return r.replace(Wi,"");if(!r||!(i=$t(i)))return r;var y=on(r),S=Pv(y,on(i));return mr(y,S).join("")}function XL(r,i){var u=K,y=Z;if(Ke(i)){var S="separator"in i?i.separator:S;u="length"in i?Ie(i.length):u,y="omission"in i?$t(i.omission):y}r=Fe(r);var I=r.length;if(Ao(r)){var F=on(r);I=F.length}if(u>=I)return r;var j=u-Io(y);if(j<1)return y;var X=F?mr(F,0,j).join(""):r.slice(0,j);if(S===n)return X+y;if(F&&(j+=X.length-j),Od(S)){if(r.slice(j).search(S)){var oe,ie=X;for(S.global||(S=Gf(S.source,Fe(ji.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ie);)var le=oe.index;X=X.slice(0,le===n?j:le)}}else if(r.indexOf($t(S),j)!=j){var he=X.lastIndexOf(S);he>-1&&(X=X.slice(0,he))}return X+y}function qL(r){return r=Fe(r),r&&of.test(r)?r.replace(Ba,Ek):r}var KL=Lo(function(r,i,u){return r+(u?" ":"")+i.toUpperCase()}),Md=_x("toUpperCase");function ww(r,i,u){return r=Fe(r),i=u?n:i,i===n?xk(r)?Tk(r):uk(r):r.match(i)||[]}var bw=ke(function(r,i){try{return Dt(r,n,i)}catch(u){return Id(u)?u:new Te(u)}}),ZL=Un(function(r,i){return Wt(i,function(u){u=Nn(u),Wn(r,u,Td(r[u],r))}),r});function QL(r){var i=r==null?0:r.length,u=Se();return r=i?Xe(r,function(y){if(typeof y[1]!="function")throw new jt(l);return[u(y[0]),y[1]]}):[],ke(function(y){for(var S=-1;++S<i;){var I=r[S];if(Dt(I[0],this,y))return Dt(I[1],this,y)}})}function JL(r){return EM(Gt(r,g))}function Rd(r){return function(){return r}}function e$(r,i){return r==null||r!==r?i:r}var t$=Ex(),n$=Ex(!0);function Tt(r){return r}function Dd(r){return ex(typeof r=="function"?r:Gt(r,g))}function r$(r){return nx(Gt(r,g))}function o$(r,i){return rx(r,Gt(i,g))}var i$=ke(function(r,i){return function(u){return ns(u,r,i)}}),s$=ke(function(r,i){return function(u){return ns(r,u,i)}});function Ld(r,i,u){var y=ct(i),S=wl(i,y);u==null&&!(Ke(i)&&(S.length||!y.length))&&(u=i,i=r,r=this,S=wl(i,ct(i)));var I=!(Ke(u)&&"chain"in u)||!!u.chain,F=Yn(r);return Wt(S,function(j){var X=i[j];r[j]=X,F&&(r.prototype[j]=function(){var oe=this.__chain__;if(I||oe){var ie=r(this.__wrapped__),le=ie.__actions__=Et(this.__actions__);return le.push({func:X,args:arguments,thisArg:r}),ie.__chain__=oe,ie}return X.apply(r,ur([this.value()],arguments))})}),r}function a$(){return ft._===this&&(ft._=Mk),this}function $d(){}function l$(r){return r=Ie(r),ke(function(i){return ox(i,r)})}var c$=pd(Xe),u$=pd(Cv),f$=pd(Ff);function _w(r){return bd(r)?Hf(Nn(r)):zM(r)}function d$(r){return function(i){return r==null?n:Vr(r,i)}}var h$=Nx(),p$=Nx(!0);function Bd(){return[]}function Fd(){return!1}function g$(){return{}}function m$(){return""}function y$(){return!0}function v$(r,i){if(r=Ie(r),r<1||r>P)return[];var u=G,y=gt(r,G);i=Se(i),r-=G;for(var S=Wf(y,i);++u<r;)i(u);return S}function x$(r){return Ae(r)?Xe(r,Nn):Bt(r)?[r]:Et(Vx(Fe(r)))}function w$(r){var i=++Pk;return Fe(r)+i}var b$=Nl(function(r,i){return r+i},0),_$=gd("ceil"),S$=Nl(function(r,i){return r/i},1),E$=gd("floor");function C$(r){return r&&r.length?xl(r,Tt,ed):n}function N$(r,i){return r&&r.length?xl(r,Se(i,2),ed):n}function T$(r){return Av(r,Tt)}function A$(r,i){return Av(r,Se(i,2))}function I$(r){return r&&r.length?xl(r,Tt,od):n}function O$(r,i){return r&&r.length?xl(r,Se(i,2),od):n}var P$=Nl(function(r,i){return r*i},1),k$=gd("round"),M$=Nl(function(r,i){return r-i},0);function R$(r){return r&&r.length?Vf(r,Tt):0}function D$(r,i){return r&&r.length?Vf(r,Se(i,2)):0}return A.after=r2,A.ary=Jx,A.assign=j2,A.assignIn=hw,A.assignInWith=Fl,A.assignWith=U2,A.at=G2,A.before=ew,A.bind=Td,A.bindAll=ZL,A.bindKey=tw,A.castArray=g2,A.chain=Kx,A.chunk=ER,A.compact=CR,A.concat=NR,A.cond=QL,A.conforms=JL,A.constant=Rd,A.countBy=RD,A.create=Y2,A.curry=nw,A.curryRight=rw,A.debounce=ow,A.defaults=X2,A.defaultsDeep=q2,A.defer=o2,A.delay=i2,A.difference=TR,A.differenceBy=AR,A.differenceWith=IR,A.drop=OR,A.dropRight=PR,A.dropRightWhile=kR,A.dropWhile=MR,A.fill=RR,A.filter=LD,A.flatMap=FD,A.flatMapDeep=HD,A.flatMapDepth=zD,A.flatten=Gx,A.flattenDeep=DR,A.flattenDepth=LR,A.flip=s2,A.flow=t$,A.flowRight=n$,A.fromPairs=$R,A.functions=nL,A.functionsIn=rL,A.groupBy=VD,A.initial=FR,A.intersection=HR,A.intersectionBy=zR,A.intersectionWith=VR,A.invert=iL,A.invertBy=sL,A.invokeMap=jD,A.iteratee=Dd,A.keyBy=UD,A.keys=ct,A.keysIn=Nt,A.map=Ml,A.mapKeys=lL,A.mapValues=cL,A.matches=r$,A.matchesProperty=o$,A.memoize=Dl,A.merge=uL,A.mergeWith=pw,A.method=i$,A.methodOf=s$,A.mixin=Ld,A.negate=Ll,A.nthArg=l$,A.omit=fL,A.omitBy=dL,A.once=a2,A.orderBy=GD,A.over=c$,A.overArgs=l2,A.overEvery=u$,A.overSome=f$,A.partial=Ad,A.partialRight=iw,A.partition=YD,A.pick=hL,A.pickBy=gw,A.property=_w,A.propertyOf=d$,A.pull=GR,A.pullAll=Xx,A.pullAllBy=YR,A.pullAllWith=XR,A.pullAt=qR,A.range=h$,A.rangeRight=p$,A.rearg=c2,A.reject=KD,A.remove=KR,A.rest=u2,A.reverse=Cd,A.sampleSize=QD,A.set=gL,A.setWith=mL,A.shuffle=JD,A.slice=ZR,A.sortBy=n2,A.sortedUniq=oD,A.sortedUniqBy=iD,A.split=FL,A.spread=f2,A.tail=sD,A.take=aD,A.takeRight=lD,A.takeRightWhile=cD,A.takeWhile=uD,A.tap=CD,A.throttle=d2,A.thru=kl,A.toArray=uw,A.toPairs=mw,A.toPairsIn=yw,A.toPath=x$,A.toPlainObject=dw,A.transform=yL,A.unary=h2,A.union=fD,A.unionBy=dD,A.unionWith=hD,A.uniq=pD,A.uniqBy=gD,A.uniqWith=mD,A.unset=vL,A.unzip=Nd,A.unzipWith=qx,A.update=xL,A.updateWith=wL,A.values=Fo,A.valuesIn=bL,A.without=yD,A.words=ww,A.wrap=p2,A.xor=vD,A.xorBy=xD,A.xorWith=wD,A.zip=bD,A.zipObject=_D,A.zipObjectDeep=SD,A.zipWith=ED,A.entries=mw,A.entriesIn=yw,A.extend=hw,A.extendWith=Fl,Ld(A,A),A.add=b$,A.attempt=bw,A.camelCase=CL,A.capitalize=vw,A.ceil=_$,A.clamp=_L,A.clone=m2,A.cloneDeep=v2,A.cloneDeepWith=x2,A.cloneWith=y2,A.conformsTo=w2,A.deburr=xw,A.defaultTo=e$,A.divide=S$,A.endsWith=NL,A.eq=an,A.escape=TL,A.escapeRegExp=AL,A.every=DD,A.find=$D,A.findIndex=jx,A.findKey=K2,A.findLast=BD,A.findLastIndex=Ux,A.findLastKey=Z2,A.floor=E$,A.forEach=Zx,A.forEachRight=Qx,A.forIn=Q2,A.forInRight=J2,A.forOwn=eL,A.forOwnRight=tL,A.get=Pd,A.gt=b2,A.gte=_2,A.has=oL,A.hasIn=kd,A.head=Yx,A.identity=Tt,A.includes=WD,A.indexOf=BR,A.inRange=SL,A.invoke=aL,A.isArguments=Ur,A.isArray=Ae,A.isArrayBuffer=S2,A.isArrayLike=Ct,A.isArrayLikeObject=et,A.isBoolean=E2,A.isBuffer=yr,A.isDate=C2,A.isElement=N2,A.isEmpty=T2,A.isEqual=A2,A.isEqualWith=I2,A.isError=Id,A.isFinite=O2,A.isFunction=Yn,A.isInteger=sw,A.isLength=$l,A.isMap=aw,A.isMatch=P2,A.isMatchWith=k2,A.isNaN=M2,A.isNative=R2,A.isNil=L2,A.isNull=D2,A.isNumber=lw,A.isObject=Ke,A.isObjectLike=Qe,A.isPlainObject=ls,A.isRegExp=Od,A.isSafeInteger=$2,A.isSet=cw,A.isString=Bl,A.isSymbol=Bt,A.isTypedArray=Bo,A.isUndefined=B2,A.isWeakMap=F2,A.isWeakSet=H2,A.join=WR,A.kebabCase=IL,A.last=Xt,A.lastIndexOf=jR,A.lowerCase=OL,A.lowerFirst=PL,A.lt=z2,A.lte=V2,A.max=C$,A.maxBy=N$,A.mean=T$,A.meanBy=A$,A.min=I$,A.minBy=O$,A.stubArray=Bd,A.stubFalse=Fd,A.stubObject=g$,A.stubString=m$,A.stubTrue=y$,A.multiply=P$,A.nth=UR,A.noConflict=a$,A.noop=$d,A.now=Rl,A.pad=kL,A.padEnd=ML,A.padStart=RL,A.parseInt=DL,A.random=EL,A.reduce=XD,A.reduceRight=qD,A.repeat=LL,A.replace=$L,A.result=pL,A.round=k$,A.runInContext=Y,A.sample=ZD,A.size=e2,A.snakeCase=BL,A.some=t2,A.sortedIndex=QR,A.sortedIndexBy=JR,A.sortedIndexOf=eD,A.sortedLastIndex=tD,A.sortedLastIndexBy=nD,A.sortedLastIndexOf=rD,A.startCase=HL,A.startsWith=zL,A.subtract=M$,A.sum=R$,A.sumBy=D$,A.template=VL,A.times=v$,A.toFinite=Xn,A.toInteger=Ie,A.toLength=fw,A.toLower=WL,A.toNumber=qt,A.toSafeInteger=W2,A.toString=Fe,A.toUpper=jL,A.trim=UL,A.trimEnd=GL,A.trimStart=YL,A.truncate=XL,A.unescape=qL,A.uniqueId=w$,A.upperCase=KL,A.upperFirst=Md,A.each=Zx,A.eachRight=Qx,A.first=Yx,Ld(A,function(){var r={};return En(A,function(i,u){He.call(A.prototype,u)||(r[u]=i)}),r}(),{chain:!1}),A.VERSION=o,Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){A[r].placeholder=A}),Wt(["drop","take"],function(r,i){De.prototype[r]=function(u){u=u===n?1:lt(Ie(u),0);var y=this.__filtered__&&!i?new De(this):this.clone();return y.__filtered__?y.__takeCount__=gt(u,y.__takeCount__):y.__views__.push({size:gt(u,G),type:r+(y.__dir__<0?"Right":"")}),y},De.prototype[r+"Right"]=function(u){return this.reverse()[r](u).reverse()}}),Wt(["filter","map","takeWhile"],function(r,i){var u=i+1,y=u==C||u==B;De.prototype[r]=function(S){var I=this.clone();return I.__iteratees__.push({iteratee:Se(S,3),type:u}),I.__filtered__=I.__filtered__||y,I}}),Wt(["head","last"],function(r,i){var u="take"+(i?"Right":"");De.prototype[r]=function(){return this[u](1).value()[0]}}),Wt(["initial","tail"],function(r,i){var u="drop"+(i?"":"Right");De.prototype[r]=function(){return this.__filtered__?new De(this):this[u](1)}}),De.prototype.compact=function(){return this.filter(Tt)},De.prototype.find=function(r){return this.filter(r).head()},De.prototype.findLast=function(r){return this.reverse().find(r)},De.prototype.invokeMap=ke(function(r,i){return typeof r=="function"?new De(this):this.map(function(u){return ns(u,r,i)})}),De.prototype.reject=function(r){return this.filter(Ll(Se(r)))},De.prototype.slice=function(r,i){r=Ie(r);var u=this;return u.__filtered__&&(r>0||i<0)?new De(u):(r<0?u=u.takeRight(-r):r&&(u=u.drop(r)),i!==n&&(i=Ie(i),u=i<0?u.dropRight(-i):u.take(i-r)),u)},De.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},De.prototype.toArray=function(){return this.take(G)},En(De.prototype,function(r,i){var u=/^(?:filter|find|map|reject)|While$/.test(i),y=/^(?:head|last)$/.test(i),S=A[y?"take"+(i=="last"?"Right":""):i],I=y||/^find/.test(i);S&&(A.prototype[i]=function(){var F=this.__wrapped__,j=y?[1]:arguments,X=F instanceof De,oe=j[0],ie=X||Ae(F),le=function(Me){var $e=S.apply(A,ur([Me],j));return y&&he?$e[0]:$e};ie&&u&&typeof oe=="function"&&oe.length!=1&&(X=ie=!1);var he=this.__chain__,we=!!this.__actions__.length,Ee=I&&!he,Oe=X&&!we;if(!I&&ie){F=Oe?F:new De(this);var Ce=r.apply(F,j);return Ce.__actions__.push({func:kl,args:[le],thisArg:n}),new Ut(Ce,he)}return Ee&&Oe?r.apply(this,j):(Ce=this.thru(le),Ee?y?Ce.value()[0]:Ce.value():Ce)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(r){var i=ol[r],u=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",y=/^(?:pop|shift)$/.test(r);A.prototype[r]=function(){var S=arguments;if(y&&!this.__chain__){var I=this.value();return i.apply(Ae(I)?I:[],S)}return this[u](function(F){return i.apply(Ae(F)?F:[],S)})}}),En(De.prototype,function(r,i){var u=A[i];if(u){var y=u.name+"";He.call(Mo,y)||(Mo[y]=[]),Mo[y].push({name:i,func:u})}}),Mo[Cl(n,_).name]=[{name:"wrapper",func:n}],De.prototype.clone=qk,De.prototype.reverse=Kk,De.prototype.value=Zk,A.prototype.at=ND,A.prototype.chain=TD,A.prototype.commit=AD,A.prototype.next=ID,A.prototype.plant=PD,A.prototype.reverse=kD,A.prototype.toJSON=A.prototype.valueOf=A.prototype.value=MD,A.prototype.first=A.prototype.head,qi&&(A.prototype[qi]=OD),A},Oo=Ak();$r?(($r.exports=Oo)._=Oo,Df._=Oo):ft._=Oo}).call(DT)}(bi,bi.exports)),bi.exports}var $T=LT();const BT=Vd($T);function Am(e,t,n=!0){let o;if(t?.handle){const{id:l,name:c,dataType:f,inferredDataType:d,...h}=t.handle;o=h}const s=(t?.handle?.inferredDataType||t?.handle?.dataType)&&!t?.resetInferredType?t?.handle?.inferredDataType||t?.handle?.dataType:void 0,a=BT.cloneDeep({inferredDataType:s,...t?.overrideDataType?{dataType:s}:{},...t?.handle?.dataType?.dataTypeObject&&t?.handle?.dataType?.dataTypeUniqueId&&o?o:{},...t?.overrideName&&t?.handle?.name?{name:t.handle.name}:{}});return n?(Object.assign(e,a),e):Yo(e,l=>(Object.assign(l,a),l))}function eu(e,t,n,o=!0){return o?Cm(e,s=>{s.dataType?.dataTypeUniqueId===t&&Am(s,n)}):Yo(e,s=>(Cm(s,a=>{a.dataType?.dataTypeUniqueId===t&&Am(a,n)}),s))}function FT(e,t,n,o,s,a,l,c,f){if(!a.sourceHandle||!a.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const d=e.nodes[t].data,h=e.nodes[n].data,g=gn(o,d)?.value,p=gn(s,h)?.value,m=g?.dataType,x=p?.dataType,v=g?.inferredDataType,b=p?.inferredDataType,_=m?.dataTypeObject.underlyingType==="inferFromConnection",N=x?.dataTypeObject.underlyingType==="inferFromConnection";if(!m||!x)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const w=!!l&&a.source===l,E=!!c&&a.target===c,O=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!_&&!N)return{validation:{isValid:!0}};let k,M,D,V=!1,K=!1,Z=!1;if(_&&N){if(!v&&!b)return{validation:{isValid:!1,reason:"None of the handles are inferred, inference has no information to work with"}};if(v&&b)return{validation:{isValid:!0}};v?(k=n,M=x.dataTypeUniqueId,D=g,V=!1,K=E,Z=E):b&&(k=t,M=m.dataTypeUniqueId,D=p,V=!1,K=w,Z=w)}else if(_){if(v)return{validation:{isValid:!0}};k=t,M=m.dataTypeUniqueId,D=p,V=!1,K=w,Z=w}else if(N){if(b)return{validation:{isValid:!0}};k=n,M=x.dataTypeUniqueId,D=g,V=!1,K=E,Z=E}if(k===void 0||M===void 0||D===void 0)return{validation:{isValid:!1,reason:"Index of node to update, data type to infer for, or connected handle not found"}};eu(e.nodes[k].data,M,{handle:D,resetInferredType:V,overrideDataType:K,overrideName:Z});//!== is basically xor for boolean, we are checking if one is true and the other is false
87
- if(O&&(_&&w)!==(N&&E)){const U=E?n:t,q=E?"input":"output",C=sa(e.dataTypes,e.nodes[U].data.nodeTypeUniqueId,e.typeOfNodes,{type:q,index1:0,index2:void 0}),H=E?p.name:g.name,B=E?p.inferredDataType?.dataTypeUniqueId:g.inferredDataType?.dataTypeUniqueId,R=E?p.inferredDataType?.dataTypeObject.allowInput:g.inferredDataType?.dataTypeObject.allowInput;if(!H||!B)return{validation:{isValid:!1,reason:"Handle to add name, data type, or allow input not found"}};if(!C)return{validation:{isValid:!1,reason:"New duplicate handle not found"}};Jc(e.nodes[U].data,{type:q,index1:-1,index2:void 0},0,C,!0,"after"),Mm(f,O.nodeType,{name:H,dataType:B,allowInput:R},{type:E?"output":"input",index1:-1,index2:void 0},"after")}return{validation:{isValid:!0}}}function HT(e,t,n,o,s,a){if(!a.sourceHandle||!a.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const l=e.nodes[t].data,c=e.nodes[n].data,f=gn(o,l)?.value,d=gn(s,c)?.value,h=_i(f),g=_i(d);if(!h||!g)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const p=h?.dataTypeObject.underlyingType==="complex",m=g?.dataTypeObject.underlyingType==="complex";return!p&&!m?{validation:{isValid:!0}}:p!==m?{validation:{isValid:!1,reason:"Can't connect complex types with non-complex types"}}:p&&m?h.dataTypeUniqueId===g.dataTypeUniqueId||JSON.stringify(h.dataTypeObject.complexSchema)===JSON.stringify(g.dataTypeObject.complexSchema)?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:"Can't connect complex types with different types"}}:{validation:{isValid:!0}}}function zT(e,t,n,o,s,a){if(!a.sourceHandle||!a.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const l=e.nodes[t].data,c=e.nodes[n].data,f=gn(o,l)?.value,d=gn(s,c)?.value,h=_i(f),g=_i(d);if(!h||!g)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(h.dataTypeUniqueId===g.dataTypeUniqueId)return{validation:{isValid:!0}};const m=e.allowedConversionsBetweenDataTypes?.[h.dataTypeUniqueId]?.[g.dataTypeUniqueId],x=h.dataTypeObject.underlyingType==="complex"&&g.dataTypeObject.underlyingType==="complex";return m||x&&e.allowConversionBetweenComplexTypesUnlessDisallowedByComplexTypeChecking?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:`${h.dataTypeUniqueId} to ${g.dataTypeUniqueId} conversion is not allowed`}}}function VT(e,t,n,o,s,a){const l=e.nodes[t],c=e.nodes[n],f=gn(o,l.data)?.value,d=gn(s,c.data)?.value,h=f?.dataType,g=d?.dataType;if(!h||!g)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(h.dataTypeObject.underlyingType!=="inferFromConnection"&&g.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};let p=e.nodes;if(h.dataTypeObject.underlyingType==="inferFromConnection"){const m=Cc([l],e.edges),{inputsAndIndices:x,outputsAndIndices:v}=Dm(l.data),b={};for(const N of x)N.value.dataType?.dataTypeUniqueId===h.dataTypeUniqueId&&(b[N.value.id]=!0);for(const N of v)N.value.dataType?.dataTypeUniqueId===h.dataTypeUniqueId&&(b[N.value.id]=!0);let _=!1;for(const N of m)if(N.id!==a.id&&!(!N.sourceHandle||!N.targetHandle)){if(b[N.sourceHandle]){_=!0;break}if(b[N.targetHandle]){_=!0;break}}_||(p=[...p],p[t]={...p[t],data:eu(p[t].data,h.dataTypeUniqueId,{handle:sa(e.dataTypes,p[t].data.nodeTypeUniqueId,e.typeOfNodes,o),resetInferredType:!0})})}if(g.dataTypeObject.underlyingType==="inferFromConnection"){const m=Cc([c],e.edges),{inputsAndIndices:x,outputsAndIndices:v}=Dm(c.data),b={};for(const N of x)N.value.dataType?.dataTypeUniqueId===g.dataTypeUniqueId&&(b[N.value.id]=!0);for(const N of v)N.value.dataType?.dataTypeUniqueId===g.dataTypeUniqueId&&(b[N.value.id]=!0);let _=!1;for(const N of m)if(N.id!==a.id&&!(!N.sourceHandle||!N.targetHandle)){if(b[N.sourceHandle]){_=!0;break}if(b[N.targetHandle]){_=!0;break}}_||(p=[...p],p[n]={...p[n],data:eu(p[n].data,g.dataTypeUniqueId,{handle:sa(e.dataTypes,p[n].data.nodeTypeUniqueId,e.typeOfNodes,s),resetInferredType:!0})})}return{updatedNodes:p,validation:{isValid:!0}}}const WT=20;function Im(e,t,n,o,s,a,l,c){const f={id:un(WT),source:e,target:n,sourceHandle:t,targetHandle:o,type:"configurableEdge"};if(Wp(f,s.edges)===s.edges)return{validation:{isValid:!1,reason:"Edge already exists or was rejected by reactflow"}};if(!(s.enableTypeInference||s.enableComplexTypeChecking||s.allowedConversionsBetweenDataTypes))return s.edges.push(f),{validation:{isValid:!0}};const h=s.nodes.findIndex(_=>_.id===e),g=s.nodes.findIndex(_=>_.id===n);if(h===-1||g===-1)return{validation:{isValid:!1,reason:"Source or target node not found"}};const p=s.nodes[h],m=s.nodes[g],x=Rn(t,p.data)?.handleIndices,v=Rn(o,m.data)?.handleIndices;if(!x||!v)return{validation:{isValid:!1,reason:"Source or target handle not found"}};let b={isValid:!0};if(s.enableTypeInference){const{validation:_}=FT(s,h,g,x,v,f,a,l,c);b=_}if(s.enableComplexTypeChecking&&b.isValid){const{validation:_}=HT({...s,nodes:s.nodes},h,g,x,v,f);b=_}if(s.allowedConversionsBetweenDataTypes&&b.isValid){const{validation:_}=zT({...s,nodes:s.nodes},h,g,x,v,f);b=_}return b.isValid?(s.edges.push(f),{validation:b}):{validation:b}}function Om(e,t,n){if(gi([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:gi([n],t.edges),validation:{isValid:!0}};const s=t.nodes.findIndex(p=>p.id===e.source),a=t.nodes.findIndex(p=>p.id===e.target);if(s===-1||a===-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 l=t.nodes[s],c=t.nodes[a],f=Rn(e.sourceHandle,l.data)?.handleIndices,d=Rn(e.targetHandle,c.data)?.handleIndices;if(!f||!d)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let h=t.nodes,g={isValid:!0};if(t.enableTypeInference){const{updatedNodes:p,validation:m}=VT(t,s,a,f,d,e);h=p,g=m}return{updatedNodes:h,updatedEdges:gi([n],t.edges),validation:g}}function _i(e){const t=e?.dataType,n=e?.inferredDataType;if(t)return t.dataTypeObject.underlyingType!=="inferFromConnection"?t:n||void 0}function Pm(e,t,n){const o=e.nodes.find(a=>a.id===n);if(!o)return!1;if(o.id===t)return!0;const s=(a,l=new Set)=>{if(l.has(a.id))return!1;l.add(a.id);for(const c of dE(a,e.nodes,e.edges))if(c.id===t||s(c,l))return!0;return!1};return s(o)}function km(e,t,n,o,s,a){const l=[],c=[];for(const f of t.nodes){if(f.data.nodeTypeUniqueId!==n){l.push(f);continue}Jc(f.data,s,0,tr(o,e),void 0,a),l.push(f)}for(const f of t.edges)c.push(f);return{...t,nodes:l,edges:c}}function Mm(e,t,n,o,s="before"){const a=e.typeOfNodes[t];if(!a)return e;Jc(a,o,0,n,void 0,s);const l=Kc(e,t);for(const d of l){const h=e.typeOfNodes[d];h&&h.subtree&&(e.typeOfNodes[d]={...h,subtree:{...h.subtree,...km(e.dataTypes,h.subtree,t,n,o,s)}})}const{nodes:c,edges:f}=km(e.dataTypes,{nodes:e.nodes,edges:e.edges},t,n,o,s);return{typeOfNodes:e.typeOfNodes,nodes:c,edges:f}}const Si=["newGroupInput","newGroupOutput"],Ei={[Si[0]]:Si[0],[Si[1]]:Si[1]},Ci=["groupInput","groupOutput"],Ni={[Ci[0]]:Ci[0],[Ci[1]]:Ci[1]},jT={[Ei.newGroupInput]:{name:"New Group Input",underlyingType:"inferFromConnection",color:"#333333"},[Ei.newGroupOutput]:{name:"New Group Output",underlyingType:"inferFromConnection",color:"#333333"}},UT={[Ni.groupInput]:{name:"Group Input",headerColor:"#1d1d1d",inputs:[],outputs:[{name:"",dataType:Ei.newGroupInput}]},[Ni.groupOutput]:{name:"Group Output",headerColor:"#1d1d1d",inputs:[{name:"",dataType:Ei.newGroupOutput}],outputs:[]}},Ti=20,rt=["ADD_NODE","ADD_NODE_AND_SELECT","UPDATE_NODE_BY_REACT_FLOW","UPDATE_EDGES_BY_REACT_FLOW","ADD_EDGE_BY_REACT_FLOW","UPDATE_INPUT_VALUE","OPEN_NODE_GROUP","CLOSE_NODE_GROUP","ADD_NODE_GROUP","SET_VIEWPORT"],st={[rt[0]]:rt[0],[rt[1]]:rt[1],[rt[2]]:rt[2],[rt[3]]:rt[3],[rt[4]]:rt[4],[rt[5]]:rt[5],[rt[6]]:rt[6],[rt[7]]:rt[7],[rt[8]]:rt[8],[rt[9]]:rt[9]};function Rm(e,t){return Yo(e,o=>{switch(t.type){case st.ADD_NODE:const s=t.payload.type,a=un(Ti),l=t.payload.position,c=xi(o.dataTypes,s,o.typeOfNodes,a,l);o=Or(o,[...Pt(o).nodes,c]);break;case st.ADD_NODE_AND_SELECT:const f=t.payload.type,d=un(Ti),h=t.payload.position,g=xi(o.dataTypes,f,o.typeOfNodes,d,h);o=Or(o,Pt(o).nodes.map(C=>({...C,selected:!1}))),o=Or(o,[...Pt(o).nodes,{...g,selected:!0}]);break;case st.UPDATE_NODE_BY_REACT_FLOW:const p=t.payload.changes;o=Or(o,Pg(p,Pt(o).nodes));break;case st.UPDATE_EDGES_BY_REACT_FLOW:const m=t.payload.changes;for(const C of m){if(C.type!=="remove"){o=Or(o,void 0,gi([C],Pt(o).edges));continue}const{id:H}=C,B=Pt(o).edges.find(P=>P.id===H);if(!B)continue;const R=Om(B,{...o,nodes:Pt(o).nodes,edges:Pt(o).edges},C);R.validation.isValid&&(o=Or(o,R.updatedNodes,R.updatedEdges))}break;case st.ADD_EDGE_BY_REACT_FLOW:const x=t.payload.edge,{sourceHandle:v,targetHandle:b,source:_,target:N}=x,w=Pt(o);if(o.enableCycleChecking&&Pm({...o,nodes:w.nodes,edges:w.edges},_,N)||!_||!N||!v||!b)break;const E=Pt(o);if(!Im(_,v,N,b,{...o,nodes:E.nodes,edges:E.edges},E.inputNodeId,E.outputNodeId,o).validation.isValid)break;break;case st.OPEN_NODE_GROUP:if("nodeId"in t.payload){const C=t.payload.nodeId,H=Pt(o).nodes.find(P=>P.id===C);if(!H)break;const B=H.data.nodeTypeUniqueId;if(!B)break;const R=o.typeOfNodes[B];if(!R||!R.subtree)break;o.openedNodeGroupStack=[...o.openedNodeGroupStack||[],{nodeType:B,nodeId:C,previousViewport:o.viewport}]}else{const C=t.payload.nodeType,H=o.typeOfNodes[C];if(!H||!H.subtree)break;o.openedNodeGroupStack=[{nodeType:C,previousViewport:o.openedNodeGroupStack?.[0]?.previousViewport||o.viewport}]}o.viewport=void 0;break;case st.CLOSE_NODE_GROUP:const k=o.openedNodeGroupStack?.[o.openedNodeGroupStack.length-1];k&&"previousViewport"in k&&(o.viewport=k.previousViewport),o.openedNodeGroupStack=o.openedNodeGroupStack?.slice(0,-1);break;case st.ADD_NODE_GROUP:const M=un(Ti),D=un(Ti),V=xi(o.dataTypes,Ni.groupInput,o.typeOfNodes,D,{x:-500,y:0}),K=un(Ti),Z=xi(o.dataTypes,Ni.groupOutput,o.typeOfNodes,K,{x:500,y:0}),q={name:"Node Group "+(Object.keys(o.typeOfNodes).filter(C=>o.typeOfNodes[C].subtree).length+1).toString(),headerColor:"#344621",inputs:[],outputs:[],subtree:{nodes:[V,Z],edges:[],numberOfReferences:0,inputNodeId:D,outputNodeId:K}};o.typeOfNodes[M]=q,o.openedNodeGroupStack=[{nodeType:M,previousViewport:o.openedNodeGroupStack?.[0]?.previousViewport||o.viewport}],o.viewport=void 0;break;case st.SET_VIEWPORT:o.viewport=t.payload.viewport;break}})}function Rn(e,t,n=!0,o=!0){if(n){const s=t?.inputs instanceof Array?t?.inputs:[],l=Pr(s,"input").find(({value:c})=>c?.id===e);if(l)return l}if(o){const s=t?.outputs instanceof Array?t?.outputs:[],l=Pr(s,"output").find(({value:c})=>c?.id===e);if(l)return l}}function gn(e,t){if(!e)return;const n=e.type==="input"?t.inputs:t.outputs;if(!n)return;const s=Pr(n,e.type,{index1:e.index1,index2:e.index2}).next();return s.value&&s.value.handleIndices.index1===e.index1&&s.value.handleIndices.index2===e.index2?s.value:{value:void 0,handleIndices:e,parentArray:n,parentArrayIndex:s.value.parentArrayIndex}}function Dm(e,t=!0,n=!0){let o=[],s=[];return t&&e.inputs&&(o=Array.from(Pr(e.inputs,"input"))),n&&e.outputs&&(s=Array.from(Pr(e.outputs,"output"))),{inputsAndIndices:o,outputsAndIndices:s}}const tu=z.forwardRef(({id:e,sourceX:t,sourceY:n,targetX:o,targetY:s,sourcePosition:a,targetPosition:l,...c},f)=>{const[d]=qs({sourceX:t,sourceY:n,sourcePosition:a,targetX:o,targetY:s,targetPosition:l}),h=je(),[g,p]=z.useState(!0),m=z.useRef(null);z.useEffect(()=>{const M=h.getState().domNode;if(!M)return;const D=document.getElementById(e);if(!D)return;const V=new IntersectionObserver(K=>{const Z=K.find(U=>U.target.id===e);Z&&p(U=>Z.isIntersecting)},{root:M,threshold:1,rootMargin:"20px"});return V.observe(D),m.current=V,()=>{m.current&&(m.current.disconnect(),m.current=null)}},[h.getState().domNode]);const x=Yc(c.source||""),v=z.useMemo(()=>!c.source||!x?void 0:Rn(c.sourceHandleId||"",x?.data)?.value?.handleColor??"#A1A1A1",[c.source,x]),b=Yc(c.target||""),_=z.useMemo(()=>!c.target||!b?void 0:Rn(c.targetHandleId||"",b?.data)?.value?.handleColor??"#A1A1A1",[c.target,b]),{label:N,labelStyle:w,markerStart:E,markerEnd:O,interactionWidth:k}=c;return T.jsxs(T.Fragment,{children:[T.jsx("defs",{children:T.jsxs("linearGradient",{id:`linear-gradient-edge-${e}`,x1:t,y1:n,x2:o,y2:s,gradientUnits:"userSpaceOnUse",children:[T.jsx("stop",{stopColor:v,offset:"0"}),T.jsx("stop",{stopColor:_,offset:"1"})]})}),T.jsx(co,{id:e,path:d,label:N,labelStyle:w,markerEnd:O,markerStart:E,interactionWidth:k,className:Ne("!stroke-7 in-[g.selected]:brightness-150",!g&&"opacity-25"),style:{stroke:`url(#${`linear-gradient-edge-${e}`})`},focusable:!0})]})});tu.displayName="ConfigurableEdge";function Lm(e,t,n=!0,o=!1){const s=e!==null?"current"in e?e.current:e:null,a=z.useCallback(l=>{if(!s)return;let c=!0;if(n&&l.target instanceof Node&&!s.contains(l.target))c=!1;else if(o){const f="clientX"in l?{x:l.clientX,y:l.clientY}:{x:l.touches[0].clientX,y:l.touches[0].clientY},d=s.getBoundingClientRect();dh(f,d)||(c=!1)}c||t()},[s,t,n,o]);z.useEffect(()=>(document.addEventListener("mousedown",a),document.addEventListener("touchstart",a),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a)}),[s,a])}const Ai=z.forwardRef(({placeholder:e="Input",className:t,...n},o)=>{const s=z.useMemo(()=>n.allowOnlyNumbers&&n.value!==void 0?Yl(n.value,n.numberOfDecimals??5):n.value?.toString(),[n.value,n.allowOnlyNumbers,n.numberOfDecimals]),[a,l]=z.useState(s??""),[c,f]=z.useState(null),d=n.value??a,[h,g]=z.useState(d.toString());function p(x){n.allowOnlyNumbers&&/[^0-9\.\-]/.test(x)||g(x)}function m(){if(n.allowOnlyNumbers){const x=hh(h||d.toString()),v=Yl(x,n.numberOfDecimals??5);l(v),n.onChange?.(x),g(v)}else l(h),n.onChange?.(h),g(h)}return Lm(c,()=>m()),T.jsx("input",{type:"text",className:Ne("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:x=>{f(x),typeof o=="function"?o(x):o&&(o.current=x)},value:h,onChange:x=>p(x.target.value),onKeyDown:x=>{x.key==="Enter"&&m()},onMouseMove:x=>{x.preventDefault(),x.stopPropagation()},onBlur:x=>{x.preventDefault(),x.stopPropagation(),m()}})});Ai.displayName="Input";function $m({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:s,lineStyle:a,color:l,minWidth:c=10,minHeight:f=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:g=!1,autoScale:p=!0,shouldResize:m,onResizeStart:x,onResize:v,onResizeEnd:b,linePosition:_=["left","right"],handlePosition:N=[],resizeDirection:w="horizontal"}){return t?T.jsxs(T.Fragment,{children:[_.map(E=>T.jsx(bm,{className:Ne("!border-none",E==="left"||E==="right"?"!w-4":"!h-4",s),style:a,nodeId:e,position:E,variant:Ar.Line,color:l,minWidth:c,minHeight:f,maxWidth:d,maxHeight:h,onResizeStart:x,keepAspectRatio:g,autoScale:p,shouldResize:m,onResize:v,onResizeEnd:b,resizeDirection:w},E)),N.map(E=>T.jsx(bm,{className:n,style:o,nodeId:e,position:E,color:l,minWidth:c,minHeight:f,maxWidth:d,maxHeight:h,onResizeStart:x,keepAspectRatio:g,autoScale:p,shouldResize:m,onResize:v,onResizeEnd:b,resizeDirection:w},E))]}):null}/**
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const Ei=Ye("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
88
63
  * @license lucide-react v0.542.0 - ISC
89
64
  *
90
65
  * This source code is licensed under the ISC license.
91
66
  * See the LICENSE file in the root directory of this source tree.
92
- */const GT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),YT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),Bm=e=>{const t=YT(e);return t.charAt(0).toUpperCase()+t.slice(1)},Fm=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),XT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
67
+ */const iu=Ye("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
93
68
  * @license lucide-react v0.542.0 - ISC
94
69
  *
95
70
  * This source code is licensed under the ISC license.
96
71
  * See the LICENSE file in the root directory of this source tree.
97
- */var qT={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"};/**
72
+ */const zr=Ye("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
98
73
  * @license lucide-react v0.542.0 - ISC
99
74
  *
100
75
  * This source code is licensed under the ISC license.
101
76
  * See the LICENSE file in the root directory of this source tree.
102
- */const KT=z.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:l,...c},f)=>z.createElement("svg",{ref:f,...qT,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Fm("lucide",s),...!a&&!XT(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,h])=>z.createElement(d,h)),...Array.isArray(a)?a:[a]]));/**
77
+ */const su=Ye("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
103
78
  * @license lucide-react v0.542.0 - ISC
104
79
  *
105
80
  * This source code is licensed under the ISC license.
106
81
  * See the LICENSE file in the root directory of this source tree.
107
- */const nr=(e,t)=>{const n=z.forwardRef(({className:o,...s},a)=>z.createElement(KT,{ref:a,iconNode:t,className:Fm(`lucide-${GT(Bm(e))}`,`lucide-${e}`,o),...s}));return n.displayName=Bm(e),n};/**
82
+ */const O_=Ye("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
108
83
  * @license lucide-react v0.542.0 - ISC
109
84
  *
110
85
  * This source code is licensed under the ISC license.
111
86
  * See the LICENSE file in the root directory of this source tree.
112
- */const ZT=nr("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
87
+ */const P_=Ye("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
113
88
  * @license lucide-react v0.542.0 - ISC
114
89
  *
115
90
  * This source code is licensed under the ISC license.
116
91
  * See the LICENSE file in the root directory of this source tree.
117
- */const QT=nr("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
92
+ */const R_=Ye("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
118
93
  * @license lucide-react v0.542.0 - ISC
119
94
  *
120
95
  * This source code is licensed under the ISC license.
121
96
  * See the LICENSE file in the root directory of this source tree.
122
- */const aa=nr("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
97
+ */const Kh=Ye("file-input",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
123
98
  * @license lucide-react v0.542.0 - ISC
124
99
  *
125
100
  * This source code is licensed under the ISC license.
126
101
  * See the LICENSE file in the root directory of this source tree.
127
- */const Hm=nr("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
102
+ */const Zh=Ye("file-output",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/**
128
103
  * @license lucide-react v0.542.0 - ISC
129
104
  *
130
105
  * This source code is licensed under the ISC license.
131
106
  * See the LICENSE file in the root directory of this source tree.
132
- */const la=nr("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
107
+ */const L_=Ye("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
133
108
  * @license lucide-react v0.542.0 - ISC
134
109
  *
135
110
  * This source code is licensed under the ISC license.
136
111
  * See the LICENSE file in the root directory of this source tree.
137
- */const nu=nr("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
112
+ */const D_=Ye("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
138
113
  * @license lucide-react v0.542.0 - ISC
139
114
  *
140
115
  * This source code is licensed under the ISC license.
141
116
  * See the LICENSE file in the root directory of this source tree.
142
- */const zm=nr("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
117
+ */const j_=Ye("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/**
143
118
  * @license lucide-react v0.542.0 - ISC
144
119
  *
145
120
  * This source code is licensed under the ISC license.
146
121
  * See the LICENSE file in the root directory of this source tree.
147
- */const Vm=nr("square-mouse-pointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]),ru=z.forwardRef(({children:e,orientation:t="horizontal",className:n,scrollAreaClassName:o,showArrows:s=!0,disabled:a=!1,ariaLabel:l,scrollSpeedPxPerFrame:c=14,observeChildren:f=!0},d)=>{const h=z.useRef(null),[g,p]=z.useState(!1),[m,x]=z.useState(!1),v=z.useRef(null),b=z.useRef(null);z.useImperativeHandle(d,()=>h.current);const _=z.useCallback(()=>t==="vertical"?{pos:"scrollTop",size:"clientHeight",full:"scrollHeight"}:{pos:"scrollLeft",size:"clientWidth",full:"scrollWidth"},[t]),N=z.useCallback(()=>{const V=h.current;if(!V||a){p(!1),x(!1);return}const K=_(),Z=V[K.pos],U=V[K.size],q=V[K.full];p(Z>0),x(Z+U<q-1)},[a,_]),w=z.useCallback(()=>{v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),b.current=null},[]),E=z.useCallback(()=>{const V=h.current;if(!V||!b.current||a){w();return}const K=_(),Z=b.current==="start"?-1:1;if(K.pos==="scrollLeft"?V.scrollLeft+=Z*c:V.scrollTop+=Z*c,N(),Z<0&&!g||Z>0&&!m){w();return}v.current=requestAnimationFrame(E)},[m,g,a,_,c,w,N]),O=z.useCallback(V=>{a||b.current!==V&&(b.current=V,v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(E))},[a,E]);z.useEffect(()=>{N();const V=h.current;if(!V)return;const K=()=>N();V.addEventListener("scroll",K,{passive:!0});let Z=null;"ResizeObserver"in window&&(Z=new ResizeObserver(()=>N()),Z.observe(V));const U=()=>N();window.addEventListener("resize",U);const q=()=>w();return window.addEventListener("pointerup",q),window.addEventListener("touchend",q),()=>{V.removeEventListener("scroll",K),window.removeEventListener("resize",U),window.removeEventListener("pointerup",q),window.removeEventListener("touchend",q),Z&&Z.disconnect()}},[N]),z.useEffect(()=>{const V=requestAnimationFrame(N);return()=>cancelAnimationFrame(V)},[e,N]),z.useEffect(()=>{if(!f)return;const V=h.current;if(!V)return;const K=new MutationObserver(()=>N());return K.observe(V,{childList:!0,subtree:!0}),()=>K.disconnect()},[f,N]);const k=s&&g&&!a,M=s&&m&&!a,D=t==="horizontal"?"overflow-x-scroll overflow-y-hidden flex items-center gap-2 whitespace-nowrap":"overflow-y-scroll overflow-x-hidden flex flex-col items-start gap-2";return T.jsxs("div",{className:Ne("relative w-full h-full",n),children:[k&&T.jsx(An,{className:Ne("h-[44px] border-secondary-dark-gray bg-primary-black absolute z-10",t==="horizontal"?"left-0 top-1/2 -translate-y-1/2":"top-0 left-1/2 -translate-x-1/2"),disabled:!k,onMouseDown:()=>O("start"),onMouseUp:w,onMouseLeave:w,onTouchStart:()=>O("start"),onTouchEnd:w,children:t==="horizontal"?T.jsx(Hm,{}):T.jsx(nu,{})}),T.jsx("div",{ref:h,"aria-label":l,className:Ne("no-scrollbar w-full h-full",D,o),children:e}),M&&T.jsx(An,{className:Ne("h-[44px] border-secondary-dark-gray bg-primary-black absolute z-10",t==="horizontal"?"right-0 top-1/2 -translate-y-1/2":"bottom-0 left-1/2 -translate-x-1/2"),disabled:!M,onMouseDown:()=>O("end"),onMouseUp:w,onMouseLeave:w,onTouchStart:()=>O("end"),onTouchEnd:w,children:t==="horizontal"?T.jsx(la,{}):T.jsx(aa,{})})]})});ru.displayName="ScrollableButtonContainer";function Wm({onMove:e,onClick:t,clickThreshold:n=2,enabled:o=!0,preventDefaultAndStopPropagation:s=!0}={}){const[a,l]=z.useState(!1),[c,f]=z.useState(null),d=z.useRef(null),h=z.useRef(null),g=z.useCallback(p=>{f(p)},[]);return z.useEffect(()=>{if(!c||!o)return;const p=m=>{s&&(m.preventDefault(),m.stopPropagation()),d.current={x:m.clientX,y:m.clientY},h.current={width:c.clientWidth,height:c.clientHeight},l(!0);const x=b=>{s&&(b.preventDefault(),b.stopPropagation()),document.removeEventListener("mouseup",x),document.removeEventListener("mousemove",v),l(!1),d.current&&Math.sqrt((b.clientX-d.current.x)**2+(b.clientY-d.current.y)**2)<n&&t?.()},v=b=>{s&&(b.preventDefault(),b.stopPropagation());const _=b.movementX,N=b.movementY,w=h.current?.width||1,E=h.current?.height||1,O=_/w,k=N/E;e?.(_,N,O,k,w,E)};document.addEventListener("mouseup",x),document.addEventListener("mousemove",v)};return c.addEventListener("mousedown",p),()=>{c.removeEventListener("mousedown",p)}},[c,o,e,t,n,s]),{isDragging:a,dragRef:g}}const ca=z.forwardRef(({name:e="Input",value:t,onChange:n=()=>{},className:o,min:s,max:a,step:l},c)=>{const[f,d]=z.useState(t??0),[h,g]=z.useState(!1),p=z.useRef(0),m=z.useRef(0),x=t??f,v=z.useRef(0);z.useEffect(()=>{v.current=Math.abs(l??parseFloat(a===void 0||s===void 0?(x||1).toString():(a-s).toString()))},[x,l,a,s]);const{isDragging:b,dragRef:_}=Wm({onMove:(K,Z,U,q,C)=>{const H=K/(C+60);p.current+=H,Math.abs(p.current)>.05&&Date.now()-m.current>50&&(m.current=Date.now(),N(v.current*p.current),p.current=0)},onClick:O,clickThreshold:2});function N(K){d(Z=>{let U=Z+K;return s!==void 0&&U<=s?U=s:a!==void 0&&U>=a&&(U=a),n(U),U})}function w(K=.1){N(v.current*K)}function E(K=.1){N(-v.current*K)}function O(){g(!0)}function k(K){N(K-x),g(!1)}const M=b,D=s!==void 0&&a!==void 0&&x!==void 0&&a!==s?(x-s)/(a-s)*100:-1,V=D!==-1?`linear-gradient(90deg,#4772b3 ${D}%, #545454 ${D}%)`:"";return h?T.jsx(Ai,{className:"w-full",placeholder:e,value:x,allowOnlyNumbers:!0,onChange:K=>k(K),ref:c}):T.jsxs("div",{className:Ne("flex items-center gap-0 group/lightParentGroupBasedHover w-max rounded-md bg-primary-gray",o),style:V!==""?{background:V}:{},ref:c,children:[T.jsx(An,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-r-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>E(.1),"aria-label":`Decrement ${e}`,applyHoverStyles:!M,children:T.jsx(Hm,{})}),T.jsxs(An,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-none pl-1.5 pr-0 flex-1 justify-between grid grid-cols-[repeat(2,auto)] bg-transparent",applyHoverStyles:!M,ref:_,children:[T.jsx("span",{className:"truncate text-left",children:e}),T.jsx("span",{className:"truncate",children:x.toFixed(4)})]}),T.jsx(An,{color:"lightParentGroupBasedHover",className:"h-[44px] rounded-l-none w-[30px] p-0 shrink-0 bg-transparent",onClick:()=>w(.1),"aria-label":`Increment ${e}`,applyHoverStyles:!M,children:T.jsx(la,{})})]})});ca.displayName="SliderNumberInput";function ua(){return typeof window<"u"}function uo(e){return jm(e)?(e.nodeName||"").toLowerCase():"#document"}function kt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mn(e){var t;return(t=(jm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jm(e){return ua()?e instanceof Node||e instanceof kt(e).Node:!1}function Ue(e){return ua()?e instanceof Element||e instanceof kt(e).Element:!1}function en(e){return ua()?e instanceof HTMLElement||e instanceof kt(e).HTMLElement:!1}function fa(e){return!ua()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof kt(e).ShadowRoot}const JT=new Set(["inline","contents"]);function Ii(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!JT.has(s)}const eA=new Set(["table","td","th"]);function tA(e){return eA.has(uo(e))}const nA=[":popover-open",":modal"];function da(e){return nA.some(t=>{try{return e.matches(t)}catch{return!1}})}const rA=["transform","translate","scale","rotate","perspective"],oA=["transform","translate","scale","rotate","perspective","filter"],iA=["paint","layout","strict","content"];function ou(e){const t=ha(),n=Ue(e)?zt(e):e;return rA.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)||oA.some(o=>(n.willChange||"").includes(o))||iA.some(o=>(n.contain||"").includes(o))}function sA(e){let t=Ln(e);for(;en(t)&&!Dn(t);){if(ou(t))return t;if(da(t))return null;t=Ln(t)}return null}function ha(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const aA=new Set(["html","body","#document"]);function Dn(e){return aA.has(uo(e))}function zt(e){return kt(e).getComputedStyle(e)}function pa(e){return Ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ln(e){if(uo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fa(e)&&e.host||mn(e);return fa(t)?t.host:t}function Um(e){const t=Ln(e);return Dn(t)?e.ownerDocument?e.ownerDocument.body:e.body:en(t)&&Ii(t)?t:Um(t)}function rr(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Um(e),a=s===((o=e.ownerDocument)==null?void 0:o.body),l=kt(s);if(a){const c=iu(l);return t.concat(l,l.visualViewport||[],Ii(s)?s:[],c&&n?rr(c):[])}return t.concat(s,rr(s,[],n))}function iu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const lA=["top","right","bottom","left"],or=Math.min,Mt=Math.max,ga=Math.round,ma=Math.floor,yn=e=>({x:e,y:e}),cA={left:"right",right:"left",bottom:"top",top:"bottom"},uA={start:"end",end:"start"};function su(e,t,n){return Mt(e,or(t,n))}function $n(e,t){return typeof e=="function"?e(t):e}function Bn(e){return e.split("-")[0]}function fo(e){return e.split("-")[1]}function au(e){return e==="x"?"y":"x"}function lu(e){return e==="y"?"height":"width"}const fA=new Set(["top","bottom"]);function vn(e){return fA.has(Bn(e))?"y":"x"}function cu(e){return au(vn(e))}function dA(e,t,n){n===void 0&&(n=!1);const o=fo(e),s=cu(e),a=lu(s);let l=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=ya(l)),[l,ya(l)]}function hA(e){const t=ya(e);return[uu(e),t,uu(t)]}function uu(e){return e.replace(/start|end/g,t=>uA[t])}const Gm=["left","right"],Ym=["right","left"],pA=["top","bottom"],gA=["bottom","top"];function mA(e,t,n){switch(e){case"top":case"bottom":return n?t?Ym:Gm:t?Gm:Ym;case"left":case"right":return t?pA:gA;default:return[]}}function yA(e,t,n,o){const s=fo(e);let a=mA(Bn(e),n==="start",o);return s&&(a=a.map(l=>l+"-"+s),t&&(a=a.concat(a.map(uu)))),a}function ya(e){return e.replace(/left|right|bottom|top/g,t=>cA[t])}function vA(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xm(e){return typeof e!="number"?vA(e):{top:e,right:e,bottom:e,left:e}}function va(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function fu(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&fa(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Oi(e){return"composedPath"in e?e.composedPath()[0]:e.target}function du(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 xA(e){return e.matches("html,body")}function ho(e){return e?.ownerDocument||document}function xa(e,t,n){return n===void 0&&(n=!0),e.filter(s=>{var a;return s.parentId===t&&(!n||((a=s.context)==null?void 0:a.open))}).flatMap(s=>[s,...xa(e,s.id,n)])}function wA(e){return"nativeEvent"in e}function hu(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var bA=typeof document<"u",_A=function(){},po=bA?z.useLayoutEffect:_A;const SA={...L};function wa(e){const t=L.useRef(e);return po(()=>{t.current=e}),t}const EA=SA.useInsertionEffect||(e=>e());function xn(e){const t=L.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return EA(()=>{t.current=e}),L.useCallback(function(){for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return t.current==null?void 0:t.current(...o)},[])}function qm(e,t,n){let{reference:o,floating:s}=e;const a=vn(t),l=cu(t),c=lu(l),f=Bn(t),d=a==="y",h=o.x+o.width/2-s.width/2,g=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let m;switch(f){case"top":m={x:h,y:o.y-s.height};break;case"bottom":m={x:h,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:g};break;case"left":m={x:o.x-s.width,y:g};break;default:m={x:o.x,y:o.y}}switch(fo(t)){case"start":m[l]-=p*(n&&d?-1:1);break;case"end":m[l]+=p*(n&&d?-1:1);break}return m}const CA=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,c=a.filter(Boolean),f=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:g}=qm(d,o,f),p=o,m={},x=0;for(let v=0;v<c.length;v++){const{name:b,fn:_}=c[v],{x:N,y:w,data:E,reset:O}=await _({x:h,y:g,initialPlacement:o,placement:p,strategy:s,middlewareData:m,rects:d,platform:l,elements:{reference:e,floating:t}});h=N??h,g=w??g,m={...m,[b]:{...m[b],...E}},O&&x<=50&&(x++,typeof O=="object"&&(O.placement&&(p=O.placement),O.rects&&(d=O.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):O.rects),{x:h,y:g}=qm(d,p,f)),v=-1)}return{x:h,y:g,placement:p,strategy:s,middlewareData:m}};async function Pi(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:a,rects:l,elements:c,strategy:f}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:p=!1,padding:m=0}=$n(t,e),x=Xm(m),b=c[p?g==="floating"?"reference":"floating":g],_=va(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:d,rootBoundary:h,strategy:f})),N=g==="floating"?{x:o,y:s,width:l.floating.width,height:l.floating.height}:l.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),E=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},O=va(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:w,strategy:f}):N);return{top:(_.top-O.top+x.top)/E.y,bottom:(O.bottom-_.bottom+x.bottom)/E.y,left:(_.left-O.left+x.left)/E.x,right:(O.right-_.right+x.right)/E.x}}const NA=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:a,platform:l,elements:c,middlewareData:f}=t,{element:d,padding:h=0}=$n(e,t)||{};if(d==null)return{};const g=Xm(h),p={x:n,y:o},m=cu(s),x=lu(m),v=await l.getDimensions(d),b=m==="y",_=b?"top":"left",N=b?"bottom":"right",w=b?"clientHeight":"clientWidth",E=a.reference[x]+a.reference[m]-p[m]-a.floating[x],O=p[m]-a.reference[m],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let M=k?k[w]:0;(!M||!await(l.isElement==null?void 0:l.isElement(k)))&&(M=c.floating[w]||a.floating[x]);const D=E/2-O/2,V=M/2-v[x]/2-1,K=or(g[_],V),Z=or(g[N],V),U=K,q=M-v[x]-Z,C=M/2-v[x]/2+D,H=su(U,C,q),B=!f.arrow&&fo(s)!=null&&C!==H&&a.reference[x]/2-(C<U?K:Z)-v[x]/2<0,R=B?C<U?C-U:C-q:0;return{[m]:p[m]+R,data:{[m]:H,centerOffset:C-H-R,...B&&{alignmentOffset:R}},reset:B}}}),TA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:a,rects:l,initialPlacement:c,platform:f,elements:d}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...b}=$n(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const _=Bn(s),N=vn(c),w=Bn(c)===c,E=await(f.isRTL==null?void 0:f.isRTL(d.floating)),O=p||(w||!v?[ya(c)]:hA(c)),k=x!=="none";!p&&k&&O.push(...yA(c,v,x,E));const M=[c,...O],D=await Pi(t,b),V=[];let K=((o=a.flip)==null?void 0:o.overflows)||[];if(h&&V.push(D[_]),g){const C=dA(s,l,E);V.push(D[C[0]],D[C[1]])}if(K=[...K,{placement:s,overflows:V}],!V.every(C=>C<=0)){var Z,U;const C=(((Z=a.flip)==null?void 0:Z.index)||0)+1,H=M[C];if(H&&(!(g==="alignment"?N!==vn(H):!1)||K.every(P=>vn(P.placement)===N?P.overflows[0]>0:!0)))return{data:{index:C,overflows:K},reset:{placement:H}};let B=(U=K.filter(R=>R.overflows[0]<=0).sort((R,P)=>R.overflows[1]-P.overflows[1])[0])==null?void 0:U.placement;if(!B)switch(m){case"bestFit":{var q;const R=(q=K.filter(P=>{if(k){const W=vn(P.placement);return W===N||W==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(W=>W>0).reduce((W,$)=>W+$,0)]).sort((P,W)=>P[1]-W[1])[0])==null?void 0:q[0];R&&(B=R);break}case"initialPlacement":B=c;break}if(s!==B)return{reset:{placement:B}}}return{}}}};function Km(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zm(e){return lA.some(t=>e[t]>=0)}const AA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...s}=$n(e,t);switch(o){case"referenceHidden":{const a=await Pi(t,{...s,elementContext:"reference"}),l=Km(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Zm(l)}}}case"escaped":{const a=await Pi(t,{...s,altBoundary:!0}),l=Km(a,n.floating);return{data:{escapedOffsets:l,escaped:Zm(l)}}}default:return{}}}}},Qm=new Set(["left","top"]);async function IA(e,t){const{placement:n,platform:o,elements:s}=e,a=await(o.isRTL==null?void 0:o.isRTL(s.floating)),l=Bn(n),c=fo(n),f=vn(n)==="y",d=Qm.has(l)?-1:1,h=a&&f?-1:1,g=$n(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return c&&typeof x=="number"&&(m=c==="end"?x*-1:x),f?{x:m*h,y:p*d}:{x:p*d,y:m*h}}const OA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:a,placement:l,middlewareData:c}=t,f=await IA(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+f.x,y:a+f.y,data:{...f,placement:l}}}}},PA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:_,y:N}=b;return{x:_,y:N}}},...f}=$n(e,t),d={x:n,y:o},h=await Pi(t,f),g=vn(Bn(s)),p=au(g);let m=d[p],x=d[g];if(a){const b=p==="y"?"top":"left",_=p==="y"?"bottom":"right",N=m+h[b],w=m-h[_];m=su(N,m,w)}if(l){const b=g==="y"?"top":"left",_=g==="y"?"bottom":"right",N=x+h[b],w=x-h[_];x=su(N,x,w)}const v=c.fn({...t,[p]:m,[g]:x});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[p]:a,[g]:l}}}}}},kA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:d=!0}=$n(e,t),h={x:n,y:o},g=vn(s),p=au(g);let m=h[p],x=h[g];const v=$n(c,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(f){const w=p==="y"?"height":"width",E=a.reference[p]-a.floating[w]+b.mainAxis,O=a.reference[p]+a.reference[w]-b.mainAxis;m<E?m=E:m>O&&(m=O)}if(d){var _,N;const w=p==="y"?"width":"height",E=Qm.has(Bn(s)),O=a.reference[g]-a.floating[w]+(E&&((_=l.offset)==null?void 0:_[g])||0)+(E?0:b.crossAxis),k=a.reference[g]+a.reference[w]+(E?0:((N=l.offset)==null?void 0:N[g])||0)-(E?b.crossAxis:0);x<O?x=O:x>k&&(x=k)}return{[p]:m,[g]:x}}}},MA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:a,platform:l,elements:c}=t,{apply:f=()=>{},...d}=$n(e,t),h=await Pi(t,d),g=Bn(s),p=fo(s),m=vn(s)==="y",{width:x,height:v}=a.floating;let b,_;g==="top"||g==="bottom"?(b=g,_=p===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(_=g,b=p==="end"?"top":"bottom");const N=v-h.top-h.bottom,w=x-h.left-h.right,E=or(v-h[b],N),O=or(x-h[_],w),k=!t.middlewareData.shift;let M=E,D=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(M=N),k&&!p){const K=Mt(h.left,0),Z=Mt(h.right,0),U=Mt(h.top,0),q=Mt(h.bottom,0);m?D=x-2*(K!==0||Z!==0?K+Z:Mt(h.left,h.right)):M=v-2*(U!==0||q!==0?U+q:Mt(h.top,h.bottom))}await f({...t,availableWidth:D,availableHeight:M});const V=await l.getDimensions(c.floating);return x!==V.width||v!==V.height?{reset:{rects:!0}}:{}}}};function Jm(e){const t=zt(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=en(e),a=s?e.offsetWidth:n,l=s?e.offsetHeight:o,c=ga(n)!==a||ga(o)!==l;return c&&(n=a,o=l),{width:n,height:o,$:c}}function pu(e){return Ue(e)?e:e.contextElement}function go(e){const t=pu(e);if(!en(t))return yn(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:a}=Jm(t);let l=(a?ga(n.width):n.width)/o,c=(a?ga(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const RA=yn(0);function ey(e){const t=kt(e);return!ha()||!t.visualViewport?RA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DA(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==kt(e)?!1:t}function kr(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=pu(e);let l=yn(1);t&&(o?Ue(o)&&(l=go(o)):l=go(e));const c=DA(a,n,o)?ey(a):yn(0);let f=(s.left+c.x)/l.x,d=(s.top+c.y)/l.y,h=s.width/l.x,g=s.height/l.y;if(a){const p=kt(a),m=o&&Ue(o)?kt(o):o;let x=p,v=iu(x);for(;v&&o&&m!==x;){const b=go(v),_=v.getBoundingClientRect(),N=zt(v),w=_.left+(v.clientLeft+parseFloat(N.paddingLeft))*b.x,E=_.top+(v.clientTop+parseFloat(N.paddingTop))*b.y;f*=b.x,d*=b.y,h*=b.x,g*=b.y,f+=w,d+=E,x=kt(v),v=iu(x)}}return va({width:h,height:g,x:f,y:d})}function ba(e,t){const n=pa(e).scrollLeft;return t?t.left+n:kr(mn(e)).left+n}function ty(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ba(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function LA(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const a=s==="fixed",l=mn(o),c=t?da(t.floating):!1;if(o===l||c&&a)return n;let f={scrollLeft:0,scrollTop:0},d=yn(1);const h=yn(0),g=en(o);if((g||!g&&!a)&&((uo(o)!=="body"||Ii(l))&&(f=pa(o)),en(o))){const m=kr(o);d=go(o),h.x=m.x+o.clientLeft,h.y=m.y+o.clientTop}const p=l&&!g&&!a?ty(l,f):yn(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-f.scrollLeft*d.x+h.x+p.x,y:n.y*d.y-f.scrollTop*d.y+h.y+p.y}}function $A(e){return Array.from(e.getClientRects())}function BA(e){const t=mn(e),n=pa(e),o=e.ownerDocument.body,s=Mt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=Mt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+ba(e);const c=-n.scrollTop;return zt(o).direction==="rtl"&&(l+=Mt(t.clientWidth,o.clientWidth)-s),{width:s,height:a,x:l,y:c}}const ny=25;function FA(e,t){const n=kt(e),o=mn(e),s=n.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,f=0;if(s){a=s.width,l=s.height;const h=ha();(!h||h&&t==="fixed")&&(c=s.offsetLeft,f=s.offsetTop)}const d=ba(o);if(d<=0){const h=o.ownerDocument,g=h.body,p=getComputedStyle(g),m=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(o.clientWidth-g.clientWidth-m);x<=ny&&(a-=x)}else d<=ny&&(a+=d);return{width:a,height:l,x:c,y:f}}const HA=new Set(["absolute","fixed"]);function zA(e,t){const n=kr(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,a=en(e)?go(e):yn(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,f=s*a.x,d=o*a.y;return{width:l,height:c,x:f,y:d}}function ry(e,t,n){let o;if(t==="viewport")o=FA(e,n);else if(t==="document")o=BA(mn(e));else if(Ue(t))o=zA(t,n);else{const s=ey(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return va(o)}function oy(e,t){const n=Ln(e);return n===t||!Ue(n)||Dn(n)?!1:zt(n).position==="fixed"||oy(n,t)}function VA(e,t){const n=t.get(e);if(n)return n;let o=rr(e,[],!1).filter(c=>Ue(c)&&uo(c)!=="body"),s=null;const a=zt(e).position==="fixed";let l=a?Ln(e):e;for(;Ue(l)&&!Dn(l);){const c=zt(l),f=ou(l);!f&&c.position==="fixed"&&(s=null),(a?!f&&!s:!f&&c.position==="static"&&!!s&&HA.has(s.position)||Ii(l)&&!f&&oy(e,l))?o=o.filter(h=>h!==l):s=c,l=Ln(l)}return t.set(e,o),o}function WA(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const l=[...n==="clippingAncestors"?da(t)?[]:VA(t,this._c):[].concat(n),o],c=l[0],f=l.reduce((d,h)=>{const g=ry(t,h,s);return d.top=Mt(g.top,d.top),d.right=or(g.right,d.right),d.bottom=or(g.bottom,d.bottom),d.left=Mt(g.left,d.left),d},ry(t,c,s));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function jA(e){const{width:t,height:n}=Jm(e);return{width:t,height:n}}function UA(e,t,n){const o=en(t),s=mn(t),a=n==="fixed",l=kr(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const f=yn(0);function d(){f.x=ba(s)}if(o||!o&&!a)if((uo(t)!=="body"||Ii(s))&&(c=pa(t)),o){const m=kr(t,!0,a,t);f.x=m.x+t.clientLeft,f.y=m.y+t.clientTop}else s&&d();a&&!o&&s&&d();const h=s&&!o&&!a?ty(s,c):yn(0),g=l.left+c.scrollLeft-f.x-h.x,p=l.top+c.scrollTop-f.y-h.y;return{x:g,y:p,width:l.width,height:l.height}}function gu(e){return zt(e).position==="static"}function iy(e,t){if(!en(e)||zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mn(e)===n&&(n=n.ownerDocument.body),n}function sy(e,t){const n=kt(e);if(da(e))return n;if(!en(e)){let s=Ln(e);for(;s&&!Dn(s);){if(Ue(s)&&!gu(s))return s;s=Ln(s)}return n}let o=iy(e,t);for(;o&&tA(o)&&gu(o);)o=iy(o,t);return o&&Dn(o)&&gu(o)&&!ou(o)?n:o||sA(e)||n}const GA=async function(e){const t=this.getOffsetParent||sy,n=this.getDimensions,o=await n(e.floating);return{reference:UA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function YA(e){return zt(e).direction==="rtl"}const XA={convertOffsetParentRelativeRectToViewportRelativeRect:LA,getDocumentElement:mn,getClippingRect:WA,getOffsetParent:sy,getElementRects:GA,getClientRects:$A,getDimensions:jA,getScale:go,isElement:Ue,isRTL:YA};function ay(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qA(e,t){let n=null,o;const s=mn(e);function a(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function l(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),a();const d=e.getBoundingClientRect(),{left:h,top:g,width:p,height:m}=d;if(c||t(),!p||!m)return;const x=ma(g),v=ma(s.clientWidth-(h+p)),b=ma(s.clientHeight-(g+m)),_=ma(h),w={rootMargin:-x+"px "+-v+"px "+-b+"px "+-_+"px",threshold:Mt(0,or(1,f))||1};let E=!0;function O(k){const M=k[0].intersectionRatio;if(M!==f){if(!E)return l();M?l(!1,M):o=setTimeout(()=>{l(!1,1e-7)},1e3)}M===1&&!ay(d,e.getBoundingClientRect())&&l(),E=!1}try{n=new IntersectionObserver(O,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,w)}n.observe(e)}return l(!0),a}function mu(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,d=pu(e),h=s||a?[...d?rr(d):[],...rr(t)]:[];h.forEach(_=>{s&&_.addEventListener("scroll",n,{passive:!0}),a&&_.addEventListener("resize",n)});const g=d&&c?qA(d,n):null;let p=-1,m=null;l&&(m=new ResizeObserver(_=>{let[N]=_;N&&N.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),d&&!f&&m.observe(d),m.observe(t));let x,v=f?kr(e):null;f&&b();function b(){const _=kr(e);v&&!ay(v,_)&&n(),v=_,x=requestAnimationFrame(b)}return n(),()=>{var _;h.forEach(N=>{s&&N.removeEventListener("scroll",n),a&&N.removeEventListener("resize",n)}),g?.(),(_=m)==null||_.disconnect(),m=null,f&&cancelAnimationFrame(x)}}const KA=OA,ZA=PA,QA=TA,JA=MA,eI=AA,ly=NA,tI=kA,nI=(e,t,n)=>{const o=new Map,s={platform:XA,...n},a={...s.platform,_c:o};return CA(e,t,{...s,platform:a})};var rI=typeof document<"u",oI=function(){},_a=rI?z.useLayoutEffect:oI;function Sa(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,s;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(!Sa(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const a=s[o];if(!(a==="_owner"&&e.$$typeof)&&!Sa(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function cy(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uy(e,t){const n=cy(e);return Math.round(t*n)/n}function yu(e){const t=L.useRef(e);return _a(()=>{t.current=e}),t}function fy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:f,open:d}=e,[h,g]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=L.useState(o);Sa(p,o)||m(o);const[x,v]=L.useState(null),[b,_]=L.useState(null),N=L.useCallback(P=>{P!==k.current&&(k.current=P,v(P))},[]),w=L.useCallback(P=>{P!==M.current&&(M.current=P,_(P))},[]),E=a||x,O=l||b,k=L.useRef(null),M=L.useRef(null),D=L.useRef(h),V=f!=null,K=yu(f),Z=yu(s),U=yu(d),q=L.useCallback(()=>{if(!k.current||!M.current)return;const P={placement:t,strategy:n,middleware:p};Z.current&&(P.platform=Z.current),nI(k.current,M.current,P).then(W=>{const $={...W,isPositioned:U.current!==!1};C.current&&!Sa(D.current,$)&&(D.current=$,cs.flushSync(()=>{g($)}))})},[p,t,n,Z,U]);_a(()=>{d===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,g(P=>({...P,isPositioned:!1})))},[d]);const C=L.useRef(!1);_a(()=>(C.current=!0,()=>{C.current=!1}),[]),_a(()=>{if(E&&(k.current=E),O&&(M.current=O),E&&O){if(K.current)return K.current(E,O,q);q()}},[E,O,q,K,V]);const H=L.useMemo(()=>({reference:k,floating:M,setReference:N,setFloating:w}),[N,w]),B=L.useMemo(()=>({reference:E,floating:O}),[E,O]),R=L.useMemo(()=>{const P={position:n,left:0,top:0};if(!B.floating)return P;const W=uy(B.floating,h.x),$=uy(B.floating,h.y);return c?{...P,transform:"translate("+W+"px, "+$+"px)",...cy(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:$}},[n,c,B.floating,h.x,h.y]);return L.useMemo(()=>({...h,update:q,refs:H,elements:B,floatingStyles:R}),[h,q,H,B,R])}const iI=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:s}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?ly({element:o.current,padding:s}).fn(n):{}:o?ly({element:o,padding:s}).fn(n):{}}}},vu=(e,t)=>({...KA(e),options:[e,t]}),xu=(e,t)=>({...ZA(e),options:[e,t]}),sI=(e,t)=>({...tI(e),options:[e,t]}),wu=(e,t)=>({...QA(e),options:[e,t]}),aI=(e,t)=>({...JA(e),options:[e,t]}),lI=(e,t)=>({...eI(e),options:[e,t]}),cI=(e,t)=>({...iI(e),options:[e,t]}),uI="data-floating-ui-focusable",dy="active",hy="selected",fI={...L};let py=!1,dI=0;const gy=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+dI++;function hI(){const[e,t]=L.useState(()=>py?gy():void 0);return po(()=>{e==null&&t(gy())},[]),L.useEffect(()=>{py=!0},[]),e}const pI=fI.useId||hI;let bu;process.env.NODE_ENV!=="production"&&(bu=new Set);function gI(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];const s="Floating UI: "+n.join(" ");if(!((e=bu)!=null&&e.has(s))){var a;(a=bu)==null||a.add(s),console.error(s)}}function mI(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(s=>s(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 yI=L.createContext(null),vI=L.createContext(null),my=()=>{var e;return((e=L.useContext(yI))==null?void 0:e.id)||null},_u=()=>L.useContext(vI);function yy(e){return"data-floating-ui-"+e}function Rt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const vy=yy("safe-polygon");function Su(e,t,n){if(n&&!hu(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 Eu(e){return typeof e=="function"?e():e}function xI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,dataRef:s,events:a,elements:l}=e,{enabled:c=!0,delay:f=0,handleClose:d=null,mouseOnly:h=!1,restMs:g=0,move:p=!0}=t,m=_u(),x=my(),v=wa(d),b=wa(f),_=wa(n),N=wa(g),w=L.useRef(),E=L.useRef(-1),O=L.useRef(),k=L.useRef(-1),M=L.useRef(!0),D=L.useRef(!1),V=L.useRef(()=>{}),K=L.useRef(!1),Z=xn(()=>{var R;const P=(R=s.current.openEvent)==null?void 0:R.type;return P?.includes("mouse")&&P!=="mousedown"});L.useEffect(()=>{if(!c)return;function R(P){let{open:W}=P;W||(Rt(E),Rt(k),M.current=!0,K.current=!1)}return a.on("openchange",R),()=>{a.off("openchange",R)}},[c,a]),L.useEffect(()=>{if(!c||!v.current||!n)return;function R(W){Z()&&o(!1,W,"hover")}const P=ho(l.floating).documentElement;return P.addEventListener("mouseleave",R),()=>{P.removeEventListener("mouseleave",R)}},[l.floating,n,o,c,v,Z]);const U=L.useCallback(function(R,P,W){P===void 0&&(P=!0),W===void 0&&(W="hover");const $=Su(b.current,"close",w.current);$&&!O.current?(Rt(E),E.current=window.setTimeout(()=>o(!1,R,W),$)):P&&(Rt(E),o(!1,R,W))},[b,o]),q=xn(()=>{V.current(),O.current=void 0}),C=xn(()=>{if(D.current){const R=ho(l.floating).body;R.style.pointerEvents="",R.removeAttribute(vy),D.current=!1}}),H=xn(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);L.useEffect(()=>{if(!c)return;function R(J){if(Rt(E),M.current=!1,h&&!hu(w.current)||Eu(N.current)>0&&!Su(b.current,"open"))return;const re=Su(b.current,"open",w.current);re?E.current=window.setTimeout(()=>{_.current||o(!0,J,"hover")},re):n||o(!0,J,"hover")}function P(J){if(H()){C();return}V.current();const re=ho(l.floating);if(Rt(k),K.current=!1,v.current&&s.current.floatingContext){n||Rt(E),O.current=v.current({...s.current.floatingContext,tree:m,x:J.clientX,y:J.clientY,onClose(){C(),q(),H()||U(J,!0,"safe-polygon")}});const ce=O.current;re.addEventListener("mousemove",ce),V.current=()=>{re.removeEventListener("mousemove",ce)};return}(w.current==="touch"?!fu(l.floating,J.relatedTarget):!0)&&U(J)}function W(J){H()||s.current.floatingContext&&(v.current==null||v.current({...s.current.floatingContext,tree:m,x:J.clientX,y:J.clientY,onClose(){C(),q(),H()||U(J)}})(J))}function $(){Rt(E)}function G(J){H()||U(J,!1)}if(Ue(l.domReference)){const J=l.domReference,re=l.floating;return n&&J.addEventListener("mouseleave",W),p&&J.addEventListener("mousemove",R,{once:!0}),J.addEventListener("mouseenter",R),J.addEventListener("mouseleave",P),re&&(re.addEventListener("mouseleave",W),re.addEventListener("mouseenter",$),re.addEventListener("mouseleave",G)),()=>{n&&J.removeEventListener("mouseleave",W),p&&J.removeEventListener("mousemove",R),J.removeEventListener("mouseenter",R),J.removeEventListener("mouseleave",P),re&&(re.removeEventListener("mouseleave",W),re.removeEventListener("mouseenter",$),re.removeEventListener("mouseleave",G))}}},[l,c,e,h,p,U,q,C,o,n,_,m,b,v,s,H,N]),po(()=>{var R;if(c&&n&&(R=v.current)!=null&&(R=R.__options)!=null&&R.blockPointerEvents&&Z()){D.current=!0;const W=l.floating;if(Ue(l.domReference)&&W){var P;const $=ho(l.floating).body;$.setAttribute(vy,"");const G=l.domReference,J=m==null||(P=m.nodesRef.current.find(re=>re.id===x))==null||(P=P.context)==null?void 0:P.elements.floating;return J&&(J.style.pointerEvents=""),$.style.pointerEvents="none",G.style.pointerEvents="auto",W.style.pointerEvents="auto",()=>{$.style.pointerEvents="",G.style.pointerEvents="",W.style.pointerEvents=""}}}},[c,n,x,l,m,v,Z]),po(()=>{n||(w.current=void 0,K.current=!1,q(),C())},[n,q,C]),L.useEffect(()=>()=>{q(),Rt(E),Rt(k),C()},[c,l.domReference,q,C]);const B=L.useMemo(()=>{function R(P){w.current=P.pointerType}return{onPointerDown:R,onPointerEnter:R,onMouseMove(P){const{nativeEvent:W}=P;function $(){!M.current&&!_.current&&o(!0,W,"hover")}h&&!hu(w.current)||n||Eu(N.current)===0||K.current&&P.movementX**2+P.movementY**2<2||(Rt(k),w.current==="touch"?$():(K.current=!0,k.current=window.setTimeout($,Eu(N.current))))}}},[h,o,n,_,N]);return L.useMemo(()=>c?{reference:B}:{},[c,B])}function Cu(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&fa(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function wI(e){return"composedPath"in e?e.composedPath()[0]:e.target}const bI={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},_I={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},xy=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 SI(e,t){t===void 0&&(t={});const{open:n,onOpenChange:o,elements:s,dataRef:a}=e,{enabled:l=!0,escapeKey:c=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:g="pointerdown",ancestorScroll:p=!1,bubbles:m,capture:x}=t,v=_u(),b=xn(typeof f=="function"?f:()=>!1),_=typeof f=="function"?b:f,N=L.useRef(!1),{escapeKey:w,outsidePress:E}=xy(m),{escapeKey:O,outsidePress:k}=xy(x),M=L.useRef(!1),D=xn(C=>{var H;if(!n||!l||!c||C.key!=="Escape"||M.current)return;const B=(H=a.current.floatingContext)==null?void 0:H.nodeId,R=v?xa(v.nodesRef.current,B):[];if(!w&&(C.stopPropagation(),R.length>0)){let P=!0;if(R.forEach(W=>{var $;if(($=W.context)!=null&&$.open&&!W.context.dataRef.current.__escapeKeyBubbles){P=!1;return}}),!P)return}o(!1,wA(C)?C.nativeEvent:C,"escape-key")}),V=xn(C=>{var H;const B=()=>{var R;D(C),(R=Oi(C))==null||R.removeEventListener("keydown",B)};(H=Oi(C))==null||H.addEventListener("keydown",B)}),K=xn(C=>{var H;const B=a.current.insideReactTree;a.current.insideReactTree=!1;const R=N.current;if(N.current=!1,d==="click"&&R||B||typeof _=="function"&&!_(C))return;const P=Oi(C),W="["+yy("inert")+"]",$=ho(s.floating).querySelectorAll(W);let G=Ue(P)?P:null;for(;G&&!Dn(G);){const ce=Ln(G);if(Dn(ce)||!Ue(ce))break;G=ce}if($.length&&Ue(P)&&!xA(P)&&!fu(P,s.floating)&&Array.from($).every(ce=>!fu(G,ce)))return;if(en(P)&&q){const ce=Dn(P),ge=zt(P),te=/auto|scroll/,Q=ce||te.test(ge.overflowX),ae=ce||te.test(ge.overflowY),fe=Q&&P.clientWidth>0&&P.scrollWidth>P.clientWidth,de=ae&&P.clientHeight>0&&P.scrollHeight>P.clientHeight,ue=ge.direction==="rtl",_e=de&&(ue?C.offsetX<=P.offsetWidth-P.clientWidth:C.offsetX>P.clientWidth),ye=fe&&C.offsetY>P.clientHeight;if(_e||ye)return}const J=(H=a.current.floatingContext)==null?void 0:H.nodeId,re=v&&xa(v.nodesRef.current,J).some(ce=>{var ge;return du(C,(ge=ce.context)==null?void 0:ge.elements.floating)});if(du(C,s.floating)||du(C,s.domReference)||re)return;const se=v?xa(v.nodesRef.current,J):[];if(se.length>0){let ce=!0;if(se.forEach(ge=>{var te;if((te=ge.context)!=null&&te.open&&!ge.context.dataRef.current.__outsidePressBubbles){ce=!1;return}}),!ce)return}o(!1,C,"outside-press")}),Z=xn(C=>{var H;const B=()=>{var R;K(C),(R=Oi(C))==null||R.removeEventListener(d,B)};(H=Oi(C))==null||H.addEventListener(d,B)});L.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=w,a.current.__outsidePressBubbles=E;let C=-1;function H($){o(!1,$,"ancestor-scroll")}function B(){window.clearTimeout(C),M.current=!0}function R(){C=window.setTimeout(()=>{M.current=!1},ha()?5:0)}const P=ho(s.floating);c&&(P.addEventListener("keydown",O?V:D,O),P.addEventListener("compositionstart",B),P.addEventListener("compositionend",R)),_&&P.addEventListener(d,k?Z:K,k);let W=[];return p&&(Ue(s.domReference)&&(W=rr(s.domReference)),Ue(s.floating)&&(W=W.concat(rr(s.floating))),!Ue(s.reference)&&s.reference&&s.reference.contextElement&&(W=W.concat(rr(s.reference.contextElement)))),W=W.filter($=>{var G;return $!==((G=P.defaultView)==null?void 0:G.visualViewport)}),W.forEach($=>{$.addEventListener("scroll",H,{passive:!0})}),()=>{c&&(P.removeEventListener("keydown",O?V:D,O),P.removeEventListener("compositionstart",B),P.removeEventListener("compositionend",R)),_&&P.removeEventListener(d,k?Z:K,k),W.forEach($=>{$.removeEventListener("scroll",H)}),window.clearTimeout(C)}},[a,s,c,_,d,n,o,p,l,w,E,D,O,V,K,k,Z]),L.useEffect(()=>{a.current.insideReactTree=!1},[a,_,d]);const U=L.useMemo(()=>({onKeyDown:D,...h&&{[bI[g]]:C=>{o(!1,C.nativeEvent,"reference-press")},...g!=="click"&&{onClick(C){o(!1,C.nativeEvent,"reference-press")}}}}),[D,o,h,g]),q=L.useMemo(()=>({onKeyDown:D,onMouseDown(){N.current=!0},onMouseUp(){N.current=!0},[_I[d]]:()=>{a.current.insideReactTree=!0}}),[D,d,a]);return L.useMemo(()=>l?{reference:U,floating:q}:{},[l,U,q])}function EI(e){const{open:t=!1,onOpenChange:n,elements:o}=e,s=pI(),a=L.useRef({}),[l]=L.useState(()=>mI()),c=my()!=null;if(process.env.NODE_ENV!=="production"){const m=o.reference;m&&!Ue(m)&&gI("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[f,d]=L.useState(o.reference),h=xn((m,x,v)=>{a.current.openEvent=m?x:void 0,l.emit("openchange",{open:m,event:x,reason:v,nested:c}),n?.(m,x,v)}),g=L.useMemo(()=>({setPositionReference:d}),[]),p=L.useMemo(()=>({reference:f||o.reference||null,floating:o.floating||null,domReference:o.reference}),[f,o.reference,o.floating]);return L.useMemo(()=>({dataRef:a,open:t,onOpenChange:h,elements:p,events:l,floatingId:s,refs:g}),[t,h,p,l,s,g])}function wy(e){e===void 0&&(e={});const{nodeId:t}=e,n=EI({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,s=o.elements,[a,l]=L.useState(null),[c,f]=L.useState(null),h=s?.domReference||a,g=L.useRef(null),p=_u();po(()=>{h&&(g.current=h)},[h]);const m=fy({...e,elements:{...s,...c&&{reference:c}}}),x=L.useCallback(w=>{const E=Ue(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;f(E),m.refs.setReference(E)},[m.refs]),v=L.useCallback(w=>{(Ue(w)||w===null)&&(g.current=w,l(w)),(Ue(m.refs.reference.current)||m.refs.reference.current===null||w!==null&&!Ue(w))&&m.refs.setReference(w)},[m.refs]),b=L.useMemo(()=>({...m.refs,setReference:v,setPositionReference:x,domReference:g}),[m.refs,v,x]),_=L.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),N=L.useMemo(()=>({...m,...o,refs:b,elements:_,nodeId:t}),[m,b,_,t,o]);return po(()=>{o.dataRef.current.floatingContext=N;const w=p?.nodesRef.current.find(E=>E.id===t);w&&(w.context=N)}),L.useMemo(()=>({...m,context:N,refs:b,elements:_}),[m,b,_,N])}function Nu(e,t,n){const o=new Map,s=n==="item";let a=e;if(s&&e){const{[dy]:l,[hy]:c,...f}=e;a=f}return{...n==="floating"&&{tabIndex:-1,[uI]:""},...a,...t.map(l=>{const c=l?l[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((l,c)=>(c&&Object.entries(c).forEach(f=>{let[d,h]=f;if(!(s&&[dy,hy].includes(d)))if(d.indexOf("on")===0){if(o.has(d)||o.set(d,[]),typeof h=="function"){var g;(g=o.get(d))==null||g.push(h),l[d]=function(){for(var p,m=arguments.length,x=new Array(m),v=0;v<m;v++)x[v]=arguments[v];return(p=o.get(d))==null?void 0:p.map(b=>b(...x)).find(b=>b!==void 0)}}}else l[d]=h}),l),{})}}function by(e){e===void 0&&(e=[]);const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),o=e.map(c=>c?.item),s=L.useCallback(c=>Nu(c,e,"reference"),t),a=L.useCallback(c=>Nu(c,e,"floating"),n),l=L.useCallback(c=>Nu(c,e,"item"),o);return L.useMemo(()=>({getReferenceProps:s,getFloatingProps:a,getItemProps:l}),[s,a,l])}function _y(e,t,n){return n===void 0&&(n=!0),e.filter(s=>{var a;return s.parentId===t&&(!n||((a=s.context)==null?void 0:a.open))}).flatMap(s=>[s,..._y(e,s.id,n)])}function Sy(e,t){const[n,o]=e;let s=!1;const a=t.length;for(let l=0,c=a-1;l<a;c=l++){const[f,d]=t[l]||[0,0],[h,g]=t[c]||[0,0];d>=o!=g>=o&&n<=(h-f)*(o-d)/(g-d)+f&&(s=!s)}return s}function CI(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function NI(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,s={current:-1};let a=!1,l=null,c=null,f=typeof performance<"u"?performance.now():0;function d(g,p){const m=performance.now(),x=m-f;if(l===null||c===null||x===0)return l=g,c=p,f=m,null;const v=g-l,b=p-c,N=Math.sqrt(v*v+b*b)/x;return l=g,c=p,f=m,N}const h=g=>{let{x:p,y:m,placement:x,elements:v,onClose:b,nodeId:_,tree:N}=g;return function(E){function O(){Rt(s),b()}if(Rt(s),!v.domReference||!v.floating||x==null||p==null||m==null)return;const{clientX:k,clientY:M}=E,D=[k,M],V=wI(E),K=E.type==="mouseleave",Z=Cu(v.floating,V),U=Cu(v.domReference,V),q=v.domReference.getBoundingClientRect(),C=v.floating.getBoundingClientRect(),H=x.split("-")[0],B=p>C.right-C.width/2,R=m>C.bottom-C.height/2,P=CI(D,q),W=C.width>q.width,$=C.height>q.height,G=(W?q:C).left,J=(W?q:C).right,re=($?q:C).top,se=($?q:C).bottom;if(Z&&(a=!0,!K))return;if(U&&(a=!1),U&&!K){a=!0;return}if(K&&Ue(E.relatedTarget)&&Cu(v.floating,E.relatedTarget)||N&&_y(N.nodesRef.current,_).length)return;if(H==="top"&&m>=q.bottom-1||H==="bottom"&&m<=q.top+1||H==="left"&&p>=q.right-1||H==="right"&&p<=q.left+1)return O();let ce=[];switch(H){case"top":ce=[[G,q.top+1],[G,C.bottom-1],[J,C.bottom-1],[J,q.top+1]];break;case"bottom":ce=[[G,C.top+1],[G,q.bottom-1],[J,q.bottom-1],[J,C.top+1]];break;case"left":ce=[[C.right-1,se],[C.right-1,re],[q.left+1,re],[q.left+1,se]];break;case"right":ce=[[q.right-1,se],[q.right-1,re],[C.left+1,re],[C.left+1,se]];break}function ge(te){let[Q,ae]=te;switch(H){case"top":{const fe=[W?Q+t/2:B?Q+t*4:Q-t*4,ae+t+1],de=[W?Q-t/2:B?Q+t*4:Q-t*4,ae+t+1],ue=[[C.left,B||W?C.bottom-t:C.top],[C.right,B?W?C.bottom-t:C.top:C.bottom-t]];return[fe,de,...ue]}case"bottom":{const fe=[W?Q+t/2:B?Q+t*4:Q-t*4,ae-t],de=[W?Q-t/2:B?Q+t*4:Q-t*4,ae-t],ue=[[C.left,B||W?C.top+t:C.bottom],[C.right,B?W?C.top+t:C.bottom:C.top+t]];return[fe,de,...ue]}case"left":{const fe=[Q+t+1,$?ae+t/2:R?ae+t*4:ae-t*4],de=[Q+t+1,$?ae-t/2:R?ae+t*4:ae-t*4];return[...[[R||$?C.right-t:C.left,C.top],[R?$?C.right-t:C.left:C.right-t,C.bottom]],fe,de]}case"right":{const fe=[Q-t,$?ae+t/2:R?ae+t*4:ae-t*4],de=[Q-t,$?ae-t/2:R?ae+t*4:ae-t*4],ue=[[R||$?C.left+t:C.right,C.top],[R?$?C.left+t:C.right:C.left+t,C.bottom]];return[fe,de,...ue]}}}if(!Sy([k,M],ce)){if(a&&!P)return O();if(!K&&o){const te=d(E.clientX,E.clientY);if(te!==null&&te<.1)return O()}Sy([k,M],ge([p,m]))?!a&&o&&(s.current=window.setTimeout(O,40)):O()}}};return h.__options={blockPointerEvents:n},h}const Ey=({subItems:e,onItemClick:t,className:n})=>{const[,o]=z.useState(null),s=a=>{a.onClick&&a.onClick(),t&&t(a)};return T.jsx("ul",{className:Ne("min-w-48 bg-[#181818] border border-none rounded-md shadow-lg py-1",n),children:e.map((a,l)=>T.jsx(TI,{item:a,index:l,onItemClick:s,onItemClickCallback:t,setHoveredItemId:o},a.id))})},TI=({item:e,index:t,onItemClick:n,onItemClickCallback:o,setHoveredItemId:s})=>{const[a,l]=z.useState(!1),{refs:c,floatingStyles:f,context:d}=wy({open:a,onOpenChange:l,placement:"right-start",middleware:[vu(5),wu({fallbackPlacements:["left-start"]}),xu({padding:8})],whileElementsMounted:mu}),h=xI(d,{handleClose:NI(),delay:{open:75,close:75}}),{getReferenceProps:g,getFloatingProps:p}=by([h]),m=()=>{s(e.id),e.subItems&&e.subItems.length>0&&l(!0)},x=()=>{};return T.jsxs("li",{className:"relative",children:[e.separator&&t>0&&T.jsx("div",{className:"border-t border-gray-600 m-0"}),T.jsxs("div",{ref:c.setReference,className:Ne("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:m,onMouseLeave:x,...g(),children:[T.jsxs("div",{className:"flex items-center gap-2",children:[e.icon&&T.jsx("span",{className:"text-primary-white w-3 h-3 flex items-center justify-center",children:e.icon}),T.jsx("span",{className:"text-sm leading-3.5 text-primary-white font-main",children:e.label})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[e.shortcut&&T.jsx("span",{className:"text-sm leading-3.5 text-gray-400 font-mono",children:e.shortcut}),e.subItems&&e.subItems.length>0&&T.jsx(la,{className:"w-3 h-3 text-gray-400"})]})]}),e.subItems&&e.subItems.length>0&&a&&T.jsx("div",{ref:c.setFloating,style:{...f,contain:"layout",willChange:"transform"},className:"z-50",...p(),children:T.jsx(Ey,{subItems:e.subItems,onItemClick:o,className:"ml-1"})})]})},Cy=({subItems:e,className:t,onItemClick:n})=>T.jsx("div",{className:Ne("relative",t),children:T.jsx(Ey,{subItems:e,onItemClick:n})});function Ny({typeOfNodes:e,dispatch:t,setContextMenu:n,contextMenuPosition:o,isRecursionAllowed:s=!0,currentNodeType:a}){const l=Object.keys(e);if(l.length===0)return[];function c(h,g){if(g||!a)return h;const p=Em({typeOfNodes:e},a);return h.filter(m=>!p.has(m))}const d=c(l,s).map(h=>({id:`add-${h}`,label:e[h].name,onClick:()=>{t({type:st.ADD_NODE_AND_SELECT,payload:{type:h,position:o}}),n({isOpen:!1,position:{x:0,y:0}})}}));return[{id:"add-node",label:"Add Node",icon:z.createElement(zm,{className:"w-4 h-4"}),subItems:d}]}function Ty(e,[t,n]){return Math.min(n,Math.max(t,e))}function ot(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function Tu(e,t=[]){let n=[];function o(a,l){const c=L.createContext(l),f=n.length;n=[...n,l];const d=g=>{const{scope:p,children:m,...x}=g,v=p?.[e]?.[f]||c,b=L.useMemo(()=>x,Object.values(x));return T.jsx(v.Provider,{value:b,children:m})};d.displayName=a+"Provider";function h(g,p){const m=p?.[e]?.[f]||c,x=L.useContext(m);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${g}\` must be used within \`${a}\``)}return[d,h]}const s=()=>{const a=n.map(l=>L.createContext(l));return function(c){const f=c?.[e]||a;return L.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])}};return s.scopeName=e,[o,AI(s,...t)]}function AI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=o.reduce((c,{useScope:f,scopeName:d})=>{const g=f(a)[`__scope${d}`];return{...c,...g}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function II(e){const t=e+"CollectionProvider",[n,o]=Tu(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=v=>{const{scope:b,children:_}=v,N=z.useRef(null),w=z.useRef(new Map).current;return T.jsx(s,{scope:b,itemMap:w,collectionRef:N,children:_})};l.displayName=t;const c=e+"CollectionSlot",f=Vo(c),d=z.forwardRef((v,b)=>{const{scope:_,children:N}=v,w=a(c,_),E=ut(b,w.collectionRef);return T.jsx(f,{ref:E,children:N})});d.displayName=c;const h=e+"CollectionItemSlot",g="data-radix-collection-item",p=Vo(h),m=z.forwardRef((v,b)=>{const{scope:_,children:N,...w}=v,E=z.useRef(null),O=ut(b,E),k=a(h,_);return z.useEffect(()=>(k.itemMap.set(E,{ref:E,...w}),()=>void k.itemMap.delete(E))),T.jsx(p,{[g]:"",ref:O,children:N})});m.displayName=h;function x(v){const b=a(e+"CollectionConsumer",v);return z.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const w=Array.from(N.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((k,M)=>w.indexOf(k.ref.current)-w.indexOf(M.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:l,Slot:d,ItemSlot:m},x,o]}var OI=L.createContext(void 0);function PI(e){const t=L.useContext(OI);return e||t||"ltr"}var kI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=kI.reduce((e,t)=>{const n=Vo(`Primitive.${t}`),o=L.forwardRef((s,a)=>{const{asChild:l,...c}=s,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(f,{...c,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function MI(e,t){e&&cs.flushSync(()=>e.dispatchEvent(t))}function Mr(e){const t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...n)=>t.current?.(...n),[])}function RI(e,t=globalThis?.document){const n=Mr(e);L.useEffect(()=>{const o=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var DI="DismissableLayer",Au="dismissableLayer.update",LI="dismissableLayer.pointerDownOutside",$I="dismissableLayer.focusOutside",Ay,Iy=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Oy=L.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...f}=e,d=L.useContext(Iy),[h,g]=L.useState(null),p=h?.ownerDocument??globalThis?.document,[,m]=L.useState({}),x=ut(t,M=>g(M)),v=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),_=v.indexOf(b),N=h?v.indexOf(h):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,E=N>=_,O=HI(M=>{const D=M.target,V=[...d.branches].some(K=>K.contains(D));!E||V||(s?.(M),l?.(M),M.defaultPrevented||c?.())},p),k=zI(M=>{const D=M.target;[...d.branches].some(K=>K.contains(D))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},p);return RI(M=>{N===d.layers.size-1&&(o?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))},p),L.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ay=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),Py(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Ay)}},[h,p,n,d]),L.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),Py())},[h,d]),L.useEffect(()=>{const M=()=>m({});return document.addEventListener(Au,M),()=>document.removeEventListener(Au,M)},[]),T.jsx(Je.div,{...f,ref:x,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:ot(e.onFocusCapture,k.onFocusCapture),onBlurCapture:ot(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:ot(e.onPointerDownCapture,O.onPointerDownCapture)})});Oy.displayName=DI;var BI="DismissableLayerBranch",FI=L.forwardRef((e,t)=>{const n=L.useContext(Iy),o=L.useRef(null),s=ut(t,o);return L.useEffect(()=>{const a=o.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),T.jsx(Je.div,{...e,ref:s})});FI.displayName=BI;function HI(e,t=globalThis?.document){const n=Mr(e),o=L.useRef(!1),s=L.useRef(()=>{});return L.useEffect(()=>{const a=c=>{if(c.target&&!o.current){let f=function(){ky(LI,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=f,t.addEventListener("click",s.current,{once:!0})):f()}else t.removeEventListener("click",s.current);o.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function zI(e,t=globalThis?.document){const n=Mr(e),o=L.useRef(!1);return L.useEffect(()=>{const s=a=>{a.target&&!o.current&&ky($I,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Py(){const e=new CustomEvent(Au);document.dispatchEvent(e)}function ky(e,t,n,{discrete:o}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),o?MI(s,a):s.dispatchEvent(a)}var Iu=0;function VI(){L.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??My()),document.body.insertAdjacentElement("beforeend",e[1]??My()),Iu++,()=>{Iu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Iu--}},[])}function My(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ou="focusScope.autoFocusOnMount",Pu="focusScope.autoFocusOnUnmount",Ry={bubbles:!1,cancelable:!0},WI="FocusScope",Dy=L.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[c,f]=L.useState(null),d=Mr(s),h=Mr(a),g=L.useRef(null),p=ut(t,v=>f(v)),m=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(o){let v=function(w){if(m.paused||!c)return;const E=w.target;c.contains(E)?g.current=E:ir(g.current,{select:!0})},b=function(w){if(m.paused||!c)return;const E=w.relatedTarget;E!==null&&(c.contains(E)||ir(g.current,{select:!0}))},_=function(w){if(document.activeElement===document.body)for(const O of w)O.removedNodes.length>0&&ir(c)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const N=new MutationObserver(_);return c&&N.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),N.disconnect()}}},[o,c,m.paused]),L.useEffect(()=>{if(c){By.add(m);const v=document.activeElement;if(!c.contains(v)){const _=new CustomEvent(Ou,Ry);c.addEventListener(Ou,d),c.dispatchEvent(_),_.defaultPrevented||(jI(qI(Ly(c)),{select:!0}),document.activeElement===v&&ir(c))}return()=>{c.removeEventListener(Ou,d),setTimeout(()=>{const _=new CustomEvent(Pu,Ry);c.addEventListener(Pu,h),c.dispatchEvent(_),_.defaultPrevented||ir(v??document.body,{select:!0}),c.removeEventListener(Pu,h),By.remove(m)},0)}}},[c,d,h,m]);const x=L.useCallback(v=>{if(!n&&!o||m.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,_=document.activeElement;if(b&&_){const N=v.currentTarget,[w,E]=UI(N);w&&E?!v.shiftKey&&_===E?(v.preventDefault(),n&&ir(w,{select:!0})):v.shiftKey&&_===w&&(v.preventDefault(),n&&ir(E,{select:!0})):_===N&&v.preventDefault()}},[n,o,m.paused]);return T.jsx(Je.div,{tabIndex:-1,...l,ref:p,onKeyDown:x})});Dy.displayName=WI;function jI(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(ir(o,{select:t}),document.activeElement!==n)return}function UI(e){const t=Ly(e),n=$y(t,e),o=$y(t.reverse(),e);return[n,o]}function Ly(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const s=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||s?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $y(e,t){for(const n of e)if(!GI(n,{upTo:t}))return n}function GI(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function YI(e){return e instanceof HTMLInputElement&&"select"in e}function ir(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&YI(e)&&t&&e.select()}}var By=XI();function XI(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Fy(e,t),e.unshift(t)},remove(t){e=Fy(e,t),e[0]?.resume()}}}function Fy(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function qI(e){return e.filter(t=>t.tagName!=="A")}var St=globalThis?.document?L.useLayoutEffect:()=>{},KI=L[" useId ".trim().toString()]||(()=>{}),ZI=0;function ku(e){const[t,n]=L.useState(KI());return St(()=>{n(o=>o??String(ZI++))},[e]),t?`radix-${t}`:""}var QI="Arrow",Hy=L.forwardRef((e,t)=>{const{children:n,width:o=10,height:s=5,...a}=e;return T.jsx(Je.svg,{...a,ref:t,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:T.jsx("polygon",{points:"0,0 30,0 15,10"})})});Hy.displayName=QI;var JI=Hy;function eO(e){const[t,n]=L.useState(void 0);return St(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,c;if("borderBoxSize"in a){const f=a.borderBoxSize,d=Array.isArray(f)?f[0]:f;l=d.inlineSize,c=d.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Mu="Popper",[zy,Vy]=Tu(Mu),[tO,Wy]=zy(Mu),jy=e=>{const{__scopePopper:t,children:n}=e,[o,s]=L.useState(null);return T.jsx(tO,{scope:t,anchor:o,onAnchorChange:s,children:n})};jy.displayName=Mu;var Uy="PopperAnchor",Gy=L.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...s}=e,a=Wy(Uy,n),l=L.useRef(null),c=ut(t,l),f=L.useRef(null);return L.useEffect(()=>{const d=f.current;f.current=o?.current||l.current,d!==f.current&&a.onAnchorChange(f.current)}),o?null:T.jsx(Je.div,{...s,ref:c})});Gy.displayName=Uy;var Ru="PopperContent",[nO,rO]=zy(Ru),Yy=L.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:f=!0,collisionBoundary:d=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:x,...v}=e,b=Wy(Ru,n),[_,N]=L.useState(null),w=ut(t,te=>N(te)),[E,O]=L.useState(null),k=eO(E),M=k?.width??0,D=k?.height??0,V=o+(a!=="center"?"-"+a:""),K=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},Z=Array.isArray(d)?d:[d],U=Z.length>0,q={padding:K,boundary:Z.filter(iO),altBoundary:U},{refs:C,floatingStyles:H,placement:B,isPositioned:R,middlewareData:P}=fy({strategy:"fixed",placement:V,whileElementsMounted:(...te)=>mu(...te,{animationFrame:m==="always"}),elements:{reference:b.anchor},middleware:[vu({mainAxis:s+D,alignmentAxis:l}),f&&xu({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?sI():void 0,...q}),f&&wu({...q}),aI({...q,apply:({elements:te,rects:Q,availableWidth:ae,availableHeight:fe})=>{const{width:de,height:ue}=Q.reference,_e=te.floating.style;_e.setProperty("--radix-popper-available-width",`${ae}px`),_e.setProperty("--radix-popper-available-height",`${fe}px`),_e.setProperty("--radix-popper-anchor-width",`${de}px`),_e.setProperty("--radix-popper-anchor-height",`${ue}px`)}}),E&&cI({element:E,padding:c}),sO({arrowWidth:M,arrowHeight:D}),p&&lI({strategy:"referenceHidden",...q})]}),[W,$]=Ky(B),G=Mr(x);St(()=>{R&&G?.()},[R,G]);const J=P.arrow?.x,re=P.arrow?.y,se=P.arrow?.centerOffset!==0,[ce,ge]=L.useState();return St(()=>{_&&ge(window.getComputedStyle(_).zIndex)},[_]),T.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:R?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(" "),...P.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:T.jsx(nO,{scope:n,placedSide:W,onArrowChange:O,arrowX:J,arrowY:re,shouldHideArrow:se,children:T.jsx(Je.div,{"data-side":W,"data-align":$,...v,ref:w,style:{...v.style,animation:R?void 0:"none"}})})})});Yy.displayName=Ru;var Xy="PopperArrow",oO={top:"bottom",right:"left",bottom:"top",left:"right"},qy=L.forwardRef(function(t,n){const{__scopePopper:o,...s}=t,a=rO(Xy,o),l=oO[a.placedSide];return T.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:T.jsx(JI,{...s,ref:n,style:{...s.style,display:"block"}})})});qy.displayName=Xy;function iO(e){return e!==null}var sO=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:s}=t,l=s.arrow?.centerOffset!==0,c=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[d,h]=Ky(n),g={start:"0%",center:"50%",end:"100%"}[h],p=(s.arrow?.x??0)+c/2,m=(s.arrow?.y??0)+f/2;let x="",v="";return d==="bottom"?(x=l?g:`${p}px`,v=`${-f}px`):d==="top"?(x=l?g:`${p}px`,v=`${o.floating.height+f}px`):d==="right"?(x=`${-f}px`,v=l?g:`${m}px`):d==="left"&&(x=`${o.floating.width+f}px`,v=l?g:`${m}px`),{data:{x,y:v}}}});function Ky(e){const[t,n="center"]=e.split("-");return[t,n]}var aO=jy,lO=Gy,cO=Yy,uO=qy,fO="Portal",Zy=L.forwardRef((e,t)=>{const{container:n,...o}=e,[s,a]=L.useState(!1);St(()=>a(!0),[]);const l=n||s&&globalThis?.document?.body;return l?Hd.createPortal(T.jsx(Je.div,{...o,ref:t}),l):null});Zy.displayName=fO;var dO=L[" useInsertionEffect ".trim().toString()]||St;function Qy({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[s,a,l]=hO({defaultProp:t,onChange:n}),c=e!==void 0,f=c?e:s;{const h=L.useRef(e!==void 0);L.useEffect(()=>{const g=h.current;g!==c&&console.warn(`${o} is changing from ${g?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=c},[c,o])}const d=L.useCallback(h=>{if(c){const g=pO(h)?h(e):h;g!==e&&l.current?.(g)}else a(h)},[c,e,a,l]);return[f,d]}function hO({defaultProp:e,onChange:t}){const[n,o]=L.useState(e),s=L.useRef(n),a=L.useRef(t);return dO(()=>{a.current=t},[t]),L.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,o,a]}function pO(e){return typeof e=="function"}function gO(e){const t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Jy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mO="VisuallyHidden",yO=L.forwardRef((e,t)=>T.jsx(Je.span,{...e,ref:t,style:{...Jy,...e.style}}));yO.displayName=mO;var vO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},mo=new WeakMap,Ea=new WeakMap,Ca={},Du=0,e0=function(e){return e&&(e.host||e0(e.parentNode))},xO=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=e0(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},wO=function(e,t,n,o){var s=xO(t,Array.isArray(e)?e:[e]);Ca[n]||(Ca[n]=new WeakMap);var a=Ca[n],l=[],c=new Set,f=new Set(s),d=function(g){!g||c.has(g)||(c.add(g),d(g.parentNode))};s.forEach(d);var h=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(p){if(c.has(p))h(p);else try{var m=p.getAttribute(o),x=m!==null&&m!=="false",v=(mo.get(p)||0)+1,b=(a.get(p)||0)+1;mo.set(p,v),a.set(p,b),l.push(p),v===1&&x&&Ea.set(p,!0),b===1&&p.setAttribute(n,"true"),x||p.setAttribute(o,"true")}catch(_){console.error("aria-hidden: cannot operate on ",p,_)}})};return h(t),c.clear(),Du++,function(){l.forEach(function(g){var p=mo.get(g)-1,m=a.get(g)-1;mo.set(g,p),a.set(g,m),p||(Ea.has(g)||g.removeAttribute(o),Ea.delete(g)),m||g.removeAttribute(n)}),Du--,Du||(mo=new WeakMap,mo=new WeakMap,Ea=new WeakMap,Ca={})}},bO=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),s=vO(e);return s?(o.push.apply(o,Array.from(s.querySelectorAll("[aria-live], script"))),wO(o,s,n,"aria-hidden")):function(){return null}},wn=function(){return wn=Object.assign||function(t){for(var n,o=1,s=arguments.length;o<s;o++){n=arguments[o];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},wn.apply(this,arguments)};function t0(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(e);s<o.length;s++)t.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(n[o[s]]=e[o[s]]);return n}function _O(e,t,n){if(n||arguments.length===2)for(var o=0,s=t.length,a;o<s;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Na="right-scroll-bar-position",Ta="width-before-scroll-bar",SO="with-scroll-bars-hidden",EO="--removed-body-scroll-bar-size";function Lu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function CO(e,t){var n=z.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){var s=n.value;s!==o&&(n.value=o,n.callback(o,s))}}}})[0];return n.callback=t,n.facade}var NO=typeof window<"u"?L.useLayoutEffect:L.useEffect,n0=new WeakMap;function TO(e,t){var n=CO(null,function(o){return e.forEach(function(s){return Lu(s,o)})});return NO(function(){var o=n0.get(n);if(o){var s=new Set(o),a=new Set(e),l=n.current;s.forEach(function(c){a.has(c)||Lu(c,null)}),a.forEach(function(c){s.has(c)||Lu(c,l)})}n0.set(n,e)},[e]),n}function AO(e){return e}function IO(e,t){t===void 0&&(t=AO);var n=[],o=!1,s={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,o);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(o=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){o=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var f=function(){var h=l;l=[],h.forEach(a)},d=function(){return Promise.resolve().then(f)};d(),n={push:function(h){l.push(h),d()},filter:function(h){return l=l.filter(h),n}}}};return s}function OO(e){e===void 0&&(e={});var t=IO(null);return t.options=wn({async:!0,ssr:!1},e),t}var r0=function(e){var t=e.sideCar,n=t0(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return L.createElement(o,wn({},n))};r0.isSideCarExport=!0;function PO(e,t){return e.useMedium(t),r0}var o0=OO(),$u=function(){},Aa=L.forwardRef(function(e,t){var n=L.useRef(null),o=L.useState({onScrollCapture:$u,onWheelCapture:$u,onTouchMoveCapture:$u}),s=o[0],a=o[1],l=e.forwardProps,c=e.children,f=e.className,d=e.removeScrollBar,h=e.enabled,g=e.shards,p=e.sideCar,m=e.noRelative,x=e.noIsolation,v=e.inert,b=e.allowPinchZoom,_=e.as,N=_===void 0?"div":_,w=e.gapMode,E=t0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=p,k=TO([n,t]),M=wn(wn({},E),s);return L.createElement(L.Fragment,null,h&&L.createElement(O,{sideCar:o0,removeScrollBar:d,shards:g,noRelative:m,noIsolation:x,inert:v,setCallbacks:a,allowPinchZoom:!!b,lockRef:n,gapMode:w}),l?L.cloneElement(L.Children.only(c),wn(wn({},M),{ref:k})):L.createElement(N,wn({},M,{className:f,ref:k}),c))});Aa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Aa.classNames={fullWidth:Ta,zeroRight:Na};var kO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function MO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kO();return t&&e.setAttribute("nonce",t),e}function RO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function DO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var LO=function(){var e=0,t=null;return{add:function(n){e==0&&(t=MO())&&(RO(t,n),DO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$O=function(){var e=LO();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},i0=function(){var e=$O(),t=function(n){var o=n.styles,s=n.dynamic;return e(o,s),null};return t},BO={left:0,top:0,right:0,gap:0},Bu=function(e){return parseInt(e||"",10)||0},FO=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Bu(n),Bu(o),Bu(s)]},HO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return BO;var t=FO(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},zO=i0(),yo="data-scroll-locked",VO=function(e,t,n,o){var s=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
148
- .`.concat(SO,` {
149
- overflow: hidden `).concat(o,`;
150
- padding-right: `).concat(c,"px ").concat(o,`;
122
+ */const $_=Ye("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
123
+ * @license lucide-react v0.542.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const H_=Ye("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);/**
128
+ * @license lucide-react v0.542.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const au=Ye("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);/**
133
+ * @license lucide-react v0.542.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const Jh=Ye("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
138
+ * @license lucide-react v0.542.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const Qh=Ye("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
143
+ * @license lucide-react v0.542.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const B_=Ye("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
148
+ * @license lucide-react v0.542.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const V_=Ye("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]);/**
153
+ * @license lucide-react v0.542.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const eg=Ye("square-mouse-pointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/**
158
+ * @license lucide-react v0.542.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const tg=Ye("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
163
+ * @license lucide-react v0.542.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const F_=Ye("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
168
+ * @license lucide-react v0.542.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const ng=Ye("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
173
+ * @license lucide-react v0.542.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const aa=Ye("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
178
+ * @license lucide-react v0.542.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const z_=Ye("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
183
+ * @license lucide-react v0.542.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const U_=Ye("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
188
+ * @license lucide-react v0.542.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const W_=Ye("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function rg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function og(...e){return t=>{let n=!1;const r=e.map(i=>{const s=rg(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():rg(e[i],null)}}}}function ut(...e){return V.useCallback(og(...e),e)}function Ti(e){const t=q_(e),n=V.forwardRef((r,i)=>{const{children:s,...a}=r,l=V.Children.toArray(s),u=l.find(X_);if(u){const d=u.props.children,f=l.map(g=>g===u?V.Children.count(d)>1?V.Children.only(null):V.isValidElement(d)?d.props.children:null:g);return y.jsx(t,{...a,ref:i,children:V.isValidElement(d)?V.cloneElement(d,void 0,f):null})}return y.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var G_=Ti("Slot");function q_(e){const t=V.forwardRef((n,r)=>{const{children:i,...s}=n;if(V.isValidElement(i)){const a=Z_(i),l=K_(s,i.props);return i.type!==V.Fragment&&(l.ref=r?og(r,a):a),V.cloneElement(i,l)}return V.Children.count(i)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Y_=Symbol("radix.slottable");function X_(e){return V.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Y_}function K_(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const u=s(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Z_(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)}var J_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ke=J_.reduce((e,t)=>{const n=Ti(`Primitive.${t}`),r=V.forwardRef((i,s)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(u,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Q_(e,t){e&&_o.flushSync(()=>e.dispatchEvent(t))}var ig=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),eN="VisuallyHidden",tN=V.forwardRef((e,t)=>y.jsx(Ke.span,{...e,ref:t,style:{...ig,...e.style}}));tN.displayName=eN;function No(e,t=[]){let n=[];function r(s,a){const l=V.createContext(a),u=n.length;n=[...n,a];const d=g=>{const{scope:h,children:m,...x}=g,v=h?.[e]?.[u]||l,b=V.useMemo(()=>x,Object.values(x));return y.jsx(v.Provider,{value:b,children:m})};d.displayName=s+"Provider";function f(g,h){const m=h?.[e]?.[u]||l,x=V.useContext(m);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${g}\` must be used within \`${s}\``)}return[d,f]}const i=()=>{const s=n.map(a=>V.createContext(a));return function(l){const u=l?.[e]||s;return V.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return i.scopeName=e,[r,nN(i,...t)]}function nN(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((l,{useScope:u,scopeName:d})=>{const g=u(s)[`__scope${d}`];return{...l,...g}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function sg(e){const t=e+"CollectionProvider",[n,r]=No(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:b,children:S}=v,N=T.useRef(null),w=T.useRef(new Map).current;return y.jsx(i,{scope:b,itemMap:w,collectionRef:N,children:S})};a.displayName=t;const l=e+"CollectionSlot",u=Ti(l),d=T.forwardRef((v,b)=>{const{scope:S,children:N}=v,w=s(l,S),I=ut(b,w.collectionRef);return y.jsx(u,{ref:I,children:N})});d.displayName=l;const f=e+"CollectionItemSlot",g="data-radix-collection-item",h=Ti(f),m=T.forwardRef((v,b)=>{const{scope:S,children:N,...w}=v,I=T.useRef(null),k=ut(b,I),A=s(f,S);return T.useEffect(()=>(A.itemMap.set(I,{ref:I,...w}),()=>void A.itemMap.delete(I))),y.jsx(h,{[g]:"",ref:k,children:N})});m.displayName=f;function x(v){const b=s(e+"CollectionConsumer",v);return T.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const w=Array.from(N.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((A,M)=>w.indexOf(A.ref.current)-w.indexOf(M.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:d,ItemSlot:m},x,r]}function it(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var _t=globalThis?.document?V.useLayoutEffect:()=>{},rN=V[" useInsertionEffect ".trim().toString()]||_t;function Io({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,a]=oN({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:i;{const f=V.useRef(e!==void 0);V.useEffect(()=>{const g=f.current;g!==l&&console.warn(`${r} is changing from ${g?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,r])}const d=V.useCallback(f=>{if(l){const g=iN(f)?f(e):f;g!==e&&a.current?.(g)}else s(f)},[l,e,s,a]);return[u,d]}function oN({defaultProp:e,onChange:t}){const[n,r]=V.useState(e),i=V.useRef(n),s=V.useRef(t);return rN(()=>{s.current=t},[t]),V.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}function iN(e){return typeof e=="function"}function sN(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var cu=e=>{const{present:t,children:n}=e,r=aN(t),i=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),s=ut(r.ref,cN(i));return typeof n=="function"||r.isPresent?V.cloneElement(i,{ref:s}):null};cu.displayName="Presence";function aN(e){const[t,n]=V.useState(),r=V.useRef(null),i=V.useRef(e),s=V.useRef("none"),a=e?"mounted":"unmounted",[l,u]=sN(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const d=ca(r.current);s.current=l==="mounted"?d:"none"},[l]),_t(()=>{const d=r.current,f=i.current;if(f!==e){const h=s.current,m=ca(d);e?u("MOUNT"):m==="none"||d?.display==="none"?u("UNMOUNT"):u(f&&h!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),_t(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,g=m=>{const v=ca(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=m=>{m.target===t&&(s.current=ca(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:V.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function ca(e){return e?.animationName||"none"}function cN(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)}var lN=V[" useId ".trim().toString()]||(()=>{}),uN=0;function Ci(e){const[t,n]=V.useState(lN());return _t(()=>{n(r=>r??String(uN++))},[e]),t?`radix-${t}`:""}var la="Collapsible",[dN,ag]=No(la),[fN,lu]=dN(la),cg=V.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:a,...l}=e,[u,d]=Io({prop:r,defaultProp:i??!1,onChange:a,caller:la});return y.jsx(fN,{scope:n,disabled:s,contentId:Ci(),open:u,onOpenToggle:V.useCallback(()=>d(f=>!f),[d]),children:y.jsx(Ke.div,{"data-state":du(u),"data-disabled":s?"":void 0,...l,ref:t})})});cg.displayName=la;var lg="CollapsibleTrigger",ug=V.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=lu(lg,n);return y.jsx(Ke.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":du(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:it(e.onClick,i.onOpenToggle)})});ug.displayName=lg;var uu="CollapsibleContent",dg=V.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=lu(uu,e.__scopeCollapsible);return y.jsx(cu,{present:n||i.open,children:({present:s})=>y.jsx(pN,{...r,ref:t,present:s})})});dg.displayName=uu;var pN=V.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=e,a=lu(uu,n),[l,u]=V.useState(r),d=V.useRef(null),f=ut(t,d),g=V.useRef(0),h=g.current,m=V.useRef(0),x=m.current,v=a.open||l,b=V.useRef(v),S=V.useRef(void 0);return V.useEffect(()=>{const N=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(N)},[]),_t(()=>{const N=d.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const w=N.getBoundingClientRect();g.current=w.height,m.current=w.width,b.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),u(r)}},[a.open,r]),y.jsx(Ke.div,{"data-state":du(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:v&&i})});function du(e){return e?"open":"closed"}var hN=cg,gN=ug,mN=dg,yN=V.createContext(void 0);function fg(e){const t=V.useContext(yN);return e||t||"ltr"}var vn="Accordion",vN=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fu,xN,wN]=sg(vn),[ua,CF]=No(vn,[wN,ag]),pu=ag(),pg=T.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,s=r;return y.jsx(fu.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?y.jsx(NN,{...s,ref:t}):y.jsx(_N,{...i,ref:t})})});pg.displayName=vn;var[hg,bN]=ua(vn),[gg,SN]=ua(vn,{collapsible:!1}),_N=T.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:s=!1,...a}=e,[l,u]=Io({prop:n,defaultProp:r??"",onChange:i,caller:vn});return y.jsx(hg,{scope:e.__scopeAccordion,value:T.useMemo(()=>l?[l]:[],[l]),onItemOpen:u,onItemClose:T.useCallback(()=>s&&u(""),[s,u]),children:y.jsx(gg,{scope:e.__scopeAccordion,collapsible:s,children:y.jsx(mg,{...a,ref:t})})})}),NN=T.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=e,[a,l]=Io({prop:n,defaultProp:r??[],onChange:i,caller:vn}),u=T.useCallback(f=>l((g=[])=>[...g,f]),[l]),d=T.useCallback(f=>l((g=[])=>g.filter(h=>h!==f)),[l]);return y.jsx(hg,{scope:e.__scopeAccordion,value:a,onItemOpen:u,onItemClose:d,children:y.jsx(gg,{scope:e.__scopeAccordion,collapsible:!0,children:y.jsx(mg,{...s,ref:t})})})}),[IN,da]=ua(vn),mg=T.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:s="vertical",...a}=e,l=T.useRef(null),u=ut(l,t),d=xN(n),g=fg(i)==="ltr",h=it(e.onKeyDown,m=>{if(!vN.includes(m.key))return;const x=m.target,v=d().filter(B=>!B.ref.current?.disabled),b=v.findIndex(B=>B.ref.current===x),S=v.length;if(b===-1)return;m.preventDefault();let N=b;const w=0,I=S-1,k=()=>{N=b+1,N>I&&(N=w)},A=()=>{N=b-1,N<w&&(N=I)};switch(m.key){case"Home":N=w;break;case"End":N=I;break;case"ArrowRight":s==="horizontal"&&(g?k():A());break;case"ArrowDown":s==="vertical"&&k();break;case"ArrowLeft":s==="horizontal"&&(g?A():k());break;case"ArrowUp":s==="vertical"&&A();break}const M=N%S;v[M].ref.current?.focus()});return y.jsx(IN,{scope:n,disabled:r,direction:i,orientation:s,children:y.jsx(fu.Slot,{scope:n,children:y.jsx(Ke.div,{...a,"data-orientation":s,ref:u,onKeyDown:r?void 0:h})})})}),fa="AccordionItem",[EN,hu]=ua(fa),yg=T.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,s=da(fa,n),a=bN(fa,n),l=pu(n),u=Ci(),d=r&&a.value.includes(r)||!1,f=s.disabled||e.disabled;return y.jsx(EN,{scope:n,open:d,disabled:f,triggerId:u,children:y.jsx(hN,{"data-orientation":s.orientation,"data-state":_g(d),...l,...i,ref:t,disabled:f,open:d,onOpenChange:g=>{g?a.onItemOpen(r):a.onItemClose(r)}})})});yg.displayName=fa;var vg="AccordionHeader",xg=T.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=da(vn,n),s=hu(vg,n);return y.jsx(Ke.h3,{"data-orientation":i.orientation,"data-state":_g(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:t})});xg.displayName=vg;var gu="AccordionTrigger",wg=T.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=da(vn,n),s=hu(gu,n),a=SN(gu,n),l=pu(n);return y.jsx(fu.ItemSlot,{scope:n,children:y.jsx(gN,{"aria-disabled":s.open&&!a.collapsible||void 0,"data-orientation":i.orientation,id:s.triggerId,...l,...r,ref:t})})});wg.displayName=gu;var bg="AccordionContent",Sg=T.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=da(vn,n),s=hu(bg,n),a=pu(n);return y.jsx(mN,{role:"region","aria-labelledby":s.triggerId,"data-orientation":i.orientation,...a,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Sg.displayName=bg;function _g(e){return e?"open":"closed"}var TN=pg,CN=yg,AN=xg,kN=wg,MN=Sg;function Ur(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>t.current?.(...n),[])}function ON(e,t=globalThis?.document){const n=Ur(e);V.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var PN="DismissableLayer",mu="dismissableLayer.update",RN="dismissableLayer.pointerDownOutside",LN="dismissableLayer.focusOutside",Ng,Ig=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Eg=V.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...u}=e,d=V.useContext(Ig),[f,g]=V.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=V.useState({}),x=ut(t,M=>g(M)),v=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),S=v.indexOf(b),N=f?v.indexOf(f):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,I=N>=S,k=$N(M=>{const B=M.target,U=[...d.branches].some(q=>q.contains(B));!I||U||(i?.(M),a?.(M),M.defaultPrevented||l?.())},h),A=HN(M=>{const B=M.target;[...d.branches].some(q=>q.contains(B))||(s?.(M),a?.(M),M.defaultPrevented||l?.())},h);return ON(M=>{N===d.layers.size-1&&(r?.(M),!M.defaultPrevented&&l&&(M.preventDefault(),l()))},h),V.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ng=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Tg(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ng)}},[f,h,n,d]),V.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Tg())},[f,d]),V.useEffect(()=>{const M=()=>m({});return document.addEventListener(mu,M),()=>document.removeEventListener(mu,M)},[]),y.jsx(Ke.div,{...u,ref:x,style:{pointerEvents:w?I?"auto":"none":void 0,...e.style},onFocusCapture:it(e.onFocusCapture,A.onFocusCapture),onBlurCapture:it(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:it(e.onPointerDownCapture,k.onPointerDownCapture)})});Eg.displayName=PN;var DN="DismissableLayerBranch",jN=V.forwardRef((e,t)=>{const n=V.useContext(Ig),r=V.useRef(null),i=ut(t,r);return V.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),y.jsx(Ke.div,{...e,ref:i})});jN.displayName=DN;function $N(e,t=globalThis?.document){const n=Ur(e),r=V.useRef(!1),i=V.useRef(()=>{});return V.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let u=function(){Cg(RN,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function HN(e,t=globalThis?.document){const n=Ur(e),r=V.useRef(!1);return V.useEffect(()=>{const i=s=>{s.target&&!r.current&&Cg(LN,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Tg(){const e=new CustomEvent(mu);document.dispatchEvent(e)}function Cg(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Q_(i,s):i.dispatchEvent(s)}var yu="focusScope.autoFocusOnMount",vu="focusScope.autoFocusOnUnmount",Ag={bubbles:!1,cancelable:!0},BN="FocusScope",kg=V.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=e,[l,u]=V.useState(null),d=Ur(i),f=Ur(s),g=V.useRef(null),h=ut(t,v=>u(v)),m=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let v=function(w){if(m.paused||!l)return;const I=w.target;l.contains(I)?g.current=I:mr(g.current,{select:!0})},b=function(w){if(m.paused||!l)return;const I=w.relatedTarget;I!==null&&(l.contains(I)||mr(g.current,{select:!0}))},S=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&mr(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const N=new MutationObserver(S);return l&&N.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),N.disconnect()}}},[r,l,m.paused]),V.useEffect(()=>{if(l){Pg.add(m);const v=document.activeElement;if(!l.contains(v)){const S=new CustomEvent(yu,Ag);l.addEventListener(yu,d),l.dispatchEvent(S),S.defaultPrevented||(VN(GN(Mg(l)),{select:!0}),document.activeElement===v&&mr(l))}return()=>{l.removeEventListener(yu,d),setTimeout(()=>{const S=new CustomEvent(vu,Ag);l.addEventListener(vu,f),l.dispatchEvent(S),S.defaultPrevented||mr(v??document.body,{select:!0}),l.removeEventListener(vu,f),Pg.remove(m)},0)}}},[l,d,f,m]);const x=V.useCallback(v=>{if(!n&&!r||m.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,S=document.activeElement;if(b&&S){const N=v.currentTarget,[w,I]=FN(N);w&&I?!v.shiftKey&&S===I?(v.preventDefault(),n&&mr(w,{select:!0})):v.shiftKey&&S===w&&(v.preventDefault(),n&&mr(I,{select:!0})):S===N&&v.preventDefault()}},[n,r,m.paused]);return y.jsx(Ke.div,{tabIndex:-1,...a,ref:h,onKeyDown:x})});kg.displayName=BN;function VN(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mr(r,{select:t}),document.activeElement!==n)return}function FN(e){const t=Mg(e),n=Og(t,e),r=Og(t.reverse(),e);return[n,r]}function Mg(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Og(e,t){for(const n of e)if(!zN(n,{upTo:t}))return n}function zN(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function UN(e){return e instanceof HTMLInputElement&&"select"in e}function mr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&UN(e)&&t&&e.select()}}var Pg=WN();function WN(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Rg(e,t),e.unshift(t)},remove(t){e=Rg(e,t),e[0]?.resume()}}}function Rg(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function GN(e){return e.filter(t=>t.tagName!=="A")}var qN="Portal",Lg=V.forwardRef((e,t)=>{const{container:n,...r}=e,[i,s]=V.useState(!1);_t(()=>s(!0),[]);const a=n||i&&globalThis?.document?.body;return a?Fh.createPortal(y.jsx(Ke.div,{...r,ref:t}),a):null});Lg.displayName=qN;var xu=0;function YN(){V.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dg()),document.body.insertAdjacentElement("beforeend",e[1]??Dg()),xu++,()=>{xu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xu--}},[])}function Dg(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Pn=function(){return Pn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Pn.apply(this,arguments)};function jg(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function XN(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var pa="right-scroll-bar-position",ha="width-before-scroll-bar",KN="with-scroll-bars-hidden",ZN="--removed-body-scroll-bar-size";function wu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function JN(e,t){var n=T.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var QN=typeof window<"u"?V.useLayoutEffect:V.useEffect,$g=new WeakMap;function eI(e,t){var n=JN(null,function(r){return e.forEach(function(i){return wu(i,r)})});return QN(function(){var r=$g.get(n);if(r){var i=new Set(r),s=new Set(e),a=n.current;i.forEach(function(l){s.has(l)||wu(l,null)}),s.forEach(function(l){i.has(l)||wu(l,a)})}$g.set(n,e)},[e]),n}function tI(e){return e}function nI(e,t){t===void 0&&(t=tI);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var u=function(){var f=a;a=[],f.forEach(s)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(f){a.push(f),d()},filter:function(f){return a=a.filter(f),n}}}};return i}function rI(e){e===void 0&&(e={});var t=nI(null);return t.options=Pn({async:!0,ssr:!1},e),t}var Hg=function(e){var t=e.sideCar,n=jg(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return V.createElement(r,Pn({},n))};Hg.isSideCarExport=!0;function oI(e,t){return e.useMedium(t),Hg}var Bg=rI(),bu=function(){},ga=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:bu,onWheelCapture:bu,onTouchMoveCapture:bu}),i=r[0],s=r[1],a=e.forwardProps,l=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,g=e.shards,h=e.sideCar,m=e.noRelative,x=e.noIsolation,v=e.inert,b=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,w=e.gapMode,I=jg(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,A=eI([n,t]),M=Pn(Pn({},I),i);return V.createElement(V.Fragment,null,f&&V.createElement(k,{sideCar:Bg,removeScrollBar:d,shards:g,noRelative:m,noIsolation:x,inert:v,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:w}),a?V.cloneElement(V.Children.only(l),Pn(Pn({},M),{ref:A})):V.createElement(N,Pn({},M,{className:u,ref:A}),l))});ga.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ga.classNames={fullWidth:ha,zeroRight:pa};var iI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=iI();return t&&e.setAttribute("nonce",t),e}function aI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sI())&&(aI(t,n),cI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},uI=function(){var e=lI();return function(t,n){V.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vg=function(){var e=uI(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},dI={left:0,top:0,right:0,gap:0},Su=function(e){return parseInt(e||"",10)||0},fI=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Su(n),Su(r),Su(i)]},pI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return dI;var t=fI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hI=Vg(),Eo="data-scroll-locked",gI=function(e,t,n,r){var i=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
193
+ .`.concat(KN,` {
194
+ overflow: hidden `).concat(r,`;
195
+ padding-right: `).concat(l,"px ").concat(r,`;
151
196
  }
152
- body[`).concat(yo,`] {
153
- overflow: hidden `).concat(o,`;
197
+ body[`).concat(Eo,`] {
198
+ overflow: hidden `).concat(r,`;
154
199
  overscroll-behavior: contain;
155
- `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&`
156
- padding-left: `.concat(s,`px;
157
- padding-top: `).concat(a,`px;
158
- padding-right: `).concat(l,`px;
200
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
201
+ padding-left: `.concat(i,`px;
202
+ padding-top: `).concat(s,`px;
203
+ padding-right: `).concat(a,`px;
159
204
  margin-left:0;
160
205
  margin-top:0;
161
- margin-right: `).concat(c,"px ").concat(o,`;
162
- `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(o,";")].filter(Boolean).join(""),`
206
+ margin-right: `).concat(l,"px ").concat(r,`;
207
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
163
208
  }
164
209
 
165
- .`).concat(Na,` {
166
- right: `).concat(c,"px ").concat(o,`;
210
+ .`).concat(pa,` {
211
+ right: `).concat(l,"px ").concat(r,`;
167
212
  }
168
213
 
169
- .`).concat(Ta,` {
170
- margin-right: `).concat(c,"px ").concat(o,`;
214
+ .`).concat(ha,` {
215
+ margin-right: `).concat(l,"px ").concat(r,`;
171
216
  }
172
217
 
173
- .`).concat(Na," .").concat(Na,` {
174
- right: 0 `).concat(o,`;
218
+ .`).concat(pa," .").concat(pa,` {
219
+ right: 0 `).concat(r,`;
175
220
  }
176
221
 
177
- .`).concat(Ta," .").concat(Ta,` {
178
- margin-right: 0 `).concat(o,`;
222
+ .`).concat(ha," .").concat(ha,` {
223
+ margin-right: 0 `).concat(r,`;
179
224
  }
180
225
 
181
- body[`).concat(yo,`] {
182
- `).concat(EO,": ").concat(c,`px;
226
+ body[`).concat(Eo,`] {
227
+ `).concat(ZN,": ").concat(l,`px;
183
228
  }
184
- `)},s0=function(){var e=parseInt(document.body.getAttribute(yo)||"0",10);return isFinite(e)?e:0},WO=function(){L.useEffect(function(){return document.body.setAttribute(yo,(s0()+1).toString()),function(){var e=s0()-1;e<=0?document.body.removeAttribute(yo):document.body.setAttribute(yo,e.toString())}},[])},jO=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,s=o===void 0?"margin":o;WO();var a=L.useMemo(function(){return HO(s)},[s]);return L.createElement(zO,{styles:VO(a,!t,s,n?"":"!important")})},Fu=!1;if(typeof window<"u")try{var Ia=Object.defineProperty({},"passive",{get:function(){return Fu=!0,!0}});window.addEventListener("test",Ia,Ia),window.removeEventListener("test",Ia,Ia)}catch{Fu=!1}var vo=Fu?{passive:!1}:!1,UO=function(e){return e.tagName==="TEXTAREA"},a0=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!UO(e)&&n[t]==="visible")},GO=function(e){return a0(e,"overflowY")},YO=function(e){return a0(e,"overflowX")},l0=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var s=c0(e,o);if(s){var a=u0(e,o),l=a[1],c=a[2];if(l>c)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},XO=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},qO=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},c0=function(e,t){return e==="v"?GO(t):YO(t)},u0=function(e,t){return e==="v"?XO(t):qO(t)},KO=function(e,t){return e==="h"&&t==="rtl"?-1:1},ZO=function(e,t,n,o,s){var a=KO(e,window.getComputedStyle(t).direction),l=a*o,c=n.target,f=t.contains(c),d=!1,h=l>0,g=0,p=0;do{if(!c)break;var m=u0(e,c),x=m[0],v=m[1],b=m[2],_=v-b-a*x;(x||_)&&c0(e,c)&&(g+=_,p+=x);var N=c.parentNode;c=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!f&&c!==document.body||f&&(t.contains(c)||t===c));return(h&&Math.abs(g)<1||!h&&Math.abs(p)<1)&&(d=!0),d},Oa=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},f0=function(e){return[e.deltaX,e.deltaY]},d0=function(e){return e&&"current"in e?e.current:e},QO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},JO=function(e){return`
229
+ `)},Fg=function(){var e=parseInt(document.body.getAttribute(Eo)||"0",10);return isFinite(e)?e:0},mI=function(){V.useEffect(function(){return document.body.setAttribute(Eo,(Fg()+1).toString()),function(){var e=Fg()-1;e<=0?document.body.removeAttribute(Eo):document.body.setAttribute(Eo,e.toString())}},[])},yI=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;mI();var s=V.useMemo(function(){return pI(i)},[i]);return V.createElement(hI,{styles:gI(s,!t,i,n?"":"!important")})},_u=!1;if(typeof window<"u")try{var ma=Object.defineProperty({},"passive",{get:function(){return _u=!0,!0}});window.addEventListener("test",ma,ma),window.removeEventListener("test",ma,ma)}catch{_u=!1}var To=_u?{passive:!1}:!1,vI=function(e){return e.tagName==="TEXTAREA"},zg=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!vI(e)&&n[t]==="visible")},xI=function(e){return zg(e,"overflowY")},wI=function(e){return zg(e,"overflowX")},Ug=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Wg(e,r);if(i){var s=Gg(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bI=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},SI=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Wg=function(e,t){return e==="v"?xI(t):wI(t)},Gg=function(e,t){return e==="v"?bI(t):SI(t)},_I=function(e,t){return e==="h"&&t==="rtl"?-1:1},NI=function(e,t,n,r,i){var s=_I(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,u=t.contains(l),d=!1,f=a>0,g=0,h=0;do{if(!l)break;var m=Gg(e,l),x=m[0],v=m[1],b=m[2],S=v-b-s*x;(x||S)&&Wg(e,l)&&(g+=S,h+=x);var N=l.parentNode;l=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(f&&Math.abs(g)<1||!f&&Math.abs(h)<1)&&(d=!0),d},ya=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qg=function(e){return[e.deltaX,e.deltaY]},Yg=function(e){return e&&"current"in e?e.current:e},II=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EI=function(e){return`
185
230
  .block-interactivity-`.concat(e,` {pointer-events: none;}
186
231
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
187
- `)},eP=0,xo=[];function tP(e){var t=L.useRef([]),n=L.useRef([0,0]),o=L.useRef(),s=L.useState(eP++)[0],a=L.useState(i0)[0],l=L.useRef(e);L.useEffect(function(){l.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=_O([e.lockRef.current],(e.shards||[]).map(d0),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=L.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!l.current.allowPinchZoom;var _=Oa(v),N=n.current,w="deltaX"in v?v.deltaX:N[0]-_[0],E="deltaY"in v?v.deltaY:N[1]-_[1],O,k=v.target,M=Math.abs(w)>Math.abs(E)?"h":"v";if("touches"in v&&M==="h"&&k.type==="range")return!1;var D=l0(M,k);if(!D)return!0;if(D?O=M:(O=M==="v"?"h":"v",D=l0(M,k)),!D)return!1;if(!o.current&&"changedTouches"in v&&(w||E)&&(o.current=O),!O)return!0;var V=o.current||O;return ZO(V,b,v,V==="h"?w:E)},[]),f=L.useCallback(function(v){var b=v;if(!(!xo.length||xo[xo.length-1]!==a)){var _="deltaY"in b?f0(b):Oa(b),N=t.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&QO(O.delta,_)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var w=(l.current.shards||[]).map(d0).filter(Boolean).filter(function(O){return O.contains(b.target)}),E=w.length>0?c(b,w[0]):!l.current.noIsolation;E&&b.cancelable&&b.preventDefault()}}},[]),d=L.useCallback(function(v,b,_,N){var w={name:v,delta:b,target:_,should:N,shadowParent:nP(_)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(E){return E!==w})},1)},[]),h=L.useCallback(function(v){n.current=Oa(v),o.current=void 0},[]),g=L.useCallback(function(v){d(v.type,f0(v),v.target,c(v,e.lockRef.current))},[]),p=L.useCallback(function(v){d(v.type,Oa(v),v.target,c(v,e.lockRef.current))},[]);L.useEffect(function(){return xo.push(a),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:p}),document.addEventListener("wheel",f,vo),document.addEventListener("touchmove",f,vo),document.addEventListener("touchstart",h,vo),function(){xo=xo.filter(function(v){return v!==a}),document.removeEventListener("wheel",f,vo),document.removeEventListener("touchmove",f,vo),document.removeEventListener("touchstart",h,vo)}},[]);var m=e.removeScrollBar,x=e.inert;return L.createElement(L.Fragment,null,x?L.createElement(a,{styles:JO(s)}):null,m?L.createElement(jO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rP=PO(o0,tP);var h0=L.forwardRef(function(e,t){return L.createElement(Aa,wn({},e,{ref:t,sideCar:rP}))});h0.classNames=Aa.classNames;var oP=[" ","Enter","ArrowUp","ArrowDown"],iP=[" ","Enter"],Rr="Select",[Pa,ka,sP]=II(Rr),[wo,X$]=Tu(Rr,[sP,Vy]),Ma=Vy(),[aP,sr]=wo(Rr),[lP,cP]=wo(Rr),p0=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:s,onOpenChange:a,value:l,defaultValue:c,onValueChange:f,dir:d,name:h,autoComplete:g,disabled:p,required:m,form:x}=e,v=Ma(t),[b,_]=L.useState(null),[N,w]=L.useState(null),[E,O]=L.useState(!1),k=PI(d),[M,D]=Qy({prop:o,defaultProp:s??!1,onChange:a,caller:Rr}),[V,K]=Qy({prop:l,defaultProp:c,onChange:f,caller:Rr}),Z=L.useRef(null),U=b?x||!!b.closest("form"):!0,[q,C]=L.useState(new Set),H=Array.from(q).map(B=>B.props.value).join(";");return T.jsx(aO,{...v,children:T.jsxs(aP,{required:m,scope:t,trigger:b,onTriggerChange:_,valueNode:N,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:O,contentId:ku(),value:V,onValueChange:K,open:M,onOpenChange:D,dir:k,triggerPointerDownPosRef:Z,disabled:p,children:[T.jsx(Pa.Provider,{scope:t,children:T.jsx(lP,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(B=>{C(R=>new Set(R).add(B))},[]),onNativeOptionRemove:L.useCallback(B=>{C(R=>{const P=new Set(R);return P.delete(B),P})},[]),children:n})}),U?T.jsxs(F0,{"aria-hidden":!0,required:m,tabIndex:-1,name:h,autoComplete:g,value:V,onChange:B=>K(B.target.value),disabled:p,form:x,children:[V===void 0?T.jsx("option",{value:""}):null,Array.from(q)]},H):null]})})};p0.displayName=Rr;var g0="SelectTrigger",m0=L.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...s}=e,a=Ma(n),l=sr(g0,n),c=l.disabled||o,f=ut(t,l.onTriggerChange),d=ka(n),h=L.useRef("touch"),[g,p,m]=z0(v=>{const b=d().filter(w=>!w.disabled),_=b.find(w=>w.value===l.value),N=V0(b,v,_);N!==void 0&&l.onValueChange(N.value)}),x=v=>{c||(l.onOpenChange(!0),m()),v&&(l.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return T.jsx(lO,{asChild:!0,...a,children:T.jsx(Je.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":H0(l.value)?"":void 0,...s,ref:f,onClick:ot(s.onClick,v=>{v.currentTarget.focus(),h.current!=="mouse"&&x(v)}),onPointerDown:ot(s.onPointerDown,v=>{h.current=v.pointerType;const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(x(v),v.preventDefault())}),onKeyDown:ot(s.onKeyDown,v=>{const b=g.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&p(v.key),!(b&&v.key===" ")&&oP.includes(v.key)&&(x(),v.preventDefault())})})})});m0.displayName=g0;var y0="SelectValue",v0=L.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,children:a,placeholder:l="",...c}=e,f=sr(y0,n),{onValueNodeHasChildrenChange:d}=f,h=a!==void 0,g=ut(t,f.onValueNodeChange);return St(()=>{d(h)},[d,h]),T.jsx(Je.span,{...c,ref:g,style:{pointerEvents:"none"},children:H0(f.value)?T.jsx(T.Fragment,{children:l}):a})});v0.displayName=y0;var uP="SelectIcon",x0=L.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...s}=e;return T.jsx(Je.span,{"aria-hidden":!0,...s,ref:t,children:o||"▼"})});x0.displayName=uP;var fP="SelectPortal",w0=e=>T.jsx(Zy,{asChild:!0,...e});w0.displayName=fP;var Dr="SelectContent",b0=L.forwardRef((e,t)=>{const n=sr(Dr,e.__scopeSelect),[o,s]=L.useState();if(St(()=>{s(new DocumentFragment)},[]),!n.open){const a=o;return a?cs.createPortal(T.jsx(_0,{scope:e.__scopeSelect,children:T.jsx(Pa.Slot,{scope:e.__scopeSelect,children:T.jsx("div",{children:e.children})})}),a):null}return T.jsx(S0,{...e,ref:t})});b0.displayName=Dr;var tn=10,[_0,ar]=wo(Dr),dP="SelectContentImpl",hP=Vo("SelectContent.RemoveScroll"),S0=L.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:f,align:d,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:m,sticky:x,hideWhenDetached:v,avoidCollisions:b,..._}=e,N=sr(Dr,n),[w,E]=L.useState(null),[O,k]=L.useState(null),M=ut(t,te=>E(te)),[D,V]=L.useState(null),[K,Z]=L.useState(null),U=ka(n),[q,C]=L.useState(!1),H=L.useRef(!1);L.useEffect(()=>{if(w)return bO(w)},[w]),VI();const B=L.useCallback(te=>{const[Q,...ae]=U().map(ue=>ue.ref.current),[fe]=ae.slice(-1),de=document.activeElement;for(const ue of te)if(ue===de||(ue?.scrollIntoView({block:"nearest"}),ue===Q&&O&&(O.scrollTop=0),ue===fe&&O&&(O.scrollTop=O.scrollHeight),ue?.focus(),document.activeElement!==de))return},[U,O]),R=L.useCallback(()=>B([D,w]),[B,D,w]);L.useEffect(()=>{q&&R()},[q,R]);const{onOpenChange:P,triggerPointerDownPosRef:W}=N;L.useEffect(()=>{if(w){let te={x:0,y:0};const Q=fe=>{te={x:Math.abs(Math.round(fe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(fe.pageY)-(W.current?.y??0))}},ae=fe=>{te.x<=10&&te.y<=10?fe.preventDefault():w.contains(fe.target)||P(!1),document.removeEventListener("pointermove",Q),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",ae,{capture:!0})}}},[w,P,W]),L.useEffect(()=>{const te=()=>P(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[P]);const[$,G]=z0(te=>{const Q=U().filter(de=>!de.disabled),ae=Q.find(de=>de.ref.current===document.activeElement),fe=V0(Q,te,ae);fe&&setTimeout(()=>fe.ref.current.focus())}),J=L.useCallback((te,Q,ae)=>{const fe=!H.current&&!ae;(N.value!==void 0&&N.value===Q||fe)&&(V(te),fe&&(H.current=!0))},[N.value]),re=L.useCallback(()=>w?.focus(),[w]),se=L.useCallback((te,Q,ae)=>{const fe=!H.current&&!ae;(N.value!==void 0&&N.value===Q||fe)&&Z(te)},[N.value]),ce=o==="popper"?Hu:E0,ge=ce===Hu?{side:c,sideOffset:f,align:d,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:m,sticky:x,hideWhenDetached:v,avoidCollisions:b}:{};return T.jsx(_0,{scope:n,content:w,viewport:O,onViewportChange:k,itemRefCallback:J,selectedItem:D,onItemLeave:re,itemTextRefCallback:se,focusSelectedItem:R,selectedItemText:K,position:o,isPositioned:q,searchRef:$,children:T.jsx(h0,{as:hP,allowPinchZoom:!0,children:T.jsx(Dy,{asChild:!0,trapped:N.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:ot(s,te=>{N.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:T.jsx(Oy,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:T.jsx(ce,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:te=>te.preventDefault(),..._,...ge,onPlaced:()=>C(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:ot(_.onKeyDown,te=>{const Q=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!Q&&te.key.length===1&&G(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let fe=U().filter(de=>!de.disabled).map(de=>de.ref.current);if(["ArrowUp","End"].includes(te.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const de=te.target,ue=fe.indexOf(de);fe=fe.slice(ue+1)}setTimeout(()=>B(fe)),te.preventDefault()}})})})})})})});S0.displayName=dP;var pP="SelectItemAlignedPosition",E0=L.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...s}=e,a=sr(Dr,n),l=ar(Dr,n),[c,f]=L.useState(null),[d,h]=L.useState(null),g=ut(t,M=>h(M)),p=ka(n),m=L.useRef(!1),x=L.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:_,focusSelectedItem:N}=l,w=L.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&d&&v&&b&&_){const M=a.trigger.getBoundingClientRect(),D=d.getBoundingClientRect(),V=a.valueNode.getBoundingClientRect(),K=_.getBoundingClientRect();if(a.dir!=="rtl"){const de=K.left-D.left,ue=V.left-de,_e=M.left-ue,ye=M.width+_e,Le=Math.max(ye,D.width),Ze=window.innerWidth-tn,Ge=Ty(ue,[tn,Math.max(tn,Ze-Le)]);c.style.minWidth=ye+"px",c.style.left=Ge+"px"}else{const de=D.right-K.right,ue=window.innerWidth-V.right-de,_e=window.innerWidth-M.right-ue,ye=M.width+_e,Le=Math.max(ye,D.width),Ze=window.innerWidth-tn,Ge=Ty(ue,[tn,Math.max(tn,Ze-Le)]);c.style.minWidth=ye+"px",c.style.right=Ge+"px"}const Z=p(),U=window.innerHeight-tn*2,q=v.scrollHeight,C=window.getComputedStyle(d),H=parseInt(C.borderTopWidth,10),B=parseInt(C.paddingTop,10),R=parseInt(C.borderBottomWidth,10),P=parseInt(C.paddingBottom,10),W=H+B+q+P+R,$=Math.min(b.offsetHeight*5,W),G=window.getComputedStyle(v),J=parseInt(G.paddingTop,10),re=parseInt(G.paddingBottom,10),se=M.top+M.height/2-tn,ce=U-se,ge=b.offsetHeight/2,te=b.offsetTop+ge,Q=H+B+te,ae=W-Q;if(Q<=se){const de=Z.length>0&&b===Z[Z.length-1].ref.current;c.style.bottom="0px";const ue=d.clientHeight-v.offsetTop-v.offsetHeight,_e=Math.max(ce,ge+(de?re:0)+ue+R),ye=Q+_e;c.style.height=ye+"px"}else{const de=Z.length>0&&b===Z[0].ref.current;c.style.top="0px";const _e=Math.max(se,H+v.offsetTop+(de?J:0)+ge)+ae;c.style.height=_e+"px",v.scrollTop=Q-se+v.offsetTop}c.style.margin=`${tn}px 0`,c.style.minHeight=$+"px",c.style.maxHeight=U+"px",o?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,c,d,v,b,_,a.dir,o]);St(()=>w(),[w]);const[E,O]=L.useState();St(()=>{d&&O(window.getComputedStyle(d).zIndex)},[d]);const k=L.useCallback(M=>{M&&x.current===!0&&(w(),N?.(),x.current=!1)},[w,N]);return T.jsx(mP,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:k,children:T.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:T.jsx(Je.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});E0.displayName=pP;var gP="SelectPopperPosition",Hu=L.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:s=tn,...a}=e,l=Ma(n);return T.jsx(cO,{...l,...a,ref:t,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Hu.displayName=gP;var[mP,zu]=wo(Dr,{}),Vu="SelectViewport",C0=L.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...s}=e,a=ar(Vu,n),l=zu(Vu,n),c=ut(t,a.onViewportChange),f=L.useRef(0);return T.jsxs(T.Fragment,{children:[T.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),T.jsx(Pa.Slot,{scope:n,children:T.jsx(Je.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ot(s.onScroll,d=>{const h=d.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:p}=l;if(p?.current&&g){const m=Math.abs(f.current-h.scrollTop);if(m>0){const x=window.innerHeight-tn*2,v=parseFloat(g.style.minHeight),b=parseFloat(g.style.height),_=Math.max(v,b);if(_<x){const N=_+m,w=Math.min(x,N),E=N-w;g.style.height=w+"px",g.style.bottom==="0px"&&(h.scrollTop=E>0?E:0,g.style.justifyContent="flex-end")}}}f.current=h.scrollTop})})})]})});C0.displayName=Vu;var N0="SelectGroup",[yP,vP]=wo(N0),T0=L.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=ku();return T.jsx(yP,{scope:n,id:s,children:T.jsx(Je.div,{role:"group","aria-labelledby":s,...o,ref:t})})});T0.displayName=N0;var A0="SelectLabel",I0=L.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=vP(A0,n);return T.jsx(Je.div,{id:s.id,...o,ref:t})});I0.displayName=A0;var Ra="SelectItem",[xP,O0]=wo(Ra),P0=L.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:a,...l}=e,c=sr(Ra,n),f=ar(Ra,n),d=c.value===o,[h,g]=L.useState(a??""),[p,m]=L.useState(!1),x=ut(t,N=>f.itemRefCallback?.(N,o,s)),v=ku(),b=L.useRef("touch"),_=()=>{s||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return T.jsx(xP,{scope:n,value:o,disabled:s,textId:v,isSelected:d,onItemTextChange:L.useCallback(N=>{g(w=>w||(N?.textContent??"").trim())},[]),children:T.jsx(Pa.ItemSlot,{scope:n,value:o,disabled:s,textValue:h,children:T.jsx(Je.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:x,onFocus:ot(l.onFocus,()=>m(!0)),onBlur:ot(l.onBlur,()=>m(!1)),onClick:ot(l.onClick,()=>{b.current!=="mouse"&&_()}),onPointerUp:ot(l.onPointerUp,()=>{b.current==="mouse"&&_()}),onPointerDown:ot(l.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:ot(l.onPointerMove,N=>{b.current=N.pointerType,s?f.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ot(l.onPointerLeave,N=>{N.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:ot(l.onKeyDown,N=>{f.searchRef?.current!==""&&N.key===" "||(iP.includes(N.key)&&_(),N.key===" "&&N.preventDefault())})})})})});P0.displayName=Ra;var ki="SelectItemText",k0=L.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,...a}=e,l=sr(ki,n),c=ar(ki,n),f=O0(ki,n),d=cP(ki,n),[h,g]=L.useState(null),p=ut(t,_=>g(_),f.onItemTextChange,_=>c.itemTextRefCallback?.(_,f.value,f.disabled)),m=h?.textContent,x=L.useMemo(()=>T.jsx("option",{value:f.value,disabled:f.disabled,children:m},f.value),[f.disabled,f.value,m]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=d;return St(()=>(v(x),()=>b(x)),[v,b,x]),T.jsxs(T.Fragment,{children:[T.jsx(Je.span,{id:f.textId,...a,ref:p}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren?cs.createPortal(a.children,l.valueNode):null]})});k0.displayName=ki;var M0="SelectItemIndicator",R0=L.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return O0(M0,n).isSelected?T.jsx(Je.span,{"aria-hidden":!0,...o,ref:t}):null});R0.displayName=M0;var Wu="SelectScrollUpButton",D0=L.forwardRef((e,t)=>{const n=ar(Wu,e.__scopeSelect),o=zu(Wu,e.__scopeSelect),[s,a]=L.useState(!1),l=ut(t,o.onScrollButtonChange);return St(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=f.scrollTop>0;a(d)};const f=n.viewport;return c(),f.addEventListener("scroll",c),()=>f.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?T.jsx($0,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:f}=n;c&&f&&(c.scrollTop=c.scrollTop-f.offsetHeight)}}):null});D0.displayName=Wu;var ju="SelectScrollDownButton",L0=L.forwardRef((e,t)=>{const n=ar(ju,e.__scopeSelect),o=zu(ju,e.__scopeSelect),[s,a]=L.useState(!1),l=ut(t,o.onScrollButtonChange);return St(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=f.scrollHeight-f.clientHeight,h=Math.ceil(f.scrollTop)<d;a(h)};const f=n.viewport;return c(),f.addEventListener("scroll",c),()=>f.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?T.jsx($0,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:f}=n;c&&f&&(c.scrollTop=c.scrollTop+f.offsetHeight)}}):null});L0.displayName=ju;var $0=L.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=e,a=ar("SelectScrollButton",n),l=L.useRef(null),c=ka(n),f=L.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return L.useEffect(()=>()=>f(),[f]),St(()=>{c().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),T.jsx(Je.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ot(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:ot(s.onPointerMove,()=>{a.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:ot(s.onPointerLeave,()=>{f()})})}),wP="SelectSeparator",B0=L.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return T.jsx(Je.div,{"aria-hidden":!0,...o,ref:t})});B0.displayName=wP;var Uu="SelectArrow",bP=L.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=Ma(n),a=sr(Uu,n),l=ar(Uu,n);return a.open&&l.position==="popper"?T.jsx(uO,{...s,...o,ref:t}):null});bP.displayName=Uu;var _P="SelectBubbleInput",F0=L.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const s=L.useRef(null),a=ut(o,s),l=gO(t);return L.useEffect(()=>{const c=s.current;if(!c)return;const f=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(f,"value").set;if(l!==t&&h){const g=new Event("change",{bubbles:!0});h.call(c,t),c.dispatchEvent(g)}},[l,t]),T.jsx(Je.select,{...n,style:{...Jy,...n.style},ref:a,defaultValue:t})});F0.displayName=_P;function H0(e){return e===""||e===void 0}function z0(e){const t=Mr(e),n=L.useRef(""),o=L.useRef(0),s=L.useCallback(l=>{const c=n.current+l;t(c),function f(d){n.current=d,window.clearTimeout(o.current),d!==""&&(o.current=window.setTimeout(()=>f(""),1e3))}(c)},[t]),a=L.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,s,a]}function V0(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=SP(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const f=l.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return f!==n?f:void 0}function SP(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var EP=p0,W0=m0,j0=v0,CP=x0,NP=w0,U0=b0,TP=C0,AP=T0,G0=I0,Y0=P0,IP=k0,OP=R0,X0=D0,q0=L0,K0=B0;const Z0=EP,Gu=z.forwardRef(({className:e,children:t,...n},o)=>T.jsxs(W0,{ref:o,className:Ne("flex h-[44px] w-full items-center justify-between rounded-md border cursor-pointer border-secondary-dark-gray bg-primary-black px-4 py-2 text-[27px] leading-[27px] font-main text-primary-white data-[placeholder]:text-[#6B6B6B] focus:outline-none focus-visible:ring-1 focus-visible:ring-white disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[T.jsx("span",{className:"text-left truncate",children:t}),T.jsx(CP,{asChild:!0,children:T.jsx(aa,{className:"h-6 w-6 shrink-0 ml-2"})})]}));Gu.displayName=W0.displayName;const Yu=z.forwardRef(({className:e,...t},n)=>T.jsx(X0,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:T.jsx(nu,{className:"h-4 w-4"})}));Yu.displayName=X0.displayName;const Xu=z.forwardRef(({className:e,...t},n)=>T.jsx(q0,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:T.jsx(aa,{className:"h-4 w-4"})}));Xu.displayName=q0.displayName;const qu=z.forwardRef(({className:e,children:t,position:n="popper",...o},s)=>T.jsx(NP,{children:T.jsxs(U0,{ref:s,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-secondary-dark-gray bg-[#181818] text-primary-white shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[T.jsx(Yu,{}),T.jsx(TP,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),T.jsx(Xu,{})]})}));qu.displayName=U0.displayName;const Q0=z.forwardRef(({className:e,...t},n)=>T.jsx(G0,{ref:n,className:Ne("py-1.5 px-2 text-[27px] leading-[27px] font-main font-semibold text-primary-white",e),...t}));Q0.displayName=G0.displayName;const Da=z.forwardRef(({className:e,children:t,...n},o)=>T.jsxs(Y0,{ref:o,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-4 pr-2 text-[27px] leading-[27px] font-main text-primary-white outline-none focus:bg-[#3F3F3F] focus:text-primary-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[T.jsx(IP,{children:t}),T.jsx("span",{className:"ml-auto",children:T.jsx(OP,{children:T.jsx(QT,{className:"h-5 w-5 ml-2 mr-1",strokeWidth:2.5})})})]}));Da.displayName=Y0.displayName;const J0=z.forwardRef(({className:e,...t},n)=>T.jsx(K0,{ref:n,className:Ne("-mx-1 my-1 h-px bg-secondary-dark-gray",e),...t}));J0.displayName=K0.displayName;const PP=AP,Ku=z.forwardRef(({className:e,...t},n)=>T.jsx(j0,{ref:n,className:Ne(e),...t}));Ku.displayName=j0.displayName;const Ve=["circle","square","rectangle","list","grid","diamond","trapezium","hexagon","star","cross","zigzag","sparkle","parallelogram"],ht={[Ve[0]]:Ve[0],[Ve[1]]:Ve[1],[Ve[2]]:Ve[2],[Ve[3]]:Ve[3],[Ve[4]]:Ve[4],[Ve[5]]:Ve[5],[Ve[6]]:Ve[6],[Ve[7]]:Ve[7],[Ve[8]]:Ve[8],[Ve[9]]:Ve[9],[Ve[10]]:Ve[10],[Ve[11]]:Ve[11],[Ve[12]]:Ve[12]},La=(e,t,n,o="black",s=2)=>T.jsxs("div",{className:Ne("relative",n),children:[T.jsx("div",{className:"absolute",style:{top:-s,left:-s,right:-s,bottom:-s,backgroundColor:o,clipPath:e}}),T.jsx("div",{className:"absolute inset-0",style:{backgroundColor:t,clipPath:e}})]}),ev=(e=ht.circle,t="#A1A1A1",n)=>{const o="border-2 border-black",s="border-1 border-black",a={backgroundColor:t};switch(e){case ht.circle:return T.jsx("div",{className:Ne("w-6 h-6 rounded-full",o,n),style:a});case ht.square:return T.jsx("div",{className:Ne("w-6 h-6",o,n),style:a});case ht.rectangle:return T.jsx("div",{className:Ne("w-4 h-8",o,n),style:a});case ht.list:return T.jsx("div",{className:Ne("w-6 h-6 flex flex-col justify-center gap-0.5",n),children:[0,1,2].map(l=>T.jsx("div",{className:Ne("w-full h-2",s),style:a},l))});case ht.grid:return T.jsx("div",{className:Ne("w-6 h-6 grid grid-cols-2 gap-0.5",n),children:[0,1,2,3].map(l=>T.jsx("div",{className:Ne("w-full h-full",s),style:a},l))});case ht.diamond:return T.jsx("div",{className:Ne("w-6 h-6 rotate-45",o,n),style:a});case ht.trapezium:return La("polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%)",t,Ne("w-6 h-6",n));case ht.hexagon:return La("polygon(-50% 50%,50% 100%,150% 50%,50% 0)",t,Ne("w-5 h-6",n));case ht.star:return La("polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)",t,Ne("w-6 h-6",n));case ht.cross:return T.jsxs("div",{className:Ne("w-6 h-6 relative",n),children:[T.jsx("div",{className:Ne("absolute top-1/2 left-0 w-full h-2 -translate-y-1/2",s),style:a}),T.jsx("div",{className:Ne("absolute left-1/2 top-0 w-2 h-full -translate-x-1/2",s),style:a})]});case ht.zigzag:return T.jsx("div",{className:Ne("w-6 h-6",n),style:{...a,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 ht.sparkle:return T.jsx("div",{className:Ne("w-6 h-6",n),style:{...a,mask:"radial-gradient(#0000 71%, #000 72%) 10000% 10000%/99.5% 99.5%",border:"2px solid black"}});case ht.parallelogram:return La("polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)",t,Ne("w-6 h-6",n));default:return T.jsx("div",{className:Ne("w-6 h-6 rounded-full",o,n),style:a})}},$a=z.forwardRef(({type:e,position:t,id:n,color:o,shape:s=ht.circle,isCurrentlyInsideReactFlow:a=!1,className:l,...c},f)=>a?T.jsx(vi,{type:e,position:t,id:n,className:Ne("!w-6 !h-6 !border-none !bg-transparent !pointer-events-auto",l),style:{backgroundColor:"transparent"},...c,ref:f,children:T.jsx("div",{className:Ne("pointer-events-none flex justify-center"),children:ev(s,o||"#A1A1A1",l)})}):T.jsx("div",{className:Ne("absolute",t===be.Right&&"right-0 top-1/2 -translate-y-1/2 translate-x-1/2",t===be.Left&&"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2"),...c,ref:f,children:ev(s,o||"#A1A1A1",l)}));$a.displayName="ContextAwareHandle";const tv=({input:e})=>{const t=mi(),n=yi();return e.type==="string"?T.jsx(Ai,{placeholder:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(s=>s.map(a=>a.id===n?{...a,data:Nm(a.data,e.id,{value:o},!0,!1,!1)}:a))},allowOnlyNumbers:!1,className:"w-full"}):T.jsx(ca,{name:e.name,value:e.value,onChange:o=>{e.onChange?.(o),t.setNodes(s=>s.map(a=>a.id===n?{...a,data:Nm(a.data,e.id,{value:o},!0,!1,!1)}:a))},className:"w-full"})},nv=({input:e,isCurrentlyInsideReactFlow:t})=>t?T.jsx(tv,{input:e}):e.type==="string"?T.jsx(Ai,{placeholder:e.name,value:e.value,onChange:e.onChange,allowOnlyNumbers:!1,className:"w-full"}):T.jsx(ca,{name:e.name,value:e.value,onChange:e.onChange,className:"w-full"}),rv=({})=>{const e=z.useContext(ef),t=yi(),n=()=>{e?.allProps?.dispatch&&t&&e.allProps.dispatch({type:st.OPEN_NODE_GROUP,payload:{nodeId:t}})};return T.jsx(Vm,{strokeWidth:2.5,className:"shrink-0 w-7 h-7 aspect-square cursor-pointer hover:opacity-80",onClick:n})},ov=({showButton:e=!1,isCurrentlyInsideReactFlow:t})=>e?t?T.jsx(rv,{}):T.jsx(Vm,{strokeWidth:2.5,className:"shrink-0 w-7 h-7 aspect-square cursor-pointer hover:opacity-80"}):T.jsx(T.Fragment,{}),Zu=z.forwardRef(({input:e,isCurrentlyInsideReactFlow:t,hide:n=!1},o)=>{const s=t?iT({handleId:e.id}):[],a=t&&s.some(c=>c.targetHandle===e.id),l=e.allowInput&&!a;return T.jsxs("div",{ref:o,className:Ne("text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row py-3",n&&"h-0 overflow-hidden py-0",l&&"py-1"),children:[T.jsx($a,{type:"target",position:be.Left,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t}),T.jsxs("div",{className:"flex-1 flex items-center gap-3 w-full",children:[!l&&T.jsx("div",{className:"truncate",children:e.name||"​"}),l&&T.jsx("div",{className:"flex-1 w-full",children:T.jsx(nv,{input:e,isCurrentlyInsideReactFlow:t})})]})]},e.id)});Zu.displayName="RenderInput";const iv=z.forwardRef(({output:e,isCurrentlyInsideReactFlow:t},n)=>T.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:[T.jsx("div",{className:"truncate text-right",children:e.name||"​"}),T.jsx($a,{type:"source",position:be.Right,id:e.id,color:e.handleColor,shape:e.handleShape,isCurrentlyInsideReactFlow:t})]},e.id));iv.displayName="RenderOutput";const sv=z.forwardRef(({panel:e,isCurrentlyInsideReactFlow:t,isOpen:n,onToggle:o},s)=>T.jsxs("div",{ref:s,className:"flex flex-col",children:[T.jsxs(An,{onClick:a=>{a.stopPropagation(),a.preventDefault(),o()},className:"bg-transparent border-none hover:bg-primary-gray rounded-none justify-start",children:[n?T.jsx(nu,{className:"w-6 h-6 flex-shrink-0 mr-2"}):T.jsx(aa,{className:"w-6 h-6 flex-shrink-0 mr-2"}),T.jsx("span",{className:"truncate",children:e.name})]}),T.jsx("div",{className:Ne("flex flex-col bg-[#272727]",!n&&"h-0 overflow-hidden"),children:e.inputs.map(a=>T.jsx(Zu,{input:a,isCurrentlyInsideReactFlow:t,hide:!n},a.id))})]},e.id));sv.displayName="RenderInputPanel";const Qu=z.forwardRef(({name:e="Node",headerColor:t="#79461D",inputs:n=[],outputs:o=[],isCurrentlyInsideReactFlow:s=!1,className:a,nodeResizerProps:l={},nodeTypeUniqueId:c,showNodeOpenButton:f=!1,...d},h)=>{const[g,p]=z.useState(new Set),m=x=>{p(v=>{const b=new Set(v);return b.has(x)?b.delete(x):b.add(x),b})};return T.jsxs("div",{tabIndex:0,className:Ne("flex flex-col gap-0 rounded-md w-max border-[1.5px] border-transparent focus:border-white","in-[.selected]:border-white",a),...d,ref:h,children:[T.jsxs("div",{className:`text-primary-white text-left text-[27px] leading-[27px] font-main \\
188
- px-4 transition-all rounded-t-md truncate flex justify-between items-center`,style:{backgroundColor:t},children:[T.jsx("p",{className:"truncate py-2",children:e}),T.jsx(ov,{showButton:f,isCurrentlyInsideReactFlow:s})]}),T.jsxs("div",{className:"min-h-[50px] rounded-b-md bg-primary-dark-gray",children:[s&&T.jsx($m,{...l}),T.jsx("div",{className:"flex flex-col py-4",children:o.map(x=>T.jsx(iv,{output:x,isCurrentlyInsideReactFlow:s},x.id))}),T.jsx("div",{className:"flex flex-col py-4",children:n.map(x=>{if("inputs"in x){const v=g.has(x.id);return T.jsx(sv,{panel:x,isCurrentlyInsideReactFlow:s,isOpen:v,onToggle:()=>m(x.id)},x.id)}else return T.jsx(Zu,{input:x,isCurrentlyInsideReactFlow:s},x.id)})})]})]})});Qu.displayName="ConfigurableNode";const Ju=z.forwardRef(({data:e={}},t)=>T.jsx(Qu,{isCurrentlyInsideReactFlow:!0,className:"w-full",...e,ref:t}));Ju.displayName="ConfigurableNodeReactFlowWrapper";const av=({fromX:e,fromY:t,toX:n,toY:o,fromPosition:s,toPosition:a})=>{const{fromHandle:l}=dm(),c=Yc(l?.nodeId||""),f=z.useMemo(()=>!l?.id||!c?.data?void 0:Rn(l?.id,c?.data)?.value?.handleColor??"#A1A1A1",[l?.id,c?.data]),[d]=qs({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:o,targetPosition:a});return T.jsx(co,{path:d,className:"!stroke-7 in-[g.selected]:brightness-150",style:{stroke:f||"#A1A1A1"},focusable:!0})};av.displayName="ConfigurableConnection";const kP=({isOpen:e,position:t,onClose:n,subItems:o})=>{const{refs:s,floatingStyles:a,context:l}=wy({open:e,onOpenChange:d=>{d||n()},placement:"bottom-start",middleware:[vu(5),wu({fallbackPlacements:["top-start"]}),xu({padding:8})],whileElementsMounted:mu}),c=SI(l),{getFloatingProps:f}=by([c]);return z.useEffect(()=>{e&&s.setReference({getBoundingClientRect:()=>({x:t.x,y:t.y,width:1,height:1,top:t.y,right:t.x+1,bottom:t.y+1,left:t.x})})},[e,t,s]),e?T.jsx("div",{ref:s.setFloating,style:{...a,contain:"layout",willChange:"transform"},className:"z-50",onClick:d=>d.stopPropagation(),...f(),children:T.jsx(Cy,{subItems:o})}):null},lv="add-new-node-group"+un(10),MP=({value:e,setValue:t,nodeGroups:n,handleAddNewGroup:o,enableBackButton:s,handleBack:a,openedNodeGroupStack:l})=>{const c=f=>{if(f===lv){o?.();return}t(f)};return T.jsxs("div",{className:"absolute top-0 left-0 scale-75 origin-top-left flex items-center gap-3 m-2 max-w-full",children:[T.jsx(An,{className:"h-[44px] border-secondary-dark-gray bg-primary-black shrink-0",disabled:!s,onClick:a,children:T.jsx(ZT,{})}),T.jsxs(Z0,{value:e,onValueChange:c,children:[T.jsx(Gu,{className:"hover:bg-primary-dark-gray shrink-0 w-fit",children:T.jsx(Ku,{placeholder:"Node Group"})}),T.jsxs(qu,{className:"scale-75 origin-top-left",children:[T.jsx(Da,{value:lv,className:"pl-2",children:T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(zm,{}),T.jsx("p",{className:"truncate",children:"Add New Node Group"})]})}),n.map(f=>T.jsx(Da,{value:f.id,children:f.name},f.id))]})]}),T.jsx(ru,{orientation:"horizontal",className:"relative flex-1 min-w-0",scrollAreaClassName:"text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white flex gap-2 items-center overflow-x-scroll no-scrollbar overflow-y-hidden",children:l.map((f,d)=>T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("div",{children:f.name}),d<l.length-1&&T.jsx(la,{className:"shrink-0"})]},f.id))})]})},RP={configurableNode:Ju},DP={configurableEdge:tu};function LP(e){const[t,n]=z.useReducer(Rm,e);return{state:t,dispatch:n}}function $P({state:e,dispatch:t}){const[n,o]=z.useState({isOpen:!1,position:{x:0,y:0}}),s=z.useMemo(()=>Object.keys(e.typeOfNodes).filter(p=>e.typeOfNodes[p].subtree!==void 0).map(p=>({id:p,name:e.typeOfNodes[p].name})),[e.typeOfNodes]),a=z.useMemo(()=>e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1],[e.openedNodeGroupStack]),{screenToFlowPosition:l,fitView:c}=mi(),f=z.useMemo(()=>Ny({typeOfNodes:e.typeOfNodes,dispatch:t,setContextMenu:o,contextMenuPosition:l(n.position),currentNodeType:a?.nodeType,isRecursionAllowed:!e.enableRecursionChecking}),[e.typeOfNodes,t,o,n.position,a?.nodeType,e.enableRecursionChecking]),d=z.useCallback(p=>{p.preventDefault();const m={x:p.clientX,y:p.clientY};o({isOpen:!0,position:m})},[]),h=z.useCallback(()=>{o({isOpen:!1,position:{x:0,y:0}})},[]),g=z.useMemo(()=>Pt(e),[e.nodes,e.edges,e.openedNodeGroupStack,e.typeOfNodes]);return z.useEffect(()=>{e.viewport===void 0&&c({maxZoom:.5,minZoom:.1})},[e.viewport]),T.jsxs("div",{style:{width:"100%",height:"100%"},className:"relative",children:[T.jsxs(rT,{nodes:g.nodes,edges:g.edges,onNodesChange:p=>t({type:st.UPDATE_NODE_BY_REACT_FLOW,payload:{changes:p}}),onEdgesChange:p=>t({type:st.UPDATE_EDGES_BY_REACT_FLOW,payload:{changes:p}}),onConnect:p=>t({type:st.ADD_EDGE_BY_REACT_FLOW,payload:{edge:p}}),maxZoom:1,minZoom:.1,proOptions:{hideAttribution:!0},colorMode:"dark",selectNodesOnDrag:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectionMode:no.Partial,nodeTypes:RP,edgeTypes:DP,deleteKeyCode:["Backspace","Delete","x"],connectionLineComponent:av,onContextMenu:d,onClick:h,viewport:e.viewport,onViewportChange:p=>t({type:st.SET_VIEWPORT,payload:{viewport:p}}),children:[T.jsx(yT,{}),T.jsx(uT,{}),T.jsx(OT,{pannable:!0})]}),T.jsx(kP,{isOpen:n.isOpen,position:n.position,onClose:h,subItems:f}),T.jsx(MP,{nodeGroups:s,value:a?.nodeType??"",setValue:p=>t({type:st.OPEN_NODE_GROUP,payload:{nodeType:p}}),handleAddNewGroup:()=>t({type:st.ADD_NODE_GROUP}),enableBackButton:(e.openedNodeGroupStack?.length||0)>0,handleBack:()=>t({type:st.CLOSE_NODE_GROUP}),openedNodeGroupStack:(e.openedNodeGroupStack||[]).map(p=>({id:p.nodeType+("nodeId"in p?p.nodeId:""),name:e.typeOfNodes[p.nodeType].name}))})]})}const ef=z.createContext(null);function BP({state:e,dispatch:t}){return T.jsx(ym,{children:T.jsx(ef.Provider,{value:{allProps:{state:e,dispatch:t}},children:T.jsx($P,{state:e,dispatch:t})})})}pe.Button=An,pe.ConfigurableEdge=tu,pe.ConfigurableNode=Qu,pe.ConfigurableNodeReactFlowWrapper=Ju,pe.ContextAwareHandle=$a,pe.ContextAwareInput=nv,pe.ContextAwareOpenButton=ov,pe.ContextMenu=Cy,pe.FullGraph=BP,pe.FullGraphContext=ef,pe.Input=Ai,pe.NodeResizerWithMoreControls=$m,pe.ReactFlowAwareInput=tv,pe.ReactFlowAwareOpenButton=rv,pe.ScrollableButtonContainer=ru,pe.Select=Z0,pe.SelectContent=qu,pe.SelectGroup=PP,pe.SelectItem=Da,pe.SelectLabel=Q0,pe.SelectScrollDownButton=Xu,pe.SelectScrollUpButton=Yu,pe.SelectSeparator=J0,pe.SelectTrigger=Gu,pe.SelectValue=Ku,pe.SliderNumberInput=ca,pe.actionTypesMap=st,pe.addAnInputOrOutputToAllNodesOfANodeTypeAcrossStateIncludingSubtrees=Mm,pe.addEdgeWithTypeChecking=Im,pe.cn=Ne,pe.constructInputOrOutputOfType=tr,pe.constructInputPanelOfType=_m,pe.constructNodeOfType=xi,pe.constructTypeOfHandleFromIndices=sa,pe.convertStringToNumber=hh,pe.createNodeContextMenu=Ny,pe.getAllDependenciesOfNodeTypeRecursively=RT,pe.getAllDependentsOfNodeTypeRecursively=Em,pe.getCurrentNodesAndEdgesFromState=Pt,pe.getDependencyGraphBetweenNodeTypes=wi,pe.getDirectDependenciesOfNodeType=Sm,pe.getDirectDependentsOfNodeType=Kc,pe.getResultantDataTypeOfHandleConsideringInferredType=_i,pe.handleShapesMap=ht,pe.isCoordinateInBox=dh,pe.isNumberInRange=Gl,pe.isSupportedUnderlyingType=pb,pe.isValidDataTypeId=mb,pe.mainReducer=Rm,pe.makeAllowedConversionsBetweenDataTypesWithAutoInfer=vb,pe.makeDataTypeWithAutoInfer=gb,pe.makeStateWithAutoInfer=xb,pe.makeTypeOfNodeWithAutoInfer=yb,pe.removeEdgeWithTypeChecking=Om,pe.sanitizeNumberToShowAsText=Yl,pe.setCurrentNodesAndEdgesToStateWithMutatingState=Or,pe.standardDataTypeNames=Si,pe.standardDataTypeNamesMap=Ei,pe.standardDataTypes=jT,pe.standardNodeTypeNames=Ci,pe.standardNodeTypeNamesMap=Ni,pe.standardNodeTypes=UT,pe.supportedUnderlyingTypesMap=ph,pe.useClickedOutside=Lm,pe.useDrag=Wm,pe.useFullGraph=LP,pe.willAddingEdgeCreateCycle=Pm,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
189
- //# sourceMappingURL=react-blender-nodes.umd.js.map
232
+ `)},TI=0,Co=[];function CI(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(TI++)[0],s=V.useState(Vg)[0],a=V.useRef(e);V.useEffect(function(){a.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=XN([e.lockRef.current],(e.shards||[]).map(Yg),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=V.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var S=ya(v),N=n.current,w="deltaX"in v?v.deltaX:N[0]-S[0],I="deltaY"in v?v.deltaY:N[1]-S[1],k,A=v.target,M=Math.abs(w)>Math.abs(I)?"h":"v";if("touches"in v&&M==="h"&&A.type==="range")return!1;var B=Ug(M,A);if(!B)return!0;if(B?k=M:(k=M==="v"?"h":"v",B=Ug(M,A)),!B)return!1;if(!r.current&&"changedTouches"in v&&(w||I)&&(r.current=k),!k)return!0;var U=r.current||k;return NI(U,b,v,U==="h"?w:I)},[]),u=V.useCallback(function(v){var b=v;if(!(!Co.length||Co[Co.length-1]!==s)){var S="deltaY"in b?qg(b):ya(b),N=t.current.filter(function(k){return k.name===b.type&&(k.target===b.target||b.target===k.shadowParent)&&II(k.delta,S)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var w=(a.current.shards||[]).map(Yg).filter(Boolean).filter(function(k){return k.contains(b.target)}),I=w.length>0?l(b,w[0]):!a.current.noIsolation;I&&b.cancelable&&b.preventDefault()}}},[]),d=V.useCallback(function(v,b,S,N){var w={name:v,delta:b,target:S,should:N,shadowParent:AI(S)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(I){return I!==w})},1)},[]),f=V.useCallback(function(v){n.current=ya(v),r.current=void 0},[]),g=V.useCallback(function(v){d(v.type,qg(v),v.target,l(v,e.lockRef.current))},[]),h=V.useCallback(function(v){d(v.type,ya(v),v.target,l(v,e.lockRef.current))},[]);V.useEffect(function(){return Co.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:h}),document.addEventListener("wheel",u,To),document.addEventListener("touchmove",u,To),document.addEventListener("touchstart",f,To),function(){Co=Co.filter(function(v){return v!==s}),document.removeEventListener("wheel",u,To),document.removeEventListener("touchmove",u,To),document.removeEventListener("touchstart",f,To)}},[]);var m=e.removeScrollBar,x=e.inert;return V.createElement(V.Fragment,null,x?V.createElement(s,{styles:EI(i)}):null,m?V.createElement(yI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function AI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kI=oI(Bg,CI);var Xg=V.forwardRef(function(e,t){return V.createElement(ga,Pn({},e,{ref:t,sideCar:kI}))});Xg.classNames=ga.classNames;var MI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ao=new WeakMap,va=new WeakMap,xa={},Nu=0,Kg=function(e){return e&&(e.host||Kg(e.parentNode))},OI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Kg(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},PI=function(e,t,n,r){var i=OI(t,Array.isArray(e)?e:[e]);xa[n]||(xa[n]=new WeakMap);var s=xa[n],a=[],l=new Set,u=new Set(i),d=function(g){!g||l.has(g)||(l.add(g),d(g.parentNode))};i.forEach(d);var f=function(g){!g||u.has(g)||Array.prototype.forEach.call(g.children,function(h){if(l.has(h))f(h);else try{var m=h.getAttribute(r),x=m!==null&&m!=="false",v=(Ao.get(h)||0)+1,b=(s.get(h)||0)+1;Ao.set(h,v),s.set(h,b),a.push(h),v===1&&x&&va.set(h,!0),b===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",h,S)}})};return f(t),l.clear(),Nu++,function(){a.forEach(function(g){var h=Ao.get(g)-1,m=s.get(g)-1;Ao.set(g,h),s.set(g,m),h||(va.has(g)||g.removeAttribute(r),va.delete(g)),m||g.removeAttribute(n)}),Nu--,Nu||(Ao=new WeakMap,Ao=new WeakMap,va=new WeakMap,xa={})}},RI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=MI(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),PI(r,i,n,"aria-hidden")):function(){return null}},wa={exports:{}},Iu={};/**
233
+ * @license React
234
+ * use-sync-external-store-shim.production.js
235
+ *
236
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
237
+ *
238
+ * This source code is licensed under the MIT license found in the
239
+ * LICENSE file in the root directory of this source tree.
240
+ */var Zg;function LI(){if(Zg)return Iu;Zg=1;var e=T;function t(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function l(g,h){var m=h(),x=r({inst:{value:m,getSnapshot:h}}),v=x[0].inst,b=x[1];return s(function(){v.value=m,v.getSnapshot=h,u(v)&&b({inst:v})},[g,m,h]),i(function(){return u(v)&&b({inst:v}),g(function(){u(v)&&b({inst:v})})},[g]),a(m),m}function u(g){var h=g.getSnapshot;g=g.value;try{var m=h();return!n(g,m)}catch{return!0}}function d(g,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return Iu.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Iu}var Eu={};/**
241
+ * @license React
242
+ * use-sync-external-store-shim.development.js
243
+ *
244
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
245
+ *
246
+ * This source code is licensed under the MIT license found in the
247
+ * LICENSE file in the root directory of this source tree.
248
+ */var Jg;function DI(){return Jg||(Jg=1,process.env.NODE_ENV!=="production"&&function(){function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}function t(m,x){f||i.startTransition===void 0||(f=!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 v=x();if(!g){var b=x();s(v,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}b=a({inst:{value:v,getSnapshot:x}});var S=b[0].inst,N=b[1];return u(function(){S.value=v,S.getSnapshot=x,n(S)&&N({inst:S})},[m,v,x]),l(function(){return n(S)&&N({inst:S}),m(function(){n(S)&&N({inst:S})})},[m]),d(v),v}function n(m){var x=m.getSnapshot;m=m.value;try{var v=x();return!s(m,v)}catch{return!0}}function r(m,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=T,s=typeof Object.is=="function"?Object.is:e,a=i.useState,l=i.useEffect,u=i.useLayoutEffect,d=i.useDebugValue,f=!1,g=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Eu.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Eu}var Qg;function em(){return Qg||(Qg=1,process.env.NODE_ENV==="production"?wa.exports=LI():wa.exports=DI()),wa.exports}function tm(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function nm(e){const[t,n]=V.useState(void 0);return _t(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;a=d.inlineSize,l=d.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ba="Checkbox",[jI,AF]=No(ba),[$I,Tu]=jI(ba);function HI(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:u,required:d,value:f="on",internal_do_not_use_render:g}=e,[h,m]=Io({prop:n,defaultProp:i??!1,onChange:u,caller:ba}),[x,v]=V.useState(null),[b,S]=V.useState(null),N=V.useRef(!1),w=x?!!a||!!x.closest("form"):!0,I={checked:h,disabled:s,setChecked:m,control:x,setControl:v,name:l,form:a,value:f,hasConsumerStoppedPropagationRef:N,required:d,defaultChecked:yr(i)?!1:i,isFormControl:w,bubbleInput:b,setBubbleInput:S};return y.jsx($I,{scope:t,...I,children:BI(g)?g(I):r})}var rm="CheckboxTrigger",om=V.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:s,value:a,disabled:l,checked:u,required:d,setControl:f,setChecked:g,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:x}=Tu(rm,e),v=ut(i,f),b=V.useRef(u);return V.useEffect(()=>{const S=s?.form;if(S){const N=()=>g(b.current);return S.addEventListener("reset",N),()=>S.removeEventListener("reset",N)}},[s,g]),y.jsx(Ke.button,{type:"button",role:"checkbox","aria-checked":yr(u)?"mixed":u,"aria-required":d,"data-state":lm(u),"data-disabled":l?"":void 0,disabled:l,value:a,...r,ref:v,onKeyDown:it(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:it(n,S=>{g(N=>yr(N)?!0:!N),x&&m&&(h.current=S.isPropagationStopped(),h.current||S.stopPropagation())})})});om.displayName=rm;var Cu=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:s,required:a,disabled:l,value:u,onCheckedChange:d,form:f,...g}=e;return y.jsx(HI,{__scopeCheckbox:n,checked:i,defaultChecked:s,disabled:l,required:a,onCheckedChange:d,name:r,form:f,value:u,internal_do_not_use_render:({isFormControl:h})=>y.jsxs(y.Fragment,{children:[y.jsx(om,{...g,ref:t,__scopeCheckbox:n}),h&&y.jsx(cm,{__scopeCheckbox:n})]})})});Cu.displayName=ba;var im="CheckboxIndicator",sm=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,s=Tu(im,n);return y.jsx(cu,{present:r||yr(s.checked)||s.checked===!0,children:y.jsx(Ke.span,{"data-state":lm(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});sm.displayName=im;var am="CheckboxBubbleInput",cm=V.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:s,defaultChecked:a,required:l,disabled:u,name:d,value:f,form:g,bubbleInput:h,setBubbleInput:m}=Tu(am,e),x=ut(n,m),v=tm(s),b=nm(r);V.useEffect(()=>{const N=h;if(!N)return;const w=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(w,"checked").set,A=!i.current;if(v!==s&&k){const M=new Event("click",{bubbles:A});N.indeterminate=yr(s),k.call(N,yr(s)?!1:s),N.dispatchEvent(M)}},[h,v,s,i]);const S=V.useRef(yr(s)?!1:s);return y.jsx(Ke.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??S.current,required:l,disabled:u,name:d,value:f,form:g,...t,tabIndex:-1,ref:x,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});cm.displayName=am;function BI(e){return typeof e=="function"}function yr(e){return e==="indeterminate"}function lm(e){return yr(e)?"indeterminate":e?"checked":"unchecked"}const VI=["top","right","bottom","left"],vr=Math.min,zt=Math.max,Sa=Math.round,_a=Math.floor,Rn=e=>({x:e,y:e}),FI={left:"right",right:"left",bottom:"top",top:"bottom"},zI={start:"end",end:"start"};function Au(e,t,n){return zt(e,vr(t,n))}function Yn(e,t){return typeof e=="function"?e(t):e}function Xn(e){return e.split("-")[0]}function ko(e){return e.split("-")[1]}function ku(e){return e==="x"?"y":"x"}function Mu(e){return e==="y"?"height":"width"}const UI=new Set(["top","bottom"]);function Ln(e){return UI.has(Xn(e))?"y":"x"}function Ou(e){return ku(Ln(e))}function WI(e,t,n){n===void 0&&(n=!1);const r=ko(e),i=Ou(e),s=Mu(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Na(a)),[a,Na(a)]}function GI(e){const t=Na(e);return[Pu(e),t,Pu(t)]}function Pu(e){return e.replace(/start|end/g,t=>zI[t])}const um=["left","right"],dm=["right","left"],qI=["top","bottom"],YI=["bottom","top"];function XI(e,t,n){switch(e){case"top":case"bottom":return n?t?dm:um:t?um:dm;case"left":case"right":return t?qI:YI;default:return[]}}function KI(e,t,n,r){const i=ko(e);let s=XI(Xn(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(Pu)))),s}function Na(e){return e.replace(/left|right|bottom|top/g,t=>FI[t])}function ZI(e){return{top:0,right:0,bottom:0,left:0,...e}}function fm(e){return typeof e!="number"?ZI(e):{top:e,right:e,bottom:e,left:e}}function Ia(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pm(e,t,n){let{reference:r,floating:i}=e;const s=Ln(t),a=Ou(t),l=Mu(a),u=Xn(t),d=s==="y",f=r.x+r.width/2-i.width/2,g=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let m;switch(u){case"top":m={x:f,y:r.y-i.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:g};break;case"left":m={x:r.x-i.width,y:g};break;default:m={x:r.x,y:r.y}}switch(ko(t)){case"start":m[a]-=h*(n&&d?-1:1);break;case"end":m[a]+=h*(n&&d?-1:1);break}return m}const JI=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:g}=pm(d,r,u),h=r,m={},x=0;for(let v=0;v<l.length;v++){const{name:b,fn:S}=l[v],{x:N,y:w,data:I,reset:k}=await S({x:f,y:g,initialPlacement:r,placement:h,strategy:i,middlewareData:m,rects:d,platform:a,elements:{reference:e,floating:t}});f=N??f,g=w??g,m={...m,[b]:{...m[b],...I}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(d=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:f,y:g}=pm(d,h,u)),v=-1)}return{x:f,y:g,placement:h,strategy:i,middlewareData:m}};async function Ai(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:h=!1,padding:m=0}=Yn(t,e),x=fm(m),b=l[h?g==="floating"?"reference":"floating":g],S=Ia(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:u})),N=g==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),I=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},k=Ia(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:w,strategy:u}):N);return{top:(S.top-k.top+x.top)/I.y,bottom:(k.bottom-S.bottom+x.bottom)/I.y,left:(S.left-k.left+x.left)/I.x,right:(k.right-S.right+x.right)/I.x}}const QI=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=Yn(e,t)||{};if(d==null)return{};const g=fm(f),h={x:n,y:r},m=Ou(i),x=Mu(m),v=await a.getDimensions(d),b=m==="y",S=b?"top":"left",N=b?"bottom":"right",w=b?"clientHeight":"clientWidth",I=s.reference[x]+s.reference[m]-h[m]-s.floating[x],k=h[m]-s.reference[m],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let M=A?A[w]:0;(!M||!await(a.isElement==null?void 0:a.isElement(A)))&&(M=l.floating[w]||s.floating[x]);const B=I/2-k/2,U=M/2-v[x]/2-1,q=vr(g[S],U),D=vr(g[N],U),$=q,F=M-v[x]-D,E=M/2-v[x]/2+B,P=Au($,E,F),L=!u.arrow&&ko(i)!=null&&E!==P&&s.reference[x]/2-(E<$?q:D)-v[x]/2<0,j=L?E<$?E-$:E-F:0;return{[m]:h[m]+j,data:{[m]:P,centerOffset:E-P-j,...L&&{alignmentOffset:j}},reset:L}}}),eE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...b}=Yn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=Xn(i),N=Ln(l),w=Xn(l)===l,I=await(u.isRTL==null?void 0:u.isRTL(d.floating)),k=h||(w||!v?[Na(l)]:GI(l)),A=x!=="none";!h&&A&&k.push(...KI(l,v,x,I));const M=[l,...k],B=await Ai(t,b),U=[];let q=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&U.push(B[S]),g){const E=WI(i,a,I);U.push(B[E[0]],B[E[1]])}if(q=[...q,{placement:i,overflows:U}],!U.every(E=>E<=0)){var D,$;const E=(((D=s.flip)==null?void 0:D.index)||0)+1,P=M[E];if(P&&(!(g==="alignment"?N!==Ln(P):!1)||q.every(O=>Ln(O.placement)===N?O.overflows[0]>0:!0)))return{data:{index:E,overflows:q},reset:{placement:P}};let L=($=q.filter(j=>j.overflows[0]<=0).sort((j,O)=>j.overflows[1]-O.overflows[1])[0])==null?void 0:$.placement;if(!L)switch(m){case"bestFit":{var F;const j=(F=q.filter(O=>{if(A){const W=Ln(O.placement);return W===N||W==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(W=>W>0).reduce((W,z)=>W+z,0)]).sort((O,W)=>O[1]-W[1])[0])==null?void 0:F[0];j&&(L=j);break}case"initialPlacement":L=l;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function hm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gm(e){return VI.some(t=>e[t]>=0)}const tE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Yn(e,t);switch(r){case"referenceHidden":{const s=await Ai(t,{...i,elementContext:"reference"}),a=hm(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:gm(a)}}}case"escaped":{const s=await Ai(t,{...i,altBoundary:!0}),a=hm(s,n.floating);return{data:{escapedOffsets:a,escaped:gm(a)}}}default:return{}}}}},mm=new Set(["left","top"]);async function nE(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Xn(n),l=ko(n),u=Ln(n)==="y",d=mm.has(a)?-1:1,f=s&&u?-1:1,g=Yn(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return l&&typeof x=="number"&&(m=l==="end"?x*-1:x),u?{x:m*f,y:h*d}:{x:h*d,y:m*f}}const rE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=t,u=await nE(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:a}}}}},oE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:S,y:N}=b;return{x:S,y:N}}},...u}=Yn(e,t),d={x:n,y:r},f=await Ai(t,u),g=Ln(Xn(i)),h=ku(g);let m=d[h],x=d[g];if(s){const b=h==="y"?"top":"left",S=h==="y"?"bottom":"right",N=m+f[b],w=m-f[S];m=Au(N,m,w)}if(a){const b=g==="y"?"top":"left",S=g==="y"?"bottom":"right",N=x+f[b],w=x-f[S];x=Au(N,x,w)}const v=l.fn({...t,[h]:m,[g]:x});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:s,[g]:a}}}}}},iE=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:d=!0}=Yn(e,t),f={x:n,y:r},g=Ln(i),h=ku(g);let m=f[h],x=f[g];const v=Yn(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const w=h==="y"?"height":"width",I=s.reference[h]-s.floating[w]+b.mainAxis,k=s.reference[h]+s.reference[w]-b.mainAxis;m<I?m=I:m>k&&(m=k)}if(d){var S,N;const w=h==="y"?"width":"height",I=mm.has(Xn(i)),k=s.reference[g]-s.floating[w]+(I&&((S=a.offset)==null?void 0:S[g])||0)+(I?0:b.crossAxis),A=s.reference[g]+s.reference[w]+(I?0:((N=a.offset)==null?void 0:N[g])||0)-(I?b.crossAxis:0);x<k?x=k:x>A&&(x=A)}return{[h]:m,[g]:x}}}},sE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:a,elements:l}=t,{apply:u=()=>{},...d}=Yn(e,t),f=await Ai(t,d),g=Xn(i),h=ko(i),m=Ln(i)==="y",{width:x,height:v}=s.floating;let b,S;g==="top"||g==="bottom"?(b=g,S=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(S=g,b=h==="end"?"top":"bottom");const N=v-f.top-f.bottom,w=x-f.left-f.right,I=vr(v-f[b],N),k=vr(x-f[S],w),A=!t.middlewareData.shift;let M=I,B=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=N),A&&!h){const q=zt(f.left,0),D=zt(f.right,0),$=zt(f.top,0),F=zt(f.bottom,0);m?B=x-2*(q!==0||D!==0?q+D:zt(f.left,f.right)):M=v-2*($!==0||F!==0?$+F:zt(f.top,f.bottom))}await u({...t,availableWidth:B,availableHeight:M});const U=await a.getDimensions(l.floating);return x!==U.width||v!==U.height?{reset:{rects:!0}}:{}}}};function Ea(){return typeof window<"u"}function Mo(e){return Ru(e)?(e.nodeName||"").toLowerCase():"#document"}function Ut(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dn(e){var t;return(t=(Ru(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ru(e){return Ea()?e instanceof Node||e instanceof Ut(e).Node:!1}function st(e){return Ea()?e instanceof Element||e instanceof Ut(e).Element:!1}function xn(e){return Ea()?e instanceof HTMLElement||e instanceof Ut(e).HTMLElement:!1}function Lu(e){return!Ea()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ut(e).ShadowRoot}const aE=new Set(["inline","contents"]);function ki(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Wt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!aE.has(i)}const cE=new Set(["table","td","th"]);function lE(e){return cE.has(Mo(e))}const uE=[":popover-open",":modal"];function Ta(e){return uE.some(t=>{try{return e.matches(t)}catch{return!1}})}const dE=["transform","translate","scale","rotate","perspective"],fE=["transform","translate","scale","rotate","perspective","filter"],pE=["paint","layout","strict","content"];function Du(e){const t=Ca(),n=st(e)?Wt(e):e;return dE.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||fE.some(r=>(n.willChange||"").includes(r))||pE.some(r=>(n.contain||"").includes(r))}function hE(e){let t=Zn(e);for(;xn(t)&&!Kn(t);){if(Du(t))return t;if(Ta(t))return null;t=Zn(t)}return null}function Ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gE=new Set(["html","body","#document"]);function Kn(e){return gE.has(Mo(e))}function Wt(e){return Ut(e).getComputedStyle(e)}function Aa(e){return st(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zn(e){if(Mo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lu(e)&&e.host||Dn(e);return Lu(t)?t.host:t}function ym(e){const t=Zn(e);return Kn(t)?e.ownerDocument?e.ownerDocument.body:e.body:xn(t)&&ki(t)?t:ym(t)}function xr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=ym(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Ut(i);if(s){const l=ju(a);return t.concat(a,a.visualViewport||[],ki(i)?i:[],l&&n?xr(l):[])}return t.concat(i,xr(i,[],n))}function ju(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vm(e){const t=Wt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=xn(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=Sa(n)!==s||Sa(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function $u(e){return st(e)?e:e.contextElement}function Oo(e){const t=$u(e);if(!xn(t))return Rn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=vm(t);let a=(s?Sa(n.width):n.width)/r,l=(s?Sa(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const mE=Rn(0);function xm(e){const t=Ut(e);return!Ca()||!t.visualViewport?mE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ut(e)?!1:t}function Wr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=$u(e);let a=Rn(1);t&&(r?st(r)&&(a=Oo(r)):a=Oo(e));const l=yE(s,n,r)?xm(s):Rn(0);let u=(i.left+l.x)/a.x,d=(i.top+l.y)/a.y,f=i.width/a.x,g=i.height/a.y;if(s){const h=Ut(s),m=r&&st(r)?Ut(r):r;let x=h,v=ju(x);for(;v&&r&&m!==x;){const b=Oo(v),S=v.getBoundingClientRect(),N=Wt(v),w=S.left+(v.clientLeft+parseFloat(N.paddingLeft))*b.x,I=S.top+(v.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,d*=b.y,f*=b.x,g*=b.y,u+=w,d+=I,x=Ut(v),v=ju(x)}}return Ia({width:f,height:g,x:u,y:d})}function ka(e,t){const n=Aa(e).scrollLeft;return t?t.left+n:Wr(Dn(e)).left+n}function wm(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ka(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function vE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=Dn(r),l=t?Ta(t.floating):!1;if(r===a||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=Rn(1);const f=Rn(0),g=xn(r);if((g||!g&&!s)&&((Mo(r)!=="body"||ki(a))&&(u=Aa(r)),xn(r))){const m=Wr(r);d=Oo(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const h=a&&!g&&!s?wm(a,u):Rn(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+h.x,y:n.y*d.y-u.scrollTop*d.y+f.y+h.y}}function xE(e){return Array.from(e.getClientRects())}function wE(e){const t=Dn(e),n=Aa(e),r=e.ownerDocument.body,i=zt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=zt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ka(e);const l=-n.scrollTop;return Wt(r).direction==="rtl"&&(a+=zt(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:l}}const bm=25;function bE(e,t){const n=Ut(e),r=Dn(e),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,u=0;if(i){s=i.width,a=i.height;const f=Ca();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=ka(r);if(d<=0){const f=r.ownerDocument,g=f.body,h=getComputedStyle(g),m=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,x=Math.abs(r.clientWidth-g.clientWidth-m);x<=bm&&(s-=x)}else d<=bm&&(s+=d);return{width:s,height:a,x:l,y:u}}const SE=new Set(["absolute","fixed"]);function _E(e,t){const n=Wr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=xn(e)?Oo(e):Rn(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,u=i*s.x,d=r*s.y;return{width:a,height:l,x:u,y:d}}function Sm(e,t,n){let r;if(t==="viewport")r=bE(e,n);else if(t==="document")r=wE(Dn(e));else if(st(t))r=_E(t,n);else{const i=xm(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Ia(r)}function _m(e,t){const n=Zn(e);return n===t||!st(n)||Kn(n)?!1:Wt(n).position==="fixed"||_m(n,t)}function NE(e,t){const n=t.get(e);if(n)return n;let r=xr(e,[],!1).filter(l=>st(l)&&Mo(l)!=="body"),i=null;const s=Wt(e).position==="fixed";let a=s?Zn(e):e;for(;st(a)&&!Kn(a);){const l=Wt(a),u=Du(a);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&SE.has(i.position)||ki(a)&&!u&&_m(e,a))?r=r.filter(f=>f!==a):i=l,a=Zn(a)}return t.set(e,r),r}function IE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?Ta(t)?[]:NE(t,this._c):[].concat(n),r],l=a[0],u=a.reduce((d,f)=>{const g=Sm(t,f,i);return d.top=zt(g.top,d.top),d.right=vr(g.right,d.right),d.bottom=vr(g.bottom,d.bottom),d.left=zt(g.left,d.left),d},Sm(t,l,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function EE(e){const{width:t,height:n}=vm(e);return{width:t,height:n}}function TE(e,t,n){const r=xn(t),i=Dn(t),s=n==="fixed",a=Wr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=Rn(0);function d(){u.x=ka(i)}if(r||!r&&!s)if((Mo(t)!=="body"||ki(i))&&(l=Aa(t)),r){const m=Wr(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?wm(i,l):Rn(0),g=a.left+l.scrollLeft-u.x-f.x,h=a.top+l.scrollTop-u.y-f.y;return{x:g,y:h,width:a.width,height:a.height}}function Hu(e){return Wt(e).position==="static"}function Nm(e,t){if(!xn(e)||Wt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Dn(e)===n&&(n=n.ownerDocument.body),n}function Im(e,t){const n=Ut(e);if(Ta(e))return n;if(!xn(e)){let i=Zn(e);for(;i&&!Kn(i);){if(st(i)&&!Hu(i))return i;i=Zn(i)}return n}let r=Nm(e,t);for(;r&&lE(r)&&Hu(r);)r=Nm(r,t);return r&&Kn(r)&&Hu(r)&&!Du(r)?n:r||hE(e)||n}const CE=async function(e){const t=this.getOffsetParent||Im,n=this.getDimensions,r=await n(e.floating);return{reference:TE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AE(e){return Wt(e).direction==="rtl"}const kE={convertOffsetParentRelativeRectToViewportRelativeRect:vE,getDocumentElement:Dn,getClippingRect:IE,getOffsetParent:Im,getElementRects:CE,getClientRects:xE,getDimensions:EE,getScale:Oo,isElement:st,isRTL:AE};function Em(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ME(e,t){let n=null,r;const i=Dn(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:g,width:h,height:m}=d;if(l||t(),!h||!m)return;const x=_a(g),v=_a(i.clientWidth-(f+h)),b=_a(i.clientHeight-(g+m)),S=_a(f),w={rootMargin:-x+"px "+-v+"px "+-b+"px "+-S+"px",threshold:zt(0,vr(1,u))||1};let I=!0;function k(A){const M=A[0].intersectionRatio;if(M!==u){if(!I)return a();M?a(!1,M):r=setTimeout(()=>{a(!1,1e-7)},1e3)}M===1&&!Em(d,e.getBoundingClientRect())&&a(),I=!1}try{n=new IntersectionObserver(k,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return a(!0),s}function Mi(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=$u(e),f=i||s?[...d?xr(d):[],...xr(t)]:[];f.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const g=d&&l?ME(d,n):null;let h=-1,m=null;a&&(m=new ResizeObserver(S=>{let[N]=S;N&&N.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),d&&!u&&m.observe(d),m.observe(t));let x,v=u?Wr(e):null;u&&b();function b(){const S=Wr(e);v&&!Em(v,S)&&n(),v=S,x=requestAnimationFrame(b)}return n(),()=>{var S;f.forEach(N=>{i&&N.removeEventListener("scroll",n),s&&N.removeEventListener("resize",n)}),g?.(),(S=m)==null||S.disconnect(),m=null,u&&cancelAnimationFrame(x)}}const OE=rE,PE=oE,RE=eE,LE=sE,DE=tE,Tm=QI,jE=iE,$E=(e,t,n)=>{const r=new Map,i={platform:kE,...n},s={...i.platform,_c:r};return JI(e,t,{...i,platform:s})};var HE=typeof document<"u",BE=function(){},Ma=HE?T.useLayoutEffect:BE;function Oa(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,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Oa(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Oa(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Cm(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Am(e,t){const n=Cm(e);return Math.round(t*n)/n}function Bu(e){const t=V.useRef(e);return Ma(()=>{t.current=e}),t}function km(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,g]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=V.useState(r);Oa(h,r)||m(r);const[x,v]=V.useState(null),[b,S]=V.useState(null),N=V.useCallback(O=>{O!==A.current&&(A.current=O,v(O))},[]),w=V.useCallback(O=>{O!==M.current&&(M.current=O,S(O))},[]),I=s||x,k=a||b,A=V.useRef(null),M=V.useRef(null),B=V.useRef(f),U=u!=null,q=Bu(u),D=Bu(i),$=Bu(d),F=V.useCallback(()=>{if(!A.current||!M.current)return;const O={placement:t,strategy:n,middleware:h};D.current&&(O.platform=D.current),$E(A.current,M.current,O).then(W=>{const z={...W,isPositioned:$.current!==!1};E.current&&!Oa(B.current,z)&&(B.current=z,_o.flushSync(()=>{g(z)}))})},[h,t,n,D,$]);Ma(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,g(O=>({...O,isPositioned:!1})))},[d]);const E=V.useRef(!1);Ma(()=>(E.current=!0,()=>{E.current=!1}),[]),Ma(()=>{if(I&&(A.current=I),k&&(M.current=k),I&&k){if(q.current)return q.current(I,k,F);F()}},[I,k,F,q,U]);const P=V.useMemo(()=>({reference:A,floating:M,setReference:N,setFloating:w}),[N,w]),L=V.useMemo(()=>({reference:I,floating:k}),[I,k]),j=V.useMemo(()=>{const O={position:n,left:0,top:0};if(!L.floating)return O;const W=Am(L.floating,f.x),z=Am(L.floating,f.y);return l?{...O,transform:"translate("+W+"px, "+z+"px)",...Cm(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:z}},[n,l,L.floating,f.x,f.y]);return V.useMemo(()=>({...f,update:F,refs:P,elements:L,floatingStyles:j}),[f,F,P,L,j])}const VE=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Tm({element:r.current,padding:i}).fn(n):{}:r?Tm({element:r,padding:i}).fn(n):{}}}},Oi=(e,t)=>({...OE(e),options:[e,t]}),Pi=(e,t)=>({...PE(e),options:[e,t]}),FE=(e,t)=>({...jE(e),options:[e,t]}),Ri=(e,t)=>({...RE(e),options:[e,t]}),zE=(e,t)=>({...LE(e),options:[e,t]}),UE=(e,t)=>({...DE(e),options:[e,t]}),Vu=(e,t)=>({...VE(e),options:[e,t]});var WE="Arrow",Mm=V.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return y.jsx(Ke.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:y.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mm.displayName=WE;var GE=Mm,Fu="Popper",[Om,Pm]=No(Fu),[qE,Rm]=Om(Fu),Lm=e=>{const{__scopePopper:t,children:n}=e,[r,i]=V.useState(null);return y.jsx(qE,{scope:t,anchor:r,onAnchorChange:i,children:n})};Lm.displayName=Fu;var Dm="PopperAnchor",jm=V.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=Rm(Dm,n),a=V.useRef(null),l=ut(t,a),u=V.useRef(null);return V.useEffect(()=>{const d=u.current;u.current=r?.current||a.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:y.jsx(Ke.div,{...i,ref:l})});jm.displayName=Dm;var zu="PopperContent",[YE,XE]=Om(zu),$m=V.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:g="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:x,...v}=e,b=Rm(zu,n),[S,N]=V.useState(null),w=ut(t,Q=>N(Q)),[I,k]=V.useState(null),A=nm(I),M=A?.width??0,B=A?.height??0,U=r+(s!=="center"?"-"+s:""),q=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(d)?d:[d],$=D.length>0,F={padding:q,boundary:D.filter(ZE),altBoundary:$},{refs:E,floatingStyles:P,placement:L,isPositioned:j,middlewareData:O}=km({strategy:"fixed",placement:U,whileElementsMounted:(...Q)=>Mi(...Q,{animationFrame:m==="always"}),elements:{reference:b.anchor},middleware:[Oi({mainAxis:i+B,alignmentAxis:a}),u&&Pi({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?FE():void 0,...F}),u&&Ri({...F}),zE({...F,apply:({elements:Q,rects:te,availableWidth:ne,availableHeight:oe})=>{const{width:pe,height:le}=te.reference,ve=Q.floating.style;ve.setProperty("--radix-popper-available-width",`${ne}px`),ve.setProperty("--radix-popper-available-height",`${oe}px`),ve.setProperty("--radix-popper-anchor-width",`${pe}px`),ve.setProperty("--radix-popper-anchor-height",`${le}px`)}}),I&&Vu({element:I,padding:l}),JE({arrowWidth:M,arrowHeight:B}),h&&UE({strategy:"referenceHidden",...F})]}),[W,z]=Vm(L),Y=Ur(x);_t(()=>{j&&Y?.()},[j,Y]);const J=O.arrow?.x,ie=O.arrow?.y,ee=O.arrow?.centerOffset!==0,[ce,ge]=V.useState();return _t(()=>{S&&ge(window.getComputedStyle(S).zIndex)},[S]),y.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:j?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[O.transformOrigin?.x,O.transformOrigin?.y].join(" "),...O.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(YE,{scope:n,placedSide:W,onArrowChange:k,arrowX:J,arrowY:ie,shouldHideArrow:ee,children:y.jsx(Ke.div,{"data-side":W,"data-align":z,...v,ref:w,style:{...v.style,animation:j?void 0:"none"}})})})});$m.displayName=zu;var Hm="PopperArrow",KE={top:"bottom",right:"left",bottom:"top",left:"right"},Bm=V.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=XE(Hm,r),a=KE[s.placedSide];return y.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:y.jsx(GE,{...i,ref:n,style:{...i.style,display:"block"}})})});Bm.displayName=Hm;function ZE(e){return e!==null}var JE=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[d,f]=Vm(n),g={start:"0%",center:"50%",end:"100%"}[f],h=(i.arrow?.x??0)+l/2,m=(i.arrow?.y??0)+u/2;let x="",v="";return d==="bottom"?(x=a?g:`${h}px`,v=`${-u}px`):d==="top"?(x=a?g:`${h}px`,v=`${r.floating.height+u}px`):d==="right"?(x=`${-u}px`,v=a?g:`${m}px`):d==="left"&&(x=`${r.floating.width+u}px`,v=a?g:`${m}px`),{data:{x,y:v}}}});function Vm(e){const[t,n="center"]=e.split("-");return[t,n]}var QE=Lm,eT=jm,tT=$m,nT=Bm;function Fm(e,[t,n]){return Math.min(n,Math.max(t,e))}var rT=[" ","Enter","ArrowUp","ArrowDown"],oT=[" ","Enter"],Gr="Select",[Pa,Ra,iT]=sg(Gr),[Po,kF]=No(Gr,[iT,Pm]),La=Pm(),[sT,wr]=Po(Gr),[aT,cT]=Po(Gr),zm=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:l,onValueChange:u,dir:d,name:f,autoComplete:g,disabled:h,required:m,form:x}=e,v=La(t),[b,S]=V.useState(null),[N,w]=V.useState(null),[I,k]=V.useState(!1),A=fg(d),[M,B]=Io({prop:r,defaultProp:i??!1,onChange:s,caller:Gr}),[U,q]=Io({prop:a,defaultProp:l,onChange:u,caller:Gr}),D=V.useRef(null),$=b?x||!!b.closest("form"):!0,[F,E]=V.useState(new Set),P=Array.from(F).map(L=>L.props.value).join(";");return y.jsx(QE,{...v,children:y.jsxs(sT,{required:m,scope:t,trigger:b,onTriggerChange:S,valueNode:N,onValueNodeChange:w,valueNodeHasChildren:I,onValueNodeHasChildrenChange:k,contentId:Ci(),value:U,onValueChange:q,open:M,onOpenChange:B,dir:A,triggerPointerDownPosRef:D,disabled:h,children:[y.jsx(Pa.Provider,{scope:t,children:y.jsx(aT,{scope:e.__scopeSelect,onNativeOptionAdd:V.useCallback(L=>{E(j=>new Set(j).add(L))},[]),onNativeOptionRemove:V.useCallback(L=>{E(j=>{const O=new Set(j);return O.delete(L),O})},[]),children:n})}),$?y.jsxs(hy,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:g,value:U,onChange:L=>q(L.target.value),disabled:h,form:x,children:[U===void 0?y.jsx("option",{value:""}):null,Array.from(F)]},P):null]})})};zm.displayName=Gr;var Um="SelectTrigger",Wm=V.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=La(n),a=wr(Um,n),l=a.disabled||r,u=ut(t,a.onTriggerChange),d=Ra(n),f=V.useRef("touch"),[g,h,m]=my(v=>{const b=d().filter(w=>!w.disabled),S=b.find(w=>w.value===a.value),N=yy(b,v,S);N!==void 0&&a.onValueChange(N.value)}),x=v=>{l||(a.onOpenChange(!0),m()),v&&(a.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return y.jsx(eT,{asChild:!0,...s,children:y.jsx(Ke.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":gy(a.value)?"":void 0,...i,ref:u,onClick:it(i.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&x(v)}),onPointerDown:it(i.onPointerDown,v=>{f.current=v.pointerType;const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(x(v),v.preventDefault())}),onKeyDown:it(i.onKeyDown,v=>{const b=g.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(b&&v.key===" ")&&rT.includes(v.key)&&(x(),v.preventDefault())})})})});Wm.displayName=Um;var Gm="SelectValue",qm=V.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...l}=e,u=wr(Gm,n),{onValueNodeHasChildrenChange:d}=u,f=s!==void 0,g=ut(t,u.onValueNodeChange);return _t(()=>{d(f)},[d,f]),y.jsx(Ke.span,{...l,ref:g,style:{pointerEvents:"none"},children:gy(u.value)?y.jsx(y.Fragment,{children:a}):s})});qm.displayName=Gm;var lT="SelectIcon",Ym=V.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return y.jsx(Ke.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Ym.displayName=lT;var uT="SelectPortal",Xm=e=>y.jsx(Lg,{asChild:!0,...e});Xm.displayName=uT;var qr="SelectContent",Km=V.forwardRef((e,t)=>{const n=wr(qr,e.__scopeSelect),[r,i]=V.useState();if(_t(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?_o.createPortal(y.jsx(Zm,{scope:e.__scopeSelect,children:y.jsx(Pa.Slot,{scope:e.__scopeSelect,children:y.jsx("div",{children:e.children})})}),s):null}return y.jsx(Jm,{...e,ref:t})});Km.displayName=qr;var wn=10,[Zm,br]=Po(qr),dT="SelectContentImpl",fT=Ti("SelectContent.RemoveScroll"),Jm=V.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:g,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:v,avoidCollisions:b,...S}=e,N=wr(qr,n),[w,I]=V.useState(null),[k,A]=V.useState(null),M=ut(t,Q=>I(Q)),[B,U]=V.useState(null),[q,D]=V.useState(null),$=Ra(n),[F,E]=V.useState(!1),P=V.useRef(!1);V.useEffect(()=>{if(w)return RI(w)},[w]),YN();const L=V.useCallback(Q=>{const[te,...ne]=$().map(le=>le.ref.current),[oe]=ne.slice(-1),pe=document.activeElement;for(const le of Q)if(le===pe||(le?.scrollIntoView({block:"nearest"}),le===te&&k&&(k.scrollTop=0),le===oe&&k&&(k.scrollTop=k.scrollHeight),le?.focus(),document.activeElement!==pe))return},[$,k]),j=V.useCallback(()=>L([B,w]),[L,B,w]);V.useEffect(()=>{F&&j()},[F,j]);const{onOpenChange:O,triggerPointerDownPosRef:W}=N;V.useEffect(()=>{if(w){let Q={x:0,y:0};const te=oe=>{Q={x:Math.abs(Math.round(oe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(oe.pageY)-(W.current?.y??0))}},ne=oe=>{Q.x<=10&&Q.y<=10?oe.preventDefault():w.contains(oe.target)||O(!1),document.removeEventListener("pointermove",te),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",ne,{capture:!0})}}},[w,O,W]),V.useEffect(()=>{const Q=()=>O(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[O]);const[z,Y]=my(Q=>{const te=$().filter(pe=>!pe.disabled),ne=te.find(pe=>pe.ref.current===document.activeElement),oe=yy(te,Q,ne);oe&&setTimeout(()=>oe.ref.current.focus())}),J=V.useCallback((Q,te,ne)=>{const oe=!P.current&&!ne;(N.value!==void 0&&N.value===te||oe)&&(U(Q),oe&&(P.current=!0))},[N.value]),ie=V.useCallback(()=>w?.focus(),[w]),ee=V.useCallback((Q,te,ne)=>{const oe=!P.current&&!ne;(N.value!==void 0&&N.value===te||oe)&&D(Q)},[N.value]),ce=r==="popper"?Uu:Qm,ge=ce===Uu?{side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:g,collisionBoundary:h,collisionPadding:m,sticky:x,hideWhenDetached:v,avoidCollisions:b}:{};return y.jsx(Zm,{scope:n,content:w,viewport:k,onViewportChange:A,itemRefCallback:J,selectedItem:B,onItemLeave:ie,itemTextRefCallback:ee,focusSelectedItem:j,selectedItemText:q,position:r,isPositioned:F,searchRef:z,children:y.jsx(Xg,{as:fT,allowPinchZoom:!0,children:y.jsx(kg,{asChild:!0,trapped:N.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:it(i,Q=>{N.trigger?.focus({preventScroll:!0}),Q.preventDefault()}),children:y.jsx(Eg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:y.jsx(ce,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Q=>Q.preventDefault(),...S,...ge,onPlaced:()=>E(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:it(S.onKeyDown,Q=>{const te=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!te&&Q.key.length===1&&Y(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let oe=$().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const pe=Q.target,le=oe.indexOf(pe);oe=oe.slice(le+1)}setTimeout(()=>L(oe)),Q.preventDefault()}})})})})})})});Jm.displayName=dT;var pT="SelectItemAlignedPosition",Qm=V.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=wr(qr,n),a=br(qr,n),[l,u]=V.useState(null),[d,f]=V.useState(null),g=ut(t,M=>f(M)),h=Ra(n),m=V.useRef(!1),x=V.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:S,focusSelectedItem:N}=a,w=V.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&v&&b&&S){const M=s.trigger.getBoundingClientRect(),B=d.getBoundingClientRect(),U=s.valueNode.getBoundingClientRect(),q=S.getBoundingClientRect();if(s.dir!=="rtl"){const pe=q.left-B.left,le=U.left-pe,ve=M.left-le,me=M.width+ve,Oe=Math.max(me,B.width),Ce=window.innerWidth-wn,ae=Fm(le,[wn,Math.max(wn,Ce-Oe)]);l.style.minWidth=me+"px",l.style.left=ae+"px"}else{const pe=B.right-q.right,le=window.innerWidth-U.right-pe,ve=window.innerWidth-M.right-le,me=M.width+ve,Oe=Math.max(me,B.width),Ce=window.innerWidth-wn,ae=Fm(le,[wn,Math.max(wn,Ce-Oe)]);l.style.minWidth=me+"px",l.style.right=ae+"px"}const D=h(),$=window.innerHeight-wn*2,F=v.scrollHeight,E=window.getComputedStyle(d),P=parseInt(E.borderTopWidth,10),L=parseInt(E.paddingTop,10),j=parseInt(E.borderBottomWidth,10),O=parseInt(E.paddingBottom,10),W=P+L+F+O+j,z=Math.min(b.offsetHeight*5,W),Y=window.getComputedStyle(v),J=parseInt(Y.paddingTop,10),ie=parseInt(Y.paddingBottom,10),ee=M.top+M.height/2-wn,ce=$-ee,ge=b.offsetHeight/2,Q=b.offsetTop+ge,te=P+L+Q,ne=W-te;if(te<=ee){const pe=D.length>0&&b===D[D.length-1].ref.current;l.style.bottom="0px";const le=d.clientHeight-v.offsetTop-v.offsetHeight,ve=Math.max(ce,ge+(pe?ie:0)+le+j),me=te+ve;l.style.height=me+"px"}else{const pe=D.length>0&&b===D[0].ref.current;l.style.top="0px";const ve=Math.max(ee,P+v.offsetTop+(pe?J:0)+ge)+ne;l.style.height=ve+"px",v.scrollTop=te-ee+v.offsetTop}l.style.margin=`${wn}px 0`,l.style.minHeight=z+"px",l.style.maxHeight=$+"px",r?.(),requestAnimationFrame(()=>m.current=!0)}},[h,s.trigger,s.valueNode,l,d,v,b,S,s.dir,r]);_t(()=>w(),[w]);const[I,k]=V.useState();_t(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const A=V.useCallback(M=>{M&&x.current===!0&&(w(),N?.(),x.current=!1)},[w,N]);return y.jsx(gT,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:A,children:y.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:y.jsx(Ke.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Qm.displayName=pT;var hT="SelectPopperPosition",Uu=V.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=wn,...s}=e,a=La(n);return y.jsx(tT,{...a,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Uu.displayName=hT;var[gT,Wu]=Po(qr,{}),Gu="SelectViewport",ey=V.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=br(Gu,n),a=Wu(Gu,n),l=ut(t,s.onViewportChange),u=V.useRef(0);return y.jsxs(y.Fragment,{children:[y.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),y.jsx(Pa.Slot,{scope:n,children:y.jsx(Ke.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:it(i.onScroll,d=>{const f=d.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:h}=a;if(h?.current&&g){const m=Math.abs(u.current-f.scrollTop);if(m>0){const x=window.innerHeight-wn*2,v=parseFloat(g.style.minHeight),b=parseFloat(g.style.height),S=Math.max(v,b);if(S<x){const N=S+m,w=Math.min(x,N),I=N-w;g.style.height=w+"px",g.style.bottom==="0px"&&(f.scrollTop=I>0?I:0,g.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});ey.displayName=Gu;var ty="SelectGroup",[mT,yT]=Po(ty),ny=V.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Ci();return y.jsx(mT,{scope:n,id:i,children:y.jsx(Ke.div,{role:"group","aria-labelledby":i,...r,ref:t})})});ny.displayName=ty;var ry="SelectLabel",oy=V.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=yT(ry,n);return y.jsx(Ke.div,{id:i.id,...r,ref:t})});oy.displayName=ry;var Da="SelectItem",[vT,iy]=Po(Da),sy=V.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=e,l=wr(Da,n),u=br(Da,n),d=l.value===r,[f,g]=V.useState(s??""),[h,m]=V.useState(!1),x=ut(t,N=>u.itemRefCallback?.(N,r,i)),v=Ci(),b=V.useRef("touch"),S=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return y.jsx(vT,{scope:n,value:r,disabled:i,textId:v,isSelected:d,onItemTextChange:V.useCallback(N=>{g(w=>w||(N?.textContent??"").trim())},[]),children:y.jsx(Pa.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:y.jsx(Ke.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:x,onFocus:it(a.onFocus,()=>m(!0)),onBlur:it(a.onBlur,()=>m(!1)),onClick:it(a.onClick,()=>{b.current!=="mouse"&&S()}),onPointerUp:it(a.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:it(a.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:it(a.onPointerMove,N=>{b.current=N.pointerType,i?u.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:it(a.onPointerLeave,N=>{N.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:it(a.onKeyDown,N=>{u.searchRef?.current!==""&&N.key===" "||(oT.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});sy.displayName=Da;var Li="SelectItemText",ay=V.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,a=wr(Li,n),l=br(Li,n),u=iy(Li,n),d=cT(Li,n),[f,g]=V.useState(null),h=ut(t,S=>g(S),u.onItemTextChange,S=>l.itemTextRefCallback?.(S,u.value,u.disabled)),m=f?.textContent,x=V.useMemo(()=>y.jsx("option",{value:u.value,disabled:u.disabled,children:m},u.value),[u.disabled,u.value,m]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=d;return _t(()=>(v(x),()=>b(x)),[v,b,x]),y.jsxs(y.Fragment,{children:[y.jsx(Ke.span,{id:u.textId,...s,ref:h}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?_o.createPortal(s.children,a.valueNode):null]})});ay.displayName=Li;var cy="SelectItemIndicator",ly=V.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return iy(cy,n).isSelected?y.jsx(Ke.span,{"aria-hidden":!0,...r,ref:t}):null});ly.displayName=cy;var qu="SelectScrollUpButton",uy=V.forwardRef((e,t)=>{const n=br(qu,e.__scopeSelect),r=Wu(qu,e.__scopeSelect),[i,s]=V.useState(!1),a=ut(t,r.onScrollButtonChange);return _t(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=u.scrollTop>0;s(d)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?y.jsx(fy,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}}):null});uy.displayName=qu;var Yu="SelectScrollDownButton",dy=V.forwardRef((e,t)=>{const n=br(Yu,e.__scopeSelect),r=Wu(Yu,e.__scopeSelect),[i,s]=V.useState(!1),a=ut(t,r.onScrollButtonChange);return _t(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)<d;s(f)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?y.jsx(fy,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}}):null});dy.displayName=Yu;var fy=V.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=br("SelectScrollButton",n),a=V.useRef(null),l=Ra(n),u=V.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return V.useEffect(()=>()=>u(),[u]),_t(()=>{l().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),y.jsx(Ke.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:it(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:it(i.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:it(i.onPointerLeave,()=>{u()})})}),xT="SelectSeparator",py=V.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return y.jsx(Ke.div,{"aria-hidden":!0,...r,ref:t})});py.displayName=xT;var Xu="SelectArrow",wT=V.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=La(n),s=wr(Xu,n),a=br(Xu,n);return s.open&&a.position==="popper"?y.jsx(nT,{...i,...r,ref:t}):null});wT.displayName=Xu;var bT="SelectBubbleInput",hy=V.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=V.useRef(null),s=ut(r,i),a=tm(t);return V.useEffect(()=>{const l=i.current;if(!l)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==t&&f){const g=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(g)}},[a,t]),y.jsx(Ke.select,{...n,style:{...ig,...n.style},ref:s,defaultValue:t})});hy.displayName=bT;function gy(e){return e===""||e===void 0}function my(e){const t=Ur(e),n=V.useRef(""),r=V.useRef(0),i=V.useCallback(a=>{const l=n.current+a;t(l),function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(l)},[t]),s=V.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return V.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function yy(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=ST(e,Math.max(s,0));i.length===1&&(a=a.filter(d=>d!==n));const u=a.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function ST(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var _T=zm,vy=Wm,xy=qm,NT=Ym,IT=Xm,wy=Km,ET=ey,TT=ny,by=oy,Sy=sy,CT=ay,AT=ly,_y=uy,Ny=dy,Iy=py;function Ey(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ey(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ty(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ey(e))&&(r&&(r+=" "),r+=t);return r}const Ku="-",kT=e=>{const t=OT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Ku);return l[0]===""&&l.length!==1&&l.shift(),Cy(l,t)||MT(a)},getConflictingClassGroupIds:(a,l)=>{const u=n[a]||[];return l&&r[a]?[...u,...r[a]]:u}}},Cy=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Cy(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(Ku);return t.validators.find(({validator:a})=>a(s))?.classGroupId},Ay=/^\[(.+)\]$/,MT=e=>{if(Ay.test(e)){const t=Ay.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},OT=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const i in n)Zu(n[i],r,i,t);return r},Zu=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:ky(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(PT(i)){Zu(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{Zu(a,ky(t,s),n,r)})})},ky=(e,t)=>{let n=e;return t.split(Ku).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},PT=e=>e.isThemeGetter,RT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},Ju="!",Qu=":",LT=Qu.length,DT=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let a=0,l=0,u=0,d;for(let x=0;x<i.length;x++){let v=i[x];if(a===0&&l===0){if(v===Qu){s.push(i.slice(u,x)),u=x+LT;continue}if(v==="/"){d=x;continue}}v==="["?a++:v==="]"?a--:v==="("?l++:v===")"&&l--}const f=s.length===0?i:i.substring(u),g=jT(f),h=g!==f,m=d&&d>u?d-u:void 0;return{modifiers:s,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:m}};if(t){const i=t+Qu,s=r;r=a=>a.startsWith(i)?s(a.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:a,maybePostfixModifierPosition:void 0}}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},jT=e=>e.endsWith(Ju)?e.substring(0,e.length-1):e.startsWith(Ju)?e.substring(1):e,$T=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(a=>{a[0]==="["||t[a]?(i.push(...s.sort(),a),s=[]):s.push(a)}),i.push(...s.sort()),i}},HT=e=>({cache:RT(e.cacheSize),parseClassName:DT(e),sortModifiers:$T(e),...kT(e)}),BT=/\s+/,VT=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,a=[],l=e.trim().split(BT);let u="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:g,modifiers:h,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:v}=n(f);if(g){u=f+(u.length>0?" "+u:u);continue}let b=!!v,S=r(b?x.substring(0,v):x);if(!S){if(!b){u=f+(u.length>0?" "+u:u);continue}if(S=r(x),!S){u=f+(u.length>0?" "+u:u);continue}b=!1}const N=s(h).join(":"),w=m?N+Ju:N,I=w+S;if(a.includes(I))continue;a.push(I);const k=i(S,b);for(let A=0;A<k.length;++A){const M=k[A];a.push(w+M)}u=f+(u.length>0?" "+u:u)}return u};function FT(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=My(t))&&(r&&(r+=" "),r+=n);return r}const My=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=My(e[r]))&&(n&&(n+=" "),n+=t);return n};function zT(e,...t){let n,r,i,s=a;function a(u){const d=t.reduce((f,g)=>g(f),e());return n=HT(d),r=n.cache.get,i=n.cache.set,s=l,l(u)}function l(u){const d=r(u);if(d)return d;const f=VT(u,n);return i(u,f),f}return function(){return s(FT.apply(null,arguments))}}const vt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Oy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Py=/^\((?:(\w[\w-]*):)?(.+)\)$/i,UT=/^\d+\/\d+$/,WT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,GT=/\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$/,qT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,YT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,XT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ro=e=>UT.test(e),$e=e=>!!e&&!Number.isNaN(Number(e)),Sr=e=>!!e&&Number.isInteger(Number(e)),ed=e=>e.endsWith("%")&&$e(e.slice(0,-1)),Jn=e=>WT.test(e),KT=()=>!0,ZT=e=>GT.test(e)&&!qT.test(e),Ry=()=>!1,JT=e=>YT.test(e),QT=e=>XT.test(e),eC=e=>!be(e)&&!Se(e),tC=e=>Lo(e,Hy,Ry),be=e=>Oy.test(e),Yr=e=>Lo(e,By,ZT),td=e=>Lo(e,sC,$e),Ly=e=>Lo(e,jy,Ry),nC=e=>Lo(e,$y,QT),ja=e=>Lo(e,Vy,JT),Se=e=>Py.test(e),Di=e=>Do(e,By),rC=e=>Do(e,aC),Dy=e=>Do(e,jy),oC=e=>Do(e,Hy),iC=e=>Do(e,$y),$a=e=>Do(e,Vy,!0),Lo=(e,t,n)=>{const r=Oy.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Do=(e,t,n=!1)=>{const r=Py.exec(e);return r?r[1]?t(r[1]):n:!1},jy=e=>e==="position"||e==="percentage",$y=e=>e==="image"||e==="url",Hy=e=>e==="length"||e==="size"||e==="bg-size",By=e=>e==="length",sC=e=>e==="number",aC=e=>e==="family-name",Vy=e=>e==="shadow",cC=zT(()=>{const e=vt("color"),t=vt("font"),n=vt("text"),r=vt("font-weight"),i=vt("tracking"),s=vt("leading"),a=vt("breakpoint"),l=vt("container"),u=vt("spacing"),d=vt("radius"),f=vt("shadow"),g=vt("inset-shadow"),h=vt("text-shadow"),m=vt("drop-shadow"),x=vt("blur"),v=vt("perspective"),b=vt("aspect"),S=vt("ease"),N=vt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...I(),Se,be],A=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],B=()=>[Se,be,u],U=()=>[Ro,"full","auto",...B()],q=()=>[Sr,"none","subgrid",Se,be],D=()=>["auto",{span:["full",Sr,Se,be]},Sr,Se,be],$=()=>[Sr,"auto",Se,be],F=()=>["auto","min","max","fr",Se,be],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...B()],j=()=>[Ro,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],O=()=>[e,Se,be],W=()=>[...I(),Dy,Ly,{position:[Se,be]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Y=()=>["auto","cover","contain",oC,tC,{size:[Se,be]}],J=()=>[ed,Di,Yr],ie=()=>["","none","full",d,Se,be],ee=()=>["",$e,Di,Yr],ce=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[$e,ed,Dy,Ly],te=()=>["","none",x,Se,be],ne=()=>["none",$e,Se,be],oe=()=>["none",$e,Se,be],pe=()=>[$e,Se,be],le=()=>[Ro,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jn],breakpoint:[Jn],color:[KT],container:[Jn],"drop-shadow":[Jn],ease:["in","out","in-out"],font:[eC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jn],shadow:[Jn],spacing:["px",$e],text:[Jn],"text-shadow":[Jn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ro,be,Se,b]}],container:["container"],columns:[{columns:[$e,be,Se,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[Sr,"auto",Se,be]}],basis:[{basis:[Ro,"full","auto",l,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$e,Ro,"auto","initial","none",be]}],grow:[{grow:["",$e,Se,be]}],shrink:[{shrink:["",$e,Se,be]}],order:[{order:[Sr,"first","last","none",Se,be]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],w:[{w:[l,"screen",...j()]}],"min-w":[{"min-w":[l,"screen","none",...j()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",n,Di,Yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Se,td]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ed,be]}],"font-family":[{font:[rC,be,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:[i,Se,be]}],"line-clamp":[{"line-clamp":[$e,"none",Se,td]}],leading:[{leading:[s,...B()]}],"list-image":[{"list-image":["none",Se,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,be]}],"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:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[$e,"from-font","auto",Se,Yr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[$e,"auto",Se,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,be]}],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",Se,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:Y()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sr,Se,be],radial:["",Se,be],conic:[Sr,Se,be]},iC,nC]}],"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:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"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:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$e,Se,be]}],"outline-w":[{outline:["",$e,Di,Yr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",f,$a,ja]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",g,$a,ja]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[$e,Yr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,$a,ja]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[$e,Se,be]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"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":[$e]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"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":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"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":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"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":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"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":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"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":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"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":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Se,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"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":I()}],"mask-image-conic-pos":[{"mask-conic":[$e]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"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:W()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:Y()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,be]}],filter:[{filter:["","none",Se,be]}],blur:[{blur:te()}],brightness:[{brightness:[$e,Se,be]}],contrast:[{contrast:[$e,Se,be]}],"drop-shadow":[{"drop-shadow":["","none",m,$a,ja]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",$e,Se,be]}],"hue-rotate":[{"hue-rotate":[$e,Se,be]}],invert:[{invert:["",$e,Se,be]}],saturate:[{saturate:[$e,Se,be]}],sepia:[{sepia:["",$e,Se,be]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,be]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[$e,Se,be]}],"backdrop-contrast":[{"backdrop-contrast":[$e,Se,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$e,Se,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$e,Se,be]}],"backdrop-invert":[{"backdrop-invert":["",$e,Se,be]}],"backdrop-opacity":[{"backdrop-opacity":[$e,Se,be]}],"backdrop-saturate":[{"backdrop-saturate":[$e,Se,be]}],"backdrop-sepia":[{"backdrop-sepia":["",$e,Se,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$e,"initial",Se,be]}],ease:[{ease:["linear","initial",S,Se,be]}],delay:[{delay:[$e,Se,be]}],animate:[{animate:["none",N,Se,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Se,be]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Se,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"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",Se,be]}],"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":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Se,be]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[$e,Di,Yr,td]}],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 ye(...e){return cC(Ty(e))}function Fy({...e}){return y.jsx(TN,{"data-slot":"accordion",...e})}function nd({className:e,...t}){return y.jsx(CN,{"data-slot":"accordion-item",className:ye("border-b border-secondary-dark-gray last:border-b-0",e),...t})}function rd({className:e,children:t,...n}){return y.jsx(AN,{className:"flex",children:y.jsxs(kN,{"data-slot":"accordion-trigger",className:ye("flex flex-1 items-center gap-2 rounded-md py-2.5 px-4 text-left text-sm font-medium transition-all outline-none bg-runner-section-header-bg text-primary-white hover:no-underline focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...n,children:[y.jsx(Ei,{className:"pointer-events-none size-4 shrink-0 text-secondary-light-gray transition-transform duration-200",strokeWidth:3}),t]})})}function od({className:e,children:t,...n}){return y.jsx(MN,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:y.jsx("div",{className:ye("pt-0 pb-4",e),children:t})})}const zy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Uy=Ty,lC=((e,t)=>n=>{var r;if(t?.variants==null)return Uy(e,n?.class,n?.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map(d=>{const f=n?.[d],g=s?.[d];if(f===null)return null;const h=zy(f)||zy(g);return i[d][h]}),l=n&&Object.entries(n).reduce((d,f)=>{let[g,h]=f;return h===void 0||(d[g]=h),d},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:g,className:h,...m}=f;return Object.entries(m).every(x=>{let[v,b]=x;return Array.isArray(b)?b.includes({...s,...l}[v]):{...s,...l}[v]===b})?[...d,g,h]:d},[]);return Uy(e,a,u,n?.class,n?.className)})("inline-flex items-center justify-center gap-2 cursor-pointer py-2 px-4 rounded-md transition-all text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white disabled:cursor-not-allowed disabled:bg-secondary-dark-gray disabled:opacity-50 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"}]}),Qn=T.forwardRef(({className:e,color:t,asChild:n=!1,applyHoverStyles:r,...i},s)=>{const a=n?G_:"button";return y.jsx(a,{ref:s,"data-slot":"button",className:ye(lC({color:t,className:e,applyHoverStyles:r})),...i})});Qn.displayName="Button";function id(e,t,n,r=!1,i=!1){if(t>n){const s=t;t=n,n=s}return(r?e>=t:e>t)&&(i?e<=n:e<n)}function Wy(e,t,n=!1,r=!1){return id(e.x,t.left,t.right,n)&&id(e.y,t.top,t.bottom,r)}function Gy(e){const t=e.startsWith("-"),n=e.replaceAll(/[^0-9\.]/g,""),r=n.indexOf(".");let i=0;if(r===-1)i=Number(n);else{const s=n.substring(0,r).replaceAll(/[^0-9]/g,""),a=n.substring(r+1).replaceAll(/[^0-9]/g,"");i=+(s+"."+a)}return t&&(i=-i),i}function sd(e,t){return e.toFixed(t).replace(/[0]+$/,"").replace(/\.$/,"")}const nn=["string","number","boolean","complex","noEquivalent","inferFromConnection"],qy={[nn[0]]:nn[0],[nn[1]]:nn[1],[nn[2]]:nn[2],[nn[3]]:nn[3],[nn[4]]:nn[4],[nn[5]]:nn[5]};function uC(e){return!!qy[e]}function dC(e){return e}function fC(e,t){return e in t}function pC(e){return e}function hC(e){return e}function gC(e){return e}var Yy=Symbol.for("immer-nothing"),Xy=Symbol.for("immer-draftable"),Gt=Symbol.for("immer-state"),mC=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 Lt(e,...t){if(process.env.NODE_ENV!=="production"){const n=mC[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jo=Object.getPrototypeOf;function $o(e){return!!e&&!!e[Gt]}function Xr(e){return e?Ky(e)||Array.isArray(e)||!!e[Xy]||!!e.constructor?.[Xy]||ji(e)||Va(e):!1}var yC=Object.prototype.constructor.toString();function Ky(e){if(!e||typeof e!="object")return!1;const t=jo(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)===yC}function Ha(e,t){Ba(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ba(e){const t=e[Gt];return t?t.type_:Array.isArray(e)?1:ji(e)?2:Va(e)?3:0}function ad(e,t){return Ba(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zy(e,t,n){const r=Ba(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function vC(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ji(e){return e instanceof Map}function Va(e){return e instanceof Set}function Kr(e){return e.copy_||e.base_}function cd(e,t){if(ji(e))return new Map(e);if(Va(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ky(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Gt];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const a=i[s],l=r[a];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(r[a]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[a]})}return Object.create(jo(e),r)}else{const r=jo(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function ld(e,t=!1){return za(e)||$o(e)||!Xr(e)||(Ba(e)>1&&Object.defineProperties(e,{set:{value:Fa},add:{value:Fa},clear:{value:Fa},delete:{value:Fa}}),Object.freeze(e),t&&Object.values(e).forEach(n=>ld(n,!0))),e}function Fa(){Lt(2)}function za(e){return Object.isFrozen(e)}var xC={};function Zr(e){const t=xC[e];return t||Lt(0,e),t}var $i;function Jy(){return $i}function wC(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qy(e,t){t&&(Zr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ud(e){dd(e),e.drafts_.forEach(bC),e.drafts_=null}function dd(e){e===$i&&($i=e.parent_)}function ev(e){return $i=wC($i,e)}function bC(e){const t=e[Gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tv(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Gt].modified_&&(ud(t),Lt(4)),Xr(e)&&(e=Ua(t,e),t.parent_||Wa(t,e)),t.patches_&&Zr("Patches").generateReplacementPatches_(n[Gt].base_,e,t.patches_,t.inversePatches_)):e=Ua(t,n,[]),ud(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Yy?e:void 0}function Ua(e,t,n){if(za(t))return t;const r=t[Gt];if(!r)return Ha(t,(i,s)=>nv(e,r,t,i,s,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Wa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let s=i,a=!1;r.type_===3&&(s=new Set(i),i.clear(),a=!0),Ha(s,(l,u)=>nv(e,r,i,l,u,n,a)),Wa(e,i,!1),n&&e.patches_&&Zr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nv(e,t,n,r,i,s,a){if(process.env.NODE_ENV!=="production"&&i===n&&Lt(5),$o(i)){const l=s&&t&&t.type_!==3&&!ad(t.assigned_,r)?s.concat(r):void 0,u=Ua(e,i,l);if(Zy(n,r,u),$o(u))e.canAutoFreeze_=!1;else return}else a&&n.add(i);if(Xr(i)&&!za(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ua(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ji(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Wa(e,i)}}function Wa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ld(t,n)}function SC(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Jy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=fd;n&&(i=[r],s=Hi);const{revoke:a,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=a,l}var fd={get(e,t){if(t===Gt)return e;const n=Kr(e);if(!ad(n,t))return _C(e,n,t);const r=n[t];return e.finalized_||!Xr(r)?r:r===pd(e.base_,t)?(gd(e),e.copy_[t]=md(r,e)):r},has(e,t){return t in Kr(e)},ownKeys(e){return Reflect.ownKeys(Kr(e))},set(e,t,n){const r=rv(Kr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=pd(Kr(e),t),s=i?.[Gt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(vC(n,i)&&(n!==void 0||ad(e.base_,t)))return!0;gd(e),hd(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 pd(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,gd(e),hd(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Kr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Lt(11)},getPrototypeOf(e){return jo(e.base_)},setPrototypeOf(){Lt(12)}},Hi={};Ha(fd,(e,t)=>{Hi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Hi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Lt(13),Hi.set.call(this,e,t,void 0)},Hi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Lt(14),fd.set.call(this,e[0],t,n,e[0])};function pd(e,t){const n=e[Gt];return(n?Kr(n):e)[t]}function _C(e,t,n){const r=rv(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function rv(e,t){if(!(t in e))return;let n=jo(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=jo(n)}}function hd(e){e.modified_||(e.modified_=!0,e.parent_&&hd(e.parent_))}function gd(e){e.copy_||(e.copy_=cd(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var NC=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const a=this;return function(u=s,...d){return a.produce(u,f=>n.call(this,f,...d))}}typeof n!="function"&&Lt(6),r!==void 0&&typeof r!="function"&&Lt(7);let i;if(Xr(t)){const s=ev(this),a=md(t,void 0);let l=!0;try{i=n(a),l=!1}finally{l?ud(s):dd(s)}return Qy(s,r),tv(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Yy&&(i=void 0),this.autoFreeze_&&ld(i,!0),r){const s=[],a=[];Zr("Patches").generateReplacementPatches_(t,i,s,a),r(s,a)}return i}else Lt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(a,...l)=>this.produceWithPatches(a,u=>t(u,...l));let r,i;return[this.produce(t,n,(a,l)=>{r=a,i=l}),r,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Xr(e)||Lt(8),$o(e)&&(e=IC(e));const t=ev(this),n=md(e,void 0);return n[Gt].isManual_=!0,dd(t),n}finishDraft(e,t){const n=e&&e[Gt];(!n||!n.isManual_)&&Lt(9);const{scope_:r}=n;return Qy(r,t),tv(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Zr("Patches").applyPatches_;return $o(e)?r(e,t):this.produce(e,i=>r(i,t))}};function md(e,t){const n=ji(e)?Zr("MapSet").proxyMap_(e,t):Va(e)?Zr("MapSet").proxySet_(e,t):SC(e,t);return(t?t.scope_:Jy()).drafts_.push(n),n}function IC(e){return $o(e)||Lt(10,e),ov(e)}function ov(e){if(!Xr(e)||za(e))return e;const t=e[Gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=cd(e,t.scope_.immer_.useStrictShallowCopy_)}else n=cd(e,!0);return Ha(n,(r,i)=>{Zy(n,r,ov(i))}),t&&(t.finalized_=!1),n}var EC=new NC,Bi=EC.produce;function rn(e){const t=[];for(let r=0;r<Math.floor(e/8);r++)t.push(Math.random().toString(36).substring(2,10));return e%8>0&&t.push(Math.random().toString(36).substring(2,e%8+2)),t.join("")}function yt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=yt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var TC={value:()=>{}};function Ga(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new qa(n)}function qa(e){this._=e}function CC(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}qa.prototype=Ga.prototype={constructor:qa,on:function(e,t){var n=this._,r=CC(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=AC(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=iv(n[i],e.name,t);else if(t==null)for(i in n)n[i]=iv(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new qa(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function AC(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function iv(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=TC,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var yd="http://www.w3.org/1999/xhtml";const sv={svg:"http://www.w3.org/2000/svg",xhtml:yd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ya(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),sv.hasOwnProperty(t)?{space:sv[t],local:e}:e}function kC(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===yd&&t.documentElement.namespaceURI===yd?t.createElement(e):t.createElementNS(n,e)}}function MC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function av(e){var t=Ya(e);return(t.local?MC:kC)(t)}function OC(){}function vd(e){return e==null?OC:function(){return this.querySelector(e)}}function PC(e){typeof e!="function"&&(e=vd(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=new Array(a),u,d,f=0;f<a;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d);return new qt(r,this._parents)}function RC(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function LC(){return[]}function cv(e){return e==null?LC:function(){return this.querySelectorAll(e)}}function DC(e){return function(){return RC(e.apply(this,arguments))}}function jC(e){typeof e=="function"?e=DC(e):e=cv(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],l=a.length,u,d=0;d<l;++d)(u=a[d])&&(r.push(e.call(u,u.__data__,d,a)),i.push(u));return new qt(r,i)}function lv(e){return function(){return this.matches(e)}}function uv(e){return function(t){return t.matches(e)}}var $C=Array.prototype.find;function HC(e){return function(){return $C.call(this.children,e)}}function BC(){return this.firstElementChild}function VC(e){return this.select(e==null?BC:HC(typeof e=="function"?e:uv(e)))}var FC=Array.prototype.filter;function zC(){return Array.from(this.children)}function UC(e){return function(){return FC.call(this.children,e)}}function WC(e){return this.selectAll(e==null?zC:UC(typeof e=="function"?e:uv(e)))}function GC(e){typeof e!="function"&&(e=lv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],u,d=0;d<a;++d)(u=s[d])&&e.call(u,u.__data__,d,s)&&l.push(u);return new qt(r,this._parents)}function dv(e){return new Array(e.length)}function qC(){return new qt(this._enter||this._groups.map(dv),this._parents)}function Xa(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xa.prototype={constructor:Xa,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 YC(e){return function(){return e}}function XC(e,t,n,r,i,s){for(var a=0,l,u=t.length,d=s.length;a<d;++a)(l=t[a])?(l.__data__=s[a],r[a]=l):n[a]=new Xa(e,s[a]);for(;a<u;++a)(l=t[a])&&(i[a]=l)}function KC(e,t,n,r,i,s,a){var l,u,d=new Map,f=t.length,g=s.length,h=new Array(f),m;for(l=0;l<f;++l)(u=t[l])&&(h[l]=m=a.call(u,u.__data__,l,t)+"",d.has(m)?i[l]=u:d.set(m,u));for(l=0;l<g;++l)m=a.call(e,s[l],l,s)+"",(u=d.get(m))?(r[l]=u,u.__data__=s[l],d.delete(m)):n[l]=new Xa(e,s[l]);for(l=0;l<f;++l)(u=t[l])&&d.get(h[l])===u&&(i[l]=u)}function ZC(e){return e.__data__}function JC(e,t){if(!arguments.length)return Array.from(this,ZC);var n=t?KC:XC,r=this._parents,i=this._groups;typeof e!="function"&&(e=YC(e));for(var s=i.length,a=new Array(s),l=new Array(s),u=new Array(s),d=0;d<s;++d){var f=r[d],g=i[d],h=g.length,m=QC(e.call(f,f&&f.__data__,d,r)),x=m.length,v=l[d]=new Array(x),b=a[d]=new Array(x),S=u[d]=new Array(h);n(f,g,v,b,S,m,t);for(var N=0,w=0,I,k;N<x;++N)if(I=v[N]){for(N>=w&&(w=N+1);!(k=b[w])&&++w<x;);I._next=k||null}}return a=new qt(a,r),a._enter=l,a._exit=u,a}function QC(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function eA(){return new qt(this._exit||this._groups.map(dv),this._parents)}function tA(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function nA(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,a=Math.min(i,s),l=new Array(i),u=0;u<a;++u)for(var d=n[u],f=r[u],g=d.length,h=l[u]=new Array(g),m,x=0;x<g;++x)(m=d[x]||f[x])&&(h[x]=m);for(;u<i;++u)l[u]=n[u];return new qt(l,this._parents)}function rA(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function oA(e){e||(e=iA);function t(g,h){return g&&h?e(g.__data__,h.__data__):!g-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],l=a.length,u=i[s]=new Array(l),d,f=0;f<l;++f)(d=a[f])&&(u[f]=d);u.sort(t)}return new qt(i,this._parents).order()}function iA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function sA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function aA(){return Array.from(this)}function cA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}function lA(){let e=0;for(const t of this)++e;return e}function uA(){return!this.node()}function dA(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}function fA(e){return function(){this.removeAttribute(e)}}function pA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hA(e,t){return function(){this.setAttribute(e,t)}}function gA(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mA(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function yA(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 vA(e,t){var n=Ya(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?pA:fA:typeof t=="function"?n.local?yA:mA:n.local?gA:hA)(n,t))}function fv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xA(e){return function(){this.style.removeProperty(e)}}function wA(e,t,n){return function(){this.style.setProperty(e,t,n)}}function bA(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function SA(e,t,n){return arguments.length>1?this.each((t==null?xA:typeof t=="function"?bA:wA)(e,t,n??"")):Ho(this.node(),e)}function Ho(e,t){return e.style.getPropertyValue(t)||fv(e).getComputedStyle(e,null).getPropertyValue(t)}function _A(e){return function(){delete this[e]}}function NA(e,t){return function(){this[e]=t}}function IA(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function EA(e,t){return arguments.length>1?this.each((t==null?_A:typeof t=="function"?IA:NA)(e,t)):this.node()[e]}function pv(e){return e.trim().split(/^|\s+/)}function xd(e){return e.classList||new hv(e)}function hv(e){this._node=e,this._names=pv(e.getAttribute("class")||"")}hv.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 gv(e,t){for(var n=xd(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function mv(e,t){for(var n=xd(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function TA(e){return function(){gv(this,e)}}function CA(e){return function(){mv(this,e)}}function AA(e,t){return function(){(t.apply(this,arguments)?gv:mv)(this,e)}}function kA(e,t){var n=pv(e+"");if(arguments.length<2){for(var r=xd(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?AA:t?TA:CA)(n,t))}function MA(){this.textContent=""}function OA(e){return function(){this.textContent=e}}function PA(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function RA(e){return arguments.length?this.each(e==null?MA:(typeof e=="function"?PA:OA)(e)):this.node().textContent}function LA(){this.innerHTML=""}function DA(e){return function(){this.innerHTML=e}}function jA(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $A(e){return arguments.length?this.each(e==null?LA:(typeof e=="function"?jA:DA)(e)):this.node().innerHTML}function HA(){this.nextSibling&&this.parentNode.appendChild(this)}function BA(){return this.each(HA)}function VA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function FA(){return this.each(VA)}function zA(e){var t=typeof e=="function"?e:av(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function UA(){return null}function WA(e,t){var n=typeof e=="function"?e:av(e),r=t==null?UA:typeof t=="function"?t:vd(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function GA(){var e=this.parentNode;e&&e.removeChild(this)}function qA(){return this.each(GA)}function YA(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XA(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KA(e){return this.select(e?XA:YA)}function ZA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function JA(e){return function(t){e.call(this,t,this.__data__)}}function QA(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ek(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function tk(e,t,n){return function(){var r=this.__on,i,s=JA(t);if(r){for(var a=0,l=r.length;a<l;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function nk(e,t,n){var r=QA(e+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,d=l.length,f;u<d;++u)for(i=0,f=l[u];i<s;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?tk:ek,i=0;i<s;++i)this.each(l(r[i],t,n));return this}function yv(e,t,n){var r=fv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function rk(e,t){return function(){return yv(this,e,t)}}function ok(e,t){return function(){return yv(this,e,t.apply(this,arguments))}}function ik(e,t){return this.each((typeof t=="function"?ok:rk)(e,t))}function*sk(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}var vv=[null];function qt(e,t){this._groups=e,this._parents=t}function Vi(){return new qt([[document.documentElement]],vv)}function ak(){return this}qt.prototype=Vi.prototype={constructor:qt,select:PC,selectAll:jC,selectChild:VC,selectChildren:WC,filter:GC,data:JC,enter:qC,exit:eA,join:tA,merge:nA,selection:ak,order:rA,sort:oA,call:sA,nodes:aA,node:cA,size:lA,empty:uA,each:dA,attr:vA,style:SA,property:EA,classed:kA,text:RA,html:$A,raise:BA,lower:FA,append:zA,insert:WA,remove:qA,clone:KA,datum:ZA,on:nk,dispatch:ik,[Symbol.iterator]:sk};function Yt(e){return typeof e=="string"?new qt([[document.querySelector(e)]],[document.documentElement]):new qt([[e]],vv)}function ck(e){let t;for(;t=e.sourceEvent;)e=t;return e}function bn(e,t){if(e=ck(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const lk={passive:!1},Fi={capture:!0,passive:!1};function wd(e){e.stopImmediatePropagation()}function Bo(e){e.preventDefault(),e.stopImmediatePropagation()}function xv(e){var t=e.document.documentElement,n=Yt(e).on("dragstart.drag",Bo,Fi);"onselectstart"in t?n.on("selectstart.drag",Bo,Fi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function wv(e,t){var n=e.document.documentElement,r=Yt(e).on("dragstart.drag",null);t&&(r.on("click.drag",Bo,Fi),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ka=e=>()=>e;function bd(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:u,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}bd.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uk(e){return!e.ctrlKey&&!e.button}function dk(){return this.parentNode}function fk(e,t){return t??{x:e.x,y:e.y}}function pk(){return navigator.maxTouchPoints||"ontouchstart"in this}function bv(){var e=uk,t=dk,n=fk,r=pk,i={},s=Ga("start","drag","end"),a=0,l,u,d,f,g=0;function h(I){I.on("mousedown.drag",m).filter(r).on("touchstart.drag",b).on("touchmove.drag",S,lk).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(I,k){if(!(f||!e.call(this,I,k))){var A=w(this,t.call(this,I,k),I,k,"mouse");A&&(Yt(I.view).on("mousemove.drag",x,Fi).on("mouseup.drag",v,Fi),xv(I.view),wd(I),d=!1,l=I.clientX,u=I.clientY,A("start",I))}}function x(I){if(Bo(I),!d){var k=I.clientX-l,A=I.clientY-u;d=k*k+A*A>g}i.mouse("drag",I)}function v(I){Yt(I.view).on("mousemove.drag mouseup.drag",null),wv(I.view,d),Bo(I),i.mouse("end",I)}function b(I,k){if(e.call(this,I,k)){var A=I.changedTouches,M=t.call(this,I,k),B=A.length,U,q;for(U=0;U<B;++U)(q=w(this,M,I,k,A[U].identifier,A[U]))&&(wd(I),q("start",I,A[U]))}}function S(I){var k=I.changedTouches,A=k.length,M,B;for(M=0;M<A;++M)(B=i[k[M].identifier])&&(Bo(I),B("drag",I,k[M]))}function N(I){var k=I.changedTouches,A=k.length,M,B;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),M=0;M<A;++M)(B=i[k[M].identifier])&&(wd(I),B("end",I,k[M]))}function w(I,k,A,M,B,U){var q=s.copy(),D=bn(U||A,k),$,F,E;if((E=n.call(I,new bd("beforestart",{sourceEvent:A,target:h,identifier:B,active:a,x:D[0],y:D[1],dx:0,dy:0,dispatch:q}),M))!=null)return $=E.x-D[0]||0,F=E.y-D[1]||0,function P(L,j,O){var W=D,z;switch(L){case"start":i[B]=P,z=a++;break;case"end":delete i[B],--a;case"drag":D=bn(O||j,k),z=a;break}q.call(L,I,new bd(L,{sourceEvent:j,subject:E,target:h,identifier:B,active:z,x:D[0]+$,y:D[1]+F,dx:D[0]-W[0],dy:D[1]-W[1],dispatch:q}),M)}}return h.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Ka(!!I),h):e},h.container=function(I){return arguments.length?(t=typeof I=="function"?I:Ka(I),h):t},h.subject=function(I){return arguments.length?(n=typeof I=="function"?I:Ka(I),h):n},h.touchable=function(I){return arguments.length?(r=typeof I=="function"?I:Ka(!!I),h):r},h.on=function(){var I=s.on.apply(s,arguments);return I===s?h:I},h.clickDistance=function(I){return arguments.length?(g=(I=+I)*I,h):Math.sqrt(g)},h}function Sd(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Sv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function zi(){}var Ui=.7,Za=1/Ui,Vo="\\s*([+-]?\\d+)\\s*",Wi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hk=/^#([0-9a-f]{3,8})$/,gk=new RegExp(`^rgb\\(${Vo},${Vo},${Vo}\\)$`),mk=new RegExp(`^rgb\\(${jn},${jn},${jn}\\)$`),yk=new RegExp(`^rgba\\(${Vo},${Vo},${Vo},${Wi}\\)$`),vk=new RegExp(`^rgba\\(${jn},${jn},${jn},${Wi}\\)$`),xk=new RegExp(`^hsl\\(${Wi},${jn},${jn}\\)$`),wk=new RegExp(`^hsla\\(${Wi},${jn},${jn},${Wi}\\)$`),_v={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};Sd(zi,Jr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nv,formatHex:Nv,formatHex8:bk,formatHsl:Sk,formatRgb:Iv,toString:Iv});function Nv(){return this.rgb().formatHex()}function bk(){return this.rgb().formatHex8()}function Sk(){return kv(this).formatHsl()}function Iv(){return this.rgb().formatRgb()}function Jr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=hk.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ev(t):n===3?new Dt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ja(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ja(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=gk.exec(e))?new Dt(t[1],t[2],t[3],1):(t=mk.exec(e))?new Dt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yk.exec(e))?Ja(t[1],t[2],t[3],t[4]):(t=vk.exec(e))?Ja(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xk.exec(e))?Av(t[1],t[2]/100,t[3]/100,1):(t=wk.exec(e))?Av(t[1],t[2]/100,t[3]/100,t[4]):_v.hasOwnProperty(e)?Ev(_v[e]):e==="transparent"?new Dt(NaN,NaN,NaN,0):null}function Ev(e){return new Dt(e>>16&255,e>>8&255,e&255,1)}function Ja(e,t,n,r){return r<=0&&(e=t=n=NaN),new Dt(e,t,n,r)}function _k(e){return e instanceof zi||(e=Jr(e)),e?(e=e.rgb(),new Dt(e.r,e.g,e.b,e.opacity)):new Dt}function _d(e,t,n,r){return arguments.length===1?_k(e):new Dt(e,t,n,r??1)}function Dt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Sd(Dt,_d,Sv(zi,{brighter(e){return e=e==null?Za:Math.pow(Za,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ui:Math.pow(Ui,e),new Dt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dt(Qr(this.r),Qr(this.g),Qr(this.b),Qa(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:Tv,formatHex:Tv,formatHex8:Nk,formatRgb:Cv,toString:Cv}));function Tv(){return`#${eo(this.r)}${eo(this.g)}${eo(this.b)}`}function Nk(){return`#${eo(this.r)}${eo(this.g)}${eo(this.b)}${eo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Cv(){const e=Qa(this.opacity);return`${e===1?"rgb(":"rgba("}${Qr(this.r)}, ${Qr(this.g)}, ${Qr(this.b)}${e===1?")":`, ${e})`}`}function Qa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Qr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function eo(e){return e=Qr(e),(e<16?"0":"")+e.toString(16)}function Av(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sn(e,t,n,r)}function kv(e){if(e instanceof Sn)return new Sn(e.h,e.s,e.l,e.opacity);if(e instanceof zi||(e=Jr(e)),!e)return new Sn;if(e instanceof Sn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),a=NaN,l=s-i,u=(s+i)/2;return l?(t===s?a=(n-r)/l+(n<r)*6:n===s?a=(r-t)/l+2:a=(t-n)/l+4,l/=u<.5?s+i:2-s-i,a*=60):l=u>0&&u<1?0:a,new Sn(a,l,u,e.opacity)}function Ik(e,t,n,r){return arguments.length===1?kv(e):new Sn(e,t,n,r??1)}function Sn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Sd(Sn,Ik,Sv(zi,{brighter(e){return e=e==null?Za:Math.pow(Za,e),new Sn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ui:Math.pow(Ui,e),new Sn(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,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Dt(Nd(e>=240?e-240:e+120,i,r),Nd(e,i,r),Nd(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Sn(Mv(this.h),ec(this.s),ec(this.l),Qa(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=Qa(this.opacity);return`${e===1?"hsl(":"hsla("}${Mv(this.h)}, ${ec(this.s)*100}%, ${ec(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mv(e){return e=(e||0)%360,e<0?e+360:e}function ec(e){return Math.max(0,Math.min(1,e||0))}function Nd(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 Id=e=>()=>e;function Ek(e,t){return function(n){return e+n*t}}function Tk(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Ck(e){return(e=+e)==1?Ov:function(t,n){return n-t?Tk(t,n,e):Id(isNaN(t)?n:t)}}function Ov(e,t){var n=t-e;return n?Ek(e,n):Id(isNaN(e)?t:e)}const tc=function e(t){var n=Ck(t);function r(i,s){var a=n((i=_d(i)).r,(s=_d(s)).r),l=n(i.g,s.g),u=n(i.b,s.b),d=Ov(i.opacity,s.opacity);return function(f){return i.r=a(f),i.g=l(f),i.b=u(f),i.opacity=d(f),i+""}}return r.gamma=e,r}(1);function Ak(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=e[i]*(1-s)+t[i]*s;return r}}function kk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Mk(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),s=new Array(n),a;for(a=0;a<r;++a)i[a]=Gi(e[a],t[a]);for(;a<n;++a)s[a]=t[a];return function(l){for(a=0;a<r;++a)s[a]=i[a](l);return s}}function Ok(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function $n(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Pk(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Gi(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var Ed=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Td=new RegExp(Ed.source,"g");function Rk(e){return function(){return e}}function Lk(e){return function(t){return e(t)+""}}function Pv(e,t){var n=Ed.lastIndex=Td.lastIndex=0,r,i,s,a=-1,l=[],u=[];for(e=e+"",t=t+"";(r=Ed.exec(e))&&(i=Td.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(r=r[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,u.push({i:a,x:$n(r,i)})),n=Td.lastIndex;return n<t.length&&(s=t.slice(n),l[a]?l[a]+=s:l[++a]=s),l.length<2?u[0]?Lk(u[0].x):Rk(t):(t=u.length,function(d){for(var f=0,g;f<t;++f)l[(g=u[f]).i]=g.x(d);return l.join("")})}function Gi(e,t){var n=typeof t,r;return t==null||n==="boolean"?Id(t):(n==="number"?$n:n==="string"?(r=Jr(t))?(t=r,tc):Pv:t instanceof Jr?tc:t instanceof Date?Ok:kk(t)?Ak:Array.isArray(t)?Mk:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Pk:$n)(e,t)}var Rv=180/Math.PI,Cd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lv(e,t,n,r,i,s){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,u/=l),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Rv,skewX:Math.atan(u)*Rv,scaleX:a,scaleY:l}}var nc;function Dk(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Cd:Lv(t.a,t.b,t.c,t.d,t.e,t.f)}function jk(e){return e==null||(nc||(nc=document.createElementNS("http://www.w3.org/2000/svg","g")),nc.setAttribute("transform",e),!(e=nc.transform.baseVal.consolidate()))?Cd:(e=e.matrix,Lv(e.a,e.b,e.c,e.d,e.e,e.f))}function Dv(e,t,n,r){function i(d){return d.length?d.pop()+" ":""}function s(d,f,g,h,m,x){if(d!==g||f!==h){var v=m.push("translate(",null,t,null,n);x.push({i:v-4,x:$n(d,g)},{i:v-2,x:$n(f,h)})}else(g||h)&&m.push("translate("+g+t+h+n)}function a(d,f,g,h){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),h.push({i:g.push(i(g)+"rotate(",null,r)-2,x:$n(d,f)})):f&&g.push(i(g)+"rotate("+f+r)}function l(d,f,g,h){d!==f?h.push({i:g.push(i(g)+"skewX(",null,r)-2,x:$n(d,f)}):f&&g.push(i(g)+"skewX("+f+r)}function u(d,f,g,h,m,x){if(d!==g||f!==h){var v=m.push(i(m)+"scale(",null,",",null,")");x.push({i:v-4,x:$n(d,g)},{i:v-2,x:$n(f,h)})}else(g!==1||h!==1)&&m.push(i(m)+"scale("+g+","+h+")")}return function(d,f){var g=[],h=[];return d=e(d),f=e(f),s(d.translateX,d.translateY,f.translateX,f.translateY,g,h),a(d.rotate,f.rotate,g,h),l(d.skewX,f.skewX,g,h),u(d.scaleX,d.scaleY,f.scaleX,f.scaleY,g,h),d=f=null,function(m){for(var x=-1,v=h.length,b;++x<v;)g[(b=h[x]).i]=b.x(m);return g.join("")}}}var $k=Dv(Dk,"px, ","px)","deg)"),Hk=Dv(jk,", ",")",")"),Bk=1e-12;function jv(e){return((e=Math.exp(e))+1/e)/2}function Vk(e){return((e=Math.exp(e))-1/e)/2}function Fk(e){return((e=Math.exp(2*e))-1)/(e+1)}const rc=function e(t,n,r){function i(s,a){var l=s[0],u=s[1],d=s[2],f=a[0],g=a[1],h=a[2],m=f-l,x=g-u,v=m*m+x*x,b,S;if(v<Bk)S=Math.log(h/d)/t,b=function(M){return[l+M*m,u+M*x,d*Math.exp(t*M*S)]};else{var N=Math.sqrt(v),w=(h*h-d*d+r*v)/(2*d*n*N),I=(h*h-d*d-r*v)/(2*h*n*N),k=Math.log(Math.sqrt(w*w+1)-w),A=Math.log(Math.sqrt(I*I+1)-I);S=(A-k)/t,b=function(M){var B=M*S,U=jv(k),q=d/(n*N)*(U*Fk(t*B+k)-Vk(k));return[l+q*m,u+q*x,d*U/jv(t*B+k)]}}return b.duration=S*1e3*t/Math.SQRT2,b}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a,u=l*l;return e(a,l,u)},i}(Math.SQRT2,2,4);var Fo=0,qi=0,Yi=0,$v=1e3,oc,Xi,ic=0,to=0,sc=0,Ki=typeof performance=="object"&&performance.now?performance:Date,Hv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ad(){return to||(Hv(zk),to=Ki.now()+sc)}function zk(){to=0}function ac(){this._call=this._time=this._next=null}ac.prototype=Bv.prototype={constructor:ac,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Ad():+n)+(t==null?0:+t),!this._next&&Xi!==this&&(Xi?Xi._next=this:oc=this,Xi=this),this._call=e,this._time=n,kd()},stop:function(){this._call&&(this._call=null,this._time=1/0,kd())}};function Bv(e,t,n){var r=new ac;return r.restart(e,t,n),r}function Uk(){Ad(),++Fo;for(var e=oc,t;e;)(t=to-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fo}function Vv(){to=(ic=Ki.now())+sc,Fo=qi=0;try{Uk()}finally{Fo=0,Gk(),to=0}}function Wk(){var e=Ki.now(),t=e-ic;t>$v&&(sc-=t,ic=e)}function Gk(){for(var e,t=oc,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:oc=n);Xi=e,kd(r)}function kd(e){if(!Fo){qi&&(qi=clearTimeout(qi));var t=e-to;t>24?(e<1/0&&(qi=setTimeout(Vv,e-Ki.now()-sc)),Yi&&(Yi=clearInterval(Yi))):(Yi||(ic=Ki.now(),Yi=setInterval(Wk,$v)),Fo=1,Hv(Vv))}}function Fv(e,t,n){var r=new ac;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var qk=Ga("start","end","cancel","interrupt"),Yk=[],zv=0,Uv=1,Md=2,cc=3,Wv=4,Od=5,lc=6;function uc(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Xk(e,n,{name:t,index:r,group:i,on:qk,tween:Yk,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:zv})}function Pd(e,t){var n=_n(e,t);if(n.state>zv)throw new Error("too late; already scheduled");return n}function Hn(e,t){var n=_n(e,t);if(n.state>cc)throw new Error("too late; already running");return n}function _n(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Xk(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bv(s,0,n.time);function s(d){n.state=Uv,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var f,g,h,m;if(n.state!==Uv)return u();for(f in r)if(m=r[f],m.name===n.name){if(m.state===cc)return Fv(a);m.state===Wv?(m.state=lc,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[f]):+f<t&&(m.state=lc,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[f])}if(Fv(function(){n.state===cc&&(n.state=Wv,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=Md,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Md){for(n.state=cc,i=new Array(h=n.tween.length),f=0,g=-1;f<h;++f)(m=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=m);i.length=g+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(u),n.state=Od,1),g=-1,h=i.length;++g<h;)i[g].call(e,f);n.state===Od&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=lc,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function dc(e,t){var n=e.__transition,r,i,s=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){s=!1;continue}i=r.state>Md&&r.state<Od,r.state=lc,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}function Kk(e){return this.each(function(){dc(this,e)})}function Zk(e,t){var n,r;return function(){var i=Hn(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Jk(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Hn(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:t,value:n},u=0,d=i.length;u<d;++u)if(i[u].name===t){i[u]=l;break}u===d&&i.push(l)}s.tween=i}}function Qk(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=_n(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Zk:Jk)(n,e,t))}function Rd(e,t,n){var r=e._id;return e.each(function(){var i=Hn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return _n(i,r).value[t]}}function Gv(e,t){var n;return(typeof t=="number"?$n:t instanceof Jr?tc:(n=Jr(t))?(t=n,tc):Pv)(e,t)}function eM(e){return function(){this.removeAttribute(e)}}function tM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nM(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===r?s:s=t(r=a,n)}}function rM(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?s:s=t(r=a,n)}}function oM(e,t,n){var r,i,s;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===r&&u===i?s:(i=u,s=t(r=a,l)))}}function iM(e,t,n){var r,i,s;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===r&&u===i?s:(i=u,s=t(r=a,l)))}}function sM(e,t){var n=Ya(e),r=n==="transform"?Hk:Gv;return this.attrTween(e,typeof t=="function"?(n.local?iM:oM)(n,r,Rd(this,"attr."+e,t)):t==null?(n.local?tM:eM)(n):(n.local?rM:nM)(n,r,t))}function aM(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function cM(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function lM(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&cM(e,s)),n}return i._value=t,i}function uM(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&aM(e,s)),n}return i._value=t,i}function dM(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 r=Ya(e);return this.tween(n,(r.local?lM:uM)(r,t))}function fM(e,t){return function(){Pd(this,e).delay=+t.apply(this,arguments)}}function pM(e,t){return t=+t,function(){Pd(this,e).delay=t}}function hM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fM:pM)(t,e)):_n(this.node(),t).delay}function gM(e,t){return function(){Hn(this,e).duration=+t.apply(this,arguments)}}function mM(e,t){return t=+t,function(){Hn(this,e).duration=t}}function yM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gM:mM)(t,e)):_n(this.node(),t).duration}function vM(e,t){if(typeof t!="function")throw new Error;return function(){Hn(this,e).ease=t}}function xM(e){var t=this._id;return arguments.length?this.each(vM(t,e)):_n(this.node(),t).ease}function wM(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Hn(this,e).ease=n}}function bM(e){if(typeof e!="function")throw new Error;return this.each(wM(this._id,e))}function SM(e){typeof e!="function"&&(e=lv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],u,d=0;d<a;++d)(u=s[d])&&e.call(u,u.__data__,d,s)&&l.push(u);return new er(r,this._parents,this._name,this._id)}function _M(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var u=t[l],d=n[l],f=u.length,g=a[l]=new Array(f),h,m=0;m<f;++m)(h=u[m]||d[m])&&(g[m]=h);for(;l<r;++l)a[l]=t[l];return new er(a,this._parents,this._name,this._id)}function NM(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 IM(e,t,n){var r,i,s=NM(t)?Pd:Hn;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}function EM(e,t){var n=this._id;return arguments.length<2?_n(this.node(),n).on.on(e):this.each(IM(n,e,t))}function TM(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function CM(){return this.on("end.remove",TM(this._id))}function AM(e){var t=this._name,n=this._id;typeof e!="function"&&(e=vd(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],u=l.length,d=s[a]=new Array(u),f,g,h=0;h<u;++h)(f=l[h])&&(g=e.call(f,f.__data__,h,l))&&("__data__"in f&&(g.__data__=f.__data__),d[h]=g,uc(d[h],t,n,h,d,_n(f,n)));return new er(s,this._parents,t,n)}function kM(e){var t=this._name,n=this._id;typeof e!="function"&&(e=cv(e));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var u=r[l],d=u.length,f,g=0;g<d;++g)if(f=u[g]){for(var h=e.call(f,f.__data__,g,u),m,x=_n(f,n),v=0,b=h.length;v<b;++v)(m=h[v])&&uc(m,t,n,v,h,x);s.push(h),a.push(f)}return new er(s,a,t,n)}var MM=Vi.prototype.constructor;function OM(){return new MM(this._groups,this._parents)}function PM(e,t){var n,r,i;return function(){var s=Ho(this,e),a=(this.style.removeProperty(e),Ho(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}function qv(e){return function(){this.style.removeProperty(e)}}function RM(e,t,n){var r,i=n+"",s;return function(){var a=Ho(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}function LM(e,t,n){var r,i,s;return function(){var a=Ho(this,e),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),Ho(this,e))),a===u?null:a===r&&u===i?s:(i=u,s=t(r=a,l))}}function DM(e,t){var n,r,i,s="style."+t,a="end."+s,l;return function(){var u=Hn(this,e),d=u.on,f=u.value[s]==null?l||(l=qv(t)):void 0;(d!==n||i!==f)&&(r=(n=d).copy()).on(a,i=f),u.on=r}}function jM(e,t,n){var r=(e+="")=="transform"?$k:Gv;return t==null?this.styleTween(e,PM(e,r)).on("end.style."+e,qv(e)):typeof t=="function"?this.styleTween(e,LM(e,r,Rd(this,"style."+e,t))).each(DM(this._id,e)):this.styleTween(e,RM(e,r,t),n).on("end.style."+e,null)}function $M(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function HM(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&$M(e,a,n)),r}return s._value=t,s}function BM(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,HM(e,t,n??""))}function VM(e){return function(){this.textContent=e}}function FM(e){return function(){var t=e(this);this.textContent=t??""}}function zM(e){return this.tween("text",typeof e=="function"?FM(Rd(this,"text",e)):VM(e==null?"":e+""))}function UM(e){return function(t){this.textContent=e.call(this,t)}}function WM(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&UM(i)),t}return r._value=e,r}function GM(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,WM(e))}function qM(){for(var e=this._name,t=this._id,n=Yv(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,u,d=0;d<l;++d)if(u=a[d]){var f=_n(u,t);uc(u,e,n,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new er(r,this._parents,e,n)}function YM(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},u={value:function(){--i===0&&s()}};n.each(function(){var d=Hn(this,r),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),d.on=t}),i===0&&s()})}var XM=0;function er(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Yv(){return++XM}var tr=Vi.prototype;er.prototype={constructor:er,select:AM,selectAll:kM,selectChild:tr.selectChild,selectChildren:tr.selectChildren,filter:SM,merge:_M,selection:OM,transition:qM,call:tr.call,nodes:tr.nodes,node:tr.node,size:tr.size,empty:tr.empty,each:tr.each,on:EM,attr:sM,attrTween:dM,style:jM,styleTween:BM,text:zM,textTween:GM,remove:CM,tween:Qk,delay:hM,duration:yM,ease:xM,easeVarying:bM,end:YM,[Symbol.iterator]:tr[Symbol.iterator]};function KM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ZM={time:null,delay:0,duration:250,ease:KM};function JM(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 QM(e){var t,n;e instanceof er?(t=e._id,e=e._name):(t=Yv(),(n=ZM).time=Ad(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,u,d=0;d<l;++d)(u=a[d])&&uc(u,e,t,d,a,n||JM(u,t));return new er(r,this._parents,e,t)}Vi.prototype.interrupt=Kk,Vi.prototype.transition=QM;const fc=e=>()=>e;function eO(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function nr(e,t,n){this.k=e,this.x=t,this.y=n}nr.prototype={constructor:nr,scale:function(e){return e===1?this:new nr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new nr(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 pc=new nr(1,0,0);Xv.prototype=nr.prototype;function Xv(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pc;return e.__zoom}function Ld(e){e.stopImmediatePropagation()}function Zi(e){e.preventDefault(),e.stopImmediatePropagation()}function tO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function nO(){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 Kv(){return this.__zoom||pc}function rO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function oO(){return navigator.maxTouchPoints||"ontouchstart"in this}function iO(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Zv(){var e=tO,t=nO,n=iO,r=rO,i=oO,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=rc,d=Ga("start","zoom","end"),f,g,h,m=500,x=150,v=0,b=10;function S(E){E.property("__zoom",Kv).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",q).filter(i).on("touchstart.zoom",D).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(E,P,L,j){var O=E.selection?E.selection():E;O.property("__zoom",Kv),E!==O?k(E,P,L,j):O.interrupt().each(function(){A(this,arguments).event(j).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},S.scaleBy=function(E,P,L,j){S.scaleTo(E,function(){var O=this.__zoom.k,W=typeof P=="function"?P.apply(this,arguments):P;return O*W},L,j)},S.scaleTo=function(E,P,L,j){S.transform(E,function(){var O=t.apply(this,arguments),W=this.__zoom,z=L==null?I(O):typeof L=="function"?L.apply(this,arguments):L,Y=W.invert(z),J=typeof P=="function"?P.apply(this,arguments):P;return n(w(N(W,J),z,Y),O,a)},L,j)},S.translateBy=function(E,P,L,j){S.transform(E,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),a)},null,j)},S.translateTo=function(E,P,L,j,O){S.transform(E,function(){var W=t.apply(this,arguments),z=this.__zoom,Y=j==null?I(W):typeof j=="function"?j.apply(this,arguments):j;return n(pc.translate(Y[0],Y[1]).scale(z.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),W,a)},j,O)};function N(E,P){return P=Math.max(s[0],Math.min(s[1],P)),P===E.k?E:new nr(P,E.x,E.y)}function w(E,P,L){var j=P[0]-L[0]*E.k,O=P[1]-L[1]*E.k;return j===E.x&&O===E.y?E:new nr(E.k,j,O)}function I(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function k(E,P,L,j){E.on("start.zoom",function(){A(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(j).end()}).tween("zoom",function(){var O=this,W=arguments,z=A(O,W).event(j),Y=t.apply(O,W),J=L==null?I(Y):typeof L=="function"?L.apply(O,W):L,ie=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ee=O.__zoom,ce=typeof P=="function"?P.apply(O,W):P,ge=u(ee.invert(J).concat(ie/ee.k),ce.invert(J).concat(ie/ce.k));return function(Q){if(Q===1)Q=ce;else{var te=ge(Q),ne=ie/te[2];Q=new nr(ne,J[0]-te[0]*ne,J[1]-te[1]*ne)}z.zoom(null,Q)}})}function A(E,P,L){return!L&&E.__zooming||new M(E,P)}function M(E,P){this.that=E,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,P),this.taps=0}M.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,P){return this.mouse&&E!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&E!=="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(E){var P=Yt(this.that).datum();d.call(E,this.that,new eO(E,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:d}),P)}};function B(E,...P){if(!e.apply(this,arguments))return;var L=A(this,P).event(E),j=this.__zoom,O=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,r.apply(this,arguments)))),W=bn(E);if(L.wheel)(L.mouse[0][0]!==W[0]||L.mouse[0][1]!==W[1])&&(L.mouse[1]=j.invert(L.mouse[0]=W)),clearTimeout(L.wheel);else{if(j.k===O)return;L.mouse=[W,j.invert(W)],dc(this),L.start()}Zi(E),L.wheel=setTimeout(z,x),L.zoom("mouse",n(w(N(j,O),L.mouse[0],L.mouse[1]),L.extent,a));function z(){L.wheel=null,L.end()}}function U(E,...P){if(h||!e.apply(this,arguments))return;var L=E.currentTarget,j=A(this,P,!0).event(E),O=Yt(E.view).on("mousemove.zoom",J,!0).on("mouseup.zoom",ie,!0),W=bn(E,L),z=E.clientX,Y=E.clientY;xv(E.view),Ld(E),j.mouse=[W,this.__zoom.invert(W)],dc(this),j.start();function J(ee){if(Zi(ee),!j.moved){var ce=ee.clientX-z,ge=ee.clientY-Y;j.moved=ce*ce+ge*ge>v}j.event(ee).zoom("mouse",n(w(j.that.__zoom,j.mouse[0]=bn(ee,L),j.mouse[1]),j.extent,a))}function ie(ee){O.on("mousemove.zoom mouseup.zoom",null),wv(ee.view,j.moved),Zi(ee),j.event(ee).end()}}function q(E,...P){if(e.apply(this,arguments)){var L=this.__zoom,j=bn(E.changedTouches?E.changedTouches[0]:E,this),O=L.invert(j),W=L.k*(E.shiftKey?.5:2),z=n(w(N(L,W),j,O),t.apply(this,P),a);Zi(E),l>0?Yt(this).transition().duration(l).call(k,z,j,E):Yt(this).call(S.transform,z,j,E)}}function D(E,...P){if(e.apply(this,arguments)){var L=E.touches,j=L.length,O=A(this,P,E.changedTouches.length===j).event(E),W,z,Y,J;for(Ld(E),z=0;z<j;++z)Y=L[z],J=bn(Y,this),J=[J,this.__zoom.invert(J),Y.identifier],O.touch0?!O.touch1&&O.touch0[2]!==J[2]&&(O.touch1=J,O.taps=0):(O.touch0=J,W=!0,O.taps=1+!!f);f&&(f=clearTimeout(f)),W&&(O.taps<2&&(g=J[0],f=setTimeout(function(){f=null},m)),dc(this),O.start())}}function $(E,...P){if(this.__zooming){var L=A(this,P).event(E),j=E.changedTouches,O=j.length,W,z,Y,J;for(Zi(E),W=0;W<O;++W)z=j[W],Y=bn(z,this),L.touch0&&L.touch0[2]===z.identifier?L.touch0[0]=Y:L.touch1&&L.touch1[2]===z.identifier&&(L.touch1[0]=Y);if(z=L.that.__zoom,L.touch1){var ie=L.touch0[0],ee=L.touch0[1],ce=L.touch1[0],ge=L.touch1[1],Q=(Q=ce[0]-ie[0])*Q+(Q=ce[1]-ie[1])*Q,te=(te=ge[0]-ee[0])*te+(te=ge[1]-ee[1])*te;z=N(z,Math.sqrt(Q/te)),Y=[(ie[0]+ce[0])/2,(ie[1]+ce[1])/2],J=[(ee[0]+ge[0])/2,(ee[1]+ge[1])/2]}else if(L.touch0)Y=L.touch0[0],J=L.touch0[1];else return;L.zoom("touch",n(w(z,Y,J),L.extent,a))}}function F(E,...P){if(this.__zooming){var L=A(this,P).event(E),j=E.changedTouches,O=j.length,W,z;for(Ld(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),W=0;W<O;++W)z=j[W],L.touch0&&L.touch0[2]===z.identifier?delete L.touch0:L.touch1&&L.touch1[2]===z.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(z=bn(z,this),Math.hypot(g[0]-z[0],g[1]-z[1])<b)){var Y=Yt(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return S.wheelDelta=function(E){return arguments.length?(r=typeof E=="function"?E:fc(+E),S):r},S.filter=function(E){return arguments.length?(e=typeof E=="function"?E:fc(!!E),S):e},S.touchable=function(E){return arguments.length?(i=typeof E=="function"?E:fc(!!E),S):i},S.extent=function(E){return arguments.length?(t=typeof E=="function"?E:fc([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),S):t},S.scaleExtent=function(E){return arguments.length?(s[0]=+E[0],s[1]=+E[1],S):[s[0],s[1]]},S.translateExtent=function(E){return arguments.length?(a[0][0]=+E[0][0],a[1][0]=+E[1][0],a[0][1]=+E[0][1],a[1][1]=+E[1][1],S):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},S.constrain=function(E){return arguments.length?(n=E,S):n},S.duration=function(E){return arguments.length?(l=+E,S):l},S.interpolate=function(E){return arguments.length?(u=E,S):u},S.on=function(){var E=d.on.apply(d,arguments);return E===d?S:E},S.clickDistance=function(E){return arguments.length?(v=(E=+E)*E,S):Math.sqrt(v)},S.tapDistance=function(E){return arguments.length?(b=+E,S):b},S}const jt={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:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", 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."},Ji=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jv=["Enter"," ","Escape"],Qv={"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 zo;(function(e){e.Strict="strict",e.Loose="loose"})(zo||(zo={}));var no;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(no||(no={}));var Uo;(function(e){e.Partial="partial",e.Full="full"})(Uo||(Uo={}));const ex={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var _r;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_r||(_r={}));var hc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(hc||(hc={}));var Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));const tx={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function sO(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 nx(e,t,n){if(!n)return;const r=[];e.forEach((i,s)=>{t?.has(s)||r.push(i)}),r.length&&n(r)}function rx(e){return e===null?null:e?"valid":"invalid"}const ox=e=>"id"in e&&"source"in e&&"target"in e,aO=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Dd=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Qi=(e,t,n)=>{if(!e.id)return[];const r=new Set;return n.forEach(i=>{i.source===e.id&&r.add(i.target)}),t.filter(i=>r.has(i.id))},gc=(e,t,n)=>{if(!e.id)return[];const r=new Set;return n.forEach(i=>{i.target===e.id&&r.add(i.source)}),t.filter(i=>r.has(i.id))},es=(e,t=[0,0])=>{const{width:n,height:r}=rr(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},cO=(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((r,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):Dd(i)?i:t.nodeLookup.get(i.id));const l=a?vc(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return mc(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return yc(n)},ts=(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(r=>{if(t.filter===void 0||t.filter(r)){const i=vc(r);n=mc(n,i)}}),yc(n)},jd=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...os(t,[n,r,i]),width:t.width/i,height:t.height/i},u=[];for(const d of e.values()){const{measured:f,selectable:g=!0,hidden:h=!1}=d;if(a&&!g||h)continue;const m=f.width??d.width??d.initialWidth??null,x=f.height??d.height??d.initialHeight??null,v=ns(l,Go(d)),b=(m??0)*(x??0),S=s&&v>0;(!d.internals.handleBounds||S||v>=b||d.dragging)&&u.push(d)}return u},$d=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function lO(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function uO({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return Promise.resolve(!0);const l=lO(e,a),u=ts(l),d=Bd(u,t,n,a?.minZoom??i,a?.maxZoom??s,a?.padding??.1);return await r.setViewport(d,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function ix({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:u,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let g=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s?.("005",jt.error005());else{const m=l.measured.width,x=l.measured.height;m&&x&&(g=[[u,d],[u+m,d+x]])}else l&&Yo(a.extent)&&(g=[[a.extent[0][0]+u,a.extent[0][1]+d],[a.extent[1][0]+u,a.extent[1][1]+d]]);const h=Yo(g)?ro(t,g,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",jt.error015()),{position:{x:h.x-u+(a.measured.width??0)*f[0],y:h.y-d+(a.measured.height??0)*f[1]},positionAbsolute:h}}async function dO({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),x=!m&&h.parentId&&a.find(v=>v.id===h.parentId);(m||x)&&a.push(h)}const l=new Set(t.map(h=>h.id)),u=r.filter(h=>h.deletable!==!1),f=$d(a,u);for(const h of u)l.has(h.id)&&!f.find(x=>x.id===h.id)&&f.push(h);if(!i)return{edges:f,nodes:a};const g=await i({nodes:a,edges:f});return typeof g=="boolean"?g?{edges:f,nodes:a}:{edges:[],nodes:[]}:g}const Wo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ro=(e={x:0,y:0},t,n)=>({x:Wo(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Wo(e.y,t[0][1],t[1][1]-(n?.height??0))});function sx(e,t,n){const{width:r,height:i}=rr(n),{x:s,y:a}=n.internals.positionAbsolute;return ro(e,[[s,a],[s+r,a+i]],t)}const ax=(e,t,n)=>e<t?Wo(Math.abs(e-t),1,t)/t:e>n?-Wo(Math.abs(e-n),1,t)/t:0,cx=(e,t,n=15,r=40)=>{const i=ax(e.x,r,t.width-r)*n,s=ax(e.y,r,t.height-r)*n;return[i,s]},mc=(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)}),Hd=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Go=(e,t=[0,0])=>{const{x:n,y:r}=Dd(e)?e.internals.positionAbsolute:es(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},vc=(e,t=[0,0])=>{const{x:n,y:r}=Dd(e)?e.internals.positionAbsolute:es(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},lx=(e,t)=>yc(mc(Hd(e),Hd(t))),ns=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ux=e=>Nn(e.width)&&Nn(e.height)&&Nn(e.x)&&Nn(e.y),Nn=e=>!isNaN(e)&&isFinite(e),dx=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},rs=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),os=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?rs(l,a):l},xc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function qo(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 fO(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=qo(e,n),i=qo(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=qo(e.top??e.y??0,n),i=qo(e.bottom??e.y??0,n),s=qo(e.left??e.x??0,t),a=qo(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function pO(e,t,n,r,i,s){const{x:a,y:l}=xc(e,[t,n,r]),{x:u,y:d}=xc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=i-u,g=s-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(g)}}const Bd=(e,t,n,r,i,s)=>{const a=fO(s,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,d=Math.min(l,u),f=Wo(d,r,i),g=e.x+e.width/2,h=e.y+e.height/2,m=t/2-g*f,x=n/2-h*f,v=pO(e,m,x,f,t,n),b={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:m-b.left+b.right,y:x-b.top+b.bottom,zoom:f}},is=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Yo(e){return e!=null&&e!=="parent"}function rr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fx(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function px(e,t={width:0,height:0},n,r,i){const s={...e},a=r.get(n);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function hx(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function hO(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function gO(e){return{...Qv,...e||{}}}function ss(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=Bn(e),l=os({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:u,y:d}=n?rs(l,t):l;return{xSnapped:u,ySnapped:d,...l}}const Vd=e=>({width:e.offsetWidth,height:e.offsetHeight}),gx=e=>e?.getRootNode?.()||window?.document,mO=["INPUT","SELECT","TEXTAREA"];function mx(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:mO.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const yx=e=>"clientX"in e,Bn=(e,t)=>{const n=yx(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},vx=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Vd(a)}})};function xx({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const u=e*.125+i*.375+a*.375+n*.125,d=t*.125+s*.375+l*.375+r*.125,f=Math.abs(u-e),g=Math.abs(d-t);return[u,d,f,g]}function wc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wx({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Ne.Left:return[t-wc(t-r,s),n];case Ne.Right:return[t+wc(r-t,s),n];case Ne.Top:return[t,n-wc(n-i,s)];case Ne.Bottom:return[t,n+wc(i-n,s)]}}function bc({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top,curvature:a=.25}){const[l,u]=wx({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[d,f]=wx({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[g,h,m,x]=xx({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${r},${i}`,g,h,m,x]}function bx({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n<e?n+i:n-i,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[s,l,i,a]}function yO({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:i=!1}){if(r!==void 0)return r;const s=i&&n?1e3:0,a=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return s+a}function vO({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=mc(vc(e),vc(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return ns(a,yc(s))>0}const xO=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,wO=(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)),Sx=(e,t)=>{if(!e.source||!e.target)return dx("006",jt.error006()),t;let n;return ox(e)?n={...e}:n={...e,id:xO(e)},wO(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function _x({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,l]=bx({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}const Nx={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},bO=({source:e,sourcePosition:t=Ne.Bottom,target:n})=>t===Ne.Left||t===Ne.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},Ix=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function SO({source:e,sourcePosition:t=Ne.Bottom,target:n,targetPosition:r=Ne.Top,center:i,offset:s,stepPosition:a}){const l=Nx[t],u=Nx[r],d={x:e.x+l.x*s,y:e.y+l.y*s},f={x:n.x+u.x*s,y:n.y+u.y*s},g=bO({source:d,sourcePosition:t,target:f}),h=g.x!==0?"x":"y",m=g[h];let x=[],v,b;const S={x:0,y:0},N={x:0,y:0},[,,w,I]=bx({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*u[h]===-1){h==="x"?(v=i.x??d.x+(f.x-d.x)*a,b=i.y??(d.y+f.y)/2):(v=i.x??(d.x+f.x)/2,b=i.y??d.y+(f.y-d.y)*a);const A=[{x:v,y:d.y},{x:v,y:f.y}],M=[{x:d.x,y:b},{x:f.x,y:b}];l[h]===m?x=h==="x"?A:M:x=h==="x"?M:A}else{const A=[{x:d.x,y:f.y}],M=[{x:f.x,y:d.y}];if(h==="x"?x=l.x===m?M:A:x=l.y===m?A:M,t===r){const $=Math.abs(e[h]-n[h]);if($<=s){const F=Math.min(s-1,s-$);l[h]===m?S[h]=(d[h]>e[h]?-1:1)*F:N[h]=(f[h]>n[h]?-1:1)*F}}if(t!==r){const $=h==="x"?"y":"x",F=l[h]===u[$],E=d[$]>f[$],P=d[$]<f[$];(l[h]===1&&(!F&&E||F&&P)||l[h]!==1&&(!F&&P||F&&E))&&(x=h==="x"?A:M)}const B={x:d.x+S.x,y:d.y+S.y},U={x:f.x+N.x,y:f.y+N.y},q=Math.max(Math.abs(B.x-x[0].x),Math.abs(U.x-x[0].x)),D=Math.max(Math.abs(B.y-x[0].y),Math.abs(U.y-x[0].y));q>=D?(v=(B.x+U.x)/2,b=x[0].y):(v=x[0].x,b=(B.y+U.y)/2)}return[[e,{x:d.x+S.x,y:d.y+S.y},...x,{x:f.x+N.x,y:f.y+N.y},n],v,b,w,I]}function _O(e,t,n,r){const i=Math.min(Ix(e,t)/2,Ix(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const d=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${s+i*d},${a}Q ${s},${a} ${s},${a+i*f}`}const l=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${s},${a+i*u}Q ${s},${a} ${s+i*l},${a}`}function Fd({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top,borderRadius:a=5,centerX:l,centerY:u,offset:d=20,stepPosition:f=.5}){const[g,h,m,x,v]=SO({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:u},offset:d,stepPosition:f});return[g.reduce((S,N,w)=>{let I="";return w>0&&w<g.length-1?I=_O(g[w-1],N,g[w+1],a):I=`${w===0?"M":"L"}${N.x} ${N.y}`,S+=I,S},""),h,m,x,v]}function Ex(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function NO(e){const{sourceNode:t,targetNode:n}=e;if(!Ex(t)||!Ex(n))return null;const r=t.internals.handleBounds||Tx(t.handles),i=n.internals.handleBounds||Tx(n.handles),s=Cx(r?.source??[],e.sourceHandle),a=Cx(e.connectionMode===zo.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",jt.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=s?.position||Ne.Bottom,u=a?.position||Ne.Top,d=as(t,s,l),f=as(n,a,u);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:u}}function Tx(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function as(e,t,n=Ne.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??rr(e);if(r)return{x:i+a/2,y:s+l/2};switch(t?.position??n){case Ne.Top:return{x:i+a/2,y:s};case Ne.Right:return{x:i+a,y:s+l/2};case Ne.Bottom:return{x:i+a/2,y:s+l};case Ne.Left:return{x:i,y:s+l/2}}}function Cx(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function zd(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function IO(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(u=>{if(u&&typeof u=="object"){const d=zd(u,t);s.has(d)||(a.push({id:d,color:u.color||n,...u}),s.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const Ud={nodeOrigin:[0,0],nodeExtent:Ji,elevateNodesOnSelect:!0,defaults:{}},EO={...Ud,checkEquality:!0};function Wd(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function TO(e,t,n){const r=Wd(Ud,n);for(const i of e.values())if(i.parentId)qd(i,e,t,r);else{const s=es(i,r.nodeOrigin),a=Yo(i.extent)?i.extent:r.nodeExtent,l=ro(s,a,rr(i));i.internals.positionAbsolute=l}}function Gd(e,t,n,r){const i=Wd(EO,r);let s=e.length>0;const a=new Map(t),l=i?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const u of e){let d=a.get(u.id);if(i.checkEquality&&u===d?.internals.userNode)t.set(u.id,d);else{const f=es(u,i.nodeOrigin),g=Yo(u.extent)?u.extent:i.nodeExtent,h=ro(f,g,rr(u));d={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:u.measured?d?.internals.handleBounds:void 0,z:Ax(u,l),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(s=!1),u.parentId&&qd(d,t,n,r)}return s}function CO(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 qd(e,t,n,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a}=Wd(Ud,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}CO(e,n);const d=i?1e3:0,{x:f,y:g,z:h}=AO(e,u,s,a,d),{positionAbsolute:m}=e.internals,x=f!==m.x||g!==m.y;(x||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:g}:m,z:h}})}function Ax(e,t){return(Nn(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function AO(e,t,n,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=rr(e),u=es(e,n),d=Yo(e.extent)?ro(u,e.extent,l):u;let f=ro({x:s+d.x,y:a+d.y},r,l);e.extent==="parent"&&(f=sx(f,l,t));const g=Ax(e,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=g?h+1:g}}function Yd(e,t,n,r=[0,0]){const i=[],s=new Map;for(const a of e){const l=t.get(a.parentId);if(!l)continue;const u=s.get(a.parentId)?.expandedRect??Go(l),d=lx(u,a.rect);s.set(a.parentId,{expandedRect:d,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},u)=>{const d=l.internals.positionAbsolute,f=rr(l),g=l.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,m=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(f.width,Math.round(a.width)),v=Math.max(f.height,Math.round(a.height)),b=(x-f.width)*g[0],S=(v-f.height)*g[1];(h>0||m>0||b||S)&&(i.push({id:u,type:"position",position:{x:l.position.x-h+b,y:l.position.y-m+S}}),n.get(u)?.forEach(N=>{e.some(w=>w.id===N.id)||i.push({id:N.id,type:"position",position:{x:N.position.x+h,y:N.position.y+m}})})),(f.width<a.width||f.height<a.height||h||m)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?g[0]*h-b:0),height:v+(m?g[1]*m-S:0)}})}),i}function kO(e,t,n,r,i,s){const a=r?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const u=[],d=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(d.transform),g=[];for(const h of e.values()){const m=t.get(h.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const x=Vd(h.nodeElement),v=m.measured.width!==x.width||m.measured.height!==x.height;if(!!(x.width&&x.height&&(v||!m.internals.handleBounds||h.force))){const S=h.nodeElement.getBoundingClientRect(),N=Yo(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=sx(w,x,t.get(m.parentId)):N&&(w=ro(w,N,x));const I={...m,measured:x,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:vx("source",h.nodeElement,S,f,m.id),target:vx("target",h.nodeElement,S,f,m.id)}}};t.set(m.id,I),m.parentId&&qd(I,t,n,{nodeOrigin:i}),l=!0,v&&(u.push({id:m.id,type:"dimensions",dimensions:x}),m.expandParent&&m.parentId&&g.push({id:m.id,parentId:m.parentId,rect:Go(I,i)}))}}if(g.length>0){const h=Yd(g,t,n,i);u.push(...h)}return{changes:u,updatedInternals:l}}async function MO({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function kx(e,t,n,r,i,s){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;const u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),s){a=`${i}-${e}-${s}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function Mx(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,u={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},d=`${i}-${a}--${s}-${l}`,f=`${s}-${l}--${i}-${a}`;kx("source",u,f,e,i,a),kx("target",u,d,e,s,l),t.set(r.id,r)}}function OO(e,t){if(e===null||t===null)return!1;const n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t];if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i].id!==r[i].id||n[i].type!==r[i].type||!Object.is(n[i].data,r[i].data))return!1;return!0}function Ox(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ox(n,t):!1}function Px(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function PO(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Ox(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Xd({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[a,l]of t){const u=n.get(a)?.internals.userNode;u&&i.push({...u,position:l.position,dragging:r})}if(!e)return[i[0],i];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}function RO({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},a=rs(s,t);return{x:a.x-s.x,y:a.y-s.y}}function LO({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,u=!1,d={x:0,y:0},f=null,g=!1,h=null,m=!1,x=!1,v=null;function b({noDragClassName:N,handleSelector:w,domNode:I,isSelectable:k,nodeId:A,nodeClickDistance:M=0}){h=Yt(I);function B({x:$,y:F}){const{nodeLookup:E,nodeExtent:P,snapGrid:L,snapToGrid:j,nodeOrigin:O,onNodeDrag:W,onSelectionDrag:z,onError:Y,updateNodePositions:J}=t();s={x:$,y:F};let ie=!1;const ee=l.size>1,ce=ee&&P?Hd(ts(l)):null,ge=ee&&j?RO({dragItems:l,snapGrid:L,x:$,y:F}):null;for(const[Q,te]of l){if(!E.has(Q))continue;let ne={x:$-te.distance.x,y:F-te.distance.y};j&&(ne=ge?{x:Math.round(ne.x+ge.x),y:Math.round(ne.y+ge.y)}:rs(ne,L));let oe=null;if(ee&&P&&!te.extent&&ce){const{positionAbsolute:ve}=te.internals,me=ve.x-ce.x+P[0][0],Oe=ve.x+te.measured.width-ce.x2+P[1][0],Ce=ve.y-ce.y+P[0][1],ae=ve.y+te.measured.height-ce.y2+P[1][1];oe=[[me,Ce],[Oe,ae]]}const{position:pe,positionAbsolute:le}=ix({nodeId:Q,nextPosition:ne,nodeLookup:E,nodeExtent:oe||P,nodeOrigin:O,onError:Y});ie=ie||te.position.x!==pe.x||te.position.y!==pe.y,te.position=pe,te.internals.positionAbsolute=le}if(x=x||ie,!!ie&&(J(l,!0),v&&(r||W||!A&&z))){const[Q,te]=Xd({nodeId:A,dragItems:l,nodeLookup:E});r?.(v,l,Q,te),W?.(v,Q,te),A||z?.(v,te)}}async function U(){if(!f)return;const{transform:$,panBy:F,autoPanSpeed:E,autoPanOnNodeDrag:P}=t();if(!P){u=!1,cancelAnimationFrame(a);return}const[L,j]=cx(d,f,E);(L!==0||j!==0)&&(s.x=(s.x??0)-L/$[2],s.y=(s.y??0)-j/$[2],await F({x:L,y:j})&&B(s)),a=requestAnimationFrame(U)}function q($){const{nodeLookup:F,multiSelectionActive:E,nodesDraggable:P,transform:L,snapGrid:j,snapToGrid:O,selectNodesOnDrag:W,onNodeDragStart:z,onSelectionDragStart:Y,unselectNodesAndEdges:J}=t();g=!0,(!W||!k)&&!E&&A&&(F.get(A)?.selected||J()),k&&W&&A&&e?.(A);const ie=ss($.sourceEvent,{transform:L,snapGrid:j,snapToGrid:O,containerBounds:f});if(s=ie,l=PO(F,P,ie,A),l.size>0&&(n||z||!A&&Y)){const[ee,ce]=Xd({nodeId:A,dragItems:l,nodeLookup:F});n?.($.sourceEvent,l,ee,ce),z?.($.sourceEvent,ee,ce),A||Y?.($.sourceEvent,ce)}}const D=bv().clickDistance(M).on("start",$=>{const{domNode:F,nodeDragThreshold:E,transform:P,snapGrid:L,snapToGrid:j}=t();f=F?.getBoundingClientRect()||null,m=!1,x=!1,v=$.sourceEvent,E===0&&q($),s=ss($.sourceEvent,{transform:P,snapGrid:L,snapToGrid:j,containerBounds:f}),d=Bn($.sourceEvent,f)}).on("drag",$=>{const{autoPanOnNodeDrag:F,transform:E,snapGrid:P,snapToGrid:L,nodeDragThreshold:j,nodeLookup:O}=t(),W=ss($.sourceEvent,{transform:E,snapGrid:P,snapToGrid:L,containerBounds:f});if(v=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||A&&!O.has(A))&&(m=!0),!m){if(!u&&F&&g&&(u=!0,U()),!g){const z=W.xSnapped-(s.x??0),Y=W.ySnapped-(s.y??0);Math.sqrt(z*z+Y*Y)>j&&q($)}(s.x!==W.xSnapped||s.y!==W.ySnapped)&&l&&g&&(d=Bn($.sourceEvent,f),B(W))}}).on("end",$=>{if(!(!g||m)&&(u=!1,g=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:F,updateNodePositions:E,onNodeDragStop:P,onSelectionDragStop:L}=t();if(x&&(E(l,!1),x=!1),i||P||!A&&L){const[j,O]=Xd({nodeId:A,dragItems:l,nodeLookup:F,dragging:!1});i?.($.sourceEvent,l,j,O),P?.($.sourceEvent,j,O),A||L?.($.sourceEvent,O)}}}).filter($=>{const F=$.target;return!$.button&&(!N||!Px(F,`.${N}`,I))&&(!w||Px(F,w,I))});h.call(D)}function S(){h?.on(".drag",null)}return{update:b,destroy:S}}function DO(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())ns(i,Go(s))>0&&r.push(s);return r}const jO=250;function $O(e,t,n,r){let i=[],s=1/0;const a=DO(e,n,t+jO);for(const l of a){const u=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of u){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:g}=as(l,d,d.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(g-e.y,2));h>t||(h<s?(i=[{...d,x:f,y:g}],s=h):h===s&&i.push({...d,x:f,y:g}))}}if(!i.length)return null;if(i.length>1){const l=r.type==="source"?"target":"source";return i.find(u=>u.type===l)??i[0]}return i[0]}function Rx(e,t,n,r,i,s=!1){const a=r.get(e);if(!a)return null;const l=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],u=(n?l?.find(d=>d.id===n):l?.[0])??null;return u&&s?{...u,...as(a,u,u.position,!0)}:u}function Lx(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function HO(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Dx=()=>!0;function BO(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:u,lib:d,autoPanOnConnect:f,flowId:g,panBy:h,cancelConnection:m,onConnectStart:x,onConnect:v,onConnectEnd:b,isValidConnection:S=Dx,onReconnectEnd:N,updateConnection:w,getTransform:I,getFromHandle:k,autoPanSpeed:A,dragThreshold:M=1,handleDomNode:B}){const U=gx(e.target);let q=0,D;const{x:$,y:F}=Bn(e),E=Lx(s,B),P=l?.getBoundingClientRect();let L=!1;if(!P||!E)return;const j=Rx(i,E,r,u,t);if(!j)return;let O=Bn(e,P),W=!1,z=null,Y=!1,J=null;function ie(){if(!f||!P)return;const[pe,le]=cx(O,P,A);h({x:pe,y:le}),q=requestAnimationFrame(ie)}const ee={...j,nodeId:i,type:E,position:j.position},ce=u.get(i);let Q={inProgress:!0,isValid:null,from:as(ce,ee,Ne.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:ce,to:O,toHandle:null,toPosition:tx[ee.position],toNode:null};function te(){L=!0,w(Q),x?.(e,{nodeId:i,handleId:r,handleType:E})}M===0&&te();function ne(pe){if(!L){const{x:Oe,y:Ce}=Bn(pe),ae=Oe-$,Ie=Ce-F;if(!(ae*ae+Ie*Ie>M*M))return;te()}if(!k()||!ee){oe(pe);return}const le=I();O=Bn(pe,P),D=$O(os(O,le,!1,[1,1]),n,u,ee),W||(ie(),W=!0);const ve=jx(pe,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:S,doc:U,lib:d,flowId:g,nodeLookup:u});J=ve.handleDomNode,z=ve.connection,Y=HO(!!D,ve.isValid);const me={...Q,isValid:Y,to:ve.toHandle&&Y?xc({x:ve.toHandle.x,y:ve.toHandle.y},le):O,toHandle:ve.toHandle,toPosition:Y&&ve.toHandle?ve.toHandle.position:tx[ee.position],toNode:ve.toHandle?u.get(ve.toHandle.nodeId):null};Y&&D&&Q.toHandle&&me.toHandle&&Q.toHandle.type===me.toHandle.type&&Q.toHandle.nodeId===me.toHandle.nodeId&&Q.toHandle.id===me.toHandle.id&&Q.to.x===me.to.x&&Q.to.y===me.to.y||(w(me),Q=me)}function oe(pe){if(L){(D||J)&&z&&Y&&v?.(z);const{inProgress:le,...ve}=Q,me={...ve,toPosition:Q.toHandle?Q.toPosition:null};b?.(pe,me),s&&N?.(pe,me)}m(),cancelAnimationFrame(q),W=!1,Y=!1,z=null,J=null,U.removeEventListener("mousemove",ne),U.removeEventListener("mouseup",oe),U.removeEventListener("touchmove",ne),U.removeEventListener("touchend",oe)}U.addEventListener("mousemove",ne),U.addEventListener("mouseup",oe),U.addEventListener("touchmove",ne),U.addEventListener("touchend",oe)}function jx(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:u,isValidConnection:d=Dx,nodeLookup:f}){const g=s==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:x}=Bn(e),v=a.elementFromPoint(m,x),b=v?.classList.contains(`${l}-flow__handle`)?v:h,S={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=Lx(void 0,b),w=b.getAttribute("data-nodeid"),I=b.getAttribute("data-handleid"),k=b.classList.contains("connectable"),A=b.classList.contains("connectableend");if(!w||!N)return S;const M={source:g?w:r,sourceHandle:g?I:i,target:g?r:w,targetHandle:g?i:I};S.connection=M;const U=k&&A&&(n===zo.Strict?g&&N==="source"||!g&&N==="target":w!==r||I!==i);S.isValid=U&&d(M),S.toHandle=Rx(w,N,I,f,n,!0)}return S}const Kd={onPointerDown:BO,isValid:jx};function VO({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Yt(e);function s({translateExtent:l,width:u,height:d,zoomStep:f=1,pannable:g=!0,zoomable:h=!0,inversePan:m=!1}){const x=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const I=n(),k=w.sourceEvent.ctrlKey&&is()?10:1,A=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*f,M=I[2]*Math.pow(2,A*k);t.scaleTo(M)};let v=[0,0];const b=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(v=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},S=w=>{const I=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const k=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],A=[k[0]-v[0],k[1]-v[1]];v=k;const M=r()*Math.max(I[2],Math.log(I[2]))*(m?-1:1),B={x:I[0]-A[0]*M,y:I[1]-A[1]*M},U=[[0,0],[u,d]];t.setViewportConstrained({x:B.x,y:B.y,zoom:I[2]},U,l)},N=Zv().on("start",b).on("zoom",g?S:null).on("zoom.wheel",h?x:null);i.call(N,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:bn}}const FO=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Sc=e=>({x:e.x,y:e.y,zoom:e.k}),Zd=({x:e,y:t,zoom:n})=>pc.translate(e,t).scale(n),Xo=(e,t)=>e.target.closest(`.${t}`),$x=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),zO=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jd=(e,t=0,n=zO,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},Hx=e=>{const t=e.ctrlKey&&is()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function UO({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:d}){return f=>{if(Xo(f,t))return!1;f.preventDefault(),f.stopImmediatePropagation();const g=n.property("__zoom").k||1;if(f.ctrlKey&&a){const b=bn(f),S=Hx(f),N=g*Math.pow(2,S);r.scaleTo(n,N,b,f);return}const h=f.deltaMode===1?20:1;let m=i===no.Vertical?0:f.deltaX*h,x=i===no.Horizontal?0:f.deltaY*h;!is()&&f.shiftKey&&i!==no.Vertical&&(m=f.deltaY*h,x=0),r.translateBy(n,-(m/g)*s,-(x/g)*s,{internal:!0});const v=Sc(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,l?.(f,v)),e.isPanScrolling&&(u?.(f,v),e.panScrollTimeout=setTimeout(()=>{d?.(f,v),e.isPanScrolling=!1},150))}}function WO({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=Xo(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function GO({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=Sc(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}function qO({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&$x(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Sc(s.transform))}}function YO({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&$x(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i&&FO(e.prevViewport,a.transform))){const l=Sc(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},n?150:0)}}}function XO({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:u,lib:d}){return f=>{const g=e||t,h=n&&f.ctrlKey;if(f.button===1&&f.type==="mousedown"&&(Xo(f,`${d}-flow__node`)||Xo(f,`${d}-flow__edge`)))return!0;if(!r&&!g&&!i&&!s&&!n||a||Xo(f,l)&&f.type==="wheel"||Xo(f,u)&&(f.type!=="wheel"||i&&f.type==="wheel"&&!e)||!n&&f.ctrlKey&&f.type==="wheel")return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!g&&!i&&!h&&f.type==="wheel"||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||f.type==="wheel")&&m}}function KO({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),h=Zv().clickDistance(!Nn(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(i),m=Yt(e).call(h);w({x:s.x,y:s.y,zoom:Wo(s.zoom,t,n)},[[0,0],[g.width,g.height]],i);const x=m.on("wheel.zoom"),v=m.on("dblclick.zoom");h.wheelDelta(Hx);function b($,F){return m?new Promise(E=>{h?.interpolate(F?.interpolate==="linear"?Gi:rc).transform(Jd(m,F?.duration,F?.ease,()=>E(!0)),$)}):Promise.resolve(!1)}function S({noWheelClassName:$,noPanClassName:F,onPaneContextMenu:E,userSelectionActive:P,panOnScroll:L,panOnDrag:j,panOnScrollMode:O,panOnScrollSpeed:W,preventScrolling:z,zoomOnPinch:Y,zoomOnScroll:J,zoomOnDoubleClick:ie,zoomActivationKeyPressed:ee,lib:ce,onTransformChange:ge}){P&&!f.isZoomingOrPanning&&N();const te=L&&!ee&&!P?UO({zoomPanValues:f,noWheelClassName:$,d3Selection:m,d3Zoom:h,panOnScrollMode:O,panOnScrollSpeed:W,zoomOnPinch:Y,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}):WO({noWheelClassName:$,preventScrolling:z,d3ZoomHandler:x});if(m.on("wheel.zoom",te,{passive:!1}),!P){const oe=GO({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});h.on("start",oe);const pe=qO({zoomPanValues:f,panOnDrag:j,onPaneContextMenu:!!E,onPanZoom:a,onTransformChange:ge});h.on("zoom",pe);const le=YO({zoomPanValues:f,panOnDrag:j,panOnScroll:L,onPaneContextMenu:E,onPanZoomEnd:u,onDraggingChange:d});h.on("end",le)}const ne=XO({zoomActivationKeyPressed:ee,panOnDrag:j,zoomOnScroll:J,panOnScroll:L,zoomOnDoubleClick:ie,zoomOnPinch:Y,userSelectionActive:P,noPanClassName:F,noWheelClassName:$,lib:ce});h.filter(ne),ie?m.on("dblclick.zoom",v):m.on("dblclick.zoom",null)}function N(){h.on("zoom",null)}async function w($,F,E){const P=Zd($),L=h?.constrain()(P,F,E);return L&&await b(L),new Promise(j=>j(L))}async function I($,F){const E=Zd($);return await b(E,F),new Promise(P=>P(E))}function k($){if(m){const F=Zd($),E=m.property("__zoom");(E.k!==$.zoom||E.x!==$.x||E.y!==$.y)&&h?.transform(m,F,null,{sync:!0})}}function A(){const $=m?Xv(m.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function M($,F){return m?new Promise(E=>{h?.interpolate(F?.interpolate==="linear"?Gi:rc).scaleTo(Jd(m,F?.duration,F?.ease,()=>E(!0)),$)}):Promise.resolve(!1)}function B($,F){return m?new Promise(E=>{h?.interpolate(F?.interpolate==="linear"?Gi:rc).scaleBy(Jd(m,F?.duration,F?.ease,()=>E(!0)),$)}):Promise.resolve(!1)}function U($){h?.scaleExtent($)}function q($){h?.translateExtent($)}function D($){const F=!Nn($)||$<0?0:$;h?.clickDistance(F)}return{update:S,destroy:N,setViewport:I,setViewportConstrained:w,getViewport:A,scaleTo:M,scaleBy:B,setScaleExtent:U,setTranslateExtent:q,syncViewport:k,setClickDistance:D}}var oo;(function(e){e.Line="line",e.Handle="handle"})(oo||(oo={}));function ZO({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const a=e-t,l=n-r,u=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(u[0]=u[0]*-1),l&&s&&(u[1]=u[1]*-1),u}function JO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Nr(e,t){return Math.max(0,t-e)}function Ir(e,t){return Math.max(0,e-t)}function _c(e,t,n){return Math.max(0,t-e,e-n)}function Bx(e,t){return e?!t:t}function QO(e,t,n,r,i,s,a,l){let{affectsX:u,affectsY:d}=t;const{isHorizontal:f,isVertical:g}=t,h=f&&g,{xSnapped:m,ySnapped:x}=n,{minWidth:v,maxWidth:b,minHeight:S,maxHeight:N}=r,{x:w,y:I,width:k,height:A,aspectRatio:M}=e;let B=Math.floor(f?m-e.pointerX:0),U=Math.floor(g?x-e.pointerY:0);const q=k+(u?-B:B),D=A+(d?-U:U),$=-s[0]*k,F=-s[1]*A;let E=_c(q,v,b),P=_c(D,S,N);if(a){let O=0,W=0;u&&B<0?O=Nr(w+B+$,a[0][0]):!u&&B>0&&(O=Ir(w+q+$,a[1][0])),d&&U<0?W=Nr(I+U+F,a[0][1]):!d&&U>0&&(W=Ir(I+D+F,a[1][1])),E=Math.max(E,O),P=Math.max(P,W)}if(l){let O=0,W=0;u&&B>0?O=Ir(w+B,l[0][0]):!u&&B<0&&(O=Nr(w+q,l[1][0])),d&&U>0?W=Ir(I+U,l[0][1]):!d&&U<0&&(W=Nr(I+D,l[1][1])),E=Math.max(E,O),P=Math.max(P,W)}if(i){if(f){const O=_c(q/M,S,N)*M;if(E=Math.max(E,O),a){let W=0;!u&&!d||u&&!d&&h?W=Ir(I+F+q/M,a[1][1])*M:W=Nr(I+F+(u?B:-B)/M,a[0][1])*M,E=Math.max(E,W)}if(l){let W=0;!u&&!d||u&&!d&&h?W=Nr(I+q/M,l[1][1])*M:W=Ir(I+(u?B:-B)/M,l[0][1])*M,E=Math.max(E,W)}}if(g){const O=_c(D*M,v,b)/M;if(P=Math.max(P,O),a){let W=0;!u&&!d||d&&!u&&h?W=Ir(w+D*M+$,a[1][0])/M:W=Nr(w+(d?U:-U)*M+$,a[0][0])/M,P=Math.max(P,W)}if(l){let W=0;!u&&!d||d&&!u&&h?W=Nr(w+D*M,l[1][0])/M:W=Ir(w+(d?U:-U)*M,l[0][0])/M,P=Math.max(P,W)}}}U=U+(U<0?P:-P),B=B+(B<0?E:-E),i&&(h?q>D*M?U=(Bx(u,d)?-B:B)/M:B=(Bx(u,d)?-U:U)*M:f?(U=B/M,d=u):(B=U*M,u=d));const L=u?w+B:w,j=d?I+U:I;return{width:k+(u?-B:B),height:A+(d?-U:U),x:s[0]*B*(u?-1:1)+L,y:s[1]*U*(d?-1:1)+j}}const Vx={width:0,height:0,x:0,y:0},eP={...Vx,pointerX:0,pointerY:0,aspectRatio:1};function tP(e){return[[0,0],[e.measured.width,e.measured.height]]}function nP(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,u=n[1]*a;return[[r-l,i-u],[r+s-l,i+a-u]]}function rP({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Yt(e);function a({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:g,onResizeStart:h,onResize:m,onResizeEnd:x,shouldResize:v}){let b={...Vx},S={...eP};const N=JO(u);let w,I=null,k=[],A,M,B;const U=bv().on("start",q=>{const{nodeLookup:D,transform:$,snapGrid:F,snapToGrid:E,nodeOrigin:P,paneDomNode:L}=n();if(w=D.get(t),!w)return;I=L?.getBoundingClientRect()??null;const{xSnapped:j,ySnapped:O}=ss(q.sourceEvent,{transform:$,snapGrid:F,snapToGrid:E,containerBounds:I});b={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},S={...b,pointerX:j,pointerY:O,aspectRatio:b.width/b.height},A=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(A=D.get(w.parentId),M=A&&w.extent==="parent"?tP(A):void 0),k=[],B=void 0;for(const[W,z]of D)if(z.parentId===t&&(k.push({id:W,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const Y=nP(z,w,z.origin??P);B?B=[[Math.min(Y[0][0],B[0][0]),Math.min(Y[0][1],B[0][1])],[Math.max(Y[1][0],B[1][0]),Math.max(Y[1][1],B[1][1])]]:B=Y}h?.(q,{...b})}).on("drag",q=>{const{transform:D,snapGrid:$,snapToGrid:F,nodeOrigin:E}=n(),P=ss(q.sourceEvent,{transform:D,snapGrid:$,snapToGrid:F,containerBounds:I}),L=[];if(!w)return;const{x:j,y:O,width:W,height:z}=b,Y={},J=w.origin??E,{width:ie,height:ee,x:ce,y:ge}=QO(S,N,P,d,f,J,M,B),Q=ie!==W,te=ee!==z,ne=ce!==j&&Q,oe=ge!==O&&te;if(!ne&&!oe&&!Q&&!te)return;if((ne||oe||J[0]===1||J[1]===1)&&(Y.x=ne?ce:b.x,Y.y=oe?ge:b.y,b.x=Y.x,b.y=Y.y,k.length>0)){const me=ce-j,Oe=ge-O;for(const Ce of k)Ce.position={x:Ce.position.x-me+J[0]*(ie-W),y:Ce.position.y-Oe+J[1]*(ee-z)},L.push(Ce)}if((Q||te)&&(Y.width=Q&&(!g||g==="horizontal")?ie:b.width,Y.height=te&&(!g||g==="vertical")?ee:b.height,b.width=Y.width,b.height=Y.height),A&&w.expandParent){const me=J[0]*(Y.width??0);Y.x&&Y.x<me&&(b.x=me,S.x=S.x-(Y.x-me));const Oe=J[1]*(Y.height??0);Y.y&&Y.y<Oe&&(b.y=Oe,S.y=S.y-(Y.y-Oe))}const pe=ZO({width:b.width,prevWidth:W,height:b.height,prevHeight:z,affectsX:N.affectsX,affectsY:N.affectsY}),le={...b,direction:pe};v?.(q,le)!==!1&&(m?.(q,le),r(Y,L))}).on("end",q=>{x?.(q,{...b}),i?.({...b})});s.call(U)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}var Nc={exports:{}},Qd={};/**
249
+ * @license React
250
+ * use-sync-external-store-shim/with-selector.production.js
251
+ *
252
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
253
+ *
254
+ * This source code is licensed under the MIT license found in the
255
+ * LICENSE file in the root directory of this source tree.
256
+ */var Fx;function oP(){if(Fx)return Qd;Fx=1;var e=T,t=em();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,a=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Qd.useSyncExternalStoreWithSelector=function(d,f,g,h,m){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(A){if(!N){if(N=!0,w=A,A=h(A),m!==void 0&&v.hasValue){var M=v.value;if(m(M,A))return I=M}return I=A}if(M=I,r(w,A))return M;var B=h(A);return m!==void 0&&m(M,B)?(w=A,M):(w=A,I=B)}var N=!1,w,I,k=g===void 0?null:g;return[function(){return S(f())},k===null?void 0:function(){return S(k())}]},[f,g,h,m]);var b=i(d,x[0],x[1]);return a(function(){v.hasValue=!0,v.value=b},[b]),u(b),b},Qd}var ef={};/**
257
+ * @license React
258
+ * use-sync-external-store-shim/with-selector.development.js
259
+ *
260
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
261
+ *
262
+ * This source code is licensed under the MIT license found in the
263
+ * LICENSE file in the root directory of this source tree.
264
+ */var zx;function iP(){return zx||(zx=1,process.env.NODE_ENV!=="production"&&function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=T,n=em(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,s=t.useRef,a=t.useEffect,l=t.useMemo,u=t.useDebugValue;ef.useSyncExternalStoreWithSelector=function(d,f,g,h,m){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(A){if(!N){if(N=!0,w=A,A=h(A),m!==void 0&&v.hasValue){var M=v.value;if(m(M,A))return I=M}return I=A}if(M=I,r(w,A))return M;var B=h(A);return m!==void 0&&m(M,B)?(w=A,M):(w=A,I=B)}var N=!1,w,I,k=g===void 0?null:g;return[function(){return S(f())},k===null?void 0:function(){return S(k())}]},[f,g,h,m]);var b=i(d,x[0],x[1]);return a(function(){v.hasValue=!0,v.value=b},[b]),u(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ef}var Ux;function sP(){return Ux||(Ux=1,process.env.NODE_ENV==="production"?Nc.exports=oP():Nc.exports=iP()),Nc.exports}var aP=sP();const cP=Uh(aP),lP={},Wx=e=>{let t;const n=new Set,r=(f,g)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const m=t;t=g??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(x=>x(t,m))}},i=()=>t,u={setState:r,getState:i,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(lP?"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()}},d=t=e(r,i,u);return u},uP=e=>e?Wx(e):Wx,{useDebugValue:dP}=T,{useSyncExternalStoreWithSelector:fP}=cP,pP=e=>e;function Gx(e,t=pP,n){const r=fP(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dP(r),r}const qx=(e,t)=>{const n=uP(e),r=(i,s=t)=>Gx(n,i,s);return Object.assign(r,n),r},hP=(e,t)=>e?qx(e,t):qx;function ct(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[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Ic=T.createContext(null),gP=Ic.Provider,Yx=jt.error001();function Fe(e,t){const n=T.useContext(Ic);if(n===null)throw new Error(Yx);return Gx(n,e,t)}function rt(){const e=T.useContext(Ic);if(e===null)throw new Error(Yx);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Xx={display:"none"},mP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Kx="react-flow__node-desc",Zx="react-flow__edge-desc",yP="react-flow__aria-live",vP=e=>e.ariaLiveMessage,xP=e=>e.ariaLabelConfig;function wP({rfId:e}){const t=Fe(vP);return y.jsx("div",{id:`${yP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:mP,children:t})}function bP({rfId:e,disableKeyboardA11y:t}){const n=Fe(xP);return y.jsxs(y.Fragment,{children:[y.jsx("div",{id:`${Kx}-${e}`,style:Xx,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),y.jsx("div",{id:`${Zx}-${e}`,style:Xx,children:n["edge.a11yDescription.default"]}),!t&&y.jsx(wP,{rfId:e})]})}const Ec=T.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return y.jsx("div",{className:yt(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});Ec.displayName="Panel";function SP({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:y.jsx(Ec,{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:y.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const _P=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Tc=e=>e.id;function NP(e,t){return ct(e.selectedNodes.map(Tc),t.selectedNodes.map(Tc))&&ct(e.selectedEdges.map(Tc),t.selectedEdges.map(Tc))}function IP({onSelectionChange:e}){const t=rt(),{selectedNodes:n,selectedEdges:r}=Fe(_P,NP);return T.useEffect(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const EP=e=>!!e.onSelectionChangeHandlers;function TP({onSelectionChange:e}){const t=Fe(EP);return e||t?y.jsx(IP,{onSelectionChange:e}):null}const Jx=[0,0],CP={x:0,y:0,zoom:1},Qx=[...["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"],AP=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}),e0={translateExtent:Ji,nodeOrigin:Jx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function kP(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:u,setPaneClickDistance:d}=Fe(AP,ct),f=rt();T.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{g.current=e0,l()}),[]);const g=T.useRef(e0);return T.useEffect(()=>{for(const h of Qx){const m=e[h],x=g.current[h];m!==x&&(typeof e[h]>"u"||(h==="nodes"?t(m):h==="edges"?n(m):h==="minZoom"?r(m):h==="maxZoom"?i(m):h==="translateExtent"?s(m):h==="nodeExtent"?a(m):h==="paneClickDistance"?d(m):h==="ariaLabelConfig"?f.setState({ariaLabelConfig:gO(m)}):h==="fitView"?f.setState({fitViewQueued:m}):h==="fitViewOptions"?f.setState({fitViewOptions:m}):f.setState({[h]:m})))}g.current=e},Qx.map(h=>e[h])),null}function t0(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function MP(e){const[t,n]=T.useState(e==="system"?null:e);return T.useEffect(()=>{if(e!=="system"){n(e);return}const r=t0(),i=()=>n(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:t0()?.matches?"dark":"light"}const n0=typeof document<"u"?document:null;function cs(e=null,t={target:n0,actInsideInputWithModifier:!0}){const[n,r]=T.useState(!1),i=T.useRef(!1),s=T.useRef(new Set([])),[a,l]=T.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
265
+ `).replace(`
266
+
267
+ `,`
268
+ +`).split(`
269
+ `)),f=d.reduce((g,h)=>g.concat(...h),[]);return[d,f]}return[[],[]]},[e]);return T.useEffect(()=>{const u=t?.target??n0,d=t?.actInsideInputWithModifier??!0;if(e!==null){const f=m=>{if(i.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!i.current||i.current&&!d)&&mx(m))return!1;const v=o0(m.code,l);if(s.current.add(m[v]),r0(a,s.current,!1)){const b=m.composedPath?.()?.[0]||m.target,S=b?.nodeName==="BUTTON"||b?.nodeName==="A";t.preventDefault!==!1&&(i.current||!S)&&m.preventDefault(),r(!0)}},g=m=>{const x=o0(m.code,l);r0(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(m[x]),m.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.current.clear(),r(!1)};return u?.addEventListener("keydown",f),u?.addEventListener("keyup",g),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{u?.removeEventListener("keydown",f),u?.removeEventListener("keyup",g),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function r0(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function o0(e,t){return t.includes(e)?"code":"key"}const OP=()=>{const e=rt();return T.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:s,maxZoom:a,panZoom:l}=e.getState(),u=Bd(t,r,i,s,a,n?.padding??.1);return l?(await l.setViewport(u,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:l,y:u}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-u},f=n.snapGrid??i,g=n.snapToGrid??s;return os(d,r,g,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),a=xc(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function i0(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const a=r.get(s.id);a?a.push(s):r.set(s.id,[s])}for(const s of t){const a=r.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const u of a)PP(u,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function PP(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 s0(e,t){return i0(e,t)}function ls(e,t){return i0(e,t)}function io(e,t){return{id:e,type:"select",selected:t}}function Ko(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const a=t.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),r.push(io(s.id,a)))}return r}function a0({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const a=t.get(s.id),l=a?.internals?.userNode??a;l!==void 0&&l!==s&&n.push({id:s.id,item:s,type:"replace"}),l===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function c0(e){return{id:e.id,type:"remove"}}const l0=e=>aO(e),RP=e=>ox(e);function u0(e){return T.forwardRef(e)}const LP=typeof window<"u"?T.useLayoutEffect:T.useEffect;function d0(e){const[t,n]=T.useState(BigInt(0)),[r]=T.useState(()=>DP(()=>n(i=>i+BigInt(1))));return LP(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function DP(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const f0=T.createContext(null);function jP({children:e}){const t=rt(),n=T.useCallback(l=>{const{nodes:u=[],setNodes:d,hasDefaultNodes:f,onNodesChange:g,nodeLookup:h,fitViewQueued:m}=t.getState();let x=u;for(const b of l)x=typeof b=="function"?b(x):b;const v=a0({items:x,lookup:h});f&&d(x),v.length>0?g?.(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:S,setNodes:N}=t.getState();b&&N(S)})},[]),r=d0(n),i=T.useCallback(l=>{const{edges:u=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:g,edgeLookup:h}=t.getState();let m=u;for(const x of l)m=typeof x=="function"?x(m):x;f?d(m):g&&g(a0({items:m,lookup:h}))},[]),s=d0(i),a=T.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return y.jsx(f0.Provider,{value:a,children:e})}function $P(){const e=T.useContext(f0);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const HP=e=>!!e.panZoom;function Zo(){const e=OP(),t=rt(),n=$P(),r=Fe(HP),i=T.useMemo(()=>{const s=g=>t.getState().nodeLookup.get(g),a=g=>{n.nodeQueue.push(g)},l=g=>{n.edgeQueue.push(g)},u=g=>{const{nodeLookup:h,nodeOrigin:m}=t.getState(),x=l0(g)?g:h.get(g.id),v=x.parentId?px(x.position,x.measured,x.parentId,h,m):x.position,b={...x,position:v,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return Go(b)},d=(g,h,m={replace:!1})=>{a(x=>x.map(v=>{if(v.id===g){const b=typeof h=="function"?h(v):h;return m.replace&&l0(b)?b:{...v,...b}}return v}))},f=(g,h,m={replace:!1})=>{l(x=>x.map(v=>{if(v.id===g){const b=typeof h=="function"?h(v):h;return m.replace&&RP(b)?b:{...v,...b}}return v}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>s(g)?.internals.userNode,getInternalNode:s,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(h=>({...h}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:a,setEdges:l,addNodes:g=>{const h=Array.isArray(g)?g:[g];n.nodeQueue.push(m=>[...m,...h])},addEdges:g=>{const h=Array.isArray(g)?g:[g];n.edgeQueue.push(m=>[...m,...h])},toObject:()=>{const{nodes:g=[],edges:h=[],transform:m}=t.getState(),[x,v,b]=m;return{nodes:g.map(S=>({...S})),edges:h.map(S=>({...S})),viewport:{x,y:v,zoom:b}}},deleteElements:async({nodes:g=[],edges:h=[]})=>{const{nodes:m,edges:x,onNodesDelete:v,onEdgesDelete:b,triggerNodeChanges:S,triggerEdgeChanges:N,onDelete:w,onBeforeDelete:I}=t.getState(),{nodes:k,edges:A}=await dO({nodesToRemove:g,edgesToRemove:h,nodes:m,edges:x,onBeforeDelete:I}),M=A.length>0,B=k.length>0;if(M){const U=A.map(c0);b?.(A),N(U)}if(B){const U=k.map(c0);v?.(k),S(U)}return(B||M)&&w?.({nodes:k,edges:A}),{deletedNodes:k,deletedEdges:A}},getIntersectingNodes:(g,h=!0,m)=>{const x=ux(g),v=x?g:u(g),b=m!==void 0;return v?(m||t.getState().nodes).filter(S=>{const N=t.getState().nodeLookup.get(S.id);if(N&&!x&&(S.id===g.id||!N.internals.positionAbsolute))return!1;const w=Go(b?S:N),I=ns(w,v);return h&&I>0||I>=w.width*w.height||I>=v.width*v.height}):[]},isNodeIntersecting:(g,h,m=!0)=>{const v=ux(g)?g:u(g);if(!v)return!1;const b=ns(v,h);return m&&b>0||b>=v.width*v.height},updateNode:d,updateNodeData:(g,h,m={replace:!1})=>{d(g,x=>{const v=typeof h=="function"?h(x):h;return m.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},m)},updateEdge:f,updateEdgeData:(g,h,m={replace:!1})=>{f(g,x=>{const v=typeof h=="function"?h(x):h;return m.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},m)},getNodesBounds:g=>{const{nodeLookup:h,nodeOrigin:m}=t.getState();return cO(g,{nodeLookup:h,nodeOrigin:m})},getHandleConnections:({type:g,id:h,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}-${g}${h?`-${h}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:h,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}${g?h?`-${g}-${h}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const h=t.getState().fitViewResolver??hO();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:h}),n.nodeQueue.push(m=>[...m]),h.promise}}},[]);return T.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const p0=e=>e.selected,BP=typeof window<"u"?window:void 0;function VP({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=rt(),{deleteElements:r}=Zo(),i=cs(e,{actInsideInputWithModifier:!1}),s=cs(t,{target:BP});T.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(p0),edges:a.filter(p0)}),n.setState({nodesSelectionActive:!1})}},[i]),T.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function FP(e){const t=rt();T.useEffect(()=>{const n=()=>{if(!e.current)return!1;const r=Vd(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",jt.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Cc={position:"absolute",width:"100%",height:"100%",top:0,left:0},zP=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function UP({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=no.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:d,minZoom:f,maxZoom:g,zoomActivationKeyCode:h,preventScrolling:m=!0,children:x,noWheelClassName:v,noPanClassName:b,onViewportChange:S,isControlledViewport:N,paneClickDistance:w}){const I=rt(),k=T.useRef(null),{userSelectionActive:A,lib:M}=Fe(zP,ct),B=cs(h),U=T.useRef();FP(k);const q=T.useCallback(D=>{S?.({x:D[0],y:D[1],zoom:D[2]}),N||I.setState({transform:D})},[S,N]);return T.useEffect(()=>{if(k.current){U.current=KO({domNode:k.current,minZoom:f,maxZoom:g,translateExtent:d,viewport:u,paneClickDistance:w,onDraggingChange:E=>I.setState({paneDragging:E}),onPanZoomStart:(E,P)=>{const{onViewportChangeStart:L,onMoveStart:j}=I.getState();j?.(E,P),L?.(P)},onPanZoom:(E,P)=>{const{onViewportChange:L,onMove:j}=I.getState();j?.(E,P),L?.(P)},onPanZoomEnd:(E,P)=>{const{onViewportChangeEnd:L,onMoveEnd:j}=I.getState();j?.(E,P),L?.(P)}});const{x:D,y:$,zoom:F}=U.current.getViewport();return I.setState({panZoom:U.current,transform:[D,$,F],domNode:k.current.closest(".react-flow")}),()=>{U.current?.destroy()}}},[]),T.useEffect(()=>{U.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:B,preventScrolling:m,noPanClassName:b,userSelectionActive:A,noWheelClassName:v,lib:M,onTransformChange:q})},[e,t,n,r,i,s,a,l,B,m,b,A,v,M,q]),y.jsx("div",{className:"react-flow__renderer",ref:k,style:Cc,children:x})}const WP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function GP(){const{userSelectionActive:e,userSelectionRect:t}=Fe(WP,ct);return e&&t?y.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 tf=(e,t)=>n=>{n.target===t.current&&e?.(n)},qP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function YP({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Uo.Full,panOnDrag:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:g,onPaneMouseLeave:h,children:m}){const x=rt(),{userSelectionActive:v,elementsSelectable:b,dragging:S,connectionInProgress:N}=Fe(qP,ct),w=b&&(e||v),I=T.useRef(null),k=T.useRef(),A=T.useRef(new Set),M=T.useRef(new Set),B=T.useRef(!1),U=T.useRef(!1),q=j=>{if(B.current||N){B.current=!1;return}l?.(j),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},D=j=>{if(Array.isArray(r)&&r?.includes(2)){j.preventDefault();return}u?.(j)},$=d?j=>d(j):void 0,F=j=>{const{resetSelectedElements:O,domNode:W}=x.getState();if(k.current=W?.getBoundingClientRect(),!b||!e||j.button!==0||j.target!==I.current||!k.current)return;j.target?.setPointerCapture?.(j.pointerId),U.current=!0,B.current=!1;const{x:z,y:Y}=Bn(j.nativeEvent,k.current);O(),x.setState({userSelectionRect:{width:0,height:0,startX:z,startY:Y,x:z,y:Y}}),s?.(j)},E=j=>{const{userSelectionRect:O,transform:W,nodeLookup:z,edgeLookup:Y,connectionLookup:J,triggerNodeChanges:ie,triggerEdgeChanges:ee,defaultEdgeOptions:ce}=x.getState();if(!k.current||!O)return;B.current=!0;const{x:ge,y:Q}=Bn(j.nativeEvent,k.current),{startX:te,startY:ne}=O,oe={startX:te,startY:ne,x:ge<te?ge:te,y:Q<ne?Q:ne,width:Math.abs(ge-te),height:Math.abs(Q-ne)},pe=A.current,le=M.current;A.current=new Set(jd(z,oe,W,n===Uo.Partial,!0).map(me=>me.id)),M.current=new Set;const ve=ce?.selectable??!0;for(const me of A.current){const Oe=J.get(me);if(Oe)for(const{edgeId:Ce}of Oe.values()){const ae=Y.get(Ce);ae&&(ae.selectable??ve)&&M.current.add(Ce)}}if(!hx(pe,A.current)){const me=Ko(z,A.current,!0);ie(me)}if(!hx(le,M.current)){const me=Ko(Y,M.current);ee(me)}x.setState({userSelectionRect:oe,userSelectionActive:!0,nodesSelectionActive:!1})},P=j=>{if(j.button!==0||!U.current)return;j.target?.releasePointerCapture?.(j.pointerId);const{userSelectionRect:O}=x.getState();!v&&O&&j.target===I.current&&q?.(j),x.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:A.current.size>0}),a?.(j),(t||i)&&(B.current=!1),U.current=!1},L=r===!0||Array.isArray(r)&&r.includes(0);return y.jsxs("div",{className:yt(["react-flow__pane",{draggable:L,dragging:S,selection:e}]),onClick:w?void 0:tf(q,I),onContextMenu:tf(D,I),onWheel:tf($,I),onPointerEnter:w?void 0:f,onPointerDown:w?F:g,onPointerMove:w?E:g,onPointerUp:w?P:void 0,onPointerLeave:h,ref:I,style:Cc,children:[m,y.jsx(GP,{})]})}function nf({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:u}=t.getState(),d=l.get(e);if(!d){u?.("012",jt.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function h0({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=rt(),[u,d]=T.useState(!1),f=T.useRef();return T.useEffect(()=>{f.current=LO({getStoreItems:()=>l.getState(),onNodeMouseDown:g=>{nf({id:g,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),T.useEffect(()=>{if(t)f.current?.destroy();else if(e.current)return f.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{f.current?.destroy()}},[n,r,t,s,e,i]),u}const XP=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function g0(){const e=rt();return T.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:u,nodeLookup:d,nodeOrigin:f}=e.getState(),g=new Map,h=XP(a),m=i?s[0]:5,x=i?s[1]:5,v=n.direction.x*m*n.factor,b=n.direction.y*x*n.factor;for(const[,S]of d){if(!h(S))continue;let N={x:S.internals.positionAbsolute.x+v,y:S.internals.positionAbsolute.y+b};i&&(N=rs(N,s));const{position:w,positionAbsolute:I}=ix({nodeId:S.id,nextPosition:N,nodeLookup:d,nodeExtent:r,nodeOrigin:f,onError:l});S.position=w,S.internals.positionAbsolute=I,g.set(S.id,S)}u(g)},[])}const rf=T.createContext(null),KP=rf.Provider;rf.Consumer;const us=()=>T.useContext(rf),ZP=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),JP=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,toHandle:u,isValid:d}=a,f=u?.nodeId===e&&u?.id===t&&u?.type===n;return{connectingFrom:l?.nodeId===e&&l?.id===t&&l?.type===n,connectingTo:f,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:s===zo.Strict?l?.type!==n:e!==l?.nodeId||t!==l?.id,connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:f&&d}};function QP({type:e="source",position:t=Ne.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:u,className:d,onMouseDown:f,onTouchStart:g,...h},m){const x=a||null,v=e==="target",b=rt(),S=us(),{connectOnClick:N,noPanClassName:w,rfId:I}=Fe(ZP,ct),{connectingFrom:k,connectingTo:A,clickConnecting:M,isPossibleEndHandle:B,connectionInProcess:U,clickConnectionInProcess:q,valid:D}=Fe(JP(S,x,e),ct);S||b.getState().onError?.("010",jt.error010());const $=P=>{const{defaultEdgeOptions:L,onConnect:j,hasDefaultEdges:O}=b.getState(),W={...L,...P};if(O){const{edges:z,setEdges:Y}=b.getState();Y(Sx(W,z))}j?.(W),l?.(W)},F=P=>{if(!S)return;const L=yx(P.nativeEvent);if(i&&(L&&P.button===0||!L)){const j=b.getState();Kd.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:v,handleId:x,nodeId:S,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:j.onConnectEnd,updateConnection:j.updateConnection,onConnect:$,isValidConnection:n||j.isValidConnection,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}L?f?.(P):g?.(P)},E=P=>{const{onClickConnectStart:L,onClickConnectEnd:j,connectionClickStartHandle:O,connectionMode:W,isValidConnection:z,lib:Y,rfId:J,nodeLookup:ie,connection:ee}=b.getState();if(!S||!O&&!i)return;if(!O){L?.(P.nativeEvent,{nodeId:S,handleId:x,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,id:x}});return}const ce=gx(P.target),ge=n||z,{connection:Q,isValid:te}=Kd.isValid(P.nativeEvent,{handle:{nodeId:S,id:x,type:e},connectionMode:W,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:ge,flowId:J,doc:ce,lib:Y,nodeLookup:ie});te&&Q&&$(Q);const ne=structuredClone(ee);delete ne.inProgress,ne.toPosition=ne.toHandle?ne.toHandle.position:null,j?.(P,ne),b.setState({connectionClickStartHandle:null})};return y.jsx("div",{"data-handleid":x,"data-nodeid":S,"data-handlepos":t,"data-id":`${I}-${S}-${x}-${e}`,className:yt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!v,target:v,connectable:r,connectablestart:i,connectableend:s,clickconnecting:M,connectingfrom:k,connectingto:A,valid:D,connectionindicator:r&&(!U||B)&&(U||q?s:i)}]),onMouseDown:F,onTouchStart:F,onClick:N?E:void 0,ref:m,...h,children:u})}const ds=T.memo(u0(QP));function eR({data:e,isConnectable:t,sourcePosition:n=Ne.Bottom}){return y.jsxs(y.Fragment,{children:[e?.label,y.jsx(ds,{type:"source",position:n,isConnectable:t})]})}function tR({data:e,isConnectable:t,targetPosition:n=Ne.Top,sourcePosition:r=Ne.Bottom}){return y.jsxs(y.Fragment,{children:[y.jsx(ds,{type:"target",position:n,isConnectable:t}),e?.label,y.jsx(ds,{type:"source",position:r,isConnectable:t})]})}function nR(){return null}function rR({data:e,isConnectable:t,targetPosition:n=Ne.Top}){return y.jsxs(y.Fragment,{children:[y.jsx(ds,{type:"target",position:n,isConnectable:t}),e?.label]})}const Ac={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},m0={input:eR,default:tR,output:rR,group:nR};function oR(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 iR=e=>{const{width:t,height:n,x:r,y:i}=ts(e.nodeLookup,{filter:s=>!!s.selected});return{width:Nn(t)?t:null,height:Nn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function sR({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=rt(),{width:i,height:s,transformString:a,userSelectionActive:l}=Fe(iR,ct),u=g0(),d=T.useRef(null);if(T.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]),h0({nodeRef:d}),l||!i||!s)return null;const f=e?h=>{const m=r.getState().nodes.filter(x=>x.selected);e(h,m)}:void 0,g=h=>{Object.prototype.hasOwnProperty.call(Ac,h.key)&&(h.preventDefault(),u({direction:Ac[h.key],factor:h.shiftKey?4:1}))};return y.jsx("div",{className:yt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:y.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:i,height:s}})})}const y0=typeof window<"u"?window:void 0,aR=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function v0({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:g,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:x,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:S,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:I,panOnScrollSpeed:k,panOnScrollMode:A,zoomOnDoubleClick:M,panOnDrag:B,defaultViewport:U,translateExtent:q,minZoom:D,maxZoom:$,preventScrolling:F,onSelectionContextMenu:E,noWheelClassName:P,noPanClassName:L,disableKeyboardA11y:j,onViewportChange:O,isControlledViewport:W}){const{nodesSelectionActive:z,userSelectionActive:Y}=Fe(aR),J=cs(d,{target:y0}),ie=cs(v,{target:y0}),ee=ie||B,ce=ie||I,ge=f&&ee!==!0,Q=J||Y||ge;return VP({deleteKeyCode:u,multiSelectionKeyCode:x}),y.jsx(UP,{onPaneContextMenu:s,elementsSelectable:S,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:ce,panOnScrollSpeed:k,panOnScrollMode:A,zoomOnDoubleClick:M,panOnDrag:!J&&ee,defaultViewport:U,translateExtent:q,minZoom:D,maxZoom:$,zoomActivationKeyCode:b,preventScrolling:F,noWheelClassName:P,noPanClassName:L,onViewportChange:O,isControlledViewport:W,paneClickDistance:l,children:y.jsxs(YP,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:ee,isSelecting:!!Q,selectionMode:g,selectionKeyPressed:J,selectionOnDrag:ge,children:[e,z&&y.jsx(sR,{onSelectionContextMenu:E,noPanClassName:L,disableKeyboardA11y:j})]})})}v0.displayName="FlowRenderer";const cR=T.memo(v0),lR=e=>t=>e?jd(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 uR(e){return Fe(T.useCallback(lR(e),[e]),ct)}const dR=e=>e.updateNodeInternals;function fR(){const e=Fe(dR),[t]=T.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return T.useEffect(()=>()=>{t?.disconnect()},[t]),t}function pR({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=rt(),s=T.useRef(null),a=T.useRef(null),l=T.useRef(e.sourcePosition),u=T.useRef(e.targetPosition),d=T.useRef(t),f=n&&!!e.internals.handleBounds;return T.useEffect(()=>{s.current&&!e.hidden&&(!f||a.current!==s.current)&&(a.current&&r?.unobserve(a.current),r?.observe(s.current),a.current=s.current)},[f,e.hidden]),T.useEffect(()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)},[]),T.useEffect(()=>{if(s.current){const g=d.current!==t,h=l.current!==e.sourcePosition,m=u.current!==e.targetPosition;(g||h||m)&&(d.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function hR({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:u,nodesConnectable:d,nodesFocusable:f,resizeObserver:g,noDragClassName:h,noPanClassName:m,disableKeyboardA11y:x,rfId:v,nodeTypes:b,nodeClickDistance:S,onError:N}){const{node:w,internals:I,isParent:k}=Fe(te=>{const ne=te.nodeLookup.get(e),oe=te.parentLookup.has(e);return{node:ne,internals:ne.internals,isParent:oe}},ct);let A=w.type||"default",M=b?.[A]||m0[A];M===void 0&&(N?.("003",jt.error003(A)),A="default",M=b?.default||m0.default);const B=!!(w.draggable||l&&typeof w.draggable>"u"),U=!!(w.selectable||u&&typeof w.selectable>"u"),q=!!(w.connectable||d&&typeof w.connectable>"u"),D=!!(w.focusable||f&&typeof w.focusable>"u"),$=rt(),F=fx(w),E=pR({node:w,nodeType:A,hasDimensions:F,resizeObserver:g}),P=h0({nodeRef:E,disabled:w.hidden||!B,noDragClassName:h,handleSelector:w.dragHandle,nodeId:e,isSelectable:U,nodeClickDistance:S}),L=g0();if(w.hidden)return null;const j=rr(w),O=oR(w),W=U||B||t||n||r||i,z=n?te=>n(te,{...I.userNode}):void 0,Y=r?te=>r(te,{...I.userNode}):void 0,J=i?te=>i(te,{...I.userNode}):void 0,ie=s?te=>s(te,{...I.userNode}):void 0,ee=a?te=>a(te,{...I.userNode}):void 0,ce=te=>{const{selectNodesOnDrag:ne,nodeDragThreshold:oe}=$.getState();U&&(!ne||!B||oe>0)&&nf({id:e,store:$,nodeRef:E}),t&&t(te,{...I.userNode})},ge=te=>{if(!(mx(te.nativeEvent)||x)){if(Jv.includes(te.key)&&U){const ne=te.key==="Escape";nf({id:e,store:$,unselect:ne,nodeRef:E})}else if(B&&w.selected&&Object.prototype.hasOwnProperty.call(Ac,te.key)){te.preventDefault();const{ariaLabelConfig:ne}=$.getState();$.setState({ariaLiveMessage:ne["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~I.positionAbsolute.x,y:~~I.positionAbsolute.y})}),L({direction:Ac[te.key],factor:te.shiftKey?4:1})}}},Q=()=>{if(x||!E.current?.matches(":focus-visible"))return;const{transform:te,width:ne,height:oe,autoPanOnNodeFocus:pe,setCenter:le}=$.getState();if(!pe)return;jd(new Map([[e,w]]),{x:0,y:0,width:ne,height:oe},te,!0).length>0||le(w.position.x+j.width/2,w.position.y+j.height/2,{zoom:te[2]})};return y.jsx("div",{className:yt(["react-flow__node",`react-flow__node-${A}`,{[m]:B},w.className,{selected:w.selected,selectable:U,parent:k,draggable:B,dragging:P}]),ref:E,style:{zIndex:I.z,transform:`translate(${I.positionAbsolute.x}px,${I.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:F?"visible":"hidden",...w.style,...O},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:z,onMouseMove:Y,onMouseLeave:J,onContextMenu:ie,onClick:ce,onDoubleClick:ee,onKeyDown:D?ge:void 0,tabIndex:D?0:void 0,onFocus:D?Q:void 0,role:w.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${Kx}-${v}`,"aria-label":w.ariaLabel,...w.domAttributes,children:y.jsx(KP,{value:e,children:y.jsx(M,{id:e,data:w.data,type:A,positionAbsoluteX:I.positionAbsolute.x,positionAbsoluteY:I.positionAbsolute.y,selected:w.selected??!1,selectable:U,draggable:B,deletable:w.deletable??!0,isConnectable:q,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:P,dragHandle:w.dragHandle,zIndex:I.z,parentId:w.parentId,...j})})})}const gR=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function x0(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Fe(gR,ct),a=uR(e.onlyRenderVisibleElements),l=fR();return y.jsx("div",{className:"react-flow__nodes",style:Cc,children:a.map(u=>y.jsx(hR,{id:u,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},u))})}x0.displayName="NodeRenderer";const mR=T.memo(x0);function yR(e){return Fe(T.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);s&&a&&vO({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),ct)}const vR=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return y.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},xR=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return y.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},w0={[hc.Arrow]:vR,[hc.ArrowClosed]:xR};function wR(e){const t=rt();return T.useMemo(()=>Object.prototype.hasOwnProperty.call(w0,e)?w0[e]:(t.getState().onError?.("009",jt.error009(e)),null),[e])}const bR=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const u=wR(t);return u?y.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:y.jsx(u,{color:n,strokeWidth:a})}):null},b0=({defaultColor:e,rfId:t})=>{const n=Fe(s=>s.edges),r=Fe(s=>s.defaultEdgeOptions),i=T.useMemo(()=>IO(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?y.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:y.jsx("defs",{children:i.map(s=>y.jsx(bR,{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};b0.displayName="MarkerDefinitions";var SR=T.memo(b0);function S0({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:u,className:d,...f}){const[g,h]=T.useState({x:1,y:0,width:0,height:0}),m=yt(["react-flow__edge-textwrapper",d]),x=T.useRef(null);return T.useEffect(()=>{if(x.current){const v=x.current.getBBox();h({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?y.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...f,children:[i&&y.jsx("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),y.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:x,style:r,children:n}),u]}):null}S0.displayName="EdgeText";const _R=T.memo(S0);function Jo({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:d=20,...f}){return y.jsxs(y.Fragment,{children:[y.jsx("path",{...f,d:e,fill:"none",className:yt(["react-flow__edge-path",f.className])}),d?y.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Nn(t)&&Nn(n)?y.jsx(_R,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function _0({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Ne.Left||e===Ne.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function N0({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:s=Ne.Top}){const[a,l]=_0({pos:n,x1:e,y1:t,x2:r,y2:i}),[u,d]=_0({pos:s,x1:r,y1:i,x2:e,y2:t}),[f,g,h,m]=xx({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${l} ${u},${d} ${r},${i}`,f,g,h,m]}function I0(e){return T.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:S})=>{const[N,w,I]=N0({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),k=e.isInternal?void 0:t;return y.jsx(Jo,{id:k,path:N,labelX:w,labelY:I,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:S})})}const NR=I0({isInternal:!1}),E0=I0({isInternal:!0});NR.displayName="SimpleBezierEdge",E0.displayName="SimpleBezierEdgeInternal";function T0(e){return T.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:h,sourcePosition:m=Ne.Bottom,targetPosition:x=Ne.Top,markerEnd:v,markerStart:b,pathOptions:S,interactionWidth:N})=>{const[w,I,k]=Fd({sourceX:n,sourceY:r,sourcePosition:m,targetX:i,targetY:s,targetPosition:x,borderRadius:S?.borderRadius,offset:S?.offset,stepPosition:S?.stepPosition}),A=e.isInternal?void 0:t;return y.jsx(Jo,{id:A,path:w,labelX:I,labelY:k,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:v,markerStart:b,interactionWidth:N})})}const C0=T0({isInternal:!1}),A0=T0({isInternal:!0});C0.displayName="SmoothStepEdge",A0.displayName="SmoothStepEdgeInternal";function k0(e){return T.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return y.jsx(C0,{...n,id:r,pathOptions:T.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const IR=k0({isInternal:!1}),M0=k0({isInternal:!0});IR.displayName="StepEdge",M0.displayName="StepEdgeInternal";function O0(e){return T.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:x,interactionWidth:v})=>{const[b,S,N]=_x({sourceX:n,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:t;return y.jsx(Jo,{id:w,path:b,labelX:S,labelY:N,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:x,interactionWidth:v})})}const ER=O0({isInternal:!1}),P0=O0({isInternal:!0});ER.displayName="StraightEdge",P0.displayName="StraightEdgeInternal";function R0(e){return T.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=Ne.Bottom,targetPosition:l=Ne.Top,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,pathOptions:S,interactionWidth:N})=>{const[w,I,k]=bc({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:S?.curvature}),A=e.isInternal?void 0:t;return y.jsx(Jo,{id:A,path:w,labelX:I,labelY:k,label:u,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:h,labelBgBorderRadius:m,style:x,markerEnd:v,markerStart:b,interactionWidth:N})})}const TR=R0({isInternal:!1}),L0=R0({isInternal:!0});TR.displayName="BezierEdge",L0.displayName="BezierEdgeInternal";const D0={default:L0,straight:P0,step:M0,smoothstep:A0,simplebezier:E0},j0={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},CR=(e,t,n)=>n===Ne.Left?e-t:n===Ne.Right?e+t:e,AR=(e,t,n)=>n===Ne.Top?e-t:n===Ne.Bottom?e+t:e,$0="react-flow__edgeupdater";function H0({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return y.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:yt([$0,`${$0}-${l}`]),cx:CR(t,r,e),cy:AR(n,r,e),r,stroke:"transparent",fill:"transparent"})}function kR({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,setReconnecting:h,setUpdateHover:m}){const x=rt(),v=(I,k)=>{if(I.button!==0)return;const{autoPanOnConnect:A,domNode:M,isValidConnection:B,connectionMode:U,connectionRadius:q,lib:D,onConnectStart:$,onConnectEnd:F,cancelConnection:E,nodeLookup:P,rfId:L,panBy:j,updateConnection:O}=x.getState(),W=k.type==="target",z=(ie,ee)=>{h(!1),g?.(ie,n,k.type,ee)},Y=ie=>d?.(n,ie),J=(ie,ee)=>{h(!0),f?.(I,n,k.type),$?.(ie,ee)};Kd.onPointerDown(I.nativeEvent,{autoPanOnConnect:A,connectionMode:U,connectionRadius:q,domNode:M,handleId:k.id,nodeId:k.nodeId,nodeLookup:P,isTarget:W,edgeUpdaterType:k.type,lib:D,flowId:L,cancelConnection:E,panBy:j,isValidConnection:B,onConnect:Y,onConnectStart:J,onConnectEnd:F,onReconnectEnd:z,updateConnection:O,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:I.currentTarget})},b=I=>v(I,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=I=>v(I,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>m(!0),w=()=>m(!1);return y.jsxs(y.Fragment,{children:[(e===!0||e==="source")&&y.jsx(H0,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&y.jsx(H0,{position:u,centerX:s,centerY:a,radius:t,onMouseDown:S,onMouseEnter:N,onMouseOut:w,type:"target"})]})}function MR({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,reconnectRadius:f,onReconnect:g,onReconnectStart:h,onReconnectEnd:m,rfId:x,edgeTypes:v,noPanClassName:b,onError:S,disableKeyboardA11y:N}){let w=Fe(le=>le.edgeLookup.get(e));const I=Fe(le=>le.defaultEdgeOptions);w=I?{...I,...w}:w;let k=w.type||"default",A=v?.[k]||D0[k];A===void 0&&(S?.("011",jt.error011(k)),k="default",A=v?.default||D0.default);const M=!!(w.focusable||t&&typeof w.focusable>"u"),B=typeof g<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),U=!!(w.selectable||r&&typeof w.selectable>"u"),q=T.useRef(null),[D,$]=T.useState(!1),[F,E]=T.useState(!1),P=rt(),{zIndex:L,sourceX:j,sourceY:O,targetX:W,targetY:z,sourcePosition:Y,targetPosition:J}=Fe(T.useCallback(le=>{const ve=le.nodeLookup.get(w.source),me=le.nodeLookup.get(w.target);if(!ve||!me)return{zIndex:w.zIndex,...j0};const Oe=NO({id:e,sourceNode:ve,targetNode:me,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:le.connectionMode,onError:S});return{zIndex:yO({selected:w.selected,zIndex:w.zIndex,sourceNode:ve,targetNode:me,elevateOnSelect:le.elevateEdgesOnSelect}),...Oe||j0}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),ct),ie=T.useMemo(()=>w.markerStart?`url('#${zd(w.markerStart,x)}')`:void 0,[w.markerStart,x]),ee=T.useMemo(()=>w.markerEnd?`url('#${zd(w.markerEnd,x)}')`:void 0,[w.markerEnd,x]);if(w.hidden||j===null||O===null||W===null||z===null)return null;const ce=le=>{const{addSelectedEdges:ve,unselectNodesAndEdges:me,multiSelectionActive:Oe}=P.getState();U&&(P.setState({nodesSelectionActive:!1}),w.selected&&Oe?(me({nodes:[],edges:[w]}),q.current?.blur()):ve([e])),i&&i(le,w)},ge=s?le=>{s(le,{...w})}:void 0,Q=a?le=>{a(le,{...w})}:void 0,te=l?le=>{l(le,{...w})}:void 0,ne=u?le=>{u(le,{...w})}:void 0,oe=d?le=>{d(le,{...w})}:void 0,pe=le=>{if(!N&&Jv.includes(le.key)&&U){const{unselectNodesAndEdges:ve,addSelectedEdges:me}=P.getState();le.key==="Escape"?(q.current?.blur(),ve({edges:[w]})):me([e])}};return y.jsx("svg",{style:{zIndex:L},children:y.jsxs("g",{className:yt(["react-flow__edge",`react-flow__edge-${k}`,w.className,b,{selected:w.selected,animated:w.animated,inactive:!U&&!i,updating:D,selectable:U}]),onClick:ce,onDoubleClick:ge,onContextMenu:Q,onMouseEnter:te,onMouseMove:ne,onMouseLeave:oe,onKeyDown:M?pe:void 0,tabIndex:M?0:void 0,role:w.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":M?`${Zx}-${x}`:void 0,ref:q,...w.domAttributes,children:[!F&&y.jsx(A,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:U,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:j,sourceY:O,targetX:W,targetY:z,sourcePosition:Y,targetPosition:J,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:ie,markerEnd:ee,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),B&&y.jsx(kR,{edge:w,isReconnectable:B,reconnectRadius:f,onReconnect:g,onReconnectStart:h,onReconnectEnd:m,sourceX:j,sourceY:O,targetX:W,targetY:z,sourcePosition:Y,targetPosition:J,setUpdateHover:$,setReconnecting:E})]})})}const OR=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function B0({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:g,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:x,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:S,elementsSelectable:N,onError:w}=Fe(OR,ct),I=yR(t);return y.jsxs("div",{className:"react-flow__edges",children:[y.jsx(SR,{defaultColor:e,rfId:n}),I.map(k=>y.jsx(MR,{id:k,edgesFocusable:b,edgesReconnectable:S,elementsSelectable:N,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:f,reconnectRadius:g,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:x,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:v},k))]})}B0.displayName="EdgeRenderer";const PR=T.memo(B0),RR=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function LR({children:e}){const t=Fe(RR);return y.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function DR(e){const t=Zo(),n=T.useRef(!1);T.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const jR=e=>e.panZoom?.syncViewport;function $R(e){const t=Fe(jR),n=rt();return T.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function HR(e){return e.connection.inProgress?{...e.connection,to:os(e.connection.to,e.transform)}:{...e.connection}}function BR(e){return HR}function V0(e){const t=BR();return Fe(t,ct)}const VR=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FR({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:u}=Fe(VR,ct);return!(s&&i&&u)?null:y.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:y.jsx("g",{className:yt(["react-flow__connection",rx(l)]),children:y.jsx(F0,{style:t,type:n,CustomComponent:r,isValid:l})})})}const F0=({style:e,type:t=_r.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:u,to:d,toNode:f,toHandle:g,toPosition:h}=V0();if(!i)return;if(n)return y.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:h,connectionStatus:rx(r),toNode:f,toHandle:g});let m="";const x={sourceX:s.x,sourceY:s.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case _r.Bezier:[m]=bc(x);break;case _r.SimpleBezier:[m]=N0(x);break;case _r.Step:[m]=Fd({...x,borderRadius:0});break;case _r.SmoothStep:[m]=Fd(x);break;default:[m]=_x(x)}return y.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};F0.displayName="ConnectionLine";const zR={};function z0(e=zR){const t=T.useRef(e),n=rt();T.useEffect(()=>{if(process.env.NODE_ENV==="development"){const r=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const i of r)if(t.current[i]!==e[i]){n.getState().onError?.("002",jt.error002());break}t.current=e}},[e])}function UR(){const e=rt(),t=T.useRef(!1);T.useEffect(()=>{if(process.env.NODE_ENV==="development"&&!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",jt.error013("react")),t.current=!0}},[])}function U0({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:g,onSelectionStart:h,onSelectionEnd:m,connectionLineType:x,connectionLineStyle:v,connectionLineComponent:b,connectionLineContainerStyle:S,selectionKeyCode:N,selectionOnDrag:w,selectionMode:I,multiSelectionKeyCode:k,panActivationKeyCode:A,zoomActivationKeyCode:M,deleteKeyCode:B,onlyRenderVisibleElements:U,elementsSelectable:q,defaultViewport:D,translateExtent:$,minZoom:F,maxZoom:E,preventScrolling:P,defaultMarkerColor:L,zoomOnScroll:j,zoomOnPinch:O,panOnScroll:W,panOnScrollSpeed:z,panOnScrollMode:Y,zoomOnDoubleClick:J,panOnDrag:ie,onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:ge,onPaneMouseLeave:Q,onPaneScroll:te,onPaneContextMenu:ne,paneClickDistance:oe,nodeClickDistance:pe,onEdgeContextMenu:le,onEdgeMouseEnter:ve,onEdgeMouseMove:me,onEdgeMouseLeave:Oe,reconnectRadius:Ce,onReconnect:ae,onReconnectStart:Ie,onReconnectEnd:Be,noDragClassName:Qe,noWheelClassName:Ue,noPanClassName:Ze,disableKeyboardA11y:pt,nodeExtent:Cn,rfId:cn,viewport:Nt,onViewportChange:$t}){return z0(e),z0(t),UR(),DR(n),$R(Nt),y.jsx(cR,{onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:ge,onPaneMouseLeave:Q,onPaneContextMenu:ne,onPaneScroll:te,paneClickDistance:oe,deleteKeyCode:B,selectionKeyCode:N,selectionOnDrag:w,selectionMode:I,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:k,panActivationKeyCode:A,zoomActivationKeyCode:M,elementsSelectable:q,zoomOnScroll:j,zoomOnPinch:O,zoomOnDoubleClick:J,panOnScroll:W,panOnScrollSpeed:z,panOnScrollMode:Y,panOnDrag:ie,defaultViewport:D,translateExtent:$,minZoom:F,maxZoom:E,onSelectionContextMenu:g,preventScrolling:P,noDragClassName:Qe,noWheelClassName:Ue,noPanClassName:Ze,disableKeyboardA11y:pt,onViewportChange:$t,isControlledViewport:!!Nt,children:y.jsxs(LR,{children:[y.jsx(PR,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ae,onReconnectStart:Ie,onReconnectEnd:Be,onlyRenderVisibleElements:U,onEdgeContextMenu:le,onEdgeMouseEnter:ve,onEdgeMouseMove:me,onEdgeMouseLeave:Oe,reconnectRadius:Ce,defaultMarkerColor:L,noPanClassName:Ze,disableKeyboardA11y:pt,rfId:cn}),y.jsx(FR,{style:v,type:x,component:b,containerStyle:S}),y.jsx("div",{className:"react-flow__edgelabel-renderer"}),y.jsx(mR,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:pe,onlyRenderVisibleElements:U,noPanClassName:Ze,noDragClassName:Qe,disableKeyboardA11y:pt,nodeExtent:Cn,rfId:cn}),y.jsx("div",{className:"react-flow__viewport-portal"})]})})}U0.displayName="GraphView";const WR=T.memo(U0),W0=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:u=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:g}={})=>{const h=new Map,m=new Map,x=new Map,v=new Map,b=r??t??[],S=n??e??[],N=f??[0,0],w=g??Ji;Mx(x,v,b);const I=Gd(S,h,m,{nodeOrigin:N,nodeExtent:w,elevateNodesOnSelect:!1});let k=[0,0,1];if(a&&i&&s){const A=ts(h,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:M,y:B,zoom:U}=Bd(A,i,s,u,d,l?.padding??.1);k=[M,B,U]}return{rfId:"1",width:0,height:0,transform:k,nodes:S,nodesInitialized:I,nodeLookup:h,parentLookup:m,edges:b,edgeLookup:v,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:d,translateExtent:Ji,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:zo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,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:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...ex},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:dx,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Qv}},GR=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:g})=>hP((h,m)=>{async function x(){const{nodeLookup:v,panZoom:b,fitViewOptions:S,fitViewResolver:N,width:w,height:I,minZoom:k,maxZoom:A}=m();b&&(await uO({nodes:v,width:w,height:I,panZoom:b,minZoom:k,maxZoom:A},S),N?.resolve(!0),h({fitViewResolver:null}))}return{...W0({nodes:e,edges:t,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:g,defaultNodes:n,defaultEdges:r}),setNodes:v=>{const{nodeLookup:b,parentLookup:S,nodeOrigin:N,elevateNodesOnSelect:w,fitViewQueued:I}=m(),k=Gd(v,b,S,{nodeOrigin:N,nodeExtent:g,elevateNodesOnSelect:w,checkEquality:!0});I&&k?(x(),h({nodes:v,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:v,nodesInitialized:k})},setEdges:v=>{const{connectionLookup:b,edgeLookup:S}=m();Mx(b,S,v),h({edges:v})},setDefaultNodesAndEdges:(v,b)=>{if(v){const{setNodes:S}=m();S(v),h({hasDefaultNodes:!0})}if(b){const{setEdges:S}=m();S(b),h({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:b,nodeLookup:S,parentLookup:N,domNode:w,nodeOrigin:I,nodeExtent:k,debug:A,fitViewQueued:M}=m(),{changes:B,updatedInternals:U}=kO(v,S,N,w,I,k);U&&(TO(S,N,{nodeOrigin:I,nodeExtent:k}),M?(x(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),B?.length>0&&(A&&console.log("React Flow: trigger node changes",B),b?.(B)))},updateNodePositions:(v,b=!1)=>{const S=[],N=[],{nodeLookup:w,triggerNodeChanges:I}=m();for(const[k,A]of v){const M=w.get(k),B=!!(M?.expandParent&&M?.parentId&&A?.position),U={id:k,type:"position",position:B?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:b};B&&M.parentId&&S.push({id:k,parentId:M.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),N.push(U)}if(S.length>0){const{parentLookup:k,nodeOrigin:A}=m(),M=Yd(S,w,k,A);N.push(...M)}I(N)},triggerNodeChanges:v=>{const{onNodesChange:b,setNodes:S,nodes:N,hasDefaultNodes:w,debug:I}=m();if(v?.length){if(w){const k=s0(v,N);S(k)}I&&console.log("React Flow: trigger node changes",v),b?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:b,setEdges:S,edges:N,hasDefaultEdges:w,debug:I}=m();if(v?.length){if(w){const k=ls(v,N);S(k)}I&&console.log("React Flow: trigger edge changes",v),b?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:b,edgeLookup:S,nodeLookup:N,triggerNodeChanges:w,triggerEdgeChanges:I}=m();if(b){const k=v.map(A=>io(A,!0));w(k);return}w(Ko(N,new Set([...v]),!0)),I(Ko(S))},addSelectedEdges:v=>{const{multiSelectionActive:b,edgeLookup:S,nodeLookup:N,triggerNodeChanges:w,triggerEdgeChanges:I}=m();if(b){const k=v.map(A=>io(A,!0));I(k);return}I(Ko(S,new Set([...v]))),w(Ko(N,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:b}={})=>{const{edges:S,nodes:N,nodeLookup:w,triggerNodeChanges:I,triggerEdgeChanges:k}=m(),A=v||N,M=b||S,B=A.map(q=>{const D=w.get(q.id);return D&&(D.selected=!1),io(q.id,!1)}),U=M.map(q=>io(q.id,!1));I(B),k(U)},setMinZoom:v=>{const{panZoom:b,maxZoom:S}=m();b?.setScaleExtent([v,S]),h({minZoom:v})},setMaxZoom:v=>{const{panZoom:b,minZoom:S}=m();b?.setScaleExtent([S,v]),h({maxZoom:v})},setTranslateExtent:v=>{m().panZoom?.setTranslateExtent(v),h({translateExtent:v})},setPaneClickDistance:v=>{m().panZoom?.setClickDistance(v)},resetSelectedElements:()=>{const{edges:v,nodes:b,triggerNodeChanges:S,triggerEdgeChanges:N,elementsSelectable:w}=m();if(!w)return;const I=b.reduce((A,M)=>M.selected?[...A,io(M.id,!1)]:A,[]),k=v.reduce((A,M)=>M.selected?[...A,io(M.id,!1)]:A,[]);S(I),N(k)},setNodeExtent:v=>{const{nodes:b,nodeLookup:S,parentLookup:N,nodeOrigin:w,elevateNodesOnSelect:I,nodeExtent:k}=m();v[0][0]===k[0][0]&&v[0][1]===k[0][1]&&v[1][0]===k[1][0]&&v[1][1]===k[1][1]||(Gd(b,S,N,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:I,checkEquality:!1}),h({nodeExtent:v}))},panBy:v=>{const{transform:b,width:S,height:N,panZoom:w,translateExtent:I}=m();return MO({delta:v,panZoom:w,transform:b,translateExtent:I,width:S,height:N})},setCenter:async(v,b,S)=>{const{width:N,height:w,maxZoom:I,panZoom:k}=m();if(!k)return Promise.resolve(!1);const A=typeof S?.zoom<"u"?S.zoom:I;return await k.setViewport({x:N/2-v*A,y:w/2-b*A,zoom:A},{duration:S?.duration,ease:S?.ease,interpolate:S?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...ex}})},updateConnection:v=>{h({connection:v})},reset:()=>h({...W0()})}},Object.is);function G0({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:g,children:h}){const[m]=T.useState(()=>GR({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:u,nodeOrigin:f,nodeExtent:g}));return y.jsx(gP,{value:m,children:y.jsx(jP,{children:h})})}function qR({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:g,nodeExtent:h}){return T.useContext(Ic)?y.jsx(y.Fragment,{children:e}):y.jsx(G0,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:g,nodeExtent:h,children:e})}const YR={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function XR({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:u,onInit:d,onMove:f,onMoveStart:g,onMoveEnd:h,onConnect:m,onConnectStart:x,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:I,onNodeContextMenu:k,onNodeDoubleClick:A,onNodeDragStart:M,onNodeDrag:B,onNodeDragStop:U,onNodesDelete:q,onEdgesDelete:D,onDelete:$,onSelectionChange:F,onSelectionDragStart:E,onSelectionDrag:P,onSelectionDragStop:L,onSelectionContextMenu:j,onSelectionStart:O,onSelectionEnd:W,onBeforeDelete:z,connectionMode:Y,connectionLineType:J=_r.Bezier,connectionLineStyle:ie,connectionLineComponent:ee,connectionLineContainerStyle:ce,deleteKeyCode:ge="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:te=!1,selectionMode:ne=Uo.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:pe=is()?"Meta":"Control",zoomActivationKeyCode:le=is()?"Meta":"Control",snapToGrid:ve,snapGrid:me,onlyRenderVisibleElements:Oe=!1,selectNodesOnDrag:Ce,nodesDraggable:ae,autoPanOnNodeFocus:Ie,nodesConnectable:Be,nodesFocusable:Qe,nodeOrigin:Ue=Jx,edgesFocusable:Ze,edgesReconnectable:pt,elementsSelectable:Cn=!0,defaultViewport:cn=CP,minZoom:Nt=.5,maxZoom:$t=2,translateExtent:ln=Ji,preventScrolling:Or=!0,nodeExtent:Un,defaultMarkerColor:fo="#b1b1b7",zoomOnScroll:po=!0,zoomOnPinch:Pr=!0,panOnScroll:Ps=!1,panOnScrollSpeed:Rs=.5,panOnScrollMode:Ls=no.Free,zoomOnDoubleClick:Ds=!0,panOnDrag:op=!0,onPaneClick:ip,onPaneMouseEnter:sp,onPaneMouseMove:rl,onPaneMouseLeave:ol,onPaneScroll:ap,onPaneContextMenu:cp,paneClickDistance:il=0,nodeClickDistance:lp=0,children:sl,onReconnect:up,onReconnectStart:dp,onReconnectEnd:fp,onEdgeContextMenu:js,onEdgeDoubleClick:pp,onEdgeMouseEnter:$s,onEdgeMouseMove:hp,onEdgeMouseLeave:gp,reconnectRadius:mp=10,onNodesChange:yp,onEdgesChange:vp,noDragClassName:xp="nodrag",noWheelClassName:wp="nowheel",noPanClassName:al="nopan",fitView:Hs,fitViewOptions:cl,connectOnClick:bp,attributionPosition:Sp,proOptions:_p,defaultEdgeOptions:Np,elevateNodesOnSelect:Ip,elevateEdgesOnSelect:si,disableKeyboardA11y:ll=!1,autoPanOnConnect:ai,autoPanOnNodeDrag:Ep,autoPanSpeed:Tp,connectionRadius:Cp,isValidConnection:ul,onError:dl,style:fl,id:pl,nodeDragThreshold:Ap,connectionDragThreshold:kp,viewport:Mp,onViewportChange:hl,width:gl,height:ml,colorMode:Bs="light",debug:Op,onScroll:Vs,ariaLabelConfig:ci,...yl},Pp){const li=pl||"1",vl=MP(Bs),Fs=T.useCallback(xl=>{xl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Vs?.(xl)},[Vs]);return y.jsx("div",{"data-testid":"rf__wrapper",...yl,onScroll:Fs,style:{...fl,...YR},ref:Pp,className:yt(["react-flow",i,vl]),id:pl,role:"application",children:y.jsxs(qR,{nodes:e,edges:t,width:gl,height:ml,fitView:Hs,fitViewOptions:cl,minZoom:Nt,maxZoom:$t,nodeOrigin:Ue,nodeExtent:Un,children:[y.jsx(WR,{onInit:d,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:I,onNodeContextMenu:k,onNodeDoubleClick:A,nodeTypes:s,edgeTypes:a,connectionLineType:J,connectionLineStyle:ie,connectionLineComponent:ee,connectionLineContainerStyle:ce,selectionKeyCode:Q,selectionOnDrag:te,selectionMode:ne,deleteKeyCode:ge,multiSelectionKeyCode:pe,panActivationKeyCode:oe,zoomActivationKeyCode:le,onlyRenderVisibleElements:Oe,defaultViewport:cn,translateExtent:ln,minZoom:Nt,maxZoom:$t,preventScrolling:Or,zoomOnScroll:po,zoomOnPinch:Pr,zoomOnDoubleClick:Ds,panOnScroll:Ps,panOnScrollSpeed:Rs,panOnScrollMode:Ls,panOnDrag:op,onPaneClick:ip,onPaneMouseEnter:sp,onPaneMouseMove:rl,onPaneMouseLeave:ol,onPaneScroll:ap,onPaneContextMenu:cp,paneClickDistance:il,nodeClickDistance:lp,onSelectionContextMenu:j,onSelectionStart:O,onSelectionEnd:W,onReconnect:up,onReconnectStart:dp,onReconnectEnd:fp,onEdgeContextMenu:js,onEdgeDoubleClick:pp,onEdgeMouseEnter:$s,onEdgeMouseMove:hp,onEdgeMouseLeave:gp,reconnectRadius:mp,defaultMarkerColor:fo,noDragClassName:xp,noWheelClassName:wp,noPanClassName:al,rfId:li,disableKeyboardA11y:ll,nodeExtent:Un,viewport:Mp,onViewportChange:hl}),y.jsx(kP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:x,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:ae,autoPanOnNodeFocus:Ie,nodesConnectable:Be,nodesFocusable:Qe,edgesFocusable:Ze,edgesReconnectable:pt,elementsSelectable:Cn,elevateNodesOnSelect:Ip,elevateEdgesOnSelect:si,minZoom:Nt,maxZoom:$t,nodeExtent:Un,onNodesChange:yp,onEdgesChange:vp,snapToGrid:ve,snapGrid:me,connectionMode:Y,translateExtent:ln,connectOnClick:bp,defaultEdgeOptions:Np,fitView:Hs,fitViewOptions:cl,onNodesDelete:q,onEdgesDelete:D,onDelete:$,onNodeDragStart:M,onNodeDrag:B,onNodeDragStop:U,onSelectionDrag:P,onSelectionDragStart:E,onSelectionDragStop:L,onMove:f,onMoveStart:g,onMoveEnd:h,noPanClassName:al,nodeOrigin:Ue,rfId:li,autoPanOnConnect:ai,autoPanOnNodeDrag:Ep,autoPanSpeed:Tp,onError:dl,connectionRadius:Cp,isValidConnection:ul,selectNodesOnDrag:Ce,nodeDragThreshold:Ap,connectionDragThreshold:kp,onBeforeDelete:z,paneClickDistance:il,debug:Op,ariaLabelConfig:ci}),y.jsx(TP,{onSelectionChange:F}),sl,y.jsx(SP,{proOptions:_p,position:Sp}),y.jsx(bP,{rfId:li,disableKeyboardA11y:ll})]})})}var KR=u0(XR);const ZR=jt.error014();function q0({id:e,handleType:t,handleId:n,onConnect:r,onDisconnect:i}={}){const s=us(),a=e??s;if(!a)throw new Error(ZR);const l=T.useRef(null),u=Fe(d=>d.connectionLookup.get(`${a}${t?n?`-${t}-${n}`:`-${t}`:""}`),sO);return T.useEffect(()=>{if(l.current&&l.current!==u){const d=u??new Map;nx(l.current,d,i),nx(d,l.current,r)}l.current=u??new Map},[u,r,i]),T.useMemo(()=>Array.from(u?.values()??[]),[u])}function of(e){return Fe(T.useCallback(n=>{const r=[],i=Array.isArray(e),s=i?e:[e];for(const a of s){const l=n.nodeLookup.get(a);l&&r.push({id:l.id,type:l.type,data:l.data})}return i?r:r[0]??null},[e]),OO)}function JR({dimensions:e,lineWidth:t,variant:n,className:r}){return y.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:yt(["react-flow__background-pattern",n,r])})}function QR({radius:e,className:t}){return y.jsx("circle",{cx:e,cy:e,r:e,className:yt(["react-flow__background-pattern","dots",t])})}var Er;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Er||(Er={}));const eL={[Er.Dots]:1,[Er.Lines]:1,[Er.Cross]:6},tL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Y0({id:e,variant:t=Er.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:u,className:d,patternClassName:f}){const g=T.useRef(null),{transform:h,patternId:m}=Fe(tL,ct),x=r||eL[t],v=t===Er.Dots,b=t===Er.Cross,S=Array.isArray(n)?n:[n,n],N=[S[0]*h[2]||1,S[1]*h[2]||1],w=x*h[2],I=Array.isArray(s)?s:[s,s],k=b?[w,w]:N,A=[I[0]*h[2]||1+k[0]/2,I[1]*h[2]||1+k[1]/2],M=`${m}${e||""}`;return y.jsxs("svg",{className:yt(["react-flow__background",d]),style:{...u,...Cc,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:g,"data-testid":"rf__background",children:[y.jsx("pattern",{id:M,x:h[0]%N[0],y:h[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:v?y.jsx(QR,{radius:w/2,className:f}):y.jsx(JR,{dimensions:k,lineWidth:i,variant:t,className:f})}),y.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}Y0.displayName="Background";const nL=T.memo(Y0);function rL(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:y.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function oL(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:y.jsx("path",{d:"M0 0h32v4.2H0z"})})}function iL(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:y.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 sL(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:y.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 aL(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:y.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 kc({children:e,className:t,...n}){return y.jsx("button",{type:"button",className:yt(["react-flow__controls-button",t]),...n,children:e})}const cL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function X0({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:u,className:d,children:f,position:g="bottom-left",orientation:h="vertical","aria-label":m}){const x=rt(),{isInteractive:v,minZoomReached:b,maxZoomReached:S,ariaLabelConfig:N}=Fe(cL,ct),{zoomIn:w,zoomOut:I,fitView:k}=Zo(),A=()=>{w(),s?.()},M=()=>{I(),a?.()},B=()=>{k(i),l?.()},U=()=>{x.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u?.(!v)},q=h==="horizontal"?"horizontal":"vertical";return y.jsxs(Ec,{className:yt(["react-flow__controls",q,d]),position:g,style:e,"data-testid":"rf__controls","aria-label":m??N["controls.ariaLabel"],children:[t&&y.jsxs(y.Fragment,{children:[y.jsx(kc,{onClick:A,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:S,children:y.jsx(rL,{})}),y.jsx(kc,{onClick:M,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:b,children:y.jsx(oL,{})})]}),n&&y.jsx(kc,{className:"react-flow__controls-fitview",onClick:B,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:y.jsx(iL,{})}),r&&y.jsx(kc,{className:"react-flow__controls-interactive",onClick:U,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:v?y.jsx(aL,{}):y.jsx(sL,{})}),f]})}X0.displayName="Controls";const lL=T.memo(X0);function uL({id:e,x:t,y:n,width:r,height:i,style:s,color:a,strokeColor:l,strokeWidth:u,className:d,borderRadius:f,shapeRendering:g,selected:h,onClick:m}){const{background:x,backgroundColor:v}=s||{},b=a||x||v;return y.jsx("rect",{className:yt(["react-flow__minimap-node",{selected:h},d]),x:t,y:n,rx:f,ry:f,width:r,height:i,style:{fill:b,stroke:l,strokeWidth:u},shapeRendering:g,onClick:m?S=>m(S,e):void 0})}const dL=T.memo(uL),fL=e=>e.nodes.map(t=>t.id),sf=e=>e instanceof Function?e:()=>e;function pL({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=dL,onClick:a}){const l=Fe(fL,ct),u=sf(t),d=sf(e),f=sf(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return y.jsx(y.Fragment,{children:l.map(h=>y.jsx(gL,{id:h,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:g},h))})}function hL({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:u}){const{node:d,x:f,y:g,width:h,height:m}=Fe(x=>{const{internals:v}=x.nodeLookup.get(e),b=v.userNode,{x:S,y:N}=v.positionAbsolute,{width:w,height:I}=rr(b);return{node:b,x:S,y:N,width:w,height:I}},ct);return!d||d.hidden||!fx(d)?null:y.jsx(l,{x:f,y:g,width:h,height:m,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:i,strokeColor:n(d),strokeWidth:s,shapeRendering:a,onClick:u,id:d.id})}const gL=T.memo(hL);var mL=T.memo(pL);const yL=200,vL=150,xL=e=>!e.hidden,wL=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?lx(ts(e.nodeLookup,{filter:xL}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bL="react-flow__minimap-desc";function K0({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:u,maskColor:d,maskStrokeColor:f,maskStrokeWidth:g,position:h="bottom-right",onClick:m,onNodeClick:x,pannable:v=!1,zoomable:b=!1,ariaLabel:S,inversePan:N,zoomStep:w=1,offsetScale:I=5}){const k=rt(),A=T.useRef(null),{boundingRect:M,viewBB:B,rfId:U,panZoom:q,translateExtent:D,flowWidth:$,flowHeight:F,ariaLabelConfig:E}=Fe(wL,ct),P=e?.width??yL,L=e?.height??vL,j=M.width/P,O=M.height/L,W=Math.max(j,O),z=W*P,Y=W*L,J=I*W,ie=M.x-(z-M.width)/2-J,ee=M.y-(Y-M.height)/2-J,ce=z+J*2,ge=Y+J*2,Q=`${bL}-${U}`,te=T.useRef(0),ne=T.useRef();te.current=W,T.useEffect(()=>{if(A.current&&q)return ne.current=VO({domNode:A.current,panZoom:q,getTransform:()=>k.getState().transform,getViewScale:()=>te.current}),()=>{ne.current?.destroy()}},[q]),T.useEffect(()=>{ne.current?.update({translateExtent:D,width:$,height:F,inversePan:N,pannable:v,zoomStep:w,zoomable:b})},[v,b,N,w,D,$,F]);const oe=m?ve=>{const[me,Oe]=ne.current?.pointer(ve)||[0,0];m(ve,{x:me,y:Oe})}:void 0,pe=x?T.useCallback((ve,me)=>{const Oe=k.getState().nodeLookup.get(me).internals.userNode;x(ve,Oe)},[]):void 0,le=S??E["minimap.ariaLabel"];return y.jsx(Ec,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*W:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:yt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:y.jsxs("svg",{width:P,height:L,viewBox:`${ie} ${ee} ${ce} ${ge}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:A,onClick:oe,children:[le&&y.jsx("title",{id:Q,children:le}),y.jsx(mL,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),y.jsx("path",{className:"react-flow__minimap-mask",d:`M${ie-J},${ee-J}h${ce+J*2}v${ge+J*2}h${-ce-J*2}z
270
+ M${B.x},${B.y}h${B.width}v${B.height}h${-B.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}K0.displayName="MiniMap";const SL=T.memo(K0),_L=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,NL={[oo.Line]:"right",[oo.Handle]:"bottom-right"};function IL({nodeId:e,position:t,variant:n=oo.Handle,className:r,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:h,autoScale:m=!0,shouldResize:x,onResizeStart:v,onResize:b,onResizeEnd:S}){const N=us(),w=typeof e=="string"?e:N,I=rt(),k=T.useRef(null),A=n===oo.Handle,M=Fe(T.useCallback(_L(A&&m),[A,m]),ct),B=T.useRef(null),U=t??NL[n];T.useEffect(()=>{if(!(!k.current||!w))return B.current||(B.current=rP({domNode:k.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:D,transform:$,snapGrid:F,snapToGrid:E,nodeOrigin:P,domNode:L}=I.getState();return{nodeLookup:D,transform:$,snapGrid:F,snapToGrid:E,nodeOrigin:P,paneDomNode:L}},onChange:(D,$)=>{const{triggerNodeChanges:F,nodeLookup:E,parentLookup:P,nodeOrigin:L}=I.getState(),j=[],O={x:D.x,y:D.y},W=E.get(w);if(W&&W.expandParent&&W.parentId){const z=W.origin??L,Y=D.width??W.measured.width??0,J=D.height??W.measured.height??0,ie={id:W.id,parentId:W.parentId,rect:{width:Y,height:J,...px({x:D.x??W.position.x,y:D.y??W.position.y},{width:Y,height:J},W.parentId,E,z)}},ee=Yd([ie],E,P,L);j.push(...ee),O.x=D.x?Math.max(z[0]*Y,D.x):void 0,O.y=D.y?Math.max(z[1]*J,D.y):void 0}if(O.x!==void 0&&O.y!==void 0){const z={id:w,type:"position",position:{...O}};j.push(z)}if(D.width!==void 0&&D.height!==void 0){const Y={id:w,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};j.push(Y)}for(const z of $){const Y={...z,type:"position"};j.push(Y)}F(j)},onEnd:({width:D,height:$})=>{const F={id:w,type:"dimensions",resizing:!1,dimensions:{width:D,height:$}};I.getState().triggerNodeChanges([F])}})),B.current.update({controlPosition:U,boundaries:{minWidth:l,minHeight:u,maxWidth:d,maxHeight:f},keepAspectRatio:g,resizeDirection:h,onResizeStart:v,onResize:b,onResizeEnd:S,shouldResize:x}),()=>{B.current?.destroy()}},[U,l,u,d,f,g,v,b,S,x]);const q=U.split("-");return y.jsx("div",{className:yt(["react-flow__resize-control","nodrag",...q,n,r]),ref:k,style:{...i,scale:M,...a&&{[A?"backgroundColor":"borderColor"]:a}},children:s})}const Z0=T.memo(IL),fs=20;function Tr(e,t){const n=t[e.dataType],r=e.allowInput??n.allowInput,i=e.maxConnections??n.maxConnections;return n.underlyingType==="number"?{id:rn(fs),name:e.name,handleColor:n.color,allowInput:r,maxConnections:i,type:"number",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:n.underlyingType==="string"?{id:rn(fs),name:e.name,handleColor:n.color,allowInput:r,maxConnections:i,type:"string",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:n.underlyingType==="boolean"?{id:rn(fs),name:e.name,handleColor:n.color,allowInput:r,maxConnections:i,type:"boolean",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}:{id:rn(fs),name:e.name,handleColor:n.color,allowInput:r,maxConnections:i,type:"unsupportedDirectly",handleShape:n.shape,dataType:{dataTypeObject:n,dataTypeUniqueId:e.dataType}}}function J0(e,t){const n=rn(fs),r=e.inputs.map(i=>Tr(i,t));return{id:n,name:e.name,inputs:r}}function ps(e,t,n,r,i){const s=n[t],a=s.inputs.map(u=>"inputs"in u?J0(u,e):Tr(u,e)),l=s.outputs.map(u=>Tr(u,e));return{id:r,position:i,sourcePosition:Ne.Right,targetPosition:Ne.Left,type:"configurableNode",width:400,data:{name:s.name,headerColor:s.headerColor,inputs:a,outputs:l,nodeTypeUniqueId:t,showNodeOpenButton:s.subtree!==void 0}}}function Cr(e,t,n,r){const i=n[t];if(r)if(r.type==="input"){const s=i?.inputs?.[r.index1];if(!s)return;if(r.index2!==void 0&&"inputs"in s)return Tr(s.inputs?.[r.index2],e);if(r.index2===void 0&&!("inputs"in s))return Tr(s,e)}else return Tr(i?.outputs?.[r.index1],e)}function Mt(e){const t=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!t)return{nodes:e.nodes,edges:e.edges};const n=e.typeOfNodes[t.nodeType].subtree;return n?{nodes:n.nodes,edges:n.edges,inputNodeId:n.inputNodeId,outputNodeId:n.outputNodeId}:{nodes:e.nodes,edges:e.edges}}function so(e,t,n){const r=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!r)return t&&(e.nodes=[...t]),n&&(e.edges=[...n]),e;const i=e.typeOfNodes[r.nodeType].subtree,s=e.typeOfNodes[r.nodeType].subtree?.numberOfReferences;return!i||s!==0?(t&&(e.nodes=[...t]),n&&(e.edges=[...n]),e):(t&&(i.nodes=[...t]),n&&(i.edges=[...n]),e)}function hs(e){const t={},n={};for(const r of Object.keys(e.typeOfNodes)){const s=e.typeOfNodes[r].subtree;if(!(!s||s.nodes.length===0))for(const a of s.nodes){const l=a.data.nodeTypeUniqueId;l&&(n[r]=n[r]||new Set,n[r]?.add(l),t[l]=t[l]||new Set,t[l]?.add(r))}}return{nodeToNodeDependents:t,nodeToNodeDependencies:n}}function af(e,t){return("typeOfNodes"in e?hs(e).nodeToNodeDependents:e)[t]||new Set}function Q0(e,t){return("typeOfNodes"in e?hs(e).nodeToNodeDependencies:e)[t]||new Set}function ew(e,t){const n="typeOfNodes"in e?hs(e).nodeToNodeDependents:e,r=new Set,i=[t];for(;i.length>0;){const s=i.shift();if(!s)continue;r.add(s);const a=af(n,s);for(const l of a)r.has(l)||i.push(l)}return r}function EL(e,t){const n="typeOfNodes"in e?hs(e).nodeToNodeDependencies:e,r=new Set,i=[t];for(;i.length>0;){const s=i.shift();if(!s)continue;r.add(s);const a=Q0(n,s);for(const l of a)r.has(l)||i.push(l)}return r}function or(e,t){return e>=0?e:e+t}function cf(e){return e>=0?e+1:e-1}function lf(e,t){const n=or(e,t);return n>=0&&n<t}function ao(e,t,n=void 0){let r=n?.index1??0,i=n?.index2??0;return Iterator.from({next:function(){if(!lf(r,e.length))return{value:{value:void 0,handleIndices:{type:t,index1:r,index2:void 0},parentArray:e,parentArrayIndex:r},done:!0};const a=e[or(r,e.length)];if("inputs"in a){if(!lf(i,a.inputs.length))return{value:{value:void 0,handleIndices:{type:"input",index1:r,index2:i},parentArray:a.inputs,parentArrayIndex:i},done:!0};const l=a.inputs[or(i,a.inputs.length)],u=r,d=i;let f=!1;for(;;){f?(i=i>=0?0:-1,f=!1):i=cf(i);const m=e[or(r,e.length)];if(!m||!("inputs"in m)){i=0;break}if(lf(i,m.inputs.length))break;r=cf(r),f=!0}const g=l,h=e[or(u,e.length)];return{value:{value:g,handleIndices:{type:"input",index1:u,index2:d},parentArray:h,parentArrayIndex:d},done:!1}}else{const l=r;return r=cf(r),i=0,{value:{value:a,handleIndices:{type:t,index1:l,index2:void 0},parentArray:e,parentArrayIndex:l},done:!1}}}})}function tw(e,t,n=!0,r=!0){if(n){const i=e?.inputs instanceof Array?e?.inputs:[];ao(i,"input").every(({value:a,handleIndices:l})=>t(a,l)!==!1)}if(r){const i=e?.outputs instanceof Array?e?.outputs:[];ao(i,"output").forEach(({value:a,handleIndices:l})=>{t(a,l)})}return e}function uf(e,t,n,r=!0,i=!0,s=!0){if(s){const a=on(t,e,r,i)?.value;return a&&Object.assign(a,n),e}else return Bi(e,a=>{const l=on(t,a,r,i)?.value;return l&&Object.assign(l,n),a})}function co(e,t,n=0,r,i=!0,s="before"){if(i){const a=bt(t,e);if(a){const l=a.parentArray,u=s==="before"?or(a.parentArrayIndex,l.length):or(a.parentArrayIndex,l.length)+1;l.splice(u,n,r)}return e}else return Bi(e,a=>{const l=bt(t,a);if(l){const u=l.parentArray,d=s==="before"?or(l.parentArrayIndex,u.length):or(l.parentArrayIndex,u.length)+1;u.splice(d,n,r)}return a})}var gs={exports:{}};/**
271
+ * @license
272
+ * Lodash <https://lodash.com/>
273
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
274
+ * Released under MIT license <https://lodash.com/license>
275
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
276
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
277
+ */var TL=gs.exports,nw;function CL(){return nw||(nw=1,function(e,t){(function(){var n,r="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",d=500,f="__lodash_placeholder__",g=1,h=2,m=4,x=1,v=2,b=1,S=2,N=4,w=8,I=16,k=32,A=64,M=128,B=256,U=512,q=30,D="...",$=800,F=16,E=1,P=2,L=3,j=1/0,O=9007199254740991,W=17976931348623157e292,z=NaN,Y=4294967295,J=Y-1,ie=Y>>>1,ee=[["ary",M],["bind",b],["bindKey",S],["curry",w],["curryRight",I],["flip",U],["partial",k],["partialRight",A],["rearg",B]],ce="[object Arguments]",ge="[object Array]",Q="[object AsyncFunction]",te="[object Boolean]",ne="[object Date]",oe="[object DOMException]",pe="[object Error]",le="[object Function]",ve="[object GeneratorFunction]",me="[object Map]",Oe="[object Number]",Ce="[object Null]",ae="[object Object]",Ie="[object Promise]",Be="[object Proxy]",Qe="[object RegExp]",Ue="[object Set]",Ze="[object String]",pt="[object Symbol]",Cn="[object Undefined]",cn="[object WeakMap]",Nt="[object WeakSet]",$t="[object ArrayBuffer]",ln="[object DataView]",Or="[object Float32Array]",Un="[object Float64Array]",fo="[object Int8Array]",po="[object Int16Array]",Pr="[object Int32Array]",Ps="[object Uint8Array]",Rs="[object Uint8ClampedArray]",Ls="[object Uint16Array]",Ds="[object Uint32Array]",op=/\b__p \+= '';/g,ip=/\b(__p \+=) '' \+/g,sp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rl=/&(?:amp|lt|gt|quot|#39);/g,ol=/[&<>"']/g,ap=RegExp(rl.source),cp=RegExp(ol.source),il=/<%-([\s\S]+?)%>/g,lp=/<%([\s\S]+?)%>/g,sl=/<%=([\s\S]+?)%>/g,up=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dp=/^\w*$/,fp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,js=/[\\^$.*+?()[\]{}|]/g,pp=RegExp(js.source),$s=/^\s+/,hp=/\s/,gp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,mp=/\{\n\/\* \[wrapped with (.+)\] \*/,yp=/,? & /,vp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xp=/[()=,{}\[\]\/\s]/,wp=/\\(\\)?/g,al=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Hs=/\w*$/,cl=/^[-+]0x[0-9a-f]+$/i,bp=/^0b[01]+$/i,Sp=/^\[object .+?Constructor\]$/,_p=/^0o[0-7]+$/i,Np=/^(?:0|[1-9]\d*)$/,Ip=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,si=/($^)/,ll=/['\n\r\u2028\u2029\\]/g,ai="\\ud800-\\udfff",Ep="\\u0300-\\u036f",Tp="\\ufe20-\\ufe2f",Cp="\\u20d0-\\u20ff",ul=Ep+Tp+Cp,dl="\\u2700-\\u27bf",fl="a-z\\xdf-\\xf6\\xf8-\\xff",pl="\\xac\\xb1\\xd7\\xf7",Ap="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",kp="\\u2000-\\u206f",Mp=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",hl="A-Z\\xc0-\\xd6\\xd8-\\xde",gl="\\ufe0e\\ufe0f",ml=pl+Ap+kp+Mp,Bs="['’]",Op="["+ai+"]",Vs="["+ml+"]",ci="["+ul+"]",yl="\\d+",Pp="["+dl+"]",li="["+fl+"]",vl="[^"+ai+ml+yl+dl+fl+hl+"]",Fs="\\ud83c[\\udffb-\\udfff]",xl="(?:"+ci+"|"+Fs+")",aS="[^"+ai+"]",Rp="(?:\\ud83c[\\udde6-\\uddff]){2}",Lp="[\\ud800-\\udbff][\\udc00-\\udfff]",ui="["+hl+"]",cS="\\u200d",lS="(?:"+li+"|"+vl+")",tj="(?:"+ui+"|"+vl+")",uS="(?:"+Bs+"(?:d|ll|m|re|s|t|ve))?",dS="(?:"+Bs+"(?:D|LL|M|RE|S|T|VE))?",fS=xl+"?",pS="["+gl+"]?",nj="(?:"+cS+"(?:"+[aS,Rp,Lp].join("|")+")"+pS+fS+")*",rj="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",oj="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hS=pS+fS+nj,ij="(?:"+[Pp,Rp,Lp].join("|")+")"+hS,sj="(?:"+[aS+ci+"?",ci,Rp,Lp,Op].join("|")+")",aj=RegExp(Bs,"g"),cj=RegExp(ci,"g"),Dp=RegExp(Fs+"(?="+Fs+")|"+sj+hS,"g"),lj=RegExp([ui+"?"+li+"+"+uS+"(?="+[Vs,ui,"$"].join("|")+")",tj+"+"+dS+"(?="+[Vs,ui+lS,"$"].join("|")+")",ui+"?"+lS+"+"+uS,ui+"+"+dS,oj,rj,yl,ij].join("|"),"g"),uj=RegExp("["+cS+ai+ul+gl+"]"),dj=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fj=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],pj=-1,ot={};ot[Or]=ot[Un]=ot[fo]=ot[po]=ot[Pr]=ot[Ps]=ot[Rs]=ot[Ls]=ot[Ds]=!0,ot[ce]=ot[ge]=ot[$t]=ot[te]=ot[ln]=ot[ne]=ot[pe]=ot[le]=ot[me]=ot[Oe]=ot[ae]=ot[Qe]=ot[Ue]=ot[Ze]=ot[cn]=!1;var nt={};nt[ce]=nt[ge]=nt[$t]=nt[ln]=nt[te]=nt[ne]=nt[Or]=nt[Un]=nt[fo]=nt[po]=nt[Pr]=nt[me]=nt[Oe]=nt[ae]=nt[Qe]=nt[Ue]=nt[Ze]=nt[pt]=nt[Ps]=nt[Rs]=nt[Ls]=nt[Ds]=!0,nt[pe]=nt[le]=nt[cn]=!1;var hj={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},gj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mj={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},yj={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vj=parseFloat,xj=parseInt,gS=typeof oa=="object"&&oa&&oa.Object===Object&&oa,wj=typeof self=="object"&&self&&self.Object===Object&&self,It=gS||wj||Function("return this")(),jp=t&&!t.nodeType&&t,ho=jp&&!0&&e&&!e.nodeType&&e,mS=ho&&ho.exports===jp,$p=mS&&gS.process,un=function(){try{var K=ho&&ho.require&&ho.require("util").types;return K||$p&&$p.binding&&$p.binding("util")}catch{}}(),yS=un&&un.isArrayBuffer,vS=un&&un.isDate,xS=un&&un.isMap,wS=un&&un.isRegExp,bS=un&&un.isSet,SS=un&&un.isTypedArray;function Kt(K,se,re){switch(re.length){case 0:return K.call(se);case 1:return K.call(se,re[0]);case 2:return K.call(se,re[0],re[1]);case 3:return K.call(se,re[0],re[1],re[2])}return K.apply(se,re)}function bj(K,se,re,we){for(var Re=-1,qe=K==null?0:K.length;++Re<qe;){var xt=K[Re];se(we,xt,re(xt),K)}return we}function dn(K,se){for(var re=-1,we=K==null?0:K.length;++re<we&&se(K[re],re,K)!==!1;);return K}function Sj(K,se){for(var re=K==null?0:K.length;re--&&se(K[re],re,K)!==!1;);return K}function _S(K,se){for(var re=-1,we=K==null?0:K.length;++re<we;)if(!se(K[re],re,K))return!1;return!0}function Rr(K,se){for(var re=-1,we=K==null?0:K.length,Re=0,qe=[];++re<we;){var xt=K[re];se(xt,re,K)&&(qe[Re++]=xt)}return qe}function wl(K,se){var re=K==null?0:K.length;return!!re&&di(K,se,0)>-1}function Hp(K,se,re){for(var we=-1,Re=K==null?0:K.length;++we<Re;)if(re(se,K[we]))return!0;return!1}function at(K,se){for(var re=-1,we=K==null?0:K.length,Re=Array(we);++re<we;)Re[re]=se(K[re],re,K);return Re}function Lr(K,se){for(var re=-1,we=se.length,Re=K.length;++re<we;)K[Re+re]=se[re];return K}function Bp(K,se,re,we){var Re=-1,qe=K==null?0:K.length;for(we&&qe&&(re=K[++Re]);++Re<qe;)re=se(re,K[Re],Re,K);return re}function _j(K,se,re,we){var Re=K==null?0:K.length;for(we&&Re&&(re=K[--Re]);Re--;)re=se(re,K[Re],Re,K);return re}function Vp(K,se){for(var re=-1,we=K==null?0:K.length;++re<we;)if(se(K[re],re,K))return!0;return!1}var Nj=Fp("length");function Ij(K){return K.split("")}function Ej(K){return K.match(vp)||[]}function NS(K,se,re){var we;return re(K,function(Re,qe,xt){if(se(Re,qe,xt))return we=qe,!1}),we}function bl(K,se,re,we){for(var Re=K.length,qe=re+(we?1:-1);we?qe--:++qe<Re;)if(se(K[qe],qe,K))return qe;return-1}function di(K,se,re){return se===se?$j(K,se,re):bl(K,IS,re)}function Tj(K,se,re,we){for(var Re=re-1,qe=K.length;++Re<qe;)if(we(K[Re],se))return Re;return-1}function IS(K){return K!==K}function ES(K,se){var re=K==null?0:K.length;return re?Up(K,se)/re:z}function Fp(K){return function(se){return se==null?n:se[K]}}function zp(K){return function(se){return K==null?n:K[se]}}function TS(K,se,re,we,Re){return Re(K,function(qe,xt,et){re=we?(we=!1,qe):se(re,qe,xt,et)}),re}function Cj(K,se){var re=K.length;for(K.sort(se);re--;)K[re]=K[re].value;return K}function Up(K,se){for(var re,we=-1,Re=K.length;++we<Re;){var qe=se(K[we]);qe!==n&&(re=re===n?qe:re+qe)}return re}function Wp(K,se){for(var re=-1,we=Array(K);++re<K;)we[re]=se(re);return we}function Aj(K,se){return at(se,function(re){return[re,K[re]]})}function CS(K){return K&&K.slice(0,OS(K)+1).replace($s,"")}function Zt(K){return function(se){return K(se)}}function Gp(K,se){return at(se,function(re){return K[re]})}function zs(K,se){return K.has(se)}function AS(K,se){for(var re=-1,we=K.length;++re<we&&di(se,K[re],0)>-1;);return re}function kS(K,se){for(var re=K.length;re--&&di(se,K[re],0)>-1;);return re}function kj(K,se){for(var re=K.length,we=0;re--;)K[re]===se&&++we;return we}var Mj=zp(hj),Oj=zp(gj);function Pj(K){return"\\"+yj[K]}function Rj(K,se){return K==null?n:K[se]}function fi(K){return uj.test(K)}function Lj(K){return dj.test(K)}function Dj(K){for(var se,re=[];!(se=K.next()).done;)re.push(se.value);return re}function qp(K){var se=-1,re=Array(K.size);return K.forEach(function(we,Re){re[++se]=[Re,we]}),re}function MS(K,se){return function(re){return K(se(re))}}function Dr(K,se){for(var re=-1,we=K.length,Re=0,qe=[];++re<we;){var xt=K[re];(xt===se||xt===f)&&(K[re]=f,qe[Re++]=re)}return qe}function Sl(K){var se=-1,re=Array(K.size);return K.forEach(function(we){re[++se]=we}),re}function jj(K){var se=-1,re=Array(K.size);return K.forEach(function(we){re[++se]=[we,we]}),re}function $j(K,se,re){for(var we=re-1,Re=K.length;++we<Re;)if(K[we]===se)return we;return-1}function Hj(K,se,re){for(var we=re+1;we--;)if(K[we]===se)return we;return we}function pi(K){return fi(K)?Vj(K):Nj(K)}function An(K){return fi(K)?Fj(K):Ij(K)}function OS(K){for(var se=K.length;se--&&hp.test(K.charAt(se)););return se}var Bj=zp(mj);function Vj(K){for(var se=Dp.lastIndex=0;Dp.test(K);)++se;return se}function Fj(K){return K.match(Dp)||[]}function zj(K){return K.match(lj)||[]}var Uj=function K(se){se=se==null?It:hi.defaults(It.Object(),se,hi.pick(It,fj));var re=se.Array,we=se.Date,Re=se.Error,qe=se.Function,xt=se.Math,et=se.Object,Yp=se.RegExp,Wj=se.String,fn=se.TypeError,_l=re.prototype,Gj=qe.prototype,gi=et.prototype,Nl=se["__core-js_shared__"],Il=Gj.toString,Je=gi.hasOwnProperty,qj=0,PS=function(){var o=/[^.]+$/.exec(Nl&&Nl.keys&&Nl.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),El=gi.toString,Yj=Il.call(et),Xj=It._,Kj=Yp("^"+Il.call(Je).replace(js,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Tl=mS?se.Buffer:n,jr=se.Symbol,Cl=se.Uint8Array,RS=Tl?Tl.allocUnsafe:n,Al=MS(et.getPrototypeOf,et),LS=et.create,DS=gi.propertyIsEnumerable,kl=_l.splice,jS=jr?jr.isConcatSpreadable:n,Us=jr?jr.iterator:n,go=jr?jr.toStringTag:n,Ml=function(){try{var o=wo(et,"defineProperty");return o({},"",{}),o}catch{}}(),Zj=se.clearTimeout!==It.clearTimeout&&se.clearTimeout,Jj=we&&we.now!==It.Date.now&&we.now,Qj=se.setTimeout!==It.setTimeout&&se.setTimeout,Ol=xt.ceil,Pl=xt.floor,Xp=et.getOwnPropertySymbols,e$=Tl?Tl.isBuffer:n,$S=se.isFinite,t$=_l.join,n$=MS(et.keys,et),wt=xt.max,At=xt.min,r$=we.now,o$=se.parseInt,HS=xt.random,i$=_l.reverse,Kp=wo(se,"DataView"),Ws=wo(se,"Map"),Zp=wo(se,"Promise"),mi=wo(se,"Set"),Gs=wo(se,"WeakMap"),qs=wo(et,"create"),Rl=Gs&&new Gs,yi={},s$=bo(Kp),a$=bo(Ws),c$=bo(Zp),l$=bo(mi),u$=bo(Gs),Ll=jr?jr.prototype:n,Ys=Ll?Ll.valueOf:n,BS=Ll?Ll.toString:n;function R(o){if(ht(o)&&!Le(o)&&!(o instanceof We)){if(o instanceof pn)return o;if(Je.call(o,"__wrapped__"))return V1(o)}return new pn(o)}var vi=function(){function o(){}return function(c){if(!lt(c))return{};if(LS)return LS(c);o.prototype=c;var p=new o;return o.prototype=n,p}}();function Dl(){}function pn(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=n}R.templateSettings={escape:il,evaluate:lp,interpolate:sl,variable:"",imports:{_:R}},R.prototype=Dl.prototype,R.prototype.constructor=R,pn.prototype=vi(Dl.prototype),pn.prototype.constructor=pn;function We(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Y,this.__views__=[]}function d$(){var o=new We(this.__wrapped__);return o.__actions__=Ht(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Ht(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Ht(this.__views__),o}function f$(){if(this.__filtered__){var o=new We(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function p$(){var o=this.__wrapped__.value(),c=this.__dir__,p=Le(o),_=c<0,C=p?o.length:0,H=IH(0,C,this.__views__),G=H.start,X=H.end,Z=X-G,ue=_?X:G-1,de=this.__iteratees__,he=de.length,xe=0,_e=At(Z,this.__takeCount__);if(!p||!_&&C==Z&&_e==Z)return u1(o,this.__actions__);var ke=[];e:for(;Z--&&xe<_e;){ue+=c;for(var je=-1,Me=o[ue];++je<he;){var Ve=de[je],Ge=Ve.iteratee,en=Ve.type,Rt=Ge(Me);if(en==P)Me=Rt;else if(!Rt){if(en==E)continue e;break e}}ke[xe++]=Me}return ke}We.prototype=vi(Dl.prototype),We.prototype.constructor=We;function mo(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var _=o[c];this.set(_[0],_[1])}}function h$(){this.__data__=qs?qs(null):{},this.size=0}function g$(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function m$(o){var c=this.__data__;if(qs){var p=c[o];return p===u?n:p}return Je.call(c,o)?c[o]:n}function y$(o){var c=this.__data__;return qs?c[o]!==n:Je.call(c,o)}function v$(o,c){var p=this.__data__;return this.size+=this.has(o)?0:1,p[o]=qs&&c===n?u:c,this}mo.prototype.clear=h$,mo.prototype.delete=g$,mo.prototype.get=m$,mo.prototype.has=y$,mo.prototype.set=v$;function ar(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var _=o[c];this.set(_[0],_[1])}}function x$(){this.__data__=[],this.size=0}function w$(o){var c=this.__data__,p=jl(c,o);if(p<0)return!1;var _=c.length-1;return p==_?c.pop():kl.call(c,p,1),--this.size,!0}function b$(o){var c=this.__data__,p=jl(c,o);return p<0?n:c[p][1]}function S$(o){return jl(this.__data__,o)>-1}function _$(o,c){var p=this.__data__,_=jl(p,o);return _<0?(++this.size,p.push([o,c])):p[_][1]=c,this}ar.prototype.clear=x$,ar.prototype.delete=w$,ar.prototype.get=b$,ar.prototype.has=S$,ar.prototype.set=_$;function cr(o){var c=-1,p=o==null?0:o.length;for(this.clear();++c<p;){var _=o[c];this.set(_[0],_[1])}}function N$(){this.size=0,this.__data__={hash:new mo,map:new(Ws||ar),string:new mo}}function I$(o){var c=Xl(this,o).delete(o);return this.size-=c?1:0,c}function E$(o){return Xl(this,o).get(o)}function T$(o){return Xl(this,o).has(o)}function C$(o,c){var p=Xl(this,o),_=p.size;return p.set(o,c),this.size+=p.size==_?0:1,this}cr.prototype.clear=N$,cr.prototype.delete=I$,cr.prototype.get=E$,cr.prototype.has=T$,cr.prototype.set=C$;function yo(o){var c=-1,p=o==null?0:o.length;for(this.__data__=new cr;++c<p;)this.add(o[c])}function A$(o){return this.__data__.set(o,u),this}function k$(o){return this.__data__.has(o)}yo.prototype.add=yo.prototype.push=A$,yo.prototype.has=k$;function kn(o){var c=this.__data__=new ar(o);this.size=c.size}function M$(){this.__data__=new ar,this.size=0}function O$(o){var c=this.__data__,p=c.delete(o);return this.size=c.size,p}function P$(o){return this.__data__.get(o)}function R$(o){return this.__data__.has(o)}function L$(o,c){var p=this.__data__;if(p instanceof ar){var _=p.__data__;if(!Ws||_.length<i-1)return _.push([o,c]),this.size=++p.size,this;p=this.__data__=new cr(_)}return p.set(o,c),this.size=p.size,this}kn.prototype.clear=M$,kn.prototype.delete=O$,kn.prototype.get=P$,kn.prototype.has=R$,kn.prototype.set=L$;function VS(o,c){var p=Le(o),_=!p&&So(o),C=!p&&!_&&Fr(o),H=!p&&!_&&!C&&Si(o),G=p||_||C||H,X=G?Wp(o.length,Wj):[],Z=X.length;for(var ue in o)(c||Je.call(o,ue))&&!(G&&(ue=="length"||C&&(ue=="offset"||ue=="parent")||H&&(ue=="buffer"||ue=="byteLength"||ue=="byteOffset")||fr(ue,Z)))&&X.push(ue);return X}function FS(o){var c=o.length;return c?o[ch(0,c-1)]:n}function D$(o,c){return Kl(Ht(o),vo(c,0,o.length))}function j$(o){return Kl(Ht(o))}function Jp(o,c,p){(p!==n&&!Mn(o[c],p)||p===n&&!(c in o))&&lr(o,c,p)}function Xs(o,c,p){var _=o[c];(!(Je.call(o,c)&&Mn(_,p))||p===n&&!(c in o))&&lr(o,c,p)}function jl(o,c){for(var p=o.length;p--;)if(Mn(o[p][0],c))return p;return-1}function $$(o,c,p,_){return $r(o,function(C,H,G){c(_,C,p(C),G)}),_}function zS(o,c){return o&&Gn(c,St(c),o)}function H$(o,c){return o&&Gn(c,Vt(c),o)}function lr(o,c,p){c=="__proto__"&&Ml?Ml(o,c,{configurable:!0,enumerable:!0,value:p,writable:!0}):o[c]=p}function Qp(o,c){for(var p=-1,_=c.length,C=re(_),H=o==null;++p<_;)C[p]=H?n:Ph(o,c[p]);return C}function vo(o,c,p){return o===o&&(p!==n&&(o=o<=p?o:p),c!==n&&(o=o>=c?o:c)),o}function hn(o,c,p,_,C,H){var G,X=c&g,Z=c&h,ue=c&m;if(p&&(G=C?p(o,_,C,H):p(o)),G!==n)return G;if(!lt(o))return o;var de=Le(o);if(de){if(G=TH(o),!X)return Ht(o,G)}else{var he=kt(o),xe=he==le||he==ve;if(Fr(o))return p1(o,X);if(he==ae||he==ce||xe&&!C){if(G=Z||xe?{}:O1(o),!X)return Z?mH(o,H$(G,o)):gH(o,zS(G,o))}else{if(!nt[he])return C?o:{};G=CH(o,he,X)}}H||(H=new kn);var _e=H.get(o);if(_e)return _e;H.set(o,G),a_(o)?o.forEach(function(Me){G.add(hn(Me,c,p,Me,o,H))}):i_(o)&&o.forEach(function(Me,Ve){G.set(Ve,hn(Me,c,p,Ve,o,H))});var ke=ue?Z?xh:vh:Z?Vt:St,je=de?n:ke(o);return dn(je||o,function(Me,Ve){je&&(Ve=Me,Me=o[Ve]),Xs(G,Ve,hn(Me,c,p,Ve,o,H))}),G}function B$(o){var c=St(o);return function(p){return US(p,o,c)}}function US(o,c,p){var _=p.length;if(o==null)return!_;for(o=et(o);_--;){var C=p[_],H=c[C],G=o[C];if(G===n&&!(C in o)||!H(G))return!1}return!0}function WS(o,c,p){if(typeof o!="function")throw new fn(a);return na(function(){o.apply(n,p)},c)}function Ks(o,c,p,_){var C=-1,H=wl,G=!0,X=o.length,Z=[],ue=c.length;if(!X)return Z;p&&(c=at(c,Zt(p))),_?(H=Hp,G=!1):c.length>=i&&(H=zs,G=!1,c=new yo(c));e:for(;++C<X;){var de=o[C],he=p==null?de:p(de);if(de=_||de!==0?de:0,G&&he===he){for(var xe=ue;xe--;)if(c[xe]===he)continue e;Z.push(de)}else H(c,he,_)||Z.push(de)}return Z}var $r=v1(Wn),GS=v1(th,!0);function V$(o,c){var p=!0;return $r(o,function(_,C,H){return p=!!c(_,C,H),p}),p}function $l(o,c,p){for(var _=-1,C=o.length;++_<C;){var H=o[_],G=c(H);if(G!=null&&(X===n?G===G&&!Qt(G):p(G,X)))var X=G,Z=H}return Z}function F$(o,c,p,_){var C=o.length;for(p=De(p),p<0&&(p=-p>C?0:C+p),_=_===n||_>C?C:De(_),_<0&&(_+=C),_=p>_?0:l_(_);p<_;)o[p++]=c;return o}function qS(o,c){var p=[];return $r(o,function(_,C,H){c(_,C,H)&&p.push(_)}),p}function Et(o,c,p,_,C){var H=-1,G=o.length;for(p||(p=kH),C||(C=[]);++H<G;){var X=o[H];c>0&&p(X)?c>1?Et(X,c-1,p,_,C):Lr(C,X):_||(C[C.length]=X)}return C}var eh=x1(),YS=x1(!0);function Wn(o,c){return o&&eh(o,c,St)}function th(o,c){return o&&YS(o,c,St)}function Hl(o,c){return Rr(c,function(p){return pr(o[p])})}function xo(o,c){c=Br(c,o);for(var p=0,_=c.length;o!=null&&p<_;)o=o[qn(c[p++])];return p&&p==_?o:n}function XS(o,c,p){var _=c(o);return Le(o)?_:Lr(_,p(o))}function Ot(o){return o==null?o===n?Cn:Ce:go&&go in et(o)?NH(o):jH(o)}function nh(o,c){return o>c}function z$(o,c){return o!=null&&Je.call(o,c)}function U$(o,c){return o!=null&&c in et(o)}function W$(o,c,p){return o>=At(c,p)&&o<wt(c,p)}function rh(o,c,p){for(var _=p?Hp:wl,C=o[0].length,H=o.length,G=H,X=re(H),Z=1/0,ue=[];G--;){var de=o[G];G&&c&&(de=at(de,Zt(c))),Z=At(de.length,Z),X[G]=!p&&(c||C>=120&&de.length>=120)?new yo(G&&de):n}de=o[0];var he=-1,xe=X[0];e:for(;++he<C&&ue.length<Z;){var _e=de[he],ke=c?c(_e):_e;if(_e=p||_e!==0?_e:0,!(xe?zs(xe,ke):_(ue,ke,p))){for(G=H;--G;){var je=X[G];if(!(je?zs(je,ke):_(o[G],ke,p)))continue e}xe&&xe.push(ke),ue.push(_e)}}return ue}function G$(o,c,p,_){return Wn(o,function(C,H,G){c(_,p(C),H,G)}),_}function Zs(o,c,p){c=Br(c,o),o=D1(o,c);var _=o==null?o:o[qn(mn(c))];return _==null?n:Kt(_,o,p)}function KS(o){return ht(o)&&Ot(o)==ce}function q$(o){return ht(o)&&Ot(o)==$t}function Y$(o){return ht(o)&&Ot(o)==ne}function Js(o,c,p,_,C){return o===c?!0:o==null||c==null||!ht(o)&&!ht(c)?o!==o&&c!==c:X$(o,c,p,_,Js,C)}function X$(o,c,p,_,C,H){var G=Le(o),X=Le(c),Z=G?ge:kt(o),ue=X?ge:kt(c);Z=Z==ce?ae:Z,ue=ue==ce?ae:ue;var de=Z==ae,he=ue==ae,xe=Z==ue;if(xe&&Fr(o)){if(!Fr(c))return!1;G=!0,de=!1}if(xe&&!de)return H||(H=new kn),G||Si(o)?A1(o,c,p,_,C,H):SH(o,c,Z,p,_,C,H);if(!(p&x)){var _e=de&&Je.call(o,"__wrapped__"),ke=he&&Je.call(c,"__wrapped__");if(_e||ke){var je=_e?o.value():o,Me=ke?c.value():c;return H||(H=new kn),C(je,Me,p,_,H)}}return xe?(H||(H=new kn),_H(o,c,p,_,C,H)):!1}function K$(o){return ht(o)&&kt(o)==me}function oh(o,c,p,_){var C=p.length,H=C,G=!_;if(o==null)return!H;for(o=et(o);C--;){var X=p[C];if(G&&X[2]?X[1]!==o[X[0]]:!(X[0]in o))return!1}for(;++C<H;){X=p[C];var Z=X[0],ue=o[Z],de=X[1];if(G&&X[2]){if(ue===n&&!(Z in o))return!1}else{var he=new kn;if(_)var xe=_(ue,de,Z,o,c,he);if(!(xe===n?Js(de,ue,x|v,_,he):xe))return!1}}return!0}function ZS(o){if(!lt(o)||OH(o))return!1;var c=pr(o)?Kj:Sp;return c.test(bo(o))}function Z$(o){return ht(o)&&Ot(o)==Qe}function J$(o){return ht(o)&&kt(o)==Ue}function Q$(o){return ht(o)&&nu(o.length)&&!!ot[Ot(o)]}function JS(o){return typeof o=="function"?o:o==null?Ft:typeof o=="object"?Le(o)?t1(o[0],o[1]):e1(o):w_(o)}function ih(o){if(!ta(o))return n$(o);var c=[];for(var p in et(o))Je.call(o,p)&&p!="constructor"&&c.push(p);return c}function eH(o){if(!lt(o))return DH(o);var c=ta(o),p=[];for(var _ in o)_=="constructor"&&(c||!Je.call(o,_))||p.push(_);return p}function sh(o,c){return o<c}function QS(o,c){var p=-1,_=Bt(o)?re(o.length):[];return $r(o,function(C,H,G){_[++p]=c(C,H,G)}),_}function e1(o){var c=bh(o);return c.length==1&&c[0][2]?R1(c[0][0],c[0][1]):function(p){return p===o||oh(p,o,c)}}function t1(o,c){return _h(o)&&P1(c)?R1(qn(o),c):function(p){var _=Ph(p,o);return _===n&&_===c?Rh(p,o):Js(c,_,x|v)}}function Bl(o,c,p,_,C){o!==c&&eh(c,function(H,G){if(C||(C=new kn),lt(H))tH(o,c,G,p,Bl,_,C);else{var X=_?_(Ih(o,G),H,G+"",o,c,C):n;X===n&&(X=H),Jp(o,G,X)}},Vt)}function tH(o,c,p,_,C,H,G){var X=Ih(o,p),Z=Ih(c,p),ue=G.get(Z);if(ue){Jp(o,p,ue);return}var de=H?H(X,Z,p+"",o,c,G):n,he=de===n;if(he){var xe=Le(Z),_e=!xe&&Fr(Z),ke=!xe&&!_e&&Si(Z);de=Z,xe||_e||ke?Le(X)?de=X:gt(X)?de=Ht(X):_e?(he=!1,de=p1(Z,!0)):ke?(he=!1,de=h1(Z,!0)):de=[]:ra(Z)||So(Z)?(de=X,So(X)?de=u_(X):(!lt(X)||pr(X))&&(de=O1(Z))):he=!1}he&&(G.set(Z,de),C(de,Z,_,H,G),G.delete(Z)),Jp(o,p,de)}function n1(o,c){var p=o.length;if(p)return c+=c<0?p:0,fr(c,p)?o[c]:n}function r1(o,c,p){c.length?c=at(c,function(H){return Le(H)?function(G){return xo(G,H.length===1?H[0]:H)}:H}):c=[Ft];var _=-1;c=at(c,Zt(Ae()));var C=QS(o,function(H,G,X){var Z=at(c,function(ue){return ue(H)});return{criteria:Z,index:++_,value:H}});return Cj(C,function(H,G){return hH(H,G,p)})}function nH(o,c){return o1(o,c,function(p,_){return Rh(o,_)})}function o1(o,c,p){for(var _=-1,C=c.length,H={};++_<C;){var G=c[_],X=xo(o,G);p(X,G)&&Qs(H,Br(G,o),X)}return H}function rH(o){return function(c){return xo(c,o)}}function ah(o,c,p,_){var C=_?Tj:di,H=-1,G=c.length,X=o;for(o===c&&(c=Ht(c)),p&&(X=at(o,Zt(p)));++H<G;)for(var Z=0,ue=c[H],de=p?p(ue):ue;(Z=C(X,de,Z,_))>-1;)X!==o&&kl.call(X,Z,1),kl.call(o,Z,1);return o}function i1(o,c){for(var p=o?c.length:0,_=p-1;p--;){var C=c[p];if(p==_||C!==H){var H=C;fr(C)?kl.call(o,C,1):dh(o,C)}}return o}function ch(o,c){return o+Pl(HS()*(c-o+1))}function oH(o,c,p,_){for(var C=-1,H=wt(Ol((c-o)/(p||1)),0),G=re(H);H--;)G[_?H:++C]=o,o+=p;return G}function lh(o,c){var p="";if(!o||c<1||c>O)return p;do c%2&&(p+=o),c=Pl(c/2),c&&(o+=o);while(c);return p}function He(o,c){return Eh(L1(o,c,Ft),o+"")}function iH(o){return FS(_i(o))}function sH(o,c){var p=_i(o);return Kl(p,vo(c,0,p.length))}function Qs(o,c,p,_){if(!lt(o))return o;c=Br(c,o);for(var C=-1,H=c.length,G=H-1,X=o;X!=null&&++C<H;){var Z=qn(c[C]),ue=p;if(Z==="__proto__"||Z==="constructor"||Z==="prototype")return o;if(C!=G){var de=X[Z];ue=_?_(de,Z,X):n,ue===n&&(ue=lt(de)?de:fr(c[C+1])?[]:{})}Xs(X,Z,ue),X=X[Z]}return o}var s1=Rl?function(o,c){return Rl.set(o,c),o}:Ft,aH=Ml?function(o,c){return Ml(o,"toString",{configurable:!0,enumerable:!1,value:Dh(c),writable:!0})}:Ft;function cH(o){return Kl(_i(o))}function gn(o,c,p){var _=-1,C=o.length;c<0&&(c=-c>C?0:C+c),p=p>C?C:p,p<0&&(p+=C),C=c>p?0:p-c>>>0,c>>>=0;for(var H=re(C);++_<C;)H[_]=o[_+c];return H}function lH(o,c){var p;return $r(o,function(_,C,H){return p=c(_,C,H),!p}),!!p}function Vl(o,c,p){var _=0,C=o==null?_:o.length;if(typeof c=="number"&&c===c&&C<=ie){for(;_<C;){var H=_+C>>>1,G=o[H];G!==null&&!Qt(G)&&(p?G<=c:G<c)?_=H+1:C=H}return C}return uh(o,c,Ft,p)}function uh(o,c,p,_){var C=0,H=o==null?0:o.length;if(H===0)return 0;c=p(c);for(var G=c!==c,X=c===null,Z=Qt(c),ue=c===n;C<H;){var de=Pl((C+H)/2),he=p(o[de]),xe=he!==n,_e=he===null,ke=he===he,je=Qt(he);if(G)var Me=_||ke;else ue?Me=ke&&(_||xe):X?Me=ke&&xe&&(_||!_e):Z?Me=ke&&xe&&!_e&&(_||!je):_e||je?Me=!1:Me=_?he<=c:he<c;Me?C=de+1:H=de}return At(H,J)}function a1(o,c){for(var p=-1,_=o.length,C=0,H=[];++p<_;){var G=o[p],X=c?c(G):G;if(!p||!Mn(X,Z)){var Z=X;H[C++]=G===0?0:G}}return H}function c1(o){return typeof o=="number"?o:Qt(o)?z:+o}function Jt(o){if(typeof o=="string")return o;if(Le(o))return at(o,Jt)+"";if(Qt(o))return BS?BS.call(o):"";var c=o+"";return c=="0"&&1/o==-j?"-0":c}function Hr(o,c,p){var _=-1,C=wl,H=o.length,G=!0,X=[],Z=X;if(p)G=!1,C=Hp;else if(H>=i){var ue=c?null:wH(o);if(ue)return Sl(ue);G=!1,C=zs,Z=new yo}else Z=c?[]:X;e:for(;++_<H;){var de=o[_],he=c?c(de):de;if(de=p||de!==0?de:0,G&&he===he){for(var xe=Z.length;xe--;)if(Z[xe]===he)continue e;c&&Z.push(he),X.push(de)}else C(Z,he,p)||(Z!==X&&Z.push(he),X.push(de))}return X}function dh(o,c){return c=Br(c,o),o=D1(o,c),o==null||delete o[qn(mn(c))]}function l1(o,c,p,_){return Qs(o,c,p(xo(o,c)),_)}function Fl(o,c,p,_){for(var C=o.length,H=_?C:-1;(_?H--:++H<C)&&c(o[H],H,o););return p?gn(o,_?0:H,_?H+1:C):gn(o,_?H+1:0,_?C:H)}function u1(o,c){var p=o;return p instanceof We&&(p=p.value()),Bp(c,function(_,C){return C.func.apply(C.thisArg,Lr([_],C.args))},p)}function fh(o,c,p){var _=o.length;if(_<2)return _?Hr(o[0]):[];for(var C=-1,H=re(_);++C<_;)for(var G=o[C],X=-1;++X<_;)X!=C&&(H[C]=Ks(H[C]||G,o[X],c,p));return Hr(Et(H,1),c,p)}function d1(o,c,p){for(var _=-1,C=o.length,H=c.length,G={};++_<C;){var X=_<H?c[_]:n;p(G,o[_],X)}return G}function ph(o){return gt(o)?o:[]}function hh(o){return typeof o=="function"?o:Ft}function Br(o,c){return Le(o)?o:_h(o,c)?[o]:B1(Xe(o))}var uH=He;function Vr(o,c,p){var _=o.length;return p=p===n?_:p,!c&&p>=_?o:gn(o,c,p)}var f1=Zj||function(o){return It.clearTimeout(o)};function p1(o,c){if(c)return o.slice();var p=o.length,_=RS?RS(p):new o.constructor(p);return o.copy(_),_}function gh(o){var c=new o.constructor(o.byteLength);return new Cl(c).set(new Cl(o)),c}function dH(o,c){var p=c?gh(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.byteLength)}function fH(o){var c=new o.constructor(o.source,Hs.exec(o));return c.lastIndex=o.lastIndex,c}function pH(o){return Ys?et(Ys.call(o)):{}}function h1(o,c){var p=c?gh(o.buffer):o.buffer;return new o.constructor(p,o.byteOffset,o.length)}function g1(o,c){if(o!==c){var p=o!==n,_=o===null,C=o===o,H=Qt(o),G=c!==n,X=c===null,Z=c===c,ue=Qt(c);if(!X&&!ue&&!H&&o>c||H&&G&&Z&&!X&&!ue||_&&G&&Z||!p&&Z||!C)return 1;if(!_&&!H&&!ue&&o<c||ue&&p&&C&&!_&&!H||X&&p&&C||!G&&C||!Z)return-1}return 0}function hH(o,c,p){for(var _=-1,C=o.criteria,H=c.criteria,G=C.length,X=p.length;++_<G;){var Z=g1(C[_],H[_]);if(Z){if(_>=X)return Z;var ue=p[_];return Z*(ue=="desc"?-1:1)}}return o.index-c.index}function m1(o,c,p,_){for(var C=-1,H=o.length,G=p.length,X=-1,Z=c.length,ue=wt(H-G,0),de=re(Z+ue),he=!_;++X<Z;)de[X]=c[X];for(;++C<G;)(he||C<H)&&(de[p[C]]=o[C]);for(;ue--;)de[X++]=o[C++];return de}function y1(o,c,p,_){for(var C=-1,H=o.length,G=-1,X=p.length,Z=-1,ue=c.length,de=wt(H-X,0),he=re(de+ue),xe=!_;++C<de;)he[C]=o[C];for(var _e=C;++Z<ue;)he[_e+Z]=c[Z];for(;++G<X;)(xe||C<H)&&(he[_e+p[G]]=o[C++]);return he}function Ht(o,c){var p=-1,_=o.length;for(c||(c=re(_));++p<_;)c[p]=o[p];return c}function Gn(o,c,p,_){var C=!p;p||(p={});for(var H=-1,G=c.length;++H<G;){var X=c[H],Z=_?_(p[X],o[X],X,p,o):n;Z===n&&(Z=o[X]),C?lr(p,X,Z):Xs(p,X,Z)}return p}function gH(o,c){return Gn(o,Sh(o),c)}function mH(o,c){return Gn(o,k1(o),c)}function zl(o,c){return function(p,_){var C=Le(p)?bj:$$,H=c?c():{};return C(p,o,Ae(_,2),H)}}function xi(o){return He(function(c,p){var _=-1,C=p.length,H=C>1?p[C-1]:n,G=C>2?p[2]:n;for(H=o.length>3&&typeof H=="function"?(C--,H):n,G&&Pt(p[0],p[1],G)&&(H=C<3?n:H,C=1),c=et(c);++_<C;){var X=p[_];X&&o(c,X,_,H)}return c})}function v1(o,c){return function(p,_){if(p==null)return p;if(!Bt(p))return o(p,_);for(var C=p.length,H=c?C:-1,G=et(p);(c?H--:++H<C)&&_(G[H],H,G)!==!1;);return p}}function x1(o){return function(c,p,_){for(var C=-1,H=et(c),G=_(c),X=G.length;X--;){var Z=G[o?X:++C];if(p(H[Z],Z,H)===!1)break}return c}}function yH(o,c,p){var _=c&b,C=ea(o);function H(){var G=this&&this!==It&&this instanceof H?C:o;return G.apply(_?p:this,arguments)}return H}function w1(o){return function(c){c=Xe(c);var p=fi(c)?An(c):n,_=p?p[0]:c.charAt(0),C=p?Vr(p,1).join(""):c.slice(1);return _[o]()+C}}function wi(o){return function(c){return Bp(v_(y_(c).replace(aj,"")),o,"")}}function ea(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=vi(o.prototype),_=o.apply(p,c);return lt(_)?_:p}}function vH(o,c,p){var _=ea(o);function C(){for(var H=arguments.length,G=re(H),X=H,Z=bi(C);X--;)G[X]=arguments[X];var ue=H<3&&G[0]!==Z&&G[H-1]!==Z?[]:Dr(G,Z);if(H-=ue.length,H<p)return I1(o,c,Ul,C.placeholder,n,G,ue,n,n,p-H);var de=this&&this!==It&&this instanceof C?_:o;return Kt(de,this,G)}return C}function b1(o){return function(c,p,_){var C=et(c);if(!Bt(c)){var H=Ae(p,3);c=St(c),p=function(X){return H(C[X],X,C)}}var G=o(c,p,_);return G>-1?C[H?c[G]:G]:n}}function S1(o){return dr(function(c){var p=c.length,_=p,C=pn.prototype.thru;for(o&&c.reverse();_--;){var H=c[_];if(typeof H!="function")throw new fn(a);if(C&&!G&&Yl(H)=="wrapper")var G=new pn([],!0)}for(_=G?_:p;++_<p;){H=c[_];var X=Yl(H),Z=X=="wrapper"?wh(H):n;Z&&Nh(Z[0])&&Z[1]==(M|w|k|B)&&!Z[4].length&&Z[9]==1?G=G[Yl(Z[0])].apply(G,Z[3]):G=H.length==1&&Nh(H)?G[X]():G.thru(H)}return function(){var ue=arguments,de=ue[0];if(G&&ue.length==1&&Le(de))return G.plant(de).value();for(var he=0,xe=p?c[he].apply(this,ue):de;++he<p;)xe=c[he].call(this,xe);return xe}})}function Ul(o,c,p,_,C,H,G,X,Z,ue){var de=c&M,he=c&b,xe=c&S,_e=c&(w|I),ke=c&U,je=xe?n:ea(o);function Me(){for(var Ve=arguments.length,Ge=re(Ve),en=Ve;en--;)Ge[en]=arguments[en];if(_e)var Rt=bi(Me),tn=kj(Ge,Rt);if(_&&(Ge=m1(Ge,_,C,_e)),H&&(Ge=y1(Ge,H,G,_e)),Ve-=tn,_e&&Ve<ue){var mt=Dr(Ge,Rt);return I1(o,c,Ul,Me.placeholder,p,Ge,mt,X,Z,ue-Ve)}var On=he?p:this,gr=xe?On[o]:o;return Ve=Ge.length,X?Ge=$H(Ge,X):ke&&Ve>1&&Ge.reverse(),de&&Z<Ve&&(Ge.length=Z),this&&this!==It&&this instanceof Me&&(gr=je||ea(gr)),gr.apply(On,Ge)}return Me}function _1(o,c){return function(p,_){return G$(p,o,c(_),{})}}function Wl(o,c){return function(p,_){var C;if(p===n&&_===n)return c;if(p!==n&&(C=p),_!==n){if(C===n)return _;typeof p=="string"||typeof _=="string"?(p=Jt(p),_=Jt(_)):(p=c1(p),_=c1(_)),C=o(p,_)}return C}}function mh(o){return dr(function(c){return c=at(c,Zt(Ae())),He(function(p){var _=this;return o(c,function(C){return Kt(C,_,p)})})})}function Gl(o,c){c=c===n?" ":Jt(c);var p=c.length;if(p<2)return p?lh(c,o):c;var _=lh(c,Ol(o/pi(c)));return fi(c)?Vr(An(_),0,o).join(""):_.slice(0,o)}function xH(o,c,p,_){var C=c&b,H=ea(o);function G(){for(var X=-1,Z=arguments.length,ue=-1,de=_.length,he=re(de+Z),xe=this&&this!==It&&this instanceof G?H:o;++ue<de;)he[ue]=_[ue];for(;Z--;)he[ue++]=arguments[++X];return Kt(xe,C?p:this,he)}return G}function N1(o){return function(c,p,_){return _&&typeof _!="number"&&Pt(c,p,_)&&(p=_=n),c=hr(c),p===n?(p=c,c=0):p=hr(p),_=_===n?c<p?1:-1:hr(_),oH(c,p,_,o)}}function ql(o){return function(c,p){return typeof c=="string"&&typeof p=="string"||(c=yn(c),p=yn(p)),o(c,p)}}function I1(o,c,p,_,C,H,G,X,Z,ue){var de=c&w,he=de?G:n,xe=de?n:G,_e=de?H:n,ke=de?n:H;c|=de?k:A,c&=~(de?A:k),c&N||(c&=-4);var je=[o,c,C,_e,he,ke,xe,X,Z,ue],Me=p.apply(n,je);return Nh(o)&&j1(Me,je),Me.placeholder=_,$1(Me,o,c)}function yh(o){var c=xt[o];return function(p,_){if(p=yn(p),_=_==null?0:At(De(_),292),_&&$S(p)){var C=(Xe(p)+"e").split("e"),H=c(C[0]+"e"+(+C[1]+_));return C=(Xe(H)+"e").split("e"),+(C[0]+"e"+(+C[1]-_))}return c(p)}}var wH=mi&&1/Sl(new mi([,-0]))[1]==j?function(o){return new mi(o)}:Hh;function E1(o){return function(c){var p=kt(c);return p==me?qp(c):p==Ue?jj(c):Aj(c,o(c))}}function ur(o,c,p,_,C,H,G,X){var Z=c&S;if(!Z&&typeof o!="function")throw new fn(a);var ue=_?_.length:0;if(ue||(c&=-97,_=C=n),G=G===n?G:wt(De(G),0),X=X===n?X:De(X),ue-=C?C.length:0,c&A){var de=_,he=C;_=C=n}var xe=Z?n:wh(o),_e=[o,c,p,_,C,de,he,H,G,X];if(xe&&LH(_e,xe),o=_e[0],c=_e[1],p=_e[2],_=_e[3],C=_e[4],X=_e[9]=_e[9]===n?Z?0:o.length:wt(_e[9]-ue,0),!X&&c&(w|I)&&(c&=-25),!c||c==b)var ke=yH(o,c,p);else c==w||c==I?ke=vH(o,c,X):(c==k||c==(b|k))&&!C.length?ke=xH(o,c,p,_):ke=Ul.apply(n,_e);var je=xe?s1:j1;return $1(je(ke,_e),o,c)}function T1(o,c,p,_){return o===n||Mn(o,gi[p])&&!Je.call(_,p)?c:o}function C1(o,c,p,_,C,H){return lt(o)&&lt(c)&&(H.set(c,o),Bl(o,c,n,C1,H),H.delete(c)),o}function bH(o){return ra(o)?n:o}function A1(o,c,p,_,C,H){var G=p&x,X=o.length,Z=c.length;if(X!=Z&&!(G&&Z>X))return!1;var ue=H.get(o),de=H.get(c);if(ue&&de)return ue==c&&de==o;var he=-1,xe=!0,_e=p&v?new yo:n;for(H.set(o,c),H.set(c,o);++he<X;){var ke=o[he],je=c[he];if(_)var Me=G?_(je,ke,he,c,o,H):_(ke,je,he,o,c,H);if(Me!==n){if(Me)continue;xe=!1;break}if(_e){if(!Vp(c,function(Ve,Ge){if(!zs(_e,Ge)&&(ke===Ve||C(ke,Ve,p,_,H)))return _e.push(Ge)})){xe=!1;break}}else if(!(ke===je||C(ke,je,p,_,H))){xe=!1;break}}return H.delete(o),H.delete(c),xe}function SH(o,c,p,_,C,H,G){switch(p){case ln:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case $t:return!(o.byteLength!=c.byteLength||!H(new Cl(o),new Cl(c)));case te:case ne:case Oe:return Mn(+o,+c);case pe:return o.name==c.name&&o.message==c.message;case Qe:case Ze:return o==c+"";case me:var X=qp;case Ue:var Z=_&x;if(X||(X=Sl),o.size!=c.size&&!Z)return!1;var ue=G.get(o);if(ue)return ue==c;_|=v,G.set(o,c);var de=A1(X(o),X(c),_,C,H,G);return G.delete(o),de;case pt:if(Ys)return Ys.call(o)==Ys.call(c)}return!1}function _H(o,c,p,_,C,H){var G=p&x,X=vh(o),Z=X.length,ue=vh(c),de=ue.length;if(Z!=de&&!G)return!1;for(var he=Z;he--;){var xe=X[he];if(!(G?xe in c:Je.call(c,xe)))return!1}var _e=H.get(o),ke=H.get(c);if(_e&&ke)return _e==c&&ke==o;var je=!0;H.set(o,c),H.set(c,o);for(var Me=G;++he<Z;){xe=X[he];var Ve=o[xe],Ge=c[xe];if(_)var en=G?_(Ge,Ve,xe,c,o,H):_(Ve,Ge,xe,o,c,H);if(!(en===n?Ve===Ge||C(Ve,Ge,p,_,H):en)){je=!1;break}Me||(Me=xe=="constructor")}if(je&&!Me){var Rt=o.constructor,tn=c.constructor;Rt!=tn&&"constructor"in o&&"constructor"in c&&!(typeof Rt=="function"&&Rt instanceof Rt&&typeof tn=="function"&&tn instanceof tn)&&(je=!1)}return H.delete(o),H.delete(c),je}function dr(o){return Eh(L1(o,n,U1),o+"")}function vh(o){return XS(o,St,Sh)}function xh(o){return XS(o,Vt,k1)}var wh=Rl?function(o){return Rl.get(o)}:Hh;function Yl(o){for(var c=o.name+"",p=yi[c],_=Je.call(yi,c)?p.length:0;_--;){var C=p[_],H=C.func;if(H==null||H==o)return C.name}return c}function bi(o){var c=Je.call(R,"placeholder")?R:o;return c.placeholder}function Ae(){var o=R.iteratee||jh;return o=o===jh?JS:o,arguments.length?o(arguments[0],arguments[1]):o}function Xl(o,c){var p=o.__data__;return MH(c)?p[typeof c=="string"?"string":"hash"]:p.map}function bh(o){for(var c=St(o),p=c.length;p--;){var _=c[p],C=o[_];c[p]=[_,C,P1(C)]}return c}function wo(o,c){var p=Rj(o,c);return ZS(p)?p:n}function NH(o){var c=Je.call(o,go),p=o[go];try{o[go]=n;var _=!0}catch{}var C=El.call(o);return _&&(c?o[go]=p:delete o[go]),C}var Sh=Xp?function(o){return o==null?[]:(o=et(o),Rr(Xp(o),function(c){return DS.call(o,c)}))}:Bh,k1=Xp?function(o){for(var c=[];o;)Lr(c,Sh(o)),o=Al(o);return c}:Bh,kt=Ot;(Kp&&kt(new Kp(new ArrayBuffer(1)))!=ln||Ws&&kt(new Ws)!=me||Zp&&kt(Zp.resolve())!=Ie||mi&&kt(new mi)!=Ue||Gs&&kt(new Gs)!=cn)&&(kt=function(o){var c=Ot(o),p=c==ae?o.constructor:n,_=p?bo(p):"";if(_)switch(_){case s$:return ln;case a$:return me;case c$:return Ie;case l$:return Ue;case u$:return cn}return c});function IH(o,c,p){for(var _=-1,C=p.length;++_<C;){var H=p[_],G=H.size;switch(H.type){case"drop":o+=G;break;case"dropRight":c-=G;break;case"take":c=At(c,o+G);break;case"takeRight":o=wt(o,c-G);break}}return{start:o,end:c}}function EH(o){var c=o.match(mp);return c?c[1].split(yp):[]}function M1(o,c,p){c=Br(c,o);for(var _=-1,C=c.length,H=!1;++_<C;){var G=qn(c[_]);if(!(H=o!=null&&p(o,G)))break;o=o[G]}return H||++_!=C?H:(C=o==null?0:o.length,!!C&&nu(C)&&fr(G,C)&&(Le(o)||So(o)))}function TH(o){var c=o.length,p=new o.constructor(c);return c&&typeof o[0]=="string"&&Je.call(o,"index")&&(p.index=o.index,p.input=o.input),p}function O1(o){return typeof o.constructor=="function"&&!ta(o)?vi(Al(o)):{}}function CH(o,c,p){var _=o.constructor;switch(c){case $t:return gh(o);case te:case ne:return new _(+o);case ln:return dH(o,p);case Or:case Un:case fo:case po:case Pr:case Ps:case Rs:case Ls:case Ds:return h1(o,p);case me:return new _;case Oe:case Ze:return new _(o);case Qe:return fH(o);case Ue:return new _;case pt:return pH(o)}}function AH(o,c){var p=c.length;if(!p)return o;var _=p-1;return c[_]=(p>1?"& ":"")+c[_],c=c.join(p>2?", ":" "),o.replace(gp,`{
278
+ /* [wrapped with `+c+`] */
279
+ `)}function kH(o){return Le(o)||So(o)||!!(jS&&o&&o[jS])}function fr(o,c){var p=typeof o;return c=c??O,!!c&&(p=="number"||p!="symbol"&&Np.test(o))&&o>-1&&o%1==0&&o<c}function Pt(o,c,p){if(!lt(p))return!1;var _=typeof c;return(_=="number"?Bt(p)&&fr(c,p.length):_=="string"&&c in p)?Mn(p[c],o):!1}function _h(o,c){if(Le(o))return!1;var p=typeof o;return p=="number"||p=="symbol"||p=="boolean"||o==null||Qt(o)?!0:dp.test(o)||!up.test(o)||c!=null&&o in et(c)}function MH(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function Nh(o){var c=Yl(o),p=R[c];if(typeof p!="function"||!(c in We.prototype))return!1;if(o===p)return!0;var _=wh(p);return!!_&&o===_[0]}function OH(o){return!!PS&&PS in o}var PH=Nl?pr:Vh;function ta(o){var c=o&&o.constructor,p=typeof c=="function"&&c.prototype||gi;return o===p}function P1(o){return o===o&&!lt(o)}function R1(o,c){return function(p){return p==null?!1:p[o]===c&&(c!==n||o in et(p))}}function RH(o){var c=eu(o,function(_){return p.size===d&&p.clear(),_}),p=c.cache;return c}function LH(o,c){var p=o[1],_=c[1],C=p|_,H=C<(b|S|M),G=_==M&&p==w||_==M&&p==B&&o[7].length<=c[8]||_==(M|B)&&c[7].length<=c[8]&&p==w;if(!(H||G))return o;_&b&&(o[2]=c[2],C|=p&b?0:N);var X=c[3];if(X){var Z=o[3];o[3]=Z?m1(Z,X,c[4]):X,o[4]=Z?Dr(o[3],f):c[4]}return X=c[5],X&&(Z=o[5],o[5]=Z?y1(Z,X,c[6]):X,o[6]=Z?Dr(o[5],f):c[6]),X=c[7],X&&(o[7]=X),_&M&&(o[8]=o[8]==null?c[8]:At(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=C,o}function DH(o){var c=[];if(o!=null)for(var p in et(o))c.push(p);return c}function jH(o){return El.call(o)}function L1(o,c,p){return c=wt(c===n?o.length-1:c,0),function(){for(var _=arguments,C=-1,H=wt(_.length-c,0),G=re(H);++C<H;)G[C]=_[c+C];C=-1;for(var X=re(c+1);++C<c;)X[C]=_[C];return X[c]=p(G),Kt(o,this,X)}}function D1(o,c){return c.length<2?o:xo(o,gn(c,0,-1))}function $H(o,c){for(var p=o.length,_=At(c.length,p),C=Ht(o);_--;){var H=c[_];o[_]=fr(H,p)?C[H]:n}return o}function Ih(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var j1=H1(s1),na=Qj||function(o,c){return It.setTimeout(o,c)},Eh=H1(aH);function $1(o,c,p){var _=c+"";return Eh(o,AH(_,HH(EH(_),p)))}function H1(o){var c=0,p=0;return function(){var _=r$(),C=F-(_-p);if(p=_,C>0){if(++c>=$)return arguments[0]}else c=0;return o.apply(n,arguments)}}function Kl(o,c){var p=-1,_=o.length,C=_-1;for(c=c===n?_:c;++p<c;){var H=ch(p,C),G=o[H];o[H]=o[p],o[p]=G}return o.length=c,o}var B1=RH(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(fp,function(p,_,C,H){c.push(C?H.replace(wp,"$1"):_||p)}),c});function qn(o){if(typeof o=="string"||Qt(o))return o;var c=o+"";return c=="0"&&1/o==-j?"-0":c}function bo(o){if(o!=null){try{return Il.call(o)}catch{}try{return o+""}catch{}}return""}function HH(o,c){return dn(ee,function(p){var _="_."+p[0];c&p[1]&&!wl(o,_)&&o.push(_)}),o.sort()}function V1(o){if(o instanceof We)return o.clone();var c=new pn(o.__wrapped__,o.__chain__);return c.__actions__=Ht(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function BH(o,c,p){(p?Pt(o,c,p):c===n)?c=1:c=wt(De(c),0);var _=o==null?0:o.length;if(!_||c<1)return[];for(var C=0,H=0,G=re(Ol(_/c));C<_;)G[H++]=gn(o,C,C+=c);return G}function VH(o){for(var c=-1,p=o==null?0:o.length,_=0,C=[];++c<p;){var H=o[c];H&&(C[_++]=H)}return C}function FH(){var o=arguments.length;if(!o)return[];for(var c=re(o-1),p=arguments[0],_=o;_--;)c[_-1]=arguments[_];return Lr(Le(p)?Ht(p):[p],Et(c,1))}var zH=He(function(o,c){return gt(o)?Ks(o,Et(c,1,gt,!0)):[]}),UH=He(function(o,c){var p=mn(c);return gt(p)&&(p=n),gt(o)?Ks(o,Et(c,1,gt,!0),Ae(p,2)):[]}),WH=He(function(o,c){var p=mn(c);return gt(p)&&(p=n),gt(o)?Ks(o,Et(c,1,gt,!0),n,p):[]});function GH(o,c,p){var _=o==null?0:o.length;return _?(c=p||c===n?1:De(c),gn(o,c<0?0:c,_)):[]}function qH(o,c,p){var _=o==null?0:o.length;return _?(c=p||c===n?1:De(c),c=_-c,gn(o,0,c<0?0:c)):[]}function YH(o,c){return o&&o.length?Fl(o,Ae(c,3),!0,!0):[]}function XH(o,c){return o&&o.length?Fl(o,Ae(c,3),!0):[]}function KH(o,c,p,_){var C=o==null?0:o.length;return C?(p&&typeof p!="number"&&Pt(o,c,p)&&(p=0,_=C),F$(o,c,p,_)):[]}function F1(o,c,p){var _=o==null?0:o.length;if(!_)return-1;var C=p==null?0:De(p);return C<0&&(C=wt(_+C,0)),bl(o,Ae(c,3),C)}function z1(o,c,p){var _=o==null?0:o.length;if(!_)return-1;var C=_-1;return p!==n&&(C=De(p),C=p<0?wt(_+C,0):At(C,_-1)),bl(o,Ae(c,3),C,!0)}function U1(o){var c=o==null?0:o.length;return c?Et(o,1):[]}function ZH(o){var c=o==null?0:o.length;return c?Et(o,j):[]}function JH(o,c){var p=o==null?0:o.length;return p?(c=c===n?1:De(c),Et(o,c)):[]}function QH(o){for(var c=-1,p=o==null?0:o.length,_={};++c<p;){var C=o[c];_[C[0]]=C[1]}return _}function W1(o){return o&&o.length?o[0]:n}function e5(o,c,p){var _=o==null?0:o.length;if(!_)return-1;var C=p==null?0:De(p);return C<0&&(C=wt(_+C,0)),di(o,c,C)}function t5(o){var c=o==null?0:o.length;return c?gn(o,0,-1):[]}var n5=He(function(o){var c=at(o,ph);return c.length&&c[0]===o[0]?rh(c):[]}),r5=He(function(o){var c=mn(o),p=at(o,ph);return c===mn(p)?c=n:p.pop(),p.length&&p[0]===o[0]?rh(p,Ae(c,2)):[]}),o5=He(function(o){var c=mn(o),p=at(o,ph);return c=typeof c=="function"?c:n,c&&p.pop(),p.length&&p[0]===o[0]?rh(p,n,c):[]});function i5(o,c){return o==null?"":t$.call(o,c)}function mn(o){var c=o==null?0:o.length;return c?o[c-1]:n}function s5(o,c,p){var _=o==null?0:o.length;if(!_)return-1;var C=_;return p!==n&&(C=De(p),C=C<0?wt(_+C,0):At(C,_-1)),c===c?Hj(o,c,C):bl(o,IS,C,!0)}function a5(o,c){return o&&o.length?n1(o,De(c)):n}var c5=He(G1);function G1(o,c){return o&&o.length&&c&&c.length?ah(o,c):o}function l5(o,c,p){return o&&o.length&&c&&c.length?ah(o,c,Ae(p,2)):o}function u5(o,c,p){return o&&o.length&&c&&c.length?ah(o,c,n,p):o}var d5=dr(function(o,c){var p=o==null?0:o.length,_=Qp(o,c);return i1(o,at(c,function(C){return fr(C,p)?+C:C}).sort(g1)),_});function f5(o,c){var p=[];if(!(o&&o.length))return p;var _=-1,C=[],H=o.length;for(c=Ae(c,3);++_<H;){var G=o[_];c(G,_,o)&&(p.push(G),C.push(_))}return i1(o,C),p}function Th(o){return o==null?o:i$.call(o)}function p5(o,c,p){var _=o==null?0:o.length;return _?(p&&typeof p!="number"&&Pt(o,c,p)?(c=0,p=_):(c=c==null?0:De(c),p=p===n?_:De(p)),gn(o,c,p)):[]}function h5(o,c){return Vl(o,c)}function g5(o,c,p){return uh(o,c,Ae(p,2))}function m5(o,c){var p=o==null?0:o.length;if(p){var _=Vl(o,c);if(_<p&&Mn(o[_],c))return _}return-1}function y5(o,c){return Vl(o,c,!0)}function v5(o,c,p){return uh(o,c,Ae(p,2),!0)}function x5(o,c){var p=o==null?0:o.length;if(p){var _=Vl(o,c,!0)-1;if(Mn(o[_],c))return _}return-1}function w5(o){return o&&o.length?a1(o):[]}function b5(o,c){return o&&o.length?a1(o,Ae(c,2)):[]}function S5(o){var c=o==null?0:o.length;return c?gn(o,1,c):[]}function _5(o,c,p){return o&&o.length?(c=p||c===n?1:De(c),gn(o,0,c<0?0:c)):[]}function N5(o,c,p){var _=o==null?0:o.length;return _?(c=p||c===n?1:De(c),c=_-c,gn(o,c<0?0:c,_)):[]}function I5(o,c){return o&&o.length?Fl(o,Ae(c,3),!1,!0):[]}function E5(o,c){return o&&o.length?Fl(o,Ae(c,3)):[]}var T5=He(function(o){return Hr(Et(o,1,gt,!0))}),C5=He(function(o){var c=mn(o);return gt(c)&&(c=n),Hr(Et(o,1,gt,!0),Ae(c,2))}),A5=He(function(o){var c=mn(o);return c=typeof c=="function"?c:n,Hr(Et(o,1,gt,!0),n,c)});function k5(o){return o&&o.length?Hr(o):[]}function M5(o,c){return o&&o.length?Hr(o,Ae(c,2)):[]}function O5(o,c){return c=typeof c=="function"?c:n,o&&o.length?Hr(o,n,c):[]}function Ch(o){if(!(o&&o.length))return[];var c=0;return o=Rr(o,function(p){if(gt(p))return c=wt(p.length,c),!0}),Wp(c,function(p){return at(o,Fp(p))})}function q1(o,c){if(!(o&&o.length))return[];var p=Ch(o);return c==null?p:at(p,function(_){return Kt(c,n,_)})}var P5=He(function(o,c){return gt(o)?Ks(o,c):[]}),R5=He(function(o){return fh(Rr(o,gt))}),L5=He(function(o){var c=mn(o);return gt(c)&&(c=n),fh(Rr(o,gt),Ae(c,2))}),D5=He(function(o){var c=mn(o);return c=typeof c=="function"?c:n,fh(Rr(o,gt),n,c)}),j5=He(Ch);function $5(o,c){return d1(o||[],c||[],Xs)}function H5(o,c){return d1(o||[],c||[],Qs)}var B5=He(function(o){var c=o.length,p=c>1?o[c-1]:n;return p=typeof p=="function"?(o.pop(),p):n,q1(o,p)});function Y1(o){var c=R(o);return c.__chain__=!0,c}function V5(o,c){return c(o),o}function Zl(o,c){return c(o)}var F5=dr(function(o){var c=o.length,p=c?o[0]:0,_=this.__wrapped__,C=function(H){return Qp(H,o)};return c>1||this.__actions__.length||!(_ instanceof We)||!fr(p)?this.thru(C):(_=_.slice(p,+p+(c?1:0)),_.__actions__.push({func:Zl,args:[C],thisArg:n}),new pn(_,this.__chain__).thru(function(H){return c&&!H.length&&H.push(n),H}))});function z5(){return Y1(this)}function U5(){return new pn(this.value(),this.__chain__)}function W5(){this.__values__===n&&(this.__values__=c_(this.value()));var o=this.__index__>=this.__values__.length,c=o?n:this.__values__[this.__index__++];return{done:o,value:c}}function G5(){return this}function q5(o){for(var c,p=this;p instanceof Dl;){var _=V1(p);_.__index__=0,_.__values__=n,c?C.__wrapped__=_:c=_;var C=_;p=p.__wrapped__}return C.__wrapped__=o,c}function Y5(){var o=this.__wrapped__;if(o instanceof We){var c=o;return this.__actions__.length&&(c=new We(this)),c=c.reverse(),c.__actions__.push({func:Zl,args:[Th],thisArg:n}),new pn(c,this.__chain__)}return this.thru(Th)}function X5(){return u1(this.__wrapped__,this.__actions__)}var K5=zl(function(o,c,p){Je.call(o,p)?++o[p]:lr(o,p,1)});function Z5(o,c,p){var _=Le(o)?_S:V$;return p&&Pt(o,c,p)&&(c=n),_(o,Ae(c,3))}function J5(o,c){var p=Le(o)?Rr:qS;return p(o,Ae(c,3))}var Q5=b1(F1),e3=b1(z1);function t3(o,c){return Et(Jl(o,c),1)}function n3(o,c){return Et(Jl(o,c),j)}function r3(o,c,p){return p=p===n?1:De(p),Et(Jl(o,c),p)}function X1(o,c){var p=Le(o)?dn:$r;return p(o,Ae(c,3))}function K1(o,c){var p=Le(o)?Sj:GS;return p(o,Ae(c,3))}var o3=zl(function(o,c,p){Je.call(o,p)?o[p].push(c):lr(o,p,[c])});function i3(o,c,p,_){o=Bt(o)?o:_i(o),p=p&&!_?De(p):0;var C=o.length;return p<0&&(p=wt(C+p,0)),ru(o)?p<=C&&o.indexOf(c,p)>-1:!!C&&di(o,c,p)>-1}var s3=He(function(o,c,p){var _=-1,C=typeof c=="function",H=Bt(o)?re(o.length):[];return $r(o,function(G){H[++_]=C?Kt(c,G,p):Zs(G,c,p)}),H}),a3=zl(function(o,c,p){lr(o,p,c)});function Jl(o,c){var p=Le(o)?at:QS;return p(o,Ae(c,3))}function c3(o,c,p,_){return o==null?[]:(Le(c)||(c=c==null?[]:[c]),p=_?n:p,Le(p)||(p=p==null?[]:[p]),r1(o,c,p))}var l3=zl(function(o,c,p){o[p?0:1].push(c)},function(){return[[],[]]});function u3(o,c,p){var _=Le(o)?Bp:TS,C=arguments.length<3;return _(o,Ae(c,4),p,C,$r)}function d3(o,c,p){var _=Le(o)?_j:TS,C=arguments.length<3;return _(o,Ae(c,4),p,C,GS)}function f3(o,c){var p=Le(o)?Rr:qS;return p(o,tu(Ae(c,3)))}function p3(o){var c=Le(o)?FS:iH;return c(o)}function h3(o,c,p){(p?Pt(o,c,p):c===n)?c=1:c=De(c);var _=Le(o)?D$:sH;return _(o,c)}function g3(o){var c=Le(o)?j$:cH;return c(o)}function m3(o){if(o==null)return 0;if(Bt(o))return ru(o)?pi(o):o.length;var c=kt(o);return c==me||c==Ue?o.size:ih(o).length}function y3(o,c,p){var _=Le(o)?Vp:lH;return p&&Pt(o,c,p)&&(c=n),_(o,Ae(c,3))}var v3=He(function(o,c){if(o==null)return[];var p=c.length;return p>1&&Pt(o,c[0],c[1])?c=[]:p>2&&Pt(c[0],c[1],c[2])&&(c=[c[0]]),r1(o,Et(c,1),[])}),Ql=Jj||function(){return It.Date.now()};function x3(o,c){if(typeof c!="function")throw new fn(a);return o=De(o),function(){if(--o<1)return c.apply(this,arguments)}}function Z1(o,c,p){return c=p?n:c,c=o&&c==null?o.length:c,ur(o,M,n,n,n,n,c)}function J1(o,c){var p;if(typeof c!="function")throw new fn(a);return o=De(o),function(){return--o>0&&(p=c.apply(this,arguments)),o<=1&&(c=n),p}}var Ah=He(function(o,c,p){var _=b;if(p.length){var C=Dr(p,bi(Ah));_|=k}return ur(o,_,c,p,C)}),Q1=He(function(o,c,p){var _=b|S;if(p.length){var C=Dr(p,bi(Q1));_|=k}return ur(c,_,o,p,C)});function e_(o,c,p){c=p?n:c;var _=ur(o,w,n,n,n,n,n,c);return _.placeholder=e_.placeholder,_}function t_(o,c,p){c=p?n:c;var _=ur(o,I,n,n,n,n,n,c);return _.placeholder=t_.placeholder,_}function n_(o,c,p){var _,C,H,G,X,Z,ue=0,de=!1,he=!1,xe=!0;if(typeof o!="function")throw new fn(a);c=yn(c)||0,lt(p)&&(de=!!p.leading,he="maxWait"in p,H=he?wt(yn(p.maxWait)||0,c):H,xe="trailing"in p?!!p.trailing:xe);function _e(mt){var On=_,gr=C;return _=C=n,ue=mt,G=o.apply(gr,On),G}function ke(mt){return ue=mt,X=na(Ve,c),de?_e(mt):G}function je(mt){var On=mt-Z,gr=mt-ue,b_=c-On;return he?At(b_,H-gr):b_}function Me(mt){var On=mt-Z,gr=mt-ue;return Z===n||On>=c||On<0||he&&gr>=H}function Ve(){var mt=Ql();if(Me(mt))return Ge(mt);X=na(Ve,je(mt))}function Ge(mt){return X=n,xe&&_?_e(mt):(_=C=n,G)}function en(){X!==n&&f1(X),ue=0,_=Z=C=X=n}function Rt(){return X===n?G:Ge(Ql())}function tn(){var mt=Ql(),On=Me(mt);if(_=arguments,C=this,Z=mt,On){if(X===n)return ke(Z);if(he)return f1(X),X=na(Ve,c),_e(Z)}return X===n&&(X=na(Ve,c)),G}return tn.cancel=en,tn.flush=Rt,tn}var w3=He(function(o,c){return WS(o,1,c)}),b3=He(function(o,c,p){return WS(o,yn(c)||0,p)});function S3(o){return ur(o,U)}function eu(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new fn(a);var p=function(){var _=arguments,C=c?c.apply(this,_):_[0],H=p.cache;if(H.has(C))return H.get(C);var G=o.apply(this,_);return p.cache=H.set(C,G)||H,G};return p.cache=new(eu.Cache||cr),p}eu.Cache=cr;function tu(o){if(typeof o!="function")throw new fn(a);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function _3(o){return J1(2,o)}var N3=uH(function(o,c){c=c.length==1&&Le(c[0])?at(c[0],Zt(Ae())):at(Et(c,1),Zt(Ae()));var p=c.length;return He(function(_){for(var C=-1,H=At(_.length,p);++C<H;)_[C]=c[C].call(this,_[C]);return Kt(o,this,_)})}),kh=He(function(o,c){var p=Dr(c,bi(kh));return ur(o,k,n,c,p)}),r_=He(function(o,c){var p=Dr(c,bi(r_));return ur(o,A,n,c,p)}),I3=dr(function(o,c){return ur(o,B,n,n,n,c)});function E3(o,c){if(typeof o!="function")throw new fn(a);return c=c===n?c:De(c),He(o,c)}function T3(o,c){if(typeof o!="function")throw new fn(a);return c=c==null?0:wt(De(c),0),He(function(p){var _=p[c],C=Vr(p,0,c);return _&&Lr(C,_),Kt(o,this,C)})}function C3(o,c,p){var _=!0,C=!0;if(typeof o!="function")throw new fn(a);return lt(p)&&(_="leading"in p?!!p.leading:_,C="trailing"in p?!!p.trailing:C),n_(o,c,{leading:_,maxWait:c,trailing:C})}function A3(o){return Z1(o,1)}function k3(o,c){return kh(hh(c),o)}function M3(){if(!arguments.length)return[];var o=arguments[0];return Le(o)?o:[o]}function O3(o){return hn(o,m)}function P3(o,c){return c=typeof c=="function"?c:n,hn(o,m,c)}function R3(o){return hn(o,g|m)}function L3(o,c){return c=typeof c=="function"?c:n,hn(o,g|m,c)}function D3(o,c){return c==null||US(o,c,St(c))}function Mn(o,c){return o===c||o!==o&&c!==c}var j3=ql(nh),$3=ql(function(o,c){return o>=c}),So=KS(function(){return arguments}())?KS:function(o){return ht(o)&&Je.call(o,"callee")&&!DS.call(o,"callee")},Le=re.isArray,H3=yS?Zt(yS):q$;function Bt(o){return o!=null&&nu(o.length)&&!pr(o)}function gt(o){return ht(o)&&Bt(o)}function B3(o){return o===!0||o===!1||ht(o)&&Ot(o)==te}var Fr=e$||Vh,V3=vS?Zt(vS):Y$;function F3(o){return ht(o)&&o.nodeType===1&&!ra(o)}function z3(o){if(o==null)return!0;if(Bt(o)&&(Le(o)||typeof o=="string"||typeof o.splice=="function"||Fr(o)||Si(o)||So(o)))return!o.length;var c=kt(o);if(c==me||c==Ue)return!o.size;if(ta(o))return!ih(o).length;for(var p in o)if(Je.call(o,p))return!1;return!0}function U3(o,c){return Js(o,c)}function W3(o,c,p){p=typeof p=="function"?p:n;var _=p?p(o,c):n;return _===n?Js(o,c,n,p):!!_}function Mh(o){if(!ht(o))return!1;var c=Ot(o);return c==pe||c==oe||typeof o.message=="string"&&typeof o.name=="string"&&!ra(o)}function G3(o){return typeof o=="number"&&$S(o)}function pr(o){if(!lt(o))return!1;var c=Ot(o);return c==le||c==ve||c==Q||c==Be}function o_(o){return typeof o=="number"&&o==De(o)}function nu(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=O}function lt(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function ht(o){return o!=null&&typeof o=="object"}var i_=xS?Zt(xS):K$;function q3(o,c){return o===c||oh(o,c,bh(c))}function Y3(o,c,p){return p=typeof p=="function"?p:n,oh(o,c,bh(c),p)}function X3(o){return s_(o)&&o!=+o}function K3(o){if(PH(o))throw new Re(s);return ZS(o)}function Z3(o){return o===null}function J3(o){return o==null}function s_(o){return typeof o=="number"||ht(o)&&Ot(o)==Oe}function ra(o){if(!ht(o)||Ot(o)!=ae)return!1;var c=Al(o);if(c===null)return!0;var p=Je.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&Il.call(p)==Yj}var Oh=wS?Zt(wS):Z$;function Q3(o){return o_(o)&&o>=-O&&o<=O}var a_=bS?Zt(bS):J$;function ru(o){return typeof o=="string"||!Le(o)&&ht(o)&&Ot(o)==Ze}function Qt(o){return typeof o=="symbol"||ht(o)&&Ot(o)==pt}var Si=SS?Zt(SS):Q$;function eB(o){return o===n}function tB(o){return ht(o)&&kt(o)==cn}function nB(o){return ht(o)&&Ot(o)==Nt}var rB=ql(sh),oB=ql(function(o,c){return o<=c});function c_(o){if(!o)return[];if(Bt(o))return ru(o)?An(o):Ht(o);if(Us&&o[Us])return Dj(o[Us]());var c=kt(o),p=c==me?qp:c==Ue?Sl:_i;return p(o)}function hr(o){if(!o)return o===0?o:0;if(o=yn(o),o===j||o===-j){var c=o<0?-1:1;return c*W}return o===o?o:0}function De(o){var c=hr(o),p=c%1;return c===c?p?c-p:c:0}function l_(o){return o?vo(De(o),0,Y):0}function yn(o){if(typeof o=="number")return o;if(Qt(o))return z;if(lt(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=lt(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=CS(o);var p=bp.test(o);return p||_p.test(o)?xj(o.slice(2),p?2:8):cl.test(o)?z:+o}function u_(o){return Gn(o,Vt(o))}function iB(o){return o?vo(De(o),-O,O):o===0?o:0}function Xe(o){return o==null?"":Jt(o)}var sB=xi(function(o,c){if(ta(c)||Bt(c)){Gn(c,St(c),o);return}for(var p in c)Je.call(c,p)&&Xs(o,p,c[p])}),d_=xi(function(o,c){Gn(c,Vt(c),o)}),ou=xi(function(o,c,p,_){Gn(c,Vt(c),o,_)}),aB=xi(function(o,c,p,_){Gn(c,St(c),o,_)}),cB=dr(Qp);function lB(o,c){var p=vi(o);return c==null?p:zS(p,c)}var uB=He(function(o,c){o=et(o);var p=-1,_=c.length,C=_>2?c[2]:n;for(C&&Pt(c[0],c[1],C)&&(_=1);++p<_;)for(var H=c[p],G=Vt(H),X=-1,Z=G.length;++X<Z;){var ue=G[X],de=o[ue];(de===n||Mn(de,gi[ue])&&!Je.call(o,ue))&&(o[ue]=H[ue])}return o}),dB=He(function(o){return o.push(n,C1),Kt(f_,n,o)});function fB(o,c){return NS(o,Ae(c,3),Wn)}function pB(o,c){return NS(o,Ae(c,3),th)}function hB(o,c){return o==null?o:eh(o,Ae(c,3),Vt)}function gB(o,c){return o==null?o:YS(o,Ae(c,3),Vt)}function mB(o,c){return o&&Wn(o,Ae(c,3))}function yB(o,c){return o&&th(o,Ae(c,3))}function vB(o){return o==null?[]:Hl(o,St(o))}function xB(o){return o==null?[]:Hl(o,Vt(o))}function Ph(o,c,p){var _=o==null?n:xo(o,c);return _===n?p:_}function wB(o,c){return o!=null&&M1(o,c,z$)}function Rh(o,c){return o!=null&&M1(o,c,U$)}var bB=_1(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=El.call(c)),o[c]=p},Dh(Ft)),SB=_1(function(o,c,p){c!=null&&typeof c.toString!="function"&&(c=El.call(c)),Je.call(o,c)?o[c].push(p):o[c]=[p]},Ae),_B=He(Zs);function St(o){return Bt(o)?VS(o):ih(o)}function Vt(o){return Bt(o)?VS(o,!0):eH(o)}function NB(o,c){var p={};return c=Ae(c,3),Wn(o,function(_,C,H){lr(p,c(_,C,H),_)}),p}function IB(o,c){var p={};return c=Ae(c,3),Wn(o,function(_,C,H){lr(p,C,c(_,C,H))}),p}var EB=xi(function(o,c,p){Bl(o,c,p)}),f_=xi(function(o,c,p,_){Bl(o,c,p,_)}),TB=dr(function(o,c){var p={};if(o==null)return p;var _=!1;c=at(c,function(H){return H=Br(H,o),_||(_=H.length>1),H}),Gn(o,xh(o),p),_&&(p=hn(p,g|h|m,bH));for(var C=c.length;C--;)dh(p,c[C]);return p});function CB(o,c){return p_(o,tu(Ae(c)))}var AB=dr(function(o,c){return o==null?{}:nH(o,c)});function p_(o,c){if(o==null)return{};var p=at(xh(o),function(_){return[_]});return c=Ae(c),o1(o,p,function(_,C){return c(_,C[0])})}function kB(o,c,p){c=Br(c,o);var _=-1,C=c.length;for(C||(C=1,o=n);++_<C;){var H=o==null?n:o[qn(c[_])];H===n&&(_=C,H=p),o=pr(H)?H.call(o):H}return o}function MB(o,c,p){return o==null?o:Qs(o,c,p)}function OB(o,c,p,_){return _=typeof _=="function"?_:n,o==null?o:Qs(o,c,p,_)}var h_=E1(St),g_=E1(Vt);function PB(o,c,p){var _=Le(o),C=_||Fr(o)||Si(o);if(c=Ae(c,4),p==null){var H=o&&o.constructor;C?p=_?new H:[]:lt(o)?p=pr(H)?vi(Al(o)):{}:p={}}return(C?dn:Wn)(o,function(G,X,Z){return c(p,G,X,Z)}),p}function RB(o,c){return o==null?!0:dh(o,c)}function LB(o,c,p){return o==null?o:l1(o,c,hh(p))}function DB(o,c,p,_){return _=typeof _=="function"?_:n,o==null?o:l1(o,c,hh(p),_)}function _i(o){return o==null?[]:Gp(o,St(o))}function jB(o){return o==null?[]:Gp(o,Vt(o))}function $B(o,c,p){return p===n&&(p=c,c=n),p!==n&&(p=yn(p),p=p===p?p:0),c!==n&&(c=yn(c),c=c===c?c:0),vo(yn(o),c,p)}function HB(o,c,p){return c=hr(c),p===n?(p=c,c=0):p=hr(p),o=yn(o),W$(o,c,p)}function BB(o,c,p){if(p&&typeof p!="boolean"&&Pt(o,c,p)&&(c=p=n),p===n&&(typeof c=="boolean"?(p=c,c=n):typeof o=="boolean"&&(p=o,o=n)),o===n&&c===n?(o=0,c=1):(o=hr(o),c===n?(c=o,o=0):c=hr(c)),o>c){var _=o;o=c,c=_}if(p||o%1||c%1){var C=HS();return At(o+C*(c-o+vj("1e-"+((C+"").length-1))),c)}return ch(o,c)}var VB=wi(function(o,c,p){return c=c.toLowerCase(),o+(p?m_(c):c)});function m_(o){return Lh(Xe(o).toLowerCase())}function y_(o){return o=Xe(o),o&&o.replace(Ip,Mj).replace(cj,"")}function FB(o,c,p){o=Xe(o),c=Jt(c);var _=o.length;p=p===n?_:vo(De(p),0,_);var C=p;return p-=c.length,p>=0&&o.slice(p,C)==c}function zB(o){return o=Xe(o),o&&cp.test(o)?o.replace(ol,Oj):o}function UB(o){return o=Xe(o),o&&pp.test(o)?o.replace(js,"\\$&"):o}var WB=wi(function(o,c,p){return o+(p?"-":"")+c.toLowerCase()}),GB=wi(function(o,c,p){return o+(p?" ":"")+c.toLowerCase()}),qB=w1("toLowerCase");function YB(o,c,p){o=Xe(o),c=De(c);var _=c?pi(o):0;if(!c||_>=c)return o;var C=(c-_)/2;return Gl(Pl(C),p)+o+Gl(Ol(C),p)}function XB(o,c,p){o=Xe(o),c=De(c);var _=c?pi(o):0;return c&&_<c?o+Gl(c-_,p):o}function KB(o,c,p){o=Xe(o),c=De(c);var _=c?pi(o):0;return c&&_<c?Gl(c-_,p)+o:o}function ZB(o,c,p){return p||c==null?c=0:c&&(c=+c),o$(Xe(o).replace($s,""),c||0)}function JB(o,c,p){return(p?Pt(o,c,p):c===n)?c=1:c=De(c),lh(Xe(o),c)}function QB(){var o=arguments,c=Xe(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var eV=wi(function(o,c,p){return o+(p?"_":"")+c.toLowerCase()});function tV(o,c,p){return p&&typeof p!="number"&&Pt(o,c,p)&&(c=p=n),p=p===n?Y:p>>>0,p?(o=Xe(o),o&&(typeof c=="string"||c!=null&&!Oh(c))&&(c=Jt(c),!c&&fi(o))?Vr(An(o),0,p):o.split(c,p)):[]}var nV=wi(function(o,c,p){return o+(p?" ":"")+Lh(c)});function rV(o,c,p){return o=Xe(o),p=p==null?0:vo(De(p),0,o.length),c=Jt(c),o.slice(p,p+c.length)==c}function oV(o,c,p){var _=R.templateSettings;p&&Pt(o,c,p)&&(c=n),o=Xe(o),c=ou({},c,_,T1);var C=ou({},c.imports,_.imports,T1),H=St(C),G=Gp(C,H),X,Z,ue=0,de=c.interpolate||si,he="__p += '",xe=Yp((c.escape||si).source+"|"+de.source+"|"+(de===sl?al:si).source+"|"+(c.evaluate||si).source+"|$","g"),_e="//# sourceURL="+(Je.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++pj+"]")+`
280
+ `;o.replace(xe,function(Me,Ve,Ge,en,Rt,tn){return Ge||(Ge=en),he+=o.slice(ue,tn).replace(ll,Pj),Ve&&(X=!0,he+=`' +
281
+ __e(`+Ve+`) +
282
+ '`),Rt&&(Z=!0,he+=`';
283
+ `+Rt+`;
284
+ __p += '`),Ge&&(he+=`' +
285
+ ((__t = (`+Ge+`)) == null ? '' : __t) +
286
+ '`),ue=tn+Me.length,Me}),he+=`';
287
+ `;var ke=Je.call(c,"variable")&&c.variable;if(!ke)he=`with (obj) {
288
+ `+he+`
289
+ }
290
+ `;else if(xp.test(ke))throw new Re(l);he=(Z?he.replace(op,""):he).replace(ip,"$1").replace(sp,"$1;"),he="function("+(ke||"obj")+`) {
291
+ `+(ke?"":`obj || (obj = {});
292
+ `)+"var __t, __p = ''"+(X?", __e = _.escape":"")+(Z?`, __j = Array.prototype.join;
293
+ function print() { __p += __j.call(arguments, '') }
294
+ `:`;
295
+ `)+he+`return __p
296
+ }`;var je=x_(function(){return qe(H,_e+"return "+he).apply(n,G)});if(je.source=he,Mh(je))throw je;return je}function iV(o){return Xe(o).toLowerCase()}function sV(o){return Xe(o).toUpperCase()}function aV(o,c,p){if(o=Xe(o),o&&(p||c===n))return CS(o);if(!o||!(c=Jt(c)))return o;var _=An(o),C=An(c),H=AS(_,C),G=kS(_,C)+1;return Vr(_,H,G).join("")}function cV(o,c,p){if(o=Xe(o),o&&(p||c===n))return o.slice(0,OS(o)+1);if(!o||!(c=Jt(c)))return o;var _=An(o),C=kS(_,An(c))+1;return Vr(_,0,C).join("")}function lV(o,c,p){if(o=Xe(o),o&&(p||c===n))return o.replace($s,"");if(!o||!(c=Jt(c)))return o;var _=An(o),C=AS(_,An(c));return Vr(_,C).join("")}function uV(o,c){var p=q,_=D;if(lt(c)){var C="separator"in c?c.separator:C;p="length"in c?De(c.length):p,_="omission"in c?Jt(c.omission):_}o=Xe(o);var H=o.length;if(fi(o)){var G=An(o);H=G.length}if(p>=H)return o;var X=p-pi(_);if(X<1)return _;var Z=G?Vr(G,0,X).join(""):o.slice(0,X);if(C===n)return Z+_;if(G&&(X+=Z.length-X),Oh(C)){if(o.slice(X).search(C)){var ue,de=Z;for(C.global||(C=Yp(C.source,Xe(Hs.exec(C))+"g")),C.lastIndex=0;ue=C.exec(de);)var he=ue.index;Z=Z.slice(0,he===n?X:he)}}else if(o.indexOf(Jt(C),X)!=X){var xe=Z.lastIndexOf(C);xe>-1&&(Z=Z.slice(0,xe))}return Z+_}function dV(o){return o=Xe(o),o&&ap.test(o)?o.replace(rl,Bj):o}var fV=wi(function(o,c,p){return o+(p?" ":"")+c.toUpperCase()}),Lh=w1("toUpperCase");function v_(o,c,p){return o=Xe(o),c=p?n:c,c===n?Lj(o)?zj(o):Ej(o):o.match(c)||[]}var x_=He(function(o,c){try{return Kt(o,n,c)}catch(p){return Mh(p)?p:new Re(p)}}),pV=dr(function(o,c){return dn(c,function(p){p=qn(p),lr(o,p,Ah(o[p],o))}),o});function hV(o){var c=o==null?0:o.length,p=Ae();return o=c?at(o,function(_){if(typeof _[1]!="function")throw new fn(a);return[p(_[0]),_[1]]}):[],He(function(_){for(var C=-1;++C<c;){var H=o[C];if(Kt(H[0],this,_))return Kt(H[1],this,_)}})}function gV(o){return B$(hn(o,g))}function Dh(o){return function(){return o}}function mV(o,c){return o==null||o!==o?c:o}var yV=S1(),vV=S1(!0);function Ft(o){return o}function jh(o){return JS(typeof o=="function"?o:hn(o,g))}function xV(o){return e1(hn(o,g))}function wV(o,c){return t1(o,hn(c,g))}var bV=He(function(o,c){return function(p){return Zs(p,o,c)}}),SV=He(function(o,c){return function(p){return Zs(o,p,c)}});function $h(o,c,p){var _=St(c),C=Hl(c,_);p==null&&!(lt(c)&&(C.length||!_.length))&&(p=c,c=o,o=this,C=Hl(c,St(c)));var H=!(lt(p)&&"chain"in p)||!!p.chain,G=pr(o);return dn(C,function(X){var Z=c[X];o[X]=Z,G&&(o.prototype[X]=function(){var ue=this.__chain__;if(H||ue){var de=o(this.__wrapped__),he=de.__actions__=Ht(this.__actions__);return he.push({func:Z,args:arguments,thisArg:o}),de.__chain__=ue,de}return Z.apply(o,Lr([this.value()],arguments))})}),o}function _V(){return It._===this&&(It._=Xj),this}function Hh(){}function NV(o){return o=De(o),He(function(c){return n1(c,o)})}var IV=mh(at),EV=mh(_S),TV=mh(Vp);function w_(o){return _h(o)?Fp(qn(o)):rH(o)}function CV(o){return function(c){return o==null?n:xo(o,c)}}var AV=N1(),kV=N1(!0);function Bh(){return[]}function Vh(){return!1}function MV(){return{}}function OV(){return""}function PV(){return!0}function RV(o,c){if(o=De(o),o<1||o>O)return[];var p=Y,_=At(o,Y);c=Ae(c),o-=Y;for(var C=Wp(_,c);++p<o;)c(p);return C}function LV(o){return Le(o)?at(o,qn):Qt(o)?[o]:Ht(B1(Xe(o)))}function DV(o){var c=++qj;return Xe(o)+c}var jV=Wl(function(o,c){return o+c},0),$V=yh("ceil"),HV=Wl(function(o,c){return o/c},1),BV=yh("floor");function VV(o){return o&&o.length?$l(o,Ft,nh):n}function FV(o,c){return o&&o.length?$l(o,Ae(c,2),nh):n}function zV(o){return ES(o,Ft)}function UV(o,c){return ES(o,Ae(c,2))}function WV(o){return o&&o.length?$l(o,Ft,sh):n}function GV(o,c){return o&&o.length?$l(o,Ae(c,2),sh):n}var qV=Wl(function(o,c){return o*c},1),YV=yh("round"),XV=Wl(function(o,c){return o-c},0);function KV(o){return o&&o.length?Up(o,Ft):0}function ZV(o,c){return o&&o.length?Up(o,Ae(c,2)):0}return R.after=x3,R.ary=Z1,R.assign=sB,R.assignIn=d_,R.assignInWith=ou,R.assignWith=aB,R.at=cB,R.before=J1,R.bind=Ah,R.bindAll=pV,R.bindKey=Q1,R.castArray=M3,R.chain=Y1,R.chunk=BH,R.compact=VH,R.concat=FH,R.cond=hV,R.conforms=gV,R.constant=Dh,R.countBy=K5,R.create=lB,R.curry=e_,R.curryRight=t_,R.debounce=n_,R.defaults=uB,R.defaultsDeep=dB,R.defer=w3,R.delay=b3,R.difference=zH,R.differenceBy=UH,R.differenceWith=WH,R.drop=GH,R.dropRight=qH,R.dropRightWhile=YH,R.dropWhile=XH,R.fill=KH,R.filter=J5,R.flatMap=t3,R.flatMapDeep=n3,R.flatMapDepth=r3,R.flatten=U1,R.flattenDeep=ZH,R.flattenDepth=JH,R.flip=S3,R.flow=yV,R.flowRight=vV,R.fromPairs=QH,R.functions=vB,R.functionsIn=xB,R.groupBy=o3,R.initial=t5,R.intersection=n5,R.intersectionBy=r5,R.intersectionWith=o5,R.invert=bB,R.invertBy=SB,R.invokeMap=s3,R.iteratee=jh,R.keyBy=a3,R.keys=St,R.keysIn=Vt,R.map=Jl,R.mapKeys=NB,R.mapValues=IB,R.matches=xV,R.matchesProperty=wV,R.memoize=eu,R.merge=EB,R.mergeWith=f_,R.method=bV,R.methodOf=SV,R.mixin=$h,R.negate=tu,R.nthArg=NV,R.omit=TB,R.omitBy=CB,R.once=_3,R.orderBy=c3,R.over=IV,R.overArgs=N3,R.overEvery=EV,R.overSome=TV,R.partial=kh,R.partialRight=r_,R.partition=l3,R.pick=AB,R.pickBy=p_,R.property=w_,R.propertyOf=CV,R.pull=c5,R.pullAll=G1,R.pullAllBy=l5,R.pullAllWith=u5,R.pullAt=d5,R.range=AV,R.rangeRight=kV,R.rearg=I3,R.reject=f3,R.remove=f5,R.rest=E3,R.reverse=Th,R.sampleSize=h3,R.set=MB,R.setWith=OB,R.shuffle=g3,R.slice=p5,R.sortBy=v3,R.sortedUniq=w5,R.sortedUniqBy=b5,R.split=tV,R.spread=T3,R.tail=S5,R.take=_5,R.takeRight=N5,R.takeRightWhile=I5,R.takeWhile=E5,R.tap=V5,R.throttle=C3,R.thru=Zl,R.toArray=c_,R.toPairs=h_,R.toPairsIn=g_,R.toPath=LV,R.toPlainObject=u_,R.transform=PB,R.unary=A3,R.union=T5,R.unionBy=C5,R.unionWith=A5,R.uniq=k5,R.uniqBy=M5,R.uniqWith=O5,R.unset=RB,R.unzip=Ch,R.unzipWith=q1,R.update=LB,R.updateWith=DB,R.values=_i,R.valuesIn=jB,R.without=P5,R.words=v_,R.wrap=k3,R.xor=R5,R.xorBy=L5,R.xorWith=D5,R.zip=j5,R.zipObject=$5,R.zipObjectDeep=H5,R.zipWith=B5,R.entries=h_,R.entriesIn=g_,R.extend=d_,R.extendWith=ou,$h(R,R),R.add=jV,R.attempt=x_,R.camelCase=VB,R.capitalize=m_,R.ceil=$V,R.clamp=$B,R.clone=O3,R.cloneDeep=R3,R.cloneDeepWith=L3,R.cloneWith=P3,R.conformsTo=D3,R.deburr=y_,R.defaultTo=mV,R.divide=HV,R.endsWith=FB,R.eq=Mn,R.escape=zB,R.escapeRegExp=UB,R.every=Z5,R.find=Q5,R.findIndex=F1,R.findKey=fB,R.findLast=e3,R.findLastIndex=z1,R.findLastKey=pB,R.floor=BV,R.forEach=X1,R.forEachRight=K1,R.forIn=hB,R.forInRight=gB,R.forOwn=mB,R.forOwnRight=yB,R.get=Ph,R.gt=j3,R.gte=$3,R.has=wB,R.hasIn=Rh,R.head=W1,R.identity=Ft,R.includes=i3,R.indexOf=e5,R.inRange=HB,R.invoke=_B,R.isArguments=So,R.isArray=Le,R.isArrayBuffer=H3,R.isArrayLike=Bt,R.isArrayLikeObject=gt,R.isBoolean=B3,R.isBuffer=Fr,R.isDate=V3,R.isElement=F3,R.isEmpty=z3,R.isEqual=U3,R.isEqualWith=W3,R.isError=Mh,R.isFinite=G3,R.isFunction=pr,R.isInteger=o_,R.isLength=nu,R.isMap=i_,R.isMatch=q3,R.isMatchWith=Y3,R.isNaN=X3,R.isNative=K3,R.isNil=J3,R.isNull=Z3,R.isNumber=s_,R.isObject=lt,R.isObjectLike=ht,R.isPlainObject=ra,R.isRegExp=Oh,R.isSafeInteger=Q3,R.isSet=a_,R.isString=ru,R.isSymbol=Qt,R.isTypedArray=Si,R.isUndefined=eB,R.isWeakMap=tB,R.isWeakSet=nB,R.join=i5,R.kebabCase=WB,R.last=mn,R.lastIndexOf=s5,R.lowerCase=GB,R.lowerFirst=qB,R.lt=rB,R.lte=oB,R.max=VV,R.maxBy=FV,R.mean=zV,R.meanBy=UV,R.min=WV,R.minBy=GV,R.stubArray=Bh,R.stubFalse=Vh,R.stubObject=MV,R.stubString=OV,R.stubTrue=PV,R.multiply=qV,R.nth=a5,R.noConflict=_V,R.noop=Hh,R.now=Ql,R.pad=YB,R.padEnd=XB,R.padStart=KB,R.parseInt=ZB,R.random=BB,R.reduce=u3,R.reduceRight=d3,R.repeat=JB,R.replace=QB,R.result=kB,R.round=YV,R.runInContext=K,R.sample=p3,R.size=m3,R.snakeCase=eV,R.some=y3,R.sortedIndex=h5,R.sortedIndexBy=g5,R.sortedIndexOf=m5,R.sortedLastIndex=y5,R.sortedLastIndexBy=v5,R.sortedLastIndexOf=x5,R.startCase=nV,R.startsWith=rV,R.subtract=XV,R.sum=KV,R.sumBy=ZV,R.template=oV,R.times=RV,R.toFinite=hr,R.toInteger=De,R.toLength=l_,R.toLower=iV,R.toNumber=yn,R.toSafeInteger=iB,R.toString=Xe,R.toUpper=sV,R.trim=aV,R.trimEnd=cV,R.trimStart=lV,R.truncate=uV,R.unescape=dV,R.uniqueId=DV,R.upperCase=fV,R.upperFirst=Lh,R.each=X1,R.eachRight=K1,R.first=W1,$h(R,function(){var o={};return Wn(R,function(c,p){Je.call(R.prototype,p)||(o[p]=c)}),o}(),{chain:!1}),R.VERSION=r,dn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){R[o].placeholder=R}),dn(["drop","take"],function(o,c){We.prototype[o]=function(p){p=p===n?1:wt(De(p),0);var _=this.__filtered__&&!c?new We(this):this.clone();return _.__filtered__?_.__takeCount__=At(p,_.__takeCount__):_.__views__.push({size:At(p,Y),type:o+(_.__dir__<0?"Right":"")}),_},We.prototype[o+"Right"]=function(p){return this.reverse()[o](p).reverse()}}),dn(["filter","map","takeWhile"],function(o,c){var p=c+1,_=p==E||p==L;We.prototype[o]=function(C){var H=this.clone();return H.__iteratees__.push({iteratee:Ae(C,3),type:p}),H.__filtered__=H.__filtered__||_,H}}),dn(["head","last"],function(o,c){var p="take"+(c?"Right":"");We.prototype[o]=function(){return this[p](1).value()[0]}}),dn(["initial","tail"],function(o,c){var p="drop"+(c?"":"Right");We.prototype[o]=function(){return this.__filtered__?new We(this):this[p](1)}}),We.prototype.compact=function(){return this.filter(Ft)},We.prototype.find=function(o){return this.filter(o).head()},We.prototype.findLast=function(o){return this.reverse().find(o)},We.prototype.invokeMap=He(function(o,c){return typeof o=="function"?new We(this):this.map(function(p){return Zs(p,o,c)})}),We.prototype.reject=function(o){return this.filter(tu(Ae(o)))},We.prototype.slice=function(o,c){o=De(o);var p=this;return p.__filtered__&&(o>0||c<0)?new We(p):(o<0?p=p.takeRight(-o):o&&(p=p.drop(o)),c!==n&&(c=De(c),p=c<0?p.dropRight(-c):p.take(c-o)),p)},We.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},We.prototype.toArray=function(){return this.take(Y)},Wn(We.prototype,function(o,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),_=/^(?:head|last)$/.test(c),C=R[_?"take"+(c=="last"?"Right":""):c],H=_||/^find/.test(c);C&&(R.prototype[c]=function(){var G=this.__wrapped__,X=_?[1]:arguments,Z=G instanceof We,ue=X[0],de=Z||Le(G),he=function(Ve){var Ge=C.apply(R,Lr([Ve],X));return _&&xe?Ge[0]:Ge};de&&p&&typeof ue=="function"&&ue.length!=1&&(Z=de=!1);var xe=this.__chain__,_e=!!this.__actions__.length,ke=H&&!xe,je=Z&&!_e;if(!H&&de){G=je?G:new We(this);var Me=o.apply(G,X);return Me.__actions__.push({func:Zl,args:[he],thisArg:n}),new pn(Me,xe)}return ke&&je?o.apply(this,X):(Me=this.thru(he),ke?_?Me.value()[0]:Me.value():Me)})}),dn(["pop","push","shift","sort","splice","unshift"],function(o){var c=_l[o],p=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",_=/^(?:pop|shift)$/.test(o);R.prototype[o]=function(){var C=arguments;if(_&&!this.__chain__){var H=this.value();return c.apply(Le(H)?H:[],C)}return this[p](function(G){return c.apply(Le(G)?G:[],C)})}}),Wn(We.prototype,function(o,c){var p=R[c];if(p){var _=p.name+"";Je.call(yi,_)||(yi[_]=[]),yi[_].push({name:c,func:p})}}),yi[Ul(n,S).name]=[{name:"wrapper",func:n}],We.prototype.clone=d$,We.prototype.reverse=f$,We.prototype.value=p$,R.prototype.at=F5,R.prototype.chain=z5,R.prototype.commit=U5,R.prototype.next=W5,R.prototype.plant=q5,R.prototype.reverse=Y5,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=X5,R.prototype.first=R.prototype.head,Us&&(R.prototype[Us]=G5),R},hi=Uj();ho?((ho.exports=hi)._=hi,jp._=hi):It._=hi}).call(TL)}(gs,gs.exports)),gs.exports}var AL=CL();const kL=Uh(AL);function rw(e,t,n=!0){let r;if(t?.handle){const{id:a,name:l,dataType:u,inferredDataType:d,...f}=t.handle;r=f}const i=(t?.handle?.inferredDataType||t?.handle?.dataType)&&!t?.resetInferredType?t?.handle?.inferredDataType||t?.handle?.dataType:void 0,s=kL.cloneDeep({inferredDataType:i,...t?.overrideDataType?{dataType:i}:{},...t?.handle?.dataType?.dataTypeObject&&t?.handle?.dataType?.dataTypeUniqueId&&r?r:{},...t?.overrideName&&t?.handle?.name?{name:t.handle.name}:{}});return n?(Object.assign(e,s),e):Bi(e,a=>(Object.assign(a,s),a))}function df(e,t,n,r=!0){return r?tw(e,i=>{i.dataType?.dataTypeUniqueId===t&&rw(i,n)}):Bi(e,i=>(tw(i,s=>{s.dataType?.dataTypeUniqueId===t&&rw(s,n)}),i))}const Qo={locationInContextMenu:["Standard Nodes"],priorityInContextMenu:200},ow={locationInContextMenu:["Group Nodes"],priorityInContextMenu:100},ir=["groupInfer","loopInfer","condition","bindLoopNodes"],ze={[ir[0]]:ir[0],[ir[1]]:ir[1],[ir[2]]:ir[2],[ir[3]]:ir[3]},In=["groupInput","groupOutput","loopStart","loopEnd","loopStop"],Te={[In[0]]:In[0],[In[1]]:In[1],[In[2]]:In[2],[In[3]]:In[3],[In[4]]:In[4]},ML={[ze.groupInfer]:{name:"Group Infer",underlyingType:"inferFromConnection",color:"#333333"},[ze.loopInfer]:{name:"Loop Infer",underlyingType:"inferFromConnection",color:"#333333"},[ze.condition]:{name:"Condition",underlyingType:"boolean",color:"#cca6d6",allowInput:!0},[ze.bindLoopNodes]:{name:"Bind Loop Nodes",underlyingType:"noEquivalent",color:"#8c52d1",maxConnections:1}},OL={[Te.groupInput]:{name:"Group Input",headerColor:"#1d1d1d",...Qo,inputs:[],outputs:[{name:"",dataType:ze.groupInfer}]},[Te.groupOutput]:{name:"Group Output",headerColor:"#1d1d1d",...Qo,inputs:[{name:"",dataType:ze.groupInfer}],outputs:[]},[Te.loopStart]:{name:"Loop Start",headerColor:"#1d1d1d",...Qo,inputs:[{name:"",dataType:ze.loopInfer}],outputs:[{name:"Bind Loop Nodes",dataType:ze.bindLoopNodes},{name:"",dataType:ze.loopInfer}]},[Te.loopStop]:{name:"Loop Stop",headerColor:"#1d1d1d",...Qo,inputs:[{name:"Bind Loop Nodes",dataType:ze.bindLoopNodes},{name:"Continue If Condition Is True",dataType:ze.condition},{name:"",dataType:ze.loopInfer}],outputs:[{name:"Bind Loop Nodes",dataType:ze.bindLoopNodes},{name:"",dataType:ze.loopInfer}]},[Te.loopEnd]:{name:"Loop End",headerColor:"#1d1d1d",...Qo,inputs:[{name:"Bind Loop Nodes",dataType:ze.bindLoopNodes},{name:"",dataType:ze.loopInfer}],outputs:[{name:"",dataType:ze.loopInfer}]}},Mc=0,Oc=1,Pc=2,Rc=1,Lc=1,Dc=0;function PL(e,t,n,r,i,s,a,l,u,d,f){//!== is basically xor for boolean, we are checking if one is true and the other is false
297
+ if(f&&(a&&u)!==(l&&d)){const g=d?n:t,h=d?"input":"output",m=Cr(e.dataTypes,e.nodes[g].data.nodeTypeUniqueId,e.typeOfNodes,{type:h,index1:0,index2:void 0}),x=d?i.name:r.name,v=d?i.inferredDataType?.dataTypeUniqueId:r.inferredDataType?.dataTypeUniqueId,b=d?i.inferredDataType?.dataTypeObject.allowInput:r.inferredDataType?.dataTypeObject.allowInput,S=d?i.inferredDataType?.dataTypeObject.maxConnections:r.inferredDataType?.dataTypeObject.maxConnections;if(!x||!v)return{validation:{isValid:!1,reason:"Handle to add name, data type, or allow input not found"}};if(!m)return{validation:{isValid:!1,reason:"New duplicate handle not found"}};co(e.nodes[g].data,{type:h,index1:-1,index2:void 0},0,m,!0,"after"),dw(s,f.nodeType,{name:x,dataType:v,allowInput:b,maxConnections:S},{type:d?"output":"input",index1:-1,index2:void 0},"after")}return{validation:{isValid:!0}}}function jc(e){return e===Te.groupInput||e===Te.groupOutput}function $c(e,t){return e===Te.loopStart?t==="input"?Mc:Oc:e===Te.loopStop?t==="input"?Pc:Rc:t==="input"?Lc:Dc}function Tt(e){return e===Te.loopStart||e===Te.loopEnd||e===Te.loopStop}function RL(e,t,n,r,i){const s=e.nodes[t],a=e.nodes[n],l=s.data.nodeTypeUniqueId,u=a.data.nodeTypeUniqueId;if(!l||!u)return{validation:{isValid:!1,reason:"Source or target node type not found"}};const d=Tt(l),f=Tt(u);if(!d&&!f)return{validation:{isValid:!0}};if(d&&r){const g=Cr(e.dataTypes,l,e.typeOfNodes,{type:"input",index1:$c(l,"input"),index2:void 0});if(!g)return{validation:{isValid:!1,reason:"New duplicate input handle not found for source loop node"}};co(s.data,{type:"input",index1:-1,index2:void 0},0,g,!0,"after");const h=Cr(e.dataTypes,l,e.typeOfNodes,{type:"output",index1:$c(l,"output"),index2:void 0});if(!h)return{validation:{isValid:!1,reason:"New duplicate output handle not found for source loop node"}};co(s.data,{type:"output",index1:-1,index2:void 0},0,h,!0,"after")}if(f&&i){const g=Cr(e.dataTypes,u,e.typeOfNodes,{type:"input",index1:$c(u,"input"),index2:void 0});if(!g)return{validation:{isValid:!1,reason:"New duplicate input handle not found for target loop node"}};co(a.data,{type:"input",index1:-1,index2:void 0},0,g,!0,"after");const h=Cr(e.dataTypes,u,e.typeOfNodes,{type:"output",index1:$c(u,"output"),index2:void 0});if(!h)return{validation:{isValid:!1,reason:"New duplicate output handle not found for target loop node"}};co(a.data,{type:"output",index1:-1,index2:void 0},0,h,!0,"after")}return{validation:{isValid:!0}}}function iw(e,t){const n=[t],r=new Set;for(;n.length>0;){const i=n.shift();if(!i||r.has(i))continue;r.add(i);const s=e.nodes.find(u=>u.id===i);if(!s)continue;const a=Qi(s,e.nodes,e.edges);for(const u of a)r.has(u.id)||n.push(u.id);const l=gc(s,e.nodes,e.edges);for(const u of l)r.has(u.id)||n.push(u.id)}return r}function ff(e,t){const n=new Set,r=new Set;{const i=[t.loopStart.id,t.loopStop.id],s=new Set;for(;i.length>0;){const a=i.shift();if(!a||s.has(a))continue;s.add(a),a!==t.loopStart.id&&a!==t.loopStop.id&&n.add(a);const l=e.nodes.find(f=>f.id===a);if(!l)continue;const u=l.id!==t.loopStop.id?Qi(l,e.nodes,e.edges):[];for(const f of u)f.id===t.loopStart.id||f.id===t.loopStop.id||f.id===t.loopEnd.id||s.has(f.id)||i.push(f.id);const d=l.id!==t.loopStart.id?gc(l,e.nodes,e.edges):[];for(const f of d)f.id===t.loopStart.id||f.id===t.loopStop.id||f.id===t.loopEnd.id||s.has(f.id)||i.push(f.id)}}{const i=[t.loopStop.id,t.loopEnd.id],s=new Set;for(;i.length>0;){const a=i.shift();if(!a||s.has(a))continue;s.add(a),a!==t.loopStop.id&&a!==t.loopEnd.id&&r.add(a);const l=e.nodes.find(f=>f.id===a);if(!l)continue;const u=l.id!==t.loopEnd.id?Qi(l,e.nodes,e.edges):[];for(const f of u)f.id===t.loopStart.id||f.id===t.loopStop.id||f.id===t.loopEnd.id||s.has(f.id)||i.push(f.id);const d=l.id!==t.loopStop.id?gc(l,e.nodes,e.edges):[];for(const f of d)f.id===t.loopStart.id||f.id===t.loopStop.id||f.id===t.loopEnd.id||s.has(f.id)||i.push(f.id)}}return{nodesInRegionStartToStop:n,nodesInRegionStopToEnd:r}}function sw(e,t,n=[],r="none"){const i={},s=new Set(n),a=[t.id+"-"+r],l=new Set;for(;a.length>0;){const u=a.shift();if(!u)continue;const[d,f]=u.split("-");if(!d||l.has(d))continue;l.add(d);const g=e.nodes.find(m=>m.id===d);if(!g)continue;const h=g.data.nodeTypeUniqueId&&Tt(g.data.nodeTypeUniqueId)&&!s.has(g.id);if(h&&(i[g.id+"-"+f]=g),!h||f==="output"){const m=Qi(g,e.nodes,e.edges);for(const x of m)l.has(x.id)||a.push(x.id+"-input")}if(!h||f==="input"){const m=gc(g,e.nodes,e.edges);for(const x of m)l.has(x.id)||a.push(x.id+"-output")}}return{boundaryLoopNodes:i}}function ei(e,t){let n,r,i;if(t.data.nodeTypeUniqueId===Te.loopStart){n=t;const s=bt({type:"output",index1:0,index2:void 0},t.data)?.value?.id;if(!s)return;const a=e.edges.find(g=>g.sourceHandle===s);if(!a)return;const l=e.nodes.find(g=>g.id===a.target);if(!l||l.data.nodeTypeUniqueId!==Te.loopStop)return;r=l;const u=bt({type:"output",index1:0,index2:void 0},l.data)?.value?.id;if(!u)return;const d=e.edges.find(g=>g.sourceHandle===u);if(!d)return;const f=e.nodes.find(g=>g.id===d.target);if(!f||f.data.nodeTypeUniqueId!==Te.loopEnd)return;i=f}else if(t.data.nodeTypeUniqueId===Te.loopStop){r=t;const s=bt({type:"input",index1:0,index2:void 0},t.data)?.value?.id;if(!s)return;const a=e.edges.find(g=>g.targetHandle===s);if(!a)return;const l=e.nodes.find(g=>g.id===a.source);if(!l||l.data.nodeTypeUniqueId!==Te.loopStart)return;n=l;const u=bt({type:"output",index1:0,index2:void 0},t.data)?.value?.id;if(!u)return;const d=e.edges.find(g=>g.sourceHandle===u);if(!d)return;const f=e.nodes.find(g=>g.id===d.target);if(!f||f.data.nodeTypeUniqueId!==Te.loopEnd)return;i=f}else if(t.data.nodeTypeUniqueId===Te.loopEnd){i=t;const s=bt({type:"input",index1:0,index2:void 0},t.data)?.value?.id;if(!s)return;const a=e.edges.find(g=>g.targetHandle===s);if(!a)return;const l=e.nodes.find(g=>g.id===a.source);if(!l||l.data.nodeTypeUniqueId!==Te.loopStop)return;r=l;const u=bt({type:"input",index1:0,index2:void 0},l.data)?.value?.id;if(!u)return;const d=e.edges.find(g=>g.targetHandle===u);if(!d)return;const f=e.nodes.find(g=>g.id===d.source);if(!f||f.data.nodeTypeUniqueId!==Te.loopStart)return;n=f}if(n&&r&&i)return{loopStart:n,loopStop:r,loopEnd:i}}function pf(e,t,n,r,i){const s=e.loopStart,a=e.loopStop,l=e.loopEnd,u=xs(s.data),d=xs(a.data),f=xs(l.data),g=u.inputsAndIndices.length-(Mc+1),h=u.outputsAndIndices.length-(Oc+1),m=d.inputsAndIndices.length-(Pc+1),x=d.outputsAndIndices.length-(Rc+1),v=f.inputsAndIndices.length-(Lc+1),b=f.outputsAndIndices.length-(Dc+1),S=[g,h,m,x,v,b],N=Math.max(...S);if(!S.every(A=>A===N||A===N-1))return{validation:{isValid:!1,reason:"Loop structure has too different number of inferred handles, complete the connections"}};const I=S.map(A=>A===N),k=[e.loopStart.id===i&&n===ze.loopInfer,e.loopStart.id===r&&t===ze.loopInfer,e.loopStop.id===i&&n===ze.loopInfer,e.loopStop.id===r&&t===ze.loopInfer,e.loopEnd.id===i&&n===ze.loopInfer,e.loopEnd.id===r&&t===ze.loopInfer];if(!I.every(A=>A)&&I.map((A,M)=>A?k[M]:!1).some(A=>A))return{validation:{isValid:!1,reason:"Can't add a new connection to loops before older conenctions are synced across"}};for(let A=0;A<N;A++){const M=u.inputsAndIndices[A+Mc],B=u.outputsAndIndices[A+Oc],U=d.inputsAndIndices[A+Pc],q=d.outputsAndIndices[A+Rc],D=f.inputsAndIndices[A+Lc],$=f.outputsAndIndices[A+Dc],F=[M,B,U,q,D,$],E=F.find(L=>L?.value?.dataType?.dataTypeUniqueId&&L?.value?.dataType?.dataTypeUniqueId!==ze.loopInfer);if(!E)return{validation:{isValid:!1,reason:"This is a system error, this should never happen, please notify report this on https://github.com/TheClearSky/react-blender-nodes/issues"}};if(!F.every((L,j)=>{const O=L.value.dataType?.dataTypeUniqueId;return O&&(O===E.value?.dataType?.dataTypeUniqueId||(A===N-1?O===ze.loopInfer&&(k[j]?(j%2===0?t:n)===E.value?.dataType?.dataTypeUniqueId:!0):!1))}))return{validation:{isValid:!1,reason:"Loop structure has different handle types"}}}return{validation:{isValid:!0}}}function ms(e,t,n,r=[]){const i=t.data.nodeTypeUniqueId,s=n.data.nodeTypeUniqueId;if(!i||!s)return{validation:{isValid:!1,reason:"Source or target node type not found"}};const a=sw(e,t,r,"output"),l=sw(e,n,r,"input"),u=Object.keys(a.boundaryLoopNodes).length===0,d=Object.keys(l.boundaryLoopNodes).length===0;if(u||d)return{validation:{isValid:!0}};const f=jc(i)||Object.keys(a.boundaryLoopNodes).every(h=>{const m=a.boundaryLoopNodes[h],[x,v]=h.split("-");return m.data.nodeTypeUniqueId!==Te.loopStop&&(v==="input"?m.data.nodeTypeUniqueId!==Te.loopEnd:m.data.nodeTypeUniqueId!==Te.loopStart)}),g=jc(s)||Object.keys(l.boundaryLoopNodes).every(h=>{const m=l.boundaryLoopNodes[h],[x,v]=h.split("-");return m.data.nodeTypeUniqueId!==Te.loopStop&&(v==="input"?m.data.nodeTypeUniqueId!==Te.loopEnd:m.data.nodeTypeUniqueId!==Te.loopStart)});return f!==g?{validation:{isValid:!1,reason:"Can't connect a node from inside the loop to a node from outside the loop"}}:!f&&!g&&!(Object.keys(a.boundaryLoopNodes).every(m=>!!l.boundaryLoopNodes[m])&&Object.keys(a.boundaryLoopNodes).length===Object.keys(l.boundaryLoopNodes).length)?{validation:{isValid:!1,reason:"Can't connect 2 nodes of different regions of loop nodes"}}:{validation:{isValid:!0}}}function LL(e,t,n,r,i){const s=t.id,a=n.id,l=t.data.nodeTypeUniqueId,u=n.data.nodeTypeUniqueId;if(!l||!u)return{validation:{isValid:!1,reason:"Source or target node type not found"}};const d=bt(r,t.data)?.value,f=bt(i,n.data)?.value,g=d?.dataType,h=f?.dataType;if(!g||!h)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const m=lo(d,!0),x=lo(f,!0);if(!m||!x)return{validation:{isValid:!1,reason:"Source or target resultant handle data type not found"}};const v=Tt(l),b=Tt(u);if(v&&b){if(g.dataTypeUniqueId===ze.bindLoopNodes||h.dataTypeUniqueId===ze.bindLoopNodes){if(!(l===Te.loopStart&&u===Te.loopStop||l===Te.loopStop&&u===Te.loopEnd))return{validation:{isValid:!1,reason:"Loop nodes can only bind in order: loopStart<->loopStop<->loopEnd"}}}else{const N=ei(e,t),w=ei(e,n);if(!N||!w)return{validation:{isValid:!1,reason:`${N?"Target":"Source"} loop structure not found`}};const I=pf(N,m.dataTypeUniqueId,x.dataTypeUniqueId,s,a),k=pf(N,m.dataTypeUniqueId,x.dataTypeUniqueId,s,a);if(!I.validation.isValid||!k.validation.isValid)return{validation:{isValid:!1,reason:`${I.validation.isValid?"Target":"Source"} loop structure is invalid because of reason: ${I.validation.isValid?k.validation.reason:I.validation.reason}`}};if(N.loopStart.id!==w.loopStart.id)if(l===Te.loopEnd&&u===Te.loopStart){const M=ms(e,t,n,[N.loopStart.id,N.loopStop.id,N.loopEnd.id,w.loopStart.id,w.loopStop.id,w.loopEnd.id]);if(!M.validation.isValid)return M}else{const[M,B]=l===Te.loopEnd?[N,w]:u===Te.loopStart?[w,N]:[void 0,void 0];if(!M||!B)return{validation:{isValid:!1,reason:"Can't connect one loop structure's inner region to another loop structure's inner region"}};const U=ms(e,t,n,[M.loopStart.id,M.loopStop.id,M.loopEnd.id]);if(!U.validation.isValid)return U}else if(!(l===Te.loopStart&&u===Te.loopStop||l===Te.loopStop&&u===Te.loopEnd))return{validation:{isValid:!1,reason:"Loop nodes can only bind in order: loopStart<->loopStop<->loopEnd"}}}return{validation:{isValid:!0}}}else if(v||b){const S=ei(e,v?t:n);if(!S)return{validation:{isValid:!1,reason:"Can't connect to incomplete loop structure"}};const N=pf(S,m.dataTypeUniqueId,x.dataTypeUniqueId,s,a);if(!N.validation.isValid)return{validation:{isValid:!1,reason:`Loop structure is invalid because of reason: ${N.validation.reason}`}};if(v){const{nodesInRegionStartToStop:w,nodesInRegionStopToEnd:I}=ff(e,S),k=iw(e,s),A=w.has(a),M=I.has(a),B=k.has(a)&&!A&&!M,U=jc(u),q=S.loopStart.id===s,D=S.loopStop.id===s,$=S.loopEnd.id===s;if(U&&!$)return{validation:{isValid:!1,reason:"Group output node can only connect to loop end not inside the loop"}};if(A&&!q)return{validation:{isValid:!1,reason:"Loop nodes inside the LoopStart<->LoopStop region can only connect to LoopStart, LoopStop, other nodes in the same region or unreachable nodes"}};if(M&&!D)return{validation:{isValid:!1,reason:"Loop nodes inside the LoopStop<->LoopEnd region can only connect to LoopStop, LoopEnd, other nodes in the same region or unreachable nodes"}};if(B&&!$)return{validation:{isValid:!1,reason:"Loop nodes outside the Loop region can only connect to LoopStart, LoopStop or other nodes outside the loop"}};const F=ms(e,t,n,[S.loopStart.id,S.loopStop.id,S.loopEnd.id]);return F.validation.isValid?{validation:{isValid:!0}}:F}else if(b){const{nodesInRegionStartToStop:w,nodesInRegionStopToEnd:I}=ff(e,S),k=iw(e,a),A=w.has(s),M=I.has(s),B=k.has(s)&&!A&&!M,U=jc(l),q=S.loopStart.id===a,D=S.loopStop.id===a,$=S.loopEnd.id===a;if(U&&!q)return{validation:{isValid:!1,reason:"Group input node can only connect to loop start not inside the loop"}};if(A&&!D)return{validation:{isValid:!1,reason:"Loop nodes inside the LoopStart<->LoopStop region can only connect to LoopStart, LoopStop, other nodes in the same region or unreachable nodes"}};if(M&&!$)return{validation:{isValid:!1,reason:"Loop nodes inside the LoopStop<->LoopEnd region can only connect to LoopStop, LoopEnd, other nodes in the same region or unreachable nodes"}};if(B&&!q)return{validation:{isValid:!1,reason:"Loop nodes outside the Loop region can only connect to LoopStart, LoopStop or other nodes outside the loop"}};const F=ms(e,t,n,[S.loopStart.id,S.loopStop.id,S.loopEnd.id]);return F.validation.isValid?{validation:{isValid:!0}}:F}return{validation:{isValid:!0}}}else{const S=ms(e,t,n);return S.validation.isValid?{validation:{isValid:!0}}:S}}function DL(e,t,n){let r=[];if(t.every(l=>typeof l=="string")){const l=new Set(t);r=e.nodes.filter(u=>l.has(u.id))}else r=t;const i={};for(const l of r)i[l.id]={node:l,alreadyChecked:!1};const s=Object.keys(i);for(const l of s){const u=i[l].node;if(i[l].alreadyChecked||(i[l].alreadyChecked=!0,!u)||!u.data.nodeTypeUniqueId||!Tt(u.data.nodeTypeUniqueId))continue;const d=ei(e,u);if(d){if(i[d.loopStart.id]===void 0||i[d.loopStop.id]===void 0||i[d.loopEnd.id]===void 0)return{validation:{isValid:!1,reason:"Loop nodes all need to be removed together, can't partially remove them"}};i[d.loopStart.id].alreadyChecked=!0,i[d.loopStop.id].alreadyChecked=!0,i[d.loopEnd.id].alreadyChecked=!0}}let a=[];if(n.every(l=>typeof l=="string")){const l=new Set(n);a=e.edges.filter(u=>l.has(u.id))}else a=n;for(const l of a){const u=e.nodes.find(w=>w.id===l.source),d=e.nodes.find(w=>w.id===l.target),f=l.sourceHandle,g=l.targetHandle;if(!f||!g||!u||!d)continue;const h=u.data.nodeTypeUniqueId,m=d.data.nodeTypeUniqueId;if(!h||!m||!Tt(h)||!Tt(m))continue;const x=on(f,u.data)?.value,v=on(g,d.data)?.value,b=x?.dataType?.dataTypeUniqueId,S=v?.dataType?.dataTypeUniqueId;if(b!==ze.bindLoopNodes||S!==ze.bindLoopNodes)continue;const N=ei(e,u);if(N&&(i[N.loopStart.id]===void 0||i[N.loopStop.id]===void 0||i[N.loopEnd.id]===void 0))return{validation:{isValid:!1,reason:"Cannot disconnect loop nodes bind edges once fully connected, to delete, select all connected loop nodes and delete them at once"}}}return{validation:{isValid:!0}}}function jL(e,t,n,r,i,s,a,l,u){if(!s.sourceHandle||!s.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const d=e.nodes[t].data,f=e.nodes[n].data,g=bt(r,d)?.value,h=bt(i,f)?.value,m=g?.dataType,x=h?.dataType,v=g?.inferredDataType,b=h?.inferredDataType,S=m?.dataTypeObject.underlyingType==="inferFromConnection",N=x?.dataTypeObject.underlyingType==="inferFromConnection";if(!m||!x)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const w=!!a&&s.source===a,I=!!l&&s.target===l,k=e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1];if(!d.nodeTypeUniqueId||!f.nodeTypeUniqueId)return{validation:{isValid:!1,reason:"Source or target node type not found"}};const A=Tt(d.nodeTypeUniqueId),M=Tt(f.nodeTypeUniqueId);if(!S&&!N)return{validation:{isValid:!0}};let B,U,q,D=!1,$=!1,F=!1;if(S&&N){if(!v&&!b)return{validation:{isValid:!1,reason:"None of the handles are inferred, inference has no information to work with"}};if(v&&b)return{validation:{isValid:!0}};v?(B=n,U=x.dataTypeUniqueId,q=g,D=!1,$=I||M,F=I||M):b&&(B=t,U=m.dataTypeUniqueId,q=h,D=!1,$=w||A,F=w||A)}else if(S){if(v)return{validation:{isValid:!0}};B=t,U=m.dataTypeUniqueId,q=h,D=!1,$=w||A,F=w||A}else if(N){if(b)return{validation:{isValid:!0}};B=n,U=x.dataTypeUniqueId,q=g,D=!1,$=I||M,F=I||M}if(B===void 0||U===void 0||q===void 0)return{validation:{isValid:!1,reason:"Index of node to update, data type to infer for, or connected handle not found"}};df(e.nodes[B].data,U,{handle:q,resetInferredType:D,overrideDataType:$,overrideName:F});const E=PL(e,t,n,g,h,u,S,N,w,I,k);if(!E.validation.isValid)return E;const P=RL(e,t,n,S,N);return P.validation.isValid?{validation:{isValid:!0}}:P}function $L(e,t,n,r,i,s){if(!s.sourceHandle||!s.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const a=e.nodes[t].data,l=e.nodes[n].data,u=bt(r,a)?.value,d=bt(i,l)?.value,f=lo(u),g=lo(d);if(!f||!g)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};const h=f?.dataTypeObject.underlyingType==="complex",m=g?.dataTypeObject.underlyingType==="complex";return!h&&!m?{validation:{isValid:!0}}:h!==m?{validation:{isValid:!1,reason:"Can't connect complex types with non-complex types"}}:h&&m?f.dataTypeUniqueId===g.dataTypeUniqueId||JSON.stringify(f.dataTypeObject.complexSchema)===JSON.stringify(g.dataTypeObject.complexSchema)?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:"Can't connect complex types with different types"}}:{validation:{isValid:!0}}}function HL(e,t,n,r,i,s){if(!s.sourceHandle||!s.targetHandle)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const a=e.nodes[t].data,l=e.nodes[n].data,u=bt(r,a)?.value,d=bt(i,l)?.value,f=lo(u),g=lo(d);if(!f||!g)return{validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(f.dataTypeUniqueId===g.dataTypeUniqueId)return{validation:{isValid:!0}};const m=e.allowedConversionsBetweenDataTypes?.[f.dataTypeUniqueId]?.[g.dataTypeUniqueId],x=f.dataTypeObject.underlyingType==="complex"&&g.dataTypeObject.underlyingType==="complex";return m||x&&e.allowConversionBetweenComplexTypesUnlessDisallowedByComplexTypeChecking?{validation:{isValid:!0}}:{validation:{isValid:!1,reason:`${f.dataTypeUniqueId} to ${g.dataTypeUniqueId} conversion is not allowed`}}}function BL(e,t,n,r,i,s){const a=e.nodes[t],l=e.nodes[n],u=bt(r,a.data)?.value,d=bt(i,l.data)?.value,f=u?.dataType,g=d?.dataType;if(!f||!g)return{updatedNodes:e.nodes,validation:{isValid:!1,reason:"Source or target handle data type not found"}};if(f.dataTypeObject.underlyingType!=="inferFromConnection"&&g.dataTypeObject.underlyingType!=="inferFromConnection")return{updatedNodes:e.nodes,validation:{isValid:!0}};let h=e.nodes;if(f.dataTypeObject.underlyingType==="inferFromConnection"){const m=$d([a],e.edges),{inputsAndIndices:x,outputsAndIndices:v}=xs(a.data),b={};for(const N of x)N.value.dataType?.dataTypeUniqueId===f.dataTypeUniqueId&&(b[N.value.id]=!0);for(const N of v)N.value.dataType?.dataTypeUniqueId===f.dataTypeUniqueId&&(b[N.value.id]=!0);let S=!1;for(const N of m)if(N.id!==s.id&&!(!N.sourceHandle||!N.targetHandle)){if(b[N.sourceHandle]){S=!0;break}if(b[N.targetHandle]){S=!0;break}}S||(h=[...h],h[t]={...h[t],data:df(h[t].data,f.dataTypeUniqueId,{handle:Cr(e.dataTypes,h[t].data.nodeTypeUniqueId,e.typeOfNodes,r),resetInferredType:!0})})}if(g.dataTypeObject.underlyingType==="inferFromConnection"){const m=$d([l],e.edges),{inputsAndIndices:x,outputsAndIndices:v}=xs(l.data),b={};for(const N of x)N.value.dataType?.dataTypeUniqueId===g.dataTypeUniqueId&&(b[N.value.id]=!0);for(const N of v)N.value.dataType?.dataTypeUniqueId===g.dataTypeUniqueId&&(b[N.value.id]=!0);let S=!1;for(const N of m)if(N.id!==s.id&&!(!N.sourceHandle||!N.targetHandle)){if(b[N.sourceHandle]){S=!0;break}if(b[N.targetHandle]){S=!0;break}}S||(h=[...h],h[n]={...h[n],data:df(h[n].data,g.dataTypeUniqueId,{handle:Cr(e.dataTypes,h[n].data.nodeTypeUniqueId,e.typeOfNodes,i),resetInferredType:!0})})}return{updatedNodes:h,validation:{isValid:!0}}}const VL=20;function aw(e,t,n,r,i,s,a,l){const u={id:rn(VL),source:e,target:n,sourceHandle:t,targetHandle:r,type:"configurableEdge"};if(Sx(u,i.edges)===i.edges)return{validation:{isValid:!1,reason:"Edge already exists or was rejected by reactflow"}};if(!(i.enableTypeInference||i.enableComplexTypeChecking||i.allowedConversionsBetweenDataTypes))return i.edges.push(u),{validation:{isValid:!0}};const f=i.nodes.findIndex(N=>N.id===e),g=i.nodes.findIndex(N=>N.id===n);if(f===-1||g===-1)return{validation:{isValid:!1,reason:"Source or target node not found"}};const h=i.nodes[f],m=i.nodes[g],x=on(t,h.data)?.handleIndices,v=on(r,m.data)?.handleIndices;if(!x||!v)return{validation:{isValid:!1,reason:"Source or target handle not found"}};const b=LL(i,h,m,x,v);if(!b.validation.isValid)return b;let S={isValid:!0};if(i.enableTypeInference){const{validation:N}=jL(i,f,g,x,v,u,s,a,l);S=N}if(i.enableComplexTypeChecking&&S.isValid){const{validation:N}=$L({...i,nodes:i.nodes},f,g,x,v,u);S=N}if(i.allowedConversionsBetweenDataTypes&&S.isValid){const{validation:N}=HL({...i,nodes:i.nodes},f,g,x,v,u);S=N}return S.isValid?(i.edges.push(u),{validation:S}):{validation:S}}function cw(e,t,n){if(ls([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:ls([n],t.edges),validation:{isValid:!0}};const i=t.nodes.findIndex(h=>h.id===e.source),s=t.nodes.findIndex(h=>h.id===e.target);if(i===-1||s===-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 a=t.nodes[i],l=t.nodes[s],u=on(e.sourceHandle,a.data)?.handleIndices,d=on(e.targetHandle,l.data)?.handleIndices;if(!u||!d)return{updatedNodes:t.nodes,updatedEdges:t.edges,validation:{isValid:!1,reason:"Source or target handle not found"}};let f=t.nodes,g={isValid:!0};if(t.enableTypeInference){const{updatedNodes:h,validation:m}=BL(t,i,s,u,d,e);f=h,g=m}return{updatedNodes:f,updatedEdges:ls([n],t.edges),validation:g}}function lo(e,t=!1){const n=e?.dataType,r=e?.inferredDataType;if(n)return n.dataTypeObject.underlyingType!=="inferFromConnection"?n:r||(t?n:void 0)}function lw(e,t,n){const r=e.nodes.find(s=>s.id===n);if(!r)return!1;if(r.id===t)return!0;const i=(s,a=new Set)=>{if(a.has(s.id))return!1;a.add(s.id);for(const l of Qi(s,e.nodes,e.edges))if(l.id===t||i(l,a))return!0;return!1};return i(r)}function uw(e,t,n,r,i,s){const a=[],l=[];for(const u of t.nodes){if(u.data.nodeTypeUniqueId!==n){a.push(u);continue}co(u.data,i,0,Tr(r,e),void 0,s),a.push(u)}for(const u of t.edges)l.push(u);return{...t,nodes:a,edges:l}}function dw(e,t,n,r,i="before"){const s=e.typeOfNodes[t];if(!s)return e;co(s,r,0,n,void 0,i);const a=af(e,t);for(const d of a){const f=e.typeOfNodes[d];f&&f.subtree&&(e.typeOfNodes[d]={...f,subtree:{...f.subtree,...uw(e.dataTypes,f.subtree,t,n,r,i)}})}const{nodes:l,edges:u}=uw(e.dataTypes,{nodes:e.nodes,edges:e.edges},t,n,r,i);return{typeOfNodes:e.typeOfNodes,nodes:l,edges:u}}const ys=20,dt=["ADD_NODE","ADD_NODE_AND_SELECT","UPDATE_NODE_BY_REACT_FLOW","UPDATE_EDGES_BY_REACT_FLOW","ADD_EDGE_BY_REACT_FLOW","UPDATE_INPUT_VALUE","OPEN_NODE_GROUP","CLOSE_NODE_GROUP","ADD_NODE_GROUP","SET_VIEWPORT","REPLACE_STATE"],ft={[dt[0]]:dt[0],[dt[1]]:dt[1],[dt[2]]:dt[2],[dt[3]]:dt[3],[dt[4]]:dt[4],[dt[5]]:dt[5],[dt[6]]:dt[6],[dt[7]]:dt[7],[dt[8]]:dt[8],[dt[9]]:dt[9],[dt[10]]:dt[10]};function fw(e,t){return Bi(e,r=>{switch(t.type){case ft.ADD_NODE:const i=t.payload.type,s=rn(ys),a=t.payload.position,l=ps(r.dataTypes,i,r.typeOfNodes,s,a);r=so(r,[...Mt(r).nodes,l]);break;case ft.ADD_NODE_AND_SELECT:const u=t.payload.type,d=rn(ys),f=t.payload.position,g=ps(r.dataTypes,u,r.typeOfNodes,d,f);r=so(r,Mt(r).nodes.map(E=>({...E,selected:!1}))),r=so(r,[...Mt(r).nodes,{...g,selected:!0}]);break;case ft.UPDATE_NODE_BY_REACT_FLOW:const h=t.payload.changes;for(const E of h)r=so(r,s0([E],Mt(r).nodes));break;case ft.UPDATE_EDGES_BY_REACT_FLOW:const m=t.payload.changes;for(const E of m){if(E.type!=="remove"){r=so(r,void 0,ls([E],Mt(r).edges));continue}const{id:P}=E,L=Mt(r).edges.find(O=>O.id===P);if(!L)continue;const j=cw(L,{...r,nodes:Mt(r).nodes,edges:Mt(r).edges},E);j.validation.isValid&&(r=so(r,j.updatedNodes,j.updatedEdges))}break;case ft.ADD_EDGE_BY_REACT_FLOW:const x=t.payload.edge,{sourceHandle:v,targetHandle:b,source:S,target:N}=x,w=Mt(r);if(r.enableCycleChecking&&lw({...r,nodes:w.nodes,edges:w.edges},S,N)||!S||!N||!v||!b)break;const I=Mt(r);if(!aw(S,v,N,b,{...r,nodes:I.nodes,edges:I.edges},I.inputNodeId,I.outputNodeId,r).validation.isValid)break;break;case ft.OPEN_NODE_GROUP:if("nodeId"in t.payload){const E=t.payload.nodeId,P=Mt(r).nodes.find(O=>O.id===E);if(!P)break;const L=P.data.nodeTypeUniqueId;if(!L)break;const j=r.typeOfNodes[L];if(!j||!j.subtree)break;r.openedNodeGroupStack=[...r.openedNodeGroupStack||[],{nodeType:L,nodeId:E,previousViewport:r.viewport}]}else{const E=t.payload.nodeType,P=r.typeOfNodes[E];if(!P||!P.subtree)break;r.openedNodeGroupStack=[{nodeType:E,previousViewport:r.openedNodeGroupStack?.[0]?.previousViewport||r.viewport}]}r.viewport=void 0;break;case ft.CLOSE_NODE_GROUP:const A=r.openedNodeGroupStack?.[r.openedNodeGroupStack.length-1];A&&"previousViewport"in A&&(r.viewport=A.previousViewport),r.openedNodeGroupStack=r.openedNodeGroupStack?.slice(0,-1);break;case ft.ADD_NODE_GROUP:const M=rn(ys),B=rn(ys),U=ps(r.dataTypes,Te.groupInput,r.typeOfNodes,B,{x:-500,y:0}),q=rn(ys),D=ps(r.dataTypes,Te.groupOutput,r.typeOfNodes,q,{x:500,y:0}),F={name:"Node Group "+(Object.keys(r.typeOfNodes).filter(E=>r.typeOfNodes[E].subtree).length+1).toString(),headerColor:"#344621",...ow,inputs:[],outputs:[],subtree:{nodes:[U,D],edges:[],numberOfReferences:0,inputNodeId:B,outputNodeId:q}};r.typeOfNodes[M]=F,r.openedNodeGroupStack=[{nodeType:M,previousViewport:r.openedNodeGroupStack?.[0]?.previousViewport||r.viewport}],r.viewport=void 0;break;case ft.SET_VIEWPORT:r.viewport=t.payload.viewport;break;case ft.REPLACE_STATE:return t.payload.state}})}function Ee(e,t,n="error"){return{path:e,message:t,severity:n}}function Pe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function pw(e){const t=[];if(!Pe(e))return t.push(Ee("","Root must be an object")),t;if(e.version!==1&&t.push(Ee("version",`Expected version 1, got ${JSON.stringify(e.version)}`)),typeof e.exportedAt!="string"&&t.push(Ee("exportedAt","Expected ISO date string","warning")),!Pe(e.state))return t.push(Ee("state","Expected state object")),t;const n=e.state;if(!Pe(n.dataTypes))t.push(Ee("state.dataTypes","Expected dataTypes object"));else for(const[r,i]of Object.entries(n.dataTypes)){if(!Pe(i)){t.push(Ee(`state.dataTypes.${r}`,"Expected data type object"));continue}typeof i.name!="string"&&t.push(Ee(`state.dataTypes.${r}.name`,"Expected string name")),typeof i.underlyingType!="string"&&t.push(Ee(`state.dataTypes.${r}.underlyingType`,"Expected string underlyingType"))}if(!Pe(n.typeOfNodes))t.push(Ee("state.typeOfNodes","Expected typeOfNodes object"));else for(const[r,i]of Object.entries(n.typeOfNodes)){if(!Pe(i)){t.push(Ee(`state.typeOfNodes.${r}`,"Expected node type object"));continue}const s=i;typeof s.name!="string"&&t.push(Ee(`state.typeOfNodes.${r}.name`,"Expected string name")),Array.isArray(s.inputs)||t.push(Ee(`state.typeOfNodes.${r}.inputs`,"Expected inputs array")),Array.isArray(s.outputs)||t.push(Ee(`state.typeOfNodes.${r}.outputs`,"Expected outputs array"))}if(!Array.isArray(n.nodes))t.push(Ee("state.nodes","Expected nodes array"));else{const r=new Set;for(let i=0;i<n.nodes.length;i++){const s=n.nodes[i],a=`state.nodes[${i}]`;if(!Pe(s)){t.push(Ee(a,"Expected node object"));continue}const l=s;if(typeof l.id!="string"?t.push(Ee(`${a}.id`,"Expected string id")):(r.has(l.id)&&t.push(Ee(`${a}.id`,`Duplicate node ID: "${l.id}"`,"warning")),r.add(l.id)),typeof l.type!="string"&&l.type!==void 0&&t.push(Ee(`${a}.type`,"Expected string type")),!Pe(l.position))t.push(Ee(`${a}.position`,"Expected position object"));else{const u=l.position;typeof u.x!="number"&&t.push(Ee(`${a}.position.x`,"Expected number x")),typeof u.y!="number"&&t.push(Ee(`${a}.position.y`,"Expected number y"))}}}if(!Array.isArray(n.edges))t.push(Ee("state.edges","Expected edges array"));else{const r=new Set,i=new Set;if(Array.isArray(n.nodes))for(const s of n.nodes)Pe(s)&&typeof s.id=="string"&&i.add(s.id);for(let s=0;s<n.edges.length;s++){const a=n.edges[s],l=`state.edges[${s}]`;if(!Pe(a)){t.push(Ee(l,"Expected edge object"));continue}const u=a;typeof u.id!="string"?t.push(Ee(`${l}.id`,"Expected string id")):(r.has(u.id)&&t.push(Ee(`${l}.id`,`Duplicate edge ID: "${u.id}"`,"warning")),r.add(u.id)),typeof u.source!="string"?t.push(Ee(`${l}.source`,"Expected string source")):i.size>0&&!i.has(u.source)&&t.push(Ee(`${l}.source`,`Source node "${u.source}" not found`,"warning")),typeof u.target!="string"?t.push(Ee(`${l}.target`,"Expected string target")):i.size>0&&!i.has(u.target)&&t.push(Ee(`${l}.target`,`Target node "${u.target}" not found`,"warning")),typeof u.sourceHandle!="string"&&t.push(Ee(`${l}.sourceHandle`,"Expected string sourceHandle")),typeof u.targetHandle!="string"&&t.push(Ee(`${l}.targetHandle`,"Expected string targetHandle"))}}return t}const hw=["completed","errored","cancelled"],gw=["completed","errored","skipped"];function mw(e){const t=[];if(!Pe(e))return t.push(Ee("","Root must be an object")),t;if(e.version!==1&&t.push(Ee("version",`Expected version 1, got ${JSON.stringify(e.version)}`)),typeof e.exportedAt!="string"&&t.push(Ee("exportedAt","Expected ISO date string","warning")),!Pe(e.record))return t.push(Ee("record","Expected record object")),t;const n=e.record;if(typeof n.id!="string"&&t.push(Ee("record.id","Expected string id")),typeof n.startTime!="number"&&t.push(Ee("record.startTime","Expected number startTime")),typeof n.endTime!="number"&&t.push(Ee("record.endTime","Expected number endTime")),typeof n.totalDuration!="number"&&t.push(Ee("record.totalDuration","Expected number totalDuration")),(typeof n.status!="string"||!hw.includes(n.status))&&t.push(Ee("record.status",`Expected one of: ${hw.join(", ")}`)),!Array.isArray(n.steps))t.push(Ee("record.steps","Expected steps array"));else for(let r=0;r<n.steps.length;r++){const i=n.steps[r],s=`record.steps[${r}]`;if(!Pe(i)){t.push(Ee(s,"Expected step object"));continue}const a=i;typeof a.stepIndex!="number"&&t.push(Ee(`${s}.stepIndex`,"Expected number stepIndex")),typeof a.nodeId!="string"&&t.push(Ee(`${s}.nodeId`,"Expected string nodeId")),typeof a.nodeTypeId!="string"&&t.push(Ee(`${s}.nodeTypeId`,"Expected string nodeTypeId")),(typeof a.status!="string"||!gw.includes(a.status))&&t.push(Ee(`${s}.status`,`Expected one of: ${gw.join(", ")}`)),Pe(a.inputValues)||t.push(Ee(`${s}.inputValues`,"Expected inputValues object")),Pe(a.outputValues)||t.push(Ee(`${s}.outputValues`,"Expected outputValues object"))}return Array.isArray(n.errors)||t.push(Ee("record.errors","Expected errors array","warning")),Array.isArray(n.concurrencyLevels)||t.push(Ee("record.concurrencyLevels","Expected concurrencyLevels array","warning")),n.loopRecords!==void 0&&!Pe(n.loopRecords)&&t.push(Ee("record.loopRecords","Expected loopRecords object","warning")),n.groupRecords!==void 0&&!Pe(n.groupRecords)&&t.push(Ee("record.groupRecords","Expected groupRecords object","warning")),n.finalValues!==void 0&&!Pe(n.finalValues)&&t.push(Ee("record.finalValues","Expected finalValues object","warning")),t}function hf(e){const t={};for(const[n,r]of e)t[n]=r;return t}function vs(e){const t=new Map;if(e==null)return t;for(const[n,r]of Object.entries(e))t.set(n,r);return t}function Vn(e){if(e==null)return e;const t=typeof e;if(t==="string"||t==="number"||t==="boolean")return e;if(t==="function")return"[Function]";if(t==="symbol")return`[Symbol: ${e.toString()}]`;if(t==="bigint")return e.toString();if(e instanceof Map){const n={};for(const[r,i]of e)n[String(r)]=Vn(i);return n}if(e instanceof Set)return[...e].map(Vn);if(e instanceof Error)return{__type:"Error",name:e.name,message:e.message,stack:e.stack};if(Array.isArray(e))return e.map(Vn);if(Pe(e)){const n={};for(const[r,i]of Object.entries(e))n[r]=Vn(i);return n}return String(e)}function gf(e){return{...e,path:[...e.path],originalError:Vn(e.originalError)}}function mf(e){return{...e,path:Array.isArray(e.path)?e.path:[],originalError:e.originalError}}function FL(e){return{...e,connections:e.connections.map(t=>({...t,value:Vn(t.value)})),defaultValue:Vn(e.defaultValue)}}function zL(e){return{...e,value:Vn(e.value)}}function yw(e){const t={};for(const[r,i]of e.inputValues)t[r]=FL(i);const n={};for(const[r,i]of e.outputValues)n[r]=zL(i);return{...e,inputValues:t,outputValues:n,error:e.error?gf(e.error):void 0}}function vw(e){return{...e,inputValues:vs(e.inputValues??{}),outputValues:vs(e.outputValues??{}),error:e.error?mf(e.error):void 0}}function UL(e){const t={};for(const[n,r]of e.nestedLoopRecords)t[n]=xw(r);return{...e,stepRecords:e.stepRecords.map(yw),nestedLoopRecords:Object.keys(t).length>0?t:void 0}}function WL(e){const t=new Map;if(e.nestedLoopRecords)for(const[n,r]of Object.entries(e.nestedLoopRecords))t.set(n,ww(r));return{...e,stepRecords:(e.stepRecords??[]).map(n=>vw(n)),nestedLoopRecords:t}}function xw(e){return{...e,iterations:e.iterations.map(UL)}}function ww(e){return{...e,iterations:(e.iterations??[]).map(t=>WL(t))}}function GL(e){return{...e,innerRecord:yf(e.innerRecord),inputMapping:hf(e.inputMapping),outputMapping:hf(e.outputMapping)}}function qL(e){return{...e,innerRecord:vf(e.innerRecord),inputMapping:vs(e.inputMapping??{}),outputMapping:vs(e.outputMapping??{})}}function yf(e){const t={};for(const[i,s]of e.loopRecords)t[i]=xw(s);const n={};for(const[i,s]of e.groupRecords)n[i]=GL(s);const r={};for(const[i,s]of e.finalValues)r[i]=Vn(s);return{id:e.id,startTime:e.startTime,endTime:e.endTime,totalDuration:e.totalDuration,compilationDuration:e.compilationDuration,totalPauseDuration:e.totalPauseDuration,status:e.status,steps:e.steps.map(yw),errors:e.errors.map(gf),concurrencyLevels:[...e.concurrencyLevels],loopRecords:t,groupRecords:n,finalValues:r,...e.viewState?{viewState:e.viewState}:{}}}function vf(e){const t=new Map;if(e.loopRecords)for(const[i,s]of Object.entries(e.loopRecords))t.set(i,ww(s));const n=new Map;if(e.groupRecords)for(const[i,s]of Object.entries(e.groupRecords))n.set(i,qL(s));const r=new Map;if(e.finalValues)for(const[i,s]of Object.entries(e.finalValues))r.set(i,s);return{id:e.id,startTime:e.startTime,endTime:e.endTime,totalDuration:e.totalDuration,compilationDuration:e.compilationDuration??0,totalPauseDuration:e.totalPauseDuration??0,status:e.status,steps:(e.steps??[]).map(i=>vw(i)),errors:(e.errors??[]).map(i=>mf(i)),concurrencyLevels:e.concurrencyLevels??[],loopRecords:t,groupRecords:n,finalValues:r,...e.viewState?{viewState:e.viewState}:{}}}function YL(e){if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e,(t,n)=>{if(typeof n!="function"&&typeof n!="symbol")return n}))}function xf(e){const{complexSchema:t,...n}=e;return n}function Hc(e){const t={...e};delete t.onChange;const n=t.dataType;Pe(n)&&Pe(n.dataTypeObject)&&(t.dataType={...n,dataTypeObject:xf(n.dataTypeObject)});const r=t.inferredDataType;return Pe(r)&&Pe(r.dataTypeObject)&&(t.inferredDataType={...r,dataTypeObject:xf(r.dataTypeObject)}),t}function wf(e,t){const n=e.dataType;if(Pe(n)){const i=n.dataTypeUniqueId;typeof i=="string"&&Pe(t[i])&&(e.dataType={...n,dataTypeObject:t[i]})}const r=e.inferredDataType;if(Pe(r)){const i=r.dataTypeUniqueId;typeof i=="string"&&Pe(t[i])&&(e.inferredDataType={...r,dataTypeObject:t[i]})}return e}function XL(e){return typeof e.id=="string"&&typeof e.status=="string"&&Array.isArray(e.steps)&&Array.isArray(e.errors)}function bw(e,t){const n=YL(e);if(n.dataTypes)for(const i of Object.keys(n.dataTypes))n.dataTypes[i]=xf(n.dataTypes[i]);if(n.typeOfNodes)for(const i of Object.keys(n.typeOfNodes)){const s=n.typeOfNodes[i];s.inputs&&(s.inputs=s.inputs.map(Sw)),s.outputs&&(s.outputs=s.outputs.map(Hc)),s.subtree?.nodes&&(s.subtree.nodes=s.subtree.nodes.map(_w))}n.nodes&&(n.nodes=n.nodes.map(_w));const r={version:1,exportedAt:new Date().toISOString(),state:n};return JSON.stringify(r,null,t?.pretty?2:void 0)}function Sw(e){return e.inputs&&Array.isArray(e.inputs)?{...e,inputs:e.inputs.map(Hc)}:Hc(e)}function _w(e){if(!e.data)return e;const t={...e.data};return t.inputs&&Array.isArray(t.inputs)&&(t.inputs=t.inputs.map(Sw)),t.outputs&&Array.isArray(t.outputs)&&(t.outputs=t.outputs.map(Hc)),{...e,data:t}}function Nw(e,t){const n=yf(e),r={version:1,exportedAt:new Date().toISOString(),record:n};return JSON.stringify(r,null,t?.pretty?2:void 0)}function KL(e){return"nodes"in e&&"edges"in e&&"dataTypes"in e&&"typeOfNodes"in e}function ZL(e,t){if(!Pe(e.data))return e;const n={...e.data};if(Array.isArray(n.inputs)){const r=n.inputs;n.inputs=r.map(i=>{if(!Pe(i))return i;if(Array.isArray(i.inputs)){const s=i.inputs;return{...i,inputs:s.map(a=>Pe(a)?wf(a,t):a)}}return wf(i,t)})}if(Array.isArray(n.outputs)){const r=n.outputs;n.outputs=r.map(i=>Pe(i)?wf(i,t):i)}return{...e,data:n}}function Iw(e,t){const n=[],r=[];let i;try{i=JSON.parse(e)}catch(g){const h=g instanceof Error?g.message:String(g);return r.push({path:"",message:`Invalid JSON: ${h}`,severity:"error"}),{success:!1,errors:r,warnings:n}}const s=pw(i);for(const g of s)t.onValidationError?.(g),g.severity==="error"?r.push(g):n.push(g);const a=t.repair??{},l=Object.values(a).some(Boolean);if(r.length>0&&!l)return{success:!1,errors:r,warnings:n};if(!Pe(i))return{success:!1,errors:[{path:"",message:"Root must be an object",severity:"error"}],warnings:n};const u=i.state;if(!Pe(u))return{success:!1,errors:[{path:"state",message:"Missing state object",severity:"error"}],warnings:n};if(a.removeDuplicateNodeIds&&Array.isArray(u.nodes)){const g=new Set,h=u.nodes;u.nodes=h.filter(m=>!Pe(m)||typeof m.id!="string"?!0:g.has(m.id)?!1:(g.add(m.id),!0))}if(a.removeDuplicateEdgeIds&&Array.isArray(u.edges)){const g=new Set,h=u.edges;u.edges=h.filter(m=>!Pe(m)||typeof m.id!="string"?!0:g.has(m.id)?!1:(g.add(m.id),!0))}if(a.removeOrphanEdges&&Array.isArray(u.nodes)&&Array.isArray(u.edges)){const g=new Set,h=u.nodes;for(const S of h)Pe(S)&&typeof S.id=="string"&&g.add(S.id);const m=u.edges,x=m.length,v=m.filter(S=>Pe(S)&&typeof S.source=="string"&&typeof S.target=="string"&&g.has(S.source)&&g.has(S.target));u.edges=v;const b=x-v.length;b>0&&n.push({path:"state.edges",message:`Removed ${b} orphan edge(s)`,severity:"warning"})}a.fillMissingDefaults&&u.viewport===void 0&&(u.viewport={x:0,y:0,zoom:1});const d=t.dataTypes;if(Pe(u.dataTypes))for(const g of Object.keys(u.dataTypes)){const h=d[g],m=u.dataTypes[g];h&&Pe(h)&&Pe(m)&&"complexSchema"in h&&h.complexSchema&&(m.complexSchema=h.complexSchema)}if(Array.isArray(u.nodes)){const g=u.nodes;u.nodes=g.map(h=>Pe(h)?ZL(h,d):h)}const f=r.filter(g=>!(a.removeDuplicateNodeIds&&g.message.includes("Duplicate node ID")||a.removeDuplicateEdgeIds&&g.message.includes("Duplicate edge ID")||a.removeOrphanEdges&&g.message.includes("not found")||a.fillMissingDefaults&&g.path.includes("viewport")));return f.length>0?{success:!1,errors:f,warnings:n}:KL(u)?{success:!0,data:u,warnings:n}:{success:!1,errors:[{path:"state",message:"Invalid state structure",severity:"error"}],warnings:n}}function Ew(e,t){const n=[],r=[];let i;try{i=JSON.parse(e)}catch(g){const h=g instanceof Error?g.message:String(g);return r.push({path:"",message:`Invalid JSON: ${h}`,severity:"error"}),{success:!1,errors:r,warnings:n}}const s=mw(i);for(const g of s)t?.onValidationError?.(g),g.severity==="error"?r.push(g):n.push(g);const a=t?.repair??{},l=Object.values(a).some(Boolean);if(r.length>0&&!l)return{success:!1,errors:r,warnings:n};if(!Pe(i))return{success:!1,errors:[{path:"",message:"Root must be an object",severity:"error"}],warnings:n};const u=i.record;if(!Pe(u))return{success:!1,errors:[{path:"record",message:"Missing record object",severity:"error"}],warnings:n};if(a.removeOrphanSteps&&Array.isArray(u.steps)){const g=u.steps,h=g.filter(x=>Pe(x)&&typeof x.nodeId=="string"&&typeof x.nodeTypeId=="string"&&typeof x.stepIndex=="number"),m=g.length-h.length;m>0&&(u.steps=h,n.push({path:"record.steps",message:`Removed ${m} malformed step(s)`,severity:"warning"}))}a.sanitizeNonSerializableValues&&Array.isArray(u.steps);const d=r.filter(g=>!(a.removeOrphanSteps&&g.path.includes("steps")));return d.length>0?{success:!1,errors:d,warnings:n}:XL(u)?{success:!0,data:vf(u),warnings:n}:{success:!1,errors:[{path:"record",message:"Record structure does not match expected shape",severity:"error"}],warnings:n}}function on(e,t,n=!0,r=!0){if(n){const i=t?.inputs instanceof Array?t?.inputs:[],a=ao(i,"input").find(({value:l})=>l?.id===e);if(a)return a}if(r){const i=t?.outputs instanceof Array?t?.outputs:[],a=ao(i,"output").find(({value:l})=>l?.id===e);if(a)return a}}function bt(e,t){if(!e)return;const n=e.type==="input"?t.inputs:t.outputs;if(!n)return;const i=ao(n,e.type,{index1:e.index1,index2:e.index2}).next();return i.value&&i.value.handleIndices.index1===e.index1&&i.value.handleIndices.index2===e.index2?i.value:{value:void 0,handleIndices:e,parentArray:n,parentArrayIndex:i.value.parentArrayIndex}}function xs(e,t=!0,n=!0){let r=[],i=[];return t&&e.inputs&&(r=Array.from(ao(e.inputs,"input"))),n&&e.outputs&&(i=Array.from(ao(e.outputs,"output"))),{inputsAndIndices:r,outputsAndIndices:i}}const uo=T.createContext(null),bf=T.createContext({executionRecord:null,setExecutionRecord:()=>{}});function Tw(){return T.useContext(bf)}function JL(e){const[t,n]=T.useReducer(fw,e);return{state:t,dispatch:n}}function Sf(e,t,n,r){return{allProps:e,nodeRunnerStates:t,selectedStepRecord:n,edgeValuesAnimated:r}}const Cw=12;function QL(e){return e===void 0?"undefined":e===null?"null":typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):typeof e=="string"?e.length>Cw?`"${e.slice(0,Cw-1)}…"`:`"${e}"`:e instanceof Map?`Map(${e.size})`:Array.isArray(e)?`[${e.length}]`:typeof e=="object"?`{${Object.keys(e).length}}`:String(e)}const _f=T.forwardRef(({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,...l},u)=>{const[d,f,g]=bc({sourceX:t,sourceY:n,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),h=rt(),[m,x]=T.useState(!0),v=T.useRef(null);T.useEffect(()=>{const O=h.getState().domNode;if(!O)return;const W=document.getElementById(e);if(!W)return;const z=new IntersectionObserver(Y=>{const J=Y.find(ie=>ie.target.id===e);J&&x(ie=>J.isIntersecting)},{root:O,threshold:1,rootMargin:"20px"});return z.observe(W),v.current=z,()=>{v.current&&(v.current.disconnect(),v.current=null)}},[h.getState().domNode]);const b=of(l.source||""),S=T.useMemo(()=>!l.source||!b?void 0:on(l.sourceHandleId||"",b?.data)?.value?.handleColor??"#A1A1A1",[l.source,b]),N=of(l.target||""),w=T.useMemo(()=>!l.target||!N?void 0:on(l.targetHandleId||"",N?.data)?.value?.handleColor??"#A1A1A1",[l.target,N]),{label:I,labelStyle:k,markerStart:A,markerEnd:M,interactionWidth:B}=l,U=T.useContext(uo),q=T.useMemo(()=>{const O=U?.selectedStepRecord;if(!O||l.target!==O.nodeId)return{found:!1};for(const[,W]of O.inputValues)for(const z of W.connections)if(z.sourceNodeId===l.source&&z.sourceHandleId===(l.sourceHandleId??""))return{found:!0,value:z.value};return{found:!1}},[U?.selectedStepRecord,l.target,l.source,l.sourceHandleId]),D=T.useMemo(()=>{const O=U?.selectedStepRecord;if(!O||l.source!==O.nodeId||!b?.data)return{found:!1};const W=on(l.sourceHandleId||"",b.data,!1);if(!W)return{found:!1};const z=O.outputValues.get(W.value.name);return z?{found:!0,value:z.value}:{found:!1}},[U?.selectedStepRecord,l.source,l.sourceHandleId,b]),$=q.found?q:D,F=U?.edgeValuesAnimated??!0,E=$.found?QL($.value):null,P=E?.length??0,L=Math.max(40,P*7.5+20),j=22;return y.jsxs(y.Fragment,{children:[y.jsx("defs",{children:y.jsxs("linearGradient",{id:`linear-gradient-edge-${e}`,x1:t,y1:n,x2:r,y2:i,gradientUnits:"userSpaceOnUse",children:[y.jsx("stop",{stopColor:S,offset:"0"}),y.jsx("stop",{stopColor:w,offset:"1"})]})}),y.jsx(Jo,{id:e,path:d,label:I,labelStyle:k,markerEnd:M,markerStart:A,interactionWidth:B,className:ye("stroke-7! in-[g.selected]:brightness-150",!m&&"opacity-25",E!==null&&"animate-[edge-brightness-pulse_1.5s_ease-in-out_infinite]"),style:{stroke:`url(#${`linear-gradient-edge-${e}`})`},focusable:!0}),E!==null&&y.jsx(y.Fragment,{children:F?y.jsxs("g",{pointerEvents:"none",children:[y.jsx("animateMotion",{dur:"2.5s",repeatCount:"indefinite",path:d}),y.jsx("rect",{x:-L/2,y:-j/2,width:L,height:j,rx:6,fill:"#282828",stroke:"#444444",strokeWidth:1}),y.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#e6e6e6",fontSize:11,fontFamily:"var(--font-main)",children:E})]}):y.jsxs("g",{transform:`translate(${f}, ${g})`,pointerEvents:"none",children:[y.jsx("rect",{x:-L/2,y:-j/2,width:L,height:j,rx:6,fill:"#282828",stroke:"#444444",strokeWidth:1}),y.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#e6e6e6",fontSize:11,fontFamily:"var(--font-main)",children:E})]})})]})});_f.displayName="ConfigurableEdge";function Aw(e,t,n=!0,r=!1){const i=e!==null?"current"in e?e.current:e:null,s=T.useCallback(a=>{if(!i)return;let l=!0;if(n&&a.target instanceof Node&&!i.contains(a.target))l=!1;else if(r){const u="clientX"in a?{x:a.clientX,y:a.clientY}:{x:a.touches[0].clientX,y:a.touches[0].clientY},d=i.getBoundingClientRect();Wy(u,d)||(l=!1)}l||t()},[i,t,n,r]);T.useEffect(()=>(document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}),[i,s])}const ws=T.forwardRef(({placeholder:e="Input",className:t,...n},r)=>{const i=T.useMemo(()=>n.allowOnlyNumbers&&n.value!==void 0?sd(n.value,n.numberOfDecimals??5):n.value?.toString(),[n.value,n.allowOnlyNumbers,n.numberOfDecimals]),[s,a]=T.useState(i??""),[l,u]=T.useState(null),d=n.value??s,[f,g]=T.useState(d.toString());function h(x){n.allowOnlyNumbers&&/[^0-9\.\-]/.test(x)||g(x)}function m(){if(n.allowOnlyNumbers){const x=Gy(f||d.toString()),v=sd(x,n.numberOfDecimals??5);a(v),n.onChange?.(x),g(v)}else a(f),n.onChange?.(f),g(f)}return Aw(l,()=>m()),y.jsx("input",{type:"text",className:ye("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:x=>{u(x),typeof r=="function"?r(x):r&&(r.current=x)},value:f,onChange:x=>h(x.target.value),onKeyDown:x=>{x.key==="Enter"&&m()},onMouseMove:x=>{x.preventDefault(),x.stopPropagation()},onBlur:x=>{x.preventDefault(),x.stopPropagation(),m()}})});ws.displayName="Input";function kw({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:r,lineClassName:i,lineStyle:s,color:a,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:g=!1,autoScale:h=!0,shouldResize:m,onResizeStart:x,onResize:v,onResizeEnd:b,linePosition:S=["left","right"],handlePosition:N=[],resizeDirection:w="horizontal"}){return t?y.jsxs(y.Fragment,{children:[S.map(I=>y.jsx(Z0,{className:ye("!border-none",I==="left"||I==="right"?"!w-4":"!h-4",i),style:s,nodeId:e,position:I,variant:oo.Line,color:a,minWidth:l,minHeight:u,maxWidth:d,maxHeight:f,onResizeStart:x,keepAspectRatio:g,autoScale:h,shouldResize:m,onResize:v,onResizeEnd:b,resizeDirection:w},I)),N.map(I=>y.jsx(Z0,{className:n,style:r,nodeId:e,position:I,color:a,minWidth:l,minHeight:u,maxWidth:d,maxHeight:f,onResizeStart:x,keepAspectRatio:g,autoScale:h,shouldResize:m,onResize:v,onResizeEnd:b,resizeDirection:w},I))]}):null}/*!
298
+ * tabbable 6.2.0
299
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
300
+ */var e2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Nf=e2.join(","),Mw=typeof Element>"u",bs=Mw?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Bc=!Mw&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Vc=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=i===""||i==="true",a=s||n&&t&&e(t.parentNode);return a},t2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},n2=function(t,n,r){if(Vc(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Nf));return n&&bs.call(t,Nf)&&i.unshift(t),i=i.filter(r),i},r2=function e(t,n,r){for(var i=[],s=Array.from(t);s.length;){var a=s.shift();if(!Vc(a,!1))if(a.tagName==="SLOT"){var l=a.assignedElements(),u=l.length?l:a.children,d=e(u,!0,r);r.flatten?i.push.apply(i,d):i.push({scopeParent:a,candidates:d})}else{var f=bs.call(a,Nf);f&&r.filter(a)&&(n||!t.includes(a))&&i.push(a);var g=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),h=!Vc(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(g&&h){var m=e(g===!0?a.children:g.children,!0,r);r.flatten?i.push.apply(i,m):i.push({scopeParent:a,candidates:m})}else s.unshift.apply(s,a.children)}}return i},Ow=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Pw=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t2(t))&&!Ow(t)?0:t.tabIndex},o2=function(t,n){var r=Pw(t);return r<0&&n&&!Ow(t)?0:r},i2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Rw=function(t){return t.tagName==="INPUT"},s2=function(t){return Rw(t)&&t.type==="hidden"},a2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},c2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},l2=function(t){if(!t.name)return!0;var n=t.form||Bc(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var s=c2(i,t.form);return!s||s===t},u2=function(t){return Rw(t)&&t.type==="radio"},d2=function(t){return u2(t)&&!l2(t)},f2=function(t){var n,r=t&&Bc(t),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var a,l,u;for(s=!!((a=i)!==null&&a!==void 0&&(l=a.ownerDocument)!==null&&l!==void 0&&l.contains(i)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!s&&i;){var d,f,g;r=Bc(i),i=(d=r)===null||d===void 0?void 0:d.host,s=!!((f=i)!==null&&f!==void 0&&(g=f.ownerDocument)!==null&&g!==void 0&&g.contains(i))}}return s},Lw=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},p2=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=bs.call(t,"details>summary:first-of-type"),a=s?t.parentElement:t;if(bs.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var l=t;t;){var u=t.parentElement,d=Bc(t);if(u&&!u.shadowRoot&&i(u)===!0)return Lw(t);t.assignedSlot?t=t.assignedSlot:!u&&d!==t.ownerDocument?t=d.host:t=u}t=l}if(f2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Lw(t);return!1},h2=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return bs.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},g2=function(t,n){return!(n.disabled||Vc(n)||s2(n)||p2(n,t)||a2(n)||h2(n))},Dw=function(t,n){return!(d2(n)||Pw(n)<0||!g2(t,n))},m2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},y2=function e(t){var n=[],r=[];return t.forEach(function(i,s){var a=!!i.scopeParent,l=a?i.scopeParent:i,u=o2(l,a),d=a?e(i.candidates):l;u===0?a?n.push.apply(n,d):n.push(l):r.push({documentOrder:s,tabIndex:u,item:i,isScope:a,content:d})}),r.sort(i2).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},jw=function(t,n){n=n||{};var r;return n.getShadowRoot?r=r2([t],n.includeContainer,{filter:Dw.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:m2}):r=n2(t,n.includeContainer,Dw.bind(null,n)),y2(r)};function v2(){return/apple/i.test(navigator.vendor)}function x2(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Fc(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Lu(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Ss(e){return"composedPath"in e?e.composedPath()[0]:e.target}function If(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 w2(e){return e.matches("html,body")}function sr(e){return e?.ownerDocument||document}function zc(e,t,n){return n===void 0&&(n=!0),e.filter(i=>{var s;return i.parentId===t&&(!n||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...zc(e,i.id,n)])}function b2(e){return"nativeEvent"in e}function Ef(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var S2=typeof document<"u",_2=function(){},Xt=S2?T.useLayoutEffect:_2;const N2={...V};function Ar(e){const t=V.useRef(e);return Xt(()=>{t.current=e}),t}const I2=N2.useInsertionEffect||(e=>e());function Fn(e){const t=V.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return I2(()=>{t.current=e}),V.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}const $w=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Hw(e,t){const n=jw(e,$w()),r=n.length;if(r===0)return;const i=x2(sr(e)),s=n.indexOf(i),a=s===-1?t===1?0:r-1:s+t;return n[a]}function E2(e){return Hw(sr(e).body,1)||e}function T2(e){return Hw(sr(e).body,-1)||e}function Tf(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Fc(n,r)}function C2(e){jw(e,$w()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Bw(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const A2="data-floating-ui-focusable",Vw="active",Fw="selected",k2={...V};let zw=!1,M2=0;const Uw=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+M2++;function O2(){const[e,t]=V.useState(()=>zw?Uw():void 0);return Xt(()=>{e==null&&t(Uw())},[]),V.useEffect(()=>{zw=!0},[]),e}const Cf=k2.useId||O2;let _s;process.env.NODE_ENV!=="production"&&(_s=new Set);function P2(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=_s)!=null&&e.has(i))){var s;(s=_s)==null||s.add(i),console.warn(i)}}function R2(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=_s)!=null&&e.has(i))){var s;(s=_s)==null||s.add(i),console.error(i)}}const Ww=V.forwardRef(function(t,n){const{context:{placement:r,elements:{floating:i},middlewareData:{arrow:s,shift:a}},width:l=14,height:u=7,tipRadius:d=0,strokeWidth:f=0,staticOffset:g,stroke:h,d:m,style:{transform:x,...v}={},...b}=t;process.env.NODE_ENV!=="production"&&(n||P2("The `ref` prop is required for `FloatingArrow`."));const S=Cf(),[N,w]=V.useState(!1);if(Xt(()=>{if(!i)return;Wt(i).direction==="rtl"&&w(!0)},[i]),!i)return null;const[I,k]=r.split("-"),A=I==="top"||I==="bottom";let M=g;(A&&a!=null&&a.x||!A&&a!=null&&a.y)&&(M=null);const B=f*2,U=B/2,q=l/2*(d/-8+1),D=u/2*d/4,$=!!m,F=M&&k==="end"?"bottom":"top";let E=M&&k==="end"?"right":"left";M&&N&&(E=k==="end"?"left":"right");const P=s?.x!=null?M||s.x:"",L=s?.y!=null?M||s.y:"",j=m||"M0,0"+(" H"+l)+(" L"+(l-q)+","+(u-D))+(" Q"+l/2+","+u+" "+q+","+(u-D))+" Z",O={top:$?"rotate(180deg)":"",left:$?"rotate(90deg)":"rotate(-90deg)",bottom:$?"":"rotate(180deg)",right:$?"rotate(-90deg)":"rotate(90deg)"}[I];return y.jsxs("svg",{...b,"aria-hidden":!0,ref:n,width:$?l:l+B,height:l,viewBox:"0 0 "+l+" "+(u>l?u:l),style:{position:"absolute",pointerEvents:"none",[E]:P,[F]:L,[I]:A||$?"100%":"calc(100% - "+B/2+"px)",transform:[O,x].filter(W=>!!W).join(" "),...v},children:[B>0&&y.jsx("path",{clipPath:"url(#"+S+")",fill:"none",stroke:h,strokeWidth:B+(m?0:1),d:j}),y.jsx("path",{stroke:B&&!m?b.fill:"none",d:j}),y.jsx("clipPath",{id:S,children:y.jsx("rect",{x:-U,y:U*($?-1:1),width:l+B,height:l})})]})});function L2(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const D2=V.createContext(null),j2=V.createContext(null),Gw=()=>{var e;return((e=V.useContext(D2))==null?void 0:e.id)||null},Af=()=>V.useContext(j2);function Uc(e){return"data-floating-ui-"+e}function En(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const qw=Uc("safe-polygon");function kf(e,t,n){if(n&&!Ef(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function Mf(e){return typeof e=="function"?e():e}function $2(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:i,events:s,elements:a}=e,{enabled:l=!0,delay:u=0,handleClose:d=null,mouseOnly:f=!1,restMs:g=0,move:h=!0}=t,m=Af(),x=Gw(),v=Ar(d),b=Ar(u),S=Ar(n),N=Ar(g),w=V.useRef(),I=V.useRef(-1),k=V.useRef(),A=V.useRef(-1),M=V.useRef(!0),B=V.useRef(!1),U=V.useRef(()=>{}),q=V.useRef(!1),D=Fn(()=>{var j;const O=(j=i.current.openEvent)==null?void 0:j.type;return O?.includes("mouse")&&O!=="mousedown"});V.useEffect(()=>{if(!l)return;function j(O){let{open:W}=O;W||(En(I),En(A),M.current=!0,q.current=!1)}return s.on("openchange",j),()=>{s.off("openchange",j)}},[l,s]),V.useEffect(()=>{if(!l||!v.current||!n)return;function j(W){D()&&r(!1,W,"hover")}const O=sr(a.floating).documentElement;return O.addEventListener("mouseleave",j),()=>{O.removeEventListener("mouseleave",j)}},[a.floating,n,r,l,v,D]);const $=V.useCallback(function(j,O,W){O===void 0&&(O=!0),W===void 0&&(W="hover");const z=kf(b.current,"close",w.current);z&&!k.current?(En(I),I.current=window.setTimeout(()=>r(!1,j,W),z)):O&&(En(I),r(!1,j,W))},[b,r]),F=Fn(()=>{U.current(),k.current=void 0}),E=Fn(()=>{if(B.current){const j=sr(a.floating).body;j.style.pointerEvents="",j.removeAttribute(qw),B.current=!1}}),P=Fn(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);V.useEffect(()=>{if(!l)return;function j(J){if(En(I),M.current=!1,f&&!Ef(w.current)||Mf(N.current)>0&&!kf(b.current,"open"))return;const ie=kf(b.current,"open",w.current);ie?I.current=window.setTimeout(()=>{S.current||r(!0,J,"hover")},ie):n||r(!0,J,"hover")}function O(J){if(P()){E();return}U.current();const ie=sr(a.floating);if(En(A),q.current=!1,v.current&&i.current.floatingContext){n||En(I),k.current=v.current({...i.current.floatingContext,tree:m,x:J.clientX,y:J.clientY,onClose(){E(),F(),P()||$(J,!0,"safe-polygon")}});const ce=k.current;ie.addEventListener("mousemove",ce),U.current=()=>{ie.removeEventListener("mousemove",ce)};return}(w.current==="touch"?!Fc(a.floating,J.relatedTarget):!0)&&$(J)}function W(J){P()||i.current.floatingContext&&(v.current==null||v.current({...i.current.floatingContext,tree:m,x:J.clientX,y:J.clientY,onClose(){E(),F(),P()||$(J)}})(J))}function z(){En(I)}function Y(J){P()||$(J,!1)}if(st(a.domReference)){const J=a.domReference,ie=a.floating;return n&&J.addEventListener("mouseleave",W),h&&J.addEventListener("mousemove",j,{once:!0}),J.addEventListener("mouseenter",j),J.addEventListener("mouseleave",O),ie&&(ie.addEventListener("mouseleave",W),ie.addEventListener("mouseenter",z),ie.addEventListener("mouseleave",Y)),()=>{n&&J.removeEventListener("mouseleave",W),h&&J.removeEventListener("mousemove",j),J.removeEventListener("mouseenter",j),J.removeEventListener("mouseleave",O),ie&&(ie.removeEventListener("mouseleave",W),ie.removeEventListener("mouseenter",z),ie.removeEventListener("mouseleave",Y))}}},[a,l,e,f,h,$,F,E,r,n,S,m,b,v,i,P,N]),Xt(()=>{var j;if(l&&n&&(j=v.current)!=null&&(j=j.__options)!=null&&j.blockPointerEvents&&D()){B.current=!0;const W=a.floating;if(st(a.domReference)&&W){var O;const z=sr(a.floating).body;z.setAttribute(qw,"");const Y=a.domReference,J=m==null||(O=m.nodesRef.current.find(ie=>ie.id===x))==null||(O=O.context)==null?void 0:O.elements.floating;return J&&(J.style.pointerEvents=""),z.style.pointerEvents="none",Y.style.pointerEvents="auto",W.style.pointerEvents="auto",()=>{z.style.pointerEvents="",Y.style.pointerEvents="",W.style.pointerEvents=""}}}},[l,n,x,a,m,v,D]),Xt(()=>{n||(w.current=void 0,q.current=!1,F(),E())},[n,F,E]),V.useEffect(()=>()=>{F(),En(I),En(A),E()},[l,a.domReference,F,E]);const L=V.useMemo(()=>{function j(O){w.current=O.pointerType}return{onPointerDown:j,onPointerEnter:j,onMouseMove(O){const{nativeEvent:W}=O;function z(){!M.current&&!S.current&&r(!0,W,"hover")}f&&!Ef(w.current)||n||Mf(N.current)===0||q.current&&O.movementX**2+O.movementY**2<2||(En(A),w.current==="touch"?z():(q.current=!0,A.current=window.setTimeout(z,Mf(N.current))))}}},[f,r,n,S,N]);return V.useMemo(()=>l?{reference:L}:{},[l,L])}const Yw={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Xw=V.forwardRef(function(t,n){const[r,i]=V.useState();Xt(()=>{v2()&&i("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Uc("focus-guard")]:"",style:Yw};return y.jsx("span",{...t,...s})}),Kw=V.createContext(null),Zw=Uc("portal");function H2(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Cf(),i=B2(),[s,a]=V.useState(null),l=V.useRef(null);return Xt(()=>()=>{s?.remove(),queueMicrotask(()=>{l.current=null})},[s]),Xt(()=>{if(!r||l.current)return;const u=t?document.getElementById(t):null;if(!u)return;const d=document.createElement("div");d.id=r,d.setAttribute(Zw,""),u.appendChild(d),l.current=d,a(d)},[t,r]),Xt(()=>{if(n===null||!r||l.current)return;let u=n||i?.portalNode;u&&!Ru(u)&&(u=u.current),u=u||document.body;let d=null;t&&(d=document.createElement("div"),d.id=t,u.appendChild(d));const f=document.createElement("div");f.id=r,f.setAttribute(Zw,""),u=d||u,u.appendChild(f),l.current=f,a(f)},[t,n,r,i]),s}function Jw(e){const{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,s=H2({id:n,root:r}),[a,l]=V.useState(null),u=V.useRef(null),d=V.useRef(null),f=V.useRef(null),g=V.useRef(null),h=a?.modal,m=a?.open,x=!!a&&!a.modal&&a.open&&i&&!!(r||s);return V.useEffect(()=>{if(!s||!i||h)return;function v(b){s&&Tf(b)&&(b.type==="focusin"?Bw:C2)(s)}return s.addEventListener("focusin",v,!0),s.addEventListener("focusout",v,!0),()=>{s.removeEventListener("focusin",v,!0),s.removeEventListener("focusout",v,!0)}},[s,i,h]),V.useEffect(()=>{s&&(m||Bw(s))},[m,s]),y.jsxs(Kw.Provider,{value:V.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:g,portalNode:s,setFocusManagerState:l}),[i,s]),children:[x&&s&&y.jsx(Xw,{"data-type":"outside",ref:u,onFocus:v=>{if(Tf(v,s)){var b;(b=f.current)==null||b.focus()}else{const S=a?a.domReference:null,N=T2(S);N?.focus()}}}),x&&s&&y.jsx("span",{"aria-owns":s.id,style:Yw}),s&&_o.createPortal(t,s),x&&s&&y.jsx(Xw,{"data-type":"outside",ref:d,onFocus:v=>{if(Tf(v,s)){var b;(b=g.current)==null||b.focus()}else{const S=a?a.domReference:null,N=E2(S);N?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,v.nativeEvent,"focus-out")}}})]})}const B2=()=>V.useContext(Kw),V2={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},F2={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Qw=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 eb(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:i,dataRef:s}=e,{enabled:a=!0,escapeKey:l=!0,outsidePress:u=!0,outsidePressEvent:d="pointerdown",referencePress:f=!1,referencePressEvent:g="pointerdown",ancestorScroll:h=!1,bubbles:m,capture:x}=t,v=Af(),b=Fn(typeof u=="function"?u:()=>!1),S=typeof u=="function"?b:u,N=V.useRef(!1),{escapeKey:w,outsidePress:I}=Qw(m),{escapeKey:k,outsidePress:A}=Qw(x),M=V.useRef(!1),B=Fn(E=>{var P;if(!n||!a||!l||E.key!=="Escape"||M.current)return;const L=(P=s.current.floatingContext)==null?void 0:P.nodeId,j=v?zc(v.nodesRef.current,L):[];if(!w&&(E.stopPropagation(),j.length>0)){let O=!0;if(j.forEach(W=>{var z;if((z=W.context)!=null&&z.open&&!W.context.dataRef.current.__escapeKeyBubbles){O=!1;return}}),!O)return}r(!1,b2(E)?E.nativeEvent:E,"escape-key")}),U=Fn(E=>{var P;const L=()=>{var j;B(E),(j=Ss(E))==null||j.removeEventListener("keydown",L)};(P=Ss(E))==null||P.addEventListener("keydown",L)}),q=Fn(E=>{var P;const L=s.current.insideReactTree;s.current.insideReactTree=!1;const j=N.current;if(N.current=!1,d==="click"&&j||L||typeof S=="function"&&!S(E))return;const O=Ss(E),W="["+Uc("inert")+"]",z=sr(i.floating).querySelectorAll(W);let Y=st(O)?O:null;for(;Y&&!Kn(Y);){const ce=Zn(Y);if(Kn(ce)||!st(ce))break;Y=ce}if(z.length&&st(O)&&!w2(O)&&!Fc(O,i.floating)&&Array.from(z).every(ce=>!Fc(Y,ce)))return;if(xn(O)&&F){const ce=Kn(O),ge=Wt(O),Q=/auto|scroll/,te=ce||Q.test(ge.overflowX),ne=ce||Q.test(ge.overflowY),oe=te&&O.clientWidth>0&&O.scrollWidth>O.clientWidth,pe=ne&&O.clientHeight>0&&O.scrollHeight>O.clientHeight,le=ge.direction==="rtl",ve=pe&&(le?E.offsetX<=O.offsetWidth-O.clientWidth:E.offsetX>O.clientWidth),me=oe&&E.offsetY>O.clientHeight;if(ve||me)return}const J=(P=s.current.floatingContext)==null?void 0:P.nodeId,ie=v&&zc(v.nodesRef.current,J).some(ce=>{var ge;return If(E,(ge=ce.context)==null?void 0:ge.elements.floating)});if(If(E,i.floating)||If(E,i.domReference)||ie)return;const ee=v?zc(v.nodesRef.current,J):[];if(ee.length>0){let ce=!0;if(ee.forEach(ge=>{var Q;if((Q=ge.context)!=null&&Q.open&&!ge.context.dataRef.current.__outsidePressBubbles){ce=!1;return}}),!ce)return}r(!1,E,"outside-press")}),D=Fn(E=>{var P;const L=()=>{var j;q(E),(j=Ss(E))==null||j.removeEventListener(d,L)};(P=Ss(E))==null||P.addEventListener(d,L)});V.useEffect(()=>{if(!n||!a)return;s.current.__escapeKeyBubbles=w,s.current.__outsidePressBubbles=I;let E=-1;function P(z){r(!1,z,"ancestor-scroll")}function L(){window.clearTimeout(E),M.current=!0}function j(){E=window.setTimeout(()=>{M.current=!1},Ca()?5:0)}const O=sr(i.floating);l&&(O.addEventListener("keydown",k?U:B,k),O.addEventListener("compositionstart",L),O.addEventListener("compositionend",j)),S&&O.addEventListener(d,A?D:q,A);let W=[];return h&&(st(i.domReference)&&(W=xr(i.domReference)),st(i.floating)&&(W=W.concat(xr(i.floating))),!st(i.reference)&&i.reference&&i.reference.contextElement&&(W=W.concat(xr(i.reference.contextElement)))),W=W.filter(z=>{var Y;return z!==((Y=O.defaultView)==null?void 0:Y.visualViewport)}),W.forEach(z=>{z.addEventListener("scroll",P,{passive:!0})}),()=>{l&&(O.removeEventListener("keydown",k?U:B,k),O.removeEventListener("compositionstart",L),O.removeEventListener("compositionend",j)),S&&O.removeEventListener(d,A?D:q,A),W.forEach(z=>{z.removeEventListener("scroll",P)}),window.clearTimeout(E)}},[s,i,l,S,d,n,r,h,a,w,I,B,k,U,q,A,D]),V.useEffect(()=>{s.current.insideReactTree=!1},[s,S,d]);const $=V.useMemo(()=>({onKeyDown:B,...f&&{[V2[g]]:E=>{r(!1,E.nativeEvent,"reference-press")},...g!=="click"&&{onClick(E){r(!1,E.nativeEvent,"reference-press")}}}}),[B,r,f,g]),F=V.useMemo(()=>({onKeyDown:B,onMouseDown(){N.current=!0},onMouseUp(){N.current=!0},[F2[d]]:()=>{s.current.insideReactTree=!0}}),[B,d,s]);return V.useMemo(()=>a?{reference:$,floating:F}:{},[a,$,F])}function z2(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=Cf(),s=V.useRef({}),[a]=V.useState(()=>L2()),l=Gw()!=null;if(process.env.NODE_ENV!=="production"){const m=r.reference;m&&!st(m)&&R2("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[u,d]=V.useState(r.reference),f=Fn((m,x,v)=>{s.current.openEvent=m?x:void 0,a.emit("openchange",{open:m,event:x,reason:v,nested:l}),n?.(m,x,v)}),g=V.useMemo(()=>({setPositionReference:d}),[]),h=V.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return V.useMemo(()=>({dataRef:s,open:t,onOpenChange:f,elements:h,events:a,floatingId:i,refs:g}),[t,f,h,a,i,g])}function Wc(e){e===void 0&&(e={});const{nodeId:t}=e,n=z2({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[s,a]=V.useState(null),[l,u]=V.useState(null),f=i?.domReference||s,g=V.useRef(null),h=Af();Xt(()=>{f&&(g.current=f)},[f]);const m=km({...e,elements:{...i,...l&&{reference:l}}}),x=V.useCallback(w=>{const I=st(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;u(I),m.refs.setReference(I)},[m.refs]),v=V.useCallback(w=>{(st(w)||w===null)&&(g.current=w,a(w)),(st(m.refs.reference.current)||m.refs.reference.current===null||w!==null&&!st(w))&&m.refs.setReference(w)},[m.refs]),b=V.useMemo(()=>({...m.refs,setReference:v,setPositionReference:x,domReference:g}),[m.refs,v,x]),S=V.useMemo(()=>({...m.elements,domReference:f}),[m.elements,f]),N=V.useMemo(()=>({...m,...r,refs:b,elements:S,nodeId:t}),[m,b,S,t,r]);return Xt(()=>{r.dataRef.current.floatingContext=N;const w=h?.nodesRef.current.find(I=>I.id===t);w&&(w.context=N)}),V.useMemo(()=>({...m,context:N,refs:b,elements:S}),[m,b,S,N])}function Of(e,t,n){const r=new Map,i=n==="item";let s=e;if(i&&e){const{[Vw]:a,[Fw]:l,...u}=e;s=u}return{...n==="floating"&&{tabIndex:-1,[A2]:""},...s,...t.map(a=>{const l=a?a[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((a,l)=>(l&&Object.entries(l).forEach(u=>{let[d,f]=u;if(!(i&&[Vw,Fw].includes(d)))if(d.indexOf("on")===0){if(r.has(d)||r.set(d,[]),typeof f=="function"){var g;(g=r.get(d))==null||g.push(f),a[d]=function(){for(var h,m=arguments.length,x=new Array(m),v=0;v<m;v++)x[v]=arguments[v];return(h=r.get(d))==null?void 0:h.map(b=>b(...x)).find(b=>b!==void 0)}}}else a[d]=f}),a),{})}}function tb(e){e===void 0&&(e=[]);const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),r=e.map(l=>l?.item),i=V.useCallback(l=>Of(l,e,"reference"),t),s=V.useCallback(l=>Of(l,e,"floating"),n),a=V.useCallback(l=>Of(l,e,"item"),r);return V.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:a}),[i,s,a])}const nb=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase());function ti(e,t){return typeof e=="function"?e(t):e}function U2(e,t){const[n,r]=V.useState(e);return e&&!n&&r(!0),V.useEffect(()=>{if(!e&&n){const i=setTimeout(()=>r(!1),t);return()=>clearTimeout(i)}},[e,n,t]),n}function W2(e,t){t===void 0&&(t={});const{open:n,elements:{floating:r}}=e,{duration:i=250}=t,a=(typeof i=="number"?i:i.close)||0,[l,u]=V.useState("unmounted"),d=U2(n,a);return!d&&l==="close"&&u("unmounted"),Xt(()=>{if(r){if(n){u("initial");const f=requestAnimationFrame(()=>{_o.flushSync(()=>{u("open")})});return()=>{cancelAnimationFrame(f)}}u("close")}},[n,r]),{isMounted:d,status:l}}function rb(e,t){t===void 0&&(t={});const{initial:n={opacity:0},open:r,close:i,common:s,duration:a=250}=t,l=e.placement,u=l.split("-")[0],d=V.useMemo(()=>({side:u,placement:l}),[u,l]),f=typeof a=="number",g=(f?a:a.open)||0,h=(f?a:a.close)||0,[m,x]=V.useState(()=>({...ti(s,d),...ti(n,d)})),{isMounted:v,status:b}=W2(e,{duration:a}),S=Ar(n),N=Ar(r),w=Ar(i),I=Ar(s);return Xt(()=>{const k=ti(S.current,d),A=ti(w.current,d),M=ti(I.current,d),B=ti(N.current,d)||Object.keys(k).reduce((U,q)=>(U[q]="",U),{});if(b==="initial"&&x(U=>({transitionProperty:U.transitionProperty,...M,...k})),b==="open"&&x({transitionProperty:Object.keys(B).map(nb).join(","),transitionDuration:g+"ms",...M,...B}),b==="close"){const U=A||k;x({transitionProperty:Object.keys(U).map(nb).join(","),transitionDuration:h+"ms",...M,...U})}},[h,w,S,N,I,g,b,d]),{isMounted:v,styles:m}}function ob({placement:e="top",offsetPx:t=10,hoverDelay:n={open:150,close:0},transitionDuration:r=150,withArrow:i=!0,initialTransition:s={opacity:0,transform:"translateY(4px)"}}={}){const[a,l]=T.useState(!1),u=T.useRef(null),d=[Oi(t),Ri(),Pi({padding:8}),...i?[Vu({element:u})]:[]],{refs:f,floatingStyles:g,context:h}=Wc({open:a,onOpenChange:l,middleware:d,whileElementsMounted:Mi,placement:e}),m=$2(h,{delay:n}),x=eb(h),{getReferenceProps:v,getFloatingProps:b}=tb([m,x]),{isMounted:S,styles:N}=rb(h,{duration:r,initial:s});return{isOpen:a,setIsOpen:l,refs:f,floatingStyles:g,context:h,arrowRef:u,getReferenceProps:v,getFloatingProps:b,isMounted:S,transitionStyles:N}}function G2(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown error"}function zn(e){return{message:G2(e.error),nodeId:e.nodeId,nodeTypeId:e.nodeTypeId,nodeTypeName:e.nodeTypeName,handleId:e.handleId,path:e.path,loopContext:e.loopContext,groupContext:e.groupContext,timestamp:e.timestamp,duration:e.duration,originalError:e.error}}function Pf(e,t,n){const r=[],i=new Set,s=[{nodeId:e}];for(;s.length>0;){const a=s.shift();if(!a||i.has(a.nodeId))continue;i.add(a.nodeId);const l=n.get(a.nodeId);l&&r.push({nodeId:a.nodeId,nodeTypeId:l.nodeTypeId,nodeTypeName:l.nodeTypeName,handleId:a.handleId,concurrencyLevel:l.concurrencyLevel});for(const[u,d]of t){const f=u.indexOf(":");if(!(f===-1||u.substring(0,f)!==a.nodeId))for(const h of d)i.has(h.sourceNodeId)||s.push({nodeId:h.sourceNodeId,handleId:h.sourceHandleId})}}return r.reverse(),r}function ib(e){const t=[];if(t.push(`Error in "${e.nodeTypeName}" (${e.nodeId})`),t.push(`Message: ${e.message}`),e.path.length>0){const n=e.path.map(r=>r.nodeTypeName).join(" → ");t.push(`Path: ${n}`)}return e.loopContext&&t.push(`Loop: iteration ${e.loopContext.iteration} of ${e.loopContext.maxIterations}`),e.groupContext&&t.push(`Group: ${e.groupContext.groupNodeTypeId} (depth ${e.groupContext.depth})`),t.push(`Duration: ${e.duration.toFixed(2)}ms`),t.join(`
301
+ `)}function sb({icon:e,content:t,iconClassName:n}){const{refs:r,floatingStyles:i,context:s,arrowRef:a,getReferenceProps:l,getFloatingProps:u,isMounted:d,transitionStyles:f}=ob({placement:"top",offsetPx:10,hoverDelay:{open:150,close:0},transitionDuration:150});return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:r.setReference,className:ye("absolute top-1 right-1 z-10 cursor-pointer pointer-events-auto",n),...l(),children:e}),d&&y.jsx("div",{ref:r.setFloating,style:{...i,zIndex:50},...u(),children:y.jsxs("div",{style:f,className:"max-w-xs rounded-md bg-[#181818] border border-secondary-dark-gray px-3 py-2 text-[14px] leading-[18px] font-main text-primary-white shadow-lg whitespace-pre-wrap pointer-events-auto",children:[t,y.jsx(Ww,{ref:a,context:s,width:10,height:5,fill:"#181818",strokeWidth:1,stroke:"var(--color-secondary-dark-gray)"})]})})]})}function ab({visualState:e,errors:t,warnings:n,children:r}){const i=t&&t.length>0?t.map(a=>ib(a)).join(`
302
+
303
+ `):void 0,s=n&&n.length>0?n.join(`
304
+ `):void 0;return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:ye("absolute inset-0 rounded-md pointer-events-none z-10 transition-[outline-color,box-shadow,opacity] duration-200",e==="idle"&&"[outline:5px_solid_transparent] shadow-none",e==="running"&&"[outline:5px_dashed_var(--color-primary-blue)] animate-[running-glow_2s_ease-in-out_infinite]",e==="completed"&&"[outline:5px_solid_var(--color-status-completed)] shadow-[0_0_12px_rgba(76,175,80,0.3)]",e==="errored"&&"[outline:5px_solid_var(--color-status-errored)] shadow-[0_0_12px_rgba(255,68,68,0.3)]",e==="skipped"&&"[outline:5px_dashed_var(--color-secondary-dark-gray)] opacity-50",e==="warning"&&"[outline:5px_solid_var(--color-status-warning)] shadow-[0_0_12px_rgba(255,165,0,0.3)]")}),e==="errored"&&i&&y.jsx(sb,{icon:y.jsx(R_,{className:"w-5 h-5 text-[#FF4444]"}),content:i}),e==="warning"&&s&&y.jsx(sb,{icon:y.jsx(ng,{className:"w-5 h-5 text-[#FFA500]"}),content:s}),e==="skipped"&&y.jsx("div",{className:"absolute inset-0 rounded-md bg-black/30 pointer-events-none z-10"}),r]})}function cb({orientation:e="horizontal",disabled:t=!1,scrollSpeedPxPerFrame:n=14,observeChildren:r=!0}={}){const i=T.useRef(null),[s,a]=T.useState(!1),[l,u]=T.useState(!1),d=T.useRef(null),f=T.useRef(null),g=T.useCallback(()=>e==="vertical"?{pos:"scrollTop",size:"clientHeight",full:"scrollHeight"}:{pos:"scrollLeft",size:"clientWidth",full:"scrollWidth"},[e]),h=T.useCallback(()=>{const b=i.current;if(!b||t){a(!1),u(!1);return}const S=g(),N=b[S.pos],w=b[S.size],I=b[S.full];a(N>0),u(N+w<I-1)},[t,g]),m=T.useCallback(()=>{d.current!==null&&(cancelAnimationFrame(d.current),d.current=null),f.current=null},[]),x=T.useCallback(()=>{const b=i.current;if(!b||!f.current||t){m();return}const S=g(),N=f.current==="start"?-1:1;if(S.pos==="scrollLeft"?b.scrollLeft+=N*n:b.scrollTop+=N*n,h(),N<0&&!s||N>0&&!l){m();return}d.current=requestAnimationFrame(x)},[l,s,t,g,n,m,h]),v=T.useCallback(b=>{t||f.current!==b&&(f.current=b,d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(x))},[t,x]);return T.useEffect(()=>{h();const b=i.current;if(!b)return;const S=()=>h();b.addEventListener("scroll",S,{passive:!0});let N=null;"ResizeObserver"in window&&(N=new ResizeObserver(()=>h()),N.observe(b));const w=()=>h();window.addEventListener("resize",w);const I=()=>m();return window.addEventListener("pointerup",I),window.addEventListener("touchend",I),()=>{b.removeEventListener("scroll",S),window.removeEventListener("resize",w),window.removeEventListener("pointerup",I),window.removeEventListener("touchend",I),N&&N.disconnect()}},[h,m]),T.useEffect(()=>{const b=requestAnimationFrame(h);return()=>cancelAnimationFrame(b)},[h]),T.useEffect(()=>{if(!r)return;const b=i.current;if(!b)return;const S=new MutationObserver(()=>h());return S.observe(b,{childList:!0,subtree:!0}),()=>S.disconnect()},[r,h]),{listRef:i,canScrollStart:s,canScrollEnd:l,startAutoScroll:v,stopAutoScroll:m}}const Rf=T.forwardRef(({children:e,orientation:t="horizontal",className:n,scrollAreaClassName:r,showArrows:i=!0,disabled:s=!1,ariaLabel:a,scrollSpeedPxPerFrame:l=14,observeChildren:u=!0},d)=>{const{listRef:f,canScrollStart:g,canScrollEnd:h,startAutoScroll:m,stopAutoScroll:x}=cb({orientation:t,disabled:s,scrollSpeedPxPerFrame:l,observeChildren:u});T.useImperativeHandle(d,()=>f.current);const v=i&&g&&!s,b=i&&h&&!s,S=t==="horizontal"?"overflow-x-scroll overflow-y-hidden flex items-center gap-2 whitespace-nowrap":"overflow-y-scroll overflow-x-hidden flex flex-col items-start gap-2";return y.jsxs("div",{className:ye("relative w-full h-full",n),children:[v&&y.jsx(Qn,{className:ye("h-[44px] border-secondary-dark-gray bg-primary-black absolute z-10",t==="horizontal"?"left-0 top-1/2 -translate-y-1/2":"top-0 left-1/2 -translate-x-1/2"),disabled:!v,onMouseDown:()=>m("start"),onMouseUp:x,onMouseLeave:x,onTouchStart:()=>m("start"),onTouchEnd:x,children:t==="horizontal"?y.jsx(iu,{}):y.jsx(su,{})}),y.jsx("div",{ref:f,"aria-label":a,className:ye("no-scrollbar w-full h-full",S,r),children:e}),b&&y.jsx(Qn,{className:ye("h-[44px] border-secondary-dark-gray bg-primary-black absolute z-10",t==="horizontal"?"right-0 top-1/2 -translate-y-1/2":"bottom-0 left-1/2 -translate-x-1/2"),disabled:!b,onMouseDown:()=>m("end"),onMouseUp:x,onMouseLeave:x,onTouchStart:()=>m("end"),onTouchEnd:x,children:t==="horizontal"?y.jsx(zr,{}):y.jsx(Ei,{})})]})});Rf.displayName="ScrollableButtonContainer";function sn({content:e,children:t,infoIcon:n=!1,placement:r="bottom",maxWidth:i=240,className:s,style:a,as:l="span",triggerProps:u}){const[d,f]=T.useState(!1),g=T.useRef(null),h=T.useRef(null),{refs:m,floatingStyles:x,context:v}=Wc({open:d,onOpenChange:f,middleware:[Oi(6),Ri(),Pi({padding:8}),Vu({element:h})],whileElementsMounted:Mi,placement:r});T.useEffect(()=>{g.current&&m.setPositionReference(g.current)},[m]);const{isMounted:b,styles:S}=rb(v,{duration:120,initial:{opacity:0,transform:"translateY(-3px)"}});return y.jsxs(y.Fragment,{children:[y.jsxs(l,{ref:g,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),className:ye("inline-flex items-center gap-1.5",s),style:a,...u,children:[n&&y.jsx(L_,{className:"h-3.5 w-3.5 shrink-0 text-primary-white"}),t]}),b&&y.jsx(Jw,{children:y.jsx("div",{ref:m.setFloating,style:{...x,pointerEvents:"none",zIndex:50},children:y.jsxs("div",{style:{...S,maxWidth:`${i}px`},className:"rounded-md border-[1.25px] border-primary-white/60 bg-tooltip-bg px-3 py-2 text-[12px] text-primary-white shadow-2xl backdrop-blur-sm",children:[e,y.jsx(Ww,{ref:h,context:v,width:8,height:4,fill:"var(--color-tooltip-bg)",strokeWidth:1,stroke:"var(--color-secondary-dark-gray)"})]})})})]})}function lb({onMove:e,onClick:t,clickThreshold:n=2,enabled:r=!0,preventDefaultAndStopPropagation:i=!0}={}){const[s,a]=T.useState(!1),[l,u]=T.useState(null),d=T.useRef(null),f=T.useRef(null),g=T.useCallback(h=>{u(h)},[]);return T.useEffect(()=>{if(!l||!r)return;const h=m=>{i&&(m.preventDefault(),m.stopPropagation()),d.current={x:m.clientX,y:m.clientY},f.current={width:l.clientWidth,height:l.clientHeight},a(!0);const x=b=>{i&&(b.preventDefault(),b.stopPropagation()),document.removeEventListener("mouseup",x),document.removeEventListener("mousemove",v),a(!1),d.current&&Math.sqrt((b.clientX-d.current.x)**2+(b.clientY-d.current.y)**2)<n&&t?.()},v=b=>{i&&(b.preventDefault(),b.stopPropagation());const S=b.movementX,N=b.movementY,w=f.current?.width||1,I=f.current?.height||1,k=S/w,A=N/I;e?.(S,N,k,A,w,I)};document.addEventListener("mouseup",x),document.addEventListener("mousemove",v)};return l.addEventListener("mousedown",h),()=>{l.removeEventListener("mousedown",h)}},[l,r,e,t,n,i]),{isDragging:s,dragRef:g}}const ni=T.forwardRef(({name:e="Input",value:t,onChange:n=()=>{},className:r,min:i,max:s,step:a,size:l="normal",decimals:u},d)=>{const f=l==="small",g=u??(f?1:4),[h,m]=T.useState(t??0),[x,v]=T.useState(!1),b=T.useRef(0),S=T.useRef(0),N=t??h,w=T.useRef(0);T.useEffect(()=>{if(a!==void 0)w.current=Math.abs(a);else if(i!==void 0&&s!==void 0)w.current=Math.abs(s-i);else{const W=Math.pow(10,-g);w.current=Math.max(Math.abs(parseFloat((N||1).toString())),W)}},[N,a,g,s,i]);const{isDragging:I,dragRef:k}=lb({onMove:(W,z,Y,J,ie)=>{const ee=W/(ie+60);b.current+=ee,Math.abs(b.current)>.05&&Date.now()-S.current>50&&(S.current=Date.now(),A(w.current*b.current),b.current=0)},onClick:U,clickThreshold:2});function A(W){m(z=>{let Y=z+W;return i!==void 0&&Y<=i?Y=i:s!==void 0&&Y>=s&&(Y=s),n(Y),Y})}function M(W=.1){A(w.current*W)}function B(W=.1){A(-w.current*W)}function U(){v(!0)}function q(W){A(W-N),v(!1)}const D=I,$=i!==void 0&&s!==void 0&&N!==void 0&&s!==i?(N-i)/(s-i)*100:-1,F=$!==-1?`linear-gradient(90deg,#4772b3 ${$}%, #545454 ${$}%)`:"",E=f?"h-[22px]":"h-[44px]",P=f?`${E} w-[18px]`:`${E} w-[30px]`,L=f?"h-3 w-3":"",j=f?"text-[10px]":"",O=f?`${E} rounded-none px-1.5 flex-1 justify-between grid grid-cols-[repeat(2,auto)] bg-transparent gap-1`:`${E} rounded-none pl-1.5 pr-0 flex-1 justify-between grid grid-cols-[repeat(2,auto)] bg-transparent`;return x?y.jsx(ws,{className:ye("w-full",f&&"h-[22px] text-[11px] px-1.5"),placeholder:e,value:N,allowOnlyNumbers:!0,numberOfDecimals:g,onChange:W=>q(W),ref:d}):y.jsxs("div",{className:ye("flex items-center gap-0 group/lightParentGroupBasedHover w-max bg-primary-gray",f?"rounded-sm":"rounded-md",r),style:F!==""?{background:F}:{},ref:d,children:[y.jsx(Qn,{color:"lightParentGroupBasedHover",className:ye(P,"rounded-r-none p-0 shrink-0 bg-transparent",j),onClick:()=>B(.1),"aria-label":`Decrement ${e}`,applyHoverStyles:!D,children:y.jsx(iu,{className:L||void 0})}),y.jsxs(Qn,{color:"lightParentGroupBasedHover",className:ye(O,j),applyHoverStyles:!D,ref:k,children:[y.jsx("span",{className:"truncate text-left",children:e}),y.jsx("span",{className:"truncate tabular-nums",children:N.toFixed(g)})]}),y.jsx(Qn,{color:"lightParentGroupBasedHover",className:ye(P,"rounded-l-none p-0 shrink-0 bg-transparent",j),onClick:()=>M(.1),"aria-label":`Increment ${e}`,applyHoverStyles:!D,children:y.jsx(zr,{className:L||void 0})})]})});ni.displayName="SliderNumberInput";const ub=100,db=100,Lf=75,fb=100;function q2(e,t){const[n,r]=T.useState(null),i=T.useRef(new Map),s=T.useRef(null),a=T.useRef(!1),l=T.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),[u,d]=T.useState(null),[f,g]=T.useState(null),h=T.useRef(null),m=T.useRef(null),x=T.useRef(null),[v,b]=T.useState(null),S=T.useRef(null),N=T.useRef(null),w=T.useRef(!1),I=T.useRef(!1),[k,A]=T.useState(null),M=T.useRef(null),B=T.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),m.current&&(cancelAnimationFrame(m.current),m.current=null)},[]),U=T.useCallback(ee=>{const ce=x.current;if(ee!==ce){if(x.current=ee,B(),ce!==null&&ee!==null){I.current=!0;const ge=e.find(Q=>Q.id===ce);ge?.subItems&&d(ge.subItems),g("initial")}else if(I.current=!1,g(null),d(null),ee===null){const ge=e.find(Q=>Q.id===ce);ge?.subItems?(A(ge.subItems),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{A(null),w.current=!1,b(null),M.current=null},ub)):(w.current=!1,b(null))}else M.current&&(clearTimeout(M.current),M.current=null),A(null);r(ee)}},[e,B]);T.useEffect(()=>{if(f==="initial")return m.current=requestAnimationFrame(()=>{m.current=requestAnimationFrame(()=>{g("animating"),m.current=null,h.current=setTimeout(()=>{g(null),d(null),I.current=!1,h.current=null},db)})}),B},[f,B]);const D=(n?e.find(ee=>ee.id===n):null)?.subItems??null;T.useLayoutEffect(()=>{N.current&&N.current.disconnect();const ee=S.current;if(!ee||!n)return;const ce=new ResizeObserver(ge=>{const Q=ge[0];if(!Q)return;const{width:te,height:ne}=Q.contentRect;te>0&&ne>0&&(w.current=!0,b({w:te,h:ne}))});return ce.observe(ee),N.current=ce,()=>ce.disconnect()},[n]);const $=n?i.current.get(n):null,{refs:F,floatingStyles:E,placement:P}=Wc({open:n!==null,onOpenChange:ee=>{ee||U(null)},strategy:"fixed",placement:"right-start",middleware:[Oi(5),Ri({fallbackPlacements:["left-start"]}),Pi({padding:8})],whileElementsMounted:Mi});T.useLayoutEffect(()=>{$&&F.setReference($)},[$,F]);const L=T.useCallback(ee=>{ee.onClick&&ee.onClick(),t&&t(ee)},[t]),j=T.useCallback(ee=>{l(),ee!==n&&(n===null?ee!==null&&(s.current=setTimeout(()=>{U(ee),s.current=null},Lf)):ee!==null?s.current=setTimeout(()=>{U(ee),s.current=null},fb):s.current=setTimeout(()=>{a.current||U(null),s.current=null},fb))},[n,l,U]),O=T.useCallback(()=>{a.current=!0,l()},[l]),W=T.useCallback(()=>{a.current=!1,l(),s.current=setTimeout(()=>{U(null),s.current=null},Lf)},[l,U]),z=T.useCallback(()=>{a.current||(l(),s.current=setTimeout(()=>{a.current||U(null),s.current=null},Lf))},[l,U]),Y=T.useCallback(ee=>ce=>{ce?i.current.set(ee,ce):i.current.delete(ee)},[]),J=n!==null,ie=v!==null?{width:v.w,height:v.h,overflow:"hidden"}:{};return{activeSubmenuId:n,activeSubItems:D,prevSubItems:u,exitSubItems:k,crossfadePhase:f,containerSize:v,isSwitching:I.current,isOpen:J,panelSizeStyles:ie,incomingRef:S,floatingRefs:F,floatingStyles:E,placement:P,handleItemClick:L,handleHover:j,handleFloatingMouseEnter:O,handleFloatingMouseLeave:W,handleListMouseLeave:z,makeItemRef:Y,SUBMENU_DURATION_MS:ub,CONTENT_FADE_DURATION_MS:db}}const Y2=({item:e,index:t,onItemClick:n,onHover:r,itemRef:i,itemTransitionStyle:s})=>{const a=e.subItems&&e.subItems.length>0;return y.jsxs("li",{className:"relative",children:[e.separator&&t>0&&y.jsx("div",{className:"border-t border-gray-600 m-0"}),y.jsxs("div",{ref:i,className:ye("flex items-center justify-between gap-2 px-3 py-1.25 hover:bg-[#3F3F3F] cursor-pointer","transition-colors duration-150"),style:s,onClick:()=>n(e),onMouseEnter:()=>r(a?e.id:null),children:[y.jsxs("div",{className:"flex items-center gap-2",children:[e.icon&&y.jsx("span",{className:"text-primary-white w-3 h-3 flex items-center justify-center",children:e.icon}),y.jsx("span",{className:"text-sm leading-3.5 text-primary-white font-main",children:e.label})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[e.shortcut&&y.jsx("span",{className:"text-sm leading-3.5 text-gray-400 font-mono",children:e.shortcut}),a&&y.jsx(zr,{className:"w-3 h-3 text-gray-400"})]})]})]})},Gc=({subItems:e,onItemClick:t,className:n,bare:r=!1,itemTransitionStyle:i})=>{const{activeSubItems:s,prevSubItems:a,exitSubItems:l,crossfadePhase:u,isSwitching:d,isOpen:f,panelSizeStyles:g,incomingRef:h,floatingRefs:m,floatingStyles:x,placement:v,handleItemClick:b,handleHover:S,handleFloatingMouseEnter:N,handleFloatingMouseLeave:w,handleListMouseLeave:I,makeItemRef:k,SUBMENU_DURATION_MS:A,CONTENT_FADE_DURATION_MS:M}=q2(e,t),B=e.some(U=>U.subItems&&U.subItems.length>0);return y.jsxs(y.Fragment,{children:[y.jsx("ul",{className:ye("min-w-48 py-1",!r&&"bg-[#181818] border border-none rounded-md shadow-lg",n),onMouseLeave:I,children:e.map((U,q)=>y.jsx(Y2,{item:U,index:q,onItemClick:b,onHover:S,itemRef:k(U.id),itemTransitionStyle:i},U.id))}),B&&y.jsx(Jw,{children:y.jsx("div",{ref:m.setFloating,style:{...x,transitionProperty:d?"opacity, transform, translate":"opacity, translate",transitionDuration:`${A}ms`,transitionTimingFunction:"ease-out"},className:ye("z-50",f?"opacity-100 translate-x-0":ye("opacity-0 pointer-events-none",v.startsWith("right")?"-translate-x-[20px]":"translate-x-[20px]")),onMouseEnter:N,onMouseLeave:w,children:y.jsx("div",{className:"bg-[#181818] rounded-md shadow-lg ml-1",style:{...g,transitionProperty:"opacity, translate, width, height",transitionDuration:`${A}ms`,transitionTimingFunction:"ease-out"},children:y.jsxs("div",{className:"relative",children:[u!==null&&a&&y.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"none"},children:y.jsx(Gc,{subItems:a,onItemClick:t,bare:!0,itemTransitionStyle:u==="initial"?{opacity:1,transform:"translateX(0)"}:{opacity:0,transform:"translateX(10%)",transition:`opacity ${M}ms ease-out, transform ${M}ms ease-out`}})}),s&&y.jsx("div",{ref:h,children:y.jsx(Gc,{subItems:s,onItemClick:t,bare:!0,itemTransitionStyle:u==="initial"?{opacity:0,transform:"translateX(-10%)"}:u==="animating"?{opacity:1,transform:"translateX(0)",transition:`opacity ${M}ms ease-out, transform ${M}ms ease-out`}:void 0})}),!s&&l&&y.jsx(Gc,{subItems:l,onItemClick:t,bare:!0})]})})})})]})},pb=({subItems:e,className:t,onItemClick:n})=>y.jsx("div",{className:ye("relative",t),children:y.jsx(Gc,{subItems:e,onItemClick:n})});function Df(e){return e.kind==="leaf"?e.priority:e.children.length===0?0:Math.max(...e.children.map(Df))}function jf(e){return e.kind==="leaf"?e.insertionIndex:e.children.length===0?1/0:Math.min(...e.children.map(jf))}function hb(e){e.sort((t,n)=>{const r=Df(n)-Df(t);return r!==0?r:jf(t)-jf(n)});for(const t of e)t.kind==="folder"&&hb(t.children)}function gb(e){const t=[];for(const n of e)if(n.kind==="leaf")t.push(n.item);else{const r=gb(n.children);r.length>0&&t.push({id:`folder-${n.label}`,label:n.label,subItems:r})}return t}function mb({typeOfNodes:e,dispatch:t,setContextMenu:n,contextMenuPosition:r,isRecursionAllowed:i=!0,currentNodeType:s}){const a=Object.keys(e);if(a.length===0)return[];function l(g,h){if(h||!s)return g;const m=ew({typeOfNodes:e},s);return g.filter(x=>!m.has(x))}const u=l(a,i),d=[];for(let g=0;g<u.length;g++){const h=u[g],m=e[h],x=m.locationInContextMenu??[],v=m.priorityInContextMenu??0,b={kind:"leaf",item:{id:`add-${String(h)}`,label:m.name,onClick:()=>{t({type:ft.ADD_NODE_AND_SELECT,payload:{type:h,position:r}}),n({isOpen:!1,position:{x:0,y:0}})}},priority:v,insertionIndex:g};if(x.length===0)d.push(b);else{let S=d;for(const N of x){let w=S.find(I=>I.kind==="folder"&&I.label===N);w||(w={kind:"folder",label:N,children:[]},S.push(w)),S=w.children}S.push(b)}}hb(d);const f=gb(d);return[{id:"add-node",label:"Add Node",icon:T.createElement(Jh,{className:"w-4 h-4"}),subItems:f}]}const yb=_T,$f=T.forwardRef(({className:e,children:t,...n},r)=>y.jsxs(vy,{ref:r,className:ye("flex h-[44px] w-full items-center justify-between rounded-md border cursor-pointer border-secondary-dark-gray bg-primary-black px-4 py-2 text-[27px] leading-[27px] font-main text-primary-white data-[placeholder]:text-[#6B6B6B] focus:outline-none focus-visible:ring-1 focus-visible:ring-white disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[y.jsx("span",{className:"text-left truncate",children:t}),y.jsx(NT,{asChild:!0,children:y.jsx(Ei,{className:"h-6 w-6 shrink-0 ml-2"})})]}));$f.displayName=vy.displayName;const Hf=T.forwardRef(({className:e,...t},n)=>y.jsx(_y,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(su,{className:"h-4 w-4"})}));Hf.displayName=_y.displayName;const Bf=T.forwardRef(({className:e,...t},n)=>y.jsx(Ny,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(Ei,{className:"h-4 w-4"})}));Bf.displayName=Ny.displayName;const Vf=T.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>y.jsx(IT,{children:y.jsxs(wy,{ref:i,className:ye("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-secondary-dark-gray bg-[#181818] text-primary-white shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[y.jsx(Hf,{}),y.jsx(ET,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),y.jsx(Bf,{})]})}));Vf.displayName=wy.displayName;const vb=T.forwardRef(({className:e,...t},n)=>y.jsx(by,{ref:n,className:ye("py-1.5 px-2 text-[27px] leading-[27px] font-main font-semibold text-primary-white",e),...t}));vb.displayName=by.displayName;const qc=T.forwardRef(({className:e,children:t,...n},r)=>y.jsxs(Sy,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-4 pr-2 text-[27px] leading-[27px] font-main text-primary-white outline-none focus:bg-[#3F3F3F] focus:text-primary-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[y.jsx(CT,{children:t}),y.jsx("span",{className:"ml-auto",children:y.jsx(AT,{children:y.jsx(sa,{className:"h-5 w-5 ml-2 mr-1",strokeWidth:2.5})})})]}));qc.displayName=Sy.displayName;const xb=T.forwardRef(({className:e,...t},n)=>y.jsx(Iy,{ref:n,className:ye("-mx-1 my-1 h-px bg-secondary-dark-gray",e),...t}));xb.displayName=Iy.displayName;const X2=TT,Ff=T.forwardRef(({className:e,...t},n)=>y.jsx(xy,{ref:n,className:ye(e),...t}));Ff.displayName=xy.displayName;const K2={small:{wrapper:"rounded-sm border border-secondary-dark-gray/80",button:"px-2.5 py-0.5 text-[12px]",divider:"border-l border-secondary-dark-gray/50",activeBg:"bg-primary-blue text-white",inactiveBg:"bg-[#1a1a1a] text-secondary-light-gray hover:bg-primary-dark-gray hover:text-primary-white"},normal:{wrapper:"rounded-md border border-runner-timeline-box-border bg-runner-inset-bg p-[3px]",button:"rounded px-3.5 py-1 text-[13px]",divider:"",activeBg:"bg-primary-blue text-white",inactiveBg:"bg-[#1a1a1a] text-secondary-light-gray"}};function zf({options:e,value:t,onChange:n,disabled:r=!1,size:i="normal",className:s}){const a=K2[i];return y.jsx("div",{className:ye("flex overflow-hidden",a.wrapper,s),children:e.map((l,u)=>y.jsx("button",{type:"button",onClick:()=>n(l.value),disabled:r,className:ye("btn-press font-medium transition-all duration-100",a.button,u>0&&a.divider,t===l.value?a.activeBg:a.inactiveBg,r&&t!==l.value&&"cursor-not-allowed opacity-50",!r&&t!==l.value&&i==="normal"&&"hover:text-primary-white"),children:l.label},l.value))})}const Z2=[{value:"instant",label:"Instant"},{value:"stepByStep",label:"Step-by-Step"}],J2={idle:{color:"bg-secondary-dark-gray",pulse:!1,label:"Idle"},compiling:{color:"bg-primary-blue",pulse:!0,label:"Compiling"},running:{color:"bg-status-completed",pulse:!0,label:"Running"},paused:{color:"bg-status-warning",pulse:!1,label:"Paused"},completed:{color:"bg-status-completed",pulse:!1,label:"Completed"},errored:{color:"bg-status-errored",pulse:!1,label:"Error"}};function Ns({icon:e,onClick:t,disabled:n,active:r=!1,variant:i="default",title:s}){const a=i==="play";return y.jsx("button",{type:"button",onClick:t,disabled:n,title:s,className:ye("btn-press flex items-center justify-center transition-all duration-100",a?"h-8 w-8 rounded-md bg-primary-blue text-white shadow-[0_0_12px_rgba(74,120,194,0.4)]":"h-7 w-7 rounded",n&&"cursor-not-allowed opacity-30",!n&&!r&&!a&&"hover:bg-primary-dark-gray hover:text-white",!n&&a&&"hover:brightness-110",r&&!a&&"bg-primary-blue shadow-[0_0_8px_rgba(71,114,179,0.5)]",!n&&"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-blue"),children:e})}function wb({runnerState:e,onRun:t,onPause:n,onStep:r,onStop:i,onReset:s,mode:a,onModeChange:l,maxLoopIterations:u,onMaxLoopIterationsChange:d}){const f=J2[e],g=e==="idle"||e==="completed"||e==="errored",h=e==="idle"||e==="errored",m=e==="running",x=e==="paused"||e==="idle"||e==="errored",v=e==="running"||e==="paused",b=e==="completed"||e==="errored";return y.jsxs("div",{className:"flex h-11 w-full items-center gap-2 border-b border-secondary-dark-gray bg-runner-toolbar-bg px-3",children:[y.jsxs("div",{className:"flex w-[140px] items-center gap-2.5",children:[y.jsxs("div",{className:"relative flex items-center justify-center",children:[y.jsx("div",{className:ye("h-2.5 w-2.5 rounded-full transition-colors duration-200",f.color,f.pulse&&"animate-pulse",f.pulse&&"shadow-[0_0_8px_currentColor]")}),f.pulse&&y.jsx("div",{className:ye("absolute h-2.5 w-2.5 animate-ping rounded-full opacity-50",f.color)})]}),y.jsx("span",{className:"text-[14px] text-primary-white",children:f.label})]}),y.jsx("div",{className:"mx-3 h-6 w-px bg-secondary-dark-gray"}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(Ns,{icon:y.jsx(au,{className:"h-3.5 w-3.5 fill-current"}),onClick:t,disabled:!h,active:e==="running",variant:"play",title:"Run"}),y.jsx(Ns,{icon:y.jsx(H_,{className:"h-4 w-4 text-primary-white"}),onClick:n,disabled:!m,title:"Pause"}),y.jsx(Ns,{icon:y.jsx(V_,{className:"h-4 w-4 text-primary-white"}),onClick:r,disabled:!x,title:"Step"}),y.jsx(Ns,{icon:y.jsx(tg,{className:"h-4 w-4 text-primary-white"}),onClick:i,disabled:!v,title:"Stop"}),y.jsx(Ns,{icon:y.jsx(B_,{className:"h-4 w-4 text-primary-white"}),onClick:s,disabled:!b,title:"Reset"})]}),y.jsx("div",{className:"mx-3 h-6 w-px bg-secondary-dark-gray"}),y.jsx(sn,{content:"Instant runs the entire graph at once, then enables replay. Step-by-Step pauses after each node so you can inspect intermediate values.",children:y.jsx(zf,{options:Z2,value:a,onChange:l,disabled:!g,size:"small"})}),y.jsx(sn,{content:"Maximum loop iterations before the runner throws an error. Protects against infinite loops.",children:y.jsx("div",{className:ye("ml-4",!g&&"pointer-events-none opacity-50"),children:y.jsx(ni,{name:"Max Loops",value:u,onChange:S=>d(Math.max(1,Math.round(S))),size:"small",decimals:0})})})]})}const bb=T.createContext(null);function Q2({children:e}){const[t,n]=T.useState(null),[r,i]=T.useState(!0),[s,a]=T.useState(!0),[l,u]=T.useState(!0),[d,f]=T.useState("execution"),[g,h]=T.useState(!1),[m,x]=T.useState(new Map),[v,b]=T.useState(2),S=T.useCallback(()=>{const I={};for(const[k,A]of m)I[k]=A;return{selectedStepIndex:t,edgeValuesAnimated:r,panelOpen:s,autoScroll:l,timeMode:d,timelineCollapsed:g,selectedIterations:I,autoplayIntervalSec:v}},[t,r,s,l,d,g,m,v]),N=T.useCallback(I=>{I.selectedStepIndex!==void 0&&n(I.selectedStepIndex),I.edgeValuesAnimated!==void 0&&i(I.edgeValuesAnimated),I.panelOpen!==void 0&&a(I.panelOpen),I.autoScroll!==void 0&&u(I.autoScroll),I.timeMode!==void 0&&f(I.timeMode),I.timelineCollapsed!==void 0&&h(I.timelineCollapsed),I.selectedIterations&&x(new Map(Object.entries(I.selectedIterations).map(([k,A])=>[k,A]))),I.autoplayIntervalSec!==void 0&&b(I.autoplayIntervalSec)},[]),w=T.useMemo(()=>({selectedStepIndex:t,setSelectedStepIndex:n,edgeValuesAnimated:r,setEdgeValuesAnimated:i,isRunnerPanelOpen:s,setIsRunnerPanelOpen:a,autoScroll:l,setAutoScroll:u,timeMode:d,setTimeMode:f,timelineCollapsed:g,setTimelineCollapsed:h,selectedIterations:m,setSelectedIterations:x,autoplayIntervalSec:v,setAutoplayIntervalSec:b,getViewState:S,restoreViewState:N}),[t,r,s,l,d,g,m,v,S,N]);return y.jsx(bb.Provider,{value:w,children:e})}function Uf(){const e=T.useContext(bb);if(!e)throw new Error("useRecordingViewState must be used within a RecordingViewStateProvider");return e}const Is=.5,Wf=1e4,eD=.003,Sb=3;function tD({adjustedTotalDuration:e,timePadRightMs:t,gutterWidth:n}){const r=T.useRef(null),i=T.useRef(!1),s=T.useRef(0),a=T.useRef(0),[l,u]=T.useState(0),d=T.useRef(null),f=T.useRef(null),g=r.current;if(g!==f.current&&(d.current&&(d.current.disconnect(),d.current=null),f.current=g,g)){u(g.clientWidth);const P=new ResizeObserver(L=>{const j=L[0];j&&u(j.contentRect.width)});P.observe(g),d.current=P}T.useEffect(()=>()=>{d.current?.disconnect()},[]);const[h,m]=T.useState(!0),[x,v]=T.useState(Is),b=T.useMemo(()=>{const P=l-n;return P<=0||e<=0?Is:Math.max(Is,Math.min(Wf,P/(e*(1+t))))},[l,n,e,t]),S=h?b:x,N=T.useRef(b);T.useLayoutEffect(()=>{if(!h||N.current===b)return;N.current=b;const P=r.current;P&&(P.scrollLeft=0)},[h,b]);const w=T.useRef(null);T.useLayoutEffect(()=>{w.current!==null&&r.current&&(r.current.scrollLeft=w.current,w.current=null)});const I=T.useCallback(()=>{m(!0);const P=r.current;P&&(P.scrollLeft=0)},[]),k=T.useCallback(P=>{const L=r.current;if(!L)return;const j=L.scrollLeft+(L.clientWidth-n)/2,O=h?b:x,W=j/O,z=Math.max(Is,Math.min(Wf,O*P));w.current=W*z-(L.clientWidth-n)/2,m(!1),v(z)},[n,h,b,x]),A=T.useRef(S);A.current=S;const M=T.useRef(n);M.current=n;const B=T.useRef(h);B.current=h;const U=T.useRef(null);U.current||(U.current=P=>{if(!P.shiftKey)return;P.preventDefault();const L=r.current;if(!L)return;const j=M.current,O=L.getBoundingClientRect(),W=P.clientX-O.left+L.scrollLeft-j,z=A.current,Y=W/z,J=-P.deltaY*eD,ie=Math.pow(2,J),ee=Math.max(Is,Math.min(Wf,z*ie));w.current=Y*ee-(P.clientX-O.left-j),m(!1),v(ee)});const q=T.useRef(null);T.useEffect(()=>{const P=r.current,L=U.current;if(P!==q.current)return q.current&&q.current.removeEventListener("wheel",L),q.current=P,P&&P.addEventListener("wheel",L,{passive:!1}),()=>{q.current&&(q.current.removeEventListener("wheel",L),q.current=null)}});const D=T.useRef(0),$=T.useRef(0),F=T.useRef(!1),E=T.useCallback(P=>{if(P.button!==0&&P.button!==1)return;const L=r.current;if(!L)return;P.preventDefault(),i.current=!0,F.current=!1,s.current=P.clientX,D.current=P.clientY,a.current=L.scrollLeft,$.current=L.scrollTop,L.style.cursor="grabbing",document.body.style.userSelect="none";const j=W=>{if(!i.current)return;W.preventDefault();const z=W.clientX-s.current,Y=W.clientY-D.current;(Math.abs(z)>Sb||Math.abs(Y)>Sb)&&(F.current=!0),L.scrollLeft=a.current-z,L.scrollTop=$.current-Y},O=()=>{i.current=!1,L.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",O),document.removeEventListener("mouseleave",O),requestAnimationFrame(()=>{F.current=!1})};document.addEventListener("mousemove",j),document.addEventListener("mouseup",O),document.addEventListener("mouseleave",O)},[]);return{timeScale:S,scrollContainerRef:r,fitToView:I,zoomBy:k,handlePanStart:E,didPanMoveRef:F}}const nD=6;function _b(e,t){const n=e.startTime*t,r=Math.max(e.duration*t,nD);return n+r/2}function Nb(e,t,n){if(t.length===0)return null;let r=t[0].stepIndex,i=1/0;for(const s of t){const a=_b(s,n),l=Math.abs(a-e);l<i&&(i=l,r=s.stepIndex)}return r}function rD({steps:e,timeScale:t,contentWidth:n,currentStepIndex:r,scrollContainerRef:i,gutterWidth:s,onScrubTo:a}){const[l,u]=T.useState(null),[d,f]=T.useState(null),g=T.useRef(null),h=l!==null,m=T.useRef(!1),x=T.useRef(r);x.current!==r&&!h&&(m.current=!0),x.current=r;const v=e[r],b=v?_b(v,t):0,S=l??b,N=T.useCallback(A=>{const M=i.current;if(!M||e.length===0)return;const B=M.getBoundingClientRect(),U=A-B.left+M.scrollLeft-s,q=Math.max(0,Math.min(U,n));u(q);const D=Nb(q,e,t);g.current=D,f(D),D!==null&&a(D);const $=E=>{const P=M.getBoundingClientRect(),L=E.clientX-P.left+M.scrollLeft-s,j=Math.max(0,Math.min(L,n));u(j);const O=Nb(j,e,t);O!==g.current&&O!==null&&a(O),g.current=O,f(O)},F=()=>{document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",F),g.current!==null&&a(g.current),g.current=null,u(null),f(null),m.current=!0,setTimeout(()=>{m.current=!1},200)};document.addEventListener("mousemove",$),document.addEventListener("mouseup",F)},[e,t,n,s,i,a]),w=T.useCallback(A=>{A.stopPropagation(),N(A.clientX)},[N]),I=T.useCallback(A=>{A.stopPropagation(),A.preventDefault(),N(A.clientX)},[N]),k=T.useCallback(()=>{m.current=!1},[]);return{scrubberPx:S,isDraggingScrubber:h,nearestDragStepIndex:d,isSnapping:m.current,startScrubDrag:N,handleRulerScrubDown:w,handleScrubberMouseDown:I,onSnapTransitionEnd:k}}const Es=28,Ts=3,Yc=4,oD=32,Gf=6,Ib=0,Eb=.15,Tb=48,Cb=50,Ab=18,iD=[{value:"execution",label:"Execution"},{value:"wallClock",label:"Wall Clock"}],sD={completed:"bg-runner-bar-completed",errored:"bg-runner-bar-errored",skipped:"bg-status-skipped"},aD={completed:"text-status-completed",errored:"text-status-errored",skipped:"text-secondary-light-gray"},cD={completed:"Done",errored:"Error",skipped:"Skipped"};function kb(e){const t=Math.pow(10,Math.floor(Math.log10(e))),n=e/t;return n<=1?t:n<=2?2*t:n<=5?5*t:10*t}function Mb(e){return e===0||e<0?"0":e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(e<10?1:0)}ms`:`${(e/1e3).toFixed(2)}s`}function lD(e){return e.estimatedTiming?"< 0.1ms":`${e.duration.toFixed(2)}ms`}function uD(e){const t=new Map;for(const n of e){const r=t.get(n.concurrencyLevel);r?r.push(n):t.set(n.concurrencyLevel,[n])}return t}const Ob={loopStart:0,preStop:1,loopStop:2,postStop:3,loopEnd:4};function dD(e,t){const n=e.loopPhase?Ob[e.loopPhase]:1,r=t.loopPhase?Ob[t.loopPhase]:1;return n!==r?n-r:e.startTime-t.startTime}function Pb(e,t,n){const r=t.iterations.map(i=>{const s=i.stepRecords;if(s.length===0)return{...i,adjustedStartTime:i.startTime,adjustedEndTime:i.endTime,adjustedDuration:i.duration};let a=1/0,l=-1/0;for(const u of s){const d=n?u.startTime-u.pauseAdjustment:u.startTime,f=n?u.endTime-u.pauseAdjustment:u.endTime;d<a&&(a=d),f>l&&(l=f)}return{...i,adjustedStartTime:a,adjustedEndTime:l,adjustedDuration:l-a}});return{kind:"loop",loopStructureId:e,loopRecord:t,adjustedIterations:r,iterations:t.iterations.map(i=>({iteration:i.iteration,conditionValue:i.conditionValue,steps:[...i.stepRecords].sort(dD).map(s=>({...s,startTime:n?s.startTime-s.pauseAdjustment:s.startTime,endTime:n?s.endTime-s.pauseAdjustment:s.endTime,loopStructureId:void 0,loopIteration:void 0})),nestedLoopRecords:i.nestedLoopRecords}))}}function Rb(e,t,n){const r=[];let i=[];const s=new Map;for(const a of e)if(a.loopStructureId!==void 0&&a.loopIteration!==void 0){const u=a.loopStructureId,d=t.get(u);if(!d)continue;if(!s.has(u)&&i.length>0&&(r.push({kind:"flat",steps:i}),i=[]),!s.has(u)){const f=Pb(u,d,n);s.set(u,f),r.push(f)}}else{if(a.loopStructureId!==void 0&&!t.has(a.loopStructureId))continue;i.push(a)}i.length>0&&r.push({kind:"flat",steps:i});for(const[a,l]of t){if(s.has(a))continue;const u=Pb(a,l,n),d=l.iterations[0]?.startTime??0;let f=r.length;for(let g=r.length-1;g>=0;g--){const h=r[g];if((h.kind==="flat"?h.steps[0]?.startTime??0:h.loopRecord.iterations[0]?.startTime??0)<=d){if(h.kind==="flat"){const x=h.steps.filter(b=>b.startTime<=d),v=h.steps.filter(b=>b.startTime>d);if(x.length>0&&v.length>0){r.splice(g,1,{kind:"flat",steps:x},u,{kind:"flat",steps:v}),f=-1;break}}f=g+1;break}}f>=0&&r.splice(f,0,u)}return r}function fD({step:e}){return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[12px] font-semibold text-primary-white",children:e.nodeTypeName}),y.jsx("span",{className:ye("text-[10px] font-medium",aD[e.status]),children:cD[e.status]})]}),y.jsxs("div",{className:"mt-1 flex items-center gap-2 text-[10px] text-secondary-light-gray",children:[y.jsx("span",{className:"font-mono tabular-nums",children:lD(e)}),y.jsx("span",{className:"text-secondary-dark-gray",children:"·"}),y.jsxs("span",{children:["Step ",e.stepIndex]}),e.loopIteration!==void 0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-secondary-dark-gray",children:"·"}),y.jsxs("span",{children:["Iter ",e.loopIteration]})]})]})]})}function pD({step:e,timeScale:t,timeOffset:n=0,isSelected:r,isSnapped:i,isNearestDragTarget:s,onClick:a,onScrubTo:l,subRowTop:u,subRowHeight:d}){const f=(e.startTime-n)*t,g=Math.max(e.duration*t,Gf),h=g>Cb&&d>=Ab;return y.jsx(sn,{as:"div",placement:"top",content:y.jsx(fD,{step:e}),className:ye("timeline-block absolute cursor-pointer rounded-[2px]",sD[e.status],r&&"z-10 ring-1 ring-white ring-offset-0",!r&&i&&!s&&"z-10 ring-2 ring-primary-blue ring-offset-0 shadow-[0_0_12px_rgba(71,114,179,0.4)]",!r&&s&&"z-10 ring-1 ring-white/70 ring-offset-0 brightness-125 shadow-[0_0_20px_rgba(71,114,179,0.7)]"),style:{left:`${f}px`,width:`${g}px`,top:`${u}px`,height:`${d}px`},triggerProps:{"data-step-index":e.stepIndex,onClick:m=>{m.stopPropagation(),a()},onContextMenu:m=>{m.preventDefault(),m.stopPropagation(),l()}},children:h&&y.jsx("span",{className:"block truncate px-2 text-[12px] font-normal text-[#eee] drop-shadow-sm select-none",style:{lineHeight:`${d}px`},children:e.nodeTypeName})})}function hD({steps:e,timeScale:t,timeOffset:n=0,contentWidth:r,selectedStepIndex:i,currentStepIndex:s,nearestDragStepIndex:a,onStepClick:l,onScrubTo:u}){const d=e.length,f=d>1?(d-1)*Yc:0,g=d>1?Es+(d-1)*(Es-Ts*2)+f:Es,h=g-Ts*2-f,m=d>0?h/d:h;return y.jsx("div",{className:"relative",style:{height:`${g}px`,width:`${r}px`,marginBottom:`${Yc}px`},children:e.map((x,v)=>y.jsx(pD,{step:x,timeScale:t,timeOffset:n,isSelected:i===x.stepIndex,isSnapped:s===x.stepIndex,isNearestDragTarget:a===x.stepIndex,onClick:()=>l(x),onScrubTo:()=>u(x.stepIndex),subRowTop:Ts+v*(m+Yc),subRowHeight:m},`${x.nodeId}-${x.stepIndex}`))})}function Lb({steps:e,timeScale:t,contentWidth:n,selectedStepIndex:r,currentStepIndex:i,nearestDragStepIndex:s,onStepClick:a,onScrubTo:l}){const u=T.useMemo(()=>uD(e),[e]),d=T.useMemo(()=>Array.from(u.keys()).sort((f,g)=>f-g),[u]);return e.length===0?null:y.jsx(y.Fragment,{children:d.map(f=>{const g=u.get(f);return g?y.jsx(hD,{steps:g,timeScale:t,contentWidth:n,selectedStepIndex:r,currentStepIndex:i,nearestDragStepIndex:s,onStepClick:a,onScrubTo:l},`flat-${f}`):null})})}function gD({iterRecord:e,iterDisplay:t,loopRecord:n}){const r=e.iteration===n.totalIterations-1&&e.conditionValue===!0;return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("span",{className:"text-[12px] font-semibold text-primary-white",children:["Loop Iteration ",e.iteration]}),r?y.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-status-errored",children:[y.jsx(ng,{className:"h-2.5 w-2.5"})," max exceeded"]}):e.conditionValue?y.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-status-completed",children:[y.jsx(sa,{className:"h-2.5 w-2.5"})," continues"]}):y.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-secondary-light-gray",children:[y.jsx(aa,{className:"h-2.5 w-2.5"})," exits"]})]}),y.jsxs("div",{className:"mt-1 flex items-center gap-2 text-[10px] text-secondary-light-gray",children:[y.jsxs("span",{className:"font-mono tabular-nums",children:[e.duration.toFixed(2),"ms"]}),y.jsx("span",{className:"text-secondary-dark-gray",children:"·"}),y.jsxs("span",{children:[t.steps.length," steps"]})]})]})}function mD({segment:e,timeScale:t,contentWidth:n,selectedIteration:r,onSelectIteration:i,selectedStepIndex:s}){const{loopRecord:a,iterations:l}=e,u=a.iterations.length>0&&a.iterations[a.iterations.length-1].conditionValue===!0;return y.jsx("div",{className:"relative",style:{height:`${Es}px`,width:`${n}px`,marginBottom:`${Yc}px`},children:e.adjustedIterations.map((d,f)=>{const g=l[f];if(!g)return null;const h=d.adjustedStartTime*t,m=Math.max(d.adjustedDuration*t,Gf),x=r===d.iteration,v=u&&f===a.iterations.length-1,b=s!==null&&g.steps.some(w=>w.stepIndex===s),S=Es-Ts*2,N=m>Cb&&S>=Ab;return y.jsx(yD,{iterRecord:d,iterDisplay:g,loopRecord:a,left:h,width:m,blockHeight:S,showLabel:N,isSelected:x,isLastAndError:v,hasSelectedStep:b,onSelect:()=>i(d.iteration)},d.iteration)})})}function yD({iterRecord:e,iterDisplay:t,loopRecord:n,left:r,width:i,blockHeight:s,showLabel:a,isSelected:l,isLastAndError:u,hasSelectedStep:d,onSelect:f}){return y.jsx(sn,{as:"div",placement:"top",content:y.jsx(gD,{iterRecord:e,iterDisplay:t,loopRecord:n}),className:ye("absolute cursor-pointer rounded-[2px] bg-[#8c52d1]/60",l&&"z-10 ring-1 ring-[#8c52d1] ring-offset-0 bg-[#8c52d1]/80",!l&&d&&"z-10 ring-1 ring-white/50 ring-offset-0",u&&"border border-status-errored/50"),style:{left:`${r}px`,width:`${i}px`,top:`${Ts}px`,height:`${s}px`},triggerProps:{onClick:g=>{g.stopPropagation(),f()}},children:a?y.jsxs("span",{className:"flex items-center gap-1 truncate px-2 text-[11px] font-normal text-[#eee] drop-shadow-sm select-none",style:{lineHeight:`${s}px`},children:[y.jsx(Qh,{className:"h-2.5 w-2.5 flex-shrink-0"}),"Iter ",e.iteration]}):y.jsx("span",{className:"flex items-center justify-center text-[9px] font-medium text-[#eee] select-none",style:{lineHeight:`${s}px`},children:e.iteration})})}function vD({iteration:e,nestedLoopRecords:t,adjustForPause:n,selectedIterations:r,onSelectIteration:i,timeScale:s,contentWidth:a,selectedStepIndex:l,currentStepIndex:u,nearestDragStepIndex:d,onStepClick:f,onScrubTo:g}){const{steps:h}=e,m=T.useMemo(()=>Rb(h,t,n),[h,t,n]);return m.length===0?y.jsx("div",{className:"py-2 text-center text-[10px] text-secondary-light-gray",children:"No steps in this iteration"}):y.jsx("div",{className:"relative pb-1",style:{minHeight:"40px"},children:y.jsx("div",{className:"relative",style:{width:`${a}px`},children:m.map((x,v)=>{if(x.kind==="flat")return y.jsx(Lb,{steps:x.steps,timeScale:s,contentWidth:a,selectedStepIndex:l,currentStepIndex:u,nearestDragStepIndex:d,onStepClick:f,onScrubTo:g},`iter-${e.iteration}-flat-${v}`);const b=x.loopStructureId,S=r.get(b)??null;return y.jsx(Db,{segment:x,timeScale:s,contentWidth:a,selectedIteration:S,onSelectIteration:N=>{const w=r.get(b);i(b,w===N?null:N)},selectedStepIndex:l,currentStepIndex:u,nearestDragStepIndex:d,onStepClick:f,onScrubTo:g,adjustForPause:n,selectedIterations:r,onNestedSelectIteration:i},`iter-${e.iteration}-loop-${b}`)})})})}function Db({segment:e,timeScale:t,contentWidth:n,selectedIteration:r,onSelectIteration:i,selectedStepIndex:s,currentStepIndex:a,nearestDragStepIndex:l,onStepClick:u,onScrubTo:d,adjustForPause:f,selectedIterations:g,onNestedSelectIteration:h}){const{iterations:m}=e,x=r!==null?m[r]??null:null;return y.jsxs("div",{children:[y.jsx(mD,{segment:e,timeScale:t,contentWidth:n,selectedIteration:r,onSelectIteration:i,selectedStepIndex:s}),x&&y.jsxs("div",{className:"mb-1",children:[y.jsxs("div",{className:"sticky left-0 z-[5] ml-4 flex w-fit items-center gap-2 rounded-t-[3px] border border-b-0 border-[#8c52d1]/30 bg-runner-timeline-box-bg px-2 py-1 text-[10px]",children:[y.jsx(Qh,{className:"h-2.5 w-2.5 text-[#8c52d1]"}),y.jsxs("span",{className:"font-medium text-primary-white",children:["Iteration ",x.iteration]}),y.jsxs("span",{className:"text-secondary-light-gray",children:[x.steps.length," step",x.steps.length!==1?"s":""]}),x.conditionValue?y.jsxs("span",{className:"flex items-center gap-0.5 text-status-completed/70",children:[y.jsx(sa,{className:"h-2.5 w-2.5"})," continues"]}):y.jsxs("span",{className:"flex items-center gap-0.5 text-secondary-light-gray",children:[y.jsx(aa,{className:"h-2.5 w-2.5"})," exits"]})]}),y.jsx("div",{className:"-mt-px rounded-[3px] border border-[#8c52d1]/30 bg-runner-timeline-box-bg/50",children:y.jsx(vD,{iteration:x,nestedLoopRecords:x.nestedLoopRecords,adjustForPause:f,selectedIterations:g,onSelectIteration:h,timeScale:t,contentWidth:n,selectedStepIndex:s,currentStepIndex:a,nearestDragStepIndex:l,onStepClick:u,onScrubTo:d})})]})]})}function xD({timeScale:e,contentWidth:t,totalDuration:n,onScrubDown:r}){const i=Tb/e,s=kb(i),a=[];for(let l=0;l<=n+s;l+=s)a.push(l);return y.jsx("div",{className:"relative border-b border-[#3a3a3a] bg-runner-ruler-bg",style:{height:`${oD}px`,width:`${t}px`},children:y.jsx("div",{className:"relative h-full cursor-ew-resize select-none",onMouseDown:r,children:a.map(l=>{const u=l*e;return u>t?null:y.jsxs("div",{className:"absolute bottom-1 -translate-x-1/2",style:{left:`${u}px`},children:[y.jsx("span",{className:"font-mono text-[11px] tabular-nums text-[#9a9a9a] select-none whitespace-nowrap",children:Mb(l)}),y.jsx("div",{className:"absolute -bottom-1 left-1/2 h-1 w-px bg-[#555]"})]},l)})})})}function wD({timeScale:e,contentWidth:t,totalDuration:n}){const r=Tb/e,i=kb(r),s=[];for(let a=0;a<=n+i;a+=i){const l=a*e;l<=t&&s.push(l)}return y.jsx("div",{className:"pointer-events-none absolute inset-0",children:s.map(a=>y.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-runner-grid-line",style:{left:`${a}px`}},a))})}function bD({timeMs:e,isDragging:t}){return y.jsxs("div",{className:"flex flex-col items-center",children:[y.jsx("div",{className:ye("rounded px-1.5 py-0.5 font-mono text-[11px] text-white whitespace-nowrap",t?"bg-[#6a9be0]":"bg-runner-scrubber-blue"),children:Mb(e)}),y.jsx("div",{className:"h-0 w-0 border-l-[4px] border-r-[4px] border-t-[4px] border-l-transparent border-r-transparent border-t-runner-scrubber-blue"})]})}function jb({record:e,currentStepIndex:t,onScrubTo:n,onStepClick:r,selectedStepIndex:i,onNavigateToNode:s}){const{autoScroll:a,setAutoScroll:l,timeMode:u,setTimeMode:d,timelineCollapsed:f,setTimelineCollapsed:g,selectedIterations:h,setSelectedIterations:m,autoplayIntervalSec:x,setAutoplayIntervalSec:v}=Uf(),b=(e?.totalPauseDuration??0)>0,S=T.useMemo(()=>e?u==="wallClock"?e.steps:e.steps.map(ae=>({...ae,startTime:ae.startTime-ae.pauseAdjustment,endTime:ae.endTime-ae.pauseAdjustment})):[],[e,u]),N=e?u==="execution"?e.totalDuration-e.totalPauseDuration:e.totalDuration:0,w=T.useMemo(()=>e?Rb(S,e.loopRecords,u==="execution"):[],[S,e,u]),I=T.useRef(!1);T.useEffect(()=>{if(I.current||w.length===0)return;const ae=w.find(Ie=>Ie.kind==="loop");ae&&(I.current=!0,m(new Map([[ae.loopStructureId,0]])))},[w]),T.useEffect(()=>{if(i===null||!e)return;const ae=e.steps.find(Ie=>Ie.stepIndex===i);ae?.loopStructureId!==void 0&&ae.loopIteration!==void 0&&m(Ie=>{const Be=new Map(Ie);return Be.set(ae.loopStructureId,ae.loopIteration),Be})},[i,e]);const{timeScale:k,scrollContainerRef:A,fitToView:M,zoomBy:B,handlePanStart:U,didPanMoveRef:q}=tD({adjustedTotalDuration:N,timePadRightMs:Eb,gutterWidth:Ib}),D=N+N*Eb,$=D*k,{scrubberPx:F,isDraggingScrubber:E,nearestDragStepIndex:P,isSnapping:L,handleRulerScrubDown:j,handleScrubberMouseDown:O,onSnapTransitionEnd:W}=rD({steps:S,timeScale:k,contentWidth:$,currentStepIndex:t,scrollContainerRef:A,gutterWidth:Ib,onScrubTo:n}),z=T.useCallback(ae=>{q.current||r(ae)},[r,q]),Y=k>0?F/k:0,J=T.useRef(null),[ie,ee]=T.useState(!1),ce=T.useRef(null),ge=i??t,Q=e!==null&&ge>0,te=e!==null&&ge<e.steps.length-1,ne=T.useCallback(ae=>{const Ie=A.current;if(!Ie||k<=0)return;const Be=S.find(Nt=>Nt.stepIndex===ae.stepIndex),Ue=(Be?Be.startTime:ae.startTime-ae.pauseAdjustment)*k,Ze=Be?Be.endTime-Be.startTime:ae.duration,pt=Math.max(Ze*k,Gf),Cn=Ue+pt/2,cn=Math.max(0,Cn-Ie.clientWidth/2);setTimeout(()=>{const Nt=A.current;if(!Nt)return;let $t=Nt.scrollTop;const ln=Nt.querySelector(`[data-step-index="${ae.stepIndex}"]`);if(ln){const Or=Nt.getBoundingClientRect(),Un=ln.getBoundingClientRect(),fo=Un.top+Un.height/2,po=Or.top+Or.height/2,Pr=fo-po;Math.abs(Pr)>4&&($t=Nt.scrollTop+Pr)}Nt.scrollTo({left:cn,top:$t,behavior:"smooth"})},50)},[A,k,S]),oe=T.useCallback(ae=>{ae.loopStructureId!==void 0&&ae.loopIteration!==void 0&&m(Ie=>{if(Ie.get(ae.loopStructureId)===ae.loopIteration)return Ie;const Be=new Map(Ie);return Be.set(ae.loopStructureId,ae.loopIteration),Be})},[m]),pe=T.useCallback(()=>{if(!e||ge<=0)return;const ae=e.steps[ge-1];ae&&(oe(ae),r(ae),a&&(s?.(ae.nodeId),ne(ae)))},[e,ge,r,s,ne,a,oe]),le=T.useCallback(()=>{if(!e||ge>=e.steps.length-1)return;const ae=e.steps[ge+1];ae&&(oe(ae),r(ae),a&&(s?.(ae.nodeId),ne(ae)))},[e,ge,r,s,ne,a,oe]),ve=T.useCallback(()=>{if(!e||e.steps.length===0)return;ee(!1);const ae=e.steps[0];oe(ae),r(ae),a&&(s?.(ae.nodeId),ne(ae))},[e,r,s,ne,a,oe]),me=T.useCallback(()=>{if(!e||e.steps.length===0)return;ee(!1);const ae=e.steps[e.steps.length-1];oe(ae),r(ae),a&&(s?.(ae.nodeId),ne(ae))},[e,r,s,ne,a,oe]);T.useEffect(()=>{!ie||!e||ge>=e.steps.length-1&&ee(!1)},[ie,ge,e]),T.useEffect(()=>{if(ie&&e)return ce.current=setInterval(()=>{le()},x*1e3),()=>{ce.current&&clearInterval(ce.current)};ce.current&&(clearInterval(ce.current),ce.current=null)},[ie,x,e,le]);const Oe=T.useCallback(()=>{ee(ae=>!ae)},[]),Ce=T.useRef(t);return T.useEffect(()=>{if(Ce.current===t||(Ce.current=t,!a||!e||i!==null||E))return;const ae=e.steps[t];ae&&(oe(ae),s?.(ae.nodeId),ne(ae))},[t,a,e,i,E,oe,s,ne]),e?y.jsxs("div",{className:"flex h-full flex-col bg-runner-toolbar-bg",children:[y.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("button",{type:"button",onClick:()=>g(!f),className:"btn-press flex items-center gap-2 rounded px-1.5 py-1 text-[14px] text-primary-white transition-colors hover:bg-primary-dark-gray/50",children:[y.jsx("span",{className:ye("transition-transform duration-150",!f&&"rotate-90"),children:y.jsx(zr,{className:"h-3 w-3 text-secondary-light-gray"})}),"Timeline"]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("div",{className:"flex items-center",children:[y.jsx("button",{type:"button",disabled:!Q,onClick:ve,className:ye("btn-press rounded-l-md border border-secondary-dark-gray/80 px-1 py-0.5 transition-colors",Q?"bg-primary-dark-gray text-primary-white hover:bg-primary-blue/80":"bg-secondary-black text-secondary-dark-gray pointer-events-none"),title:"Go to first step",children:y.jsx(O_,{className:"h-3.5 w-3.5"})}),y.jsx("button",{type:"button",disabled:!Q,onClick:pe,className:ye("btn-press border border-l-0 border-secondary-dark-gray/80 px-1 py-0.5 transition-colors",Q?"bg-primary-dark-gray text-primary-white hover:bg-primary-blue/80":"bg-secondary-black text-secondary-dark-gray pointer-events-none"),title:"Previous step",children:y.jsx(iu,{className:"h-3.5 w-3.5"})}),y.jsx("button",{type:"button",disabled:!e||e.steps.length===0,onClick:Oe,className:ye("btn-press border border-l-0 border-secondary-dark-gray/80 px-1.5 py-0.5 transition-colors",ie?"bg-primary-blue text-white hover:bg-primary-blue/80":e&&e.steps.length>0?"bg-primary-dark-gray text-primary-white hover:bg-primary-blue/80":"bg-secondary-black text-secondary-dark-gray pointer-events-none"),title:ie?"Stop autoplay":"Autoplay",children:ie?y.jsx(tg,{className:"h-3 w-3"}):y.jsx(au,{className:"h-3.5 w-3.5"})}),y.jsx("button",{type:"button",disabled:!te,onClick:le,className:ye("btn-press border border-l-0 border-secondary-dark-gray/80 px-1 py-0.5 transition-colors",te?"bg-primary-dark-gray text-primary-white hover:bg-primary-blue/80":"bg-secondary-black text-secondary-dark-gray pointer-events-none"),title:"Next step",children:y.jsx(zr,{className:"h-3.5 w-3.5"})}),y.jsx("button",{type:"button",disabled:!te,onClick:me,className:ye("btn-press rounded-r-md border border-l-0 border-secondary-dark-gray/80 px-1 py-0.5 transition-colors",te?"bg-primary-dark-gray text-primary-white hover:bg-primary-blue/80":"bg-secondary-black text-secondary-dark-gray pointer-events-none"),title:"Go to last step",children:y.jsx(P_,{className:"h-3.5 w-3.5"})})]}),y.jsx(sn,{content:"Seconds between each step during autoplay. Drag or click to adjust (0.5s–30s).",children:y.jsx(ni,{name:"Interval",value:x,onChange:ae=>v(Math.max(.5,ae)),min:.5,max:30,size:"small"})}),y.jsx(sn,{content:"Automatically scroll the timeline and canvas to follow the selected step",children:y.jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[12px] text-secondary-light-gray select-none",children:[y.jsx("input",{type:"checkbox",checked:a,onChange:ae=>l(ae.target.checked),className:"h-3 w-3 cursor-pointer rounded-sm accent-primary-blue"}),y.jsx("span",{className:"text-primary-white",children:"Auto-scroll"})]})})]})]}),y.jsxs("div",{className:"flex items-center gap-3",children:[b&&y.jsx(sn,{content:y.jsxs("div",{className:"space-y-1.5 text-[12px] leading-relaxed text-primary-white",children:[y.jsxs("div",{children:[y.jsx("span",{className:"font-semibold",children:"Execution"})," — Shows only computation time with pauses removed. Best for step-by-step mode."]}),y.jsxs("div",{children:[y.jsx("span",{className:"font-semibold",children:"Wall Clock"})," — Shows real elapsed time including pauses between steps."]})]}),children:y.jsx(zf,{options:iD,value:u,onChange:d,size:"small"})}),y.jsxs("div",{className:"flex items-center gap-2 font-mono text-[12px] text-primary-white",children:[y.jsx(sn,{content:"Total execution duration",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(F_,{className:"h-3.5 w-3.5"}),y.jsxs("span",{className:"tabular-nums",children:[N.toFixed(2),"ms"]})]})}),y.jsx("span",{children:"·"}),y.jsx(sn,{content:"Total number of executed steps",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(D_,{className:"h-3.5 w-3.5"}),y.jsxs("span",{children:[e.steps.length," steps"]})]})}),e.compilationDuration>0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{children:"·"}),y.jsx(sn,{content:"JIT warmup time — absorbed before execution to ensure accurate step timings",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(z_,{className:"h-3.5 w-3.5"}),y.jsxs("span",{children:["JIT ",e.compilationDuration.toFixed(1),"ms"]})]})})]})]}),y.jsx("button",{type:"button",onClick:()=>B(1.5),className:"btn-press text-primary-white transition-colors hover:text-primary-blue",title:"Zoom In",children:y.jsx(U_,{className:"h-4 w-4"})}),y.jsx("button",{type:"button",onClick:()=>B(1/1.5),className:"btn-press text-primary-white transition-colors hover:text-primary-blue",title:"Zoom Out",children:y.jsx(W_,{className:"h-4 w-4"})}),y.jsx("button",{type:"button",onClick:M,className:"btn-press text-primary-white transition-colors hover:text-primary-blue",title:"Fit to View",children:y.jsx(j_,{className:"h-4 w-4"})})]})]}),!f&&y.jsx("div",{className:"min-h-0 flex-1 px-4 pb-4",children:y.jsx("div",{className:"flex h-full flex-col overflow-hidden rounded-md border border-runner-timeline-box-border bg-runner-timeline-box-bg",children:y.jsx("div",{ref:A,className:"timeline-scrollbar min-h-0 flex-1 overflow-x-auto overflow-y-auto",onMouseDown:U,children:y.jsxs("div",{className:"relative flex min-h-full flex-col",style:{minWidth:`${$}px`},children:[y.jsxs("div",{className:"sticky top-0 z-20",children:[y.jsx(xD,{timeScale:k,contentWidth:$,totalDuration:D,onScrubDown:j}),y.jsx("div",{className:"pointer-events-none absolute inset-y-0",style:{left:`${F}px`,transition:L?"left 150ms ease-out":"none"},children:y.jsx("div",{className:"pointer-events-auto absolute left-1/2 -translate-x-1/2 cursor-ew-resize",style:{top:"2px"},onMouseDown:O,children:y.jsx(bD,{timeMs:Y,isDragging:E})})})]}),y.jsxs("div",{ref:J,className:"relative",style:{minHeight:"120px"},children:[y.jsx(wD,{timeScale:k,contentWidth:$,totalDuration:D}),y.jsx("div",{className:"pt-3",children:w.map((ae,Ie)=>{if(ae.kind==="flat")return y.jsx(Lb,{steps:ae.steps,timeScale:k,contentWidth:$,selectedStepIndex:i,currentStepIndex:t,nearestDragStepIndex:P,onStepClick:z,onScrubTo:n},`flat-${Ie}`);const Be=ae.loopStructureId,Qe=h.get(Be)??null;return y.jsx(Db,{segment:ae,timeScale:k,contentWidth:$,selectedIteration:Qe,onSelectIteration:Ue=>{m(Ze=>{const pt=new Map(Ze);return Ze.get(Be)===Ue?pt.delete(Be):pt.set(Be,Ue),pt})},selectedStepIndex:i,currentStepIndex:t,nearestDragStepIndex:P,onStepClick:z,onScrubTo:n,adjustForPause:u==="execution",selectedIterations:h,onNestedSelectIteration:(Ue,Ze)=>{m(pt=>{const Cn=new Map(pt);return Ze===null?Cn.delete(Ue):Cn.set(Ue,Ze),Cn})}},`loop-${Be}`)})})]}),y.jsxs("div",{className:"pointer-events-none absolute inset-y-0 z-[15]",style:{left:`${F}px`,transition:L?"left 150ms ease-out":"none"},onTransitionEnd:W,children:[y.jsx("div",{className:"pointer-events-auto absolute left-1/2 top-0 bottom-0 w-0.5 -translate-x-1/2 cursor-ew-resize",onMouseDown:O}),y.jsx("div",{className:"pointer-events-none absolute left-1/2 top-0 bottom-0 w-px -translate-x-1/2",style:{backgroundColor:E?"rgba(74, 133, 255, 0.7)":"rgba(74, 133, 255, 0.5)"}})]})]})})})})]}):y.jsxs("div",{className:"flex h-full flex-col bg-runner-toolbar-bg",children:[y.jsx("div",{className:"flex h-12 items-center justify-between bg-runner-toolbar-bg px-4",children:y.jsxs("div",{className:"flex items-center gap-2 text-[14px] text-primary-white",children:[y.jsx(zr,{className:"h-3 w-3 text-secondary-light-gray"}),"Timeline"]})}),y.jsx("div",{className:"flex-1 p-4 pt-0",children:y.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 rounded-md border border-runner-timeline-box-border bg-runner-timeline-box-bg",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("div",{className:"h-1.5 w-6 rounded-full bg-secondary-dark-gray"}),y.jsx("div",{className:"h-1.5 w-10 rounded-full bg-secondary-dark-gray"}),y.jsx("div",{className:"h-1.5 w-4 rounded-full bg-secondary-dark-gray"})]}),y.jsx("span",{className:"text-[11px] text-secondary-light-gray",children:"No execution record to display"})]})})]})}function SD(e){return e===void 0?"undefined":e===null?"null":typeof e=="boolean"?"boolean":typeof e=="number"?"number":typeof e=="string"?"string":e instanceof Map?`Map(${e.size})`:Array.isArray(e)?`Array(${e.length})`:typeof e=="function"?"function":`Object(${Object.keys(e).length})`}function _D(e){if(e==null)return!1;const t=typeof e;return t==="object"||t==="function"}function Cs(e,t){if(t&&_D(e))return SD(e);if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return String(e);if(typeof e=="string")return`"${e}"`;if(e instanceof Map)return`Map { ${Array.from(e.entries()).map(([r,i])=>`${String(r)}: ${Cs(i,t)}`).join(", ")} }`;if(Array.isArray(e))return`[${e.map(n=>Cs(n,t)).join(", ")}]`;try{return JSON.stringify(e,null,2)}catch{return String(e)}}const ND={completed:{bg:"bg-runner-bar-completed",text:"text-[#e0f0e0]",label:"Completed"},errored:{bg:"bg-runner-bar-errored",text:"text-[#f0e0e0]",label:"Error"},skipped:{bg:"bg-[#888888]/30",text:"text-[#888888]",label:"Skipped"}};function ID({status:e}){const t=ND[e];return y.jsx("span",{className:ye("rounded-full px-3 py-1 text-[13px] font-medium",t.bg,t.text),children:t.label})}function ED({conn:e,hideComplex:t,debugMode:n}){return y.jsxs("div",{className:"flex flex-col gap-1.5",children:[y.jsxs("div",{className:"text-[13px]",children:[y.jsx("span",{className:"text-[#9a9a9a]",children:"Coming From–"})," ",y.jsxs("span",{className:"text-primary-white/80",children:[e.sourceNodeName," / ",e.sourceHandleName]})]}),n&&y.jsxs("div",{className:"text-[9px] text-secondary-dark-gray",children:["nodeId: ",e.sourceNodeId," · handleId: ",e.sourceHandleId]}),y.jsx("div",{className:"rounded-md border border-runner-value-border bg-runner-value-bg px-3 py-2 font-mono text-[14px] text-primary-white",children:Cs(e.value,t)})]})}function TD({handleName:e,handleValue:t,hideComplex:n,debugMode:r}){return y.jsxs("div",{className:"flex flex-col gap-1.5",children:[y.jsxs("div",{className:"text-[14px] text-primary-white",children:[e," ",y.jsxs("span",{className:"text-secondary-light-gray",children:["(",t.dataTypeId,")"]})]}),t.connections.length>0?t.connections.map((i,s)=>y.jsx(ED,{conn:i,hideComplex:n,debugMode:r},`${i.sourceNodeId}-${i.sourceHandleId}-${s}`)):t.isDefault?y.jsx("div",{className:"rounded-md border border-runner-value-border bg-runner-value-bg px-3 py-2 font-mono text-[14px] text-primary-white",children:Cs(t.defaultValue,n)}):y.jsx("span",{className:"text-[13px] italic text-secondary-light-gray",children:"No value"})]})}function CD({handleName:e,handleValue:t,hideComplex:n}){return y.jsxs("div",{className:"flex flex-col gap-1.5",children:[y.jsxs("div",{className:"text-[14px] text-primary-white",children:[e," ",y.jsxs("span",{className:"text-secondary-light-gray",children:["(",t.dataTypeId,")"]})]}),y.jsx("div",{className:"rounded-md border border-runner-value-border bg-runner-value-bg px-3 py-2 font-mono text-[14px] text-primary-white",children:Cs(t.value,n)})]})}function $b({stepRecord:e,onClose:t,loopRecords:n,hideComplexValues:r=!1,debugMode:i=!1,edgeValuesAnimated:s,onEdgeValuesAnimatedChange:a}){if(!e)return null;const l=Array.from(e.inputValues.entries()),u=Array.from(e.outputValues.entries());return y.jsxs("div",{className:"flex w-[340px] animate-slide-in-right flex-col bg-runner-panel-bg",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-secondary-dark-gray px-4 py-3",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx($_,{className:"h-5 w-5 text-primary-white"}),y.jsx("span",{className:"text-[15px] tracking-wide text-primary-white",children:e.nodeTypeName})]}),y.jsxs("div",{className:"flex items-center gap-3",children:[a&&y.jsx(sn,{content:"Animate edge value badges along the connection path instead of showing them statically",children:y.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-[12px] text-secondary-light-gray select-none",children:[y.jsx("input",{type:"checkbox",checked:s??!0,onChange:d=>a(d.target.checked),className:"h-3 w-3 accent-primary-blue"}),y.jsx("span",{className:"text-primary-white",children:"Animate"})]})}),y.jsx("button",{type:"button",onClick:t,className:"btn-press rounded p-1 text-secondary-light-gray transition-colors hover:text-primary-white","aria-label":"Close",children:y.jsx(aa,{className:"h-3.5 w-3.5"})})]})]}),y.jsxs("div",{className:"flex flex-col gap-3 border-b border-secondary-dark-gray px-4 py-3.5",children:[y.jsxs("div",{className:"flex items-center justify-between rounded-md border border-runner-value-border px-3 py-2",children:[y.jsx(ID,{status:e.status}),y.jsx("span",{className:"font-mono text-[13px] text-secondary-light-gray",children:e.estimatedTiming?"< 0.1ms":`${e.duration.toFixed(2)}ms`})]}),y.jsxs("div",{className:"rounded-md border border-runner-value-border bg-runner-timeline-box-bg px-3 py-2.5",children:[y.jsxs("div",{className:"text-center text-[13px] text-secondary-light-gray",children:[e.startTime.toFixed(2),"ms"," ",y.jsx("span",{className:"text-secondary-dark-gray",children:"→"})," ",e.endTime.toFixed(2),"ms"]}),y.jsxs("div",{className:"relative mt-2 h-1.5 w-full overflow-hidden rounded-full bg-[#333]",children:[y.jsx("div",{className:"absolute h-full rounded-full bg-secondary-light-gray/50",style:{left:"20%",width:"55%"}}),y.jsx("div",{className:"absolute h-full w-0.5 bg-secondary-light-gray",style:{left:"77%"}})]})]}),(e.loopIteration!==void 0||e.groupNodeId)&&y.jsxs("div",{className:"flex flex-col gap-2",children:[e.loopIteration!==void 0&&(()=>{const d=e.loopStructureId&&n?n.get(e.loopStructureId):void 0,f=d?.iterations[e.loopIteration];return y.jsxs("div",{className:"rounded-md border border-runner-value-border px-3 py-2",children:[y.jsxs("div",{className:"text-[12px] text-primary-white",children:["Loop iteration ",e.loopIteration+1,d?` of ${d.totalIterations}`:""]}),f&&y.jsxs("div",{className:"mt-1 text-[10px] text-secondary-light-gray",children:["Condition:"," ",f.conditionValue?"true (continues)":"false (exits)"]})]})})(),e.groupNodeId&&y.jsxs("div",{className:"text-[11px] text-secondary-light-gray",children:["Group: ",e.groupNodeId,e.groupDepth!==void 0&&` (depth ${e.groupDepth})`]})]}),i&&y.jsxs("div",{className:"text-[9px] text-secondary-dark-gray",children:["nodeId: ",e.nodeId," · typeId: ",e.nodeTypeId]})]}),y.jsxs(Fy,{type:"multiple",defaultValue:["inputs","outputs"],className:"w-full",children:[y.jsxs(nd,{value:"inputs",className:"border-b border-secondary-dark-gray",children:[y.jsx(rd,{className:"gap-1.5 border-b border-secondary-dark-gray bg-runner-section-header-bg px-4 py-2.5 text-[14px] text-primary-white hover:no-underline [&>svg]:text-secondary-light-gray",children:"Inputs"}),y.jsx(od,{className:"p-4",children:y.jsx("div",{className:"flex flex-col gap-4 bg-runner-panel-bg",children:l.length>0?l.map(([d,f],g)=>y.jsxs("div",{children:[g>0&&y.jsx("div",{className:"-mx-4 mb-4 h-px bg-secondary-dark-gray"}),y.jsx(TD,{handleName:d,handleValue:f,hideComplex:r,debugMode:i})]},d)):y.jsx("div",{className:"text-[13px] italic text-secondary-light-gray",children:"No inputs"})})})]}),y.jsxs(nd,{value:"outputs",className:"border-b border-secondary-dark-gray",children:[y.jsx(rd,{className:"gap-1.5 border-b border-secondary-dark-gray bg-runner-section-header-bg px-4 py-2.5 text-[14px] text-primary-white hover:no-underline [&>svg]:text-secondary-light-gray",children:"Outputs"}),y.jsx(od,{className:"p-4",children:y.jsx("div",{className:"flex flex-col gap-4 bg-runner-panel-bg",children:u.length>0?u.map(([d,f],g)=>y.jsxs("div",{children:[g>0&&y.jsx("div",{className:"-mx-4 mb-4 h-px bg-secondary-dark-gray"}),y.jsx(CD,{handleName:d,handleValue:f,hideComplex:r})]},d)):y.jsx("div",{className:"text-[13px] italic text-secondary-light-gray",children:"No outputs"})})})]})]}),e.error&&y.jsx("div",{className:"p-4",children:y.jsxs("div",{className:"rounded-md border border-status-errored/30 bg-status-errored/10 p-2.5",children:[y.jsx("div",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wider text-status-errored",children:"Error"}),y.jsx("div",{className:"whitespace-pre-wrap font-mono text-[11px] text-status-errored",children:ib(e.error)})]})})]})}const Hb=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:s})=>{const{fromHandle:a}=V0(),l=of(a?.nodeId||""),u=T.useMemo(()=>!a?.id||!l?.data?void 0:on(a?.id,l?.data)?.value?.handleColor??"#A1A1A1",[a?.id,l?.data]),[d]=bc({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:s});return y.jsx(Jo,{path:d,className:"stroke-7! in-[g.selected]:brightness-150",style:{stroke:u||"#A1A1A1"},focusable:!0})};Hb.displayName="ConfigurableConnection";const AD=150,kD=({isOpen:e,position:t,onClose:n,items:r})=>{const[i,s]=T.useState(!1),a=T.useRef(null);T.useEffect(()=>(a.current&&(clearTimeout(a.current),a.current=null),e?s(!0):i&&(a.current=setTimeout(()=>s(!1),AD)),()=>{a.current&&clearTimeout(a.current)}),[e]);const{refs:l,floatingStyles:u,context:d}=Wc({open:e,onOpenChange:h=>{h||n()},placement:"bottom-start",middleware:[Oi(5),Ri({fallbackPlacements:["top-start"]}),Pi({padding:8})],whileElementsMounted:Mi}),f=eb(d),{getFloatingProps:g}=tb([f]);return T.useEffect(()=>{e&&l.setReference({getBoundingClientRect:()=>({x:t.x,y:t.y,width:1,height:1,top:t.y,right:t.x+1,bottom:t.y+1,left:t.x})})},[e,t,l]),i?y.jsx("div",{ref:l.setFloating,style:{...u,contain:"layout"},className:ye("z-50 transition-opacity ease-out",e?"opacity-100 duration-100":"opacity-0 duration-150"),onClick:h=>h.stopPropagation(),...g(),children:y.jsx(pb,{subItems:r})}):null};function MD({onExportState:e,onImportState:t,onExportRecording:n,onImportRecording:r,closeMenu:i}){return[{id:"import-export",label:"Import/Export",icon:T.createElement(k_,{className:"w-4 h-4"}),separator:!0,subItems:[{id:"export-state",label:"Export State",icon:T.createElement(Zh,{className:"w-4 h-4"}),onClick:()=>{e(),i()}},{id:"import-state",label:"Import State",icon:T.createElement(Kh,{className:"w-4 h-4"}),onClick:()=>{t(),i()}},{id:"export-recording",label:"Export Recording",icon:T.createElement(Zh,{className:"w-4 h-4"}),separator:!0,onClick:()=>{n(),i()}},{id:"import-recording",label:"Import Recording",icon:T.createElement(Kh,{className:"w-4 h-4"}),onClick:()=>{r(),i()}}]}]}const Bb="add-new-node-group"+rn(10),OD=({value:e,setValue:t,nodeGroups:n,handleAddNewGroup:r,enableBackButton:i,handleBack:s,openedNodeGroupStack:a})=>{const l=u=>{if(u===Bb){r?.();return}t(u)};return y.jsxs("div",{className:"absolute top-0 left-0 scale-75 origin-top-left flex items-center gap-3 m-2 max-w-full",children:[y.jsx(Qn,{className:"h-[44px] border-secondary-dark-gray bg-primary-black shrink-0",disabled:!i,onClick:s,children:y.jsx(M_,{})}),y.jsxs(yb,{value:e,onValueChange:l,children:[y.jsx($f,{className:"hover:bg-primary-dark-gray shrink-0 w-fit",children:y.jsx(Ff,{placeholder:"Node Group"})}),y.jsxs(Vf,{className:"scale-75 origin-top-left",children:[y.jsx(qc,{value:Bb,className:"pl-2",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(Jh,{}),y.jsx("p",{className:"truncate",children:"Add New Node Group"})]})}),n.map(u=>y.jsx(qc,{value:u.id,children:u.name},u.id))]})]}),y.jsx(Rf,{orientation:"horizontal",className:"relative flex-1 min-w-0",scrollAreaClassName:"text-[27px] leading-[27px] font-main whitespace-nowrap text-primary-white flex gap-2 items-center overflow-x-scroll no-scrollbar overflow-y-hidden",children:a.map((u,d)=>y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{children:u.name}),d<a.length-1&&y.jsx(zr,{className:"shrink-0"})]},u.id))})]})},PD={configurableNode:rp},RD={configurableEdge:_f};function Vb(e,t,n){if(e.length===0)return[];const r=new Map;for(const l of e){const u=n.get(l);r.set(l,u?u.size:0)}let i=[];for(const l of e)r.get(l)===0&&i.push(l);const s=[];let a=0;for(;i.length>0;){const l=i;s.push(l),a+=l.length;const u=[];for(const d of l){const f=t.get(d);if(f)for(const g of f){if(!r.has(g))continue;const h=(r.get(g)??0)-1;r.set(g,h),h===0&&u.push(g)}}i=u}if(a<e.length){const l=new Set;for(const d of s)for(const f of d)l.add(f);const u=e.filter(d=>!l.has(d));u.length>0&&s.push(u)}return s}const Fb=20;function zb(e){const t=[];if(!e)return t;for(const n of e)if("inputs"in n&&n.inputs)for(const r of n.inputs)r.id&&t.push(r.id);else n.id&&t.push(n.id);return t}function Ub(e){const t=[];if(!e)return t;for(const n of e)n.id&&t.push(n.id);return t}function Wb(e,t,n,r,i,s=0){if(s>=Fb)return{groupScopes:[],groupNodeIds:new Set,warnings:[`Maximum group nesting depth (${Fb}) exceeded. Possible recursive group.`]};const a=[],l=new Set,u=[];for(const d of t){const f=d.data.nodeTypeUniqueId;if(!f)continue;const g=e.typeOfNodes[f];if(!g?.subtree)continue;l.add(d.id);const h=g.subtree;for(const w of h.nodes){const I=w.data.nodeTypeUniqueId;if(!I)continue;const k=e.typeOfNodes[I];if(!ri(I)&&(!kr(n,I)||!n[I])){const A=k?.name??I,M=g.name;u.push(`Node type "${A}" inside group "${M}" has no function implementation.`)}}const m={...e,nodes:h.nodes,edges:h.edges,openedNodeGroupStack:void 0},x=i(m,n,{maxLoopIterations:r},s+1);for(const w of x.warnings)u.push(`[Group "${g.name}"] ${w}`);const v=new Map,b=new Map,S=h.nodes.find(w=>w.data.nodeTypeUniqueId===Te.groupInput),N=h.nodes.find(w=>w.data.nodeTypeUniqueId===Te.groupOutput);if(S){const w=zb(d.data.inputs),I=Ub(S.data.outputs),k=Math.min(w.length,I.length);for(let A=0;A<k;A++)v.set(w[A],I[A])}if(N){const w=zb(N.data.inputs),I=Ub(d.data.outputs),k=Math.min(w.length,I.length);for(let A=0;A<k;A++)b.set(w[A],I[A])}a.push({kind:"group",groupNodeId:d.id,groupNodeTypeId:f,groupNodeTypeName:g.name,innerPlan:x,inputMapping:v,outputMapping:b,concurrencyLevel:0})}return{groupScopes:a,groupNodeIds:l,warnings:u}}function ri(e){return e===Te.loopStart||e===Te.loopStop||e===Te.loopEnd||e===Te.groupInput||e===Te.groupOutput}function Gb(e){return e===Te.groupInput||e===Te.groupOutput}function kr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function LD(e,t,n,r,i,s,a=0){const l=t.filter(v=>v.data.nodeTypeUniqueId===Te.loopStart),u=[];for(const v of l){const b=ei(e,v);if(!b)continue;const{loopStart:S,loopStop:N,loopEnd:w}=b,{nodesInRegionStartToStop:I,nodesInRegionStopToEnd:k}=ff(e,b),A=new Set([...I,...k]);u.push({loopStartId:S.id,loopStopId:N.id,loopEndId:w.id,bodyNodeIds:I,postStopBodyNodeIds:k,allBodyNodeIds:A})}const d=new Set;for(const v of u)for(const b of u)v!==b&&b.allBodyNodeIds.has(v.loopStartId)&&d.add(v.loopStartId);const f=new Map;for(const v of u)f.set(v.loopStartId,v);function g(v,b,S,N){const w=new Set(b.map(E=>E.loopStartId)),I=new Map;for(const E of b){const P=E.loopStartId;I.set(E.loopStartId,P),I.set(E.loopStopId,P),I.set(E.loopEndId,P);for(const L of E.allBodyNodeIds)I.set(L,P)}const k=[...Array.from(v).filter(E=>!N.has(E)),...w];if(k.length===0)return[];const A=new Set(k),M=new Map,B=new Map;for(const E of k)M.set(E,new Set),B.set(E,new Set);for(const E of n){if(qf(E,t))continue;let P=E.source,L=E.target;const j=I.get(P);j&&(P=j);const O=I.get(L);O&&(L=O),P!==L&&A.has(P)&&A.has(L)&&(M.get(P)?.add(L),B.get(L)?.add(P))}const U=Vb(k,M,B),q=k.filter(E=>!w.has(E)).map(E=>t.find(P=>P.id===E)).filter(E=>E!=null),{groupScopes:D}=Wb(e,q,i,r,s,a+1),$=new Map(D.map(E=>[E.groupNodeId,E])),F=[];for(let E=0;E<U.length;E++){const P=U[E];for(const L of P){if(w.has(L)){const Y=S.get(L);Y&&F.push({...Y,concurrencyLevel:E});continue}const j=t.find(Y=>Y.id===L);if(!j)continue;const O=j.data.nodeTypeUniqueId;if(!O||Gb(O))continue;const W=$.get(L);if(W){F.push({...W,concurrencyLevel:E});continue}const z=e.typeOfNodes[O];F.push({kind:"standard",nodeId:L,nodeTypeId:O,nodeTypeName:z?.name??O,concurrencyLevel:E})}}return F}function h(v){const{loopStartId:b,loopStopId:S,loopEndId:N,bodyNodeIds:w,postStopBodyNodeIds:I,allBodyNodeIds:k}=v,A=[],M=new Set;for(const F of u)if(F!==v&&k.has(F.loopStartId)){A.push(F),M.add(F.loopStartId),M.add(F.loopStopId),M.add(F.loopEndId);for(const E of F.allBodyNodeIds)M.add(E)}const B=new Map;for(const F of A)B.set(F.loopStartId,h(F));const U=A.filter(F=>w.has(F.loopStartId)),q=A.filter(F=>I.has(F.loopStartId)),D=g(w,U,B,M),$=g(I,q,B,M);return{kind:"loop",loopStartNodeId:b,loopStopNodeId:S,loopEndNodeId:N,preStopSteps:D,postStopSteps:$,maxIterations:r,concurrencyLevel:0}}const m=[],x=new Set;for(const v of u)if(!d.has(v.loopStartId)){m.push(h(v)),x.add(v.loopStartId),x.add(v.loopStopId),x.add(v.loopEndId);for(const b of v.allBodyNodeIds)x.add(b)}return{loopBlocks:m,loopNodeIds:x}}function qf(e,t){if(!e.sourceHandle)return!1;const n=t.find(g=>g.id===e.source);if(!n)return!1;const r=n.data.nodeTypeUniqueId;if(!r||!Tt(r))return!1;const i=e.sourceHandle,s=n.data.outputs;if(!s)return!1;for(const g of s)if("id"in g&&g.id===i&&g.dataType?.dataTypeUniqueId===ze.bindLoopNodes)return!0;const a=t.find(g=>g.id===e.target);if(!a)return!1;const l=a.data.nodeTypeUniqueId;if(!l||!Tt(l))return!1;const u=e.targetHandle;if(!u)return!1;const d=a.data.inputs;if(!d)return!1;const f=d.flatMap(g=>"inputs"in g?g.inputs:[g]);for(const g of f)if("id"in g&&g.id===u&&g.dataType?.dataTypeUniqueId===ze.bindLoopNodes)return!0;return!1}const qb=100;function Yf(e,t,n,r){const i=n?.maxLoopIterations??qb,s=[],{nodes:a,edges:l}=Mt(e);if(a.length===0)return{levels:[],inputResolutionMap:new Map,outputDistributionMap:new Map,nodeCount:0,warnings:[]};const u=new Map,d=new Map;for(const D of l){const $=D.sourceHandle,F=D.targetHandle;if(!$||!F||qf(D,a))continue;const E=`${D.target}:${F}`;let P=u.get(E);P||(P=[],u.set(E,P)),P.push({edgeId:D.id,sourceNodeId:D.source,sourceHandleId:$});const L=`${D.source}:${$}`;let j=d.get(L);j||(j=[],d.set(L,j)),j.push({edgeId:D.id,targetNodeId:D.target,targetHandleId:F})}for(const D of a){const $=D.data.nodeTypeUniqueId;if(!$||Tt($)||ri($))continue;const F=e.typeOfNodes[$];if(!F?.subtree&&(!kr(t,$)||!t[$])){const E=F?.name??$;s.push(`Node type "${E}" (${$}) has no function implementation.`)}}const{loopBlocks:f,loopNodeIds:g}=LD(e,a,l,i,t,Yf,r??0),{groupScopes:h,groupNodeIds:m,warnings:x}=Wb(e,a,t,i,Yf,r??0);for(const D of x)s.push(D);const v=new Map(h.map(D=>[D.groupNodeId,D])),b=new Map(f.map(D=>[D.loopStartNodeId,D])),S=new Set;for(const D of a){const $=D.data.nodeTypeUniqueId;$&&Gb($)&&S.add(D.id)}const N=new Map;for(const D of f){const $=D.loopStartNodeId;N.set(D.loopStartNodeId,$),N.set(D.loopStopNodeId,$),N.set(D.loopEndNodeId,$);for(const F of[...D.preStopSteps,...D.postStopSteps])F.kind==="standard"&&N.set(F.nodeId,$)}const w=new Set(f.map(D=>D.loopStartNodeId)),I=[...a.map(D=>D.id).filter(D=>!g.has(D)&&!S.has(D)),...w],k=new Set(I),A=new Map,M=new Map;for(const D of I)A.set(D,new Set),M.set(D,new Set);for(const D of l){if(!D.sourceHandle||!D.targetHandle||qf(D,a))continue;let $=D.source,F=D.target;const E=N.get($);E&&($=E);const P=N.get(F);P&&(F=P),$!==F&&k.has($)&&k.has(F)&&(A.get($)?.add(F),M.get(F)?.add($))}const B=Vb(I,A,M),U=[];for(let D=0;D<B.length;D++){const $=B[D],F=[];for(const E of $){if(w.has(E)){const W=b.get(E);W&&F.push({...W,concurrencyLevel:D});continue}const P=v.get(E);if(P){F.push({...P,concurrencyLevel:D});continue}const L=a.find(W=>W.id===E);if(!L)continue;const j=L.data.nodeTypeUniqueId;if(!j)continue;const O=e.typeOfNodes[j];F.push({kind:"standard",nodeId:E,nodeTypeId:j,nodeTypeName:O?.name??j,concurrencyLevel:D})}F.length>0&&U.push(F)}let q=0;for(const D of U)for(const $ of D)$.kind==="standard"?q++:$.kind==="loop"?q+=3+$.preStopSteps.length+$.postStopSteps.length:$.kind==="group"&&(q+=1+$.innerPlan.nodeCount);return{levels:U,inputResolutionMap:u,outputDistributionMap:d,nodeCount:q,warnings:s}}function Tn(e,t){return`${e}:${t}`}function Xc(e){const t=[];if(!e)return t;for(const n of e)if("inputs"in n)for(const r of n.inputs)t.push(r);else t.push(n);return t}class Kc{store;prefix;parent;constructor(t="",n=null){this.store=new Map,this.prefix=t,this.parent=n}set(t,n,r){this.store.set(this.prefix+Tn(t,n),r)}get(t,n){const r=this.prefix+Tn(t,n);if(this.store.has(r))return this.store.get(r);if(this.parent)return this.parent.get(t,n)}has(t,n){const r=this.prefix+Tn(t,n);return this.store.has(r)?!0:this.parent?this.parent.has(t,n):!1}resolveInputs(t,n,r,i){const s=new Map,a=Xc(n.inputs);for(const l of a){if(!l.id||!l.name)continue;const u=l.id,d=l.name,f=l.inferredDataType?.dataTypeUniqueId??l.dataType?.dataTypeUniqueId??"",g=Tn(t,u),h=r.get(g);if(h&&h.length>0){const m=[];for(const x of h){const v=i.get(x.sourceNodeId),S=(v?.data.outputs??[]).find(N=>N.id===x.sourceHandleId);m.push({value:this.get(x.sourceNodeId,x.sourceHandleId),sourceNodeId:x.sourceNodeId,sourceNodeName:v?.typeOfNode?.name??"",sourceNodeTypeId:v?.data.nodeTypeUniqueId??"",sourceHandleId:x.sourceHandleId,sourceHandleName:S?.name??"",sourceDataTypeId:S?.inferredDataType?.dataTypeUniqueId??S?.dataType?.dataTypeUniqueId??"",edgeId:x.edgeId})}s.set(d,{connections:m,handleId:u,handleName:d,dataTypeId:f,isDefault:!1})}else l.allowInput&&l.value!==void 0?s.set(d,{connections:[],handleId:u,handleName:d,dataTypeId:f,isDefault:!0,defaultValue:l.value}):s.set(d,{connections:[],handleId:u,handleName:d,dataTypeId:f,isDefault:!0,defaultValue:void 0})}return s}buildOutputInfo(t,n,r){const i=new Map,s=n.outputs;if(!s)return i;for(const a of s){if(!a.id||!a.name)continue;const l=a.id,u=a.name,d=a.inferredDataType?.dataTypeUniqueId??a.dataType?.dataTypeUniqueId??"",f=Tn(t,l),g=r.get(f)??[];i.set(u,{handleId:l,handleName:u,dataTypeId:d,connections:g.map(h=>({targetNodeId:h.targetNodeId,targetHandleId:h.targetHandleId,edgeId:h.edgeId}))})}return i}snapshot(){return new Map(this.store)}createScope(t){return new Kc(`${t}>`,this)}clearScope(t){const n=`${t}>`;for(const r of this.store.keys())r.startsWith(n)&&this.store.delete(r)}}class DD{lastTimestamp=0;minIncrement;constructor(t=.001){this.minIncrement=t}now(){const t=performance.now(),n=Math.max(t,this.lastTimestamp+this.minIncrement);return this.lastTimestamp=n,n}}class Yb{startTime=0;steps=[];errors=[];concurrencyLevels=[];loopRecords=new Map;groupRecords=new Map;id;timer=new DD;rawStartTimes=new Map;pausedAt=null;totalPauseDuration=0;scopeStack=[];pendingLevelStart=0;pendingLevelNodeIds=[];pendingLoopIterations=new Map;pendingLoopStructures=new Map;loopNestingStack=[];pendingNestedLoopStructures=new Map;completedNestedLoopRecords=new Map;constructor(){this.id=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`run-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}start(){this.startTime=this.timer.now()}pause(){this.pausedAt===null&&(this.pausedAt=this.timer.now())}resume(){this.pausedAt!==null&&(this.totalPauseDuration+=this.timer.now()-this.pausedAt,this.pausedAt=null)}getEffectivePauseDuration(){return this.pausedAt!==null?this.totalPauseDuration+(this.timer.now()-this.pausedAt):this.totalPauseDuration}beginStep(t){this.resume();const n=this.steps.length,r=this.timer.now();return this.rawStartTimes.set(n,performance.now()),this.steps.push({stepIndex:n,nodeId:t.nodeId,nodeTypeId:t.nodeTypeId,nodeTypeName:t.nodeTypeName,concurrencyLevel:t.concurrencyLevel,startTime:r-this.startTime,endTime:0,duration:0,pauseAdjustment:this.totalPauseDuration,status:"completed",inputValues:new Map,outputValues:new Map,loopIteration:t.loopIteration,loopStructureId:t.loopStructureId,parentLoopStructureId:t.parentLoopStructureId,parentLoopIteration:t.parentLoopIteration,groupNodeId:t.groupNodeId,groupDepth:t.groupDepth,loopPhase:t.loopPhase,inputSource:t.inputSource}),n}addStepToPendingIteration(t){if(t.loopStructureId!==void 0){const n=this.pendingLoopIterations.get(t.loopStructureId);if(n){n.stepRecords.push(t);return}}if(this.loopNestingStack.length>0){const n=this.loopNestingStack[this.loopNestingStack.length-1],r=this.pendingLoopIterations.get(n.loopStructureId);r&&r.stepRecords.push(t)}}completeStep(t,n,r){const i=this.steps[t];if(!i)return;const s=performance.now(),a=this.timer.now();i.endTime=a-this.startTime,i.duration=i.endTime-i.startTime,i.status="completed",i.inputValues=n,i.outputValues=r;const l=this.rawStartTimes.get(t);l!==void 0&&s===l&&(i.estimatedTiming=!0),this.rawStartTimes.delete(t),this.addStepToPendingIteration(i)}errorStep(t,n,r){const i=this.steps[t];if(!i)return;const s=performance.now(),a=this.timer.now();i.endTime=a-this.startTime,i.duration=i.endTime-i.startTime,i.status="errored",i.inputValues=r,i.error=n;const l=this.rawStartTimes.get(t);l!==void 0&&s===l&&(i.estimatedTiming=!0),this.rawStartTimes.delete(t),this.errors.push(n),this.addStepToPendingIteration(i)}skipStep(t){const n=this.steps[t];if(!n)return;const r=this.timer.now();n.endTime=r-this.startTime,n.duration=0,n.status="skipped",this.rawStartTimes.delete(t),this.addStepToPendingIteration(n)}beginLevel(t,n){this.pendingLevelStart=this.timer.now(),this.pendingLevelNodeIds=n}completeLevel(t){const n=this.timer.now();this.concurrencyLevels.push({level:t,startTime:this.pendingLevelStart-this.startTime,endTime:n-this.startTime,duration:n-this.pendingLevelStart,nodeIds:this.pendingLevelNodeIds})}beginLoopStructure(t,n,r,i){const s={loopStartNodeId:n,loopStopNodeId:r,loopEndNodeId:i,iterations:[],startTime:this.timer.now()};if(this.loopNestingStack.length>0){const a=this.loopNestingStack[this.loopNestingStack.length-1],l=`${a.loopStructureId}:${a.iteration}:${t}`;this.pendingNestedLoopStructures.set(l,s)}else this.pendingLoopStructures.set(t,s)}beginLoopIteration(t,n){this.loopNestingStack.push({loopStructureId:t,iteration:n}),this.pendingLoopIterations.set(t,{iteration:n,startTime:this.timer.now(),stepRecords:[]})}completeLoopIteration(t,n,r){this.loopNestingStack.pop();const i=this.pendingLoopIterations.get(t);if(!i)return;const s=new Map,a=`${t}:${n}:`;for(const[f,g]of this.completedNestedLoopRecords)if(f.startsWith(a)){const h=f.slice(a.length);s.set(h,g)}for(const f of s.keys())this.completedNestedLoopRecords.delete(`${a}${f}`);const l=this.timer.now(),u={iteration:n,startTime:i.startTime-this.startTime,endTime:l-this.startTime,duration:l-i.startTime,conditionValue:r,stepRecords:i.stepRecords,nestedLoopRecords:s},d=this.pendingLoopStructures.get(t)??this.findPendingStructure(t);d&&d.iterations.push(u),this.pendingLoopIterations.delete(t)}findPendingStructure(t){for(const[n,r]of this.pendingNestedLoopStructures)if(n.endsWith(`:${t}`))return r}completeLoopStructure(t){let n=this.pendingLoopStructures.get(t),r=null;if(!n){for(const[a,l]of this.pendingNestedLoopStructures)if(a.endsWith(`:${t}`)){n=l,r=a;break}}if(!n)return;const i=this.timer.now(),s={loopStructureId:t,loopStartNodeId:n.loopStartNodeId,loopStopNodeId:n.loopStopNodeId,loopEndNodeId:n.loopEndNodeId,iterations:n.iterations,totalIterations:n.iterations.length,startTime:n.startTime-this.startTime,endTime:i-this.startTime,duration:i-n.startTime};r?(this.completedNestedLoopRecords.set(r,s),this.pendingNestedLoopStructures.delete(r)):(this.loopRecords.set(t,s),this.pendingLoopStructures.delete(t))}beginGroup(t,n){}completeGroup(t,n,r,i,s){this.groupRecords.set(t,{groupNodeId:t,groupNodeTypeId:n,innerRecord:r,inputMapping:i,outputMapping:s})}getLatestStep(){return this.steps.length>0?this.steps[this.steps.length-1]:void 0}stepCount(){return this.steps.length}getStep(t){return this.steps[t]}beginScope(){const t=[...this.loopNestingStack];this.loopNestingStack.length=0,this.scopeStack.push({startStepIndex:this.steps.length,startErrorIndex:this.errors.length,startLoopRecordKeys:new Set(this.loopRecords.keys()),startGroupRecordKeys:new Set(this.groupRecords.keys()),startNestedLoopKeys:new Set(this.completedNestedLoopRecords.keys()),savedNestingStack:t,startTime:this.timer.now()})}endScope(t,n){const r=this.scopeStack.pop();if(!r)throw new Error("ExecutionRecorder.endScope() called without matching beginScope()");this.loopNestingStack.length=0;for(const d of r.savedNestingStack)this.loopNestingStack.push(d);const i=this.timer.now(),s=this.steps.slice(r.startStepIndex),a=this.errors.slice(r.startErrorIndex),l=new Map;for(const[d,f]of this.loopRecords)r.startLoopRecordKeys.has(d)||l.set(d,f);const u=new Map;for(const[d,f]of this.groupRecords)r.startGroupRecordKeys.has(d)||u.set(d,f);return{id:`${this.id}-scope-${r.startStepIndex}`,startTime:r.startTime,endTime:i,totalDuration:i-r.startTime,compilationDuration:0,totalPauseDuration:this.getEffectivePauseDuration(),status:t,steps:s,errors:a,concurrencyLevels:[],loopRecords:l,groupRecords:u,finalValues:n}}snapshotPendingLoopRecords(t){const n=new Map(this.loopRecords),r=(i,s)=>{const a=this.pendingLoopIterations.get(i),l=[...s.iterations];if(a){const u=new Map,d=`${i}:${a.iteration}:`;for(const[f,g]of this.completedNestedLoopRecords)f.startsWith(d)&&u.set(f.slice(d.length),g);for(const[f,g]of this.pendingNestedLoopStructures)if(f.startsWith(d)){const h=f.slice(d.length);u.has(h)||u.set(h,r(h,g))}l.push({iteration:a.iteration,startTime:a.startTime-this.startTime,endTime:t-this.startTime,duration:t-a.startTime,conditionValue:!0,stepRecords:[...a.stepRecords],nestedLoopRecords:u})}return{loopStructureId:i,loopStartNodeId:s.loopStartNodeId,loopStopNodeId:s.loopStopNodeId,loopEndNodeId:s.loopEndNodeId,iterations:l,totalIterations:l.length,startTime:s.startTime-this.startTime,endTime:t-this.startTime,duration:t-s.startTime}};for(const[i,s]of this.pendingLoopStructures)n.has(i)||n.set(i,r(i,s));return n}snapshot(t,n){const r=this.timer.now();return{id:this.id,startTime:this.startTime,endTime:r,totalDuration:r-this.startTime,compilationDuration:0,totalPauseDuration:this.getEffectivePauseDuration(),status:t,steps:[...this.steps],errors:[...this.errors],concurrencyLevels:[...this.concurrencyLevels],loopRecords:this.snapshotPendingLoopRecords(r),groupRecords:new Map(this.groupRecords),finalValues:n}}finalize(t,n,r=0){const i=this.timer.now();return{id:this.id,startTime:this.startTime,endTime:i,totalDuration:i-this.startTime,compilationDuration:r,totalPauseDuration:this.getEffectivePauseDuration(),status:t,steps:this.steps,errors:this.errors,concurrencyLevels:this.concurrencyLevels,loopRecords:this.loopRecords,groupRecords:this.groupRecords,finalValues:n}}}class jD{pendingPayload=null;pendingPushResolve=null;pendingPullResolve=null;pendingPullReject=null;closed=!1;error=void 0;push(t){if(this.closed)return Promise.resolve();if(this.pendingPullResolve){const n=this.pendingPullResolve;return this.pendingPullResolve=null,this.pendingPullReject=null,n(t),new Promise(r=>{this.pendingPushResolve=r})}return this.pendingPayload=t,new Promise(n=>{this.pendingPushResolve=n})}pull(){if(this.error!==void 0)return Promise.reject(this.error);if(this.pendingPayload){const t=this.pendingPayload;if(this.pendingPayload=null,this.pendingPushResolve){const n=this.pendingPushResolve;this.pendingPushResolve=null,n()}return Promise.resolve(t)}return this.closed?Promise.resolve(null):new Promise((t,n)=>{if(this.pendingPullResolve=t,this.pendingPullReject=n,this.pendingPushResolve){const r=this.pendingPushResolve;this.pendingPushResolve=null,r()}})}close(){this.closed=!0,this.pendingPullResolve&&(this.pendingPullResolve(null),this.pendingPullResolve=null,this.pendingPullReject=null),this.pendingPushResolve&&(this.pendingPushResolve(),this.pendingPushResolve=null)}closeWithError(t){this.closed=!0,this.error=t,this.pendingPullReject&&(this.pendingPullReject(t),this.pendingPullResolve=null,this.pendingPullReject=null),this.pendingPushResolve&&(this.pendingPushResolve(),this.pendingPushResolve=null)}}function Xb(e,t){const n=new Map;function r(i){for(const s of i)if(s.kind==="standard"){const a=t.nodes.find(d=>d.id===s.nodeId);if(!a)continue;const l=a.data.nodeTypeUniqueId;if(!l)continue;const u=t.typeOfNodes[l];n.set(s.nodeId,{data:a.data,typeOfNode:u,nodeTypeId:s.nodeTypeId,nodeTypeName:s.nodeTypeName,concurrencyLevel:s.concurrencyLevel})}else if(s.kind==="loop"){for(const a of[s.loopStartNodeId,s.loopStopNodeId,s.loopEndNodeId]){const l=t.nodes.find(f=>f.id===a);if(!l)continue;const u=l.data.nodeTypeUniqueId;if(!u)continue;const d=t.typeOfNodes[u];n.set(a,{data:l.data,typeOfNode:d,nodeTypeId:u,nodeTypeName:d?.name??u,concurrencyLevel:s.concurrencyLevel})}r(s.preStopSteps),r(s.postStopSteps)}else if(s.kind==="group"){const a=t.nodes.find(d=>d.id===s.groupNodeId);if(!a)continue;const l=a.data.nodeTypeUniqueId;if(!l)continue;const u=t.typeOfNodes[l];n.set(s.groupNodeId,{data:a.data,typeOfNode:u,nodeTypeId:s.groupNodeTypeId,nodeTypeName:s.groupNodeTypeName,concurrencyLevel:s.concurrencyLevel})}}for(const i of e.levels)r(i);return n}function Mr(e){const t=new Map;for(const[n,r]of e){const i=r.connections.map(s=>({value:s.value,sourceNodeId:s.sourceNodeId,sourceNodeName:s.sourceNodeName,sourceHandleId:s.sourceHandleId,sourceHandleName:s.sourceHandleName,sourceDataTypeId:s.sourceDataTypeId}));t.set(n,{connections:i,dataTypeId:r.dataTypeId,isDefault:r.isDefault,defaultValue:r.defaultValue})}return t}function Zc(e,t){const n=new Map;for(const[r,i]of e){const s=t.get(r);n.set(r,{value:i,dataTypeId:s?.dataTypeId??"",targetCount:s?.connections.length??0})}return n}function Jc(e,t,n){for(const[r,i]of t){const s=r.indexOf(":");if(!(s===-1||r.substring(0,s)!==e)){for(const l of i)if(n.has(l.sourceNodeId))return!0}}return!1}function Kb(e){const t=[];for(const n of e)n.kind==="standard"?t.push(n.nodeId):n.kind==="loop"?t.push(n.loopStartNodeId):n.kind==="group"&&t.push(n.groupNodeId);return t}function Xf(e,t,n){const r=e.beginStep(t);n.status==="errored"?e.errorStep(r,n.error,new Map):e.completeStep(r,new Map,new Map)}async function As(e,t,n,r,i,s,a,l,u,d,f,g){const{nodeId:h,nodeTypeId:m,nodeTypeName:x,concurrencyLevel:v}=e;l(h,"running");const b=n.beginStep({nodeId:h,nodeTypeId:m,nodeTypeName:x,concurrencyLevel:v,loopIteration:d?.loopIteration,loopStructureId:d?.loopStructureId,groupNodeId:f?.groupNodeId,groupDepth:f?.groupDepth,loopPhase:g}),S=performance.now(),N=a.get(h);if(!N){const M=zn({error:new Error(`Node "${h}" not found in state`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:[],timestamp:performance.now()-S,duration:0});throw n.errorStep(b,M,new Map),l(h,"errored"),M}const w=t.resolveInputs(h,N.data,r.inputResolutionMap,a),I=t.buildOutputInfo(h,N.data,r.outputDistributionMap);if(ri(m)){n.completeStep(b,Mr(w),new Map),l(h,"completed");return}if(!kr(i,m)){const M=zn({error:new Error(`No function implementation for node type "${x}" (${m})`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:Pf(h,r.inputResolutionMap,a),timestamp:performance.now()-S,duration:performance.now()-S,loopContext:d?{loopStructureId:d.loopStructureId,iteration:d.loopIteration,maxIterations:d.maxIterations}:void 0,groupContext:f?{groupNodeId:f.groupNodeId,groupNodeTypeId:f.groupNodeTypeId,depth:f.groupDepth}:void 0});throw n.errorStep(b,M,Mr(w)),l(h,"errored"),M}const k=i[m];if(!k){const M=zn({error:new Error(`No function implementation for node type "${x}" (${m})`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:Pf(h,r.inputResolutionMap,a),timestamp:performance.now()-S,duration:performance.now()-S,loopContext:d?{loopStructureId:d.loopStructureId,iteration:d.loopIteration,maxIterations:d.maxIterations}:void 0,groupContext:f?{groupNodeId:f.groupNodeId,groupNodeTypeId:f.groupNodeTypeId,depth:f.groupDepth}:void 0});throw n.errorStep(b,M,Mr(w)),l(h,"errored"),M}const A={nodeId:h,nodeTypeId:m,nodeTypeName:x,state:s,loopIteration:d?.loopIteration,groupDepth:f?.groupDepth,abortSignal:u};try{const M=await k(w,I,A);if(!(M instanceof Map))throw new Error(`Function implementation for "${x}" must return a Map, got ${typeof M}`);for(const[B,U]of M){const q=I.get(B);q&&t.set(h,q.handleId,U)}n.completeStep(b,Mr(w),Zc(M,I)),l(h,"completed")}catch(M){const B=performance.now()-S,U=zn({error:M,nodeId:h,nodeTypeId:m,nodeTypeName:x,path:Pf(h,r.inputResolutionMap,a),timestamp:B,duration:B,loopContext:d?{loopStructureId:d.loopStructureId,iteration:d.loopIteration,maxIterations:d.maxIterations}:void 0,groupContext:f?{groupNodeId:f.groupNodeId,groupNodeTypeId:f.groupNodeTypeId,depth:f.groupDepth}:void 0});throw n.errorStep(b,U,Mr(w)),l(h,"errored"),U}}const $D=new Set([ze.bindLoopNodes,ze.loopInfer,ze.condition]);function Zb(e){return e.inferredDataType?.dataTypeUniqueId??e.dataType?.dataTypeUniqueId}function oi(e){return e.filter(t=>{const n=Zb(t);return t.id&&n&&!$D.has(n)}).map(t=>t.id)}function HD(e){return e.find(t=>Zb(t)===ze.condition)?.id}async function Kf(e,t,n,r,i,s,a,l,u,d,f,g){const{loopStartNodeId:h,loopStopNodeId:m,loopEndNodeId:x,preStopSteps:v,postStopSteps:b,maxIterations:S}=e,N=h,w=a.get(h),I=a.get(m),k=a.get(x);if(!w||!I||!k){const oe=zn({error:new Error("Loop structure nodes not found in state"),nodeId:h,nodeTypeId:"loop",nodeTypeName:"Loop",path:[],timestamp:0,duration:0,loopContext:{loopStructureId:N,iteration:0,maxIterations:S}}),pe=n.beginStep({nodeId:h,nodeTypeId:"loop",nodeTypeName:"Loop",concurrencyLevel:e.concurrencyLevel});throw n.errorStep(pe,oe,new Map),u(h,"errored"),u(m,"errored"),u(x,"errored"),l.add(h),l.add(m),l.add(x),oe}const A=Xc(w.data.inputs),M=w.data.outputs??[],B=Xc(I.data.inputs),U=I.data.outputs??[],q=Xc(k.data.inputs),D=k.data.outputs??[],$=oi(A),F=oi(M),E=oi(B),P=oi(U),L=oi(q),j=oi(D),O=HD(B),W=$.length;if(W===0||F.length!==W||E.length!==W||P.length!==W||L.length!==W||j.length!==W||!O){const oe=zn({error:new Error(`Loop structure has mismatched data handle counts (start in=${$.length}, start out=${F.length}, stop in=${E.length}, stop out=${P.length}, end in=${L.length}, end out=${j.length})`),nodeId:h,nodeTypeId:w.nodeTypeId,nodeTypeName:w.nodeTypeName,path:[],timestamp:0,duration:0,loopContext:{loopStructureId:N,iteration:0,maxIterations:S}}),pe=n.beginStep({nodeId:h,nodeTypeId:w.nodeTypeId,nodeTypeName:w.nodeTypeName,concurrencyLevel:e.concurrencyLevel});throw n.errorStep(pe,oe,new Map),u(h,"errored"),l.add(h),l.add(m),l.add(x),oe}const z=new Array(W);for(let oe=0;oe<W;oe++){const pe=Tn(h,$[oe]),ve=(r.inputResolutionMap.get(pe)??[]).filter(me=>me.sourceNodeId!==m);ve.length>0&&(z[oe]=t.get(ve[0].sourceNodeId,ve[0].sourceHandleId))}n.beginLoopStructure(N,h,m,x);const Y=f?{parentLoopStructureId:f.loopStructureId,parentLoopIteration:f.loopIteration}:{},J=t.buildOutputInfo(h,w.data,r.outputDistributionMap),ie=t.buildOutputInfo(m,I.data,r.outputDistributionMap);u(h,"running"),u(m,"running");function ee(oe){const pe=new Map;for(const le of oe){const ve=pe.get(le.concurrencyLevel);ve?ve.push(le):pe.set(le.concurrencyLevel,[le])}return[...pe.entries()].sort((le,ve)=>le[0]-ve[0])}const ce=ee(v),ge=ee(b),Q=t.buildOutputInfo(x,k.data,r.outputDistributionMap);async function te(oe,pe,le,ve){for(const[,me]of oe){if(d.aborted)break;const Oe=[],Ce=[];for(const ae of me){const Ie=an(ae);Jc(Ie,r.inputResolutionMap,pe)?Ce.push(ae):Oe.push(ae)}for(const ae of Ce){const Ie=an(ae);u(Ie,"skipped"),pe.add(Ie);const Be=n.beginStep({nodeId:Ie,nodeTypeId:Qc(ae),nodeTypeName:el(ae),concurrencyLevel:ae.concurrencyLevel,loopIteration:le,loopStructureId:N,loopPhase:ve,...Y});n.skipStep(Be),await g?.()}if(g)for(const ae of Oe){if(d.aborted)break;try{ae.kind==="standard"?(await As(ae,t,n,r,i,s,a,u,d,{loopIteration:le,loopStructureId:N,maxIterations:S},void 0,ve),await g()):await ks(ae,t,n,r,i,s,a,pe,u,d,{loopIteration:le,loopStructureId:N},g)}catch{pe.add(an(ae))}}else{const ae=await Promise.allSettled(Oe.map(Ie=>Ie.kind==="standard"?As(Ie,t,n,r,i,s,a,u,d,{loopIteration:le,loopStructureId:N,maxIterations:S},void 0,ve):ks(Ie,t,n,r,i,s,a,pe,u,d,{loopIteration:le,loopStructureId:N})));for(let Ie=0;Ie<ae.length;Ie++)ae[Ie].status==="rejected"&&pe.add(an(Oe[Ie]))}}}let ne=!1;for(let oe=0;oe<S&&!d.aborted;oe++){n.beginLoopIteration(N,oe);for(let Ce=0;Ce<W;Ce++)t.set(h,F[Ce],z[Ce]);const pe=oe===0?"upstream":"feedback";{const Ce=n.beginStep({nodeId:h,nodeTypeId:w.nodeTypeId,nodeTypeName:w.nodeTypeName,concurrencyLevel:e.concurrencyLevel,loopIteration:oe,loopStructureId:N,loopPhase:"loopStart",inputSource:pe,...Y}),ae=t.resolveInputs(h,w.data,r.inputResolutionMap,a),Ie=new Map;for(const[Qe,Ue]of ae)if(pe==="upstream"){const Ze=Ue.connections.filter(pt=>pt.sourceNodeId!==m);Ie.set(Qe,{...Ue,connections:Ze})}else{const Ze=Ue.connections.filter(pt=>pt.sourceNodeId===m);Ie.set(Qe,{...Ue,connections:Ze})}const Be=new Map;for(const[Qe,Ue]of J){const Ze=F.indexOf(Ue.handleId);Ze>=0&&Be.set(Qe,z[Ze])}n.completeStep(Ce,Mr(Ie),Zc(Be,J)),await g?.()}const le=new Set;await te(ce,le,oe,"preStop");const ve=Tn(m,O),me=r.inputResolutionMap.get(ve);let Oe=!1;me&&me.length>0&&(me.some(ae=>le.has(ae.sourceNodeId))||(Oe=!!t.get(me[0].sourceNodeId,me[0].sourceHandleId)));for(let Ce=0;Ce<W;Ce++){const ae=Tn(m,E[Ce]),Ie=r.inputResolutionMap.get(ae);let Be;Ie&&Ie.length>0&&(Be=t.get(Ie[0].sourceNodeId,Ie[0].sourceHandleId)),t.set(m,P[Ce],Be),z[Ce]=Be}{const Ce=n.beginStep({nodeId:m,nodeTypeId:I.nodeTypeId,nodeTypeName:I.nodeTypeName,concurrencyLevel:e.concurrencyLevel,loopIteration:oe,loopStructureId:N,loopPhase:"loopStop",...Y}),ae=t.resolveInputs(m,I.data,r.inputResolutionMap,a),Ie=new Map;for(const[Be,Qe]of ie){const Ue=P.indexOf(Qe.handleId);Ue>=0&&Ie.set(Be,z[Ue])}n.completeStep(Ce,Mr(ae),Zc(Ie,ie)),await g?.()}if(Oe&&ge.length>0){await te(ge,le,oe,"postStop");for(let Ce=0;Ce<W;Ce++){const ae=Tn(x,L[Ce]),Ie=r.inputResolutionMap.get(ae);Ie&&Ie.length>0&&(z[Ce]=t.get(Ie[0].sourceNodeId,Ie[0].sourceHandleId))}}{const Ce=!Oe;if(Ce)for(let Qe=0;Qe<W;Qe++)t.set(x,j[Qe],z[Qe]);const ae=n.beginStep({nodeId:x,nodeTypeId:k.nodeTypeId,nodeTypeName:k.nodeTypeName,concurrencyLevel:e.concurrencyLevel,loopIteration:oe,loopStructureId:N,loopPhase:"loopEnd",...Y}),Ie=t.resolveInputs(x,k.data,r.inputResolutionMap,a),Be=new Map;if(Ce)for(const[Qe,Ue]of Q){const Ze=j.indexOf(Ue.handleId);Ze>=0&&Be.set(Qe,z[Ze])}n.completeStep(ae,Mr(Ie),Zc(Be,Q)),await g?.()}if(ne=Oe,n.completeLoopIteration(N,oe,Oe),!Oe)break}if(ne&&S>0){const oe=zn({error:new Error(`Loop exceeded maximum iterations (${S})`),nodeId:m,nodeTypeId:I.nodeTypeId,nodeTypeName:I.nodeTypeName,path:[],timestamp:0,duration:0,loopContext:{loopStructureId:N,iteration:S-1,maxIterations:S}}),pe=n.beginStep({nodeId:m,nodeTypeId:I.nodeTypeId,nodeTypeName:I.nodeTypeName,concurrencyLevel:e.concurrencyLevel,loopStructureId:N,loopIteration:S-1,...Y});throw n.errorStep(pe,oe,new Map),Xf(n,{nodeId:x,nodeTypeId:k.nodeTypeId,nodeTypeName:k.nodeTypeName,concurrencyLevel:e.concurrencyLevel,loopStructureId:N,...Y},{status:"errored",error:oe}),u(m,"errored"),u(x,"errored"),l.add(h),l.add(m),l.add(x),n.completeLoopStructure(N),oe}u(h,"completed"),u(m,"completed"),u(x,"completed"),n.completeLoopStructure(N)}function BD(e,t){return{...e,nodes:t.nodes,edges:t.edges,openedNodeGroupStack:void 0}}async function Zf(e,t,n,r,i,s,a,l,u,d,f=1,g){const{groupNodeId:h,groupNodeTypeId:m,groupNodeTypeName:x,innerPlan:v}=e;if(u(h,"running"),!kr(s.typeOfNodes,m)){const D=zn({error:new Error(`Group node type "${x}" not found in type definitions`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:[],timestamp:0,duration:0,groupContext:{groupNodeId:h,groupNodeTypeId:m,depth:f}}),$=n.beginStep({nodeId:h,nodeTypeId:m,nodeTypeName:x,concurrencyLevel:e.concurrencyLevel,groupNodeId:h,groupDepth:f});throw n.errorStep($,D,new Map),u(h,"errored"),l.add(h),D}const S=s.typeOfNodes[m].subtree;if(!S){const D=zn({error:new Error(`Group node type "${x}" has no subtree definition`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:[],timestamp:0,duration:0,groupContext:{groupNodeId:h,groupNodeTypeId:m,depth:f}}),$=n.beginStep({nodeId:h,nodeTypeId:m,nodeTypeName:x,concurrencyLevel:e.concurrencyLevel,groupNodeId:h,groupDepth:f});throw n.errorStep($,D,new Map),u(h,"errored"),l.add(h),D}const N=BD(s,S),w=new Map;for(const D of S.nodes){const $=D.data.nodeTypeUniqueId;if(!$)continue;const F=kr(s.typeOfNodes,$)?s.typeOfNodes[$]:void 0;w.set(D.id,{data:D.data,typeOfNode:F,nodeTypeId:$,nodeTypeName:F?.name??$,concurrencyLevel:-1})}for(const D of v.levels)for(const $ of D)if($.kind==="standard"){const F=w.get($.nodeId);F&&(F.concurrencyLevel=$.concurrencyLevel)}const I=t.createScope(h),k=S.inputNodeId;if(k)for(const[D,$]of e.inputMapping){const F=Tn(h,D),E=r.inputResolutionMap.get(F);if(E&&E.length>0){const P=t.get(E[0].sourceNodeId,E[0].sourceHandleId);I.set(k,$,P)}}n.beginGroup(h,m),n.beginScope();let A=!1;const M=new Set;for(let D=0;D<v.levels.length&&!d.aborted;D++){const $=v.levels[D],F=[],E=[];for(const P of $){const L=an(P);Jc(L,v.inputResolutionMap,M)?E.push(P):F.push(P)}for(const P of E){const L=an(P);u(L,"skipped"),M.add(L);const j=n.beginStep({nodeId:L,nodeTypeId:Qc(P),nodeTypeName:el(P),concurrencyLevel:P.concurrencyLevel,groupNodeId:h,groupDepth:f});n.skipStep(j),await g?.()}if(g)for(const P of F){if(d.aborted)break;try{P.kind==="standard"?(await As(P,I,n,v,i,N,w,u,d,void 0,{groupNodeId:h,groupNodeTypeId:m,groupDepth:f}),await g()):P.kind==="group"?await Zf(P,I,n,v,i,N,w,M,u,d,f+1,g):await Kf(P,I,n,v,i,N,w,M,u,d,void 0,g)}catch{M.add(an(P))}}else{const P=await Promise.allSettled(F.map(L=>L.kind==="standard"?As(L,I,n,v,i,N,w,u,d,void 0,{groupNodeId:h,groupNodeTypeId:m,groupDepth:f}):L.kind==="group"?Zf(L,I,n,v,i,N,w,M,u,d,f+1):Kf(L,I,n,v,i,N,w,M,u,d)));for(let L=0;L<P.length;L++)P[L].status==="rejected"&&(A=!0,M.add(an(F[L])))}}const B=S.outputNodeId;if(B)for(const[D,$]of e.outputMapping){const F=Tn(B,D),E=v.inputResolutionMap.get(F);if(E&&E.length>0){const P=I.get(E[0].sourceNodeId,E[0].sourceHandleId);t.set(h,$,P)}}const U=n.endScope(A?"errored":"completed",I.snapshot());n.completeGroup(h,m,U,e.inputMapping,e.outputMapping);const q={nodeId:h,nodeTypeId:m,nodeTypeName:x,concurrencyLevel:e.concurrencyLevel,groupNodeId:h,groupDepth:f};if(A){const D=zn({error:new Error(`Group "${x}" inner execution had errors`),nodeId:h,nodeTypeId:m,nodeTypeName:x,path:[],timestamp:0,duration:0,groupContext:{groupNodeId:h,groupNodeTypeId:m,depth:f}});Xf(n,q,{status:"errored",error:D}),u(h,"errored"),l.add(h)}else Xf(n,q,{status:"completed"}),u(h,"completed")}async function ks(e,t,n,r,i,s,a,l,u,d,f,g){switch(e.kind){case"standard":await As(e,t,n,r,i,s,a,u,d),await g?.();return;case"loop":return Kf(e,t,n,r,i,s,a,l,u,d,f,g);case"group":return Zf(e,t,n,r,i,s,a,l,u,d,void 0,g)}}async function VD(e,t,n,r){const{onNodeStateChange:i,abortSignal:s}=r,a=new Kc,l=new Yb,u=new Set,d=Xb(e,n),f=performance.now();{const x="__jit_warmup__";a.set(x,x,0),a.get(x,x);const v=new Map;v.set(x,0),v.get(x),v.delete(x),await Promise.allSettled([Promise.resolve(0)]),a.set(x,x,void 0)}const g=performance.now()-f;l.start();let h=!1;for(let x=0;x<e.levels.length;x++){if(s.aborted)return l.finalize("cancelled",a.snapshot(),g);const v=e.levels[x],b=Kb(v);l.beginLevel(x,b);const S=[],N=[];for(const I of v){const k=an(I);Jc(k,e.inputResolutionMap,u)?N.push(I):S.push(I)}for(const I of N){const k=an(I);i(k,"skipped"),u.add(k);const A=l.beginStep({nodeId:k,nodeTypeId:Qc(I),nodeTypeName:el(I),concurrencyLevel:I.concurrencyLevel});l.skipStep(A)}const w=await Promise.allSettled(S.map(I=>ks(I,a,l,e,t,n,d,u,i,s)));for(let I=0;I<w.length;I++)if(w[I].status==="rejected"){h=!0;const A=an(S[I]);u.add(A)}l.completeLevel(x)}const m=s.aborted?"cancelled":h?"errored":"completed";return l.finalize(m,a.snapshot(),g)}async function*FD(e,t,n,r){const{onNodeStateChange:i,abortSignal:s}=r,a=new Kc,l=new Yb,u=new Set,d=Xb(e,n),f=performance.now();{const x="__jit_warmup__";a.set(x,x,0),a.get(x,x),await Promise.allSettled([Promise.resolve(0)]),a.set(x,x,void 0)}const g=performance.now()-f;l.start();let h=!1;for(let x=0;x<e.levels.length;x++){if(s.aborted)return l.resume(),l.finalize("cancelled",a.snapshot(),g);const v=e.levels[x],b=Kb(v);l.beginLevel(x,b);for(const S of v){if(s.aborted)return l.resume(),l.finalize("cancelled",a.snapshot(),g);const N=an(S);if(Jc(N,e.inputResolutionMap,u)){i(N,"skipped"),u.add(N);const w=l.beginStep({nodeId:N,nodeTypeId:Qc(S),nodeTypeName:el(S),concurrencyLevel:S.concurrencyLevel});l.skipStep(w);continue}if(S.kind==="standard"){try{await ks(S,a,l,e,t,n,d,u,i,s)}catch{h=!0,u.add(N)}const w=l.getLatestStep();w&&(l.pause(),yield{stepRecord:w,partialRecord:l.snapshot(h?"errored":"completed",a.snapshot())})}else{const w=new jD,k=ks(S,a,l,e,t,n,d,u,i,s,void 0,async()=>{const A=l.getLatestStep();A&&(l.pause(),await w.push({stepRecord:A,partialRecord:l.snapshot(h?"errored":"completed",a.snapshot())}))}).then(()=>w.close(),A=>{h=!0,u.add(N),w.closeWithError(A)});try{for(;;){const A=await w.pull();if(A===null)break;yield A}}catch{h=!0,u.add(N)}await k}}l.completeLevel(x)}l.resume();const m=s.aborted?"cancelled":h?"errored":"completed";return l.finalize(m,a.snapshot(),g)}function an(e){switch(e.kind){case"standard":return e.nodeId;case"loop":return e.loopStartNodeId;case"group":return e.groupNodeId}}function Qc(e){switch(e.kind){case"standard":return e.nodeTypeId;case"loop":return"loop";case"group":return e.groupNodeTypeId}}function el(e){switch(e.kind){case"standard":return e.nodeTypeName;case"loop":return"Loop";case"group":return e.groupNodeTypeName}}const Ms=new Map,zD=new Map,Os=new Map;function ii(e,t){const n=new Map;for(const r of e.steps)r.stepIndex<t?n.set(r.nodeId,r.status==="errored"?"errored":r.status==="skipped"?"skipped":"completed"):r.stepIndex===t?n.set(r.nodeId,"running"):n.has(r.nodeId)||n.set(r.nodeId,"idle");for(const[,r]of e.loopRecords){const i=[];for(const l of r.iterations)for(const u of l.stepRecords)i.push(u.stepIndex);if(i.length===0)continue;const s=Math.min(...i),a=Math.max(...i);t>=s&&t<=a&&(n.set(r.loopStartNodeId,"running"),n.set(r.loopStopNodeId,"running"))}for(const[r,i]of e.groupRecords){const s=i.innerRecord.steps;if(s.length===0)continue;const a=s.map(d=>d.stepIndex),l=Math.min(...a),u=Math.max(...a);t>=l&&t<=u&&n.set(r,"running")}return n}function UD(e,t){const n=new Map;for(const r of e.nodes){const i=r.data.nodeTypeUniqueId;if(!i)continue;const s=e.typeOfNodes[i];if(!ri(i)&&!Tt(i)&&!s?.subtree&&(!kr(t,i)||!t[i])){const a=s?.name??i,l=n.get(r.id);l?l.push(`No function implementation for node type "${a}"`):n.set(r.id,[`No function implementation for node type "${a}"`])}}return n}function Jf(e){const t=new Map;for(const n of e.errors){const r=t.get(n.nodeId);r?r.push(n):t.set(n.nodeId,[n])}return t}function WD(e,t){const n=[],r=[];if(e.steps.length===0)return r.push("Recording has no execution steps."),{valid:!1,warnings:n,errors:r};const i=new Set(t.nodes.map(f=>f.id)),s=new Set(Object.keys(t.typeOfNodes)),a=new Set,l=new Set;for(const f of e.steps)i.has(f.nodeId)||a.add(f.nodeId),!ri(f.nodeTypeId)&&!Tt(f.nodeTypeId)&&!s.has(f.nodeTypeId)&&l.add(f.nodeTypeId);a.size>0&&n.push(`Recording references ${a.size} node(s) not in the current graph: ${[...a].join(", ")}`),l.size>0&&n.push(`Recording references ${l.size} node type(s) not in the current graph: ${[...l].join(", ")}`);const u=new Set(e.steps.map(f=>f.nodeId)),d=[];for(const f of t.nodes){const g=f.data.nodeTypeUniqueId;g&&(ri(g)||Tt(g)||t.typeOfNodes[g]?.subtree||u.has(f.id)||d.push(f.id))}return d.length>0&&n.push(`${d.length} node(s) in the current graph were not in the recording: ${d.join(", ")}`),{valid:!0,warnings:n,errors:r}}function GD({state:e,functionImplementations:t,options:n,executionRecord:r,onExecutionRecordChange:i}){const s=r!==void 0,[a,l]=T.useState(null),u=s?r:a,d=T.useRef(u??null),f=T.useCallback(ne=>{d.current=ne,s||l(ne),i?.(ne)},[s,i]),[g,h]=T.useState(()=>u?"completed":"idle"),[m,x]=T.useState(()=>u?ii(u,Math.max(0,u.steps.length-1)):Ms),[v,b]=T.useState(zD),[S,N]=T.useState(()=>u?Jf(u):Os),[w,I]=T.useState(()=>u?Math.max(0,u.steps.length-1):0),[k,A]=T.useState("instant"),[M,B]=T.useState(n?.maxLoopIterations??qb),U=T.useRef(null),q=T.useRef(null),D=T.useRef(new Map),$=T.useRef(!1),F=T.useRef(!0);T.useEffect(()=>(F.current=!0,()=>{F.current=!1,U.current?.abort(),q.current=null,$.current=!1}),[]);const E=T.useRef(u);if(s&&u!==E.current&&u!==d.current)if(E.current=u,u){const ne=Math.max(0,u.steps.length-1);I(ne),N(Jf(u));const oe=ii(u,ne);D.current=new Map(oe),x(oe),h(u.status==="cancelled"||u.errors.length>0?"errored":"completed")}else I(0),N(Os),D.current=new Map,x(Ms),h("idle");else s&&u!==E.current&&(E.current=u);T.useEffect(()=>{const ne=UD(e,t);b(ne)},[e.nodes,e.typeOfNodes,t]);const P=T.useCallback(()=>{F.current&&x(new Map(D.current))},[]),L=T.useCallback((ne,oe)=>{D.current.set(ne,oe)},[]),j=T.useCallback(()=>{try{return Yf(e,t,{maxLoopIterations:M})}catch{return F.current&&h("errored"),null}},[e,t,M]),O=T.useCallback(ne=>{if(!F.current)return;f(ne),I(Math.max(0,ne.steps.length-1));const oe=Jf(ne);N(oe);const pe=new Map;for(const le of ne.steps)pe.set(le.nodeId,le.status==="errored"?"errored":le.status==="skipped"?"skipped":"completed");D.current=pe,x(pe),q.current=null,h(ne.status==="cancelled"||ne.errors.length>0?"errored":"completed")},[]),W=T.useCallback(async()=>{D.current=new Map,x(Ms),N(Os),f(null),I(0),U.current?.abort();const ne=new AbortController;U.current=ne,h("compiling");const oe=j();if(oe&&F.current){h("running");try{const pe=await VD(oe,t,e,{onNodeStateChange:L,abortSignal:ne.signal});if(!F.current)return;O(pe)}catch{F.current&&(P(),h("errored"))}}},[e,t,j,L,P,O]),z=T.useCallback(async()=>{D.current=new Map,x(Ms),N(Os),f(null),I(0),U.current?.abort();const ne=new AbortController;U.current=ne,h("compiling");const oe=j();if(!oe||!F.current)return;h("running");const pe=FD(oe,t,e,{onNodeStateChange:L,abortSignal:ne.signal});q.current=pe;try{const le=await pe.next();if(!F.current)return;if(le.done)O(le.value);else{const{stepRecord:ve,partialRecord:me}=le.value;f(me),I(ve.stepIndex),x(ii(me,ve.stepIndex)),h("paused")}}catch{F.current&&(P(),h("errored"),q.current=null)}},[e,t,j,L,P,O]),Y=T.useCallback(()=>{k==="instant"?W():z()},[k,W,z]),J=T.useCallback(()=>{const ne=q.current;if(!ne){z();return}h("running"),(async()=>{try{const oe=await ne.next();if(!F.current)return;if(oe.done)O(oe.value);else{const{stepRecord:pe,partialRecord:le}=oe.value;f(le),I(pe.stepIndex),x(ii(le,pe.stepIndex)),h("paused")}}catch{F.current&&(P(),h("errored"),q.current=null)}})()},[z,P,O]),ie=T.useCallback(()=>{$.current=!1,F.current&&h("paused")},[]),ee=T.useCallback(()=>{const ne=q.current;ne&&($.current=!0,h("running"),(async()=>{for(;$.current;)try{const oe=await ne.next();if(!F.current)return;if(oe.done){$.current=!1,O(oe.value);return}const{stepRecord:pe,partialRecord:le}=oe.value;f(le),I(pe.stepIndex),x(ii(le,pe.stepIndex))}catch{$.current=!1,F.current&&(P(),h("errored"),q.current=null);return}F.current&&h("paused")})())},[P,O]),ce=T.useCallback(()=>{$.current=!1,U.current?.abort(),q.current=null,F.current&&(P(),h("errored"))},[P]),ge=T.useCallback(()=>{$.current=!1,U.current?.abort(),q.current=null,F.current&&(D.current=new Map,h("idle"),x(Ms),N(Os),f(null),I(0))},[]),Q=T.useCallback(ne=>{if(!u)return;const oe=Math.max(0,Math.min(ne,u.steps.length-1));I(oe);const pe=ii(u,oe);D.current=new Map(pe),x(pe)},[u]),te=T.useCallback(ne=>{const oe=WD(ne,e);return oe.valid&&($.current=!1,U.current?.abort(),q.current=null,O(ne)),oe},[e,O]);return{runnerState:g,nodeVisualStates:m,nodeWarnings:v,nodeErrors:S,executionRecord:u,currentStepIndex:w,run:Y,pause:ie,resume:ee,step:J,stop:ce,reset:ge,replayTo:Q,loadRecord:te,mode:k,setMode:A,maxLoopIterations:M,setMaxLoopIterations:B}}const qD=250;function Qf(e,t={}){const{durationMs:n=qD,hiddenTransform:r="translateY(100%)",visibleTransform:i="translateY(0)",easing:s="cubic-bezier(0.32, 0.72, 0, 1)"}=t,[a,l]=T.useState(!1),u=T.useRef(null),d=T.useRef(null);return T.useEffect(()=>{e&&l(!0)},[e]),T.useEffect(()=>{const g=u.current;if(!g||!a)return;d.current&&(g.style.transform=getComputedStyle(g).transform,d.current.cancel(),d.current=null);const h=e?i:r,m=g.animate([{transform:h}],{duration:n,easing:s,fill:"forwards"});d.current=m,e||(m.onfinish=()=>l(!1))},[e,a,n,r,i,s]),{mounted:a,ref:u,style:{transform:r}}}function Jb({initialSize:e,minSize:t,maxSize:n,direction:r="up"}){const[i,s]=T.useState(e),a=T.useRef(!1),l=T.useRef(0),u=T.useRef(0),d=r==="up"||r==="down",f=d?"ns-resize":"ew-resize",g=r==="up"||r==="left"?-1:1,h=T.useCallback(m=>{m.preventDefault(),m.stopPropagation(),a.current=!0,l.current=d?m.clientY:m.clientX,u.current=i,document.body.style.userSelect="none",document.body.style.cursor=f;const x=b=>{if(!a.current)return;const N=((d?b.clientY:b.clientX)-l.current)*g,w=Math.max(t,Math.min(n,u.current+N));s(w)},v=()=>{a.current=!1,document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",v)};document.addEventListener("mousemove",x),document.addEventListener("mouseup",v)},[i,t,n,d,f,g]);return{size:i,onMouseDown:h}}const YD=220,XD=80,KD=600;function ZD({runnerState:e,record:t,currentStepIndex:n,onRun:r,onPause:i,onStep:s,onStop:a,onReset:l,mode:u,onModeChange:d,maxLoopIterations:f,onMaxLoopIterationsChange:g,onScrubTo:h,onNavigateToNode:m,panelRef:x,debugMode:v=!1,hideComplexValues:b=!1,className:S}){const{selectedStepIndex:N,setSelectedStepIndex:w,edgeValuesAnimated:I,setEdgeValuesAnimated:k,isRunnerPanelOpen:A,setIsRunnerPanelOpen:M}=Uf(),{size:B,onMouseDown:U}=Jb({initialSize:YD,minSize:XD,maxSize:KD,direction:"up"}),{mounted:q,ref:D,style:$}=Qf(A),F=T.useCallback(Y=>{D.current=Y,x&&(x.current=Y)},[D,x]);T.useEffect(()=>{A||w(null)},[A,w]);const E=N!==null&&t?t.steps.find(Y=>Y.stepIndex===N)??null:null,P=T.useRef(null);E&&(P.current=E);const j=Qf(E!==null,{durationMs:200,hiddenTransform:"translateX(100%)",visibleTransform:"translateX(0)"}),O=E??P.current,W=T.useCallback(Y=>{w(N===Y.stepIndex?null:Y.stepIndex)},[N,w]),z=T.useCallback(()=>{w(null)},[w]);return q?y.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 overflow-hidden pointer-events-none",children:y.jsxs("div",{ref:F,className:ye("pointer-events-auto","flex flex-col overflow-hidden rounded-t-lg border border-b-0 border-secondary-dark-gray/60 bg-runner-panel-bg shadow-xl",S),style:$,children:[y.jsx("div",{className:"group/resizer flex shrink-0 cursor-ns-resize items-center justify-center border-b border-runner-timeline-box-border bg-[#2b2b2b] py-2 transition-colors hover:bg-[#353535]",onMouseDown:U,children:y.jsxs("div",{className:"flex gap-1.5",children:[y.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-runner-handle-dot transition-colors group-hover/resizer:bg-primary-blue"}),y.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-runner-handle-dot transition-colors group-hover/resizer:bg-primary-blue"}),y.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-runner-handle-dot transition-colors group-hover/resizer:bg-primary-blue"})]})}),y.jsxs("div",{className:"flex shrink-0 items-center",children:[y.jsx("div",{className:"min-w-0 flex-1",children:y.jsx(wb,{runnerState:e,onRun:r,onPause:i,onStep:s,onStop:a,onReset:l,mode:u,onModeChange:d,maxLoopIterations:f,onMaxLoopIterationsChange:g})}),y.jsx("button",{type:"button",onClick:()=>M(!1),className:"btn-press mr-3 shrink-0 rounded p-1.5 text-secondary-light-gray transition-colors hover:bg-primary-dark-gray hover:text-primary-white",title:"Close panel",children:y.jsx(aa,{className:"h-4 w-4"})})]}),y.jsxs("div",{className:"flex min-h-0 overflow-hidden",style:{height:`${B}px`},children:[y.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:y.jsx(jb,{record:t,currentStepIndex:n,onScrubTo:h,onStepClick:W,selectedStepIndex:N,onNavigateToNode:m})}),j.mounted&&O&&y.jsx("div",{ref:j.ref,className:"node-runner-scrollbar shrink-0 overflow-y-auto border-l border-secondary-dark-gray",style:j.style,children:y.jsx($b,{stepRecord:O,onClose:z,loopRecords:t?.loopRecords,hideComplexValues:b,debugMode:v,edgeValuesAnimated:I,onEdgeValuesAnimatedChange:k})})]})]})}):null}function JD({state:e,dispatch:t,functionImplementations:n,children:r,onExecutionRecordRef:i,loadRecordRef:s}){const{executionRecord:a,setExecutionRecord:l}=Tw(),u=GD({state:e,functionImplementations:n,executionRecord:a,onExecutionRecordChange:l}),{getNode:d,setCenter:f,getViewport:g}=Zo(),h=T.useRef(null),m=Uf(),{selectedStepIndex:x,setSelectedStepIndex:v,edgeValuesAnimated:b,isRunnerPanelOpen:S,setIsRunnerPanelOpen:N,getViewState:w,restoreViewState:I}=m,k=T.useCallback(q=>{const D=d(q);if(!D)return;const $=D.position.x+(D.measured?.width??200)/2;let F=D.position.y+(D.measured?.height??100)/2;const E=g().zoom,P=h.current?.offsetHeight??0;P>0&&(F+=P/(2*E)),f($,F,{duration:300,zoom:E})},[d,f,g]);T.useEffect(()=>(s&&(s.current=q=>{const D=u.loadRecord(q);return D.valid&&q.viewState&&(I(q.viewState),q.viewState.runMode!==void 0&&u.setMode(q.viewState.runMode),q.viewState.maxLoopIterations!==void 0&&u.setMaxLoopIterations(q.viewState.maxLoopIterations)),D}),()=>{s&&(s.current=null)}),[s,u.loadRecord,u.setMode,u.setMaxLoopIterations,I]);const A=T.useMemo(()=>{const q=new Map;for(const[D,$]of u.nodeVisualStates)q.set(D,{visualState:$});for(const[D,$]of u.nodeWarnings){const F=q.get(D);F?q.set(D,{...F,warnings:$}):q.set(D,{visualState:"warning",warnings:$})}for(const[D,$]of u.nodeErrors){const F=q.get(D);F?q.set(D,{...F,errors:$}):q.set(D,{visualState:"errored",errors:$})}return q},[u.nodeVisualStates,u.nodeWarnings,u.nodeErrors]),M=T.useCallback(q=>{u.setMode(q)},[u.setMode]),B=T.useCallback(()=>{u.runnerState==="paused"?u.resume():u.run()},[u.runnerState,u.run,u.resume]);T.useEffect(()=>{(u.runnerState==="compiling"||u.runnerState==="idle")&&v(null)},[u.runnerState]),T.useEffect(()=>{x!==null&&u.replayTo(x)},[x,u.replayTo]);const U=T.useMemo(()=>x===null||!u.executionRecord?null:u.executionRecord.steps.find(q=>q.stepIndex===x)??null,[x,u.executionRecord]);return T.useEffect(()=>(i&&(i.current=()=>{const q=u.executionRecord;if(!q)return null;const D={...w(),runMode:u.mode,maxLoopIterations:u.maxLoopIterations};return{...q,viewState:D}}),()=>{i&&(i.current=null)}),[i,u.executionRecord,w,u.mode,u.maxLoopIterations]),y.jsxs(uo.Provider,{value:Sf({state:e,dispatch:t},A,U,b),children:[r,y.jsx(ZD,{runnerState:u.runnerState,record:u.executionRecord,currentStepIndex:u.currentStepIndex,onRun:B,onPause:u.pause,onStep:u.step,onStop:u.stop,onReset:u.reset,mode:u.mode,onModeChange:M,maxLoopIterations:u.maxLoopIterations,onMaxLoopIterationsChange:u.setMaxLoopIterations,onScrubTo:u.replayTo,onNavigateToNode:k,panelRef:h}),!S&&y.jsxs("button",{type:"button",onClick:()=>N(!0),className:"btn-press absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center gap-2 rounded-lg border border-secondary-dark-gray/60 bg-secondary-black/90 px-4 py-2 text-[12px] font-medium text-primary-white shadow-xl backdrop-blur-sm transition-colors hover:bg-primary-dark-gray",title:"Open runner panel",children:[y.jsx(au,{className:"h-3.5 w-3.5"}),"Runner"]})]})}function Qb(e,t){const n=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}function QD({state:e,dispatch:t,functionImplementations:n,onStateImported:r,onRecordingImported:i,onImportError:s}){const a=T.useRef(null),l=T.useRef(null),[u,d]=T.useState(0),f=T.useRef(null),g=T.useRef(null),h=T.useCallback(()=>{const D=bw(e,{pretty:!0});Qb(D,"graph-state.json")},[e]),m=T.useCallback(D=>{const $=Iw(D,{dataTypes:e.dataTypes,typeOfNodes:e.typeOfNodes,repair:{removeOrphanEdges:!0,removeDuplicateNodeIds:!0,removeDuplicateEdgeIds:!0,fillMissingDefaults:!0,rehydrateDataTypeObjects:!0}});if($.success){const F={...$.data,dataTypes:e.dataTypes,typeOfNodes:e.typeOfNodes};t({type:ft.REPLACE_STATE,payload:{state:F}}),d(E=>E+1),r?.(F)}else s?.($.errors.map(F=>`${F.path}: ${F.message}`))},[e.dataTypes,e.typeOfNodes,t,r,s]),x=T.useCallback(()=>{const D=a.current?.();if(!D)return;const $=Nw(D,{pretty:!0});Qb($,"execution-recording.json")},[]),v=T.useCallback(D=>{const $=Ew(D,{repair:{sanitizeNonSerializableValues:!0,removeOrphanSteps:!0}});if($.success){const F=l.current?.($.data);if(F&&!F.valid){s?.(F.errors);return}F?.warnings.length&&console.warn("Recording import warnings:",F.warnings),i?.($.data)}else s?.($.errors.map(F=>`${F.path}: ${F.message}`))},[i,s]),[b,S]=T.useState({isOpen:!1,position:{x:0,y:0}}),N=T.useMemo(()=>{const D=[];for(const $ of Object.keys(e.typeOfNodes)){if(!kr(e.typeOfNodes,$))continue;const F=e.typeOfNodes[$];F?.subtree!==void 0&&D.push({id:$,name:F.name})}return D},[e.typeOfNodes]),w=T.useMemo(()=>e.openedNodeGroupStack?.[e.openedNodeGroupStack.length-1],[e.openedNodeGroupStack]),{screenToFlowPosition:I,fitView:k}=Zo(),A=T.useCallback(()=>{S({isOpen:!1,position:{x:0,y:0}})},[]),M=T.useMemo(()=>[...mb({typeOfNodes:e.typeOfNodes,dispatch:t,setContextMenu:S,contextMenuPosition:I(b.position),currentNodeType:w?.nodeType,isRecursionAllowed:!e.enableRecursionChecking}),...MD({onExportState:h,onImportState:()=>f.current?.click(),onExportRecording:x,onImportRecording:()=>g.current?.click(),closeMenu:A})],[e.typeOfNodes,t,S,b.position,w?.nodeType,e.enableRecursionChecking,h,x,A,I]),B=T.useCallback(D=>{D.preventDefault();const $={x:D.clientX,y:D.clientY};S({isOpen:!0,position:$})},[]),U=T.useMemo(()=>Mt(e),[e.nodes,e.edges,e.openedNodeGroupStack,e.typeOfNodes]);T.useEffect(()=>{e.viewport===void 0&&(U.nodes.length>0?k({maxZoom:.5,minZoom:.1}):t({type:ft.SET_VIEWPORT,payload:{viewport:{x:0,y:0,zoom:.45}}}))},[e.viewport]);const q=y.jsxs(y.Fragment,{children:[y.jsxs(KR,{nodes:U.nodes,edges:U.edges,onNodesChange:D=>t({type:ft.UPDATE_NODE_BY_REACT_FLOW,payload:{changes:D}}),onEdgesChange:D=>t({type:ft.UPDATE_EDGES_BY_REACT_FLOW,payload:{changes:D}}),onConnect:D=>t({type:ft.ADD_EDGE_BY_REACT_FLOW,payload:{edge:D}}),maxZoom:1,minZoom:.1,proOptions:{hideAttribution:!0},colorMode:"dark",selectNodesOnDrag:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectionMode:Uo.Partial,nodeTypes:PD,edgeTypes:RD,deleteKeyCode:["Backspace","Delete","x"],connectionLineComponent:Hb,onContextMenu:B,onClick:A,viewport:e.viewport,onViewportChange:D=>t({type:ft.SET_VIEWPORT,payload:{viewport:D}}),onBeforeDelete:async({nodes:D,edges:$})=>{const F=Mt(e);return!!DL({...e,...F},D,$).validation.isValid},children:[y.jsx(lL,{}),y.jsx(nL,{}),y.jsx(SL,{pannable:!0})]},u),y.jsx(kD,{isOpen:b.isOpen,position:b.position,onClose:A,items:M}),y.jsx(OD,{nodeGroups:N,value:w?.nodeType??"",setValue:D=>{kr(e.typeOfNodes,D)&&t({type:ft.OPEN_NODE_GROUP,payload:{nodeType:D}})},handleAddNewGroup:()=>t({type:ft.ADD_NODE_GROUP}),enableBackButton:(e.openedNodeGroupStack?.length||0)>0,handleBack:()=>t({type:ft.CLOSE_NODE_GROUP}),openedNodeGroupStack:(e.openedNodeGroupStack||[]).map(D=>({id:D.nodeType+("nodeId"in D?D.nodeId:""),name:e.typeOfNodes[D.nodeType].name}))})]});return y.jsxs("div",{style:{width:"100%",height:"100%"},className:"relative",children:[n?y.jsx(Q2,{children:y.jsx(JD,{state:e,dispatch:t,functionImplementations:n,onExecutionRecordRef:a,loadRecordRef:l,children:q})}):q,y.jsx("input",{ref:f,type:"file",accept:".json",className:"hidden",onChange:D=>{const $=D.target.files?.[0];if(!$)return;const F=new FileReader;F.onload=E=>{const P=E.target?.result;typeof P=="string"&&m(P)},F.readAsText($),D.target.value=""}}),y.jsx("input",{ref:g,type:"file",accept:".json",className:"hidden",onChange:D=>{const $=D.target.files?.[0];if(!$)return;const F=new FileReader;F.onload=E=>{const P=E.target?.result;typeof P=="string"&&v(P)},F.readAsText($),D.target.value=""}})]})}function ej({state:e,dispatch:t,functionImplementations:n,onStateImported:r,onRecordingImported:i,onImportError:s,executionRecord:a,onExecutionRecordChange:l}){const u=T.useCallback(()=>{},[]),d=T.useMemo(()=>({executionRecord:a??null,setExecutionRecord:l??u}),[a,l,u]);return y.jsx(G0,{children:y.jsx(uo.Provider,{value:Sf({state:e,dispatch:t}),children:y.jsx(bf.Provider,{value:d,children:y.jsx(QD,{state:e,dispatch:t,functionImplementations:n,onStateImported:r,onRecordingImported:i,onImportError:s})})})})}const tt=["circle","square","rectangle","list","grid","diamond","trapezium","hexagon","star","cross","zigzag","sparkle","parallelogram"],Ct={[tt[0]]:tt[0],[tt[1]]:tt[1],[tt[2]]:tt[2],[tt[3]]:tt[3],[tt[4]]:tt[4],[tt[5]]:tt[5],[tt[6]]:tt[6],[tt[7]]:tt[7],[tt[8]]:tt[8],[tt[9]]:tt[9],[tt[10]]:tt[10],[tt[11]]:tt[11],[tt[12]]:tt[12]},tl=(e,t,n,r="black",i=2)=>y.jsxs("div",{className:ye("relative",n),children:[y.jsx("div",{className:"absolute",style:{top:-i,left:-i,right:-i,bottom:-i,backgroundColor:r,clipPath:e}}),y.jsx("div",{className:"absolute inset-0",style:{backgroundColor:t,clipPath:e}})]}),eS=(e=Ct.circle,t="#A1A1A1",n)=>{const r="border-2 border-black",i="border-1 border-black",s={backgroundColor:t};switch(e){case Ct.circle:return y.jsx("div",{className:ye("w-6 h-6 rounded-full",r,n),style:s});case Ct.square:return y.jsx("div",{className:ye("w-6 h-6",r,n),style:s});case Ct.rectangle:return y.jsx("div",{className:ye("w-4 h-8",r,n),style:s});case Ct.list:return y.jsx("div",{className:ye("w-6 h-6 flex flex-col justify-center gap-0.5",n),children:[0,1,2].map(a=>y.jsx("div",{className:ye("w-full h-2",i),style:s},a))});case Ct.grid:return y.jsx("div",{className:ye("w-6 h-6 grid grid-cols-2 gap-0.5",n),children:[0,1,2,3].map(a=>y.jsx("div",{className:ye("w-full h-full",i),style:s},a))});case Ct.diamond:return y.jsx("div",{className:ye("w-6 h-6 rotate-45",r,n),style:s});case Ct.trapezium:return tl("polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%)",t,ye("w-6 h-6",n));case Ct.hexagon:return tl("polygon(-50% 50%,50% 100%,150% 50%,50% 0)",t,ye("w-5 h-6",n));case Ct.star:return tl("polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)",t,ye("w-6 h-6",n));case Ct.cross:return y.jsxs("div",{className:ye("w-6 h-6 relative",n),children:[y.jsx("div",{className:ye("absolute top-1/2 left-0 w-full h-2 -translate-y-1/2",i),style:s}),y.jsx("div",{className:ye("absolute left-1/2 top-0 w-2 h-full -translate-x-1/2",i),style:s})]});case Ct.zigzag:return y.jsx("div",{className:ye("w-6 h-6",n),style:{...s,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 Ct.sparkle:return y.jsx("div",{className:ye("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 Ct.parallelogram:return tl("polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%)",t,ye("w-6 h-6",n));default:return y.jsx("div",{className:ye("w-6 h-6 rounded-full",r,n),style:s})}},nl=T.forwardRef(({type:e,position:t,id:n,color:r,shape:i=Ct.circle,maxConnections:s,isCurrentlyInsideReactFlow:a=!1,className:l,...u},d)=>{const f=a?q0({handleId:n,handleType:e}):[];if(a){const g=s!==void 0?f.length<s:void 0;return y.jsx(ds,{type:e,position:t,id:n,className:ye("!w-6 !h-6 !border-none !bg-transparent !pointer-events-auto",l),style:{backgroundColor:"transparent"},isConnectable:g,isConnectableStart:g,isConnectableEnd:g,...u,ref:d,children:y.jsx("div",{className:ye("pointer-events-none flex justify-center"),children:eS(i,r||"#A1A1A1",l)})})}return y.jsx("div",{className:ye("absolute",t===Ne.Right&&"right-0 top-1/2 -translate-y-1/2 translate-x-1/2",t===Ne.Left&&"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2"),...u,ref:d,children:eS(i,r||"#A1A1A1",l)})});nl.displayName="ContextAwareHandle";const ep=T.forwardRef(({className:e,...t},n)=>y.jsx(Cu,{"data-slot":"checkbox",className:ye("peer bg-primary-gray border-transparent data-[state=checked]:bg-primary-blue data-[state=checked]:text-primary-white focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-7 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:y.jsx(sm,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:y.jsx(sa,{className:"size-6",strokeWidth:3.5})})}));ep.displayName=Cu.displayName;const tS=({input:e})=>{const t=Zo(),n=us();return e.type==="string"?y.jsx(ws,{placeholder:e.name,value:e.value,onChange:r=>{e.onChange?.(r),t.setNodes(i=>i.map(s=>s.id===n?{...s,data:uf(s.data,e.id,{value:r},!0,!1,!1)}:s))},allowOnlyNumbers:!1,className:"w-full"}):e.type==="number"?y.jsx(ni,{name:e.name,value:e.value,onChange:r=>{e.onChange?.(r),t.setNodes(i=>i.map(s=>s.id===n?{...s,data:uf(s.data,e.id,{value:r},!0,!1,!1)}:s))},className:"w-full"}):e.type==="boolean"?y.jsxs("div",{className:"flex items-center gap-2 w-full",children:[y.jsx(ep,{checked:e.value,onCheckedChange:r=>{r!=="indeterminate"&&(e.onChange?.(r),t.setNodes(i=>i.map(s=>s.id===n?{...s,data:uf(s.data,e.id,{value:r},!0,!1,!1)}:s)))}}),y.jsx("p",{className:"text-primary-white text-[27px] leading-[27px] font-main truncate",children:e.name})]}):null},nS=({input:e,isCurrentlyInsideReactFlow:t})=>t?y.jsx(tS,{input:e}):e.type==="string"?y.jsx(ws,{placeholder:e.name,value:e.value,onChange:e.onChange,allowOnlyNumbers:!1,className:"w-full"}):e.type==="number"?y.jsx(ni,{name:e.name,value:e.value,onChange:e.onChange,className:"w-full"}):e.type==="boolean"?y.jsxs("div",{className:"flex items-center gap-2 w-full",children:[y.jsx(ep,{checked:e.value,onCheckedChange:n=>{n!=="indeterminate"&&e.onChange?.(n)}}),y.jsx("p",{className:"text-primary-white text-[27px] leading-[27px] font-main truncate",children:e.name})]}):null,rS=({})=>{const e=T.useContext(uo),t=us(),n=()=>{e?.allProps?.dispatch&&t&&e.allProps.dispatch({type:ft.OPEN_NODE_GROUP,payload:{nodeId:t}})};return y.jsx(eg,{strokeWidth:2.5,className:"shrink-0 w-7 h-7 aspect-square cursor-pointer hover:opacity-80",onClick:n})},oS=({showButton:e=!1,isCurrentlyInsideReactFlow:t})=>e?t?y.jsx(rS,{}):y.jsx(eg,{strokeWidth:2.5,className:"shrink-0 w-7 h-7 aspect-square cursor-pointer hover:opacity-80"}):y.jsx(y.Fragment,{}),tp=T.forwardRef(({input:e,isCurrentlyInsideReactFlow:t,hide:n=!1},r)=>{const i=t?q0({handleId:e.id}):[],s=t&&i.some(l=>l.targetHandle===e.id),a=e.allowInput&&!s;return y.jsxs("div",{ref:r,className:ye("text-primary-white text-[27px] leading-[27px] font-main relative px-6 flex flex-row py-3",n&&"h-0 overflow-hidden py-0",a&&"py-1"),children:[y.jsx(nl,{type:"target",position:Ne.Left,id:e.id,color:e.handleColor,shape:e.handleShape,maxConnections:e.maxConnections,isCurrentlyInsideReactFlow:t}),y.jsxs("div",{className:"flex-1 flex items-center gap-3 w-full",children:[!a&&y.jsx("div",{className:"truncate",children:e.name||"​"}),a&&y.jsx("div",{className:"flex-1 w-full",children:y.jsx(nS,{input:e,isCurrentlyInsideReactFlow:t})})]})]},e.id)});tp.displayName="RenderInput";const iS=T.forwardRef(({output:e,isCurrentlyInsideReactFlow:t},n)=>y.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:[y.jsx("div",{className:"truncate text-right",children:e.name||"​"}),y.jsx(nl,{type:"source",position:Ne.Right,id:e.id,color:e.handleColor,shape:e.handleShape,maxConnections:e.maxConnections,isCurrentlyInsideReactFlow:t})]},e.id));iS.displayName="RenderOutput";const sS=T.forwardRef(({panel:e,isCurrentlyInsideReactFlow:t,isOpen:n,onToggle:r},i)=>y.jsxs("div",{ref:i,className:"flex flex-col",children:[y.jsxs(Qn,{onClick:s=>{s.stopPropagation(),s.preventDefault(),r()},className:"bg-transparent border-none hover:bg-primary-gray rounded-none justify-start",children:[n?y.jsx(su,{className:"w-6 h-6 shrink-0 mr-2"}):y.jsx(Ei,{className:"w-6 h-6 shrink-0 mr-2"}),y.jsx("span",{className:"truncate",children:e.name})]}),y.jsx("div",{className:ye("flex flex-col bg-[#272727]",!n&&"h-0 overflow-hidden"),children:e.inputs.map(s=>y.jsx(tp,{input:s,isCurrentlyInsideReactFlow:t,hide:!n},s.id))})]},e.id));sS.displayName="RenderInputPanel";const np=T.forwardRef(({id:e,name:t="Node",headerColor:n="#79461D",inputs:r=[],outputs:i=[],isCurrentlyInsideReactFlow:s=!1,className:a,nodeResizerProps:l={},nodeTypeUniqueId:u,showNodeOpenButton:d=!1,runnerVisualState:f,runnerErrors:g,runnerWarnings:h,...m},x)=>{const[v,b]=T.useState(new Set),S=T.useContext(uo),N=I=>{b(k=>{const A=new Set(k);return A.has(I)?A.delete(I):A.add(I),A})},w=y.jsxs("div",{tabIndex:0,className:ye("flex flex-col gap-0 rounded-md w-max border-[1.5px] border-transparent focus:border-white","in-[.selected]:border-white",a),...m,ref:x,children:[y.jsxs("div",{className:`text-primary-white text-left text-[27px] leading-[27px] font-main \\
305
+ px-4 transition-all rounded-t-md truncate flex justify-between items-center`,style:{backgroundColor:n},children:[y.jsx("p",{className:"truncate py-2",children:t}),S?.allProps?.state?.enableDebugMode&&y.jsx("p",{className:"shrink-0 py-2",children:e}),y.jsx(oS,{showButton:d,isCurrentlyInsideReactFlow:s})]}),y.jsxs("div",{className:"min-h-[50px] rounded-b-md bg-primary-dark-gray",children:[s&&y.jsx(kw,{...l}),y.jsx("div",{className:"flex flex-col py-4",children:i.map(I=>y.jsx(iS,{output:I,isCurrentlyInsideReactFlow:s},I.id))}),y.jsx("div",{className:"flex flex-col py-4",children:r.map(I=>{if("inputs"in I){const k=v.has(I.id);return y.jsx(sS,{panel:I,isCurrentlyInsideReactFlow:s,isOpen:k,onToggle:()=>N(I.id)},I.id)}else return y.jsx(tp,{input:I,isCurrentlyInsideReactFlow:s},I.id)})})]})]});return f!==void 0?y.jsx(ab,{visualState:f,errors:g,warnings:h,children:w}):w});np.displayName="ConfigurableNode";const rp=T.forwardRef(({data:e={},id:t},n)=>{const i=T.useContext(uo)?.nodeRunnerStates?.get(t);return y.jsx(np,{isCurrentlyInsideReactFlow:!0,id:t,className:"w-full",...e,runnerVisualState:i?.visualState,runnerErrors:i?.errors,runnerWarnings:i?.warnings,ref:n})});rp.displayName="ConfigurableNodeReactFlowWrapper",fe.Accordion=Fy,fe.AccordionContent=od,fe.AccordionItem=nd,fe.AccordionTrigger=rd,fe.Button=Qn,fe.ButtonToggle=zf,fe.ConfigurableEdge=_f,fe.ConfigurableNode=np,fe.ConfigurableNodeReactFlowWrapper=rp,fe.ContextAwareHandle=nl,fe.ContextAwareInput=nS,fe.ContextAwareOpenButton=oS,fe.ContextMenu=pb,fe.ExecutionStepInspector=$b,fe.ExecutionTimeline=jb,fe.FullGraph=ej,fe.FullGraphContext=uo,fe.Input=ws,fe.NodeResizerWithMoreControls=kw,fe.NodeStatusIndicator=ab,fe.ReactFlowAwareInput=tS,fe.ReactFlowAwareOpenButton=rS,fe.RecordContext=bf,fe.RunControls=wb,fe.ScrollableButtonContainer=Rf,fe.Select=yb,fe.SelectContent=Vf,fe.SelectGroup=X2,fe.SelectItem=qc,fe.SelectLabel=vb,fe.SelectScrollDownButton=Bf,fe.SelectScrollUpButton=Hf,fe.SelectSeparator=xb,fe.SelectTrigger=$f,fe.SelectValue=Ff,fe.SliderNumberInput=ni,fe.Tooltip=sn,fe.actionTypesMap=ft,fe.addAnInputOrOutputToAllNodesOfANodeTypeAcrossStateIncludingSubtrees=dw,fe.addEdgeWithTypeChecking=aw,fe.cn=ye,fe.constructInputOrOutputOfType=Tr,fe.constructInputPanelOfType=J0,fe.constructNodeOfType=ps,fe.constructTypeOfHandleFromIndices=Cr,fe.convertStringToNumber=Gy,fe.createContextValue=Sf,fe.createNodeContextMenu=mb,fe.deserializeExecutionRecord=vf,fe.deserializeGraphError=mf,fe.exportExecutionRecord=Nw,fe.exportGraphState=bw,fe.getAllDependenciesOfNodeTypeRecursively=EL,fe.getAllDependentsOfNodeTypeRecursively=ew,fe.getCurrentNodesAndEdgesFromState=Mt,fe.getDependencyGraphBetweenNodeTypes=hs,fe.getDirectDependenciesOfNodeType=Q0,fe.getDirectDependentsOfNodeType=af,fe.getResultantDataTypeOfHandleConsideringInferredType=lo,fe.groupNodeContextMenu=ow,fe.handleShapesMap=Ct,fe.importExecutionRecord=Ew,fe.importGraphState=Iw,fe.isCoordinateInBox=Wy,fe.isNumberInRange=id,fe.isSupportedUnderlyingType=uC,fe.isValidDataTypeId=fC,fe.loopEndInputInferHandleIndex=Lc,fe.loopEndOutputInferHandleIndex=Dc,fe.loopStartInputInferHandleIndex=Mc,fe.loopStartOutputInferHandleIndex=Oc,fe.loopStopInputInferHandleIndex=Pc,fe.loopStopOutputInferHandleIndex=Rc,fe.mainReducer=fw,fe.makeAllowedConversionsBetweenDataTypesWithAutoInfer=hC,fe.makeDataTypeWithAutoInfer=dC,fe.makeStateWithAutoInfer=gC,fe.makeTypeOfNodeWithAutoInfer=pC,fe.mapToRecord=hf,fe.recordToReadonlyMap=vs,fe.removeEdgeWithTypeChecking=cw,fe.safeSerializeValue=Vn,fe.sanitizeNumberToShowAsText=sd,fe.serializeExecutionRecord=yf,fe.serializeGraphError=gf,fe.setCurrentNodesAndEdgesToStateWithMutatingState=so,fe.standardDataTypeNames=ir,fe.standardDataTypeNamesMap=ze,fe.standardDataTypes=ML,fe.standardNodeContextMenu=Qo,fe.standardNodeTypeNames=In,fe.standardNodeTypeNamesMap=Te,fe.standardNodeTypes=OL,fe.supportedUnderlyingTypesMap=qy,fe.useAutoScroll=cb,fe.useClickedOutside=Aw,fe.useDrag=lb,fe.useFloatingTooltip=ob,fe.useFullGraph=JL,fe.useRecordContext=Tw,fe.useResizeHandle=Jb,fe.useSlideAnimation=Qf,fe.validateExecutionRecordStructure=mw,fe.validateGraphStateStructure=pw,fe.willAddingEdgeCreateCycle=lw,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});