@railtownai/railtracks-visualizer 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,21 +1,21 @@
1
- "use strict";var e=require("react"),t=require("react-dom"),n=require("react-countup"),r=require("react/jsx-runtime");function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var a=o(e),i=o(t);function s(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=s(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c,u={exports:{}},d={},f={exports:{}},p={};var h,m,g,y={};function v(){return m||(m=1,"production"===process.env.NODE_ENV?f.exports=function(){if(c)return p;c=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useState,o=t.useEffect,a=t.useLayoutEffect,i=t.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return a(function(){c.value=n,c.getSnapshot=t,s(c)&&u({inst:c})},[e,n,t]),o(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),i(n),n};return p.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,p}():f.exports=(h||(h=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useState,a=n.useEffect,i=n.useLayoutEffect,s=n.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,u){l||void 0===n.startTransition||(l=!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 d=u();if(!c){var f=u();r(d,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=o({inst:{value:d,getSnapshot:u}}))[0].inst,h=f[1];return i(function(){p.value=d,p.getSnapshot=u,t(p)&&h({inst:p})},[e,d,u]),a(function(){return t(p)&&h({inst:p}),e(function(){t(p)&&h({inst:p})})},[e]),s(d),d};y.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),y)),f.exports}var b,w={};"production"===process.env.NODE_ENV?u.exports=function(){if(g)return d;g=1;var t=e,n=v(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,a=t.useRef,i=t.useEffect,s=t.useMemo,l=t.useDebugValue;return d.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=a(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!i){if(i=!0,o=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return a=t}return a=e}if(t=a,r(o,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,a=n)}var o,a,i=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var p=o(e,d[0],d[1]);return i(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},d}():u.exports=(b||(b=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=e,n=v(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,a=t.useRef,i=t.useEffect,s=t.useMemo,l=t.useDebugValue;w.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=a(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!i){if(i=!0,o=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return a=t}return a=e}if(t=a,r(o,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,a=n)}var o,a,i=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var p=o(e,d[0],d[1]);return i(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),w);var x=l(u.exports);const E=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{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()}},i=t=e(r,o,a);return a},{useDebugValue:S}=e,{useSyncExternalStoreWithSelector:_}=x,C=e=>e;function k(e,t=C,n){const r=_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return S(r),r}const N=(e,t)=>{const n=(e=>e?E(e):E)(e),r=(e,r=t)=>k(n,e,r);return Object.assign(r,n),r};function M(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var R={value:()=>{}};function O(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new P(r)}function P(e){this._=e}function A(e,t){for(var n,r=0,o=e.length;r<o;++r)if((n=e[r]).name===t)return n.value}function T(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=R,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}P.prototype=O.prototype={constructor:P,on:function(e,t){var n,r,o=this._,a=(r=o,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),i=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++i<s;)if(n=(e=a[i]).type)o[n]=T(o[n],e.name,t);else if(null==t)for(n in o)o[n]=T(o[n],e.name,null);return this}for(;++i<s;)if((n=(e=a[i]).type)&&(n=A(o[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new P(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,o=new Array(n),a=0;a<n;++a)o[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=0,n=(r=this._[e]).length;a<n;++a)r[a].value.apply(t,o)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,a=r.length;o<a;++o)r[o].value.apply(t,n)}};var $="http://www.w3.org/1999/xhtml",D={svg:"http://www.w3.org/2000/svg",xhtml:$,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function I(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),D.hasOwnProperty(t)?{space:D[t],local:e}:e}function z(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$&&t.documentElement.namespaceURI===$?t.createElement(e):t.createElementNS(n,e)}}function L(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function B(e){var t=I(e);return(t.local?L:z)(t)}function F(){}function j(e){return null==e?F:function(){return this.querySelector(e)}}function H(){return[]}function V(e){return null==e?H:function(){return this.querySelectorAll(e)}}function W(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function Y(e){return function(){return this.matches(e)}}function X(e){return function(t){return t.matches(e)}}var K=Array.prototype.find;function U(){return this.firstElementChild}var q=Array.prototype.filter;function Z(){return Array.from(this.children)}function G(e){return new Array(e.length)}function J(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Q(e,t,n,r,o,a){for(var i,s=0,l=t.length,c=a.length;s<c;++s)(i=t[s])?(i.__data__=a[s],r[s]=i):n[s]=new J(e,a[s]);for(;s<l;++s)(i=t[s])&&(o[s]=i)}function ee(e,t,n,r,o,a,i){var s,l,c,u=new Map,d=t.length,f=a.length,p=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(p[s]=c=i.call(l,l.__data__,s,t)+"",u.has(c)?o[s]=l:u.set(c,l));for(s=0;s<f;++s)c=i.call(e,a[s],s,a)+"",(l=u.get(c))?(r[s]=l,l.__data__=a[s],u.delete(c)):n[s]=new J(e,a[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(p[s])===l&&(o[s]=l)}function te(e){return e.__data__}function ne(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function re(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function oe(e){return function(){this.removeAttribute(e)}}function ae(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ie(e,t){return function(){this.setAttribute(e,t)}}function se(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function le(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ce(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ue(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function de(e){return function(){this.style.removeProperty(e)}}function fe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function pe(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function he(e,t){return e.style.getPropertyValue(t)||ue(e).getComputedStyle(e,null).getPropertyValue(t)}function me(e){return function(){delete this[e]}}function ge(e,t){return function(){this[e]=t}}function ye(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function ve(e){return e.trim().split(/^|\s+/)}function be(e){return e.classList||new we(e)}function we(e){this._node=e,this._names=ve(e.getAttribute("class")||"")}function xe(e,t){for(var n=be(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ee(e,t){for(var n=be(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Se(e){return function(){xe(this,e)}}function _e(e){return function(){Ee(this,e)}}function Ce(e,t){return function(){(t.apply(this,arguments)?xe:Ee)(this,e)}}function ke(){this.textContent=""}function Ne(e){return function(){this.textContent=e}}function Me(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Re(){this.innerHTML=""}function Oe(e){return function(){this.innerHTML=e}}function Pe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Ae(){this.nextSibling&&this.parentNode.appendChild(this)}function Te(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $e(){return null}function De(){var e=this.parentNode;e&&e.removeChild(this)}function Ie(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ze(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Le(e){return function(){var t=this.__on;if(t){for(var n,r=0,o=-1,a=t.length;r<a;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?t.length=o:delete this.__on}}}function Be(e,t,n){return function(){var r,o=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(o)for(var i=0,s=o.length;i<s;++i)if((r=o[i]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),void(r.value=t);this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},o?o.push(r):this.__on=[r]}}function Fe(e,t,n){var r=ue(e),o=r.CustomEvent;"function"==typeof o?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function je(e,t){return function(){return Fe(this,e,t)}}function He(e,t){return function(){return Fe(this,e,t.apply(this,arguments))}}J.prototype={constructor:J,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)}},we.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Ve=[null];function We(e,t){this._groups=e,this._parents=t}function Ye(){return new We([[document.documentElement]],Ve)}function Xe(e){return"string"==typeof e?new We([[document.querySelector(e)]],[document.documentElement]):new We([[e]],Ve)}function Ke(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}We.prototype=Ye.prototype={constructor:We,select:function(e){"function"!=typeof e&&(e=j(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a,i,s=t[o],l=s.length,c=r[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(i=e.call(a,a.__data__,u,s))&&("__data__"in a&&(i.__data__=a.__data__),c[u]=i);return new We(r,this._parents)},selectAll:function(e){e="function"==typeof e?W(e):V(e);for(var t=this._groups,n=t.length,r=[],o=[],a=0;a<n;++a)for(var i,s=t[a],l=s.length,c=0;c<l;++c)(i=s[c])&&(r.push(e.call(i,i.__data__,c,s)),o.push(i));return new We(r,o)},selectChild:function(e){return this.select(null==e?U:function(e){return function(){return K.call(this.children,e)}}("function"==typeof e?e:X(e)))},selectChildren:function(e){return this.selectAll(null==e?Z:function(e){return function(){return q.call(this.children,e)}}("function"==typeof e?e:X(e)))},filter:function(e){"function"!=typeof e&&(e=Y(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a,i=t[o],s=i.length,l=r[o]=[],c=0;c<s;++c)(a=i[c])&&e.call(a,a.__data__,c,i)&&l.push(a);return new We(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,te);var n,r=t?ee:Q,o=this._parents,a=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var i=a.length,s=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var d=o[u],f=a[u],p=f.length,h=ne(e.call(d,d&&d.__data__,u,o)),m=h.length,g=l[u]=new Array(m),y=s[u]=new Array(m);r(d,f,g,y,c[u]=new Array(p),h,t);for(var v,b,w=0,x=0;w<m;++w)if(v=g[w]){for(w>=x&&(x=w+1);!(b=y[x])&&++x<m;);v._next=b||null}}return(s=new We(s,o))._enter=l,s._exit=c,s},enter:function(){return new We(this._enter||this._groups.map(G),this._parents)},exit:function(){return new We(this._exit||this._groups.map(G),this._parents)},join:function(e,t,n){var r=this.enter(),o=this,a=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(o=t(o))&&(o=o.selection()),null==n?a.remove():n(a),r&&o?r.merge(o).order():o},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,a=r.length,i=Math.min(o,a),s=new Array(o),l=0;l<i;++l)for(var c,u=n[l],d=r[l],f=u.length,p=s[l]=new Array(f),h=0;h<f;++h)(c=u[h]||d[h])&&(p[h]=c);for(;l<o;++l)s[l]=n[l];return new We(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,o=e[t],a=o.length-1,i=o[a];--a>=0;)(r=o[a])&&(i&&4^r.compareDocumentPosition(i)&&i.parentNode.insertBefore(r,i),i=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=re);for(var n=this._groups,r=n.length,o=new Array(r),a=0;a<r;++a){for(var i,s=n[a],l=s.length,c=o[a]=new Array(l),u=0;u<l;++u)(i=s[u])&&(c[u]=i);c.sort(t)}return new We(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,a=r.length;o<a;++o){var i=r[o];if(i)return i}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o,a=t[n],i=0,s=a.length;i<s;++i)(o=a[i])&&e.call(o,o.__data__,i,a);return this},attr:function(e,t){var n=I(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?ae:oe:"function"==typeof t?n.local?ce:le:n.local?se:ie)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?de:"function"==typeof t?pe:fe)(e,t,null==n?"":n)):he(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?me:"function"==typeof t?ye:ge)(e,t)):this.node()[e]},classed:function(e,t){var n=ve(e+"");if(arguments.length<2){for(var r=be(this.node()),o=-1,a=n.length;++o<a;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof t?Ce:t?Se:_e)(n,t))},text:function(e){return arguments.length?this.each(null==e?ke:("function"==typeof e?Me:Ne)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Re:("function"==typeof e?Pe:Oe)(e)):this.node().innerHTML},raise:function(){return this.each(Ae)},lower:function(){return this.each(Te)},append:function(e){var t="function"==typeof e?e:B(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:B(e),r=null==t?$e:"function"==typeof t?t:j(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(De)},clone:function(e){return this.select(e?ze:Ie)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,o,a=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),i=a.length;if(!(arguments.length<2)){for(s=t?Be:Le,r=0;r<i;++r)this.each(s(a[r],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<i;++r)if((o=a[r]).type===l.type&&o.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?He:je)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,o=e[t],a=0,i=o.length;a<i;++a)(r=o[a])&&(yield r)}};const Ue={passive:!1},qe={capture:!0,passive:!1};function Ze(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Je(e){var t=e.document.documentElement,n=Xe(e).on("dragstart.drag",Ge,qe);"onselectstart"in t?n.on("selectstart.drag",Ge,qe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qe(e,t){var n=e.document.documentElement,r=Xe(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ge,qe),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var et=e=>()=>e;function tt(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:a,x:i,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function nt(e){return!e.ctrlKey&&!e.button}function rt(){return this.parentNode}function ot(e,t){return null==t?{x:e.x,y:e.y}:t}function at(){return navigator.maxTouchPoints||"ontouchstart"in this}function it(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function st(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function lt(){}tt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var ct=.7,ut=1/ct,dt="\\s*([+-]?\\d+)\\s*",ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ht=/^#([0-9a-f]{3,8})$/,mt=new RegExp(`^rgb\\(${dt},${dt},${dt}\\)$`),gt=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),yt=new RegExp(`^rgba\\(${dt},${dt},${dt},${ft}\\)$`),vt=new RegExp(`^rgba\\(${pt},${pt},${pt},${ft}\\)$`),bt=new RegExp(`^hsl\\(${ft},${pt},${pt}\\)$`),wt=new RegExp(`^hsla\\(${ft},${pt},${pt},${ft}\\)$`),xt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Et(){return this.rgb().formatHex()}function St(){return this.rgb().formatRgb()}function _t(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ht.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Ct(t):3===n?new Mt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?kt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?kt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=mt.exec(e))?new Mt(t[1],t[2],t[3],1):(t=gt.exec(e))?new Mt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=yt.exec(e))?kt(t[1],t[2],t[3],t[4]):(t=vt.exec(e))?kt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=bt.exec(e))?$t(t[1],t[2]/100,t[3]/100,1):(t=wt.exec(e))?$t(t[1],t[2]/100,t[3]/100,t[4]):xt.hasOwnProperty(e)?Ct(xt[e]):"transparent"===e?new Mt(NaN,NaN,NaN,0):null}function Ct(e){return new Mt(e>>16&255,e>>8&255,255&e,1)}function kt(e,t,n,r){return r<=0&&(e=t=n=NaN),new Mt(e,t,n,r)}function Nt(e,t,n,r){return 1===arguments.length?((o=e)instanceof lt||(o=_t(o)),o?new Mt((o=o.rgb()).r,o.g,o.b,o.opacity):new Mt):new Mt(e,t,n,null==r?1:r);var o}function Mt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Rt(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}`}function Ot(){const e=Pt(this.opacity);return`${1===e?"rgb(":"rgba("}${At(this.r)}, ${At(this.g)}, ${At(this.b)}${1===e?")":`, ${e})`}`}function Pt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function At(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tt(e){return((e=At(e))<16?"0":"")+e.toString(16)}function $t(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new It(e,t,n,r)}function Dt(e){if(e instanceof It)return new It(e.h,e.s,e.l,e.opacity);if(e instanceof lt||(e=_t(e)),!e)return new It;if(e instanceof It)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),a=Math.max(t,n,r),i=NaN,s=a-o,l=(a+o)/2;return s?(i=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+o:2-a-o,i*=60):s=l>0&&l<1?0:i,new It(i,s,l,e.opacity)}function It(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function zt(e){return(e=(e||0)%360)<0?e+360:e}function Lt(e){return Math.max(0,Math.min(1,e||0))}function Bt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}it(lt,_t,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Et,formatHex:Et,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Dt(this).formatHsl()},formatRgb:St,toString:St}),it(Mt,Nt,st(lt,{brighter(e){return e=null==e?ut:Math.pow(ut,e),new Mt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ct:Math.pow(ct,e),new Mt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mt(At(this.r),At(this.g),At(this.b),Pt(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:Rt,formatHex:Rt,formatHex8:function(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}${Tt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ot,toString:Ot})),it(It,function(e,t,n,r){return 1===arguments.length?Dt(e):new It(e,t,n,null==r?1:r)},st(lt,{brighter(e){return e=null==e?ut:Math.pow(ut,e),new It(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ct:Math.pow(ct,e),new It(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Mt(Bt(e>=240?e-240:e+120,o,r),Bt(e,o,r),Bt(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new It(zt(this.h),Lt(this.s),Lt(this.l),Pt(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=Pt(this.opacity);return`${1===e?"hsl(":"hsla("}${zt(this.h)}, ${100*Lt(this.s)}%, ${100*Lt(this.l)}%${1===e?")":`, ${e})`}`}}));var Ft=e=>()=>e;function jt(e){return 1===(e=+e)?Ht:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Ft(isNaN(t)?n:t)}}function Ht(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Ft(isNaN(e)?t:e)}var Vt=function e(t){var n=jt(t);function r(e,t){var r=n((e=Nt(e)).r,(t=Nt(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),i=Ht(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=a(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function Wt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Yt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xt=new RegExp(Yt.source,"g");function Kt(e,t){var n,r,o,a=Yt.lastIndex=Xt.lastIndex=0,i=-1,s=[],l=[];for(e+="",t+="";(n=Yt.exec(e))&&(r=Xt.exec(t));)(o=r.index)>a&&(o=t.slice(a,o),s[i]?s[i]+=o:s[++i]=o),(n=n[0])===(r=r[0])?s[i]?s[i]+=r:s[++i]=r:(s[++i]=null,l.push({i:i,x:Wt(n,r)})),a=Xt.lastIndex;return a<t.length&&(o=t.slice(a),s[i]?s[i]+=o:s[++i]=o),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}var Ut,qt=180/Math.PI,Zt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Gt(e,t,n,r,o,a){var i,s,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:o,translateY:a,rotate:Math.atan2(t,e)*qt,skewX:Math.atan(l)*qt,scaleX:i,scaleY:s}}function Jt(e,t,n,r){function o(e){return e.length?e.pop()+" ":""}return function(a,i){var s=[],l=[];return a=e(a),i=e(i),function(e,r,o,a,i,s){if(e!==o||r!==a){var l=i.push("translate(",null,t,null,n);s.push({i:l-4,x:Wt(e,o)},{i:l-2,x:Wt(r,a)})}else(o||a)&&i.push("translate("+o+t+a+n)}(a.translateX,a.translateY,i.translateX,i.translateY,s,l),function(e,t,n,a){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(o(n)+"rotate(",null,r)-2,x:Wt(e,t)})):t&&n.push(o(n)+"rotate("+t+r)}(a.rotate,i.rotate,s,l),function(e,t,n,a){e!==t?a.push({i:n.push(o(n)+"skewX(",null,r)-2,x:Wt(e,t)}):t&&n.push(o(n)+"skewX("+t+r)}(a.skewX,i.skewX,s,l),function(e,t,n,r,a,i){if(e!==n||t!==r){var s=a.push(o(a)+"scale(",null,",",null,")");i.push({i:s-4,x:Wt(e,n)},{i:s-2,x:Wt(t,r)})}else 1===n&&1===r||a.push(o(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,i.scaleX,i.scaleY,s,l),a=i=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Qt=Jt(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Zt:Gt(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),en=Jt(function(e){return null==e?Zt:(Ut||(Ut=document.createElementNS("http://www.w3.org/2000/svg","g")),Ut.setAttribute("transform",e),(e=Ut.transform.baseVal.consolidate())?Gt((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Zt)},", ",")",")");function tn(e){return((e=Math.exp(e))+1/e)/2}var nn,rn,on=function e(t,n,r){function o(e,o){var a,i,s=e[0],l=e[1],c=e[2],u=o[0],d=o[1],f=o[2],p=u-s,h=d-l,m=p*p+h*h;if(m<1e-12)i=Math.log(f/c)/t,a=function(e){return[s+e*p,l+e*h,c*Math.exp(t*e*i)]};else{var g=Math.sqrt(m),y=(f*f-c*c+r*m)/(2*c*n*g),v=(f*f-c*c-r*m)/(2*f*n*g),b=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);i=(w-b)/t,a=function(e){var r,o=e*i,a=tn(b),u=c/(n*g)*(a*(r=t*o+b,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+u*p,l+u*h,c*a/tn(t*o+b)]}}return a.duration=1e3*i*t/Math.SQRT2,a}return o.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},o}(Math.SQRT2,2,4),an=0,sn=0,ln=0,cn=0,un=0,dn=0,fn="object"==typeof performance&&performance.now?performance:Date,pn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function hn(){return un||(pn(mn),un=fn.now()+dn)}function mn(){un=0}function gn(){this._call=this._time=this._next=null}function yn(e,t,n){var r=new gn;return r.restart(e,t,n),r}function vn(){un=(cn=fn.now())+dn,an=sn=0;try{!function(){hn(),++an;for(var e,t=nn;t;)(e=un-t._time)>=0&&t._call.call(void 0,e),t=t._next;--an}()}finally{an=0,function(){var e,t,n=nn,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:nn=t);rn=e,wn(r)}(),un=0}}function bn(){var e=fn.now(),t=e-cn;t>1e3&&(dn-=t,cn=e)}function wn(e){an||(sn&&(sn=clearTimeout(sn)),e-un>24?(e<1/0&&(sn=setTimeout(vn,e-fn.now()-dn)),ln&&(ln=clearInterval(ln))):(ln||(cn=fn.now(),ln=setInterval(bn,1e3)),an=1,pn(vn)))}function xn(e,t,n){var r=new gn;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}gn.prototype=yn.prototype={constructor:gn,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?hn():+n)+(null==t?0:+t),this._next||rn===this||(rn?rn._next=this:nn=this,rn=this),this._call=e,this._time=n,wn()},stop:function(){this._call&&(this._call=null,this._time=1/0,wn())}};var En=O("start","end","cancel","interrupt"),Sn=[];function _n(e,t,n,r,o,a){var i=e.__transition;if(i){if(n in i)return}else e.__transition={};!function(e,t,n){var r,o=e.__transition;function a(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)}function i(a){var c,u,d,f;if(1!==n.state)return l();for(c in o)if((f=o[c]).name===n.name){if(3===f.state)return xn(i);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[c])}if(xn(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=f);r.length=u+1}}function s(t){for(var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),a=-1,i=r.length;++a<i;)r[a].call(e,o);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete o[t],o)return;delete e.__transition}o[t]=n,n.timer=yn(a,0,n.time)}(e,n,{name:t,index:r,group:o,on:En,tween:Sn,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Cn(e,t){var n=Nn(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function kn(e,t){var n=Nn(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Nn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Mn(e,t){var n,r,o,a=e.__transition,i=!0;if(a){for(o in t=null==t?null:t+"",a)(n=a[o]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[o]):i=!1;i&&delete e.__transition}}function Rn(e,t){var n,r;return function(){var o=kn(this,e),a=o.tween;if(a!==n)for(var i=0,s=(r=n=a).length;i<s;++i)if(r[i].name===t){(r=r.slice()).splice(i,1);break}o.tween=r}}function On(e,t,n){var r,o;if("function"!=typeof n)throw new Error;return function(){var a=kn(this,e),i=a.tween;if(i!==r){o=(r=i).slice();for(var s={name:t,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===t){o[l]=s;break}l===c&&o.push(s)}a.tween=o}}function Pn(e,t,n){var r=e._id;return e.each(function(){var e=kn(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Nn(e,r).value[t]}}function An(e,t){var n;return("number"==typeof t?Wt:t instanceof _t?Vt:(n=_t(t))?(t=n,Vt):Kt)(e,t)}function Tn(e){return function(){this.removeAttribute(e)}}function $n(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Dn(e,t,n){var r,o,a=n+"";return function(){var i=this.getAttribute(e);return i===a?null:i===r?o:o=t(r=i,n)}}function In(e,t,n){var r,o,a=n+"";return function(){var i=this.getAttributeNS(e.space,e.local);return i===a?null:i===r?o:o=t(r=i,n)}}function zn(e,t,n){var r,o,a;return function(){var i,s,l=n(this);if(null!=l)return(i=this.getAttribute(e))===(s=l+"")?null:i===r&&s===o?a:(o=s,a=t(r=i,l));this.removeAttribute(e)}}function Ln(e,t,n){var r,o,a;return function(){var i,s,l=n(this);if(null!=l)return(i=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:i===r&&s===o?a:(o=s,a=t(r=i,l));this.removeAttributeNS(e.space,e.local)}}function Bn(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,o)),n}return o._value=t,o}function Fn(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,o)),n}return o._value=t,o}function jn(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function Hn(e,t){return t=+t,function(){Cn(this,e).delay=t}}function Vn(e,t){return function(){kn(this,e).duration=+t.apply(this,arguments)}}function Wn(e,t){return t=+t,function(){kn(this,e).duration=t}}var Yn=Ye.prototype.constructor;function Xn(e){return function(){this.style.removeProperty(e)}}var Kn=0;function Un(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function qn(){return++Kn}var Zn=Ye.prototype;Un.prototype={constructor:Un,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=j(e));for(var r=this._groups,o=r.length,a=new Array(o),i=0;i<o;++i)for(var s,l,c=r[i],u=c.length,d=a[i]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,_n(d[f],t,n,f,d,Nn(s,n)));return new Un(a,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=V(e));for(var r=this._groups,o=r.length,a=[],i=[],s=0;s<o;++s)for(var l,c=r[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var f,p=e.call(l,l.__data__,d,c),h=Nn(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&_n(f,t,n,m,p,h);a.push(p),i.push(l)}return new Un(a,i,t,n)},selectChild:Zn.selectChild,selectChildren:Zn.selectChildren,filter:function(e){"function"!=typeof e&&(e=Y(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var a,i=t[o],s=i.length,l=r[o]=[],c=0;c<s;++c)(a=i[c])&&e.call(a,a.__data__,c,i)&&l.push(a);return new Un(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,a=Math.min(r,o),i=new Array(r),s=0;s<a;++s)for(var l,c=t[s],u=n[s],d=c.length,f=i[s]=new Array(d),p=0;p<d;++p)(l=c[p]||u[p])&&(f[p]=l);for(;s<r;++s)i[s]=t[s];return new Un(i,this._parents,this._name,this._id)},selection:function(){return new Yn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=qn(),r=this._groups,o=r.length,a=0;a<o;++a)for(var i,s=r[a],l=s.length,c=0;c<l;++c)if(i=s[c]){var u=Nn(i,t);_n(i,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Un(r,this._parents,e,n)},call:Zn.call,nodes:Zn.nodes,node:Zn.node,size:Zn.size,empty:Zn.empty,each:Zn.each,on:function(e,t){var n=this._id;return arguments.length<2?Nn(this.node(),n).on.on(e):this.each(function(e,t,n){var r,o,a=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Cn:kn;return function(){var i=a(this,e),s=i.on;s!==r&&(o=(r=s).copy()).on(t,n),i.on=o}}(n,e,t))},attr:function(e,t){var n=I(e),r="transform"===n?en:An;return this.attrTween(e,"function"==typeof t?(n.local?Ln:zn)(n,r,Pn(this,"attr."+e,t)):null==t?(n.local?$n:Tn)(n):(n.local?In:Dn)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=I(e);return this.tween(n,(r.local?Bn:Fn)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?Qt:An;return null==t?this.styleTween(e,function(e,t){var n,r,o;return function(){var a=he(this,e),i=(this.style.removeProperty(e),he(this,e));return a===i?null:a===n&&i===r?o:o=t(n=a,r=i)}}(e,r)).on("end.style."+e,Xn(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,o,a;return function(){var i=he(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=he(this,e)),i===l?null:i===r&&l===o?a:(o=l,a=t(r=i,s))}}(e,r,Pn(this,"style."+e,t))).each(function(e,t){var n,r,o,a,i="style."+t,s="end."+i;return function(){var l=kn(this,e),c=l.on,u=null==l.value[i]?a||(a=Xn(t)):void 0;c===n&&o===u||(r=(n=c).copy()).on(s,o=u),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,o,a=n+"";return function(){var i=he(this,e);return i===a?null:i===r?o:o=t(r=i,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,o;function a(){var a=t.apply(this,arguments);return a!==o&&(r=(o=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(Pn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,o=Nn(this.node(),n).tween,a=0,i=o.length;a<i;++a)if((r=o[a]).name===e)return r.value;return null}return this.each((null==t?Rn:On)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?jn:Hn)(t,e)):Nn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Vn:Wn)(t,e)):Nn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){kn(this,e).ease=t}}(t,e)):Nn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;kn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(a,i){var s={value:i},l={value:function(){0===--o&&a()}};n.each(function(){var n=kn(this,r),o=n.on;o!==e&&((t=(e=o).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===o&&a()})},[Symbol.iterator]:Zn[Symbol.iterator]};var Gn={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Jn(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Ye.prototype.interrupt=function(e){return this.each(function(){Mn(this,e)})},Ye.prototype.transition=function(e){var t,n;e instanceof Un?(t=e._id,e=e._name):(t=qn(),(n=Gn).time=hn(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,a=0;a<o;++a)for(var i,s=r[a],l=s.length,c=0;c<l;++c)(i=s[c])&&_n(i,e,t,c,s,n||Jn(i,t));return new Un(r,this._parents,e,t)};var Qn=e=>()=>e;function er(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function tr(e,t,n){this.k=e,this.x=t,this.y=n}tr.prototype={constructor:tr,scale:function(e){return 1===e?this:new tr(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new tr(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 nr=new tr(1,0,0);function rr(e){e.stopImmediatePropagation()}function or(e){e.preventDefault(),e.stopImmediatePropagation()}function ar(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function ir(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function sr(){return this.__zoom||nr}function lr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cr(){return navigator.maxTouchPoints||"ontouchstart"in this}function ur(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}tr.prototype;const dr=e.createContext(null),fr=dr.Provider,pr=()=>"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.",hr=e=>`Node type "${e}" not found. Using fallback type "default".`,mr=()=>"The React Flow parent container needs a width and a height to render the graph.",gr=()=>"Only child nodes can use a parent extent.",yr=()=>"Can't create edge. An edge needs a source and a target.",vr=e=>`Marker type "${e}" doesn't exist.`,br=(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,wr=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",xr=e=>`Edge type "${e}" not found. Using fallback type "default".`,Er=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.`,Sr=(()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001")();function _r(t,n){const r=e.useContext(dr);if(null===r)throw new Error(Sr);return k(r,t,n)}const Cr=()=>{const t=e.useContext(dr);if(null===t)throw new Error(Sr);return e.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},kr=e=>e.userSelectionActive?"none":"all";function Nr({position:t,children:n,className:r,style:o,...a}){const i=_r(kr),l=`${t}`.split("-");return e.createElement("div",{className:s(["react-flow__panel",r,...l]),style:{...o,pointerEvents:i},...a},n)}function Mr({proOptions:t,position:n="bottom-right"}){return t?.hideAttribution?null:e.createElement(Nr,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},e.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}var Rr=e.memo(({x:t,y:n,label:r,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:u,className:d,...f})=>{const p=e.useRef(null),[h,m]=e.useState({x:0,y:0,width:0,height:0}),g=s(["react-flow__edge-textwrapper",d]);return e.useEffect(()=>{if(p.current){const e=p.current.getBBox();m({x:e.x,y:e.y,width:e.width,height:e.height})}},[r]),void 0!==r&&r?e.createElement("g",{transform:`translate(${t-h.width/2} ${n-h.height/2})`,className:g,visibility:h.width?"visible":"hidden",...f},a&&e.createElement("rect",{width:h.width+2*l[0],x:-l[0],y:-l[1],height:h.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),e.createElement("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:p,style:o},r),u):null});const Or=e=>({width:e.offsetWidth,height:e.offsetHeight}),Pr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ar=(e={x:0,y:0},t)=>({x:Pr(e.x,t[0][0],t[1][0]),y:Pr(e.y,t[0][1],t[1][1])}),Tr=(e,t,n)=>e<t?Pr(Math.abs(e-t),1,50)/50:e>n?-Pr(Math.abs(e-n),1,50)/50:0,$r=(e,t)=>[20*Tr(e.x,35,t.width-35),20*Tr(e.y,35,t.height-35)],Dr=e=>e.getRootNode?.()||window?.document,Ir=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zr=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Lr=(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)},Br=e=>!isNaN(e)&&isFinite(e),Fr=Symbol.for("internals"),jr=["Enter"," ","Escape"],Hr=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)};function Vr(e){const t=(e=>"nativeEvent"in e)(e)?e.nativeEvent:e,n=t.composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const Wr=e=>"clientX"in e,Yr=(e,t)=>{const n=Wr(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},Xr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0,Kr=({id:t,path:n,labelX:r,labelY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:h=20})=>e.createElement(e.Fragment,null,e.createElement("path",{id:t,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:p}),h&&e.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),a&&Br(r)&&Br(o)?e.createElement(Rr,{x:r,y:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null);function Ur(e,t,n){return void 0===n?n:r=>{const o=t().edges.find(t=>t.id===e);o&&n(r,{...o})}}function qr({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,i=Math.abs(r-t)/2;return[a,r<t?r+i:r-i,o,i]}function Zr({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:a,targetControlX:i,targetControlY:s}){const l=.125*e+.375*o+.375*i+.125*n,c=.125*t+.375*a+.375*s+.125*r;return[l,c,Math.abs(l-e),Math.abs(c-t)]}var Gr,Jr,Qr,eo,to,no;function ro({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===no.Left||e===no.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function oo({sourceX:e,sourceY:t,sourcePosition:n=no.Bottom,targetX:r,targetY:o,targetPosition:a=no.Top}){const[i,s]=ro({pos:n,x1:e,y1:t,x2:r,y2:o}),[l,c]=ro({pos:a,x1:r,y1:o,x2:e,y2:t}),[u,d,f,p]=Zr({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${i},${s} ${l},${c} ${r},${o}`,u,d,f,p]}Kr.displayName="BaseEdge",function(e){e.Strict="strict",e.Loose="loose"}(Gr||(Gr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Jr||(Jr={})),function(e){e.Partial="partial",e.Full="full"}(Qr||(Qr={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(eo||(eo={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(to||(to={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(no||(no={}));const ao=e.memo(({sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:a=no.Bottom,targetPosition:i=no.Top,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,interactionWidth:g})=>{const[y,v,b]=oo({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:o,targetPosition:i});return e.createElement(Kr,{path:y,labelX:v,labelY:b,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,interactionWidth:g})});ao.displayName="SimpleBezierEdge";const io={[no.Left]:{x:-1,y:0},[no.Right]:{x:1,y:0},[no.Top]:{x:0,y:-1},[no.Bottom]:{x:0,y:1}},so=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function lo({source:e,sourcePosition:t=no.Bottom,target:n,targetPosition:r=no.Top,center:o,offset:a}){const i=io[t],s=io[r],l={x:e.x+i.x*a,y:e.y+i.y*a},c={x:n.x+s.x*a,y:n.y+s.y*a},u=(({source:e,sourcePosition:t=no.Bottom,target:n})=>t===no.Left||t===no.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:l,sourcePosition:t,target:c}),d=0!==u.x?"x":"y",f=u[d];let p,h,m=[];const g={x:0,y:0},y={x:0,y:0},[v,b,w,x]=qr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(i[d]*s[d]===-1){p=o.x??v,h=o.y??b;const e=[{x:p,y:l.y},{x:p,y:c.y}],t=[{x:l.x,y:h},{x:c.x,y:h}];m=i[d]===f?"x"===d?e:t:"x"===d?t:e}else{const o=[{x:l.x,y:c.y}],u=[{x:c.x,y:l.y}];if(m="x"===d?i.x===f?u:o:i.y===f?o:u,t===r){const t=Math.abs(e[d]-n[d]);if(t<=a){const r=Math.min(a-1,a-t);i[d]===f?g[d]=(l[d]>e[d]?-1:1)*r:y[d]=(c[d]>n[d]?-1:1)*r}}if(t!==r){const e="x"===d?"y":"x",t=i[d]===s[e],n=l[e]>c[e],r=l[e]<c[e];(1===i[d]&&(!t&&n||t&&r)||1!==i[d]&&(!t&&r||t&&n))&&(m="x"===d?o:u)}const v={x:l.x+g.x,y:l.y+g.y},b={x:c.x+y.x,y:c.y+y.y};Math.max(Math.abs(v.x-m[0].x),Math.abs(b.x-m[0].x))>=Math.max(Math.abs(v.y-m[0].y),Math.abs(b.y-m[0].y))?(p=(v.x+b.x)/2,h=m[0].y):(p=m[0].x,h=(v.y+b.y)/2)}return[[e,{x:l.x+g.x,y:l.y+g.y},...m,{x:c.x+y.x,y:c.y+y.y},n],p,h,w,x]}function co({sourceX:e,sourceY:t,sourcePosition:n=no.Bottom,targetX:r,targetY:o,targetPosition:a=no.Top,borderRadius:i=5,centerX:s,centerY:l,offset:c=20}){const[u,d,f,p,h]=lo({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:a,center:{x:s,y:l},offset:c}),m=u.reduce((e,t,n)=>{let r="";return r=n>0&&n<u.length-1?function(e,t,n,r){const o=Math.min(so(e,t)/2,so(t,n)/2,r),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i)return`L ${a+o*(e.x<n.x?-1:1)},${i}Q ${a},${i} ${a},${i+o*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${a},${i+o*(e.y<n.y?-1:1)}Q ${a},${i} ${a+o*s},${i}`}(u[n-1],t,u[n+1],i):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=r},"");return[m,d,f,p,h]}const uo=e.memo(({sourceX:t,sourceY:n,targetX:r,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,style:d,sourcePosition:f=no.Bottom,targetPosition:p=no.Top,markerEnd:h,markerStart:m,pathOptions:g,interactionWidth:y})=>{const[v,b,w]=co({sourceX:t,sourceY:n,sourcePosition:f,targetX:r,targetY:o,targetPosition:p,borderRadius:g?.borderRadius,offset:g?.offset});return e.createElement(Kr,{path:v,labelX:b,labelY:w,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,style:d,markerEnd:h,markerStart:m,interactionWidth:y})});uo.displayName="SmoothStepEdge";const fo=e.memo(t=>e.createElement(uo,{...t,pathOptions:e.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));fo.displayName="StepEdge";const po=e.memo(({sourceX:t,sourceY:n,targetX:r,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:h})=>{const[m,g,y]=function({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,a,i,s]=qr({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,a,i,s]}({sourceX:t,sourceY:n,targetX:r,targetY:o});return e.createElement(Kr,{path:m,labelX:g,labelY:y,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:h})});function ho(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function mo({pos:e,x1:t,y1:n,x2:r,y2:o,c:a}){switch(e){case no.Left:return[t-ho(t-r,a),n];case no.Right:return[t+ho(r-t,a),n];case no.Top:return[t,n-ho(n-o,a)];case no.Bottom:return[t,n+ho(o-n,a)]}}function go({sourceX:e,sourceY:t,sourcePosition:n=no.Bottom,targetX:r,targetY:o,targetPosition:a=no.Top,curvature:i=.25}){const[s,l]=mo({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[c,u]=mo({pos:a,x1:r,y1:o,x2:e,y2:t,c:i}),[d,f,p,h]=Zr({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${r},${o}`,d,f,p,h]}po.displayName="StraightEdge";const yo=e.memo(({sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:a=no.Bottom,targetPosition:i=no.Top,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,pathOptions:g,interactionWidth:y})=>{const[v,b,w]=go({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:o,targetPosition:i,curvature:g?.curvature});return e.createElement(Kr,{path:v,labelX:b,labelY:w,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,interactionWidth:y})});yo.displayName="BezierEdge";const vo=e.createContext(null),bo=vo.Provider;vo.Consumer;const wo=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,xo=(e,t)=>{if(void 0===e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`},Eo=(e,t)=>{if(!e.source||!e.target)return Hr("006",yr()),t;let n;var r;return n="id"in(r=e)&&"source"in r&&"target"in r?{...e}:{...e,id:wo(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:t.concat(n)},So=({x:e,y:t},[n,r,o],a,[i,s])=>{const l={x:(e-n)/o,y:(t-r)/o};return a?{x:i*Math.round(l.x/i),y:s*Math.round(l.y/s)}:l},_o=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r}),Co=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],o={x:e.position.x-n,y:e.position.y-r};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:o}},ko=(e,t=[0,0])=>{if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const{x:r,y:o}=Co(n,t).positionAbsolute;return a=e,i=Ir({x:r,y:o,width:n.width||0,height:n.height||0}),{x:Math.min(a.x,i.x),y:Math.min(a.y,i.y),x2:Math.max(a.x2,i.x2),y2:Math.max(a.y2,i.y2)};var a,i},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}))(n)},No=(e,t,[n,r,o]=[0,0,1],a=!1,i=!1,s=[0,0])=>{const l={x:(t.x-n)/o,y:(t.y-r)/o,width:t.width/o,height:t.height/o},c=[];return e.forEach(e=>{const{width:t,height:n,selectable:r=!0,hidden:o=!1}=e;if(i&&!r||o)return!1;const{positionAbsolute:u}=Co(e,s),d={x:u.x,y:u.y,width:t||0,height:n||0},f=Lr(l,d);(void 0===t||void 0===n||null===t||null===n||a&&f>0||f>=(t||0)*(n||0)||e.dragging)&&c.push(e)}),c},Mo=(e,t)=>{const n=e.map(e=>e.id);return t.filter(e=>n.includes(e.source)||n.includes(e.target))},Ro=(e,t,n,r,o,a=.1)=>{const i=t/(e.width*(1+a)),s=n/(e.height*(1+a)),l=Math.min(i,s),c=Pr(l,r,o);return{x:t/2-(e.x+e.width/2)*c,y:n/2-(e.y+e.height/2)*c,zoom:c}},Oo=(e,t=0)=>e.transition().duration(t);function Po(e,t,n,r){return(t[n]||[]).reduce((t,o)=>(`${e.id}-${o.id}-${n}`!==r&&t.push({id:o.id||null,type:n,nodeId:e.id,x:(e.positionAbsolute?.x??0)+o.x+o.width/2,y:(e.positionAbsolute?.y??0)+o.y+o.height/2}),t),[])}const Ao={source:null,target:null,sourceHandle:null,targetHandle:null},To=()=>({handleDomNode:null,isValid:!1,connection:Ao,endHandle:null});function $o(e,t,n,r,o,a,i){const s="target"===o,l=i.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),c={...To(),handleDomNode:l};if(l){const e=Do(void 0,l),o=l.getAttribute("data-nodeid"),i=l.getAttribute("data-handleid"),u=l.classList.contains("connectable"),d=l.classList.contains("connectableend"),f={source:s?o:n,sourceHandle:s?i:r,target:s?n:o,targetHandle:s?r:i};c.connection=f;u&&d&&(t===Gr.Strict?s&&"source"===e||!s&&"target"===e:o!==n||i!==r)&&(c.endHandle={nodeId:o,handleId:i,type:e},c.isValid=a(f))}return c}function Do(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Io(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function zo(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Lo({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:o,getState:a,setState:i,isValidConnection:s,edgeUpdaterType:l,onReconnectEnd:c}){const u=Dr(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:p,connectionRadius:h,onConnectStart:m,panBy:g,getNodes:y,cancelConnection:v}=a();let b,w=0;const{x:x,y:E}=Yr(e),S=u?.elementFromPoint(x,E),_=Do(l,S),C=f?.getBoundingClientRect();if(!C||!_)return;let k,N=Yr(e,C),M=!1,R=null,O=!1,P=null;const A=function({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((e,o)=>{if(o[Fr]){const{handleBounds:a}=o[Fr];let i=[],s=[];a&&(i=Po(o,a,"source",`${t}-${n}-${r}`),s=Po(o,a,"target",`${t}-${n}-${r}`)),e.push(...i,...s)}return e},[])}({nodes:y(),nodeId:n,handleId:t,handleType:_}),T=()=>{if(!p)return;const[e,t]=$r(N,C);g({x:e,y:t}),w=requestAnimationFrame(T)};function $(e){const{transform:r}=a();N=Yr(e,C);const{handle:l,validHandleResult:c}=function(e,t,n,r,o,a){const{x:i,y:s}=Yr(e),l=t.elementsFromPoint(i,s).find(e=>e.classList.contains("react-flow__handle"));if(l){const e=l.getAttribute("data-nodeid");if(e){const t=Do(void 0,l),r=l.getAttribute("data-handleid"),i=a({nodeId:e,id:r,type:t});if(i){const a=o.find(n=>n.nodeId===e&&n.type===t&&n.id===r);return{handle:{id:r,type:t,nodeId:e,x:a?.x||n.x,y:a?.y||n.y},validHandleResult:i}}}}let c=[],u=1/0;if(o.forEach(e=>{const t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=r){const n=a(e);t<=u&&(t<u?c=[{handle:e,validHandleResult:n}]:t===u&&c.push({handle:e,validHandleResult:n}),u=t)}}),!c.length)return{handle:null,validHandleResult:To()};if(1===c.length)return c[0];const d=c.some(({validHandleResult:e})=>e.isValid),f=c.some(({handle:e})=>"target"===e.type);return c.find(({handle:e,validHandleResult:t})=>f?"target"===e.type:!d||t.isValid)||c[0]}(e,u,So(N,r,!1,[1,1]),h,A,e=>$o(e,d,n,t,o?"target":"source",s,u));if(b=l,M||(T(),M=!0),P=c.handleDomNode,R=c.connection,O=c.isValid,i({connectionPosition:b&&O?_o({x:b.x,y:b.y},r):N,connectionStatus:zo(!!b,O),connectionEndHandle:c.endHandle}),!b&&!O&&!P)return Io(k);R.source!==R.target&&P&&(Io(k),k=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",O),P.classList.toggle("react-flow__handle-valid",O))}function D(e){(b||P)&&R&&O&&r?.(R),a().onConnectEnd?.(e),l&&c?.(e),Io(k),v(),cancelAnimationFrame(w),M=!1,O=!1,R=null,P=null,u.removeEventListener("mousemove",$),u.removeEventListener("mouseup",D),u.removeEventListener("touchmove",$),u.removeEventListener("touchend",D)}i({connectionPosition:N,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:_,connectionStartHandle:{nodeId:n,handleId:t,type:_},connectionEndHandle:null}),m?.(e,{nodeId:n,handleId:t,handleType:_}),u.addEventListener("mousemove",$),u.addEventListener("mouseup",D),u.addEventListener("touchmove",$),u.addEventListener("touchend",D)}const Bo=()=>!0,Fo=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),jo=e.forwardRef(({type:t="source",position:n=no.Top,isValidConnection:r,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:c,children:u,className:d,onMouseDown:f,onTouchStart:p,...h},m)=>{const g=l||null,y="target"===t,v=Cr(),b=e.useContext(vo),{connectOnClick:w,noPanClassName:x}=_r(Fo,M),{connecting:E,clickConnecting:S}=_r(((e,t,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:a,connectionClickStartHandle:i}=r;return{connecting:o?.nodeId===e&&o?.handleId===t&&o?.type===n||a?.nodeId===e&&a?.handleId===t&&a?.type===n,clickConnecting:i?.nodeId===e&&i?.handleId===t&&i?.type===n}})(b,g,t),M);b||v.getState().onError?.("010",wr());const _=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=v.getState(),o={...t,...e};if(r){const{edges:e,setEdges:t}=v.getState();t(Eo(o,e))}n?.(o),c?.(o)},C=e=>{if(!b)return;const t=Wr(e);a&&(t&&0===e.button||!t)&&Lo({event:e,handleId:g,nodeId:b,onConnect:_,isTarget:y,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||Bo}),t?f?.(e):p?.(e)};return e.createElement("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":n,"data-id":`${b}-${g}-${t}`,className:s(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",x,d,{source:!y,target:y,connectable:o,connectablestart:a,connectableend:i,connecting:S,connectionindicator:o&&(a&&!E||i&&E)}]),onMouseDown:C,onTouchStart:C,onClick:w?e=>{const{onClickConnectStart:n,onClickConnectEnd:o,connectionClickStartHandle:i,connectionMode:s,isValidConnection:l}=v.getState();if(!b||!i&&!a)return;if(!i)return n?.(e,{nodeId:b,handleId:g,handleType:t}),void v.setState({connectionClickStartHandle:{nodeId:b,type:t,handleId:g}});const c=Dr(e.target),u=r||l||Bo,{connection:d,isValid:f}=$o({nodeId:b,id:g,type:t},s,i.nodeId,i.handleId||null,i.type,u,c);f&&_(d),o?.(e),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...h},u)});jo.displayName="Handle";var Ho=e.memo(jo);const Vo=({data:t,isConnectable:n,targetPosition:r=no.Top,sourcePosition:o=no.Bottom})=>e.createElement(e.Fragment,null,e.createElement(Ho,{type:"target",position:r,isConnectable:n}),t?.label,e.createElement(Ho,{type:"source",position:o,isConnectable:n}));Vo.displayName="DefaultNode";var Wo=e.memo(Vo);const Yo=({data:t,isConnectable:n,sourcePosition:r=no.Bottom})=>e.createElement(e.Fragment,null,t?.label,e.createElement(Ho,{type:"source",position:r,isConnectable:n}));Yo.displayName="InputNode";var Xo=e.memo(Yo);const Ko=({data:t,isConnectable:n,targetPosition:r=no.Top})=>e.createElement(e.Fragment,null,e.createElement(Ho,{type:"target",position:r,isConnectable:n}),t?.label);Ko.displayName="OutputNode";var Uo=e.memo(Ko);const qo=()=>null;qo.displayName="GroupNode";const Zo=e=>({selectedNodes:e.getNodes().filter(e=>e.selected),selectedEdges:e.edges.filter(e=>e.selected).map(e=>({...e}))}),Go=e=>e.id;function Jo(e,t){return M(e.selectedNodes.map(Go),t.selectedNodes.map(Go))&&M(e.selectedEdges.map(Go),t.selectedEdges.map(Go))}const Qo=e.memo(({onSelectionChange:t})=>{const n=Cr(),{selectedNodes:r,selectedEdges:o}=_r(Zo,Jo);return e.useEffect(()=>{const e={nodes:r,edges:o};t?.(e),n.getState().onSelectionChange.forEach(t=>t(e))},[r,o,t]),null});Qo.displayName="SelectionListener";const ea=e=>!!e.onSelectionChange;function ta({onSelectionChange:t}){const n=_r(ea);return t||n?e.createElement(Qo,{onSelectionChange:t}):null}const na=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ra(t,n){e.useEffect(()=>{void 0!==t&&n(t)},[t])}function oa(t,n,r){e.useEffect(()=>{void 0!==n&&r({[t]:n})},[n])}const aa=({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,onConnect:a,onConnectStart:i,onConnectEnd:s,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:u,nodesConnectable:d,nodesFocusable:f,edgesFocusable:p,edgesUpdatable:h,elevateNodesOnSelect:m,minZoom:g,maxZoom:y,nodeExtent:v,onNodesChange:b,onEdgesChange:w,elementsSelectable:x,connectionMode:E,snapGrid:S,snapToGrid:_,translateExtent:C,connectOnClick:k,defaultEdgeOptions:N,fitView:R,fitViewOptions:O,onNodesDelete:P,onEdgesDelete:A,onNodeDrag:T,onNodeDragStart:$,onNodeDragStop:D,onSelectionDrag:I,onSelectionDragStart:z,onSelectionDragStop:L,noPanClassName:B,nodeOrigin:F,rfId:j,autoPanOnConnect:H,autoPanOnNodeDrag:V,onError:W,connectionRadius:Y,isValidConnection:X,nodeDragThreshold:K})=>{const{setNodes:U,setEdges:q,setDefaultNodesAndEdges:Z,setMinZoom:G,setMaxZoom:J,setTranslateExtent:Q,setNodeExtent:ee,reset:te}=_r(na,M),ne=Cr();return e.useEffect(()=>{const e=o?.map(e=>({...e,...N}));return Z(r,e),()=>{te()}},[]),oa("defaultEdgeOptions",N,ne.setState),oa("connectionMode",E,ne.setState),oa("onConnect",a,ne.setState),oa("onConnectStart",i,ne.setState),oa("onConnectEnd",s,ne.setState),oa("onClickConnectStart",l,ne.setState),oa("onClickConnectEnd",c,ne.setState),oa("nodesDraggable",u,ne.setState),oa("nodesConnectable",d,ne.setState),oa("nodesFocusable",f,ne.setState),oa("edgesFocusable",p,ne.setState),oa("edgesUpdatable",h,ne.setState),oa("elementsSelectable",x,ne.setState),oa("elevateNodesOnSelect",m,ne.setState),oa("snapToGrid",_,ne.setState),oa("snapGrid",S,ne.setState),oa("onNodesChange",b,ne.setState),oa("onEdgesChange",w,ne.setState),oa("connectOnClick",k,ne.setState),oa("fitViewOnInit",R,ne.setState),oa("fitViewOnInitOptions",O,ne.setState),oa("onNodesDelete",P,ne.setState),oa("onEdgesDelete",A,ne.setState),oa("onNodeDrag",T,ne.setState),oa("onNodeDragStart",$,ne.setState),oa("onNodeDragStop",D,ne.setState),oa("onSelectionDrag",I,ne.setState),oa("onSelectionDragStart",z,ne.setState),oa("onSelectionDragStop",L,ne.setState),oa("noPanClassName",B,ne.setState),oa("nodeOrigin",F,ne.setState),oa("rfId",j,ne.setState),oa("autoPanOnConnect",H,ne.setState),oa("autoPanOnNodeDrag",V,ne.setState),oa("onError",W,ne.setState),oa("connectionRadius",Y,ne.setState),oa("isValidConnection",X,ne.setState),oa("nodeDragThreshold",K,ne.setState),ra(t,U),ra(n,q),ra(g,G),ra(y,J),ra(C,Q),ra(v,ee),null},ia={display:"none"},sa={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},la="react-flow__node-desc",ca="react-flow__edge-desc",ua=e=>e.ariaLiveMessage;function da({rfId:t}){const n=_r(ua);return e.createElement("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:sa},n)}function fa({rfId:t,disableKeyboardA11y:n}){return e.createElement(e.Fragment,null,e.createElement("div",{id:`${la}-${t}`,style:ia},"Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),e.createElement("div",{id:`${ca}-${t}`,style:ia},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&e.createElement(da,{rfId:t}))}var pa=(t=null,n={actInsideInputWithModifier:!0})=>{const[r,o]=e.useState(!1),a=e.useRef(!1),i=e.useRef(new Set([])),[s,l]=e.useMemo(()=>{if(null!==t){const e=(Array.isArray(t)?t:[t]).filter(e=>"string"==typeof e).map(e=>e.split("+")),n=e.reduce((e,t)=>e.concat(...t),[]);return[e,n]}return[[],[]]},[t]);return e.useEffect(()=>{const e="undefined"!=typeof document?document:null,r=n?.target||e;if(null!==t){const e=e=>{a.current=e.ctrlKey||e.metaKey||e.shiftKey;if((!a.current||a.current&&!n.actInsideInputWithModifier)&&Vr(e))return!1;const t=ma(e.code,l);i.current.add(e[t]),ha(s,i.current,!1)&&(e.preventDefault(),o(!0))},t=e=>{if((!a.current||a.current&&!n.actInsideInputWithModifier)&&Vr(e))return!1;const t=ma(e.code,l);ha(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),a.current=!1},c=()=>{i.current.clear(),o(!1)};return r?.addEventListener("keydown",e),r?.addEventListener("keyup",t),window.addEventListener("blur",c),()=>{r?.removeEventListener("keydown",e),r?.removeEventListener("keyup",t),window.removeEventListener("blur",c)}}},[t,o]),r};function ha(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function ma(e,t){return t.includes(e)?"code":"key"}function ga(e,t,n,r){const o=e.parentNode||e.parentId;if(!o)return n;const a=t.get(o),i=Co(a,r);return ga(a,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(a[Fr]?.z??0)>(n.z??0)?a[Fr]?.z??0:n.z??0},r)}function ya(e,t,n){e.forEach(r=>{const o=r.parentNode||r.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||n?.[r.id]){const{x:o,y:a,z:i}=ga(r,e,{...r.position,z:r[Fr]?.z??0},t);r.positionAbsolute={x:o,y:a},r[Fr].z=i,n?.[r.id]&&(r[Fr].isParent=!0)}})}function va(e,t,n,r){const o=new Map,a={},i=r?1e3:0;return e.forEach(e=>{const n=(Br(e.zIndex)?e.zIndex:0)+(e.selected?i:0),r=t.get(e.id),s={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},l=e.parentNode||e.parentId;l&&(a[l]=!0);const c=r?.type&&r?.type!==e.type;Object.defineProperty(s,Fr,{enumerable:!1,value:{handleBounds:c?void 0:r?.[Fr]?.handleBounds,z:n}}),o.set(e.id,s)}),ya(o,n,a),o}function ba(e,t={}){const{getNodes:n,width:r,height:o,minZoom:a,maxZoom:i,d3Zoom:s,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:u,nodeOrigin:d}=e(),f=t.initial&&!c&&u;if(s&&l&&(f||!t.initial)){const e=n().filter(e=>{const n=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return t.nodes?.length?n&&t.nodes.some(t=>t.id===e.id):n}),c=e.every(e=>e.width&&e.height);if(e.length>0&&c){const n=ko(e,d),{x:c,y:u,zoom:f}=Ro(n,r,o,t.minZoom??a,t.maxZoom??i,t.padding??.1),p=nr.translate(c,u).scale(f);return"number"==typeof t.duration&&t.duration>0?s.transform(Oo(l,t.duration),p):s.transform(l,p),!0}}return!1}function wa(e,t){return e.forEach(e=>{const n=t.get(e.id);n&&t.set(n.id,{...n,[Fr]:n[Fr],selected:e.selected})}),new Map(t)}function xa(e,t){return t.map(t=>{const n=e.find(e=>e.id===t.id);return n&&(t.selected=n.selected),t})}function Ea({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:o,edges:a,onNodesChange:i,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:c}=n();e?.length&&(l&&r({nodeInternals:wa(e,o)}),i?.(e)),t?.length&&(c&&r({edges:xa(t,a)}),s?.(t))}const Sa=()=>{},_a={zoomIn:Sa,zoomOut:Sa,zoomTo:Sa,getZoom:()=>1,setViewport:Sa,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Sa,fitBounds:Sa,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},Ca=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection});function ka(){const t=(()=>{const t=Cr(),{d3Zoom:n,d3Selection:r}=_r(Ca,M),o=e.useMemo(()=>r&&n?{zoomIn:e=>n.scaleBy(Oo(r,e?.duration),1.2),zoomOut:e=>n.scaleBy(Oo(r,e?.duration),1/1.2),zoomTo:(e,t)=>n.scaleTo(Oo(r,t?.duration),e),getZoom:()=>t.getState().transform[2],setViewport:(e,o)=>{const[a,i,s]=t.getState().transform,l=nr.translate(e.x??a,e.y??i).scale(e.zoom??s);n.transform(Oo(r,o?.duration),l)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},fitView:e=>ba(t.getState,e),setCenter:(e,o,a)=>{const{width:i,height:s,maxZoom:l}=t.getState(),c=void 0!==a?.zoom?a.zoom:l,u=i/2-e*c,d=s/2-o*c,f=nr.translate(u,d).scale(c);n.transform(Oo(r,a?.duration),f)},fitBounds:(e,o)=>{const{width:a,height:i,minZoom:s,maxZoom:l}=t.getState(),{x:c,y:u,zoom:d}=Ro(e,a,i,s,l,o?.padding??.1),f=nr.translate(c,u).scale(d);n.transform(Oo(r,o?.duration),f)},project:e=>{const{transform:n,snapToGrid:r,snapGrid:o}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),So(e,n,r,o)},screenToFlowPosition:e=>{const{transform:n,snapToGrid:r,snapGrid:o,domNode:a}=t.getState();if(!a)return e;const{x:i,y:s}=a.getBoundingClientRect(),l={x:e.x-i,y:e.y-s};return So(l,n,r,o)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:o,y:a}=r.getBoundingClientRect(),i=_o(e,n);return{x:i.x+o,y:i.y+a}},viewportInitialized:!0}:_a,[n,r]);return o})(),n=Cr(),r=e.useCallback(()=>n.getState().getNodes().map(e=>({...e})),[]),o=e.useCallback(e=>n.getState().nodeInternals.get(e),[]),a=e.useCallback(()=>{const{edges:e=[]}=n.getState();return e.map(e=>({...e}))},[]),i=e.useCallback(e=>{const{edges:t=[]}=n.getState();return t.find(t=>t.id===e)},[]),s=e.useCallback(e=>{const{getNodes:t,setNodes:r,hasDefaultNodes:o,onNodesChange:a}=n.getState(),i=t(),s="function"==typeof e?e(i):e;if(o)r(s);else if(a){const e=0===s.length?i.map(e=>({type:"remove",id:e.id})):s.map(e=>({item:e,type:"reset"}));a(e)}},[]),l=e.useCallback(e=>{const{edges:t=[],setEdges:r,hasDefaultEdges:o,onEdgesChange:a}=n.getState(),i="function"==typeof e?e(t):e;if(o)r(i);else if(a){a(0===i.length?t.map(e=>({type:"remove",id:e.id})):i.map(e=>({item:e,type:"reset"})))}},[]),c=e.useCallback(e=>{const t=Array.isArray(e)?e:[e],{getNodes:r,setNodes:o,hasDefaultNodes:a,onNodesChange:i}=n.getState();if(a){o([...r(),...t])}else if(i){const e=t.map(e=>({item:e,type:"add"}));i(e)}},[]),u=e.useCallback(e=>{const t=Array.isArray(e)?e:[e],{edges:r=[],setEdges:o,hasDefaultEdges:a,onEdgesChange:i}=n.getState();if(a)o([...r,...t]);else if(i){i(t.map(e=>({item:e,type:"add"})))}},[]),d=e.useCallback(()=>{const{getNodes:e,edges:t=[],transform:r}=n.getState(),[o,a,i]=r;return{nodes:e().map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:o,y:a,zoom:i}}},[]),f=e.useCallback(({nodes:e,edges:t})=>{const{nodeInternals:r,getNodes:o,edges:a,hasDefaultNodes:i,hasDefaultEdges:s,onNodesDelete:l,onEdgesDelete:c,onNodesChange:u,onEdgesChange:d}=n.getState(),f=(e||[]).map(e=>e.id),p=(t||[]).map(e=>e.id),h=o().reduce((e,t)=>{const n=t.parentNode||t.parentId,r=!f.includes(t.id)&&n&&e.find(e=>e.id===n);return("boolean"!=typeof t.deletable||t.deletable)&&(f.includes(t.id)||r)&&e.push(t),e},[]),m=a.filter(e=>"boolean"!=typeof e.deletable||e.deletable),g=m.filter(e=>p.includes(e.id));if(h||g){const e=Mo(h,m),t=[...g,...e],o=t.reduce((e,t)=>(e.includes(t.id)||e.push(t.id),e),[]);if((s||i)&&(s&&n.setState({edges:a.filter(e=>!o.includes(e.id))}),i&&(h.forEach(e=>{r.delete(e.id)}),n.setState({nodeInternals:new Map(r)}))),o.length>0&&(c?.(t),d&&d(o.map(e=>({id:e,type:"remove"})))),h.length>0&&(l?.(h),u)){u(h.map(e=>({id:e.id,type:"remove"})))}}},[]),p=e.useCallback(e=>{const t=Br((r=e).width)&&Br(r.height)&&Br(r.x)&&Br(r.y);var r;const o=t?null:n.getState().nodeInternals.get(e.id);if(!t&&!o)return[null,null,t];return[t?e:zr(o),o,t]},[]),h=e.useCallback((e,t=!0,r)=>{const[o,a,i]=p(e);return o?(r||n.getState().getNodes()).filter(e=>{if(!(i||e.id!==a.id&&e.positionAbsolute))return!1;const n=zr(e),r=Lr(n,o);return t&&r>0||r>=o.width*o.height}):[]},[]),m=e.useCallback((e,t,n=!0)=>{const[r]=p(e);if(!r)return!1;const o=Lr(r,t);return n&&o>0||o>=r.width*r.height},[]);return e.useMemo(()=>({...t,getNodes:r,getNode:o,getEdges:a,getEdge:i,setNodes:s,setEdges:l,addNodes:c,addEdges:u,toObject:d,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:m}),[t,r,o,a,i,s,l,c,u,d,f,h,m])}const Na={actInsideInputWithModifier:!1};const Ma={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ra=e=>({x:e.x,y:e.y,zoom:e.k}),Oa=(e,t)=>e.target.closest(`.${t}`),Pa=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Aa=e=>{const t=e.ctrlKey&&Xr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t},Ta=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),$a=({onMove:t,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=Jr.Free,zoomOnDoubleClick:u=!0,elementsSelectable:d,panOnDrag:f=!0,defaultViewport:p,translateExtent:h,minZoom:m,maxZoom:g,zoomActivationKeyCode:y,preventScrolling:v=!0,children:b,noWheelClassName:w,noPanClassName:x})=>{const E=e.useRef(),S=Cr(),_=e.useRef(!1),C=e.useRef(!1),k=e.useRef(null),N=e.useRef({x:0,y:0,zoom:0}),{d3Zoom:R,d3Selection:P,d3ZoomHandler:A,userSelectionActive:T}=_r(Ta,M),$=pa(y),D=e.useRef(0),I=e.useRef(!1),z=e.useRef();return function(t){const n=Cr();e.useEffect(()=>{let e;const r=()=>{if(!t.current)return;const e=Or(t.current);0!==e.height&&0!==e.width||n.getState().onError?.("004",mr()),n.setState({width:e.width||500,height:e.height||500})};return r(),window.addEventListener("resize",r),t.current&&(e=new ResizeObserver(()=>r()),e.observe(t.current)),()=>{window.removeEventListener("resize",r),e&&t.current&&e.unobserve(t.current)}},[])}(k),e.useEffect(()=>{if(k.current){const e=k.current.getBoundingClientRect(),t=function(){var e,t,n,r=ar,o=ir,a=ur,i=lr,s=cr,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=on,f=O("start","zoom","end"),p=0,h=10;function m(e){e.property("__zoom",sr).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",_).filter(s).on("touchstart.zoom",C).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new tr(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,o=t[1]-n[1]*e.k;return r===e.x&&o===e.y?e:new tr(e.k,r,o)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,n,r){e.on("start.zoom",function(){w(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,a=arguments,i=w(e,a).event(r),s=o.apply(e,a),l=null==n?v(s):"function"==typeof n?n.apply(e,a):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,f="function"==typeof t?t.apply(e,a):t,p=d(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=p(e),n=c/t[2];e=new tr(n,l[0]-t[0]*n,l[1]-t[1]*n)}i.zoom(null,e)}})}function w(e,t,n){return!n&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,t),this.taps=0}function E(e,...t){if(r.apply(this,arguments)){var n=w(this,t).event(e),o=this.__zoom,s=Math.max(l[0],Math.min(l[1],o.k*Math.pow(2,i.apply(this,arguments)))),u=Ke(e);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=o.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(o.k===s)return;n.mouse=[u,o.invert(u)],Mn(this),n.start()}or(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(y(g(o,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function S(e,...t){if(!n&&r.apply(this,arguments)){var o=e.currentTarget,i=w(this,t,!0).event(e),s=Xe(e.view).on("mousemove.zoom",function(e){if(or(e),!i.moved){var t=e.clientX-u,n=e.clientY-d;i.moved=t*t+n*n>p}i.event(e).zoom("mouse",a(y(i.that.__zoom,i.mouse[0]=Ke(e,o),i.mouse[1]),i.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),Qe(e.view,i.moved),or(e),i.event(e).end()},!0),l=Ke(e,o),u=e.clientX,d=e.clientY;Je(e.view),rr(e),i.mouse=[l,this.__zoom.invert(l)],Mn(this),i.start()}}function _(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,i=Ke(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(i),l=n.k*(e.shiftKey?.5:2),d=a(y(g(n,l),i,s),o.apply(this,t),c);or(e),u>0?Xe(this).transition().duration(u).call(b,d,i,e):Xe(this).call(m.transform,d,i,e)}}function C(n,...o){if(r.apply(this,arguments)){var a,i,s,l,c=n.touches,u=c.length,d=w(this,o,n.changedTouches.length===u).event(n);for(rr(n),i=0;i<u;++i)l=[l=Ke(s=c[i],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,a=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),Mn(this),d.start())}}function k(e,...t){if(this.__zooming){var n,r,o,i,s=w(this,t).event(e),l=e.changedTouches,u=l.length;for(or(e),n=0;n<u;++n)o=Ke(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=o:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=o);if(r=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],p=s.touch1[0],h=s.touch1[1],m=(m=p[0]-d[0])*m+(m=p[1]-d[1])*m,v=(v=h[0]-f[0])*v+(v=h[1]-f[1])*v;r=g(r,Math.sqrt(m/v)),o=[(d[0]+p[0])/2,(d[1]+p[1])/2],i=[(f[0]+h[0])/2,(f[1]+h[1])/2]}else{if(!s.touch0)return;o=s.touch0[0],i=s.touch0[1]}s.zoom("touch",a(y(r,o,i),s.extent,c))}}function N(e,...r){if(this.__zooming){var o,a,i=w(this,r).event(e),s=e.changedTouches,l=s.length;for(rr(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),o=0;o<l;++o)a=s[o],i.touch0&&i.touch0[2]===a.identifier?delete i.touch0:i.touch1&&i.touch1[2]===a.identifier&&delete i.touch1;if(i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0)i.touch0[1]=this.__zoom.invert(i.touch0[0]);else if(i.end(),2===i.taps&&(a=Ke(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<h)){var c=Xe(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,r){var o=e.selection?e.selection():e;o.property("__zoom",sr),e!==o?b(e,t,n,r):o.interrupt().each(function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,r){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,r)},m.scaleTo=function(e,t,n,r){m.transform(e,function(){var e=o.apply(this,arguments),r=this.__zoom,i=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(i),l="function"==typeof t?t.apply(this,arguments):t;return a(y(g(r,l),i,s),e,c)},n,r)},m.translateBy=function(e,t,n,r){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),c)},null,r)},m.translateTo=function(e,t,n,r,i){m.transform(e,function(){var e=o.apply(this,arguments),i=this.__zoom,s=null==r?v(e):"function"==typeof r?r.apply(this,arguments):r;return a(nr.translate(s[0],s[1]).scale(i.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},r,i)},x.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Xe(this.that).datum();f.call(e,this.that,new er(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(i="function"==typeof e?e:Qn(+e),m):i},m.filter=function(e){return arguments.length?(r="function"==typeof e?e:Qn(!!e),m):r},m.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Qn(!!e),m):s},m.extent=function(e){return arguments.length?(o="function"==typeof e?e:Qn([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):o},m.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],m):[l[0],l[1]]},m.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],m):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(u=+e,m):u},m.interpolate=function(e){return arguments.length?(d=e,m):d},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,m):Math.sqrt(p)},m.tapDistance=function(e){return arguments.length?(h=+e,m):h},m}().scaleExtent([m,g]).translateExtent(h),n=Xe(k.current).call(t),r=nr.translate(p.x,p.y).scale(Pr(p.zoom,m,g)),o=[[0,0],[e.width,e.height]],a=t.constrain()(r,o,h);t.transform(n,a),t.wheelDelta(Aa),S.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on("wheel.zoom"),transform:[a.x,a.y,a.k],domNode:k.current.closest(".react-flow")})}},[]),e.useEffect(()=>{P&&R&&(!s||$||T?void 0!==A&&P.on("wheel.zoom",function(e,t){if(!v&&"wheel"===e.type&&!e.ctrlKey||Oa(e,w))return null;e.preventDefault(),A.call(this,e,t)},{passive:!1}):P.on("wheel.zoom",e=>{if(Oa(e,w))return!1;e.preventDefault(),e.stopImmediatePropagation();const o=P.property("__zoom").k||1;if(e.ctrlKey&&i){const t=Ke(e),n=Aa(e),r=o*Math.pow(2,n);return void R.scaleTo(P,r,t,e)}const a=1===e.deltaMode?20:1;let s=c===Jr.Vertical?0:e.deltaX*a,u=c===Jr.Horizontal?0:e.deltaY*a;!Xr()&&e.shiftKey&&c!==Jr.Vertical&&(s=e.deltaY*a,u=0),R.translateBy(P,-s/o*l,-u/o*l,{internal:!0});const d=Ra(P.property("__zoom")),{onViewportChangeStart:f,onViewportChange:p,onViewportChangeEnd:h}=S.getState();clearTimeout(z.current),I.current||(I.current=!0,n?.(e,d),f?.(d)),I.current&&(t?.(e,d),p?.(d),z.current=setTimeout(()=>{r?.(e,d),h?.(d),I.current=!1},150))},{passive:!1}))},[T,s,c,P,R,A,$,i,v,w,n,t,r]),e.useEffect(()=>{R&&R.on("start",e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;D.current=e.sourceEvent?.button;const{onViewportChangeStart:t}=S.getState(),r=Ra(e.transform);_.current=!0,N.current=r,"mousedown"===e.sourceEvent?.type&&S.setState({paneDragging:!0}),t?.(r),n?.(e.sourceEvent,r)})},[R,n]),e.useEffect(()=>{R&&(T&&!_.current?R.on("zoom",null):T||R.on("zoom",e=>{const{onViewportChange:n}=S.getState();if(S.setState({transform:[e.transform.x,e.transform.y,e.transform.k]}),C.current=!(!o||!Pa(f,D.current??0)),(t||n)&&!e.sourceEvent?.internal){const r=Ra(e.transform);n?.(r),t?.(e.sourceEvent,r)}}))},[T,R,t,f,o]),e.useEffect(()=>{R&&R.on("end",e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;const{onViewportChangeEnd:t}=S.getState();if(_.current=!1,S.setState({paneDragging:!1}),o&&Pa(f,D.current??0)&&!C.current&&o(e.sourceEvent),C.current=!1,(r||t)&&(n=N.current,a=e.transform,n.x!==a.x||n.y!==a.y||n.zoom!==a.k)){const n=Ra(e.transform);N.current=n,clearTimeout(E.current),E.current=setTimeout(()=>{t?.(n),r?.(e.sourceEvent,n)},s?150:0)}var n,a})},[R,s,f,r,o]),e.useEffect(()=>{R&&R.filter(e=>{const t=$||a,n=i&&e.ctrlKey;if((!0===f||Array.isArray(f)&&f.includes(1))&&1===e.button&&"mousedown"===e.type&&(Oa(e,"react-flow__node")||Oa(e,"react-flow__edge")))return!0;if(!(f||t||s||u||i))return!1;if(T)return!1;if(!u&&"dblclick"===e.type)return!1;if(Oa(e,w)&&"wheel"===e.type)return!1;if(Oa(e,x)&&("wheel"!==e.type||s&&"wheel"===e.type&&!$))return!1;if(!i&&e.ctrlKey&&"wheel"===e.type)return!1;if(!t&&!s&&!n&&"wheel"===e.type)return!1;if(!f&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(f)&&!f.includes(e.button)&&"mousedown"===e.type)return!1;const r=Array.isArray(f)&&f.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&r})},[T,R,a,i,s,u,f,d,$]),e.createElement("div",{className:"react-flow__renderer",ref:k,style:Ma},b)},Da=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ia(){const{userSelectionActive:t,userSelectionRect:n}=_r(Da,M);return t&&n?e.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function za(e,t){const n=t.parentNode||t.parentId,r=e.find(e=>e.id===n);if(r){const e=t.position.x+t.width-r.width,n=t.position.y+t.height-r.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(r.style={...r.style}||{},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,e>0&&(r.style.width+=e),n>0&&(r.style.height+=n),t.position.x<0){const e=Math.abs(t.position.x);r.position.x=r.position.x-e,r.style.width+=e,t.position.x=0}if(t.position.y<0){const e=Math.abs(t.position.y);r.position.y=r.position.y-e,r.style.height+=e,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function La(e,t){if(e.some(e=>"reset"===e.type))return e.filter(e=>"reset"===e.type).map(e=>e.item);const n=e.filter(e=>"add"===e.type).map(e=>e.item);return t.reduce((t,n)=>{const r=e.filter(e=>e.id===n.id);if(0===r.length)return t.push(n),t;const o={...n};for(const e of r)if(e)switch(e.type){case"select":o.selected=e.selected;break;case"position":void 0!==e.position&&(o.position=e.position),void 0!==e.positionAbsolute&&(o.positionAbsolute=e.positionAbsolute),void 0!==e.dragging&&(o.dragging=e.dragging),o.expandParent&&za(t,o);break;case"dimensions":void 0!==e.dimensions&&(o.width=e.dimensions.width,o.height=e.dimensions.height),void 0!==e.updateStyle&&(o.style={...o.style||{},...e.dimensions}),"boolean"==typeof e.resizing&&(o.resizing=e.resizing),o.expandParent&&za(t,o);break;case"remove":return t}return t.push(o),t},n)}function Ba(e,t){return La(e,t)}const Fa=(e,t)=>({id:e,type:"select",selected:t});function ja(e,t){return e.reduce((e,n)=>{const r=t.includes(n.id);return!n.selected&&r?(n.selected=!0,e.push(Fa(n.id,!0))):n.selected&&!r&&(n.selected=!1,e.push(Fa(n.id,!1))),e},[])}const Ha=(e,t)=>n=>{n.target===t.current&&e?.(n)},Va=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Wa=e.memo(({isSelecting:t,selectionMode:n=Qr.Full,panOnDrag:r,onSelectionStart:o,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:u,onPaneMouseMove:d,onPaneMouseLeave:f,children:p})=>{const h=e.useRef(null),m=Cr(),g=e.useRef(0),y=e.useRef(0),v=e.useRef(),{userSelectionActive:b,elementsSelectable:w,dragging:x}=_r(Va,M),E=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),g.current=0,y.current=0},S=e=>{i?.(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},_=c?e=>c(e):void 0,C=w&&(t||b);return e.createElement("div",{className:s(["react-flow__pane",{dragging:x,selection:t}]),onClick:C?void 0:Ha(S,h),onContextMenu:Ha(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():l?.(e)},h),onWheel:Ha(_,h),onMouseEnter:C?void 0:u,onMouseDown:C?e=>{const{resetSelectedElements:n,domNode:r}=m.getState();if(v.current=r?.getBoundingClientRect(),!w||!t||0!==e.button||e.target!==h.current||!v.current)return;const{x:a,y:i}=Yr(e,v.current);n(),m.setState({userSelectionRect:{width:0,height:0,startX:a,startY:i,x:a,y:i}}),o?.(e)}:void 0,onMouseMove:C?e=>{const{userSelectionRect:r,nodeInternals:o,edges:a,transform:i,onNodesChange:s,onEdgesChange:l,nodeOrigin:c,getNodes:u}=m.getState();if(!t||!v.current||!r)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const d=Yr(e,v.current),f=r.startX??0,p=r.startY??0,h={...r,x:d.x<f?d.x:f,y:d.y<p?d.y:p,width:Math.abs(d.x-f),height:Math.abs(d.y-p)},b=u(),w=No(o,h,i,n===Qr.Partial,!0,c),x=Mo(w,a).map(e=>e.id),E=w.map(e=>e.id);if(g.current!==E.length){g.current=E.length;const e=ja(b,E);e.length&&s?.(e)}if(y.current!==x.length){y.current=x.length;const e=ja(a,x);e.length&&l?.(e)}m.setState({userSelectionRect:h})}:d,onMouseUp:C?e=>{if(0!==e.button)return;const{userSelectionRect:t}=m.getState();!b&&t&&e.target===h.current&&S?.(e),m.setState({nodesSelectionActive:g.current>0}),E(),a?.(e)}:void 0,onMouseLeave:C?e=>{b&&(m.setState({nodesSelectionActive:g.current>0}),a?.(e)),E()}:f,ref:h,style:Ma},p,e.createElement(Ia,null))});function Ya(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return!!r&&(!!r.selected||Ya(r,t))}function Xa(e,t,n){let r=e;do{if(r?.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Ka(e,t,n,r){return Array.from(e.values()).filter(n=>(n.selected||n.id===r)&&(!n.parentNode||n.parentId||!Ya(n,e))&&(n.draggable||t&&void 0===n.draggable)).map(e=>({id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-(e.positionAbsolute?.x??0),y:n.y-(e.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}))}function Ua(e,t,n,r,o=[0,0],a){const i=function(e,t){return t&&"parent"!==t?[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]:t}(e,e.extent||r);let s=i;const l=e.parentNode||e.parentId;if("parent"!==e.extent||e.expandParent){if(e.extent&&l&&"parent"!==e.extent){const t=n.get(l),{x:r,y:a}=Co(t,o).positionAbsolute;s=[[e.extent[0][0]+r,e.extent[0][1]+a],[e.extent[1][0]+r,e.extent[1][1]+a]]}}else if(l&&e.width&&e.height){const t=n.get(l),{x:r,y:a}=Co(t,o).positionAbsolute;s=t&&Br(r)&&Br(a)&&Br(t.width)&&Br(t.height)?[[r+e.width*o[0],a+e.height*o[1]],[r+t.width-e.width+e.width*o[0],a+t.height-e.height+e.height*o[1]]]:s}else a?.("005",gr()),s=i;let c={x:0,y:0};if(l){const e=n.get(l);c=Co(e,o).positionAbsolute}const u=s&&"parent"!==s?Ar(t,s):t;return{position:{x:u.x-c.x,y:u.y-c.y},positionAbsolute:u}}function qa({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute}));return[e?r.find(t=>t.id===e):r[0],r]}Wa.displayName="Pane";const Za=(e,t,n,r)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const a=Array.from(o),i=t.getBoundingClientRect(),s=i.width*r[0],l=i.height*r[1];return a.map(e=>{const t=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-i.left-s)/n,y:(t.top-i.top-l)/n,...Or(e)}})};function Ga(e,t,n){return void 0===n?n:r=>{const o=t().nodeInternals.get(e);o&&n(r,{...o})}}function Ja({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:a,multiSelectionActive:i,nodeInternals:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(a({nodes:[c],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])):l?.("012",Er(e))}function Qa(e){return(t,n,r)=>e?.(t,r)}function ei({nodeRef:t,disabled:n=!1,noDragClassName:r,handleSelector:o,nodeId:a,isSelectable:i,selectNodesOnDrag:s}){const l=Cr(),[c,u]=e.useState(!1),d=e.useRef([]),f=e.useRef({x:null,y:null}),p=e.useRef(0),h=e.useRef(null),m=e.useRef({x:0,y:0}),g=e.useRef(null),y=e.useRef(!1),v=e.useRef(!1),b=e.useRef(!1),w=function(){const t=Cr(),n=e.useCallback(({sourceEvent:e})=>{const{transform:n,snapGrid:r,snapToGrid:o}=t.getState(),a=e.touches?e.touches[0].clientX:e.clientX,i=e.touches?e.touches[0].clientY:e.clientY,s={x:(a-n[0])/n[2],y:(i-n[1])/n[2]};return{xSnapped:o?r[0]*Math.round(s.x/r[0]):s.x,ySnapped:o?r[1]*Math.round(s.y/r[1]):s.y,...s}},[]);return n}();return e.useEffect(()=>{if(t?.current){const e=Xe(t.current),c=({x:e,y:t})=>{const{nodeInternals:n,onNodeDrag:r,onSelectionDrag:o,updateNodePositions:i,nodeExtent:s,snapGrid:c,snapToGrid:p,nodeOrigin:h,onError:m}=l.getState();f.current={x:e,y:t};let y=!1,v={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&s){const e=ko(d.current,h);v=Ir(e)}if(d.current=d.current.map(r=>{const o={x:e-r.distance.x,y:t-r.distance.y};p&&(o.x=c[0]*Math.round(o.x/c[0]),o.y=c[1]*Math.round(o.y/c[1]));const a=[[s[0][0],s[0][1]],[s[1][0],s[1][1]]];d.current.length>1&&s&&!r.extent&&(a[0][0]=r.positionAbsolute.x-v.x+s[0][0],a[1][0]=r.positionAbsolute.x+(r.width??0)-v.x2+s[1][0],a[0][1]=r.positionAbsolute.y-v.y+s[0][1],a[1][1]=r.positionAbsolute.y+(r.height??0)-v.y2+s[1][1]);const i=Ua(r,o,n,a,h,m);return y=y||r.position.x!==i.position.x||r.position.y!==i.position.y,r.position=i.position,r.positionAbsolute=i.positionAbsolute,r}),!y)return;i(d.current,!0,!0),u(!0);const b=a?r:Qa(o);if(b&&g.current){const[e,t]=qa({nodeId:a,dragItems:d.current,nodeInternals:n});b(g.current,e,t)}},x=()=>{if(!h.current)return;const[e,t]=$r(m.current,h.current);if(0!==e||0!==t){const{transform:n,panBy:r}=l.getState();f.current.x=(f.current.x??0)-e/n[2],f.current.y=(f.current.y??0)-t/n[2],r({x:e,y:t})&&c(f.current)}p.current=requestAnimationFrame(x)},E=e=>{const{nodeInternals:n,multiSelectionActive:r,nodesDraggable:o,unselectNodesAndEdges:c,onNodeDragStart:u,onSelectionDragStart:p}=l.getState();v.current=!0;const h=a?u:Qa(p);s&&i||r||!a||n.get(a)?.selected||c(),a&&i&&s&&Ja({id:a,store:l,nodeRef:t});const m=w(e);if(f.current=m,d.current=Ka(n,o,m,a),h&&d.current){const[t,r]=qa({nodeId:a,dragItems:d.current,nodeInternals:n});h(e.sourceEvent,t,r)}};if(!n){const n=function(){var e,t,n,r,o=nt,a=rt,i=ot,s=at,l={},c=O("start","drag","end"),u=0,d=0;function f(e){e.on("mousedown.drag",p).filter(s).on("touchstart.drag",g).on("touchmove.drag",y,Ue).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(i,s){if(!r&&o.call(this,i,s)){var l=b(this,a.call(this,i,s),i,s,"mouse");l&&(Xe(i.view).on("mousemove.drag",h,qe).on("mouseup.drag",m,qe),Je(i.view),Ze(i),n=!1,e=i.clientX,t=i.clientY,l("start",i))}}function h(r){if(Ge(r),!n){var o=r.clientX-e,a=r.clientY-t;n=o*o+a*a>d}l.mouse("drag",r)}function m(e){Xe(e.view).on("mousemove.drag mouseup.drag",null),Qe(e.view,n),Ge(e),l.mouse("end",e)}function g(e,t){if(o.call(this,e,t)){var n,r,i=e.changedTouches,s=a.call(this,e,t),l=i.length;for(n=0;n<l;++n)(r=b(this,s,e,t,i[n].identifier,i[n]))&&(Ze(e),r("start",e,i[n]))}}function y(e){var t,n,r=e.changedTouches,o=r.length;for(t=0;t<o;++t)(n=l[r[t].identifier])&&(Ge(e),n("drag",e,r[t]))}function v(e){var t,n,o=e.changedTouches,a=o.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<a;++t)(n=l[o[t].identifier])&&(Ze(e),n("end",e,o[t]))}function b(e,t,n,r,o,a){var s,d,p,h=c.copy(),m=Ke(a||n,t);if(null!=(p=i.call(e,new tt("beforestart",{sourceEvent:n,target:f,identifier:o,active:u,x:m[0],y:m[1],dx:0,dy:0,dispatch:h}),r)))return s=p.x-m[0]||0,d=p.y-m[1]||0,function n(a,i,c){var g,y=m;switch(a){case"start":l[o]=n,g=u++;break;case"end":delete l[o],--u;case"drag":m=Ke(c||i,t),g=u}h.call(a,e,new tt(a,{sourceEvent:i,subject:p,target:f,identifier:o,active:g,x:m[0]+s,y:m[1]+d,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:h}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:et(!!e),f):o},f.container=function(e){return arguments.length?(a="function"==typeof e?e:et(e),f):a},f.subject=function(e){return arguments.length?(i="function"==typeof e?e:et(e),f):i},f.touchable=function(e){return arguments.length?(s="function"==typeof e?e:et(!!e),f):s},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",e=>{const{domNode:t,nodeDragThreshold:n}=l.getState();0===n&&E(e),b.current=!1;const r=w(e);f.current=r,h.current=t?.getBoundingClientRect()||null,m.current=Yr(e.sourceEvent,h.current)}).on("drag",e=>{const t=w(e),{autoPanOnNodeDrag:n,nodeDragThreshold:r}=l.getState();if("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1&&(b.current=!0),!b.current){if(!y.current&&v.current&&n&&(y.current=!0,x()),!v.current){const n=t.xSnapped-(f?.current?.x??0),o=t.ySnapped-(f?.current?.y??0);Math.sqrt(n*n+o*o)>r&&E(e)}(f.current.x!==t.xSnapped||f.current.y!==t.ySnapped)&&d.current&&v.current&&(g.current=e.sourceEvent,m.current=Yr(e.sourceEvent,h.current),c(t))}}).on("end",e=>{if(v.current&&!b.current&&(u(!1),y.current=!1,v.current=!1,cancelAnimationFrame(p.current),d.current)){const{updateNodePositions:t,nodeInternals:n,onNodeDragStop:r,onSelectionDragStop:o}=l.getState(),i=a?r:Qa(o);if(t(d.current,!1,!1),i){const[t,r]=qa({nodeId:a,dragItems:d.current,nodeInternals:n});i(e.sourceEvent,t,r)}}}).filter(e=>{const n=e.target;return!e.button&&(!r||!Xa(n,`.${r}`,t))&&(!o||Xa(n,o,t))});return e.call(n),()=>{e.on(".drag",null)}}e.on(".drag",null)}},[t,n,r,o,i,l,a,s,w]),c}function ti(){const t=Cr(),n=e.useCallback(e=>{const{nodeInternals:n,nodeExtent:r,updateNodePositions:o,getNodes:a,snapToGrid:i,snapGrid:s,onError:l,nodesDraggable:c}=t.getState(),u=a().filter(e=>e.selected&&(e.draggable||c&&void 0===e.draggable)),d=i?s[0]:5,f=i?s[1]:5,p=e.isShiftPressed?4:1,h=e.x*d*p,m=e.y*f*p,g=u.map(e=>{if(e.positionAbsolute){const t={x:e.positionAbsolute.x+h,y:e.positionAbsolute.y+m};i&&(t.x=s[0]*Math.round(t.x/s[0]),t.y=s[1]*Math.round(t.y/s[1]));const{positionAbsolute:o,position:a}=Ua(e,t,n,r,void 0,l);e.position=a,e.positionAbsolute=o}return e});o(g,!0,!1)},[]);return n}const ni={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ri=t=>{const n=({id:n,type:r,data:o,xPos:a,yPos:i,xPosOrigin:l,yPosOrigin:c,selected:u,onClick:d,onMouseEnter:f,onMouseMove:p,onMouseLeave:h,onContextMenu:m,onDoubleClick:g,style:y,className:v,isDraggable:b,isSelectable:w,isConnectable:x,isFocusable:E,selectNodesOnDrag:S,sourcePosition:_,targetPosition:C,hidden:k,resizeObserver:N,dragHandle:M,zIndex:R,isParent:O,noDragClassName:P,noPanClassName:A,initialized:T,disableKeyboardA11y:$,ariaLabel:D,rfId:I,hasHandleBounds:z})=>{const L=Cr(),B=e.useRef(null),F=e.useRef(null),j=e.useRef(_),H=e.useRef(C),V=e.useRef(r),W=w||b||d||f||p||h,Y=ti(),X=Ga(n,L.getState,f),K=Ga(n,L.getState,p),U=Ga(n,L.getState,h),q=Ga(n,L.getState,m),Z=Ga(n,L.getState,g);e.useEffect(()=>()=>{F.current&&(N?.unobserve(F.current),F.current=null)},[]),e.useEffect(()=>{if(B.current&&!k){const e=B.current;T&&z&&F.current===e||(F.current&&N?.unobserve(F.current),N?.observe(e),F.current=e)}},[k,T,z]),e.useEffect(()=>{const e=V.current!==r,t=j.current!==_,o=H.current!==C;B.current&&(e||t||o)&&(e&&(V.current=r),t&&(j.current=_),o&&(H.current=C),L.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,_,C]);const G=ei({nodeRef:B,disabled:k||!b,noDragClassName:P,handleSelector:M,nodeId:n,isSelectable:w,selectNodesOnDrag:S});return k?null:e.createElement("div",{className:s(["react-flow__node",`react-flow__node-${r}`,{[A]:b},v,{selected:u,selectable:w,parent:O,dragging:G}]),ref:B,style:{zIndex:R,transform:`translate(${l}px,${c}px)`,pointerEvents:W?"all":"none",visibility:T?"visible":"hidden",...y},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:X,onMouseMove:K,onMouseLeave:U,onContextMenu:q,onClick:e=>{const{nodeDragThreshold:t}=L.getState();if(w&&(!S||!b||t>0)&&Ja({id:n,store:L,nodeRef:B}),d){const t=L.getState().nodeInternals.get(n);t&&d(e,{...t})}},onDoubleClick:Z,onKeyDown:E?e=>{if(!Vr(e)&&!$)if(jr.includes(e.key)&&w){const t="Escape"===e.key;Ja({id:n,store:L,unselect:t,nodeRef:B})}else b&&u&&Object.prototype.hasOwnProperty.call(ni,e.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~i}`}),Y({x:ni[e.key].x,y:ni[e.key].y,isShiftPressed:e.shiftKey}))}:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":$?void 0:`${la}-${I}`,"aria-label":D},e.createElement(bo,{value:n},e.createElement(t,{id:n,data:o,type:r,xPos:a,yPos:i,selected:u,isConnectable:x,sourcePosition:_,targetPosition:C,dragging:G,dragHandle:M,zIndex:R})))};return n.displayName="NodeWrapper",e.memo(n)};const oi=e=>{const t=e.getNodes().filter(e=>e.selected);return{...ko(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};var ai=e.memo(function({onSelectionContextMenu:t,noPanClassName:n,disableKeyboardA11y:r}){const o=Cr(),{width:a,height:i,x:l,y:c,transformString:u,userSelectionActive:d}=_r(oi,M),f=ti(),p=e.useRef(null);if(e.useEffect(()=>{r||p.current?.focus({preventScroll:!0})},[r]),ei({nodeRef:p}),d||!a||!i)return null;const h=t?e=>{const n=o.getState().getNodes().filter(e=>e.selected);t(e,n)}:void 0;return e.createElement("div",{className:s(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u}},e.createElement("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:r?void 0:-1,onKeyDown:r?void 0:e=>{Object.prototype.hasOwnProperty.call(ni,e.key)&&f({x:ni[e.key].x,y:ni[e.key].y,isShiftPressed:e.shiftKey})},style:{width:a,height:i,top:c,left:l}}))});const ii=e=>e.nodesSelectionActive,si=({children:t,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:l,onMove:c,onMoveStart:u,onMoveEnd:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:m,onSelectionEnd:g,multiSelectionKeyCode:y,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:S,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:N,defaultViewport:M,translateExtent:R,minZoom:O,maxZoom:P,preventScrolling:A,onSelectionContextMenu:T,noWheelClassName:$,noPanClassName:D,disableKeyboardA11y:I})=>{const z=_r(ii),L=pa(f),B=pa(v),F=B||N,j=B||S,H=L||p&&!0!==F;return(({deleteKeyCode:t,multiSelectionKeyCode:n})=>{const r=Cr(),{deleteElements:o}=ka(),a=pa(t,Na),i=pa(n);e.useEffect(()=>{if(a){const{edges:e,getNodes:t}=r.getState(),n=t().filter(e=>e.selected),a=e.filter(e=>e.selected);o({nodes:n,edges:a}),r.setState({nodesSelectionActive:!1})}},[a]),e.useEffect(()=>{r.setState({multiSelectionActive:i})},[i])})({deleteKeyCode:l,multiSelectionKeyCode:y}),e.createElement($a,{onMove:c,onMoveStart:u,onMoveEnd:d,onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:j,panOnScrollSpeed:_,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:!L&&F,defaultViewport:M,translateExtent:R,minZoom:O,maxZoom:P,zoomActivationKeyCode:b,preventScrolling:A,noWheelClassName:$,noPanClassName:D},e.createElement(Wa,{onSelectionStart:m,onSelectionEnd:g,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:F,isSelecting:!!H,selectionMode:h},t,z&&e.createElement(ai,{onSelectionContextMenu:T,noPanClassName:D,disableKeyboardA11y:I})))};si.displayName="FlowRenderer";var li=e.memo(si);function ci(e){return{...{input:ri(e.input||Xo),default:ri(e.default||Wo),output:ri(e.output||Uo),group:ri(e.group||qo)},...Object.keys(e).filter(e=>!["input","default","output","group"].includes(e)).reduce((t,n)=>(t[n]=ri(e[n]||Wo),t),{})}}const ui=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),di=t=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:i,onError:s}=_r(ui,M),l=(c=t.onlyRenderVisibleElements,_r(e.useCallback(e=>c?No(e.nodeInternals,{x:0,y:0,width:e.width,height:e.height},e.transform,!0):e.getNodes(),[c])));var c;const u=e.useRef(),d=e.useMemo(()=>{if("undefined"==typeof ResizeObserver)return null;const e=new ResizeObserver(e=>{const t=e.map(e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0}));i(t)});return u.current=e,e},[]);return e.useEffect(()=>()=>{u?.current?.disconnect()},[]),e.createElement("div",{className:"react-flow__nodes",style:Ma},l.map(i=>{let l=i.type||"default";t.nodeTypes[l]||(s?.("003",hr(l)),l="default");const c=t.nodeTypes[l]||t.nodeTypes.default,u=!!(i.draggable||n&&void 0===i.draggable),f=!!(i.selectable||a&&void 0===i.selectable),p=!!(i.connectable||r&&void 0===i.connectable),h=!!(i.focusable||o&&void 0===i.focusable),m=t.nodeExtent?Ar(i.positionAbsolute,t.nodeExtent):i.positionAbsolute,g=m?.x??0,y=m?.y??0,v=(({x:e,y:t,width:n,height:r,origin:o})=>n&&r?o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-n*o[0],y:t-r*o[1]}:{x:e,y:t})({x:g,y:y,width:i.width??0,height:i.height??0,origin:t.nodeOrigin});return e.createElement(c,{key:i.id,id:i.id,className:i.className,style:i.style,type:l,data:i.data,sourcePosition:i.sourcePosition||no.Bottom,targetPosition:i.targetPosition||no.Top,hidden:i.hidden,xPos:g,yPos:y,xPosOrigin:v.x,yPosOrigin:v.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!i.selected,isDraggable:u,isSelectable:f,isConnectable:p,isFocusable:h,resizeObserver:d,dragHandle:i.dragHandle,zIndex:i[Fr]?.z??0,isParent:!!i[Fr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!i.width&&!!i.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:i.ariaLabel,hasHandleBounds:!!i[Fr]?.handleBounds})}))};di.displayName="NodeRenderer";var fi=e.memo(di);const pi=(e,t,n)=>n===no.Left?e-t:n===no.Right?e+t:e,hi=(e,t,n)=>n===no.Top?e-t:n===no.Bottom?e+t:e,mi="react-flow__edgeupdater",gi=({position:t,centerX:n,centerY:r,radius:o=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:c})=>e.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:s([mi,`${mi}-${c}`]),cx:pi(n,o,t),cy:hi(r,o,t),r:o,stroke:"transparent",fill:"transparent"}),yi=()=>!0;var vi=t=>{const n=({id:n,className:r,type:o,data:a,onClick:i,onEdgeDoubleClick:l,selected:c,animated:u,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:g,style:y,source:v,target:b,sourceX:w,sourceY:x,targetX:E,targetY:S,sourcePosition:_,targetPosition:C,elementsSelectable:k,hidden:N,sourceHandleId:M,targetHandleId:R,onContextMenu:O,onMouseEnter:P,onMouseMove:A,onMouseLeave:T,reconnectRadius:$,onReconnect:D,onReconnectStart:I,onReconnectEnd:z,markerEnd:L,markerStart:B,rfId:F,ariaLabel:j,isFocusable:H,isReconnectable:V,pathOptions:W,interactionWidth:Y,disableKeyboardA11y:X})=>{const K=e.useRef(null),[U,q]=e.useState(!1),[Z,G]=e.useState(!1),J=Cr(),Q=e.useMemo(()=>`url('#${xo(B,F)}')`,[B,F]),ee=e.useMemo(()=>`url('#${xo(L,F)}')`,[L,F]);if(N)return null;const te=Ur(n,J.getState,l),ne=Ur(n,J.getState,O),re=Ur(n,J.getState,P),oe=Ur(n,J.getState,A),ae=Ur(n,J.getState,T),ie=(e,t)=>{if(0!==e.button)return;const{edges:r,isValidConnection:o}=J.getState(),a=t?b:v,i=(t?R:M)||null,s=t?"target":"source",l=o||yi,c=t,u=r.find(e=>e.id===n);G(!0),I?.(e,u,s);Lo({event:e,handleId:i,nodeId:a,onConnect:e=>D?.(u,e),isTarget:c,getState:J.getState,setState:J.setState,isValidConnection:l,edgeUpdaterType:s,onReconnectEnd:e=>{G(!1),z?.(e,u,s)}})},se=()=>q(!0),le=()=>q(!1),ce=!k&&!i;return e.createElement("g",{className:s(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:c,animated:u,inactive:ce,updating:U}]),onClick:e=>{const{edges:t,addSelectedEdges:r,unselectNodesAndEdges:o,multiSelectionActive:a}=J.getState(),s=t.find(e=>e.id===n);s&&(k&&(J.setState({nodesSelectionActive:!1}),s.selected&&a?(o({nodes:[],edges:[s]}),K.current?.blur()):r([n])),i&&i(e,s))},onDoubleClick:te,onContextMenu:ne,onMouseEnter:re,onMouseMove:oe,onMouseLeave:ae,onKeyDown:H?e=>{if(!X&&jr.includes(e.key)&&k){const{unselectNodesAndEdges:t,addSelectedEdges:r,edges:o}=J.getState();"Escape"===e.key?(K.current?.blur(),t({edges:[o.find(e=>e.id===n)]})):r([n])}}:void 0,tabIndex:H?0:void 0,role:H?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":null===j?void 0:j||`Edge from ${v} to ${b}`,"aria-describedby":H?`${ca}-${F}`:void 0,ref:K},!Z&&e.createElement(t,{id:n,source:v,target:b,selected:c,animated:u,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:g,data:a,style:y,sourceX:w,sourceY:x,targetX:E,targetY:S,sourcePosition:_,targetPosition:C,sourceHandleId:M,targetHandleId:R,markerStart:Q,markerEnd:ee,pathOptions:W,interactionWidth:Y}),V&&e.createElement(e.Fragment,null,("source"===V||!0===V)&&e.createElement(gi,{position:_,centerX:w,centerY:x,radius:$,onMouseDown:e=>ie(e,!0),onMouseEnter:se,onMouseOut:le,type:"source"}),("target"===V||!0===V)&&e.createElement(gi,{position:C,centerX:E,centerY:S,radius:$,onMouseDown:e=>ie(e,!1),onMouseEnter:se,onMouseOut:le,type:"target"})))};return n.displayName="EdgeWrapper",e.memo(n)};function bi(e){return{...{default:vi(e.default||yo),straight:vi(e.bezier||po),step:vi(e.step||fo),smoothstep:vi(e.step||uo),simplebezier:vi(e.simplebezier||ao)},...Object.keys(e).filter(e=>!["default","bezier"].includes(e)).reduce((t,n)=>(t[n]=vi(e[n]||yo),t),{})}}function wi(e,t,n=null){const r=(n?.x||0)+t.x,o=(n?.y||0)+t.y,a=n?.width||t.width,i=n?.height||t.height;switch(e){case no.Top:return{x:r+a/2,y:o};case no.Right:return{x:r+a,y:o+i/2};case no.Bottom:return{x:r+a/2,y:o+i};case no.Left:return{x:r,y:o+i/2}}}function xi(e,t){return e?1!==e.length&&t?t&&e.find(e=>e.id===t)||null:e[0]:null}function Ei(e){const t=e?.[Fr]?.handleBounds||null,n=t&&e?.width&&e?.height&&void 0!==e?.positionAbsolute?.x&&void 0!==e?.positionAbsolute?.y;return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!n]}const Si=[{level:0,isMaxLevel:!0,edges:[]}];function _i(t,n,r){return function(e,t,n=!1){let r=-1;const o=e.reduce((e,o)=>{const a=Br(o.zIndex);let i=a?o.zIndex:0;if(n){const e=t.get(o.target),n=t.get(o.source),r=o.selected||e?.selected||n?.selected,s=Math.max(n?.[Fr]?.z||0,e?.[Fr]?.z||0,1e3);i=(a?o.zIndex:0)+(r?s:0)}return e[i]?e[i].push(o):e[i]=[o],r=i>r?i:r,e},{}),a=Object.entries(o).map(([e,t])=>{const n=+e;return{edges:t,level:n,isMaxLevel:n===r}});return 0===a.length?Si:a}(_r(e.useCallback(e=>t?e.edges.filter(t=>{const r=n.get(t.source),o=n.get(t.target);return r?.width&&r?.height&&o?.width&&o?.height&&function({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:a,width:i,height:s,transform:l}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+o),y2:Math.max(e.y+r,t.y+a)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=Ir({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:i/l[2],height:s/l[2]}),d=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),f=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(d*f)>0}({sourcePos:r.positionAbsolute||{x:0,y:0},targetPos:o.positionAbsolute||{x:0,y:0},sourceWidth:r.width,sourceHeight:r.height,targetWidth:o.width,targetHeight:o.height,width:e.width,height:e.height,transform:e.transform})}):e.edges,[t,n])),n,r)}const Ci={[to.Arrow]:({color:t="none",strokeWidth:n=1})=>e.createElement("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[to.ArrowClosed]:({color:t="none",strokeWidth:n=1})=>e.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const ki=({id:t,type:n,color:r,width:o=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const c=function(t){const n=Cr();return e.useMemo(()=>Object.prototype.hasOwnProperty.call(Ci,t)?Ci[t]:(n.getState().onError?.("009",vr(t)),null),[t])}(n);return c?e.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},e.createElement(c,{color:r,strokeWidth:s})):null},Ni=({defaultColor:t,rfId:n})=>{const r=_r(e.useCallback((({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((n,o)=>([o.markerStart,o.markerEnd].forEach(o=>{if(o&&"object"==typeof o){const a=xo(o,t);r.includes(a)||(n.push({id:a,color:o.color||e,...o}),r.push(a))}}),n),[]).sort((e,t)=>e.id.localeCompare(t.id))})({defaultColor:t,rfId:n}),[t,n]),(e,t)=>!(e.length!==t.length||e.some((e,n)=>e.id!==t[n].id)));return e.createElement("defs",null,r.map(t=>e.createElement(ki,{id:t.id,key:t.id,type:t.type,color:t.color,width:t.width,height:t.height,markerUnits:t.markerUnits,strokeWidth:t.strokeWidth,orient:t.orient})))};Ni.displayName="MarkerDefinitions";var Mi=e.memo(Ni);const Ri=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Oi=({defaultMarkerColor:t,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:o,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,onEdgeDoubleClick:p,onReconnect:h,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:y,children:v,disableKeyboardA11y:b})=>{const{edgesFocusable:w,edgesUpdatable:x,elementsSelectable:E,width:S,height:_,connectionMode:C,nodeInternals:k,onError:N}=_r(Ri,M),R=_i(n,k,r);return S?e.createElement(e.Fragment,null,R.map(({level:n,edges:r,isMaxLevel:v})=>e.createElement("svg",{key:n,style:{zIndex:n},width:S,height:_,className:"react-flow__edges react-flow__container"},v&&e.createElement(Mi,{defaultColor:t,rfId:o}),e.createElement("g",null,r.map(t=>{const[n,r,v]=Ei(k.get(t.source)),[S,_,M]=Ei(k.get(t.target));if(!v||!M)return null;let R=t.type||"default";a[R]||(N?.("011",xr(R)),R="default");const O=a[R]||a.default,P=C===Gr.Strict?_.target:(_.target??[]).concat(_.source??[]),A=xi(r.source,t.sourceHandle),T=xi(P,t.targetHandle),$=A?.position||no.Bottom,D=T?.position||no.Top,I=!!(t.focusable||w&&void 0===t.focusable),z=t.reconnectable||t.updatable,L=void 0!==h&&(z||x&&void 0===z);if(!A||!T)return N?.("008",br(A,t)),null;const{sourceX:B,sourceY:F,targetX:j,targetY:H}=((e,t,n,r,o,a)=>{const i=wi(n,e,t),s=wi(a,r,o);return{sourceX:i.x,sourceY:i.y,targetX:s.x,targetY:s.y}})(n,A,$,S,T,D);return e.createElement(O,{key:t.id,id:t.id,className:s([t.className,i]),type:R,data:t.data,selected:!!t.selected,animated:!!t.animated,hidden:!!t.hidden,label:t.label,labelStyle:t.labelStyle,labelShowBg:t.labelShowBg,labelBgStyle:t.labelBgStyle,labelBgPadding:t.labelBgPadding,labelBgBorderRadius:t.labelBgBorderRadius,style:t.style,source:t.source,target:t.target,sourceHandleId:t.sourceHandle,targetHandleId:t.targetHandle,markerEnd:t.markerEnd,markerStart:t.markerStart,sourceX:B,sourceY:F,targetX:j,targetY:H,sourcePosition:$,targetPosition:D,elementsSelectable:E,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:f,onEdgeDoubleClick:p,onReconnect:h,onReconnectStart:m,onReconnectEnd:g,reconnectRadius:y,rfId:o,ariaLabel:t.ariaLabel,isFocusable:I,isReconnectable:L,pathOptions:"pathOptions"in t?t.pathOptions:void 0,interactionWidth:t.interactionWidth,disableKeyboardA11y:b})})))),v):null};Oi.displayName="EdgeRenderer";var Pi=e.memo(Oi);const Ai=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ti({children:t}){const n=_r(Ai);return e.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},t)}const $i={[no.Left]:no.Right,[no.Right]:no.Left,[no.Top]:no.Bottom,[no.Bottom]:no.Top},Di=({nodeId:t,handleType:n,style:r,type:o=eo.Bezier,CustomComponent:a,connectionStatus:i})=>{const{fromNode:s,handleId:l,toX:c,toY:u,connectionMode:d}=_r(e.useCallback(e=>({fromNode:e.nodeInternals.get(t),handleId:e.connectionHandleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}),[t]),M),f=s?.[Fr]?.handleBounds;let p=f?.[n];if(d===Gr.Loose&&(p=p||f?.["source"===n?"target":"source"]),!s||!p)return null;const h=l?p.find(e=>e.id===l):p[0],m=h?h.x+h.width/2:(s.width??0)/2,g=h?h.y+h.height/2:s.height??0,y=(s.positionAbsolute?.x??0)+m,v=(s.positionAbsolute?.y??0)+g,b=h?.position,w=b?$i[b]:null;if(!b||!w)return null;if(a)return e.createElement(a,{connectionLineType:o,connectionLineStyle:r,fromNode:s,fromHandle:h,fromX:y,fromY:v,toX:c,toY:u,fromPosition:b,toPosition:w,connectionStatus:i});let x="";const E={sourceX:y,sourceY:v,sourcePosition:b,targetX:c,targetY:u,targetPosition:w};return o===eo.Bezier?[x]=go(E):o===eo.Step?[x]=co({...E,borderRadius:0}):o===eo.SmoothStep?[x]=co(E):o===eo.SimpleBezier?[x]=oo(E):x=`M${y},${v} ${c},${u}`,e.createElement("path",{d:x,fill:"none",className:"react-flow__connection-path",style:r})};Di.displayName="ConnectionLine";const Ii=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function zi({containerStyle:t,style:n,type:r,component:o}){const{nodeId:a,handleType:i,nodesConnectable:l,width:c,height:u,connectionStatus:d}=_r(Ii,M);return!!(a&&i&&c&&l)?e.createElement("svg",{style:t,width:c,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},e.createElement("g",{className:s(["react-flow__connection",d])},e.createElement(Di,{nodeId:a,handleType:i,style:n,type:r,CustomComponent:o,connectionStatus:d}))):null}function Li(t,n){const r=e.useRef(null),o=Cr();return e.useMemo(()=>{if("development"===process.env.NODE_ENV){const e=Object.keys(t);M(r.current,e)&&o.getState().onError?.("002",pr()),r.current=e}return n(t)},[t])}const Bi=({nodeTypes:t,edgeTypes:n,onMove:r,onMoveStart:o,onMoveEnd:a,onInit:i,onNodeClick:s,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:h,onSelectionContextMenu:m,onSelectionStart:g,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:E,selectionOnDrag:S,selectionMode:_,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:N,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:O,selectNodesOnDrag:P,defaultViewport:A,translateExtent:T,minZoom:$,maxZoom:D,preventScrolling:I,defaultMarkerColor:z,zoomOnScroll:L,zoomOnPinch:B,panOnScroll:F,panOnScrollSpeed:j,panOnScrollMode:H,zoomOnDoubleClick:V,panOnDrag:W,onPaneClick:Y,onPaneMouseEnter:X,onPaneMouseMove:K,onPaneMouseLeave:U,onPaneScroll:q,onPaneContextMenu:Z,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:re,reconnectRadius:oe,noDragClassName:ae,noWheelClassName:ie,noPanClassName:se,elevateEdgesOnSelect:le,disableKeyboardA11y:ce,nodeOrigin:ue,nodeExtent:de,rfId:fe})=>{const pe=Li(t,ci),he=Li(n,bi);return function(t){const n=ka(),r=e.useRef(!1);e.useEffect(()=>{!r.current&&n.viewportInitialized&&t&&(setTimeout(()=>t(n),1),r.current=!0)},[t,n.viewportInitialized])}(i),e.createElement(li,{onPaneClick:Y,onPaneMouseEnter:X,onPaneMouseMove:K,onPaneMouseLeave:U,onPaneContextMenu:Z,onPaneScroll:q,deleteKeyCode:M,selectionKeyCode:E,selectionOnDrag:S,selectionMode:_,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:O,onMove:r,onMoveStart:o,onMoveEnd:a,zoomOnScroll:L,zoomOnPinch:B,zoomOnDoubleClick:V,panOnScroll:F,panOnScrollSpeed:j,panOnScrollMode:H,panOnDrag:W,defaultViewport:A,translateExtent:T,minZoom:$,maxZoom:D,onSelectionContextMenu:m,preventScrolling:I,noDragClassName:ae,noWheelClassName:ie,noPanClassName:se,disableKeyboardA11y:ce},e.createElement(Ti,null,e.createElement(Pi,{edgeTypes:he,onEdgeClick:l,onEdgeDoubleClick:u,onlyRenderVisibleElements:R,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:re,reconnectRadius:oe,defaultMarkerColor:z,noPanClassName:se,elevateEdgesOnSelect:!!le,disableKeyboardA11y:ce,rfId:fe},e.createElement(zi,{style:b,type:v,component:w,containerStyle:x})),e.createElement("div",{className:"react-flow__edgelabel-renderer"}),e.createElement(fi,{nodeTypes:pe,onNodeClick:s,onNodeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:h,selectNodesOnDrag:P,onlyRenderVisibleElements:R,noPanClassName:se,noDragClassName:ae,disableKeyboardA11y:ce,nodeOrigin:ue,nodeExtent:de,rfId:fe})))};Bi.displayName="GraphView";var Fi=e.memo(Bi);const ji=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Hi={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:ji,nodeExtent:ji,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Gr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Hr,isValidConnection:void 0},Vi=()=>{return e=(e,t)=>({...Hi,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:a}=t();e({nodeInternals:va(n,r,o,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(e=>({...r,...e}))})},setDefaultNodesAndEdges:(n,r)=>{const o=void 0!==n,a=void 0!==r,i=o?va(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:i,edges:a?r:[],hasDefaultNodes:o,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:a,fitViewOnInitDone:i,fitViewOnInitOptions:s,domNode:l,nodeOrigin:c}=t(),u=l?.querySelector(".react-flow__viewport");if(!u)return;const d=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(d.transform),p=n.reduce((e,t)=>{const n=o.get(t.id);if(n?.hidden)o.set(n.id,{...n,[Fr]:{...n[Fr],handleBounds:void 0}});else if(n){const r=Or(t.nodeElement);r.width&&r.height&&(n.width!==r.width||n.height!==r.height||t.forceUpdate)&&(o.set(n.id,{...n,[Fr]:{...n[Fr],handleBounds:{source:Za(".source",t.nodeElement,f,c),target:Za(".target",t.nodeElement,f,c)}},...r}),e.push({id:n.id,type:"dimensions",dimensions:r}))}return e},[]);ya(o,c);const h=i||a&&!i&&ba(t,{initial:!0,...s});e({nodeInternals:new Map(o),fitViewOnInitDone:h}),p?.length>0&&r?.(p)},updateNodePositions:(e,n=!0,r=!1)=>{const{triggerNodeChanges:o}=t(),a=e.map(e=>{const t={id:e.id,type:"position",dragging:r};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:a,nodeOrigin:i,getNodes:s,elevateNodesOnSelect:l}=t();if(n?.length){if(a){const t=va(Ba(n,s()),o,i,l);e({nodeInternals:t})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:a}=t();let i,s=null;r?i=n.map(e=>Fa(e,!0)):(i=ja(a(),n),s=ja(o,[])),Ea({changedNodes:i,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:a}=t();let i,s=null;r?i=n.map(e=>Fa(e,!0)):(i=ja(o,n),s=ja(a(),[])),Ea({changedNodes:s,changedEdges:i,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:a}=t(),i=r||o;Ea({changedNodes:(n||a()).map(e=>(e.selected=!1,Fa(e.id,!1))),changedEdges:i.map(e=>Fa(e.id,!1)),get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=t();r?.scaleExtent([n,o]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=t();r?.scaleExtent([o,n]),e({maxZoom:n})},setTranslateExtent:n=>{t().d3Zoom?.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t();Ea({changedNodes:r().filter(e=>e.selected).map(e=>Fa(e.id,!1)),changedEdges:n.filter(e=>e.selected).map(e=>Fa(e.id,!1)),get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(e=>{e.positionAbsolute=Ar(e.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:e=>{const{transform:n,width:r,height:o,d3Zoom:a,d3Selection:i,translateExtent:s}=t();if(!a||!i||!e.x&&!e.y)return!1;const l=nr.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),c=[[0,0],[r,o]],u=a?.constrain()(l,c,s);return a.transform(i,u),n[0]!==u.x||n[1]!==u.y||n[2]!==u.k},cancelConnection:()=>e({connectionNodeId:Hi.connectionNodeId,connectionHandleId:Hi.connectionHandleId,connectionHandleType:Hi.connectionHandleType,connectionStatus:Hi.connectionStatus,connectionStartHandle:Hi.connectionStartHandle,connectionEndHandle:Hi.connectionEndHandle}),reset:()=>e({...Hi})}),t=Object.is,e?N(e,t):N;var e,t},Wi=({children:t})=>{const n=e.useRef(null);return n.current||(n.current=Vi()),e.createElement(fr,{value:n.current},t)};Wi.displayName="ReactFlowProvider";const Yi=({children:t})=>e.useContext(dr)?e.createElement(e.Fragment,null,t):e.createElement(Wi,null,t);Yi.displayName="ReactFlowWrapper";const Xi={input:Xo,default:Wo,output:Uo,group:qo},Ki={default:yo,straight:po,step:fo,smoothstep:uo,simplebezier:ao},Ui=[0,0],qi=[15,15],Zi={x:0,y:0,zoom:1},Gi={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Ji=e.forwardRef(({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,className:a,nodeTypes:i=Xi,edgeTypes:l=Ki,onNodeClick:c,onEdgeClick:u,onInit:d,onMove:f,onMoveStart:p,onMoveEnd:h,onConnect:m,onConnectStart:g,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:E,onNodeContextMenu:S,onNodeDoubleClick:_,onNodeDragStart:C,onNodeDrag:k,onNodeDragStop:N,onNodesDelete:M,onEdgesDelete:R,onSelectionChange:O,onSelectionDragStart:P,onSelectionDrag:A,onSelectionDragStop:T,onSelectionContextMenu:$,onSelectionStart:D,onSelectionEnd:I,connectionMode:z=Gr.Strict,connectionLineType:L=eo.Bezier,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:j,deleteKeyCode:H="Backspace",selectionKeyCode:V="Shift",selectionOnDrag:W=!1,selectionMode:Y=Qr.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:K=(Xr()?"Meta":"Control"),zoomActivationKeyCode:U=(Xr()?"Meta":"Control"),snapToGrid:q=!1,snapGrid:Z=qi,onlyRenderVisibleElements:G=!1,selectNodesOnDrag:J=!0,nodesDraggable:Q,nodesConnectable:ee,nodesFocusable:te,nodeOrigin:ne=Ui,edgesFocusable:re,edgesUpdatable:oe,elementsSelectable:ae,defaultViewport:ie=Zi,minZoom:se=.5,maxZoom:le=2,translateExtent:ce=ji,preventScrolling:ue=!0,nodeExtent:de,defaultMarkerColor:fe="#b1b1b7",zoomOnScroll:pe=!0,zoomOnPinch:he=!0,panOnScroll:me=!1,panOnScrollSpeed:ge=.5,panOnScrollMode:ye=Jr.Free,zoomOnDoubleClick:ve=!0,panOnDrag:be=!0,onPaneClick:we,onPaneMouseEnter:xe,onPaneMouseMove:Ee,onPaneMouseLeave:Se,onPaneScroll:_e,onPaneContextMenu:Ce,children:ke,onEdgeContextMenu:Ne,onEdgeDoubleClick:Me,onEdgeMouseEnter:Re,onEdgeMouseMove:Oe,onEdgeMouseLeave:Pe,onEdgeUpdate:Ae,onEdgeUpdateStart:Te,onEdgeUpdateEnd:$e,onReconnect:De,onReconnectStart:Ie,onReconnectEnd:ze,reconnectRadius:Le=10,edgeUpdaterRadius:Be=10,onNodesChange:Fe,onEdgesChange:je,noDragClassName:He="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:We="nopan",fitView:Ye=!1,fitViewOptions:Xe,connectOnClick:Ke=!0,attributionPosition:Ue,proOptions:qe,defaultEdgeOptions:Ze,elevateNodesOnSelect:Ge=!0,elevateEdgesOnSelect:Je=!1,disableKeyboardA11y:Qe=!1,autoPanOnConnect:et=!0,autoPanOnNodeDrag:tt=!0,connectionRadius:nt=20,isValidConnection:rt,onError:ot,style:at,id:it,nodeDragThreshold:st,...lt},ct)=>{const ut=it||"1";return e.createElement("div",{...lt,style:{...at,...Gi},ref:ct,className:s(["react-flow",a]),"data-testid":"rf__wrapper",id:it},e.createElement(Yi,null,e.createElement(Fi,{onInit:d,onMove:f,onMoveStart:p,onMoveEnd:h,onNodeClick:c,onEdgeClick:u,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:E,onNodeContextMenu:S,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:l,connectionLineType:L,connectionLineStyle:B,connectionLineComponent:F,connectionLineContainerStyle:j,selectionKeyCode:V,selectionOnDrag:W,selectionMode:Y,deleteKeyCode:H,multiSelectionKeyCode:K,panActivationKeyCode:X,zoomActivationKeyCode:U,onlyRenderVisibleElements:G,selectNodesOnDrag:J,defaultViewport:ie,translateExtent:ce,minZoom:se,maxZoom:le,preventScrolling:ue,zoomOnScroll:pe,zoomOnPinch:he,zoomOnDoubleClick:ve,panOnScroll:me,panOnScrollSpeed:ge,panOnScrollMode:ye,panOnDrag:be,onPaneClick:we,onPaneMouseEnter:xe,onPaneMouseMove:Ee,onPaneMouseLeave:Se,onPaneScroll:_e,onPaneContextMenu:Ce,onSelectionContextMenu:$,onSelectionStart:D,onSelectionEnd:I,onEdgeContextMenu:Ne,onEdgeDoubleClick:Me,onEdgeMouseEnter:Re,onEdgeMouseMove:Oe,onEdgeMouseLeave:Pe,onReconnect:De??Ae,onReconnectStart:Ie??Te,onReconnectEnd:ze??$e,reconnectRadius:Le??Be,defaultMarkerColor:fe,noDragClassName:He,noWheelClassName:Ve,noPanClassName:We,elevateEdgesOnSelect:Je,rfId:ut,disableKeyboardA11y:Qe,nodeOrigin:ne,nodeExtent:de}),e.createElement(aa,{nodes:t,edges:n,defaultNodes:r,defaultEdges:o,onConnect:m,onConnectStart:g,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:Q,nodesConnectable:ee,nodesFocusable:te,edgesFocusable:re,edgesUpdatable:oe,elementsSelectable:ae,elevateNodesOnSelect:Ge,minZoom:se,maxZoom:le,nodeExtent:de,onNodesChange:Fe,onEdgesChange:je,snapToGrid:q,snapGrid:Z,connectionMode:z,translateExtent:ce,connectOnClick:Ke,defaultEdgeOptions:Ze,fitView:Ye,fitViewOptions:Xe,onNodesDelete:M,onEdgesDelete:R,onNodeDragStart:C,onNodeDrag:k,onNodeDragStop:N,onSelectionDrag:A,onSelectionDragStart:P,onSelectionDragStop:T,noPanClassName:We,nodeOrigin:ne,rfId:ut,autoPanOnConnect:et,autoPanOnNodeDrag:tt,onError:ot,connectionRadius:nt,isValidConnection:rt,nodeDragThreshold:st}),e.createElement(ta,{onSelectionChange:O}),ke,e.createElement(Mr,{proOptions:qe,position:Ue}),e.createElement(fa,{rfId:ut,disableKeyboardA11y:Qe})))});function Qi(t){return n=>{const[r,o]=e.useState(n),a=e.useCallback(e=>o(n=>t(e,n)),[]);return[r,o,a]}}Ji.displayName="ReactFlow";const es=Qi(Ba),ts=Qi(function(e,t){return La(e,t)});var ns;function rs({color:t,dimensions:n,lineWidth:r}){return e.createElement("path",{stroke:t,strokeWidth:r,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function os({color:t,radius:n}){return e.createElement("circle",{cx:n,cy:n,r:n,fill:t})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(ns||(ns={}));const as={[ns.Dots]:"#91919a",[ns.Lines]:"#eee",[ns.Cross]:"#e2e2e2"},is={[ns.Dots]:1,[ns.Lines]:1,[ns.Cross]:6},ss=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ls({id:t,variant:n=ns.Dots,gap:r=20,size:o,lineWidth:a=1,offset:i=2,color:l,style:c,className:u}){const d=e.useRef(null),{transform:f,patternId:p}=_r(ss,M),h=l||as[n],m=o||is[n],g=n===ns.Dots,y=n===ns.Cross,v=Array.isArray(r)?r:[r,r],b=[v[0]*f[2]||1,v[1]*f[2]||1],w=m*f[2],x=y?[w,w]:b,E=g?[w/i,w/i]:[x[0]/i,x[1]/i];return e.createElement("svg",{className:s(["react-flow__background",u]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},e.createElement("pattern",{id:p+t,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`},g?e.createElement(os,{color:h,radius:w/i}):e.createElement(rs,{dimensions:x,color:h,lineWidth:a})),e.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${p+t})`}))}ls.displayName="Background";var cs=e.memo(ls);!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".react-flow{direction:ltr}.react-flow__container{height:100%;left:0;position:absolute;top:0;width:100%}.react-flow__pane{cursor:-webkit-grab;cursor:grab;z-index:1}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__viewport{pointer-events:none;transform-origin:0 0;z-index:2}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{overflow:visible;pointer-events:none}.react-flow__connection-path,.react-flow__edge-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{cursor:pointer;pointer-events:visibleStroke}.react-flow__edge.animated path{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;-webkit-animation:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{box-sizing:border-box;cursor:-webkit-grab;cursor:grab;pointer-events:all;position:absolute;transform-origin:0 0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__node.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__nodesselection{pointer-events:none;transform-origin:left top;z-index:3}.react-flow__nodesselection-rect{cursor:-webkit-grab;cursor:grab;pointer-events:all;position:absolute}.react-flow__handle{background:#1a192b;border:1px solid #fff;border-radius:100%;height:6px;min-height:5px;min-width:5px;pointer-events:none;position:absolute;width:6px}.react-flow__handle.connectionindicator{cursor:crosshair;pointer-events:all}.react-flow__handle-bottom{bottom:-4px;left:50%;top:auto;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{left:-4px;top:50%;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{margin:15px;position:absolute;z-index:5}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translateX(-50%)}.react-flow__attribution{background:hsla(0,0%,100%,.5);font-size:10px;margin:0;padding:2px 3px}.react-flow__attribution a{color:#999;text-decoration:none}@-webkit-keyframes dashdraw{0%{stroke-dashoffset:10}}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{height:100%;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-group,.react-flow__node-input,.react-flow__node-output{background-color:#fff;border:1px solid #1a192b;border-radius:3px;color:#222;font-size:12px;padding:10px;text-align:center;width:150px}.react-flow__node-default.selectable:hover,.react-flow__node-group.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover{box-shadow:0 1px 4px 1px rgba(0,0,0,.08)}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:hsla(0,0%,94%,.25)}.react-flow__nodesselection-rect,.react-flow__selection{background:rgba(0,89,220,.08);border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px rgba(0,0,0,.08)}.react-flow__controls-button{align-items:center;background:#fefefe;border:none;border-bottom:1px solid #eee;box-sizing:content-box;cursor:pointer;display:flex;height:16px;justify-content:center;padding:5px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:16px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{max-height:12px;max-width:12px;width:100%}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.bottom,.react-flow__resize-control.top{cursor:ns-resize}.react-flow__resize-control.bottom.right,.react-flow__resize-control.top.left{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:#3367d9;border:1px solid #fff;border-radius:1px;height:4px;transform:translate(-50%,-50%);width:4px}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.bottom.left,.react-flow__resize-control.handle.top.left{left:0}.react-flow__resize-control.handle.bottom.right,.react-flow__resize-control.handle.top.right{left:100%}.react-flow__resize-control.line{border:0 solid #3367d9}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{height:100%;top:0;transform:translate(-50%);width:1px}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.bottom,.react-flow__resize-control.line.top{height:1px;left:0;transform:translateY(-50%);width:100%}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}");
1
+ "use strict";var e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom"),o=require("react-countup");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var i=r(e),a=r(n);function s(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=s(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var l={value:()=>{}};function c(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new u(o)}function u(e){this._=e}function d(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function f(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=l,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}u.prototype=c.prototype={constructor:u,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=i[a]).type)r[n]=f(r[n],e.name,t);else if(null==t)for(n in r)r[n]=f(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=i[a]).type)&&(n=d(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new u(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var p="http://www.w3.org/1999/xhtml",h={svg:"http://www.w3.org/2000/svg",xhtml:p,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function m(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),h.hasOwnProperty(t)?{space:h[t],local:e}:e}function g(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===p&&t.documentElement.namespaceURI===p?t.createElement(e):t.createElementNS(n,e)}}function y(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function v(e){var t=m(e);return(t.local?y:g)(t)}function b(){}function x(e){return null==e?b:function(){return this.querySelector(e)}}function w(){return[]}function E(e){return null==e?w:function(){return this.querySelectorAll(e)}}function k(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function S(e){return function(){return this.matches(e)}}function C(e){return function(t){return t.matches(e)}}var _=Array.prototype.find;function N(){return this.firstElementChild}var M=Array.prototype.filter;function P(){return Array.from(this.children)}function O(e){return new Array(e.length)}function R(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function $(e,t,n,o,r,i){for(var a,s=0,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new R(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function A(e,t,n,o,r,i,a){var s,l,c,u=new Map,d=t.length,f=i.length,p=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(p[s]=c=a.call(l,l.__data__,s,t)+"",u.has(c)?r[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(e,i[s],s,i)+"",(l=u.get(c))?(o[s]=l,l.__data__=i[s],u.delete(c)):n[s]=new R(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(p[s])===l&&(r[s]=l)}function D(e){return e.__data__}function T(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function z(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function I(e){return function(){this.removeAttribute(e)}}function L(e){return function(){this.removeAttributeNS(e.space,e.local)}}function j(e,t){return function(){this.setAttribute(e,t)}}function B(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function F(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function H(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function V(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function W(e){return function(){this.style.removeProperty(e)}}function Y(e,t,n){return function(){this.style.setProperty(e,t,n)}}function X(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Z(e,t){return e.style.getPropertyValue(t)||V(e).getComputedStyle(e,null).getPropertyValue(t)}function K(e){return function(){delete this[e]}}function q(e,t){return function(){this[e]=t}}function U(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function G(e){return e.trim().split(/^|\s+/)}function Q(e){return e.classList||new J(e)}function J(e){this._node=e,this._names=G(e.getAttribute("class")||"")}function ee(e,t){for(var n=Q(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function te(e,t){for(var n=Q(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ne(e){return function(){ee(this,e)}}function oe(e){return function(){te(this,e)}}function re(e,t){return function(){(t.apply(this,arguments)?ee:te)(this,e)}}function ie(){this.textContent=""}function ae(e){return function(){this.textContent=e}}function se(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function le(){this.innerHTML=""}function ce(e){return function(){this.innerHTML=e}}function ue(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function de(){this.nextSibling&&this.parentNode.appendChild(this)}function fe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pe(){return null}function he(){var e=this.parentNode;e&&e.removeChild(this)}function me(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ge(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ye(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function ve(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function be(e,t,n){var o=V(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function xe(e,t){return function(){return be(this,e,t)}}function we(e,t){return function(){return be(this,e,t.apply(this,arguments))}}R.prototype={constructor:R,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)}},J.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Ee=[null];function ke(e,t){this._groups=e,this._parents=t}function Se(){return new ke([[document.documentElement]],Ee)}function Ce(e){return"string"==typeof e?new ke([[document.querySelector(e)]],[document.documentElement]):new ke([[e]],Ee)}function _e(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}ke.prototype=Se.prototype={constructor:ke,select:function(e){"function"!=typeof e&&(e=x(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=t[r],l=s.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=s[u])&&(a=e.call(i,i.__data__,u,s))&&("__data__"in i&&(a.__data__=i.__data__),c[u]=a);return new ke(o,this._parents)},selectAll:function(e){e="function"==typeof e?k(e):E(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var a,s=t[i],l=s.length,c=0;c<l;++c)(a=s[c])&&(o.push(e.call(a,a.__data__,c,s)),r.push(a));return new ke(o,r)},selectChild:function(e){return this.select(null==e?N:function(e){return function(){return _.call(this.children,e)}}("function"==typeof e?e:C(e)))},selectChildren:function(e){return this.selectAll(null==e?P:function(e){return function(){return M.call(this.children,e)}}("function"==typeof e?e:C(e)))},filter:function(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new ke(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,D);var n,o=t?A:$,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=i.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var d=r[u],f=i[u],p=f.length,h=T(e.call(d,d&&d.__data__,u,r)),m=h.length,g=l[u]=new Array(m),y=s[u]=new Array(m);o(d,f,g,y,c[u]=new Array(p),h,t);for(var v,b,x=0,w=0;x<m;++x)if(v=g[x]){for(x>=w&&(w=x+1);!(b=y[w])&&++w<m;);v._next=b||null}}return(s=new ke(s,r))._enter=l,s._exit=c,s},enter:function(){return new ke(this._enter||this._groups.map(O),this._parents)},exit:function(){return new ke(this._exit||this._groups.map(O),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c,u=n[l],d=o[l],f=u.length,p=s[l]=new Array(f),h=0;h<f;++h)(c=u[h]||d[h])&&(p[h]=c);for(;l<r;++l)s[l]=n[l];return new ke(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,a=r[i];--i>=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=z);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(t)}return new ke(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],a=0,s=i.length;a<s;++a)(r=i[a])&&e.call(r,r.__data__,a,i);return this},attr:function(e,t){var n=m(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?L:I:"function"==typeof t?n.local?H:F:n.local?B:j)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?W:"function"==typeof t?X:Y)(e,t,null==n?"":n)):Z(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?K:"function"==typeof t?U:q)(e,t)):this.node()[e]},classed:function(e,t){var n=G(e+"");if(arguments.length<2){for(var o=Q(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?re:t?ne:oe)(n,t))},text:function(e){return arguments.length?this.each(null==e?ie:("function"==typeof e?se:ae)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?le:("function"==typeof e?ue:ce)(e)):this.node().innerHTML},raise:function(){return this.each(de)},lower:function(){return this.each(fe)},append:function(e){var t="function"==typeof e?e:v(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:v(e),o=null==t?pe:"function"==typeof t?t:x(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(he)},clone:function(e){return this.select(e?ge:me)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=i.length;if(!(arguments.length<2)){for(s=t?ve:ye,o=0;o<a;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(o=0,l=s[c];o<a;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?we:xe)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const Ne={passive:!1},Me={capture:!0,passive:!1};function Pe(e){e.stopImmediatePropagation()}function Oe(e){e.preventDefault(),e.stopImmediatePropagation()}function Re(e){var t=e.document.documentElement,n=Ce(e).on("dragstart.drag",Oe,Me);"onselectstart"in t?n.on("selectstart.drag",Oe,Me):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $e(e,t){var n=e.document.documentElement,o=Ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Oe,Me),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ae=e=>()=>e;function De(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Te(e){return!e.ctrlKey&&!e.button}function ze(){return this.parentNode}function Ie(e,t){return null==t?{x:e.x,y:e.y}:t}function Le(){return navigator.maxTouchPoints||"ontouchstart"in this}function je(){var e,t,n,o,r=Te,i=ze,a=Ie,s=Le,l={},u=c("start","drag","end"),d=0,f=0;function p(e){e.on("mousedown.drag",h).filter(s).on("touchstart.drag",y).on("touchmove.drag",v,Ne).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!o&&r.call(this,a,s)){var l=x(this,i.call(this,a,s),a,s,"mouse");l&&(Ce(a.view).on("mousemove.drag",m,Me).on("mouseup.drag",g,Me),Re(a.view),Pe(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function m(o){if(Oe(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>f}l.mouse("drag",o)}function g(e){Ce(e.view).on("mousemove.drag mouseup.drag",null),$e(e.view,n),Oe(e),l.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,a=e.changedTouches,s=i.call(this,e,t),l=a.length;for(n=0;n<l;++n)(o=x(this,s,e,t,a[n].identifier,a[n]))&&(Pe(e),o("start",e,a[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(Oe(e),n("drag",e,o[t]))}function b(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(Pe(e),n("end",e,r[t]))}function x(e,t,n,o,r,i){var s,c,f,h=u.copy(),m=_e(i||n,t);if(null!=(f=a.call(e,new De("beforestart",{sourceEvent:n,target:p,identifier:r,active:d,x:m[0],y:m[1],dx:0,dy:0,dispatch:h}),o)))return s=f.x-m[0]||0,c=f.y-m[1]||0,function n(i,a,u){var g,y=m;switch(i){case"start":l[r]=n,g=d++;break;case"end":delete l[r],--d;case"drag":m=_e(u||a,t),g=d}h.call(i,e,new De(i,{sourceEvent:a,subject:f,target:p,identifier:r,active:g,x:m[0]+s,y:m[1]+c,dx:m[0]-y[0],dy:m[1]-y[1],dispatch:h}),o)}}return p.filter=function(e){return arguments.length?(r="function"==typeof e?e:Ae(!!e),p):r},p.container=function(e){return arguments.length?(i="function"==typeof e?e:Ae(e),p):i},p.subject=function(e){return arguments.length?(a="function"==typeof e?e:Ae(e),p):a},p.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Ae(!!e),p):s},p.on=function(){var e=u.on.apply(u,arguments);return e===u?p:e},p.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,p):Math.sqrt(f)},p}function Be(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Fe(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function He(){}De.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Ve=.7,We=1/Ve,Ye="\\s*([+-]?\\d+)\\s*",Xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ke=/^#([0-9a-f]{3,8})$/,qe=new RegExp(`^rgb\\(${Ye},${Ye},${Ye}\\)$`),Ue=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),Ge=new RegExp(`^rgba\\(${Ye},${Ye},${Ye},${Xe}\\)$`),Qe=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${Xe}\\)$`),Je=new RegExp(`^hsl\\(${Xe},${Ze},${Ze}\\)$`),et=new RegExp(`^hsla\\(${Xe},${Ze},${Ze},${Xe}\\)$`),tt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function nt(){return this.rgb().formatHex()}function ot(){return this.rgb().formatRgb()}function rt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ke.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?it(t):3===n?new lt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?at(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?at(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=qe.exec(e))?new lt(t[1],t[2],t[3],1):(t=Ue.exec(e))?new lt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ge.exec(e))?at(t[1],t[2],t[3],t[4]):(t=Qe.exec(e))?at(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Je.exec(e))?ht(t[1],t[2]/100,t[3]/100,1):(t=et.exec(e))?ht(t[1],t[2]/100,t[3]/100,t[4]):tt.hasOwnProperty(e)?it(tt[e]):"transparent"===e?new lt(NaN,NaN,NaN,0):null}function it(e){return new lt(e>>16&255,e>>8&255,255&e,1)}function at(e,t,n,o){return o<=0&&(e=t=n=NaN),new lt(e,t,n,o)}function st(e,t,n,o){return 1===arguments.length?((r=e)instanceof He||(r=rt(r)),r?new lt((r=r.rgb()).r,r.g,r.b,r.opacity):new lt):new lt(e,t,n,null==o?1:o);var r}function lt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function ct(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}`}function ut(){const e=dt(this.opacity);return`${1===e?"rgb(":"rgba("}${ft(this.r)}, ${ft(this.g)}, ${ft(this.b)}${1===e?")":`, ${e})`}`}function dt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ft(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function pt(e){return((e=ft(e))<16?"0":"")+e.toString(16)}function ht(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new gt(e,t,n,o)}function mt(e){if(e instanceof gt)return new gt(e.h,e.s,e.l,e.opacity);if(e instanceof He||(e=rt(e)),!e)return new gt;if(e instanceof gt)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),a=NaN,s=i-r,l=(i+r)/2;return s?(a=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new gt(a,s,l,e.opacity)}function gt(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function yt(e){return(e=(e||0)%360)<0?e+360:e}function vt(e){return Math.max(0,Math.min(1,e||0))}function bt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Be(He,rt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nt,formatHex:nt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return mt(this).formatHsl()},formatRgb:ot,toString:ot}),Be(lt,st,Fe(He,{brighter(e){return e=null==e?We:Math.pow(We,e),new lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new lt(ft(this.r),ft(this.g),ft(this.b),dt(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:ct,formatHex:ct,formatHex8:function(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}${pt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ut,toString:ut})),Be(gt,function(e,t,n,o){return 1===arguments.length?mt(e):new gt(e,t,n,null==o?1:o)},Fe(He,{brighter(e){return e=null==e?We:Math.pow(We,e),new gt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new gt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new lt(bt(e>=240?e-240:e+120,r,o),bt(e,r,o),bt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new gt(yt(this.h),vt(this.s),vt(this.l),dt(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=dt(this.opacity);return`${1===e?"hsl(":"hsla("}${yt(this.h)}, ${100*vt(this.s)}%, ${100*vt(this.l)}%${1===e?")":`, ${e})`}`}}));var xt=e=>()=>e;function wt(e){return 1===(e=+e)?Et:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):xt(isNaN(t)?n:t)}}function Et(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):xt(isNaN(e)?t:e)}var kt=function e(t){var n=wt(t);function o(e,t){var o=n((e=st(e)).r,(t=st(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=Et(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function St(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function Ct(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=$t(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=i[n](e);return a}}function _t(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Nt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Mt(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=$t(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var Pt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ot=new RegExp(Pt.source,"g");function Rt(e,t){var n,o,r,i=Pt.lastIndex=Ot.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=Pt.exec(e))&&(o=Ot.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:Nt(n,o)})),i=Ot.lastIndex;return i<t.length&&(r=t.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function $t(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?xt(t):("number"===r?Nt:"string"===r?(n=rt(t))?(t=n,kt):Rt:t instanceof rt?kt:t instanceof Date?_t:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?Ct:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Mt:Nt:St))(e,t)}var At,Dt=180/Math.PI,Tt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zt(e,t,n,o,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Dt,skewX:Math.atan(l)*Dt,scaleX:a,scaleY:s}}function It(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,a){var s=[],l=[];return i=e(i),a=e(a),function(e,o,r,i,a,s){if(e!==r||o!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:Nt(e,r)},{i:l-2,x:Nt(o,i)})}else(r||i)&&a.push("translate("+r+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:Nt(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:Nt(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,s,l),function(e,t,n,o,i,a){if(e!==n||t!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Nt(e,n)},{i:s-2,x:Nt(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,l),i=a=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Lt=It(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Tt:zt(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),jt=It(function(e){return null==e?Tt:(At||(At=document.createElementNS("http://www.w3.org/2000/svg","g")),At.setAttribute("transform",e),(e=At.transform.baseVal.consolidate())?zt((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Tt)},", ",")",")");function Bt(e){return((e=Math.exp(e))+1/e)/2}var Ft,Ht,Vt=function e(t,n,o){function r(e,r){var i,a,s=e[0],l=e[1],c=e[2],u=r[0],d=r[1],f=r[2],p=u-s,h=d-l,m=p*p+h*h;if(m<1e-12)a=Math.log(f/c)/t,i=function(e){return[s+e*p,l+e*h,c*Math.exp(t*e*a)]};else{var g=Math.sqrt(m),y=(f*f-c*c+o*m)/(2*c*n*g),v=(f*f-c*c-o*m)/(2*f*n*g),b=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);a=(x-b)/t,i=function(e){var o,r=e*a,i=Bt(b),u=c/(n*g)*(i*(o=t*r+b,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+u*p,l+u*h,c*i/Bt(t*r+b)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),Wt=0,Yt=0,Xt=0,Zt=0,Kt=0,qt=0,Ut="object"==typeof performance&&performance.now?performance:Date,Gt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Qt(){return Kt||(Gt(Jt),Kt=Ut.now()+qt)}function Jt(){Kt=0}function en(){this._call=this._time=this._next=null}function tn(e,t,n){var o=new en;return o.restart(e,t,n),o}function nn(){Kt=(Zt=Ut.now())+qt,Wt=Yt=0;try{!function(){Qt(),++Wt;for(var e,t=Ft;t;)(e=Kt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Wt}()}finally{Wt=0,function(){var e,t,n=Ft,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Ft=t);Ht=e,rn(o)}(),Kt=0}}function on(){var e=Ut.now(),t=e-Zt;t>1e3&&(qt-=t,Zt=e)}function rn(e){Wt||(Yt&&(Yt=clearTimeout(Yt)),e-Kt>24?(e<1/0&&(Yt=setTimeout(nn,e-Ut.now()-qt)),Xt&&(Xt=clearInterval(Xt))):(Xt||(Zt=Ut.now(),Xt=setInterval(on,1e3)),Wt=1,Gt(nn)))}function an(e,t,n){var o=new en;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}en.prototype=tn.prototype={constructor:en,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Qt():+n)+(null==t?0:+t),this._next||Ht===this||(Ht?Ht._next=this:Ft=this,Ht=this),this._call=e,this._time=n,rn()},stop:function(){this._call&&(this._call=null,this._time=1/0,rn())}};var sn=c("start","end","cancel","interrupt"),ln=[];function cn(e,t,n,o,r,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(i){var c,u,d,f;if(1!==n.state)return l();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return an(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(an(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=f);o.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=o.length;++i<a;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=tn(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:sn,tween:ln,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function un(e,t){var n=fn(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function dn(e,t){var n=fn(e,t);if(n.state>3)throw new Error("too late; already running");return n}function fn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function pn(e,t){var n,o,r,i=e.__transition,a=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete e.__transition}}function hn(e,t){var n,o;return function(){var r=dn(this,e),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}r.tween=o}}function mn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=dn(this,e),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function gn(e,t,n){var o=e._id;return e.each(function(){var e=dn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return fn(e,o).value[t]}}function yn(e,t){var n;return("number"==typeof t?Nt:t instanceof rt?kt:(n=rt(t))?(t=n,kt):Rt)(e,t)}function vn(e){return function(){this.removeAttribute(e)}}function bn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function wn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function En(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(e))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttribute(e)}}function kn(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttributeNS(e.space,e.local)}}function Sn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Cn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function _n(e,t){return function(){un(this,e).delay=+t.apply(this,arguments)}}function Nn(e,t){return t=+t,function(){un(this,e).delay=t}}function Mn(e,t){return function(){dn(this,e).duration=+t.apply(this,arguments)}}function Pn(e,t){return t=+t,function(){dn(this,e).duration=t}}var On=Se.prototype.constructor;function Rn(e){return function(){this.style.removeProperty(e)}}var $n=0;function An(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Dn(){return++$n}var Tn=Se.prototype;An.prototype={constructor:An,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,l,c=o[a],u=c.length,d=i[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,cn(d[f],t,n,f,d,fn(s,n)));return new An(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=E(e));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var l,c=o[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var f,p=e.call(l,l.__data__,d,c),h=fn(l,n),m=0,g=p.length;m<g;++m)(f=p[m])&&cn(f,t,n,m,p,h);i.push(p),a.push(l)}return new An(i,a,t,n)},selectChild:Tn.selectChild,selectChildren:Tn.selectChildren,filter:function(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new An(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var l,c=t[s],u=n[s],d=c.length,f=a[s]=new Array(d),p=0;p<d;++p)(l=c[p]||u[p])&&(f[p]=l);for(;s<o;++s)a[s]=t[s];return new An(a,this._parents,this._name,this._id)},selection:function(){return new On(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Dn(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=fn(a,t);cn(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new An(o,this._parents,e,n)},call:Tn.call,nodes:Tn.nodes,node:Tn.node,size:Tn.size,empty:Tn.empty,each:Tn.each,on:function(e,t){var n=this._id;return arguments.length<2?fn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?un:dn;return function(){var a=i(this,e),s=a.on;s!==o&&(r=(o=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=m(e),o="transform"===n?jt:yn;return this.attrTween(e,"function"==typeof t?(n.local?kn:En)(n,o,gn(this,"attr."+e,t)):null==t?(n.local?bn:vn)(n):(n.local?wn:xn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=m(e);return this.tween(n,(o.local?Sn:Cn)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?Lt:yn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=Z(this,e),a=(this.style.removeProperty(e),Z(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,Rn(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=Z(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Z(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,gn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=dn(this,e),c=l.on,u=null==l.value[a]?i||(i=Rn(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(s,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var a=Z(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(gn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=fn(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?hn:mn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?_n:Nn)(t,e)):fn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Mn:Pn)(t,e)):fn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){dn(this,e).ease=t}}(t,e)):fn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;dn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0===--r&&i()}};n.each(function(){var n=dn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===r&&i()})},[Symbol.iterator]:Tn[Symbol.iterator]};var zn={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function In(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Se.prototype.interrupt=function(e){return this.each(function(){pn(this,e)})},Se.prototype.transition=function(e){var t,n;e instanceof An?(t=e._id,e=e._name):(t=Dn(),(n=zn).time=Qt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)(a=s[c])&&cn(a,e,t,c,s,n||In(a,t));return new An(o,this._parents,e,t)};var Ln=e=>()=>e;function jn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Bn(e,t,n){this.k=e,this.x=t,this.y=n}Bn.prototype={constructor:Bn,scale:function(e){return 1===e?this:new Bn(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Bn(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 Fn=new Bn(1,0,0);function Hn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fn;return e.__zoom}function Vn(e){e.stopImmediatePropagation()}function Wn(e){e.preventDefault(),e.stopImmediatePropagation()}function Yn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Xn(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Zn(){return this.__zoom||Fn}function Kn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Un(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Gn(){var e,t,n,o=Yn,r=Xn,i=Un,a=Kn,s=qn,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,f=Vt,p=c("start","zoom","end"),h=0,m=10;function g(e){e.property("__zoom",Zn).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",C).filter(s).on("touchstart.zoom",_).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Bn(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Bn(e.k,o,r)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,t,n,o){e.on("start.zoom",function(){w(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,a=w(e,i).event(o),s=r.apply(e,i),l=null==n?b(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,d="function"==typeof t?t.apply(e,i):t,p=f(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=p(e),n=c/t[2];e=new Bn(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}})}function w(e,t,n){return!n&&e.__zooming||new E(e,t)}function E(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=w(this,t).event(e),r=this.__zoom,s=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,a.apply(this,arguments)))),c=_e(e);if(n.wheel)n.mouse[0][0]===c[0]&&n.mouse[0][1]===c[1]||(n.mouse[1]=r.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[c,r.invert(c)],pn(this),n.start()}Wn(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(v(y(r,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function S(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,a=w(this,t,!0).event(e),s=Ce(e.view).on("mousemove.zoom",function(e){if(Wn(e),!a.moved){var t=e.clientX-c,n=e.clientY-d;a.moved=t*t+n*n>h}a.event(e).zoom("mouse",i(v(a.that.__zoom,a.mouse[0]=_e(e,r),a.mouse[1]),a.extent,u))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),$e(e.view,a.moved),Wn(e),a.event(e).end()},!0),l=_e(e,r),c=e.clientX,d=e.clientY;Re(e.view),Vn(e),a.mouse=[l,this.__zoom.invert(l)],pn(this),a.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=_e(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(a),l=n.k*(e.shiftKey?.5:2),c=i(v(y(n,l),a,s),r.apply(this,t),u);Wn(e),d>0?Ce(this).transition().duration(d).call(x,c,a,e):Ce(this).call(g.transform,c,a,e)}}function _(n,...r){if(o.apply(this,arguments)){var i,a,s,l,c=n.touches,u=c.length,d=w(this,r,n.changedTouches.length===u).event(n);for(Vn(n),a=0;a<u;++a)l=[l=_e(s=c[a],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),pn(this),d.start())}}function N(e,...t){if(this.__zooming){var n,o,r,a,s=w(this,t).event(e),l=e.changedTouches,c=l.length;for(Wn(e),n=0;n<c;++n)r=_e(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],p=s.touch1[0],h=s.touch1[1],m=(m=p[0]-d[0])*m+(m=p[1]-d[1])*m,g=(g=h[0]-f[0])*g+(g=h[1]-f[1])*g;o=y(o,Math.sqrt(m/g)),r=[(d[0]+p[0])/2,(d[1]+p[1])/2],a=[(f[0]+h[0])/2,(f[1]+h[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(v(o,r,a),s.extent,u))}}function M(e,...o){if(this.__zooming){var r,i,a=w(this,o).event(e),s=e.changedTouches,l=s.length;for(Vn(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=s[r],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=_e(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<m)){var c=Ce(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Zn),e!==r?x(e,t,n,o):r.interrupt().each(function(){w(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,a=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(a),l="function"==typeof t?t.apply(this,arguments):t;return i(v(y(o,l),a,s),e,u)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)},null,o)},g.translateTo=function(e,t,n,o,a){g.transform(e,function(){var e=r.apply(this,arguments),a=this.__zoom,s=null==o?b(e):"function"==typeof o?o.apply(this,arguments):o;return i(Fn.translate(s[0],s[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)},o,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Ce(this.that).datum();p.call(e,this.that,new jn(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:p}),t)}},g.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Ln(+e),g):a},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Ln(!!e),g):o},g.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Ln(!!e),g):s},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Ln([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],g):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(f=e,g):f},g.on=function(){var e=p.on.apply(p,arguments);return e===p?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(m=+e,g):m},g}Hn.prototype=Bn.prototype;const Qn=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",Jn=()=>"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.",eo=e=>`Node type "${e}" not found. Using fallback type "default".`,to=()=>"The React Flow parent container needs a width and a height to render the graph.",no=()=>"Only child nodes can use a parent extent.",oo=()=>"Can't create edge. An edge needs a source and a target.",ro=e=>`Marker type "${e}" doesn't exist.`,io=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,ao=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",so=e=>`Edge type "${e}" not found. Using fallback type "default".`,lo=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.`,co=(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.`,uo=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",fo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],po=["Enter"," ","Escape"],ho={"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 mo,go,yo;!function(e){e.Strict="strict",e.Loose="loose"}(mo||(mo={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(go||(go={})),function(e){e.Partial="partial",e.Full="full"}(yo||(yo={}));const vo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var bo,xo,wo;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(bo||(bo={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(xo||(xo={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(wo||(wo={}));const Eo={[wo.Left]:wo.Right,[wo.Right]:wo.Left,[wo.Top]:wo.Bottom,[wo.Bottom]:wo.Top};function ko(e){return null===e?null:e?"valid":"invalid"}const So=e=>"id"in e&&"source"in e&&"target"in e,Co=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_o=(e,t=[0,0])=>{const{width:n,height:o}=er(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},No=(e,t={})=>{if(0===e.size)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(e=>{if(void 0===t.filter||t.filter(e)){const t=Fo(e);n=Io(n,t)}}),jo(n)},Mo=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Ko(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(a&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Vo(s,Bo(t)),d=(r??0)*(c??0),f=i&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&l.push(t)}return l};async function Po({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===e.size)return Promise.resolve(!0);const s=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,a),l=No(s),c=Go(l,t,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function Oo({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},u=a.origin??o;let d=a.extent||r;if("parent"!==a.extent||a.expandParent)s&&Jo(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+c],[a.extent[1][0]+l,a.extent[1][1]+c]]);else if(s){const e=s.measured.width,t=s.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",no());const f=Jo(d)?Ao(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",uo()),{position:{x:f.x-l+(a.measured.width??0)*u[0],y:f.y-c+(a.measured.height??0)*u[1]},positionAbsolute:f}}async function Ro({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),a=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&a.find(t=>t.id===e.parentId);(t||n)&&a.push(e)}const s=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,l),u=c;for(const e of l){s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e)}if(!r)return{edges:u,nodes:a};const d=await r({nodes:a,edges:u});return"boolean"==typeof d?d?{edges:u,nodes:a}:{edges:[],nodes:[]}:d}const $o=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ao=(e={x:0,y:0},t,n)=>({x:$o(e.x,t[0][0],t[1][0]-(n?.width??0)),y:$o(e.y,t[0][1],t[1][1]-(n?.height??0))});function Do(e,t,n){const{width:o,height:r}=er(n),{x:i,y:a}=n.internals.positionAbsolute;return Ao(e,[[i,a],[i+o,a+r]],t)}const To=(e,t,n)=>e<t?$o(Math.abs(e-t),1,t)/t:e>n?-$o(Math.abs(e-n),1,t)/t:0,zo=(e,t,n=15,o=40)=>[To(e.x,o,t.width-o)*n,To(e.y,o,t.height-o)*n],Io=(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)}),Lo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),jo=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Bo=(e,t=[0,0])=>{const{x:n,y:o}=Co(e)?e.internals.positionAbsolute:_o(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}},Fo=(e,t=[0,0])=>{const{x:n,y:o}=Co(e)?e.internals.positionAbsolute:_o(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)}},Ho=(e,t)=>jo(Io(Lo(e),Lo(t))),Vo=(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)},Wo=e=>Yo(e.width)&&Yo(e.height)&&Yo(e.x)&&Yo(e.y),Yo=e=>!isNaN(e)&&isFinite(e),Xo=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Zo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ko=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?Zo(s,a):s},qo=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Uo(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const Go=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Uo(e,n),r=Uo(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Uo(e.top??e.y??0,n),r=Uo(e.bottom??e.y??0,n),i=Uo(e.left??e.x??0,t),a=Uo(e.right??e.x??0,t);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-a.x)/e.width,l=(n-a.y)/e.height,c=Math.min(s,l),u=$o(c,o,r),d=t/2-(e.x+e.width/2)*u,f=n/2-(e.y+e.height/2)*u,p=function(e,t,n,o,r,i){const{x:a,y:s}=qo(e,[t,n,o]),{x:l,y:c}=qo({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,f,u,t,n),h=Math.min(p.left-a.left,0),m=Math.min(p.top-a.top,0);return{x:d-h+Math.min(p.right-a.right,0),y:f-m+Math.min(p.bottom-a.bottom,0),zoom:u}},Qo=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Jo(e){return null!=e&&"parent"!==e}function er(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function tr(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function nr(e,t={width:0,height:0},n,o,r){const i={...e},a=o.get(n);if(a){const e=a.origin||r;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function or(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rr(e){return{...ho,...e||{}}}function ir(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=dr(e),s=Ko({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?Zo(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const ar=e=>({width:e.offsetWidth,height:e.offsetHeight}),sr=e=>e?.getRootNode?.()||window?.document,lr=["INPUT","SELECT","TEXTAREA"];function cr(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return lr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ur=e=>"clientX"in e,dr=(e,t)=>{const n=ur(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},fr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...ar(t)}}):null};function pr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const l=.125*e+.375*r+.375*a+.125*n,c=.125*t+.375*i+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function hr(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function mr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case wo.Left:return[t-hr(t-o,i),n];case wo.Right:return[t+hr(o-t,i),n];case wo.Top:return[t,n-hr(n-r,i)];case wo.Bottom:return[t,n+hr(r-n,i)]}}function gr({sourceX:e,sourceY:t,sourcePosition:n=wo.Bottom,targetX:o,targetY:r,targetPosition:i=wo.Top,curvature:a=.25}){const[s,l]=mr({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=mr({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,f,p,h]=pr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${o},${r}`,d,f,p,h]}function yr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,a=Math.abs(o-t)/2;return[i,o<t?o+a:o-a,r,a]}function vr({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Io(Fo(e),Fo(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Vo(a,jo(i))>0}const br=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,xr=(e,t)=>{if(!e.source||!e.target)return Xo("006",oo()),t;let n;return n=So(e)?{...e}:{...e,id:br(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))};function wr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=yr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const Er={[wo.Left]:{x:-1,y:0},[wo.Right]:{x:1,y:0},[wo.Top]:{x:0,y:-1},[wo.Bottom]:{x:0,y:1}},kr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Sr({source:e,sourcePosition:t=wo.Bottom,target:n,targetPosition:o=wo.Top,center:r,offset:i,stepPosition:a}){const s=Er[t],l=Er[o],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=(({source:e,sourcePosition:t=wo.Bottom,target:n})=>t===wo.Left||t===wo.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:u}),f=0!==d.x?"x":"y",p=d[f];let h,m,g=[];const y={x:0,y:0},v={x:0,y:0},[,,b,x]=yr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*l[f]===-1){"x"===f?(h=r.x??c.x+(u.x-c.x)*a,m=r.y??(c.y+u.y)/2):(h=r.x??(c.x+u.x)/2,m=r.y??c.y+(u.y-c.y)*a);const e=[{x:h,y:c.y},{x:h,y:u.y}],t=[{x:c.x,y:m},{x:u.x,y:m}];g=s[f]===p?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:u.y}],a=[{x:u.x,y:c.y}];if(g="x"===f?s.x===p?a:r:s.y===p?r:a,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);s[f]===p?y[f]=(c[f]>e[f]?-1:1)*o:v[f]=(u[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=s[f]===l[e],n=c[e]>u[e],o=c[e]<u[e];(1===s[f]&&(!t&&n||t&&o)||1!==s[f]&&(!t&&o||t&&n))&&(g="x"===f?r:a)}const d={x:c.x+y.x,y:c.y+y.y},b={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-g[0].x),Math.abs(b.x-g[0].x))>=Math.max(Math.abs(d.y-g[0].y),Math.abs(b.y-g[0].y))?(h=(d.x+b.x)/2,m=g[0].y):(h=g[0].x,m=(d.y+b.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...g,{x:u.x+v.x,y:u.y+v.y},n],h,m,b,x]}function Cr({sourceX:e,sourceY:t,sourcePosition:n=wo.Bottom,targetX:o,targetY:r,targetPosition:i=wo.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,p,h,m]=Sr({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:l},offset:c,stepPosition:u}),g=d.reduce((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(kr(e,t)/2,kr(t,n)/2,o),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a)return`L ${i+r*(e.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${a+r*(e.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},"");return[g,f,p,h,m]}function _r(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Nr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function Mr(e,t,n=wo.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??er(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case wo.Top:return{x:r+a/2,y:i};case wo.Right:return{x:r+a,y:i+s/2};case wo.Bottom:return{x:r+a/2,y:i+s};case wo.Left:return{x:r,y:i+s/2}}}function Pr(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Or(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}const Rr={nodeOrigin:[0,0],nodeExtent:fo,elevateNodesOnSelect:!0,defaults:{}},$r={...Rr,checkEquality:!0};function Ar(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Dr(e,t,n,o){const r=Ar($r,o);let i=e.length>0;const a=new Map(t),s=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let e=a.get(l.id);if(r.checkEquality&&l===e?.internals.userNode)t.set(l.id,e);else{const n=_o(l,r.nodeOrigin),o=Jo(l.extent)?l.extent:r.nodeExtent,i=Ao(n,o,er(l));e={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:l.measured?e?.internals.handleBounds:void 0,z:zr(l,s),userNode:l}},t.set(l.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(i=!1),l.parentId&&Tr(e,t,n,o)}return i}function Tr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=Ar(Rr,o),s=e.parentId,l=t.get(s);if(!l)return void console.warn(`Parent node ${s} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(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]]))}(e,n);const c=r?1e3:0,{x:u,y:d,z:f}=function(e,t,n,o,r){const{x:i,y:a}=t.internals.positionAbsolute,s=er(e),l=_o(e,n),c=Jo(e.extent)?Ao(l,e.extent,s):l;let u=Ao({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=Do(u,s,t));const d=zr(e,r),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=d?f+1:d}}(e,l,i,a,c),{positionAbsolute:p}=e.internals,h=u!==p.x||d!==p.y;(h||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:u,y:d}:p,z:f}})}function zr(e,t){return(Yo(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ir(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Bo(e),r=Ho(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{const s=i.internals.positionAbsolute,l=er(i),c=i.origin??o,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),p=Math.max(l.height,Math.round(t.height)),h=(f-l.width)*c[0],m=(p-l.height)*c[1];(u>0||d>0||h||m)&&(r.push({id:a,type:"position",position:{x:i.position.x-u+h,y:i.position.y-d+m}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})})),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:f+(u?c[0]*u-h:0),height:p+(d?c[1]*d-m:0)}})}),r}function Lr(e,t,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,t)),a=`${r}-${e}`;const l=o.get(a)||new Map;if(o.set(a,l.set(n,t)),i){a=`${r}-${e}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,t))}}function jr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${r}-${a}`;Lr("source",s,`${r}-${a}--${n}-${i}`,e,n,i),Lr("target",s,l,e,r,a),t.set(o.id,o)}}function Br(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Br(n,t))}function Fr(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 Hr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Vr({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,p=!1,h=!1,m=null;return{update:function({noDragClassName:g,handleSelector:y,domNode:v,isSelectable:b,nodeId:x,nodeClickDistance:w=0}){function E({x:e,y:n}){const{nodeLookup:r,nodeExtent:a,snapGrid:l,snapToGrid:c,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();i={x:e,y:n};let y=!1;const v=s.size>1,b=v&&a?Lo(No(s)):null,w=v&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},a=Zo(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(const[t,o]of s){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=w?{x:Math.round(i.x+w.x),y:Math.round(i.y+w.y)}:Zo(i,l));let s=null;if(v&&a&&!o.extent&&b){const{positionAbsolute:e}=o.internals,t=e.x-b.x+a[0][0],n=e.x+o.measured.width-b.x2+a[1][0];s=[[t,e.y-b.y+a[0][1]],[n,e.y+o.measured.height-b.y2+a[1][1]]]}const{position:d,positionAbsolute:f}=Oo({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:s||a,nodeOrigin:u,onError:p});y=y||o.position.x!==d.x||o.position.y!==d.y,o.position=d,o.internals.positionAbsolute=f}if(h=h||y,y&&(g(s,!0),m&&(o||d||!x&&f))){const[e,t]=Hr({nodeId:x,dragItems:s,nodeLookup:r});o?.(m,s,e,t),d?.(m,e,t),x||f?.(m,t)}}async function k(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(a);const[s,d]=zo(c,u,o);0===s&&0===d||(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-d/e[2],await n({x:s,y:d})&&E(i)),a=requestAnimationFrame(k)}function S(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:p,selectNodesOnDrag:h,onNodeDragStart:m,onSelectionDragStart:g,unselectNodesAndEdges:y}=t();d=!0,h&&b||a||!x||r.get(x)?.selected||y(),b&&h&&x&&e?.(x);const v=ir(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:p,containerBounds:u});if(i=v,s=function(e,t,n,o){const r=new Map;for(const[i,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!Br(a,e))&&(a.draggable||t&&void 0===a.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,v,x),s.size>0&&(n||m||!x&&g)){const[e,t]=Hr({nodeId:x,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),m?.(o.sourceEvent,e,t),x||g?.(o.sourceEvent,t)}}f=Ce(v);const C=je().clickDistance(w).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,h=!1,m=e.sourceEvent,0===o&&S(e);const l=ir(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=dr(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:f,nodeLookup:h}=t(),g=ir(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:u});if(m=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||x&&!h.has(x))&&(p=!0),!p){if(!l&&n&&d&&(l=!0,k()),!d){const t=g.xSnapped-(i.x??0),n=g.ySnapped-(i.y??0);Math.sqrt(t*t+n*n)>f&&S(e)}(i.x!==g.xSnapped||i.y!==g.ySnapped)&&s&&d&&(c=dr(e.sourceEvent,u),E(g))}}).on("end",e=>{if(d&&!p&&(l=!1,d=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=t();if(h&&(o(s,!1),h=!1),r||i||!x&&a){const[t,o]=Hr({nodeId:x,dragItems:s,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,s,t,o),i?.(e.sourceEvent,t,o),x||a?.(e.sourceEvent,o)}}}).filter(e=>{const t=e.target;return!e.button&&(!g||!Fr(t,`.${g}`,v))&&(!y||Fr(t,y,v))});f.call(C)},destroy:function(){f?.on(".drag",null)}}}function Wr(e,t,n,o){let r=[],i=1/0;const a=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Vo(r,Bo(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:l}=Mr(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...s,x:a,y:l}],i=c):c===i&&r.push({...s,x:a,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}function Yr(e,t,n,o,r,i=!1){const a=o.get(e);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...Mr(a,l,l.position,!0)}:l}function Xr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Zr=()=>!0;function Kr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=Zr,nodeLookup:u}){const d="target"===i,f=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=dr(e),m=a.elementFromPoint(p,h),g=m?.classList.contains(`${s}-flow__handle`)?m:f,y={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const e=Xr(void 0,g),t=g.getAttribute("data-nodeid"),i=g.getAttribute("data-handleid"),a=g.classList.contains("connectable"),s=g.classList.contains("connectableend");if(!t||!e)return y;const l={source:d?t:o,sourceHandle:d?i:r,target:d?o:t,targetHandle:d?r:i};y.connection=l;const f=a&&s&&(n===mo.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Yr(t,e,i,u,n,!0)}return y}const qr={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:h,onConnect:m,onConnectEnd:g,isValidConnection:y=Zr,onReconnectEnd:v,updateConnection:b,getTransform:x,getFromHandle:w,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:S}){const C=sr(e.target);let _,N=0;const{x:M,y:P}=dr(e),O=Xr(i,S),R=s?.getBoundingClientRect();let $=!1;if(!R||!O)return;const A=Yr(r,O,o,l,t);if(!A)return;let D=dr(e,R),T=!1,z=null,I=!1,L=null;function j(){if(!u||!R)return;const[e,t]=zo(D,R,E);f({x:e,y:t}),N=requestAnimationFrame(j)}const B={...A,nodeId:r,type:O,position:A.position},F=l.get(r);let H={inProgress:!0,isValid:null,from:Mr(F,B,wo.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:F,to:D,toHandle:null,toPosition:Eo[B.position],toNode:null};function V(){$=!0,b(H),h?.(e,{nodeId:r,handleId:o,handleType:O})}function W(e){if(!$){const{x:t,y:n}=dr(e),o=t-M,r=n-P;if(!(o*o+r*r>k*k))return;V()}if(!w()||!B)return void Y(e);const i=x();D=dr(e,R),_=Wr(Ko(D,i,!1,[1,1]),n,l,B),T||(j(),T=!0);const s=Kr(e,{handle:_,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:d,nodeLookup:l});L=s.handleDomNode,z=s.connection,I=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!_,s.isValid);const u={...H,isValid:I,to:s.toHandle&&I?qo({x:s.toHandle.x,y:s.toHandle.y},i):D,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:Eo[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};I&&_&&H.toHandle&&u.toHandle&&H.toHandle.type===u.toHandle.type&&H.toHandle.nodeId===u.toHandle.nodeId&&H.toHandle.id===u.toHandle.id&&H.to.x===u.to.x&&H.to.y===u.to.y||(b(u),H=u)}function Y(e){if($){(_||L)&&z&&I&&m?.(z);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};g?.(e,o),i&&v?.(e,o)}p(),cancelAnimationFrame(N),T=!1,I=!1,z=null,L=null,C.removeEventListener("mousemove",W),C.removeEventListener("mouseup",Y),C.removeEventListener("touchmove",W),C.removeEventListener("touchend",Y)}0===k&&V(),C.addEventListener("mousemove",W),C.addEventListener("mouseup",Y),C.addEventListener("touchmove",W),C.addEventListener("touchend",Y)},isValid:Kr};const Ur=e=>({x:e.x,y:e.y,zoom:e.k}),Gr=({x:e,y:t,zoom:n})=>Fn.translate(e,t).scale(n),Qr=(e,t)=>e.target.closest(`.${t}`),Jr=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),ei=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ti=(e,t=0,n=ei,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ni=e=>{const t=e.ctrlKey&&Qo()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function oi({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Gn().clickDistance(!Yo(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),p=Ce(e).call(f);v({x:i.x,y:i.y,zoom:$o(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=p.on("wheel.zoom"),m=p.on("dblclick.zoom");function g(e,t){return p?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?$t:Vt).transform(ti(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function y(){f.on("zoom",null)}async function v(e,t,n){const o=Gr(e),r=f?.constrain()(o,t,n);return r&&await g(r),new Promise(e=>e(r))}return f.wheelDelta(ni),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:i,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:b,zoomOnScroll:x,zoomOnDoubleClick:w,zoomActivationKeyPressed:E,lib:k,onTransformChange:S}){o&&!u.isZoomingOrPanning&&y();const C=r&&!E&&!o?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Qr(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=_e(u),t=ni(u),r=d*Math.pow(2,t);return void o.scaleTo(n,r,e,u)}const f=1===u.deltaMode?20:1;let p=r===go.Vertical?0:u.deltaX*f,h=r===go.Horizontal?0:u.deltaY*f;!Qo()&&u.shiftKey&&r!==go.Vertical&&(p=u.deltaY*f,h=0),o.translateBy(n,-p/d*i,-h/d*i,{internal:!0});const m=Ur(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,s?.(u,m)),e.isPanScrolling&&(l?.(u,m),e.panScrollTimeout=setTimeout(()=>{c?.(u,m),e.isPanScrolling=!1},150))}}({zoomPanValues:u,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:b,onPanZoomStart:s,onPanZoom:a,onPanZoomEnd:l}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!t&&i&&!o.ctrlKey,s=Qr(o,e);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:h});if(p.on("wheel.zoom",C,{passive:!1}),!o){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Ur(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});f.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Jr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Ur(i.transform))}}({zoomPanValues:u,panOnDrag:i,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:S});f.on("zoom",t);const o=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{var s,l;if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Jr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&(s=e.prevViewport,l=a.transform,s.x!==l.x||s.y!==l.y||s.zoom!==l.k))){const t=Ur(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(a.sourceEvent,t)},n?150:0)}}}({zoomPanValues:u,panOnDrag:i,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:l,onDraggingChange:c});f.on("end",o)}const _=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:c}){return u=>{const d=e||t,f=n&&u.ctrlKey;if(1===u.button&&"mousedown"===u.type&&(Qr(u,`${c}-flow__node`)||Qr(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(Qr(u,s)&&"wheel"===u.type)return!1;if(Qr(u,l)&&("wheel"!==u.type||r&&"wheel"===u.type&&!e))return!1;if(!n&&u.ctrlKey&&"wheel"===u.type)return!1;if(!n&&"touchstart"===u.type&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!r&&!f&&"wheel"===u.type)return!1;if(!o&&("mousedown"===u.type||"touchstart"===u.type))return!1;if(Array.isArray(o)&&!o.includes(u.button)&&"mousedown"===u.type)return!1;const p=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||"wheel"===u.type)&&p}}({zoomActivationKeyPressed:E,panOnDrag:i,zoomOnScroll:x,panOnScroll:r,zoomOnDoubleClick:w,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:k});f.filter(_),w?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)},destroy:y,setViewport:async function(e,t){const n=Gr(e);return await g(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){const e=p?Hn(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return p?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?$t:Vt).scaleTo(ti(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return p?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?$t:Vt).scaleBy(ti(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){f?.scaleExtent(e)},setTranslateExtent:function(e){f?.translateExtent(e)},syncViewport:function(e){if(p){const t=Gr(e),n=p.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||f?.transform(p,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Yo(e)||e<0?0:e;f?.clickDistance(t)}}}var ri;function ii(e,t){return Math.max(0,t-e)}function ai(e,t){return Math.max(0,e-t)}function si(e,t,n){return Math.max(0,t-e,e-n)}function li(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(ri||(ri={}));const ci={width:0,height:0,x:0,y:0},ui={...ci,pointerX:0,pointerY:0,aspectRatio:1};function di(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[o-s,r-l],[o+i-s,r+a-l]]}function fi({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Ce(e);return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:s,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:f}){let p={...ci},h={...ui};const m=function(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}(e);let g,y,v,b,x=null,w=[];const E=je().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(g=o.get(t),!g)return;x=l?.getBoundingClientRect()??null;const{xSnapped:u,ySnapped:d}=ir(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:x});p={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...p,pointerX:u,pointerY:d,aspectRatio:p.width/p.height},y=void 0,g.parentId&&("parent"===g.extent||g.expandParent)&&(y=o.get(g.parentId),v=y&&"parent"===g.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),w=[],b=void 0;for(const[e,n]of o)if(n.parentId===t&&(w.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=di(n,g,n.origin??s);b=b?[[Math.min(e[0][0],b[0][0]),Math.min(e[0][1],b[0][1])],[Math.max(e[1][0],b[1][0]),Math.max(e[1][1],b[1][1])]]:e}c?.(e,{...p})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:c}=n(),d=ir(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:x}),E=[];if(!g)return;const{x:k,y:S,width:C,height:_}=p,N={},M=g.origin??c,{width:P,height:O,x:R,y:$}=function(e,t,n,o,r,i,a,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:h}=n,{minWidth:m,maxWidth:g,minHeight:y,maxHeight:v}=o,{x:b,y:x,width:w,height:E,aspectRatio:k}=e;let S=Math.floor(u?p-e.pointerX:0),C=Math.floor(d?h-e.pointerY:0);const _=w+(l?-S:S),N=E+(c?-C:C),M=-i[0]*w,P=-i[1]*E;let O=si(_,m,g),R=si(N,y,v);if(a){let e=0,t=0;l&&S<0?e=ii(b+S+M,a[0][0]):!l&&S>0&&(e=ai(b+_+M,a[1][0])),c&&C<0?t=ii(x+C+P,a[0][1]):!c&&C>0&&(t=ai(x+N+P,a[1][1])),O=Math.max(O,e),R=Math.max(R,t)}if(s){let e=0,t=0;l&&S>0?e=ai(b+S,s[0][0]):!l&&S<0&&(e=ii(b+_,s[1][0])),c&&C>0?t=ai(x+C,s[0][1]):!c&&C<0&&(t=ii(x+N,s[1][1])),O=Math.max(O,e),R=Math.max(R,t)}if(r){if(u){const e=si(_/k,y,v)*k;if(O=Math.max(O,e),a){let e=0;e=!l&&!c||l&&!c&&f?ai(x+P+_/k,a[1][1])*k:ii(x+P+(l?S:-S)/k,a[0][1])*k,O=Math.max(O,e)}if(s){let e=0;e=!l&&!c||l&&!c&&f?ii(x+_/k,s[1][1])*k:ai(x+(l?S:-S)/k,s[0][1])*k,O=Math.max(O,e)}}if(d){const e=si(N*k,m,g)/k;if(R=Math.max(R,e),a){let e=0;e=!l&&!c||c&&!l&&f?ai(b+N*k+M,a[1][0])/k:ii(b+(c?C:-C)*k+M,a[0][0])/k,R=Math.max(R,e)}if(s){let e=0;e=!l&&!c||c&&!l&&f?ii(b+N*k,s[1][0])/k:ai(b+(c?C:-C)*k,s[0][0])/k,R=Math.max(R,e)}}}C+=C<0?R:-R,S+=S<0?O:-O,r&&(f?_>N*k?C=(li(l,c)?-S:S)/k:S=(li(l,c)?-C:C)*k:u?(C=S/k,c=l):(S=C*k,l=c));const $=l?b+S:b,A=c?x+C:x;return{width:w+(l?-S:S),height:E+(c?-C:C),x:i[0]*S*(l?-1:1)+$,y:i[1]*C*(c?-1:1)+A}}(h,m,d,a,s,M,v,b),A=P!==C,D=O!==_,T=R!==k&&A,z=$!==S&&D;if(!(T||z||A||D))return;if((T||z||1===M[0]||1===M[1])&&(N.x=T?R:p.x,N.y=z?$:p.y,p.x=N.x,p.y=N.y,w.length>0)){const e=R-k,t=$-S;for(const n of w)n.position={x:n.position.x-e+M[0]*(P-C),y:n.position.y-t+M[1]*(O-_)},E.push(n)}if((A||D)&&(N.width=!A||l&&"horizontal"!==l?p.width:P,N.height=!D||l&&"vertical"!==l?p.height:O,p.width=N.width,p.height=N.height),y&&g.expandParent){const e=M[0]*(N.width??0);N.x&&N.x<e&&(p.x=e,h.x=h.x-(N.x-e));const t=M[1]*(N.height??0);N.y&&N.y<t&&(p.y=t,h.y=h.y-(N.y-t))}const I=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=e-t,s=n-o,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:p.width,prevWidth:C,height:p.height,prevHeight:_,affectsX:m.affectsX,affectsY:m.affectsY}),L={...p,direction:I},j=f?.(e,L);!1!==j&&(u?.(e,L),o(N,E))}).on("end",e=>{d?.(e,{...p}),r?.({...p})});i.call(E)},destroy:function(){i.on(".drag",null)}}}function pi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hi,mi={exports:{}},gi={},yi={exports:{}},vi={};var bi,xi,wi,Ei={};function ki(){return xi||(xi=1,"production"===process.env.NODE_ENV?yi.exports=function(){if(hi)return vi;hi=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,r=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var o=t();return!n(e,o)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=o({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,s(c)&&u({inst:c})},[e,n,t]),r(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),a(n),n};return vi.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,vi}():yi.exports=(bi||(bi=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=e,o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,i=n.useEffect,a=n.useLayoutEffect,s=n.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,u){l||void 0===n.startTransition||(l=!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 d=u();if(!c){var f=u();o(d,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=r({inst:{value:d,getSnapshot:u}}))[0].inst,h=f[1];return a(function(){p.value=d,p.getSnapshot=u,t(p)&&h({inst:p})},[e,d,u]),i(function(){return t(p)&&h({inst:p}),e(function(){t(p)&&h({inst:p})})},[e]),s(d),d};Ei.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ei)),yi.exports}var Si,Ci={};"production"===process.env.NODE_ENV?mi.exports=function(){if(wi)return gi;wi=1;var t=e,n=ki(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=t.useRef,a=t.useEffect,s=t.useMemo,l=t.useDebugValue;return gi.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var p=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},gi}():mi.exports=(Si||(Si=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=e,n=ki(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=t.useRef,a=t.useEffect,s=t.useMemo,l=t.useDebugValue;Ci.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var p=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ci);var _i=pi(mi.exports);const Ni=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{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()}},a=t=e(o,r,i);return i},{useDebugValue:Mi}=e,{useSyncExternalStoreWithSelector:Pi}=_i,Oi=e=>e;function Ri(e,t=Oi,n){const o=Pi(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Mi(o),o}const $i=(e,t)=>{const n=(e=>e?Ni(e):Ni)(e),o=(e,o=t)=>Ri(n,e,o);return Object.assign(o,n),o};function Ai(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Di=e.createContext(null),Ti=Di.Provider,zi=Qn();function Ii(t,n){const o=e.useContext(Di);if(null===o)throw new Error(zi);return Ri(o,t,n)}function Li(){const t=e.useContext(Di);if(null===t)throw new Error(zi);return e.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const ji={display:"none"},Bi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fi="react-flow__node-desc",Hi="react-flow__edge-desc",Vi=e=>e.ariaLiveMessage,Wi=e=>e.ariaLabelConfig;function Yi({rfId:e}){const n=Ii(Vi);return t.jsx("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Bi,children:n})}function Xi({rfId:e,disableKeyboardA11y:n}){const o=Ii(Wi);return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:`${Fi}-${e}`,style:ji,children:n?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),t.jsx("div",{id:`${Hi}-${e}`,style:ji,children:o["edge.a11yDescription.default"]}),!n&&t.jsx(Yi,{rfId:e})]})}const Zi=e.forwardRef(({position:e="top-left",children:n,className:o,style:r,...i},a)=>{const l=`${e}`.split("-");return t.jsx("div",{className:s(["react-flow__panel",o,...l]),style:r,ref:a,...i,children:n})});function Ki({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(Zi,{position:n,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"})})}Zi.displayName="Panel";const qi=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Ui=e=>e.id;function Gi(e,t){return Ai(e.selectedNodes.map(Ui),t.selectedNodes.map(Ui))&&Ai(e.selectedEdges.map(Ui),t.selectedEdges.map(Ui))}function Qi({onSelectionChange:t}){const n=Li(),{selectedNodes:o,selectedEdges:r}=Ii(qi,Gi);return e.useEffect(()=>{const e={nodes:o,edges:r};t?.(e),n.getState().onSelectionChangeHandlers.forEach(t=>t(e))},[o,r,t]),null}const Ji=e=>!!e.onSelectionChangeHandlers;function ea({onSelectionChange:e}){const n=Ii(Ji);return e||n?t.jsx(Qi,{onSelectionChange:e}):null}const ta=[0,0],na={x:0,y:0,zoom:1},oa=["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"],ra=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}),ia={translateExtent:fo,nodeOrigin:ta,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function aa(t){const{setNodes:n,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=Ii(ra,Ai),d=Li();e.useEffect(()=>(c(t.defaultNodes,t.defaultEdges),()=>{f.current=ia,l()}),[]);const f=e.useRef(ia);return e.useEffect(()=>{for(const e of oa){const l=t[e];l!==f.current[e]&&(void 0!==t[e]&&("nodes"===e?n(l):"edges"===e?o(l):"minZoom"===e?r(l):"maxZoom"===e?i(l):"translateExtent"===e?a(l):"nodeExtent"===e?s(l):"paneClickDistance"===e?u(l):"ariaLabelConfig"===e?d.setState({ariaLabelConfig:rr(l)}):"fitView"===e?d.setState({fitViewQueued:l}):"fitViewOptions"===e?d.setState({fitViewOptions:l}):d.setState({[e]:l})))}f.current=t},oa.map(e=>t[e])),null}function sa(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const la="undefined"!=typeof document?document:null;function ca(t=null,n={target:la,actInsideInputWithModifier:!0}){const[o,r]=e.useState(!1),i=e.useRef(!1),a=e.useRef(new Set([])),[s,l]=e.useMemo(()=>{if(null!==t){const e=(Array.isArray(t)?t:[t]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=e.reduce((e,t)=>e.concat(...t),[]);return[e,n]}return[[],[]]},[t]);return e.useEffect(()=>{const e=n?.target??la,o=n?.actInsideInputWithModifier??!0;if(null!==t){const t=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!o)&&cr(e))return!1;const t=da(e.code,l);if(a.current.add(e[t]),ua(s,a.current,!1)){const t=e.composedPath?.()?.[0]||e.target,o="BUTTON"===t?.nodeName||"A"===t?.nodeName;!1===n.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},c=e=>{const t=da(e.code,l);ua(s,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return e?.addEventListener("keydown",t),e?.addEventListener("keyup",c),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{e?.removeEventListener("keydown",t),e?.removeEventListener("keyup",c),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[t,r]),o}function ua(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function da(e,t){return t.includes(e)?"code":"key"}function fa(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)pa(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function pa(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":var n;if(void 0!==e.dimensions)(n=t).measured??(n.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height));"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function ha(e,t){return fa(e,t)}function ma(e,t){return fa(e,t)}function ga(e,t){return{id:e,type:"select",selected:t}}function ya(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ga(i.id,e)))}return o}function va({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function ba(e){return{id:e.id,type:"remove"}}const xa=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function wa(t){return e.forwardRef(t)}const Ea="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function ka(t){const[n,o]=e.useState(BigInt(0)),[r]=e.useState(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>o(e=>e+BigInt(1))));return Ea(()=>{const e=r.get();e.length&&(t(e),r.reset())},[n]),r}const Sa=e.createContext(null);function Ca({children:n}){const o=Li(),r=e.useCallback(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=va({items:l,lookup:a});r&&n(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)})},[]),i=ka(r),a=e.useCallback(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=o.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?n(s):i&&i(va({items:s,lookup:a}))},[]),s=ka(a),l=e.useMemo(()=>({nodeQueue:i,edgeQueue:s}),[]);return t.jsx(Sa.Provider,{value:l,children:n})}const _a=e=>!!e.panZoom;function Na(){const t=(()=>{const t=Li();return e.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:o}=t.getState();return o?o.scaleTo(e,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[o,r,i],panZoom:a}=t.getState();return a?(await a.setViewport({x:e.x??o,y:e.y??r,zoom:e.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,o]=t.getState().transform;return{x:e,y:n,zoom:o}},setCenter:async(e,n,o)=>t.getState().setCenter(e,n,o),fitBounds:async(e,n)=>{const{width:o,height:r,minZoom:i,maxZoom:a,panZoom:s}=t.getState(),l=Go(e,o,r,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:a}=t.getState();if(!a)return e;const{x:s,y:l}=a.getBoundingClientRect(),c={x:e.x-s,y:e.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Ko(c,o,d,u)},flowToScreenPosition:e=>{const{transform:n,domNode:o}=t.getState();if(!o)return e;const{x:r,y:i}=o.getBoundingClientRect(),a=qo(e,n);return{x:a.x+r,y:a.y+i}}}),[])})(),n=Li(),o=function(){const t=e.useContext(Sa);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}(),r=Ii(_a),i=e.useMemo(()=>{const e=e=>n.getState().nodeLookup.get(e),t=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState(),r=xa(e)?e:t.get(e.id),i=r.parentId?nr(r.position,r.measured,r.parentId,t,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Bo(a)},a=(e,n,o={replace:!1})=>{t(t=>t.map(t=>{if(t.id===e){const e="function"==typeof n?n(t):n;return o.replace&&xa(e)?e:{...t,...e}}return t}))},s=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&So(e)?e:{...o,...e}}return o}))};return{getNodes:()=>n.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=n.getState();return e.map(e=>({...e}))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:t=[],transform:o}=n.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:t=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=n.getState(),{nodes:d,edges:f}=await Ro({nodesToRemove:e,edgesToRemove:t,nodes:o,edges:r,onBeforeDelete:u}),p=f.length>0,h=d.length>0;if(p){const e=f.map(ba);a?.(f),l(e)}if(h){const e=d.map(ba);i?.(d),s(e)}return(h||p)&&c?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,t=!0,o)=>{const r=Wo(e),a=r?e:i(e),s=void 0!==o;return a?(o||n.getState().nodes).filter(o=>{const i=n.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Bo(s?o:i),c=Vo(l,a);return t&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Wo(e)?e:i(e);if(!o)return!1;const r=Vo(o,t);return n&&r>0||r>=o.width*o.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState();return((e,t={nodeOrigin:[0,0]})=>{if("development"!==process.env.NODE_ENV||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."),0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):Co(n)?n:t.nodeLookup.get(n.id));const i=r?Fo(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Io(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return jo(n)})(e,{nodeLookup:t,nodeOrigin:o})},getHandleConnections:({type:e,id:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}-${e}${t?`-${t}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}${e?t?`-${e}-${t}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const t=n.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:t}),o.nodeQueue.push(e=>[...e]),t.promise}}},[]);return e.useMemo(()=>({...i,...t,viewportInitialized:r}),[r])}const Ma=e=>e.selected,Pa="undefined"!=typeof window?window:void 0;const Oa={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ra=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function $a({onPaneContextMenu:n,zoomOnScroll:o=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=go.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:f,maxZoom:p,zoomActivationKeyCode:h,preventScrolling:m=!0,children:g,noWheelClassName:y,noPanClassName:v,onViewportChange:b,isControlledViewport:x,paneClickDistance:w}){const E=Li(),k=e.useRef(null),{userSelectionActive:S,lib:C}=Ii(Ra,Ai),_=ca(h),N=e.useRef();!function(t){const n=Li();e.useEffect(()=>{const e=()=>{if(!t.current)return!1;const e=ar(t.current);0!==e.height&&0!==e.width||n.getState().onError?.("004",to()),n.setState({width:e.width||500,height:e.height||500})};if(t.current){e(),window.addEventListener("resize",e);const n=new ResizeObserver(()=>e());return n.observe(t.current),()=>{window.removeEventListener("resize",e),n&&t.current&&n.unobserve(t.current)}}},[])}(k);const M=e.useCallback(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),x||E.setState({transform:e})},[b,x]);return e.useEffect(()=>{if(k.current){N.current=oi({domNode:k.current,minZoom:f,maxZoom:p,translateExtent:d,viewport:u,paneClickDistance:w,onDraggingChange:e=>E.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=E.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=E.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=E.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=N.current.getViewport();return E.setState({panZoom:N.current,transform:[e,t,n],domNode:k.current.closest(".react-flow")}),()=>{N.current?.destroy()}}},[]),e.useEffect(()=>{N.current?.update({onPaneContextMenu:n,zoomOnScroll:o,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:_,preventScrolling:m,noPanClassName:v,userSelectionActive:S,noWheelClassName:y,lib:C,onTransformChange:M})},[n,o,r,i,a,s,l,c,_,m,v,S,y,C,M]),t.jsx("div",{className:"react-flow__renderer",ref:k,style:Oa,children:g})}const Aa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Da(){const{userSelectionActive:e,userSelectionRect:n}=Ii(Aa,Ai);return e&&n?t.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ta=(e,t)=>n=>{n.target===t.current&&e?.(n)},za=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Ia({isSelecting:n,selectionKeyPressed:o,selectionMode:r=yo.Full,panOnDrag:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:p,onPaneMouseMove:h,onPaneMouseLeave:m,children:g}){const y=Li(),{userSelectionActive:v,elementsSelectable:b,dragging:x,connectionInProgress:w}=Ii(za,Ai),E=b&&(n||v),k=e.useRef(null),S=e.useRef(),C=e.useRef(new Set),_=e.useRef(new Set),N=e.useRef(!1),M=e.useRef(!1),P=e=>{N.current||w?N.current=!1:(u?.(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1}))},O=f?e=>f(e):void 0,R=!0===i||Array.isArray(i)&&i.includes(0);return t.jsxs("div",{className:s(["react-flow__pane",{draggable:R,dragging:x,selection:n}]),onClick:E?void 0:Ta(P,k),onContextMenu:Ta(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():d?.(e)},k),onWheel:Ta(O,k),onPointerEnter:E?void 0:p,onPointerDown:E?e=>{const{resetSelectedElements:t,domNode:o}=y.getState();if(S.current=o?.getBoundingClientRect(),!b||!n||0!==e.button||e.target!==k.current||!S.current)return;e.target?.setPointerCapture?.(e.pointerId),M.current=!0,N.current=!1;const{x:r,y:i}=dr(e.nativeEvent,S.current);t(),y.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),l?.(e)}:h,onPointerMove:E?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:i,connectionLookup:a,triggerNodeChanges:s,triggerEdgeChanges:l,defaultEdgeOptions:c}=y.getState();if(!S.current||!t)return;N.current=!0;const{x:u,y:d}=dr(e.nativeEvent,S.current),{startX:f,startY:p}=t,h={startX:f,startY:p,x:u<f?u:f,y:d<p?d:p,width:Math.abs(u-f),height:Math.abs(d-p)},m=C.current,g=_.current;C.current=new Set(Mo(o,h,n,r===yo.Partial,!0).map(e=>e.id)),_.current=new Set;const v=c?.selectable??!0;for(const e of C.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??v)&&_.current.add(e)}}if(!or(m,C.current)){s(ya(o,C.current,!0))}if(!or(g,_.current)){l(ya(i,_.current))}y.setState({userSelectionRect:h,userSelectionActive:!0,nodesSelectionActive:!1})}:h,onPointerUp:E?e=>{if(0!==e.button||!M.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=y.getState();!v&&t&&e.target===k.current&&P?.(e),y.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:C.current.size>0}),c?.(e),(o||a)&&(N.current=!1),M.current=!1}:void 0,onPointerLeave:m,ref:k,style:Oa,children:[g,t.jsx(Da,{})]})}function La({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&a)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",lo(e))}function ja({nodeRef:t,disabled:n=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Li(),[c,u]=e.useState(!1),d=e.useRef();return e.useEffect(()=>{d.current=Vr({getStoreItems:()=>l.getState(),onNodeMouseDown:e=>{La({id:e,store:l,nodeRef:t})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),e.useEffect(()=>{if(n)d.current?.destroy();else if(t.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:t.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[o,r,n,a,t,i]),c}function Ba(){const t=Li(),n=e.useCallback(e=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=t.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,p=o?r[1]:5,h=e.direction.x*f*e.factor,m=e.direction.y*p*e.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+h,y:e.internals.positionAbsolute.y+m};o&&(t=Zo(t,r));const{position:i,positionAbsolute:s}=Oo({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:a});e.position=i,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[]);return n}const Fa=e.createContext(null),Ha=Fa.Provider;Fa.Consumer;const Va=()=>e.useContext(Fa),Wa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Ya=e.memo(wa(function({type:e="source",position:n=wo.Top,isValidConnection:o,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:c,children:u,className:d,onMouseDown:f,onTouchStart:p,...h},m){const g=l||null,y="target"===e,v=Li(),b=Va(),{connectOnClick:x,noPanClassName:w,rfId:E}=Ii(Wa,Ai),{connectingFrom:k,connectingTo:S,clickConnecting:C,isPossibleEndHandle:_,connectionInProcess:N,clickConnectionInProcess:M,valid:P}=Ii(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:a}=o,{fromHandle:s,toHandle:l,isValid:c}=a,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===mo.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(b,g,e),Ai);b||v.getState().onError?.("010",ao());const O=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=v.getState();t(xr(r,e))}n?.(r),c?.(r)},R=e=>{if(!b)return;const t=ur(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=v.getState();qr.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:y,handleId:g,nodeId:b,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:O,isValidConnection:o||t.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?f?.(e):p?.(e)};return t.jsx("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":n,"data-id":`${E}-${b}-${g}-${e}`,className:s(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",w,d,{source:!y,target:y,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:k,connectingto:S,valid:P,connectionindicator:r&&(!N||_)&&(N||M?a:i)}]),onMouseDown:R,onTouchStart:R,onClick:x?t=>{const{onClickConnectStart:n,onClickConnectEnd:r,connectionClickStartHandle:a,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:f}=v.getState();if(!b||!a&&!i)return;if(!a)return n?.(t.nativeEvent,{nodeId:b,handleId:g,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:b,type:e,id:g}});const p=sr(t.target),h=o||l,{connection:m,isValid:y}=qr.isValid(t.nativeEvent,{handle:{nodeId:b,id:g,type:e},connectionMode:s,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:h,flowId:u,doc:p,lib:c,nodeLookup:d});y&&m&&O(m);const x=structuredClone(f);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,r?.(t,x),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...h,children:u})}));const Xa={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Za={input:function({data:e,isConnectable:n,sourcePosition:o=wo.Bottom}){return t.jsxs(t.Fragment,{children:[e?.label,t.jsx(Ya,{type:"source",position:o,isConnectable:n})]})},default:function({data:e,isConnectable:n,targetPosition:o=wo.Top,sourcePosition:r=wo.Bottom}){return t.jsxs(t.Fragment,{children:[t.jsx(Ya,{type:"target",position:o,isConnectable:n}),e?.label,t.jsx(Ya,{type:"source",position:r,isConnectable:n})]})},output:function({data:e,isConnectable:n,targetPosition:o=wo.Top}){return t.jsxs(t.Fragment,{children:[t.jsx(Ya,{type:"target",position:o,isConnectable:n}),e?.label]})},group:function(){return null}};const Ka=e=>{const{width:t,height:n,x:o,y:r}=No(e.nodeLookup,{filter:e=>!!e.selected});return{width:Yo(t)?t:null,height:Yo(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function qa({onSelectionContextMenu:n,noPanClassName:o,disableKeyboardA11y:r}){const i=Li(),{width:a,height:l,transformString:c,userSelectionActive:u}=Ii(Ka,Ai),d=Ba(),f=e.useRef(null);if(e.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),ja({nodeRef:f}),u||!a||!l)return null;const p=n?e=>{const t=i.getState().nodes.filter(e=>e.selected);n(e,t)}:void 0;return t.jsx("div",{className:s(["react-flow__nodesselection","react-flow__container",o]),style:{transform:c},children:t.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:r?void 0:-1,onKeyDown:r?void 0:e=>{Object.prototype.hasOwnProperty.call(Xa,e.key)&&(e.preventDefault(),d({direction:Xa[e.key],factor:e.shiftKey?4:1}))},style:{width:a,height:l}})})}const Ua="undefined"!=typeof window?window:void 0,Ga=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Qa({children:n,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:p,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:E,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:_,defaultViewport:N,translateExtent:M,minZoom:P,maxZoom:O,preventScrolling:R,onSelectionContextMenu:$,noWheelClassName:A,noPanClassName:D,disableKeyboardA11y:T,onViewportChange:z,isControlledViewport:I}){const{nodesSelectionActive:L,userSelectionActive:j}=Ii(Ga),B=ca(d,{target:Ua}),F=ca(y,{target:Ua}),H=F||_,V=F||E,W=f&&!0!==H,Y=B||j||W;return function({deleteKeyCode:t,multiSelectionKeyCode:n}){const o=Li(),{deleteElements:r}=Na(),i=ca(t,{actInsideInputWithModifier:!1}),a=ca(n,{target:Pa});e.useEffect(()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(Ma),edges:e.filter(Ma)}),o.setState({nodesSelectionActive:!1})}},[i]),e.useEffect(()=>{o.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:g}),t.jsx($a,{onPaneContextMenu:s,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:V,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!B&&H,defaultViewport:N,translateExtent:M,minZoom:P,maxZoom:O,zoomActivationKeyCode:v,preventScrolling:R,noWheelClassName:A,noPanClassName:D,onViewportChange:z,isControlledViewport:I,paneClickDistance:c,children:t.jsxs(Ia,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:H,isSelecting:!!Y,selectionMode:p,selectionKeyPressed:B,selectionOnDrag:W,children:[n,L&&t.jsx(qa,{onSelectionContextMenu:$,noPanClassName:D,disableKeyboardA11y:T})]})})}Qa.displayName="FlowRenderer";const Ja=e.memo(Qa);function es(t){const n=Ii(e.useCallback((e=>t=>e?Mo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(t),[t]),Ai);return n}const ts=e=>e.updateNodeInternals;function ns({id:n,onClick:o,onMouseEnter:r,onMouseMove:i,onMouseLeave:a,onContextMenu:l,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:f,nodesFocusable:p,resizeObserver:h,noDragClassName:m,noPanClassName:g,disableKeyboardA11y:y,rfId:v,nodeTypes:b,nodeClickDistance:x,onError:w}){const{node:E,internals:k,isParent:S}=Ii(e=>{const t=e.nodeLookup.get(n),o=e.parentLookup.has(n);return{node:t,internals:t.internals,isParent:o}},Ai);let C=E.type||"default",_=b?.[C]||Za[C];void 0===_&&(w?.("003",eo(C)),C="default",_=b?.default||Za.default);const N=!!(E.draggable||u&&void 0===E.draggable),M=!!(E.selectable||d&&void 0===E.selectable),P=!!(E.connectable||f&&void 0===E.connectable),O=!!(E.focusable||p&&void 0===E.focusable),R=Li(),$=tr(E),A=function({node:t,nodeType:n,hasDimensions:o,resizeObserver:r}){const i=Li(),a=e.useRef(null),s=e.useRef(null),l=e.useRef(t.sourcePosition),c=e.useRef(t.targetPosition),u=e.useRef(n),d=o&&!!t.internals.handleBounds;return e.useEffect(()=>{!a.current||t.hidden||d&&s.current===a.current||(s.current&&r?.unobserve(s.current),r?.observe(a.current),s.current=a.current)},[d,t.hidden]),e.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),e.useEffect(()=>{if(a.current){const e=u.current!==n,o=l.current!==t.sourcePosition,r=c.current!==t.targetPosition;(e||o||r)&&(u.current=n,l.current=t.sourcePosition,c.current=t.targetPosition,i.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}},[t.id,n,t.sourcePosition,t.targetPosition]),a}({node:E,nodeType:C,hasDimensions:$,resizeObserver:h}),D=ja({nodeRef:A,disabled:E.hidden||!N,noDragClassName:m,handleSelector:E.dragHandle,nodeId:n,isSelectable:M,nodeClickDistance:x}),T=Ba();if(E.hidden)return null;const z=er(E),I=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(E),L=M||N||o||r||i||a,j=r?e=>r(e,{...k.userNode}):void 0,B=i?e=>i(e,{...k.userNode}):void 0,F=a?e=>a(e,{...k.userNode}):void 0,H=l?e=>l(e,{...k.userNode}):void 0,V=c?e=>c(e,{...k.userNode}):void 0;return t.jsx("div",{className:s(["react-flow__node",`react-flow__node-${C}`,{[g]:N},E.className,{selected:E.selected,selectable:M,parent:S,draggable:N,dragging:D}]),ref:A,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:$?"visible":"hidden",...E.style,...I},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:B,onMouseLeave:F,onContextMenu:H,onClick:e=>{const{selectNodesOnDrag:t,nodeDragThreshold:r}=R.getState();M&&(!t||!N||r>0)&&La({id:n,store:R,nodeRef:A}),o&&o(e,{...k.userNode})},onDoubleClick:V,onKeyDown:O?e=>{if(!cr(e.nativeEvent)&&!y)if(po.includes(e.key)&&M){const t="Escape"===e.key;La({id:n,store:R,unselect:t,nodeRef:A})}else if(N&&E.selected&&Object.prototype.hasOwnProperty.call(Xa,e.key)){e.preventDefault();const{ariaLabelConfig:t}=R.getState();R.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),T({direction:Xa[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:O?0:void 0,onFocus:O?()=>{if(y||!A.current?.matches(":focus-visible"))return;const{transform:e,width:t,height:o,autoPanOnNodeFocus:r,setCenter:i}=R.getState();if(!r)return;Mo(new Map([[n,E]]),{x:0,y:0,width:t,height:o},e,!0).length>0||i(E.position.x+z.width/2,E.position.y+z.height/2,{zoom:e[2]})}:void 0,role:E.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Fi}-${v}`,"aria-label":E.ariaLabel,...E.domAttributes,children:t.jsx(Ha,{value:n,children:t.jsx(_,{id:n,data:E.data,type:C,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:E.selected??!1,selectable:M,draggable:N,deletable:E.deletable??!0,isConnectable:P,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:D,dragHandle:E.dragHandle,zIndex:k.z,parentId:E.parentId,...z})})})}const os=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function rs(n){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:s}=Ii(os,Ai),l=es(n.onlyRenderVisibleElements),c=function(){const t=Ii(ts),[n]=e.useState(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(e=>{const n=new Map;e.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),t(n)}));return e.useEffect(()=>()=>{n?.disconnect()},[n]),n}();return t.jsx("div",{className:"react-flow__nodes",style:Oa,children:l.map(e=>t.jsx(ns,{id:e,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:c,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:n.nodeClickDistance,onError:s},e))})}rs.displayName="NodeRenderer";const is=e.memo(rs);const as={[xo.Arrow]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e}};return t.jsx("polyline",{className:"arrow",style:o,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[xo.ArrowClosed]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e,fill:e}};return t.jsx("polyline",{className:"arrowclosed",style:o,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}};const ss=({id:n,type:o,color:r,width:i=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(t){const n=Li();return e.useMemo(()=>Object.prototype.hasOwnProperty.call(as,t)?as[t]:(n.getState().onError?.("009",ro(t)),null),[t])}(o);return u?t.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:t.jsx(u,{color:r,strokeWidth:l})}):null},ls=({defaultColor:n,rfId:o})=>{const r=Ii(e=>e.edges),i=Ii(e=>e.defaultEdgeOptions),a=e.useMemo(()=>{const e=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,a)=>([a.markerStart||o,a.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Or(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(r,{id:o,defaultColor:n,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return e},[r,i,o,n]);return a.length?t.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:t.jsx("defs",{children:a.map(e=>t.jsx(ss,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};ls.displayName="MarkerDefinitions";var cs=e.memo(ls);function us({x:n,y:o,label:r,labelStyle:i,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:f,...p}){const[h,m]=e.useState({x:1,y:0,width:0,height:0}),g=s(["react-flow__edge-textwrapper",f]),y=e.useRef(null);return e.useEffect(()=>{if(y.current){const e=y.current.getBBox();m({x:e.x,y:e.y,width:e.width,height:e.height})}},[r]),r?t.jsxs("g",{transform:`translate(${n-h.width/2} ${o-h.height/2})`,className:g,visibility:h.width?"visible":"hidden",...p,children:[a&&t.jsx("rect",{width:h.width+2*c[0],x:-c[0],y:-c[1],height:h.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),t.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:y,style:i,children:r}),d]}):null}us.displayName="EdgeText";const ds=e.memo(us);function fs({path:e,labelX:n,labelY:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:d=20,...f}){return t.jsxs(t.Fragment,{children:[t.jsx("path",{...f,d:e,fill:"none",className:s(["react-flow__edge-path",f.className])}),d?t.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Yo(n)&&Yo(o)?t.jsx(ds,{x:n,y:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function ps({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===wo.Left||e===wo.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function hs({sourceX:e,sourceY:t,sourcePosition:n=wo.Bottom,targetX:o,targetY:r,targetPosition:i=wo.Top}){const[a,s]=ps({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=ps({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,p]=pr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${a},${s} ${l},${c} ${o},${r}`,u,d,f,p]}function ms(n){return e.memo(({id:e,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:m,markerEnd:g,markerStart:y,interactionWidth:v})=>{const[b,x,w]=hs({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),E=n.isInternal?void 0:e;return t.jsx(fs,{id:E,path:b,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:m,markerEnd:g,markerStart:y,interactionWidth:v})})}const gs=ms({isInternal:!1}),ys=ms({isInternal:!0});function vs(n){return e.memo(({id:e,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,sourcePosition:h=wo.Bottom,targetPosition:m=wo.Top,markerEnd:g,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[x,w,E]=Cr({sourceX:o,sourceY:r,sourcePosition:h,targetX:i,targetY:a,targetPosition:m,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),k=n.isInternal?void 0:e;return t.jsx(fs,{id:k,path:x,labelX:w,labelY:E,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:y,interactionWidth:b})})}gs.displayName="SimpleBezierEdge",ys.displayName="SimpleBezierEdgeInternal";const bs=vs({isInternal:!1}),xs=vs({isInternal:!0});function ws(n){return e.memo(({id:o,...r})=>{const i=n.isInternal?void 0:o;return t.jsx(bs,{...r,id:i,pathOptions:e.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}bs.displayName="SmoothStepEdge",xs.displayName="SmoothStepEdgeInternal";const Es=ws({isInternal:!1}),ks=ws({isInternal:!0});function Ss(n){return e.memo(({id:e,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,interactionWidth:g})=>{const[y,v,b]=wr({sourceX:o,sourceY:r,targetX:i,targetY:a}),x=n.isInternal?void 0:e;return t.jsx(fs,{id:x,path:y,labelX:v,labelY:b,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:m,interactionWidth:g})})}Es.displayName="StepEdge",ks.displayName="StepEdgeInternal";const Cs=Ss({isInternal:!1}),_s=Ss({isInternal:!0});function Ns(n){return e.memo(({id:e,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=wo.Bottom,targetPosition:l=wo.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:m,markerEnd:g,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[x,w,E]=gr({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),k=n.isInternal?void 0:e;return t.jsx(fs,{id:k,path:x,labelX:w,labelY:E,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:m,markerEnd:g,markerStart:y,interactionWidth:b})})}Cs.displayName="StraightEdge",_s.displayName="StraightEdgeInternal";const Ms=Ns({isInternal:!1}),Ps=Ns({isInternal:!0});Ms.displayName="BezierEdge",Ps.displayName="BezierEdgeInternal";const Os={default:Ps,straight:_s,step:ks,smoothstep:xs,simplebezier:ys},Rs={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},$s=(e,t,n)=>n===wo.Left?e-t:n===wo.Right?e+t:e,As=(e,t,n)=>n===wo.Top?e-t:n===wo.Bottom?e+t:e,Ds="react-flow__edgeupdater";function Ts({position:e,centerX:n,centerY:o,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:c}){return t.jsx("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:s([Ds,`${Ds}-${c}`]),cx:$s(n,r,e),cy:As(o,r,e),r:r,stroke:"transparent",fill:"transparent"})}function zs({isReconnectable:e,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:a,targetY:s,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:p,setUpdateHover:h}){const m=Li(),g=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:h,cancelConnection:g,nodeLookup:y,rfId:v,panBy:b,updateConnection:x}=m.getState(),w="target"===t.type;qr.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:w,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:g,panBy:b,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:(n,r)=>{p(!0),d?.(e,o,t.type),c?.(n,r)},onConnectEnd:h,onReconnectEnd:(e,n)=>{p(!1),f?.(e,o,t.type,n)},updateConnection:x,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>h(!0),v=()=>h(!1);return t.jsxs(t.Fragment,{children:[(!0===e||"source"===e)&&t.jsx(Ts,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>g(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&t.jsx(Ts,{position:c,centerX:a,centerY:s,radius:n,onMouseDown:e=>g(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}function Is({id:n,edgesFocusable:o,edgesReconnectable:r,elementsSelectable:i,onClick:a,onDoubleClick:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,reconnectRadius:p,onReconnect:h,onReconnectStart:m,onReconnectEnd:g,rfId:y,edgeTypes:v,noPanClassName:b,onError:x,disableKeyboardA11y:w}){let E=Ii(e=>e.edgeLookup.get(n));const k=Ii(e=>e.defaultEdgeOptions);E=k?{...k,...E}:E;let S=E.type||"default",C=v?.[S]||Os[S];void 0===C&&(x?.("011",so(S)),S="default",C=v?.default||Os.default);const _=!!(E.focusable||o&&void 0===E.focusable),N=void 0!==h&&(E.reconnectable||r&&void 0===E.reconnectable),M=!!(E.selectable||i&&void 0===E.selectable),P=e.useRef(null),[O,R]=e.useState(!1),[$,A]=e.useState(!1),D=Li(),{zIndex:T,sourceX:z,sourceY:I,targetX:L,targetY:j,sourcePosition:B,targetPosition:F}=Ii(e.useCallback(e=>{const t=e.nodeLookup.get(E.source),o=e.nodeLookup.get(E.target);if(!t||!o)return{zIndex:E.zIndex,...Rs};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!_r(t)||!_r(n))return null;const o=t.internals.handleBounds||Nr(t.handles),r=n.internals.handleBounds||Nr(n.handles),i=Pr(o?.source??[],e.sourceHandle),a=Pr(e.connectionMode===mo.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",io(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||wo.Bottom,l=a?.position||wo.Top,c=Mr(t,i,s),u=Mr(n,a,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:l}}({id:n,sourceNode:t,targetNode:o,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:e.connectionMode,onError:x}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){return void 0!==o?o:(r&&n?1e3:0)+Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0)}({selected:E.selected,zIndex:E.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return{zIndex:i,...r||Rs}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),Ai),H=e.useMemo(()=>E.markerStart?`url('#${Or(E.markerStart,y)}')`:void 0,[E.markerStart,y]),V=e.useMemo(()=>E.markerEnd?`url('#${Or(E.markerEnd,y)}')`:void 0,[E.markerEnd,y]);if(E.hidden||null===z||null===I||null===L||null===j)return null;const W=l?e=>{l(e,{...E})}:void 0,Y=c?e=>{c(e,{...E})}:void 0,X=u?e=>{u(e,{...E})}:void 0,Z=d?e=>{d(e,{...E})}:void 0,K=f?e=>{f(e,{...E})}:void 0;return t.jsx("svg",{style:{zIndex:T},children:t.jsxs("g",{className:s(["react-flow__edge",`react-flow__edge-${S}`,E.className,b,{selected:E.selected,animated:E.animated,inactive:!M&&!a,updating:O,selectable:M}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=D.getState();M&&(D.setState({nodesSelectionActive:!1}),E.selected&&r?(o({nodes:[],edges:[E]}),P.current?.blur()):t([n])),a&&a(e,E)},onDoubleClick:W,onContextMenu:Y,onMouseEnter:X,onMouseMove:Z,onMouseLeave:K,onKeyDown:_?e=>{if(!w&&po.includes(e.key)&&M){const{unselectNodesAndEdges:t,addSelectedEdges:o}=D.getState();"Escape"===e.key?(P.current?.blur(),t({edges:[E]})):o([n])}}:void 0,tabIndex:_?0:void 0,role:E.ariaRole??(_?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":null===E.ariaLabel?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":_?`${Hi}-${y}`:void 0,ref:P,...E.domAttributes,children:[!$&&t.jsx(C,{id:n,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:M,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:z,sourceY:I,targetX:L,targetY:j,sourcePosition:B,targetPosition:F,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:H,markerEnd:V,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),N&&t.jsx(zs,{edge:E,isReconnectable:N,reconnectRadius:p,onReconnect:h,onReconnectStart:m,onReconnectEnd:g,sourceX:z,sourceY:I,targetX:L,targetY:j,sourcePosition:B,targetPosition:F,setUpdateHover:R,setReconnecting:A})]})})}const Ls=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function js({defaultMarkerColor:n,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:p,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:x,onError:w}=Ii(Ls,Ai),E=(k=o,Ii(e.useCallback(e=>{if(!k)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&vr({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[k]),Ai));var k;return t.jsxs("div",{className:"react-flow__edges",children:[t.jsx(cs,{defaultColor:n,rfId:r}),E.map(e=>t.jsx(Is,{id:e,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:x,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:f,reconnectRadius:p,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,rfId:r,onError:w,edgeTypes:i,disableKeyboardA11y:y},e))]})}js.displayName="EdgeRenderer";const Bs=e.memo(js),Fs=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Hs({children:e}){const n=Ii(Fs);return t.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}const Vs=e=>e.panZoom?.syncViewport;function Ws(e){return e.connection.inProgress?{...e.connection,to:Ko(e.connection.to,e.transform)}:{...e.connection}}function Ys(e){const t=function(e){if(e)return t=>{const n=Ws(t);return e(n)};return Ws}(e);return Ii(t,Ai)}const Xs=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Zs({containerStyle:e,style:n,type:o,component:r}){const{nodesConnectable:i,width:a,height:l,isValid:c,inProgress:u}=Ii(Xs,Ai);return!!(a&&i&&u)?t.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:t.jsx("g",{className:s(["react-flow__connection",ko(c)]),children:t.jsx(Ks,{style:n,type:o,CustomComponent:r,isValid:c})})}):null}const Ks=({style:e,type:n=bo.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:p}=Ys();if(!i)return;if(o)return t.jsx(o,{connectionLineType:n,connectionLineStyle:e,fromNode:s,fromHandle:l,fromX:a.x,fromY:a.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:p,connectionStatus:ko(r),toNode:d,toHandle:f});let h="";const m={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:p};switch(n){case bo.Bezier:[h]=gr(m);break;case bo.SimpleBezier:[h]=hs(m);break;case bo.Step:[h]=Cr({...m,borderRadius:0});break;case bo.SmoothStep:[h]=Cr(m);break;default:[h]=wr(m)}return t.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};Ks.displayName="ConnectionLine";const qs={};function Us(t=qs){const n=e.useRef(t),o=Li();e.useEffect(()=>{if("development"===process.env.NODE_ENV){const e=new Set([...Object.keys(n.current),...Object.keys(t)]);for(const r of e)if(n.current[r]!==t[r]){o.getState().onError?.("002",Jn());break}n.current=t}},[t])}function Gs({nodeTypes:n,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:p,onSelectionStart:h,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:w,selectionMode:E,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:_,onlyRenderVisibleElements:N,elementsSelectable:M,defaultViewport:P,translateExtent:O,minZoom:R,maxZoom:$,preventScrolling:A,defaultMarkerColor:D,zoomOnScroll:T,zoomOnPinch:z,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:j,zoomOnDoubleClick:B,panOnDrag:F,onPaneClick:H,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:Y,onPaneScroll:X,onPaneContextMenu:Z,paneClickDistance:K,nodeClickDistance:q,onEdgeContextMenu:U,onEdgeMouseEnter:G,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return Us(n),Us(o),function(){const t=Li(),n=e.useRef(!1);e.useEffect(()=>{if("development"===process.env.NODE_ENV&&!n.current){const e=document.querySelector(".react-flow__pane");e&&"1"!==window.getComputedStyle(e).zIndex&&t.getState().onError?.("013",co("react")),n.current=!0}},[])}(),function(t){const n=Na(),o=e.useRef(!1);e.useEffect(()=>{!o.current&&n.viewportInitialized&&t&&(setTimeout(()=>t(n),1),o.current=!0)},[t,n.viewportInitialized])}(r),function(t){const n=Ii(Vs),o=Li();e.useEffect(()=>{t&&(n?.(t),o.setState({transform:[t.x,t.y,t.zoom]}))},[t,n])}(ue),t.jsx(Ja,{onPaneClick:H,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:Y,onPaneContextMenu:Z,onPaneScroll:X,paneClickDistance:K,deleteKeyCode:_,selectionKeyCode:x,selectionOnDrag:w,selectionMode:E,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:M,zoomOnScroll:T,zoomOnPinch:z,zoomOnDoubleClick:B,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:j,panOnDrag:F,defaultViewport:P,translateExtent:O,minZoom:R,maxZoom:$,onSelectionContextMenu:p,preventScrolling:A,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,onViewportChange:de,isControlledViewport:!!ue,children:t.jsxs(Hs,{children:[t.jsx(Bs,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:N,onEdgeContextMenu:U,onEdgeMouseEnter:G,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:D,noPanClassName:ae,disableKeyboardA11y:se,rfId:ce}),t.jsx(Zs,{style:y,type:g,component:v,containerStyle:b}),t.jsx("div",{className:"react-flow__edgelabel-renderer"}),t.jsx(is,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:q,onlyRenderVisibleElements:N,noPanClassName:ae,noDragClassName:re,disableKeyboardA11y:se,nodeExtent:le,rfId:ce}),t.jsx("div",{className:"react-flow__viewport-portal"})]})})}Gs.displayName="GraphView";const Qs=e.memo(Gs),Js=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d}={})=>{const f=new Map,p=new Map,h=new Map,m=new Map,g=o??t??[],y=n??e??[],v=u??[0,0],b=d??fo;jr(h,m,g);const x=Dr(y,f,p,{nodeOrigin:v,nodeExtent:b,elevateNodesOnSelect:!1});let w=[0,0,1];if(a&&r&&i){const e=No(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Go(e,r,i,l,c,s?.padding??.1);w=[t,n,o]}return{rfId:"1",width:0,height:0,transform:w,nodes:y,nodesInitialized:x,nodeLookup:f,parentLookup:p,edges:g,edgeLookup:m,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:fo,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...vo},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Xo,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ho}},el=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return f=(f,p)=>{async function h(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:a,maxZoom:s}=p();t&&(await Po({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),f({fitViewResolver:null}))}return{...Js({nodes:e,edges:t,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=p(),a=Dr(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&a?(h(),f({nodes:e,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:e,nodesInitialized:a})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();jr(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l}=p(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const a=o?.querySelector(".xyflow__viewport");let s=!1;if(!a)return{changes:[],updatedInternals:s};const l=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}const a=ar(o.nodeElement),c=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(c||!e.internals.handleBounds||o.force)){const f=o.nodeElement.getBoundingClientRect(),p=Jo(e.extent)?e.extent:i;let{positionAbsolute:h}=e.internals;e.parentId&&"parent"===e.extent?h=Do(h,a,t.get(e.parentId)):p&&(h=Ao(h,p,a));const m={...e,measured:a,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:fr("source",o.nodeElement,f,u,e.id),target:fr("target",o.nodeElement,f,u,e.id)}}};t.set(e.id,m),e.parentId&&Tr(m,t,n,{nodeOrigin:r}),s=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Bo(m,r)}))}}if(d.length>0){const e=Ir(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:s}}(e,n,o,r,i,a);u&&(function(e,t,n){const o=Ar(Rr,n);for(const n of e.values())if(n.parentId)Tr(n,e,t,o);else{const e=_o(n,o.nodeOrigin),t=Jo(n.extent)?n.extent:o.nodeExtent,r=Ao(e,t,er(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:a}),l?(h(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),c?.length>0&&(s&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=p();for(const[i,a]of e){const e=r.get(i),s=!!(e?.expandParent&&e?.parentId&&a?.position),l={id:i,type:"position",position:s?{x:Math.max(0,a.position.x),y:Math.max(0,a.position.y)}:a.position,dragging:t};s&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...a.internals.positionAbsolute,width:a.measured.width??0,height:a.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),i=Ir(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=p();e?.length&&(r&&n(ha(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=p();e?.length&&(r&&n(ma(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?r(e.map(e=>ga(e,!0))):(r(ya(o,new Set([...e]),!0)),i(ya(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?i(e.map(e=>ga(e,!0))):(i(ya(n,new Set([...e]))),r(ya(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p(),s=t||n,l=(e||o).map(e=>{const t=r.get(e.id);return t&&(t.selected=!1),ga(e.id,!1)}),c=s.map(e=>ga(e.id,!1));i(l),a(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},setPaneClickDistance:e=>{p().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=p();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,ga(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,ga(t.id,!1)]:e,[]);n(i),o(a)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:a}=p();e[0][0]===a[0][0]&&e[0][1]===a[0][1]&&e[1][0]===a[1][0]&&e[1][1]===a[1][1]||(Dr(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),f({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){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],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:a}=p();if(!a)return Promise.resolve(!1);const s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:o/2-e*s,y:r/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...vo}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...Js()})}},p=Object.is,f?$i(f,p):$i;var f,p};function tl({initialNodes:n,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:p,children:h}){const[m]=e.useState(()=>el({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:f,nodeExtent:p}));return t.jsx(Ti,{value:m,children:t.jsx(Ca,{children:h})})}function nl({children:n,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:h}){return e.useContext(Di)?t.jsx(t.Fragment,{children:n}):t.jsx(tl,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:p,nodeExtent:h,children:n})}const ol={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var rl,il=wa(function({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,className:a,nodeTypes:l,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:f,onMove:p,onMoveStart:h,onMoveEnd:m,onConnect:g,onConnectStart:y,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:x,onNodeMouseEnter:w,onNodeMouseMove:E,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:_,onNodeDrag:N,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:O,onDelete:R,onSelectionChange:$,onSelectionDragStart:A,onSelectionDrag:D,onSelectionDragStop:T,onSelectionContextMenu:z,onSelectionStart:I,onSelectionEnd:L,onBeforeDelete:j,connectionMode:B,connectionLineType:F=bo.Bezier,connectionLineStyle:H,connectionLineComponent:V,connectionLineContainerStyle:W,deleteKeyCode:Y="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:Z=!1,selectionMode:K=yo.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:U=(Qo()?"Meta":"Control"),zoomActivationKeyCode:G=(Qo()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:ae=ta,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=na,minZoom:de=.5,maxZoom:fe=2,translateExtent:pe=fo,preventScrolling:he=!0,nodeExtent:me,defaultMarkerColor:ge="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:be=!1,panOnScrollSpeed:xe=.5,panOnScrollMode:we=go.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:ke=!0,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:_e,onPaneMouseLeave:Ne,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:Oe=0,nodeClickDistance:Re=0,children:$e,onReconnect:Ae,onReconnectStart:De,onReconnectEnd:Te,onEdgeContextMenu:ze,onEdgeDoubleClick:Ie,onEdgeMouseEnter:Le,onEdgeMouseMove:je,onEdgeMouseLeave:Be,reconnectRadius:Fe=10,onNodesChange:He,onEdgesChange:Ve,noDragClassName:We="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Xe="nopan",fitView:Ze,fitViewOptions:Ke,connectOnClick:qe,attributionPosition:Ue,proOptions:Ge,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:at,onError:st,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ft,onViewportChange:pt,width:ht,height:mt,colorMode:gt="light",debug:yt,onScroll:vt,ariaLabelConfig:bt,...xt},wt){const Et=ct||"1",kt=function(t){const[n,o]=e.useState("system"===t?null:t);return e.useEffect(()=>{if("system"!==t)return void o(t);const e=sa(),n=()=>o(e?.matches?"dark":"light");return n(),e?.addEventListener("change",n),()=>{e?.removeEventListener("change",n)}},[t]),null!==n?n:sa()?.matches?"dark":"light"}(gt),St=e.useCallback(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return t.jsx("div",{"data-testid":"rf__wrapper",...xt,onScroll:St,style:{...lt,...ol},ref:wt,className:s(["react-flow",a,kt]),id:ct,role:"application",children:t.jsxs(nl,{nodes:n,edges:o,width:ht,height:mt,fitView:Ze,fitViewOptions:Ke,minZoom:de,maxZoom:fe,nodeOrigin:ae,nodeExtent:me,children:[t.jsx(Qs,{onInit:f,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:w,onNodeMouseMove:E,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:l,edgeTypes:c,connectionLineType:F,connectionLineStyle:H,connectionLineComponent:V,connectionLineContainerStyle:W,selectionKeyCode:X,selectionOnDrag:Z,selectionMode:K,deleteKeyCode:Y,multiSelectionKeyCode:U,panActivationKeyCode:q,zoomActivationKeyCode:G,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:pe,minZoom:de,maxZoom:fe,preventScrolling:he,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:Ee,panOnScroll:be,panOnScrollSpeed:xe,panOnScrollMode:we,panOnDrag:ke,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:_e,onPaneMouseLeave:Ne,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:Oe,nodeClickDistance:Re,onSelectionContextMenu:z,onSelectionStart:I,onSelectionEnd:L,onReconnect:Ae,onReconnectStart:De,onReconnectEnd:Te,onEdgeContextMenu:ze,onEdgeDoubleClick:Ie,onEdgeMouseEnter:Le,onEdgeMouseMove:je,onEdgeMouseLeave:Be,reconnectRadius:Fe,defaultMarkerColor:ge,noDragClassName:We,noWheelClassName:Ye,noPanClassName:Xe,rfId:Et,disableKeyboardA11y:tt,nodeExtent:me,viewport:ft,onViewportChange:pt}),t.jsx(aa,{nodes:n,edges:o,defaultNodes:r,defaultEdges:i,onConnect:g,onConnectStart:y,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:x,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:fe,nodeExtent:me,onNodesChange:He,onEdgesChange:Ve,snapToGrid:Q,snapGrid:J,connectionMode:B,translateExtent:pe,connectOnClick:qe,defaultEdgeOptions:Qe,fitView:Ze,fitViewOptions:Ke,onNodesDelete:P,onEdgesDelete:O,onDelete:R,onNodeDragStart:_,onNodeDrag:N,onNodeDragStop:M,onSelectionDrag:D,onSelectionDragStart:A,onSelectionDragStop:T,onMove:p,onMoveStart:h,onMoveEnd:m,noPanClassName:Xe,nodeOrigin:ae,rfId:Et,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:st,connectionRadius:it,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:j,paneClickDistance:Oe,debug:yt,ariaLabelConfig:bt}),t.jsx(ea,{onSelectionChange:$}),$e,t.jsx(Ki,{proOptions:Ge,position:Ue}),t.jsx(Xi,{rfId:Et,disableKeyboardA11y:tt})]})})});function al({dimensions:e,lineWidth:n,variant:o,className:r}){return t.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:s(["react-flow__background-pattern",o,r])})}function sl({radius:e,className:n}){return t.jsx("circle",{cx:e,cy:e,r:e,className:s(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(rl||(rl={}));const ll={[rl.Dots]:1,[rl.Lines]:1,[rl.Cross]:6},cl=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ul({id:n,variant:o=rl.Dots,gap:r=20,size:i,lineWidth:a=1,offset:l=0,color:c,bgColor:u,style:d,className:f,patternClassName:p}){const h=e.useRef(null),{transform:m,patternId:g}=Ii(cl,Ai),y=i||ll[o],v=o===rl.Dots,b=o===rl.Cross,x=Array.isArray(r)?r:[r,r],w=[x[0]*m[2]||1,x[1]*m[2]||1],E=y*m[2],k=Array.isArray(l)?l:[l,l],S=b?[E,E]:w,C=[k[0]*m[2]||1+S[0]/2,k[1]*m[2]||1+S[1]/2],_=`${g}${n||""}`;return t.jsxs("svg",{className:s(["react-flow__background",f]),style:{...d,...Oa,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:h,"data-testid":"rf__background",children:[t.jsx("pattern",{id:_,x:m[0]%w[0],y:m[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:v?t.jsx(sl,{radius:E/2,className:p}):t.jsx(al,{dimensions:S,lineWidth:a,variant:o,className:p})}),t.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${_})`})]})}ul.displayName="Background";const dl=e.memo(ul);function fl(){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 pl(){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 hl(){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 ml(){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 gl(){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 yl({children:e,className:n,...o}){return t.jsx("button",{type:"button",className:s(["react-flow__controls-button",n]),...o,children:e})}const vl=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function bl({style:e,showZoom:n=!0,showFitView:o=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:d,children:f,position:p="bottom-left",orientation:h="vertical","aria-label":m}){const g=Li(),{isInteractive:y,minZoomReached:v,maxZoomReached:b,ariaLabelConfig:x}=Ii(vl,Ai),{zoomIn:w,zoomOut:E,fitView:k}=Na(),S="horizontal"===h?"horizontal":"vertical";return t.jsxs(Zi,{className:s(["react-flow__controls",S,d]),position:p,style:e,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[n&&t.jsxs(t.Fragment,{children:[t.jsx(yl,{onClick:()=>{w(),a?.()},className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:b,children:t.jsx(fl,{})}),t.jsx(yl,{onClick:()=>{E(),l?.()},className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:t.jsx(pl,{})})]}),o&&t.jsx(yl,{className:"react-flow__controls-fitview",onClick:()=>{k(i),c?.()},title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:t.jsx(hl,{})}),r&&t.jsx(yl,{className:"react-flow__controls-interactive",onClick:()=>{g.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u?.(!y)},title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:y?t.jsx(gl,{}):t.jsx(ml,{})}),f]})}bl.displayName="Controls",e.memo(bl);const xl=e.memo(function({id:e,x:n,y:o,width:r,height:i,style:a,color:l,strokeColor:c,strokeWidth:u,className:d,borderRadius:f,shapeRendering:p,selected:h,onClick:m}){const{background:g,backgroundColor:y}=a||{},v=l||g||y;return t.jsx("rect",{className:s(["react-flow__minimap-node",{selected:h},d]),x:n,y:o,rx:f,ry:f,width:r,height:i,style:{fill:v,stroke:c,strokeWidth:u},shapeRendering:p,onClick:m?t=>m(t,e):void 0})}),wl=e=>e.nodes.map(e=>e.id),El=e=>e instanceof Function?e:()=>e;const kl=e.memo(function({id:e,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:s,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:p,height:h}=Ii(t=>{const{internals:n}=t.nodeLookup.get(e),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=er(o);return{node:o,x:r,y:i,width:a,height:s}},Ai);return u&&!u.hidden&&tr(u)?t.jsx(l,{x:d,y:f,width:p,height:h,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:a,shapeRendering:s,onClick:c,id:u.id}):null});var Sl=e.memo(function({nodeStrokeColor:e,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=xl,onClick:s}){const l=Ii(wl,Ai),c=El(n),u=El(e),d=El(o),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return t.jsx(t.Fragment,{children:l.map(e=>t.jsx(kl,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:s,shapeRendering:f},e))})});const Cl=e=>!e.hidden,_l=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?Ho(No(e.nodeLookup,{filter:Cl}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function Nl({style:n,className:o,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:f,maskStrokeColor:p,maskStrokeWidth:h,position:m="bottom-right",onClick:g,onNodeClick:y,pannable:v=!1,zoomable:b=!1,ariaLabel:x,inversePan:w,zoomStep:E=1,offsetScale:k=5}){const S=Li(),C=e.useRef(null),{boundingRect:_,viewBB:N,rfId:M,panZoom:P,translateExtent:O,flowWidth:R,flowHeight:$,ariaLabelConfig:A}=Ii(_l,Ai),D=n?.width??200,T=n?.height??150,z=_.width/D,I=_.height/T,L=Math.max(z,I),j=L*D,B=L*T,F=k*L,H=_.x-(j-_.width)/2-F,V=_.y-(B-_.height)/2-F,W=j+2*F,Y=B+2*F,X=`react-flow__minimap-desc-${M}`,Z=e.useRef(0),K=e.useRef();Z.current=L,e.useEffect(()=>{if(C.current&&P)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Ce(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=1,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const f=Gn().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const f=o()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-c[0]*f,y:s[1]-c[1]*f},h=[[0,0],[i,a]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},h,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Qo()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,a=o[2]*Math.pow(2,i*r);t.scaleTo(a)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:_e}}({domNode:C.current,panZoom:P,getTransform:()=>S.getState().transform,getViewScale:()=>Z.current}),()=>{K.current?.destroy()}},[P]),e.useEffect(()=>{K.current?.update({translateExtent:O,width:R,height:$,inversePan:w,pannable:v,zoomStep:E,zoomable:b})},[v,b,w,E,O,R,$]);const q=g?e=>{const[t,n]=K.current?.pointer(e)||[0,0];g(e,{x:t,y:n})}:void 0,U=y?e.useCallback((e,t)=>{const n=S.getState().nodeLookup.get(t).internals.userNode;y(e,n)},[]):void 0,G=x??A["minimap.ariaLabel"];return t.jsx(Zi,{position:m,style:{...n,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof p?p:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof h?h*L:void 0,"--xy-minimap-node-background-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof c?c:void 0},className:s(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:t.jsxs("svg",{width:D,height:T,viewBox:`${H} ${V} ${W} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:C,onClick:q,children:[G&&t.jsx("title",{id:X,children:G}),t.jsx(Sl,{onClick:U,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),t.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-F},${V-F}h${W+2*F}v${Y+2*F}h${-W-2*F}z\n M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Nl.displayName="MiniMap",e.memo(Nl);const Ml={[ri.Line]:"right",[ri.Handle]:"bottom-right"};e.memo(function({nodeId:n,position:o,variant:r=ri.Handle,className:i,style:a,children:l,color:c,minWidth:u=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:m,autoScale:g=!0,shouldResize:y,onResizeStart:v,onResize:b,onResizeEnd:x}){const w=Va(),E="string"==typeof n?n:w,k=Li(),S=e.useRef(null),C=r===ri.Handle,_=Ii(e.useCallback((N=C&&g,e=>N?`${Math.max(1/e.transform[2],1)}`:void 0),[C,g]),Ai);var N;const M=e.useRef(null),P=o??Ml[r];e.useEffect(()=>{if(S.current&&E)return M.current||(M.current=fi({domNode:S.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=k.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=k.getState(),a=[],s={x:e.x,y:e.y},l=o.get(E);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Ir([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...nr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);a.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:E,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:E,type:"dimensions",resizing:!0,setAttributes:!m||("horizontal"===m?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(const e of t){const t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{const n={id:E,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};k.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:u,minHeight:d,maxWidth:f,maxHeight:p},keepAspectRatio:h,resizeDirection:m,onResizeStart:v,onResize:b,onResizeEnd:x,shouldResize:y}),()=>{M.current?.destroy()}},[P,u,d,f,p,h,v,b,x,y]);const O=P.split("-");return t.jsx("div",{className:s(["react-flow__resize-control","nodrag",...O,r,i]),ref:S,style:{...a,scale:_,...c&&{[C?"backgroundColor":"borderColor"]:c}},children:l})});!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:hsla(0,0%,100%,.5);--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:hsla(0,0%,94%,.6);--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:hsla(0,0%,94%,.25);--xy-node-boxshadow-hover-default:0 1px 4px 1px rgba(0,0,0,.08);--xy-node-boxshadow-selected-default:0 0 0 0.5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:rgba(0,89,220,.08);--xy-selection-border-default:1px dotted rgba(0,89,220,.8);--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px rgba(0,0,0,.08);--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;background-color:var(--xy-background-color,var(--xy-background-color-default));direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:hsla(0,0%,59%,.25);--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:rgba(60,60,60,.6);--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#777;--xy-background-pattern-lines-color-default:#777;--xy-background-pattern-cross-color-default:#777;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:hsla(0,0%,94%,.25);--xy-node-boxshadow-hover-default:0 1px 4px 1px hsla(0,0%,100%,.08);--xy-node-boxshadow-selected-default:0 0 0 0.5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:rgba(200,200,220,.08);--xy-selection-border-default:1px dotted rgba(200,200,220,.8);--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px rgba(0,0,0,.08);--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{height:100%;left:0;position:absolute;top:0;width:100%}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{pointer-events:none;transform-origin:0 0;z-index:2}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;pointer-events:none;position:absolute}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path,.react-flow__edge.selected .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{overflow:visible;position:absolute;z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{box-sizing:border-box;cursor:default;pointer-events:all;position:absolute;transform-origin:0 0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{pointer-events:none;transform-origin:left top;z-index:3}.react-flow__nodesselection-rect{cursor:grab;pointer-events:all;position:absolute}.react-flow__handle{background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;height:6px;min-height:5px;min-width:5px;pointer-events:none;position:absolute;width:6px}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{cursor:crosshair;pointer-events:all}.react-flow__handle-bottom{bottom:0;left:50%;top:auto;transform:translate(-50%,50%)}.react-flow__handle-top{left:50%;top:0;transform:translate(-50%,-50%)}.react-flow__handle-left{left:0;top:50%;transform:translate(-50%,-50%)}.react-flow__handle-right{right:0;top:50%;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{margin:15px;position:absolute;z-index:5}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.bottom.center,.react-flow__panel.top.center{left:50%;transform:translateX(-15px) translateX(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));font-size:10px;margin:0;padding:2px 3px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{pointer-events:none}.react-flow__edgelabel-renderer,.react-flow__viewport-portal{height:100%;left:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.react-flow__minimap{background:var(\n --xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default))\n )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(\n --xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default))\n );stroke:var(\n --xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default))\n );stroke-width:var(\n --xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default))\n )}.react-flow__minimap-node{fill:var(\n --xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default))\n );stroke:var(\n --xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default))\n );stroke-width:var(\n --xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default))\n )}.react-flow__background-pattern.dots{fill:var(\n --xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default))\n )}.react-flow__background-pattern.lines{stroke:var(\n --xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default))\n )}.react-flow__background-pattern.cross{stroke:var(\n --xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default))\n )}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));display:flex;flex-direction:column}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{align-items:center;background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(\n --xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default))\n );color:var(\n --xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default))\n );cursor:pointer;display:flex;height:26px;justify-content:center;padding:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:26px}.react-flow__controls-button svg{fill:currentColor;max-height:12px;max-width:12px;width:100%}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-group,.react-flow__node-input,.react-flow__node-output{background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));border:var(--xy-node-border,var(--xy-node-border-default));border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));color:var(--xy-node-color,var(--xy-node-color-default));font-size:12px;padding:10px;text-align:center;width:150px}.react-flow__node-default.selectable:hover,.react-flow__node-group.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(\n --xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default))\n );color:var(\n --xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default))\n )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(\n --xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default))\n )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.bottom,.react-flow__resize-control.top{cursor:ns-resize}.react-flow__resize-control.bottom.right,.react-flow__resize-control.top.left{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;height:5px;translate:-50% -50%;width:5px}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.bottom.left,.react-flow__resize-control.handle.top.left{left:0}.react-flow__resize-control.handle.bottom.right,.react-flow__resize-control.handle.top.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{height:100%;top:0;transform:translate(-50%);width:1px}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.bottom,.react-flow__resize-control.line.top{height:1px;left:0;transform:translateY(-50%);width:100%}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}");
2
2
  /**
3
3
  * @license lucide-react v0.525.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
- const us=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},ds=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),fs=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
8
+ const Pl=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ol=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Rl=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
9
9
  /**
10
10
  * @license lucide-react v0.525.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
14
  */
15
- var ps={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"};const hs=e.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:i,iconNode:s,...l},c)=>e.createElement("svg",{ref:c,...ps,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:ds("lucide",a),...!i&&!fs(l)&&{"aria-hidden":"true"},...l},[...s.map(([t,n])=>e.createElement(t,n)),...Array.isArray(i)?i:[i]])),ms=(t,n)=>{const r=e.forwardRef(({className:r,...o},a)=>{return e.createElement(hs,{ref:a,iconNode:n,className:ds(`lucide-${i=us(t),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var i});return r.displayName=us(t),r},gs=ms("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),ys=ms("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),vs=ms("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),bs=ms("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ws=ms("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),xs=ms("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Es=ms("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Ss=ms("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var _s=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),Cs="-ms-",ks="-moz-",Ns="-webkit-",Ms="comm",Rs="rule",Os="decl",Ps="@keyframes",As=Math.abs,Ts=String.fromCharCode,$s=Object.assign;function Ds(e){return e.trim()}function Is(e,t,n){return e.replace(t,n)}function zs(e,t){return e.indexOf(t)}function Ls(e,t){return 0|e.charCodeAt(t)}function Bs(e,t,n){return e.slice(t,n)}function Fs(e){return e.length}function js(e){return e.length}function Hs(e,t){return t.push(e),e}var Vs=1,Ws=1,Ys=0,Xs=0,Ks=0,Us="";function qs(e,t,n,r,o,a,i){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:Vs,column:Ws,length:i,return:""}}function Zs(e,t){return $s(qs("",null,null,"",null,null,0),e,{length:-e.length},t)}function Gs(){return Ks=Xs>0?Ls(Us,--Xs):0,Ws--,10===Ks&&(Ws=1,Vs--),Ks}function Js(){return Ks=Xs<Ys?Ls(Us,Xs++):0,Ws++,10===Ks&&(Ws=1,Vs++),Ks}function Qs(){return Ls(Us,Xs)}function el(){return Xs}function tl(e,t){return Bs(Us,e,t)}function nl(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function rl(e){return Vs=Ws=1,Ys=Fs(Us=e),Xs=0,[]}function ol(e){return Us="",e}function al(e){return Ds(tl(Xs-1,ll(91===e?e+2:40===e?e+1:e)))}function il(e){for(;(Ks=Qs())&&Ks<33;)Js();return nl(e)>2||nl(Ks)>3?"":" "}function sl(e,t){for(;--t&&Js()&&!(Ks<48||Ks>102||Ks>57&&Ks<65||Ks>70&&Ks<97););return tl(e,el()+(t<6&&32==Qs()&&32==Js()))}function ll(e){for(;Js();)switch(Ks){case e:return Xs;case 34:case 39:34!==e&&39!==e&&ll(Ks);break;case 40:41===e&&ll(e);break;case 92:Js()}return Xs}function cl(e,t){for(;Js()&&e+Ks!==57&&(e+Ks!==84||47!==Qs()););return"/*"+tl(t,Xs-1)+"*"+Ts(47===e?e:Js())}function ul(e){for(;!nl(Qs());)Js();return tl(e,Xs)}function dl(e){return ol(fl("",null,null,null,[""],e=rl(e),0,[0],e))}function fl(e,t,n,r,o,a,i,s,l){for(var c=0,u=0,d=i,f=0,p=0,h=0,m=1,g=1,y=1,v=0,b="",w=o,x=a,E=r,S=b;g;)switch(h=v,v=Js()){case 40:if(108!=h&&58==Ls(S,d-1)){-1!=zs(S+=Is(al(v),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:S+=al(v);break;case 9:case 10:case 13:case 32:S+=il(h);break;case 92:S+=sl(el()-1,7);continue;case 47:switch(Qs()){case 42:case 47:Hs(hl(cl(Js(),el()),t,n),l);break;default:S+="/"}break;case 123*m:s[c++]=Fs(S)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:-1==y&&(S=Is(S,/\f/g,"")),p>0&&Fs(S)-d&&Hs(p>32?ml(S+";",r,n,d-1):ml(Is(S," ","")+";",r,n,d-2),l);break;case 59:S+=";";default:if(Hs(E=pl(S,t,n,c,u,o,s,b,w=[],x=[],d),a),123===v)if(0===u)fl(S,t,E,E,w,a,d,s,x);else switch(99===f&&110===Ls(S,3)?100:f){case 100:case 108:case 109:case 115:fl(e,E,E,r&&Hs(pl(e,E,E,0,0,o,s,b,o,w=[],d),x),o,x,d,s,r?w:x);break;default:fl(S,E,E,E,[""],x,0,s,x)}}c=u=p=0,m=y=1,b=S="",d=i;break;case 58:d=1+Fs(S),p=h;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==Gs())continue;switch(S+=Ts(v),v*m){case 38:y=u>0?1:(S+="\f",-1);break;case 44:s[c++]=(Fs(S)-1)*y,y=1;break;case 64:45===Qs()&&(S+=al(Js())),f=Qs(),u=d=Fs(b=S+=ul(el())),v++;break;case 45:45===h&&2==Fs(S)&&(m=0)}}return a}function pl(e,t,n,r,o,a,i,s,l,c,u){for(var d=o-1,f=0===o?a:[""],p=js(f),h=0,m=0,g=0;h<r;++h)for(var y=0,v=Bs(e,d+1,d=As(m=i[h])),b=e;y<p;++y)(b=Ds(m>0?f[y]+" "+v:Is(v,/&\f/g,f[y])))&&(l[g++]=b);return qs(e,t,n,0===o?Rs:s,l,c,u)}function hl(e,t,n){return qs(e,t,n,Ms,Ts(Ks),Bs(e,2,-2),0)}function ml(e,t,n,r){return qs(e,t,n,Os,Bs(e,0,r),Bs(e,r+1,-1),r)}function gl(e,t){for(var n="",r=js(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function yl(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case Os:return e.return=e.return||e.value;case Ms:return"";case Ps:return e.return=e.value+"{"+gl(e.children,r)+"}";case Rs:e.value=e.props.join(",")}return Fs(n=gl(e.children,r))?e.return=e.value+"{"+n+"}":""}var vl=function(e){var t=new WeakMap;return function(n){if(t.has(n))return t.get(n);var r=e(n);return t.set(n,r),r}};function bl(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var wl=function(e,t,n){for(var r=0,o=0;r=o,o=Qs(),38===r&&12===o&&(t[n]=1),!nl(o);)Js();return tl(e,Xs)},xl=function(e,t){return ol(function(e,t){var n=-1,r=44;do{switch(nl(r)){case 0:38===r&&12===Qs()&&(t[n]=1),e[n]+=wl(Xs-1,t,n);break;case 2:e[n]+=al(r);break;case 4:if(44===r){e[++n]=58===Qs()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Ts(r)}}while(r=Js());return e}(rl(e),t))},El=new WeakMap,Sl=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||El.get(n))&&!r){El.set(e,!0);for(var o=[],a=xl(t,o),i=n.props,s=0,l=0;s<a.length;s++)for(var c=0;c<i.length;c++,l++)e.props[l]=o[s]?a[s].replace(/&\f/g,i[c]):i[c]+" "+a[s]}}},_l=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Cl(e,t){switch(function(e,t){return 45^Ls(e,0)?(((t<<2^Ls(e,0))<<2^Ls(e,1))<<2^Ls(e,2))<<2^Ls(e,3):0}(e,t)){case 5103:return Ns+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ns+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ns+e+ks+e+Cs+e+e;case 6828:case 4268:return Ns+e+Cs+e+e;case 6165:return Ns+e+Cs+"flex-"+e+e;case 5187:return Ns+e+Is(e,/(\w+).+(:[^]+)/,Ns+"box-$1$2"+Cs+"flex-$1$2")+e;case 5443:return Ns+e+Cs+"flex-item-"+Is(e,/flex-|-self/,"")+e;case 4675:return Ns+e+Cs+"flex-line-pack"+Is(e,/align-content|flex-|-self/,"")+e;case 5548:return Ns+e+Cs+Is(e,"shrink","negative")+e;case 5292:return Ns+e+Cs+Is(e,"basis","preferred-size")+e;case 6060:return Ns+"box-"+Is(e,"-grow","")+Ns+e+Cs+Is(e,"grow","positive")+e;case 4554:return Ns+Is(e,/([^-])(transform)/g,"$1"+Ns+"$2")+e;case 6187:return Is(Is(Is(e,/(zoom-|grab)/,Ns+"$1"),/(image-set)/,Ns+"$1"),e,"")+e;case 5495:case 3959:return Is(e,/(image-set\([^]*)/,Ns+"$1$`$1");case 4968:return Is(Is(e,/(.+:)(flex-)?(.*)/,Ns+"box-pack:$3"+Cs+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ns+e+e;case 4095:case 3583:case 4068:case 2532:return Is(e,/(.+)-inline(.+)/,Ns+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Fs(e)-1-t>6)switch(Ls(e,t+1)){case 109:if(45!==Ls(e,t+4))break;case 102:return Is(e,/(.+:)(.+)-([^]+)/,"$1"+Ns+"$2-$3$1"+ks+(108==Ls(e,t+3)?"$3":"$2-$3"))+e;case 115:return~zs(e,"stretch")?Cl(Is(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==Ls(e,t+1))break;case 6444:switch(Ls(e,Fs(e)-3-(~zs(e,"!important")&&10))){case 107:return Is(e,":",":"+Ns)+e;case 101:return Is(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ns+(45===Ls(e,14)?"inline-":"")+"box$3$1"+Ns+"$2$3$1"+Cs+"$2box$3")+e}break;case 5936:switch(Ls(e,t+11)){case 114:return Ns+e+Cs+Is(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ns+e+Cs+Is(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ns+e+Cs+Is(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ns+e+Cs+e+e}return e}var kl=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Os:e.return=Cl(e.value,e.length);break;case Ps:return gl([Zs(e,{value:Is(e.value,"@","@"+Ns)})],r);case Rs:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return gl([Zs(e,{props:[Is(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return gl([Zs(e,{props:[Is(t,/:(plac\w+)/,":"+Ns+"input-$1")]}),Zs(e,{props:[Is(t,/:(plac\w+)/,":-moz-$1")]}),Zs(e,{props:[Is(t,/:(plac\w+)/,Cs+"input-$1")]})],r)}return""})}}],Nl=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var r,o,a=e.stylisPlugins||kl,i={},s=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)i[t[n]]=!0;s.push(e)});var l,c,u=[yl,(c=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&c(e)})],d=function(e){var t=js(e);return function(n,r,o,a){for(var i="",s=0;s<t;s++)i+=e[s](n,r,o,a)||"";return i}}([Sl,_l].concat(a,u));o=function(e,t,n,r){l=n,gl(dl(e?e+"{"+t.styles+"}":t.styles),d),r&&(f.inserted[t.name]=!0)};var f={key:t,sheet:new _s({key:t,container:r,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:o};return f.sheet.hydrate(s),f};function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ml.apply(null,arguments)}var Rl=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)};var Ol={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pl=/[A-Z]|^ms/g,Al=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Tl=function(e){return 45===e.charCodeAt(1)},$l=function(e){return null!=e&&"boolean"!=typeof e},Dl=bl(function(e){return Tl(e)?e:e.replace(Pl,"-$&").toLowerCase()}),Il=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Al,function(e,t,n){return Ll={name:t,styles:n,next:Ll},t})}return 1===Ol[e]||Tl(e)||"number"!=typeof t||0===t?t:t+"px"};function zl(e,t,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var o=n;if(1===o.anim)return Ll={name:o.name,styles:o.styles,next:Ll},o.name;var a=n;if(void 0!==a.styles){var i=a.next;if(void 0!==i)for(;void 0!==i;)Ll={name:i.name,styles:i.styles,next:Ll},i=i.next;return a.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=zl(e,t,n[o])+";";else for(var a in n){var i=n[a];if("object"!=typeof i){var s=i;null!=t&&void 0!==t[s]?r+=a+"{"+t[s]+"}":$l(s)&&(r+=Dl(a)+":"+Il(a,s)+";")}else if(!Array.isArray(i)||"string"!=typeof i[0]||null!=t&&void 0!==t[i[0]]){var l=zl(e,t,i);switch(a){case"animation":case"animationName":r+=Dl(a)+":"+l+";";break;default:r+=a+"{"+l+"}"}}else for(var c=0;c<i.length;c++)$l(i[c])&&(r+=Dl(a)+":"+Il(a,i[c])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=Ll,l=n(e);return Ll=s,zl(e,t,l)}}var c=n;if(null==t)return c;var u=t[c];return void 0!==u?u:c}var Ll,Bl=/label:\s*([^\s;{]+)\s*(;|$)/g;var Fl=!!a.useInsertionEffect&&a.useInsertionEffect||function(e){return e()},jl=a.createContext("undefined"!=typeof HTMLElement?Nl({key:"css"}):null);jl.Provider;var Hl=a.createContext({}),Vl=vl(function(e){return vl(function(t){return function(e,t){return"function"==typeof t?t(e):Ml({},e,t)}(e,t)})}),Wl=function(e){var t=a.useContext(Hl);return e.theme!==t&&(t=Vl(t)(e.theme)),a.createElement(Hl.Provider,{value:t},e.children)};const Yl={colors:{background:"hsl(0 0% 100%)",foreground:"hsl(222.2 84% 4.9%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(222.2 84% 4.9%)",popover:"hsl(0 0% 100%)",popoverForeground:"hsl(222.2 84% 4.9%)",primary:"hsl(221.2 83.2% 53.3%)",primaryForeground:"hsl(210 40% 98%)",secondary:"hsl(210 40% 96%)",secondaryForeground:"hsl(222.2 84% 4.9%)",muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",accent:"hsl(210 40% 96%)",accentForeground:"hsl(222.2 84% 4.9%)",destructive:"hsl(0 84.2% 60.2%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(214.3 31.8% 91.4%)",mutedBorder:"hsl(214.3 31.8% 91.4%)",input:"hsl(214.3 31.8% 91.4%)",ring:"hsl(221.2 83.2% 53.3%)"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},borderRadius:{sm:"calc(var(--radius) - 4px)",md:"calc(var(--radius) - 2px)",lg:"var(--radius)",xl:"0.75rem"},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},transitions:{fast:"0.15s ease-in-out",normal:"0.2s ease-in-out",slow:"0.3s ease-in-out"}},Xl={colors:{background:"hsl(222.2 84% 4.9%)",foreground:"hsl(210 40% 98%)",card:"hsl(222.2 84% 4.9%)",cardForeground:"hsl(210 40% 98%)",popover:"hsl(222.2 84% 4.9%)",popoverForeground:"hsl(210 40% 98%)",primary:"hsl(217.2 91.2% 59.8%)",primaryForeground:"hsl(222.2 84% 4.9%)",secondary:"hsl(217.2 32.6% 17.5%)",secondaryForeground:"hsl(210 40% 98%)",muted:"hsl(217.2 32.6% 17.5%)",mutedForeground:"hsl(215 20.2% 65.1%)",accent:"hsl(217.2 32.6% 17.5%)",accentForeground:"hsl(210 40% 98%)",destructive:"hsl(0 62.8% 30.6%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(217.2 32.6% 17.5%)",mutedBorder:"hsl(217.2 32.6% 5%)",input:"hsl(217.2 32.6% 17.5%)",ring:"hsl(224.3 76.3% 94.1%)"},spacing:Yl.spacing,borderRadius:Yl.borderRadius,fontSize:Yl.fontSize,fontWeight:Yl.fontWeight,shadows:Yl.shadows,transitions:Yl.transitions},Kl=Yl,Ul=e.createContext(void 0),ql=()=>{const t=e.useContext(Ul);return void 0===t?{theme:Yl,setTheme:()=>{console.warn("Theme context not available. setTheme called but ignored.")}}:t},Zl=({id:t,sourceX:n,sourceY:r,targetX:o,targetY:a,sourcePosition:i,targetPosition:s,style:l={},markerEnd:c,bidirectional:u=!1,data:d,clientToSvgCoords:f,svgRef:p})=>{e.useState(!1);const{theme:h}=ql(),m=h.colors,[g,y,v]=e.useMemo(()=>go({sourceX:n,sourceY:r,targetX:o,targetY:a}),[n,r,o,a]),b={...l,stroke:(()=>{const e=d?.details?.state,t=d?.details?.status,n=d?.details?.output;return"Error"===e||"Error"===t||"string"==typeof n&&n.includes("ERROR:")?m.destructive:m.mutedForeground})(),strokeWidth:l.strokeWidth||2};return e.createElement(e.Fragment,null,e.createElement(Kr,{path:g,style:b}))};var Gl=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Jl=bl(function(e){return Gl.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),Ql=function(e){return"theme"!==e},ec=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?Jl:Ql},tc=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},nc=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return Rl(t,n,r),Fl(function(){return function(e,t,n){Rl(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,r)}),null},rc=function t(n,r){var o,i,s=n.__emotion_real===n,l=s&&n.__emotion_base||n;void 0!==r&&(o=r.label,i=r.target);var c=tc(n,r,s),u=c||ec(l),d=!u("as");return function(){var f=arguments,p=s&&void 0!==n.__emotion_styles?n.__emotion_styles.slice(0):[];if(void 0!==o&&p.push("label:"+o+";"),null==f[0]||void 0===f[0].raw)p.push.apply(p,f);else{var h=f[0];p.push(h[0]);for(var m=f.length,g=1;g<m;g++)p.push(f[g],h[g])}var y,v=(y=function(e,t,n){var r,o,s,f,h=d&&e.as||l,m="",g=[],y=e;if(null==e.theme){for(var v in y={},e)y[v]=e[v];y.theme=a.useContext(Hl)}"string"==typeof e.className?(r=t.registered,o=g,s=e.className,f="",s.split(" ").forEach(function(e){void 0!==r[e]?o.push(r[e]+";"):e&&(f+=e+" ")}),m=f):null!=e.className&&(m=e.className+" ");var b=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";Ll=void 0;var a=e[0];null==a||void 0===a.raw?(r=!1,o+=zl(n,t,a)):o+=a[0];for(var i=1;i<e.length;i++)o+=zl(n,t,e[i]),r&&(o+=a[i]);Bl.lastIndex=0;for(var s,l="";null!==(s=Bl.exec(o));)l+="-"+s[1];var c=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+l;return{name:c,styles:o,next:Ll}}(p.concat(g),t.registered,y);m+=t.key+"-"+b.name,void 0!==i&&(m+=" "+i);var w=d&&void 0===c?ec(h):u,x={};for(var E in e)d&&"as"===E||w(E)&&(x[E]=e[E]);return x.className=m,n&&(x.ref=n),a.createElement(a.Fragment,null,a.createElement(nc,{cache:t,serialized:b,isStringTag:"string"==typeof h}),a.createElement(h,x))},e.forwardRef(function(t,n){var r=e.useContext(jl);return y(t,r,n)}));return v.displayName=void 0!==o?o:"Styled("+("string"==typeof l?l:l.displayName||l.name||"Component")+")",v.defaultProps=n.defaultProps,v.__emotion_real=v,v.__emotion_base=l,v.__emotion_styles=p,v.__emotion_forwardProp=c,Object.defineProperty(v,"toString",{value:function(){return"."+i}}),v.withComponent=function(e,n){return t(e,Ml({},r,n,{shouldForwardProp:tc(v,n,!0)})).apply(void 0,p)},v}}.bind(null);function oc(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=oc(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ac(e){return e.split(/[-_\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}function ic(e){if(null==e)return"$0.00";if(Math.abs(e)<.01&&0!==e){const t=e.toString().split(".")[1]?.length||0,n=Math.max(3,Math.min(t,2));return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:Math.min(3,n),maximumFractionDigits:n}).format(e)}const t=e.toString().split(".")[1]?.length||0,n=Math.max(2,Math.min(t,2));return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:n}).format(e)}function sc(e){if(e<1)return`${Math.round(1e3*e)}ms`;if(e<60)return`${e.toFixed(1)}s`;return`${Math.floor(e/60)}m ${Math.round(e%60/1e3)}s`}function lc(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}function cc(e,t,n="#000000"){return e?.colors?.[t]?e.colors[t]:(console.warn(`Theme color '${t}' not found, using fallback: ${n}`),n)}function uc(e,t,n="1rem"){return e?.spacing?.[t]?e.spacing[t]:(console.warn(`Theme spacing '${t}' not found, using fallback: ${n}`),n)}function dc(e){return e||(console.warn("Theme is undefined, using default light theme"),{colors:{background:"hsl(0 0% 100%)",foreground:"hsl(222.2 84% 4.9%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(222.2 84% 4.9%)",popover:"hsl(0 0% 100%)",popoverForeground:"hsl(222.2 84% 4.9%)",primary:"hsl(221.2 83.2% 53.3%)",primaryForeground:"hsl(210 40% 98%)",secondary:"hsl(210 40% 96%)",secondaryForeground:"hsl(222.2 84% 4.9%)",muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",accent:"hsl(210 40% 96%)",accentForeground:"hsl(222.2 84% 4.9%)",destructive:"hsl(0 84.2% 60.2%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(214.3 31.8% 91.4%)",mutedBorder:"hsl(214.3 31.8% 91.4%)",input:"hsl(214.3 31.8% 91.4%)",ring:"hsl(221.2 83.2% 53.3%)"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})}["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach(function(e){rc[e]=rc(e)});const fc=rc.div`
15
+ var $l={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"};const Al=e.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:s,...l},c)=>e.createElement("svg",{ref:c,...$l,width:n,height:n,stroke:t,strokeWidth:r?24*Number(o)/Number(n):o,className:Ol("lucide",i),...!a&&!Rl(l)&&{"aria-hidden":"true"},...l},[...s.map(([t,n])=>e.createElement(t,n)),...Array.isArray(a)?a:[a]])),Dl=(t,n)=>{const o=e.forwardRef(({className:o,...r},i)=>{return e.createElement(Al,{ref:i,iconNode:n,className:Ol(`lucide-${a=Pl(t),a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,o),...r});var a});return o.displayName=Pl(t),o},Tl=Dl("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),zl=Dl("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Il=Dl("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ll=Dl("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),jl=Dl("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Bl=Dl("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Fl=Dl("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Hl=Dl("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Vl=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),Wl="-ms-",Yl="-moz-",Xl="-webkit-",Zl="comm",Kl="rule",ql="decl",Ul="@keyframes",Gl=Math.abs,Ql=String.fromCharCode,Jl=Object.assign;function ec(e){return e.trim()}function tc(e,t,n){return e.replace(t,n)}function nc(e,t){return e.indexOf(t)}function oc(e,t){return 0|e.charCodeAt(t)}function rc(e,t,n){return e.slice(t,n)}function ic(e){return e.length}function ac(e){return e.length}function sc(e,t){return t.push(e),e}var lc=1,cc=1,uc=0,dc=0,fc=0,pc="";function hc(e,t,n,o,r,i,a){return{value:e,root:t,parent:n,type:o,props:r,children:i,line:lc,column:cc,length:a,return:""}}function mc(e,t){return Jl(hc("",null,null,"",null,null,0),e,{length:-e.length},t)}function gc(){return fc=dc>0?oc(pc,--dc):0,cc--,10===fc&&(cc=1,lc--),fc}function yc(){return fc=dc<uc?oc(pc,dc++):0,cc++,10===fc&&(cc=1,lc++),fc}function vc(){return oc(pc,dc)}function bc(){return dc}function xc(e,t){return rc(pc,e,t)}function wc(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ec(e){return lc=cc=1,uc=ic(pc=e),dc=0,[]}function kc(e){return pc="",e}function Sc(e){return ec(xc(dc-1,Nc(91===e?e+2:40===e?e+1:e)))}function Cc(e){for(;(fc=vc())&&fc<33;)yc();return wc(e)>2||wc(fc)>3?"":" "}function _c(e,t){for(;--t&&yc()&&!(fc<48||fc>102||fc>57&&fc<65||fc>70&&fc<97););return xc(e,bc()+(t<6&&32==vc()&&32==yc()))}function Nc(e){for(;yc();)switch(fc){case e:return dc;case 34:case 39:34!==e&&39!==e&&Nc(fc);break;case 40:41===e&&Nc(e);break;case 92:yc()}return dc}function Mc(e,t){for(;yc()&&e+fc!==57&&(e+fc!==84||47!==vc()););return"/*"+xc(t,dc-1)+"*"+Ql(47===e?e:yc())}function Pc(e){for(;!wc(vc());)yc();return xc(e,dc)}function Oc(e){return kc(Rc("",null,null,null,[""],e=Ec(e),0,[0],e))}function Rc(e,t,n,o,r,i,a,s,l){for(var c=0,u=0,d=a,f=0,p=0,h=0,m=1,g=1,y=1,v=0,b="",x=r,w=i,E=o,k=b;g;)switch(h=v,v=yc()){case 40:if(108!=h&&58==oc(k,d-1)){-1!=nc(k+=tc(Sc(v),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:k+=Sc(v);break;case 9:case 10:case 13:case 32:k+=Cc(h);break;case 92:k+=_c(bc()-1,7);continue;case 47:switch(vc()){case 42:case 47:sc(Ac(Mc(yc(),bc()),t,n),l);break;default:k+="/"}break;case 123*m:s[c++]=ic(k)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:-1==y&&(k=tc(k,/\f/g,"")),p>0&&ic(k)-d&&sc(p>32?Dc(k+";",o,n,d-1):Dc(tc(k," ","")+";",o,n,d-2),l);break;case 59:k+=";";default:if(sc(E=$c(k,t,n,c,u,r,s,b,x=[],w=[],d),i),123===v)if(0===u)Rc(k,t,E,E,x,i,d,s,w);else switch(99===f&&110===oc(k,3)?100:f){case 100:case 108:case 109:case 115:Rc(e,E,E,o&&sc($c(e,E,E,0,0,r,s,b,r,x=[],d),w),r,w,d,s,o?x:w);break;default:Rc(k,E,E,E,[""],w,0,s,w)}}c=u=p=0,m=y=1,b=k="",d=a;break;case 58:d=1+ic(k),p=h;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==gc())continue;switch(k+=Ql(v),v*m){case 38:y=u>0?1:(k+="\f",-1);break;case 44:s[c++]=(ic(k)-1)*y,y=1;break;case 64:45===vc()&&(k+=Sc(yc())),f=vc(),u=d=ic(b=k+=Pc(bc())),v++;break;case 45:45===h&&2==ic(k)&&(m=0)}}return i}function $c(e,t,n,o,r,i,a,s,l,c,u){for(var d=r-1,f=0===r?i:[""],p=ac(f),h=0,m=0,g=0;h<o;++h)for(var y=0,v=rc(e,d+1,d=Gl(m=a[h])),b=e;y<p;++y)(b=ec(m>0?f[y]+" "+v:tc(v,/&\f/g,f[y])))&&(l[g++]=b);return hc(e,t,n,0===r?Kl:s,l,c,u)}function Ac(e,t,n){return hc(e,t,n,Zl,Ql(fc),rc(e,2,-2),0)}function Dc(e,t,n,o){return hc(e,t,n,ql,rc(e,0,o),rc(e,o+1,-1),o)}function Tc(e,t){for(var n="",o=ac(e),r=0;r<o;r++)n+=t(e[r],r,e,t)||"";return n}function zc(e,t,n,o){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case ql:return e.return=e.return||e.value;case Zl:return"";case Ul:return e.return=e.value+"{"+Tc(e.children,o)+"}";case Kl:e.value=e.props.join(",")}return ic(n=Tc(e.children,o))?e.return=e.value+"{"+n+"}":""}var Ic=function(e){var t=new WeakMap;return function(n){if(t.has(n))return t.get(n);var o=e(n);return t.set(n,o),o}};function Lc(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var jc=function(e,t,n){for(var o=0,r=0;o=r,r=vc(),38===o&&12===r&&(t[n]=1),!wc(r);)yc();return xc(e,dc)},Bc=function(e,t){return kc(function(e,t){var n=-1,o=44;do{switch(wc(o)){case 0:38===o&&12===vc()&&(t[n]=1),e[n]+=jc(dc-1,t,n);break;case 2:e[n]+=Sc(o);break;case 4:if(44===o){e[++n]=58===vc()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Ql(o)}}while(o=yc());return e}(Ec(e),t))},Fc=new WeakMap,Hc=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Fc.get(n))&&!o){Fc.set(e,!0);for(var r=[],i=Bc(t,r),a=n.props,s=0,l=0;s<i.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=r[s]?i[s].replace(/&\f/g,a[c]):a[c]+" "+i[s]}}},Vc=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Wc(e,t){switch(function(e,t){return 45^oc(e,0)?(((t<<2^oc(e,0))<<2^oc(e,1))<<2^oc(e,2))<<2^oc(e,3):0}(e,t)){case 5103:return Xl+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Xl+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Xl+e+Yl+e+Wl+e+e;case 6828:case 4268:return Xl+e+Wl+e+e;case 6165:return Xl+e+Wl+"flex-"+e+e;case 5187:return Xl+e+tc(e,/(\w+).+(:[^]+)/,Xl+"box-$1$2"+Wl+"flex-$1$2")+e;case 5443:return Xl+e+Wl+"flex-item-"+tc(e,/flex-|-self/,"")+e;case 4675:return Xl+e+Wl+"flex-line-pack"+tc(e,/align-content|flex-|-self/,"")+e;case 5548:return Xl+e+Wl+tc(e,"shrink","negative")+e;case 5292:return Xl+e+Wl+tc(e,"basis","preferred-size")+e;case 6060:return Xl+"box-"+tc(e,"-grow","")+Xl+e+Wl+tc(e,"grow","positive")+e;case 4554:return Xl+tc(e,/([^-])(transform)/g,"$1"+Xl+"$2")+e;case 6187:return tc(tc(tc(e,/(zoom-|grab)/,Xl+"$1"),/(image-set)/,Xl+"$1"),e,"")+e;case 5495:case 3959:return tc(e,/(image-set\([^]*)/,Xl+"$1$`$1");case 4968:return tc(tc(e,/(.+:)(flex-)?(.*)/,Xl+"box-pack:$3"+Wl+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Xl+e+e;case 4095:case 3583:case 4068:case 2532:return tc(e,/(.+)-inline(.+)/,Xl+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ic(e)-1-t>6)switch(oc(e,t+1)){case 109:if(45!==oc(e,t+4))break;case 102:return tc(e,/(.+:)(.+)-([^]+)/,"$1"+Xl+"$2-$3$1"+Yl+(108==oc(e,t+3)?"$3":"$2-$3"))+e;case 115:return~nc(e,"stretch")?Wc(tc(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==oc(e,t+1))break;case 6444:switch(oc(e,ic(e)-3-(~nc(e,"!important")&&10))){case 107:return tc(e,":",":"+Xl)+e;case 101:return tc(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Xl+(45===oc(e,14)?"inline-":"")+"box$3$1"+Xl+"$2$3$1"+Wl+"$2box$3")+e}break;case 5936:switch(oc(e,t+11)){case 114:return Xl+e+Wl+tc(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Xl+e+Wl+tc(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Xl+e+Wl+tc(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Xl+e+Wl+e+e}return e}var Yc=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case ql:e.return=Wc(e.value,e.length);break;case Ul:return Tc([mc(e,{value:tc(e.value,"@","@"+Xl)})],o);case Kl:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Tc([mc(e,{props:[tc(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return Tc([mc(e,{props:[tc(t,/:(plac\w+)/,":"+Xl+"input-$1")]}),mc(e,{props:[tc(t,/:(plac\w+)/,":-moz-$1")]}),mc(e,{props:[tc(t,/:(plac\w+)/,Wl+"input-$1")]})],o)}return""})}}],Xc=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var o,r,i=e.stylisPlugins||Yc,a={},s=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)a[t[n]]=!0;s.push(e)});var l,c,u=[zc,(c=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&c(e)})],d=function(e){var t=ac(e);return function(n,o,r,i){for(var a="",s=0;s<t;s++)a+=e[s](n,o,r,i)||"";return a}}([Hc,Vc].concat(i,u));r=function(e,t,n,o){l=n,Tc(Oc(e?e+"{"+t.styles+"}":t.styles),d),o&&(f.inserted[t.name]=!0)};var f={key:t,sheet:new Vl({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:r};return f.sheet.hydrate(s),f};function Zc(){return Zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Zc.apply(null,arguments)}var Kc=function(e,t,n){var o=e.key+"-"+t.name;!1===n&&void 0===e.registered[o]&&(e.registered[o]=t.styles)};var qc={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Uc=/[A-Z]|^ms/g,Gc=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Qc=function(e){return 45===e.charCodeAt(1)},Jc=function(e){return null!=e&&"boolean"!=typeof e},eu=Lc(function(e){return Qc(e)?e:e.replace(Uc,"-$&").toLowerCase()}),tu=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Gc,function(e,t,n){return ou={name:t,styles:n,next:ou},t})}return 1===qc[e]||Qc(e)||"number"!=typeof t||0===t?t:t+"px"};function nu(e,t,n){if(null==n)return"";var o=n;if(void 0!==o.__emotion_styles)return o;switch(typeof n){case"boolean":return"";case"object":var r=n;if(1===r.anim)return ou={name:r.name,styles:r.styles,next:ou},r.name;var i=n;if(void 0!==i.styles){var a=i.next;if(void 0!==a)for(;void 0!==a;)ou={name:a.name,styles:a.styles,next:ou},a=a.next;return i.styles+";"}return function(e,t,n){var o="";if(Array.isArray(n))for(var r=0;r<n.length;r++)o+=nu(e,t,n[r])+";";else for(var i in n){var a=n[i];if("object"!=typeof a){var s=a;null!=t&&void 0!==t[s]?o+=i+"{"+t[s]+"}":Jc(s)&&(o+=eu(i)+":"+tu(i,s)+";")}else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var l=nu(e,t,a);switch(i){case"animation":case"animationName":o+=eu(i)+":"+l+";";break;default:o+=i+"{"+l+"}"}}else for(var c=0;c<a.length;c++)Jc(a[c])&&(o+=eu(i)+":"+tu(i,a[c])+";")}return o}(e,t,n);case"function":if(void 0!==e){var s=ou,l=n(e);return ou=s,nu(e,t,l)}}var c=n;if(null==t)return c;var u=t[c];return void 0!==u?u:c}var ou,ru=/label:\s*([^\s;{]+)\s*(;|$)/g;var iu=!!i.useInsertionEffect&&i.useInsertionEffect||function(e){return e()},au=i.createContext("undefined"!=typeof HTMLElement?Xc({key:"css"}):null);au.Provider;var su=i.createContext({}),lu=Ic(function(e){return Ic(function(t){return function(e,t){return"function"==typeof t?t(e):Zc({},e,t)}(e,t)})}),cu=function(e){var t=i.useContext(su);return e.theme!==t&&(t=lu(t)(e.theme)),i.createElement(su.Provider,{value:t},e.children)};const uu={colors:{background:"hsl(0 0% 100%)",foreground:"hsl(222.2 84% 4.9%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(222.2 84% 4.9%)",popover:"hsl(0 0% 100%)",popoverForeground:"hsl(222.2 84% 4.9%)",primary:"hsl(221.2 83.2% 53.3%)",primaryForeground:"hsl(210 40% 98%)",secondary:"hsl(210 40% 96%)",secondaryForeground:"hsl(222.2 84% 4.9%)",muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",accent:"hsl(210 40% 96%)",accentForeground:"hsl(222.2 84% 4.9%)",destructive:"hsl(0 84.2% 60.2%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(214.3 31.8% 91.4%)",mutedBorder:"hsl(214.3 31.8% 91.4%)",input:"hsl(214.3 31.8% 91.4%)",ring:"hsl(221.2 83.2% 53.3%)"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},borderRadius:{sm:"calc(var(--radius) - 4px)",md:"calc(var(--radius) - 2px)",lg:"var(--radius)",xl:"0.75rem"},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},transitions:{fast:"0.15s ease-in-out",normal:"0.2s ease-in-out",slow:"0.3s ease-in-out"}},du={colors:{background:"hsl(222.2 84% 4.9%)",foreground:"hsl(210 40% 98%)",card:"hsl(222.2 84% 4.9%)",cardForeground:"hsl(210 40% 98%)",popover:"hsl(222.2 84% 4.9%)",popoverForeground:"hsl(210 40% 98%)",primary:"hsl(217.2 91.2% 59.8%)",primaryForeground:"hsl(222.2 84% 4.9%)",secondary:"hsl(217.2 32.6% 17.5%)",secondaryForeground:"hsl(210 40% 98%)",muted:"hsl(217.2 32.6% 17.5%)",mutedForeground:"hsl(215 20.2% 65.1%)",accent:"hsl(217.2 32.6% 17.5%)",accentForeground:"hsl(210 40% 98%)",destructive:"hsl(0 62.8% 30.6%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(217.2 32.6% 17.5%)",mutedBorder:"hsl(217.2 32.6% 5%)",input:"hsl(217.2 32.6% 17.5%)",ring:"hsl(224.3 76.3% 94.1%)"},spacing:uu.spacing,borderRadius:uu.borderRadius,fontSize:uu.fontSize,fontWeight:uu.fontWeight,shadows:uu.shadows,transitions:uu.transitions},fu=uu,pu=e.createContext(void 0),hu=()=>{const t=e.useContext(pu);return void 0===t?{theme:uu,setTheme:()=>{console.warn("Theme context not available. setTheme called but ignored.")},isDarkMode:!1}:t},mu=({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:a,targetPosition:s,style:l={},markerEnd:c,bidirectional:u=!1,data:d,clientToSvgCoords:f,svgRef:p})=>{e.useState(!1);const{theme:h}=hu(),m=h.colors,[g,y,v]=e.useMemo(()=>gr({sourceX:n,sourceY:o,targetX:r,targetY:i}),[n,o,r,i]),b={...l,stroke:(()=>{const e=d?.details?.state,t=d?.details?.status,n=d?.details?.output;return"Error"===e||"Error"===t||"string"==typeof n&&n.includes("ERROR:")?m.destructive:m.mutedForeground})(),strokeWidth:l.strokeWidth||2};return e.createElement(e.Fragment,null,e.createElement(fs,{path:g,style:b}))};var gu=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,yu=Lc(function(e){return gu.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),vu=function(e){return"theme"!==e},bu=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?yu:vu},xu=function(e,t,n){var o;if(t){var r=t.shouldForwardProp;o=e.__emotion_forwardProp&&r?function(t){return e.__emotion_forwardProp(t)&&r(t)}:r}return"function"!=typeof o&&n&&(o=e.__emotion_forwardProp),o},wu=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return Kc(t,n,o),iu(function(){return function(e,t,n){Kc(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var r=t;do{e.insert(t===r?"."+o:"",r,e.sheet,!0),r=r.next}while(void 0!==r)}}(t,n,o)}),null},Eu=function t(n,o){var r,a,s=n.__emotion_real===n,l=s&&n.__emotion_base||n;void 0!==o&&(r=o.label,a=o.target);var c=xu(n,o,s),u=c||bu(l),d=!u("as");return function(){var f=arguments,p=s&&void 0!==n.__emotion_styles?n.__emotion_styles.slice(0):[];if(void 0!==r&&p.push("label:"+r+";"),null==f[0]||void 0===f[0].raw)p.push.apply(p,f);else{var h=f[0];p.push(h[0]);for(var m=f.length,g=1;g<m;g++)p.push(f[g],h[g])}var y,v=(y=function(e,t,n){var o,r,s,f,h=d&&e.as||l,m="",g=[],y=e;if(null==e.theme){for(var v in y={},e)y[v]=e[v];y.theme=i.useContext(su)}"string"==typeof e.className?(o=t.registered,r=g,s=e.className,f="",s.split(" ").forEach(function(e){void 0!==o[e]?r.push(o[e]+";"):e&&(f+=e+" ")}),m=f):null!=e.className&&(m=e.className+" ");var b=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var o=!0,r="";ou=void 0;var i=e[0];null==i||void 0===i.raw?(o=!1,r+=nu(n,t,i)):r+=i[0];for(var a=1;a<e.length;a++)r+=nu(n,t,e[a]),o&&(r+=i[a]);ru.lastIndex=0;for(var s,l="";null!==(s=ru.exec(r));)l+="-"+s[1];var c=function(e){for(var t,n=0,o=0,r=e.length;r>=4;++o,r-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(r)+l;return{name:c,styles:r,next:ou}}(p.concat(g),t.registered,y);m+=t.key+"-"+b.name,void 0!==a&&(m+=" "+a);var x=d&&void 0===c?bu(h):u,w={};for(var E in e)d&&"as"===E||x(E)&&(w[E]=e[E]);return w.className=m,n&&(w.ref=n),i.createElement(i.Fragment,null,i.createElement(wu,{cache:t,serialized:b,isStringTag:"string"==typeof h}),i.createElement(h,w))},e.forwardRef(function(t,n){var o=e.useContext(au);return y(t,o,n)}));return v.displayName=void 0!==r?r:"Styled("+("string"==typeof l?l:l.displayName||l.name||"Component")+")",v.defaultProps=n.defaultProps,v.__emotion_real=v,v.__emotion_base=l,v.__emotion_styles=p,v.__emotion_forwardProp=c,Object.defineProperty(v,"toString",{value:function(){return"."+a}}),v.withComponent=function(e,n){return t(e,Zc({},o,n,{shouldForwardProp:xu(v,n,!0)})).apply(void 0,p)},v}}.bind(null);function ku(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=ku(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Su(e){return e.split(/[-_\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}function Cu(e){if(null==e)return"$0.00";if(Math.abs(e)<.01&&0!==e){const t=e.toString().split(".")[1]?.length||0,n=Math.max(3,Math.min(t,2));return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:Math.min(3,n),maximumFractionDigits:n}).format(e)}const t=e.toString().split(".")[1]?.length||0,n=Math.max(2,Math.min(t,2));return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:n}).format(e)}function _u(e){if(e<1)return`${Math.round(1e3*e)}ms`;if(e<60)return`${e.toFixed(1)}s`;return`${Math.floor(e/60)}m ${Math.round(e%60/1e3)}s`}function Nu(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}function Mu(e,t,n="#000000"){return e?.colors?.[t]?e.colors[t]:(console.warn(`Theme color '${t}' not found, using fallback: ${n}`),n)}function Pu(e,t,n="1rem"){return e?.spacing?.[t]?e.spacing[t]:(console.warn(`Theme spacing '${t}' not found, using fallback: ${n}`),n)}function Ou(e){return e||(console.warn("Theme is undefined, using default light theme"),{colors:{background:"hsl(0 0% 100%)",foreground:"hsl(222.2 84% 4.9%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(222.2 84% 4.9%)",popover:"hsl(0 0% 100%)",popoverForeground:"hsl(222.2 84% 4.9%)",primary:"hsl(221.2 83.2% 53.3%)",primaryForeground:"hsl(210 40% 98%)",secondary:"hsl(210 40% 96%)",secondaryForeground:"hsl(222.2 84% 4.9%)",muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",accent:"hsl(210 40% 96%)",accentForeground:"hsl(222.2 84% 4.9%)",destructive:"hsl(0 84.2% 60.2%)",destructiveForeground:"hsl(210 40% 98%)",border:"hsl(214.3 31.8% 91.4%)",mutedBorder:"hsl(214.3 31.8% 91.4%)",input:"hsl(214.3 31.8% 91.4%)",ring:"hsl(221.2 83.2% 53.3%)"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})}["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach(function(e){Eu[e]=Eu(e)});const Ru=Eu.div`
16
16
  position: relative;
17
17
  display: inline-block;
18
- `,pc=rc.div`
18
+ `,$u=Eu.div`
19
19
  position: absolute;
20
20
  z-index: 1000;
21
21
  padding: 8px 12px;
@@ -47,7 +47,7 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
47
47
 
48
48
  /* Placement-specific positioning and arrow */
49
49
  ${({placement:e,themeColors:t})=>{switch(e){case"top":default:return`\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n margin-bottom: 8px;\n &::before {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border-top-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-top-color: ${t.popover};\n }\n `;case"bottom":return`\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n margin-top: 8px;\n &::before {\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n border-bottom-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-bottom-color: ${t.popover};\n }\n `;case"left":return`\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-right: 8px;\n &::before {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n border-left-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-left-color: ${t.popover};\n }\n `;case"right":return`\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-left: 8px;\n &::before {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n border-right-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-right-color: ${t.popover};\n }\n `;case"topLeft":return`\n bottom: 100%;\n right: 0;\n margin-bottom: 8px;\n &::before {\n top: 100%;\n right: 8px;\n border-top-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n top: 100%;\n right: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-top-color: ${t.popover};\n }\n `;case"topRight":return`\n bottom: 100%;\n left: 0;\n margin-bottom: 8px;\n &::before {\n top: 100%;\n left: 8px;\n border-top-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n top: 100%;\n left: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-top-color: ${t.popover};\n }\n `;case"bottomLeft":return`\n top: 100%;\n right: 0;\n margin-top: 8px;\n &::before {\n bottom: 100%;\n right: 8px;\n border-bottom-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n bottom: 100%;\n right: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-bottom-color: ${t.popover};\n }\n `;case"bottomRight":return`\n top: 100%;\n left: 0;\n margin-top: 8px;\n &::before {\n bottom: 100%;\n left: 8px;\n border-bottom-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n bottom: 100%;\n left: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-bottom-color: ${t.popover};\n }\n `;case"leftTop":return`\n right: 100%;\n bottom: 0;\n margin-right: 8px;\n &::before {\n left: 100%;\n bottom: 8px;\n border-left-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n left: 100%;\n bottom: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-left-color: ${t.popover};\n }\n `;case"leftBottom":return`\n right: 100%;\n top: 0;\n margin-right: 8px;\n &::before {\n left: 100%;\n top: 8px;\n border-left-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n left: 100%;\n top: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-left-color: ${t.popover};\n }\n `;case"rightTop":return`\n left: 100%;\n bottom: 0;\n margin-left: 8px;\n &::before {\n right: 100%;\n bottom: 8px;\n border-right-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n right: 100%;\n bottom: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-right-color: ${t.popover};\n }\n `;case"rightBottom":return`\n left: 100%;\n top: 0;\n margin-left: 8px;\n &::before {\n right: 100%;\n top: 8px;\n border-right-color: ${t.border};\n }\n &::after {\n content: "";\n position: absolute;\n right: 100%;\n top: 8px;\n width: 0;\n height: 0;\n border: 3px solid transparent;\n border-right-color: ${t.popover};\n }\n `}}}
50
- `,hc=({children:e,content:t,placement:n="top",delay:r=300})=>{const{theme:o}=ql(),[i,s]=a.useState(!1),l=a.useRef(),c=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(!0)},r)},u=()=>{l.current&&clearTimeout(l.current),s(!1)};return a.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),a.createElement(fc,{onMouseEnter:c,onMouseLeave:u,onFocus:c,onBlur:u},e,a.createElement(pc,{isVisible:i,placement:n,themeColors:o.colors,role:"tooltip"},t))},mc=rc.div`
50
+ `,Au=({children:e,content:t,placement:n="top",delay:o=300})=>{const{theme:r}=hu(),[a,s]=i.useState(!1),l=i.useRef(),c=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(!0)},o)},u=()=>{l.current&&clearTimeout(l.current),s(!1)};return i.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),i.createElement(Ru,{onMouseEnter:c,onMouseLeave:u,onFocus:c,onBlur:u},e,i.createElement($u,{isVisible:a,placement:n,themeColors:r.colors,role:"tooltip"},t))},Du=Eu.div`
51
51
  display: inline-flex;
52
52
  align-items: center;
53
53
  border-radius: 9999px;
@@ -64,9 +64,9 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
64
64
  }
65
65
 
66
66
  ${({variant:e,themeColors:t})=>{switch(e){case"default":default:return`\n background-color: ${t.primary};\n color: ${t.primaryForeground};\n &:hover {\n background-color: ${t.primary};\n opacity: 0.9;\n }\n `;case"secondary":case"cost":case"gray":case"latency":case"latencyLow":case"latencyMedium":return`\n background-color: ${t.secondary};\n color: ${t.secondaryForeground};\n &:hover {\n background-color: ${t.muted};\n }\n `;case"destructive":case"latencyHigh":return`\n background-color: ${t.destructive};\n color: ${t.destructiveForeground};\n &:hover {\n background-color: ${t.destructive};\n opacity: 0.9;\n }\n `;case"outline":return`\n background-color: transparent;\n color: ${t.cardForeground};\n border-color: ${t.border};\n `}}}
67
- `,gc=({variant:e="default",children:t,title:n,placement:r="top"})=>{const{theme:o}=ql(),i=o.colors,s=a.createElement(mc,{variant:e,themeColors:i},t);return n?a.createElement(hc,{content:n,placement:r},s):s},yc=({label:t,content:n,isExpanded:r,onToggle:o})=>{const{theme:a}=ql(),i=a?.colors||{muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",border:"hsl(214.3 31.8% 91.4%)",foreground:"hsl(222.2 84% 4.9%)"},s=r?n:n?.slice(0,100)+(n?.length>100?"...":"");return e.createElement(vc,null,e.createElement(bc,{onClick:o,onMouseEnter:e=>{e.currentTarget.style.backgroundColor=i.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},e.createElement(wc,{style:{color:i.mutedForeground}},t),e.createElement(Ec,null,r?e.createElement(ys,{style:{width:"12px",height:"12px",color:i.mutedForeground}}):e.createElement(vs,{style:{width:"12px",height:"12px",color:i.mutedForeground}}))),e.createElement(xc,{value:s||"",readOnly:!0,rows:r?Math.max(3,Math.max(n?.split("\n").length||0,Math.ceil((n?.length||0)/60))):2,style:{border:`1px solid ${i.border}`,backgroundColor:i.muted,color:i.foreground}}))},vc=rc.div`
67
+ `,Tu=({variant:e="default",children:t,title:n,placement:o="top"})=>{const{theme:r}=hu(),a=r.colors,s=i.createElement(Du,{variant:e,themeColors:a},t);return n?i.createElement(Au,{content:n,placement:o},s):s},zu=({label:t,content:n,isExpanded:o,onToggle:r})=>{const{theme:i}=hu(),a=i?.colors||{muted:"hsl(210 40% 96%)",mutedForeground:"hsl(215.4 16.3% 46.9%)",border:"hsl(214.3 31.8% 91.4%)",foreground:"hsl(222.2 84% 4.9%)"},s=o?n:n?.slice(0,100)+(n?.length>100?"...":"");return e.createElement(Iu,null,e.createElement(Lu,{onClick:r,onMouseEnter:e=>{e.currentTarget.style.backgroundColor=a.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},e.createElement(ju,{style:{color:a.mutedForeground}},t),e.createElement(Fu,null,o?e.createElement(zl,{style:{width:"12px",height:"12px",color:a.mutedForeground}}):e.createElement(Il,{style:{width:"12px",height:"12px",color:a.mutedForeground}}))),e.createElement(Bu,{value:s||"",readOnly:!0,rows:o?Math.max(3,Math.max(n?.split("\n").length||0,Math.ceil((n?.length||0)/60))):2,style:{border:`1px solid ${a.border}`,backgroundColor:a.muted,color:a.foreground}}))},Iu=Eu.div`
68
68
  width: 100%;
69
- `,bc=rc.div`
69
+ `,Lu=Eu.div`
70
70
  display: flex;
71
71
  justify-content: space-between;
72
72
  align-items: center;
@@ -80,10 +80,10 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
80
80
  &:hover {
81
81
  background-color: transparent;
82
82
  }
83
- `,wc=rc.span`
83
+ `,ju=Eu.span`
84
84
  font-weight: 600;
85
85
  font-size: 0.75rem;
86
- `,xc=rc.textarea`
86
+ `,Bu=Eu.textarea`
87
87
  box-sizing: border-box;
88
88
  width: 100%;
89
89
  border-radius: 0.25rem;
@@ -99,11 +99,11 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
99
99
  }
100
100
 
101
101
  transition: all 0.2s ease-in-out;
102
- `,Ec=rc.div`
102
+ `,Fu=Eu.div`
103
103
  transition: transform 0.2s ease-in-out;
104
- `,Sc=rc.div`
104
+ `,Hu=Eu.div`
105
105
  user-select: none;
106
- `,_c=rc.div`
106
+ `,Vu=Eu.div`
107
107
  display: flex;
108
108
  align-items: center;
109
109
  gap: 0.25rem;
@@ -115,7 +115,7 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
115
115
  &:hover {
116
116
  background-color: ${e=>e.isExpandable?e.themeColors.muted:"transparent"};
117
117
  }
118
- `,Cc=rc.div`
118
+ `,Wu=Eu.div`
119
119
  width: 0.5rem;
120
120
  height: 0.5rem;
121
121
  flex-shrink: 0;
@@ -123,31 +123,31 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
123
123
  align-items: center;
124
124
  justify-content: center;
125
125
  color: ${e=>e.themeColors.mutedForeground};
126
- `,kc=rc.span`
126
+ `,Yu=Eu.span`
127
127
  font-weight: 500;
128
128
  color: ${e=>e.themeColors.foreground};
129
129
  font-size: 0.75rem;
130
- `,Nc=rc.span`
130
+ `,Xu=Eu.span`
131
131
  font-size: 0.75rem;
132
132
  color: ${e=>e.themeColors.primary};
133
- `,Mc=rc.span`
133
+ `,Zu=Eu.span`
134
134
  font-size: 0.75rem;
135
135
  color: ${e=>e.themeColors.mutedForeground};
136
- `,Rc=rc.div`
136
+ `,Ku=Eu.div`
137
137
  border-left: 1px solid ${e=>e.themeColors.border};
138
138
  margin-left: 0.5rem;
139
- `,Oc=rc.div`
139
+ `,qu=Eu.div`
140
140
  width: 100%;
141
141
  background-color: ${e=>e.themeColors.muted};
142
142
  border-radius: 0.5rem;
143
143
  border: 1px solid ${e=>e.themeColors.border};
144
144
  overflow: hidden;
145
- `,Pc=rc.div`
145
+ `,Uu=Eu.div`
146
146
  width: 100%;
147
147
  max-height: 16rem;
148
148
  overflow-y: auto;
149
149
  padding: 0.5rem;
150
- `,Ac=rc.div`
150
+ `,Gu=Eu.div`
151
151
  width: 100%;
152
152
  padding: 1rem;
153
153
  text-align: center;
@@ -156,7 +156,7 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
156
156
  background-color: ${e=>e.themeColors.muted};
157
157
  border-radius: 0.5rem;
158
158
  border: 1px solid ${e=>e.themeColors.border};
159
- `,Tc=rc.div`
159
+ `,Qu=Eu.div`
160
160
  width: 100%;
161
161
  padding: 0.5rem;
162
162
  background-color: ${e=>e.themeColors.muted};
@@ -165,7 +165,7 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
165
165
  font-size: 0.75rem;
166
166
  color: ${e=>e.themeColors.foreground};
167
167
  word-break: break-all;
168
- `;rc.div`
168
+ `;Eu.div`
169
169
  width: 100%;
170
170
  padding: 1rem;
171
171
  text-align: center;
@@ -175,14 +175,14 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
175
175
  border-radius: 0.5rem;
176
176
  border: 1px solid ${e=>e.themeColors.border};
177
177
  margin-bottom: 0.5rem;
178
- `;const $c=rc.span`
178
+ `;const Ju=Eu.span`
179
179
  font-weight: 500;
180
180
  color: ${e=>e.themeColors.cardForeground};
181
181
  font-size: 0.875rem;
182
- `,Dc=rc.span`
182
+ `,ed=Eu.span`
183
183
  color: ${e=>e.themeColors.foreground};
184
184
  font-size: 0.875rem;
185
- `,Ic=rc.div`
185
+ `,td=Eu.div`
186
186
  width: 100%;
187
187
  padding: 1rem;
188
188
  text-align: center;
@@ -191,13 +191,13 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
191
191
  background-color: ${e=>e.themeColors.muted};
192
192
  border-radius: 0.5rem;
193
193
  border: 1px solid ${e=>e.themeColors.border};
194
- `,zc=rc.span`
194
+ `,nd=Eu.span`
195
195
  color: ${e=>e.themeColors.mutedForeground};
196
- `,Lc=(e,t=["input","output"])=>Object.entries(e).sort(([e],[n])=>{const r=t.indexOf(e),o=t.indexOf(n);return-1!==r&&-1!==o?r-o:-1!==r?-1:-1!==o?1:e.localeCompare(n)}),Bc=({data:t,label:n,depth:r,maxDepth:o,path:a,priorityKeys:i})=>{const[s,l]=e.useState(!1),{theme:c}=ql(),u=c.colors,d=null!==t&&"object"==typeof t&&!Array.isArray(t),f=Array.isArray(t),p=(d||f)&&r<o,h=p&&Object.keys(t).length>0;return e.createElement(Sc,null,e.createElement(_c,{isExpandable:p,themeColors:u,onClick:()=>{p&&l(!s)},style:{paddingLeft:12*r+8+"px"}},e.createElement(Cc,{themeColors:u},p&&h?s?e.createElement(ys,{size:12}):e.createElement(vs,{size:12}):e.createElement("div",{style:{width:"12px",height:"12px"}})),e.createElement(kc,{themeColors:u},n,":"),!p&&e.createElement(Nc,{valueType:(m=t,null===m?"null":void 0===m?"undefined":typeof m),themeColors:u},(e=>null===e?"null":void 0===e?"undefined":"string"==typeof e?`"${e}"`:"number"==typeof e||"boolean"==typeof e?e.toString():Array.isArray(e)?`Array(${e.length})`:"object"==typeof e?`Object(${Object.keys(e).length})`:String(e))(t)),p&&!h&&e.createElement(Mc,{themeColors:u},f?"[]":"{}"),p&&h&&!s&&e.createElement(Mc,{themeColors:u},f?`[${Object.keys(t).length} items]`:`{${Object.keys(t).length} keys}`)),s&&h&&e.createElement(Rc,{themeColors:u},Lc(t,i).map(([t,n])=>e.createElement(Bc,{key:`${a}.${t}`,data:n,label:t,depth:r+1,maxDepth:o,path:`${a}.${t}`,priorityKeys:i}))));var m},Fc=({data:t,maxDepth:n=4,initialExpanded:r=!1,className:o="",priorityKeys:a=["input","output"]})=>{const{theme:i}=ql(),s=i.colors;return null==t?e.createElement(Ac,{themeColors:s,className:o},"No data available"):"object"!=typeof t?e.createElement(Tc,{themeColors:s,className:o},e.createElement($c,{themeColors:s},"Value:")," ",e.createElement(Dc,{themeColors:s},String(t))):0===Object.keys(t).length?e.createElement(Ic,{themeColors:s,className:o},e.createElement(zc,{themeColors:s},Array.isArray(t)?"Empty array":"Empty object")):e.createElement(Oc,{themeColors:s,className:o},e.createElement(Pc,null,Lc(t,a).map(([t,r])=>e.createElement(Bc,{key:t,data:r,label:t,depth:0,maxDepth:n,path:t,priorityKeys:a}))))},jc=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n,display:"block"},fill:"currentColor",viewBox:"0 0 24 24",role:"img",xmlns:"http://www.w3.org/2000/svg"},e.createElement("title",null,"OpenAI icon"),e.createElement("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})),Hc=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n},xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},e.createElement("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.createElement("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.createElement("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.createElement("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"}),e.createElement("path",{d:"M1 1h22v22H1z",fill:"none"})),Vc=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24"},e.createElement("path",{fill:"currentColor",d:"m13.788825 3.932 6.43325 16.136075h3.5279L17.316725 3.932H13.788825Z",strokeWidth:"0.25"}),e.createElement("path",{fill:"currentColor",d:"m6.325375 13.682775 2.20125 -5.67065 2.201275 5.67065H6.325375ZM6.68225 3.932 0.25 20.068075h3.596525l1.3155 -3.3886h6.729425l1.315275 3.3886h3.59655L10.371 3.932H6.68225Z",strokeWidth:"0.25"})),Wc=({isVisible:r,onClose:o,nodeData:a,triggerRef:i})=>{const{theme:s}=ql(),[l,c]=e.useState({top:0,left:0,arrowPosition:"right"});if(e.useEffect(()=>{if(r&&i.current){const e=i.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=400,o=600,a=12;if(e.width>0&&e.height>0&&e.top>=0&&e.left>=0){let i=e.right+a,s=e.top,l="right";i+r>t&&(i=e.left-r-a,l="left"),s<0?s=20:s+o>n&&(s=n-o-20),c({top:s,left:i,arrowPosition:l})}else{const e=Math.max(20,(t-r)/2),a=Math.max(20,(n-o)/2);c({top:a,left:e,arrowPosition:"none"})}}},[r,i]),e.useEffect(()=>{const e=e=>{"Escape"===e.key&&o()};if(r)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r,o]),e.useEffect(()=>{const e=e=>{r&&i.current&&!i.current.contains(e.target)&&!e.target.closest("[data-popover-content]")&&o()};if(r)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,o,i]),!r)return null;const u=a.details?.internals?.llm_details?.[0],d=a.details?.internals?.latency;console.log(a);const f=e.createElement(Yc,{style:{top:l.top,left:l.left}},e.createElement(Xc,{"data-popover-content":!0,$arrowPosition:l.arrowPosition},e.createElement(Kc,null,e.createElement(Uc,null,e.createElement(iu,null,((t,n)=>{if("tool"===t)return"🔧";if("coordinator"===t)return"🎯";if("agent"===t){if("OpenAI"===n)return e.createElement(jc,null);if("Anthropic"===n)return e.createElement(Vc,null);if("Google"===n||"Vertex_AI"===n)return e.createElement(Hc,null)}return"🤖"})(a.nodeType||"Agent",u?.model_provider)),e.createElement("span",null,a.label||"Agent Node")),e.createElement(qc,{onClick:o},e.createElement(Ss,{size:16}))),e.createElement(Zc,null,e.createElement(Gc,null,e.createElement(Jc,null,"🔍 Node Information"),e.createElement(Qc,null,e.createElement(eu,null,e.createElement(tu,null,"Type:"),e.createElement(nu,null,a.nodeType)),e.createElement(eu,null,e.createElement(tu,null,"ID:"),e.createElement(nu,null,a.id||"N/A")))),u&&e.createElement(Gc,null,e.createElement(Jc,null,"🤖 LLM Details"),e.createElement(Qc,null,e.createElement(eu,null,e.createElement(tu,null,"Model:"),e.createElement(nu,null,u.model_name)),e.createElement(eu,null,e.createElement(tu,null,"Provider:"),e.createElement(nu,null,u.model_provider)),e.createElement(eu,null,e.createElement(tu,null,"Input Tokens:"),e.createElement(nu,null,u.input_tokens?e.createElement(n,{end:u.input_tokens,duration:1.2,separator:",",useEasing:!0}):"N/A")),e.createElement(eu,null,e.createElement(tu,null,"Output Tokens:"),e.createElement(nu,null,u.output_tokens?e.createElement(n,{end:u.output_tokens,duration:1.2,separator:",",useEasing:!0}):"N/A")),e.createElement(eu,null,e.createElement(tu,null,"Total Cost:"),e.createElement(nu,null,ic(u.total_cost))),u.system_fingerprint&&e.createElement(eu,null,e.createElement(tu,null,"System Fingerprint:"),e.createElement(nu,null,u.system_fingerprint)))),d&&e.createElement(Gc,null,e.createElement(Jc,null,"🚀 Performance"),e.createElement(Qc,null,e.createElement(eu,null,e.createElement(tu,null,"Total Time:"),e.createElement(nu,null,sc(d.total_time))))),u?.input&&u.input.length>0&&e.createElement(Gc,null,e.createElement(Jc,null,"Input Messages"),u.input.map((t,n)=>e.createElement(ru,{key:n},e.createElement(ou,null,"system"===t.role?"System Message":"User Message"),e.createElement(au,null,"object"==typeof t.content?JSON.stringify(t.content,null,2):String(t.content))))),u?.output&&e.createElement(Gc,null,e.createElement(Jc,null,"Output"),e.createElement(au,null,Array.isArray(u.output.content)?u.output.content.map((t,n)=>e.createElement("div",{key:n},"object"==typeof t?JSON.stringify(t,null,2):String(t))):"object"==typeof u.output.content?JSON.stringify(u.output.content,null,2):String(u.output.content))),e.createElement(Gc,null,e.createElement(Jc,null,"Raw Data"),e.createElement(Fc,{data:a.details||{}})))));return t.createPortal(f,document.body)},Yc=rc.div`
196
+ `,od=(e,t=["input","output"])=>Object.entries(e).sort(([e],[n])=>{const o=t.indexOf(e),r=t.indexOf(n);return-1!==o&&-1!==r?o-r:-1!==o?-1:-1!==r?1:e.localeCompare(n)}),rd=({data:t,label:n,depth:o,maxDepth:r,path:i,priorityKeys:a})=>{const[s,l]=e.useState(!1),{theme:c}=hu(),u=c.colors,d=null!==t&&"object"==typeof t&&!Array.isArray(t),f=Array.isArray(t),p=(d||f)&&o<r,h=p&&Object.keys(t).length>0;return e.createElement(Hu,null,e.createElement(Vu,{isExpandable:p,themeColors:u,onClick:()=>{p&&l(!s)},style:{paddingLeft:12*o+8+"px"}},e.createElement(Wu,{themeColors:u},p&&h?s?e.createElement(zl,{size:12}):e.createElement(Il,{size:12}):e.createElement("div",{style:{width:"12px",height:"12px"}})),e.createElement(Yu,{themeColors:u},n,":"),!p&&e.createElement(Xu,{valueType:(m=t,null===m?"null":void 0===m?"undefined":typeof m),themeColors:u},(e=>null===e?"null":void 0===e?"undefined":"string"==typeof e?`"${e}"`:"number"==typeof e||"boolean"==typeof e?e.toString():Array.isArray(e)?`Array(${e.length})`:"object"==typeof e?`Object(${Object.keys(e).length})`:String(e))(t)),p&&!h&&e.createElement(Zu,{themeColors:u},f?"[]":"{}"),p&&h&&!s&&e.createElement(Zu,{themeColors:u},f?`[${Object.keys(t).length} items]`:`{${Object.keys(t).length} keys}`)),s&&h&&e.createElement(Ku,{themeColors:u},od(t,a).map(([t,n])=>e.createElement(rd,{key:`${i}.${t}`,data:n,label:t,depth:o+1,maxDepth:r,path:`${i}.${t}`,priorityKeys:a}))));var m},id=({data:t,maxDepth:n=4,initialExpanded:o=!1,className:r="",priorityKeys:i=["input","output"]})=>{const{theme:a}=hu(),s=a.colors;return null==t?e.createElement(Gu,{themeColors:s,className:r},"No data available"):"object"!=typeof t?e.createElement(Qu,{themeColors:s,className:r},e.createElement(Ju,{themeColors:s},"Value:")," ",e.createElement(ed,{themeColors:s},String(t))):0===Object.keys(t).length?e.createElement(td,{themeColors:s,className:r},e.createElement(nd,{themeColors:s},Array.isArray(t)?"Empty array":"Empty object")):e.createElement(qu,{themeColors:s,className:r},e.createElement(Uu,null,od(t,i).map(([t,o])=>e.createElement(rd,{key:t,data:o,label:t,depth:0,maxDepth:n,path:t,priorityKeys:i}))))},ad=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n,display:"block"},fill:"currentColor",viewBox:"0 0 24 24",role:"img",xmlns:"http://www.w3.org/2000/svg"},e.createElement("title",null,"OpenAI icon"),e.createElement("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})),sd=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n},xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},e.createElement("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.createElement("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.createElement("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.createElement("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"}),e.createElement("path",{d:"M1 1h22v22H1z",fill:"none"})),ld=({width:t="1.5rem",height:n="1.5rem"})=>e.createElement("svg",{style:{width:"number"==typeof t?`${t}px`:t,height:"number"==typeof n?`${n}px`:n},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",height:"24",width:"24"},e.createElement("path",{fill:"currentColor",d:"m13.788825 3.932 6.43325 16.136075h3.5279L17.316725 3.932H13.788825Z",strokeWidth:"0.25"}),e.createElement("path",{fill:"currentColor",d:"m6.325375 13.682775 2.20125 -5.67065 2.201275 5.67065H6.325375ZM6.68225 3.932 0.25 20.068075h3.596525l1.3155 -3.3886h6.729425l1.315275 3.3886h3.59655L10.371 3.932H6.68225Z",strokeWidth:"0.25"})),cd=({isVisible:t,onClose:r,nodeData:i,triggerRef:a})=>{const{theme:s}=hu(),[l,c]=e.useState({top:0,left:0,arrowPosition:"right"});if(e.useEffect(()=>{if(t&&a.current){const e=a.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,o=400,r=600,i=12;if(e.width>0&&e.height>0&&e.top>=0&&e.left>=0){let a=e.right+i,s=e.top,l="right";a+o>t&&(a=e.left-o-i,l="left"),s<0?s=20:s+r>n&&(s=n-r-20),c({top:s,left:a,arrowPosition:l})}else{const e=Math.max(20,(t-o)/2),i=Math.max(20,(n-r)/2);c({top:i,left:e,arrowPosition:"none"})}}},[t,a]),e.useEffect(()=>{const e=e=>{"Escape"===e.key&&r()};if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,r]),e.useEffect(()=>{const e=e=>{t&&a.current&&!a.current.contains(e.target)&&!e.target.closest("[data-popover-content]")&&r()};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t,r,a]),!t)return null;const u=i.details?.internals?.llm_details?.[0],d=i.details?.internals?.latency;console.log(i);const f=e.createElement(ud,{style:{top:l.top,left:l.left}},e.createElement(dd,{"data-popover-content":!0,$arrowPosition:l.arrowPosition},e.createElement(fd,null,e.createElement(pd,null,e.createElement(Cd,null,((t,n)=>{if("tool"===t)return"🔧";if("coordinator"===t)return"🎯";if("agent"===t){if("OpenAI"===n)return e.createElement(ad,null);if("Anthropic"===n)return e.createElement(ld,null);if("Google"===n||"Vertex_AI"===n)return e.createElement(sd,null)}return"🤖"})(i.nodeType||"Agent",u?.model_provider)),e.createElement("span",null,i.label||"Agent Node")),e.createElement(hd,{onClick:r},e.createElement(Hl,{size:16}))),e.createElement(md,null,e.createElement(gd,null,e.createElement(yd,null,"🔍 Node Information"),e.createElement(vd,null,e.createElement(bd,null,e.createElement(xd,null,"Type:"),e.createElement(wd,null,i.nodeType)),e.createElement(bd,null,e.createElement(xd,null,"ID:"),e.createElement(wd,null,i.id||"N/A")))),u&&e.createElement(gd,null,e.createElement(yd,null,"🤖 LLM Details"),e.createElement(vd,null,e.createElement(bd,null,e.createElement(xd,null,"Model:"),e.createElement(wd,null,u.model_name)),e.createElement(bd,null,e.createElement(xd,null,"Provider:"),e.createElement(wd,null,u.model_provider)),e.createElement(bd,null,e.createElement(xd,null,"Input Tokens:"),e.createElement(wd,null,u.input_tokens?e.createElement(o,{end:u.input_tokens,duration:1.2,separator:",",useEasing:!0}):"N/A")),e.createElement(bd,null,e.createElement(xd,null,"Output Tokens:"),e.createElement(wd,null,u.output_tokens?e.createElement(o,{end:u.output_tokens,duration:1.2,separator:",",useEasing:!0}):"N/A")),e.createElement(bd,null,e.createElement(xd,null,"Total Cost:"),e.createElement(wd,null,Cu(u.total_cost))),u.system_fingerprint&&e.createElement(bd,null,e.createElement(xd,null,"System Fingerprint:"),e.createElement(wd,null,u.system_fingerprint)))),d&&e.createElement(gd,null,e.createElement(yd,null,"🚀 Performance"),e.createElement(vd,null,e.createElement(bd,null,e.createElement(xd,null,"Total Time:"),e.createElement(wd,null,_u(d.total_time))))),u?.input&&u.input.length>0&&e.createElement(gd,null,e.createElement(yd,null,"Input Messages"),u.input.map((t,n)=>e.createElement(Ed,{key:n},e.createElement(kd,null,"system"===t.role?"System Message":"User Message"),e.createElement(Sd,null,"object"==typeof t.content?JSON.stringify(t.content,null,2):String(t.content))))),u?.output&&e.createElement(gd,null,e.createElement(yd,null,"Output"),e.createElement(Sd,null,Array.isArray(u.output.content)?u.output.content.map((t,n)=>e.createElement("div",{key:n},"object"==typeof t?JSON.stringify(t,null,2):String(t))):"object"==typeof u.output.content?JSON.stringify(u.output.content,null,2):String(u.output.content))),e.createElement(gd,null,e.createElement(yd,null,"Raw Data"),e.createElement(id,{data:i.details||{}})))));return n.createPortal(f,document.body)},ud=Eu.div`
197
197
  position: fixed;
198
198
  z-index: 99999;
199
199
  pointer-events: none;
200
- `,Xc=rc.div`
200
+ `,dd=Eu.div`
201
201
  width: 400px;
202
202
  max-height: 600px;
203
203
  background-color: ${e=>e.theme?.colors?.background||"hsl(0 0% 100%)"};
@@ -227,7 +227,7 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
227
227
  @media (max-width: 768px) {
228
228
  width: 300px;
229
229
  }
230
- `,Kc=rc.div`
230
+ `,fd=Eu.div`
231
231
  display: flex;
232
232
  justify-content: space-between;
233
233
  align-items: center;
@@ -235,14 +235,14 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
235
235
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
236
236
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
237
237
  border-radius: 0.5rem 0.5rem 0 0;
238
- `,Uc=rc.div`
238
+ `,pd=Eu.div`
239
239
  display: flex;
240
240
  align-items: center;
241
241
  gap: 0.5rem;
242
242
  font-weight: 600;
243
243
  font-size: 0.875rem;
244
244
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
245
- `,qc=rc.button`
245
+ `,hd=Eu.button`
246
246
  display: flex;
247
247
  align-items: center;
248
248
  justify-content: center;
@@ -264,41 +264,41 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
264
264
  outline: 2px solid ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
265
265
  outline-offset: 2px;
266
266
  }
267
- `,Zc=rc.div`
267
+ `,md=Eu.div`
268
268
  max-height: 500px;
269
269
  overflow-y: auto;
270
270
  padding: 1rem;
271
271
  display: flex;
272
272
  flex-direction: column;
273
273
  gap: 1rem;
274
- `,Gc=rc.div`
274
+ `,gd=Eu.div`
275
275
  display: flex;
276
276
  flex-direction: column;
277
277
  gap: 0.75rem;
278
- `,Jc=rc.h3`
278
+ `,yd=Eu.h3`
279
279
  font-size: 1rem;
280
280
  font-weight: 600;
281
281
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
282
282
  margin: 0;
283
283
  padding-bottom: 0.5rem;
284
284
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
285
- `,Qc=rc.div`
285
+ `,vd=Eu.div`
286
286
  display: grid;
287
287
  grid-template-columns: 1fr 1fr;
288
288
  gap: 0.75rem;
289
- `,eu=rc.div`
289
+ `,bd=Eu.div`
290
290
  display: flex;
291
291
  flex-direction: column;
292
292
  gap: 0.25rem;
293
- `,tu=rc.span`
293
+ `,xd=Eu.span`
294
294
  font-size: 0.875rem;
295
295
  font-weight: 500;
296
296
  color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
297
- `,nu=rc.span`
297
+ `,wd=Eu.span`
298
298
  font-size: 0.875rem;
299
299
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
300
300
  word-break: break-word;
301
- `,ru=rc.div`
301
+ `,Ed=Eu.div`
302
302
  display: flex;
303
303
  flex-direction: column;
304
304
  gap: 0.5rem;
@@ -306,11 +306,11 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
306
306
  background-color: ${e=>e.theme?.colors?.muted||"hsl(210 40% 96%)"};
307
307
  border-radius: 0.375rem;
308
308
  border: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
309
- `,ou=rc.span`
309
+ `,kd=Eu.span`
310
310
  font-size: 0.875rem;
311
311
  font-weight: 600;
312
312
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
313
- `,au=rc.div`
313
+ `,Sd=Eu.div`
314
314
  font-size: 0.875rem;
315
315
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
316
316
  line-height: 1.5;
@@ -318,13 +318,13 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
318
318
  word-break: break-word;
319
319
  max-height: 200px;
320
320
  overflow-y: auto;
321
- `,iu=rc.div`
321
+ `,Cd=Eu.div`
322
322
  font-size: 1.25rem;
323
323
  display: flex;
324
324
  align-items: center;
325
325
  justify-content: center;
326
326
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
327
- `,su=({data:t,id:n,onInspect:r})=>{const{theme:o}=ql(),a=o?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},[i,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),f=e.useRef(null),p=t.edges?.some(e=>e.source===n)||!1,h=t.edges?.some(e=>e.target===n)||!1,m=t.label||ac("Agent")||"Agent",g=t.details?.internals?.llm_details?.[0]?.model_provider,y=(t=>"OpenAI"===t?e.createElement(jc,null):"Anthropic"===t?e.createElement(Vc,null):"Google"===t||"Vertex_AI"===t?e.createElement(Hc,null):"🤖")(g),v=t.details?.internals?.llm_details?.[0]?.model_name||"Unknown",b=ic(t.details?.internals?.llm_details?.[0]?.total_cost),w=t.details?.internals?.llm_details?.[0]?.input?.[0]?.content||"",x=t.details?.internals?.llm_details?.[0]?.input?.[1]?.content||"";return e.createElement(e.Fragment,null,e.createElement(lu,{ref:f,onClick:()=>{d(!0),r&&r(t)}},h&&e.createElement(Ho,{type:"target",position:no.Top,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1}),e.createElement(cu,null,e.createElement(uu,null,e.createElement(du,null,y),e.createElement(fu,null,m)),e.createElement(pu,null,e.createElement(gc,{variant:"gray",title:v},v),e.createElement(gc,{variant:"cost",title:t.details?.internals?.llm_details?.[0]?.total_cost?.toString()||""},b))),e.createElement(hu,null,e.createElement(yc,{label:"System Message",content:w,isExpanded:i,onToggle:e=>{e?.stopPropagation(),s(!i)}}),e.createElement(yc,{label:"User Message",content:x,isExpanded:l,onToggle:e=>{e?.stopPropagation(),c(!l)}})),p&&e.createElement(Ho,{type:"source",position:no.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1})),e.createElement(Wc,{isVisible:u,onClose:()=>{d(!1)},nodeData:{...t,id:n},triggerRef:f}))},lu=rc.div`
327
+ `,_d=({data:t,id:n,onInspect:o})=>{const{theme:r}=hu(),i=r?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},[a,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),f=e.useRef(null),p=t.edges?.some(e=>e.source===n)||!1,h=t.edges?.some(e=>e.target===n)||!1,m=t.label||Su("Agent")||"Agent",g=t.details?.internals?.llm_details?.[0]?.model_provider,y=(t=>"OpenAI"===t?e.createElement(ad,null):"Anthropic"===t?e.createElement(ld,null):"Google"===t||"Vertex_AI"===t?e.createElement(sd,null):"🤖")(g),v=t.details?.internals?.llm_details?.[0]?.model_name||"Unknown",b=Cu(t.details?.internals?.llm_details?.[0]?.total_cost),x=t.details?.internals?.llm_details?.[0]?.input?.[0]?.content||"",w=t.details?.internals?.llm_details?.[0]?.input?.[1]?.content||"";return e.createElement(e.Fragment,null,e.createElement(Nd,{ref:f,onClick:()=>{d(!0),o&&o(t)}},h&&e.createElement(Ya,{type:"target",position:wo.Top,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1}),e.createElement(Md,null,e.createElement(Pd,null,e.createElement(Od,null,y),e.createElement(Rd,null,m)),e.createElement($d,null,e.createElement(Tu,{variant:"gray",title:v},v),e.createElement(Tu,{variant:"cost",title:t.details?.internals?.llm_details?.[0]?.total_cost?.toString()||""},b))),e.createElement(Ad,null,e.createElement(zu,{label:"System Message",content:x,isExpanded:a,onToggle:e=>{e?.stopPropagation(),s(!a)}}),e.createElement(zu,{label:"User Message",content:w,isExpanded:l,onToggle:e=>{e?.stopPropagation(),c(!l)}})),p&&e.createElement(Ya,{type:"source",position:wo.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1})),e.createElement(cd,{isVisible:u,onClose:()=>{d(!1)},nodeData:{...t,id:n},triggerRef:f}))},Nd=Eu.div`
328
328
  border-radius: 0.5rem;
329
329
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
330
330
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -340,41 +340,41 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
340
340
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
341
341
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
342
342
  }
343
- `,cu=rc.div`
343
+ `,Md=Eu.div`
344
344
  display: flex;
345
345
  justify-content: space-between;
346
346
  align-items: center;
347
347
  gap: 0.5rem;
348
348
  padding: 0.75rem;
349
349
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
350
- `,uu=rc.div`
350
+ `,Pd=Eu.div`
351
351
  display: flex;
352
352
  align-items: center;
353
353
  gap: 0.5rem;
354
- `,du=rc.div`
354
+ `,Od=Eu.div`
355
355
  font-size: 1.25rem;
356
356
  display: flex;
357
357
  align-items: center;
358
358
  justify-content: center;
359
359
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
360
- `,fu=rc.div`
360
+ `,Rd=Eu.div`
361
361
  font-weight: 600;
362
362
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
363
363
  font-size: 0.875rem;
364
364
  word-break: break-words;
365
- `,pu=rc.div`
365
+ `,$d=Eu.div`
366
366
  display: flex;
367
367
  gap: 0.5rem;
368
368
  justify-content: flex-end;
369
369
  align-items: center;
370
- `,hu=rc.div`
370
+ `,Ad=Eu.div`
371
371
  padding: 0.75rem;
372
372
  display: flex;
373
373
  flex-direction: column;
374
374
  align-items: flex-start;
375
375
  justify-content: center;
376
376
  gap: 0.5rem;
377
- `,mu=({data:t,id:n,onInspect:r})=>{const{theme:o}=ql(),a=o?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},i=t.edges?.some(e=>e.source===n)||!1,s=t.edges?.some(e=>e.target===n)||!1,l=t.label||ac("Coordinator")||"Coordinator";return e.createElement(gu,{onClick:()=>{console.log("Coordinator node clicked:",{label:t.label,nodeType:t.nodeType,details:t.details})}},s&&e.createElement(Ho,{type:"target",position:no.Top,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1}),e.createElement(yu,null,e.createElement(vu,null,e.createElement(bu,null,"🎯"),e.createElement(wu,null,l)),e.createElement(xu,null,e.createElement(gc,{variant:"gray"},"Coordinator"))),e.createElement(Eu,null,e.createElement(Fc,{data:t.details?.internals||{}})),i&&e.createElement(Ho,{type:"source",position:no.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1}))},gu=rc.div`
377
+ `,Dd=({data:t,id:n,onInspect:o})=>{const{theme:r}=hu(),i=r?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},a=t.edges?.some(e=>e.source===n)||!1,s=t.edges?.some(e=>e.target===n)||!1,l=t.label||Su("Coordinator")||"Coordinator";return e.createElement(Td,{onClick:()=>{console.log("Coordinator node clicked:",{label:t.label,nodeType:t.nodeType,details:t.details})}},s&&e.createElement(Ya,{type:"target",position:wo.Top,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1}),e.createElement(zd,null,e.createElement(Id,null,e.createElement(Ld,null,"🎯"),e.createElement(jd,null,l)),e.createElement(Bd,null,e.createElement(Tu,{variant:"gray"},"Coordinator"))),e.createElement(Fd,null,e.createElement(id,{data:t.details?.internals||{}})),a&&e.createElement(Ya,{type:"source",position:wo.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1}))},Td=Eu.div`
378
378
  border-radius: 0.5rem;
379
379
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
380
380
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -390,41 +390,41 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
390
390
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
391
391
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
392
392
  }
393
- `,yu=rc.div`
393
+ `,zd=Eu.div`
394
394
  display: flex;
395
395
  justify-content: space-between;
396
396
  align-items: center;
397
397
  gap: 0.5rem;
398
398
  padding: 0.75rem;
399
399
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
400
- `,vu=rc.div`
400
+ `,Id=Eu.div`
401
401
  display: flex;
402
402
  align-items: center;
403
403
  gap: 0.5rem;
404
- `,bu=rc.div`
404
+ `,Ld=Eu.div`
405
405
  font-size: 1.25rem;
406
406
  display: flex;
407
407
  align-items: center;
408
408
  justify-content: center;
409
409
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
410
- `,wu=rc.div`
410
+ `,jd=Eu.div`
411
411
  font-weight: 600;
412
412
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
413
413
  font-size: 0.875rem;
414
414
  word-break: break-words;
415
- `,xu=rc.div`
415
+ `,Bd=Eu.div`
416
416
  display: flex;
417
417
  gap: 0.5rem;
418
418
  justify-content: flex-end;
419
419
  align-items: center;
420
- `,Eu=rc.div`
420
+ `,Fd=Eu.div`
421
421
  padding: 0.75rem;
422
422
  display: flex;
423
423
  flex-direction: column;
424
424
  align-items: flex-start;
425
425
  justify-content: center;
426
426
  gap: 0.5rem;
427
- `,Su=({data:t,id:n,onInspect:r})=>{const{theme:o}=ql(),a=o?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},i=t.edges?.some(e=>e.source===n)||!1,s=t.edges?.some(e=>e.target===n)||!1,l=t.label||ac("Tool")||"Tool",c=t.details?.internals?.latency?.total_time;return e.createElement(_u,{onClick:()=>{console.log("Tool node clicked:",{label:t.label,nodeType:t.nodeType,details:t.details})}},s&&e.createElement(Ho,{type:"target",position:no.Top,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1}),e.createElement(Cu,null,e.createElement(ku,null,e.createElement(Nu,null,"🔧"),e.createElement(Mu,null,l)),null!=c&&e.createElement(Ru,null,e.createElement(gc,{variant:"latency"},sc(c)))),e.createElement(Ou,null,e.createElement(Fc,{data:(()=>{const e=t.details?.internals||{};return t.edgeDetails&&t.edgeDetails.length>0?{...e,input:{args:t.edgeDetails[0]?.input_args,kwargs:t.edgeDetails[0]?.input_kwargs},output:t.edgeDetails[0]?.output,state:t.edgeDetails[0]?.state,status:t.edgeDetails[0]?.status}:e})()})),i&&e.createElement(Ho,{type:"source",position:no.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${a.primary}`,backgroundColor:a.background,cursor:"default"},isConnectable:!1}))},_u=rc.div`
427
+ `,Hd=({data:t,id:n,onInspect:o})=>{const{theme:r}=hu(),i=r?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},a=t.edges?.some(e=>e.source===n)||!1,s=t.edges?.some(e=>e.target===n)||!1,l=t.label||Su("Tool")||"Tool",c=t.details?.internals?.latency?.total_time;return e.createElement(Vd,{onClick:()=>{console.log("Tool node clicked:",{label:t.label,nodeType:t.nodeType,details:t.details})}},s&&e.createElement(Ya,{type:"target",position:wo.Top,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1}),e.createElement(Wd,null,e.createElement(Yd,null,e.createElement(Xd,null,"🔧"),e.createElement(Zd,null,l)),null!=c&&e.createElement(Kd,null,e.createElement(Tu,{variant:"latency"},_u(c)))),e.createElement(qd,null,e.createElement(id,{data:(()=>{const e=t.details?.internals||{};return t.edgeDetails&&t.edgeDetails.length>0?{...e,input:{args:t.edgeDetails[0]?.input_args,kwargs:t.edgeDetails[0]?.input_kwargs},output:t.edgeDetails[0]?.output,state:t.edgeDetails[0]?.state,status:t.edgeDetails[0]?.status}:e})()})),a&&e.createElement(Ya,{type:"source",position:wo.Bottom,style:{width:"8px",height:"8px",border:`2px solid ${i.primary}`,backgroundColor:i.background,cursor:"default"},isConnectable:!1}))},Vd=Eu.div`
428
428
  border-radius: 0.5rem;
429
429
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
430
430
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -440,60 +440,60 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
440
440
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
441
441
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
442
442
  }
443
- `,Cu=rc.div`
443
+ `,Wd=Eu.div`
444
444
  display: flex;
445
445
  justify-content: space-between;
446
446
  align-items: center;
447
447
  gap: 0.5rem;
448
448
  padding: 0.75rem;
449
449
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
450
- `,ku=rc.div`
450
+ `,Yd=Eu.div`
451
451
  display: flex;
452
452
  align-items: center;
453
453
  gap: 0.5rem;
454
- `,Nu=rc.div`
454
+ `,Xd=Eu.div`
455
455
  font-size: 1.25rem;
456
456
  display: flex;
457
457
  align-items: center;
458
458
  justify-content: center;
459
459
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
460
- `,Mu=rc.div`
460
+ `,Zd=Eu.div`
461
461
  font-weight: 600;
462
462
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
463
463
  font-size: 0.875rem;
464
464
  word-break: break-words;
465
- `,Ru=rc.div`
465
+ `,Kd=Eu.div`
466
466
  display: flex;
467
467
  gap: 0.5rem;
468
468
  justify-content: flex-end;
469
469
  align-items: center;
470
- `,Ou=rc.div`
470
+ `,qd=Eu.div`
471
471
  padding: 0.75rem;
472
472
  display: flex;
473
473
  flex-direction: column;
474
474
  align-items: flex-start;
475
475
  justify-content: center;
476
476
  gap: 0.5rem;
477
- `,Pu=({data:t,id:n})=>{const r=t.nodeType||"Agent",o=t.onInspect;switch(r){case"Agent":default:return e.createElement(su,{data:t,id:n,onInspect:o});case"Tool":return e.createElement(Su,{data:t,id:n,onInspect:o});case"Coordinator":return e.createElement(mu,{data:t,id:n,onInspect:o})}},Au=rc.div`
477
+ `,Ud=({data:t,id:n})=>{const o=t.nodeType||"Agent",r=t.onInspect;switch(o){case"Agent":default:return e.createElement(_d,{data:t,id:n,onInspect:r});case"Tool":return e.createElement(Hd,{data:t,id:n,onInspect:r});case"Coordinator":return e.createElement(Dd,{data:t,id:n,onInspect:r})}},Gd=Eu.div`
478
478
  background-color: ${e=>e.theme.colors.card};
479
479
  border: 1px solid ${e=>e.theme.colors.border};
480
480
  border-radius: 0.5rem;
481
481
  overflow: hidden;
482
482
  width: 100%;
483
483
  max-width: 400px;
484
- `,Tu=rc.div`
484
+ `,Qd=Eu.div`
485
485
  display: flex;
486
486
  justify-content: space-between;
487
487
  align-items: center;
488
488
  padding: 0.75rem;
489
489
  border-bottom: 1px solid ${e=>e.theme.colors.border};
490
490
  background-color: ${e=>e.theme.colors.muted};
491
- `,$u=rc.h3`
491
+ `,Jd=Eu.h3`
492
492
  margin: 0;
493
493
  font-size: 0.875rem;
494
494
  font-weight: 600;
495
495
  color: ${e=>e.theme.colors.cardForeground};
496
- `,Du=rc.button`
496
+ `,ef=Eu.button`
497
497
  display: flex;
498
498
  align-items: center;
499
499
  justify-content: center;
@@ -509,11 +509,11 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
509
509
  background-color: ${e=>e.theme.colors.accent};
510
510
  color: ${e=>e.theme.colors.accentForeground};
511
511
  }
512
- `,Iu=rc.div`
512
+ `,tf=Eu.div`
513
513
  padding: 0.75rem;
514
514
  max-height: 400px;
515
515
  overflow-y: auto;
516
- `,zu=rc.div`
516
+ `,nf=Eu.div`
517
517
  position: relative;
518
518
  padding: 0.5rem;
519
519
  border-radius: 0.375rem;
@@ -526,26 +526,26 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
526
526
  &:hover {
527
527
  background-color: ${e=>e.hasStep&&!e.isActive?e.theme.colors.accent:e.isActive?e.theme.colors.primary:"transparent"};
528
528
  }
529
- `,Lu=rc.div`
529
+ `,of=Eu.div`
530
530
  display: flex;
531
531
  align-items: center;
532
532
  gap: 0.5rem;
533
533
  margin-bottom: 0.25rem;
534
- `,Bu=rc.div`
534
+ `,rf=Eu.div`
535
535
  width: 0.5rem;
536
536
  height: 0.5rem;
537
537
  border-radius: 50%;
538
538
  background-color: ${e=>e.isActive?e.theme.colors.primaryForeground:e.isPast?e.theme.colors.primary:e.hasStep?e.theme.colors.mutedForeground:e.theme.colors.border};
539
539
  flex-shrink: 0;
540
- `,Fu=rc.span`
540
+ `,af=Eu.span`
541
541
  font-weight: 600;
542
542
  font-size: 0.75rem;
543
543
  color: ${e=>e.isActive?e.theme.colors.primaryForeground:e.theme.colors.cardForeground};
544
- `,ju=rc.div`
544
+ `,sf=Eu.div`
545
545
  font-size: 0.75rem;
546
546
  color: ${e=>e.hasStep?e.theme.colors.cardForeground:e.theme.colors.mutedForeground};
547
547
  font-style: ${e=>e.hasStep?"normal":"italic"};
548
- `,Hu=rc.div`
548
+ `,lf=Eu.div`
549
549
  position: absolute;
550
550
  top: 0;
551
551
  left: 0;
@@ -565,24 +565,26 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
565
565
  opacity: 0.5;
566
566
  }
567
567
  }
568
- `,Vu=({stamps:t,currentStep:n,onStepChange:r,onToggle:o})=>{const{theme:a}=ql(),i=t.length>0?Math.max(...t.map(e=>e.step)):0,s=t.length>0?Math.min(...t.map(e=>e.step)):0,l=i-s+1,c=e=>e<5e3?"latencyLow":e<=3e4?"latencyMedium":"latencyHigh";return e.createElement(Au,{theme:a},e.createElement(Tu,{theme:a},e.createElement($u,{theme:a},"Timeline"),o&&e.createElement(Du,{onClick:o,title:"Collapse Panel",theme:a},e.createElement(xs,{size:16}))),e.createElement(Iu,null,Array.from({length:l},(o,i)=>{const l=s+i,u=l===n,d=l<n,f=t.some(e=>e.step===l),p=(e=>{const n=t.filter(t=>t.step===e);if(0===n.length)return null;const r=e-1,o=t.filter(e=>e.step===r);return 0===o.length?null:Math.min(...n.map(e=>e.time))-Math.max(...o.map(e=>e.time))})(l),h=(e=>{const n=t.filter(t=>t.step===e);return 0===n.length?`Step ${e}`:n[0]?.identifier||`Step ${e}`})(l);return e.createElement(zu,{key:l,isActive:u,isPast:d,hasStep:f,onClick:()=>f&&r(l),theme:a},e.createElement(Lu,null,e.createElement(Bu,{isActive:u,isPast:d,hasStep:f,theme:a}),e.createElement(Fu,{isActive:u,theme:a},"Step ",l),p&&e.createElement("div",{style:{marginLeft:"auto"}},e.createElement(gc,{variant:c(p)},(e=>e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`)(p)))),e.createElement(ju,{hasStep:f,theme:a},f?h:"No activity"),u&&e.createElement(Hu,{theme:a}))})))};function Wu(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Yu(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Xu(...e){return t=>{let n=!1;const r=e.map(e=>{const r=Yu(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Yu(e[t],null)}}}}function Ku(...e){return a.useCallback(Xu(...e),e)}function Uu(e,t=[]){let n=[];const o=()=>{const t=n.map(e=>a.createContext(e));return function(n){const r=n?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return o.scopeName=e,[function(t,o){const i=a.createContext(o),s=n.length;n=[...n,o];const l=t=>{const{scope:n,children:o,...l}=t,c=n?.[e]?.[s]||i,u=a.useMemo(()=>l,Object.values(l));return r.jsx(c.Provider,{value:u,children:o})};return l.displayName=t+"Provider",[l,function(n,r){const l=r?.[e]?.[s]||i,c=a.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},qu(o,...t)]}function qu(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Zu=globalThis?.document?a.useLayoutEffect:()=>{},Gu=a[" useId ".trim().toString()]||(()=>{}),Ju=0;function Qu(e){const[t,n]=a.useState(Gu());return Zu(()=>{e||n(e=>e??String(Ju++))},[e]),e||(t?`radix-${t}`:"")}var ed=a[" useInsertionEffect ".trim().toString()]||Zu;function td({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[n,r]=a.useState(e),o=a.useRef(n),i=a.useRef(t);return ed(()=>{i.current=t},[t]),a.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",n=l?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. 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.`)}t.current=l},[l,r])}const u=a.useCallback(t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else i(t)},[l,e,i,s]);return[c,u]}function nd(e){const t=rd(e),n=a.forwardRef((e,n)=>{const{children:o,...i}=e,s=a.Children.toArray(o),l=s.find(ad);if(l){const e=l.props.children,o=s.map(t=>t===l?a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null:t);return r.jsx(t,{...i,ref:n,children:a.isValidElement(e)?a.cloneElement(e,void 0,o):null})}return r.jsx(t,{...i,ref:n,children:o})});return n.displayName=`${e}.Slot`,n}function rd(e){const t=a.forwardRef((e,t)=>{const{children:n,...r}=e;if(a.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==a.Fragment&&(o.ref=t?Xu(t,e):e),a.cloneElement(n,o)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var od=Symbol("radix.slottable");function ad(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===od}var id=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=nd(`Primitive.${t}`),o=a.forwardRef((e,o)=>{const{asChild:a,...i}=e,s=a?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),r.jsx(s,{...i,ref:o})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function sd(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var ld,cd="dismissableLayer.update",ud="dismissableLayer.pointerDownOutside",dd="dismissableLayer.focusOutside",fd=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pd=a.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=a.useContext(fd),[f,p]=a.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=a.useState({}),g=Ku(t,e=>p(e)),y=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(v),w=f?y.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,S=function(e,t=globalThis?.document){const n=sd(e),r=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){gd(ud,n,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));E&&!n&&(i?.(e),l?.(e),e.defaultPrevented||c?.())},h),_=function(e,t=globalThis?.document){const n=sd(e),r=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!r.current){gd(dd,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||c?.())},h);return function(e,t=globalThis?.document){const n=sd(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{w===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},h),a.useEffect(()=>{if(f)return n&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(ld=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),md(),()=>{n&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=ld)}},[f,h,n,d]),a.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),md())},[f,d]),a.useEffect(()=>{const e=()=>m({});return document.addEventListener(cd,e),()=>document.removeEventListener(cd,e)},[]),r.jsx(id.div,{...u,ref:g,style:{pointerEvents:x?E?"auto":"none":void 0,...e.style},onFocusCapture:Wu(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Wu(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Wu(e.onPointerDownCapture,S.onPointerDownCapture)})});pd.displayName="DismissableLayer";var hd=a.forwardRef((e,t)=>{const n=a.useContext(fd),o=a.useRef(null),i=Ku(t,o);return a.useEffect(()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),r.jsx(id.div,{...e,ref:i})});function md(){const e=new CustomEvent(cd);document.dispatchEvent(e)}function gd(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&i.flushSync(()=>e.dispatchEvent(t))}(o,a):o.dispatchEvent(a)}hd.displayName="DismissableLayerBranch";var yd="focusScope.autoFocusOnMount",vd="focusScope.autoFocusOnUnmount",bd={bubbles:!1,cancelable:!0},wd=a.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=e,[c,u]=a.useState(null),d=sd(i),f=sd(s),p=a.useRef(null),h=Ku(t,e=>u(e)),m=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:_d(p.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||_d(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&_d(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[o,c,m.paused]),a.useEffect(()=>{if(c){Cd.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(yd,bd);c.addEventListener(yd,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(_d(r,{select:t}),document.activeElement!==n)return}((e=xd(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&_d(c))}return()=>{c.removeEventListener(yd,d),setTimeout(()=>{const e=new CustomEvent(vd,bd);c.addEventListener(vd,f),c.dispatchEvent(e),e.defaultPrevented||_d(t??document.body,{select:!0}),c.removeEventListener(vd,f),Cd.remove(m)},0)}}var e},[c,d,f,m]);const g=a.useCallback(e=>{if(!n&&!o)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[o,a]=function(e){const t=xd(e),n=Ed(t,e),r=Ed(t.reverse(),e);return[n,r]}(t);o&&a?e.shiftKey||r!==a?e.shiftKey&&r===o&&(e.preventDefault(),n&&_d(a,{select:!0})):(e.preventDefault(),n&&_d(o,{select:!0})):r===t&&e.preventDefault()}},[n,o,m.paused]);return r.jsx(id.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});function xd(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ed(e,t){for(const n of e)if(!Sd(n,{upTo:t}))return n}function Sd(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function _d(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}wd.displayName="FocusScope";var Cd=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=kd(e,t),e.unshift(t)},remove(t){e=kd(e,t),e[0]?.resume()}}}();function kd(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Nd=a.forwardRef((e,n)=>{const{container:o,...i}=e,[s,l]=a.useState(!1);Zu(()=>l(!0),[]);const c=o||s&&globalThis?.document?.body;return c?t.createPortal(r.jsx(id.div,{...i,ref:n}),c):null});Nd.displayName="Portal";var Md=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=a.useState(),r=a.useRef(null),o=a.useRef(e),i=a.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return a.useReducer((e,n)=>t[e][n]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=Rd(r.current);i.current="mounted"===l?e:"none"},[l]),Zu(()=>{const t=r.current,n=o.current;if(n!==e){const r=i.current,a=Rd(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,c]),Zu(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,a=a=>{const i=Rd(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&i&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(i.current=Rd(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.Children.only(n),i=Ku(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?a.cloneElement(o,{ref:i}):null};function Rd(e){return e?.animationName||"none"}Md.displayName="Presence";var Od=0;function Pd(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ad()),document.body.insertAdjacentElement("beforeend",e[1]??Ad()),Od++,()=>{1===Od&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Od--}},[])}function Ad(){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 Td=function(){return Td=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Td.apply(this,arguments)};function $d(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Dd="right-scroll-bar-position",Id="width-before-scroll-bar";function zd(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Ld="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Bd=new WeakMap;function Fd(t,n){var r,o,a,i=(r=n||null,o=function(e){return t.forEach(function(t){return zd(t,e)})},(a=e.useState(function(){return{value:r,callback:o,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=o,a.facade);return Ld(function(){var e=Bd.get(i);if(e){var n=new Set(e),r=new Set(t),o=i.current;n.forEach(function(e){r.has(e)||zd(e,null)}),r.forEach(function(e){n.has(e)||zd(e,o)})}Bd.set(i,t)},[t]),i}function jd(e){return e}var Hd=function(e){var t=e.sideCar,n=$d(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 a.createElement(r,Td({},n))};Hd.isSideCarExport=!0;var Vd=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=jd);var n=[],r=!1,o={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(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}};return o}(null);return t.options=Td({async:!0,ssr:!1},e),t}(),Wd=function(){},Yd=a.forwardRef(function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:Wd,onWheelCapture:Wd,onTouchMoveCapture:Wd}),o=r[0],i=r[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,m=e.noIsolation,g=e.inert,y=e.allowPinchZoom,v=e.as,b=void 0===v?"div":v,w=e.gapMode,x=$d(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,S=Fd([n,t]),_=Td(Td({},x),o);return a.createElement(a.Fragment,null,d&&a.createElement(E,{sideCar:Vd,removeScrollBar:u,shards:f,noRelative:h,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:w}),s?a.cloneElement(a.Children.only(l),Td(Td({},_),{ref:S})):a.createElement(b,Td({},_,{className:c,ref:S}),l))});Yd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yd.classNames={fullWidth:Id,zeroRight:Dd};function Xd(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Kd=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=Xd())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ud=function(){var e,t=(e=Kd(),function(t,n){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},qd={left:0,top:0,right:0,gap:0},Zd=function(e){return parseInt(e||"",10)||0},Gd=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return qd;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[Zd(n),Zd(r),Zd(o)]}(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])}},Jd=Ud(),Qd="data-scroll-locked",ef=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(Qd,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Dd," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Id," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Dd," .").concat(Dd," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Id," .").concat(Id," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Qd,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},tf=function(){var e=parseInt(document.body.getAttribute(Qd)||"0",10);return isFinite(e)?e:0},nf=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;a.useEffect(function(){return document.body.setAttribute(Qd,(tf()+1).toString()),function(){var e=tf()-1;e<=0?document.body.removeAttribute(Qd):document.body.setAttribute(Qd,e.toString())}},[]);var i=a.useMemo(function(){return Gd(o)},[o]);return a.createElement(Jd,{styles:ef(i,!t,o,n?"":"!important")})},rf=!1;if("undefined"!=typeof window)try{var of=Object.defineProperty({},"passive",{get:function(){return rf=!0,!0}});window.addEventListener("test",of,of),window.removeEventListener("test",of,of)}catch(e){rf=!1}var af=!!rf&&{passive:!1},sf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},lf=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),cf(e,r)){var o=uf(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cf=function(e,t){return"v"===e?function(e){return sf(e,"overflowY")}(t):function(e){return sf(e,"overflowX")}(t)},uf=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},df=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ff=function(e){return[e.deltaX,e.deltaY]},pf=function(e){return e&&"current"in e?e.current:e},hf=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},mf=0,gf=[];function yf(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var vf,bf=(vf=function(e){var t=a.useRef([]),n=a.useRef([0,0]),r=a.useRef(),o=a.useState(mf++)[0],i=a.useState(Ud)[0],s=a.useRef(e);a.useEffect(function(){s.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(pf),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var o,a=df(e),i=n.current,l="deltaX"in e?e.deltaX:i[0]-a[0],c="deltaY"in e?e.deltaY:i[1]-a[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=lf(d,u);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=lf(d,u)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=o),!o)return!0;var p=r.current||o;return function(e,t,n,r,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,f=0;do{if(!s)break;var p=uf(e,s),h=p[0],m=p[1]-p[2]-a*h;(h||m)&&cf(e,s)&&(d+=m,f+=h);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(o&&Math.abs(d)<1||!o&&i>d)||!u&&(o&&Math.abs(f)<1||!o&&-i>f))&&(c=!0),c}(p,t,e,"h"===p?l:c,!0)},[]),c=a.useCallback(function(e){var n=e;if(gf.length&&gf[gf.length-1]===i){var r="deltaY"in n?ff(n):df(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var a=(s.current.shards||[]).map(pf).filter(Boolean).filter(function(e){return e.contains(n.target)});(a.length>0?l(n,a[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=a.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:yf(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=a.useCallback(function(e){n.current=df(e),r.current=void 0},[]),f=a.useCallback(function(t){u(t.type,ff(t),t.target,l(t,e.lockRef.current))},[]),p=a.useCallback(function(t){u(t.type,df(t),t.target,l(t,e.lockRef.current))},[]);a.useEffect(function(){return gf.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,af),document.addEventListener("touchmove",c,af),document.addEventListener("touchstart",d,af),function(){gf=gf.filter(function(e){return e!==i}),document.removeEventListener("wheel",c,af),document.removeEventListener("touchmove",c,af),document.removeEventListener("touchstart",d,af)}},[]);var h=e.removeScrollBar,m=e.inert;return a.createElement(a.Fragment,null,m?a.createElement(i,{styles:hf(o)}):null,h?a.createElement(nf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Vd.useMedium(vf),Hd),wf=a.forwardRef(function(e,t){return a.createElement(Yd,Td({},e,{ref:t,sideCar:bf}))});wf.classNames=Yd.classNames;var xf=wf,Ef=new WeakMap,Sf=new WeakMap,_f={},Cf=0,kf=function(e){return e&&(e.host||kf(e.parentNode))},Nf=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=kf(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);_f[n]||(_f[n]=new WeakMap);var a=_f[n],i=[],s=new Set,l=new Set(o),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};o.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,l=(Ef.get(e)||0)+1,c=(a.get(e)||0)+1;Ef.set(e,l),a.set(e,c),i.push(e),1===l&&o&&Sf.set(e,!0),1===c&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),s.clear(),Cf++,function(){i.forEach(function(e){var t=Ef.get(e)-1,o=a.get(e)-1;Ef.set(e,t),a.set(e,o),t||(Sf.has(e)||e.removeAttribute(r),Sf.delete(e)),o||e.removeAttribute(n)}),--Cf||(Ef=new WeakMap,Ef=new WeakMap,Sf=new WeakMap,_f={})}},Mf=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Nf(r,o,n,"aria-hidden")):function(){return null}},Rf="Dialog",[Of,Pf]=Uu(Rf),[Af,Tf]=Of(Rf),$f=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,c=a.useRef(null),u=a.useRef(null),[d,f]=td({prop:o,defaultProp:i??!1,onChange:s,caller:Rf});return r.jsx(Af,{scope:t,triggerRef:c,contentRef:u,contentId:Qu(),titleId:Qu(),descriptionId:Qu(),open:d,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:l,children:n})};$f.displayName=Rf;var Df="DialogTrigger",If=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=Tf(Df,n),i=Ku(t,a.triggerRef);return r.jsx(id.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":np(a.open),...o,ref:i,onClick:Wu(e.onClick,a.onOpenToggle)})});If.displayName=Df;var zf="DialogPortal",[Lf,Bf]=Of(zf,{forceMount:void 0}),Ff=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:i}=e,s=Tf(zf,t);return r.jsx(Lf,{scope:t,forceMount:n,children:a.Children.map(o,e=>r.jsx(Md,{present:n||s.open,children:r.jsx(Nd,{asChild:!0,container:i,children:e})}))})};Ff.displayName=zf;var jf="DialogOverlay",Hf=a.forwardRef((e,t)=>{const n=Bf(jf,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,i=Tf(jf,e.__scopeDialog);return i.modal?r.jsx(Md,{present:o||i.open,children:r.jsx(Wf,{...a,ref:t})}):null});Hf.displayName=jf;var Vf=nd("DialogOverlay.RemoveScroll"),Wf=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=Tf(jf,n);return r.jsx(xf,{as:Vf,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(id.div,{"data-state":np(a.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Yf="DialogContent",Xf=a.forwardRef((e,t)=>{const n=Bf(Yf,e.__scopeDialog),{forceMount:o=n.forceMount,...a}=e,i=Tf(Yf,e.__scopeDialog);return r.jsx(Md,{present:o||i.open,children:i.modal?r.jsx(Kf,{...a,ref:t}):r.jsx(Uf,{...a,ref:t})})});Xf.displayName=Yf;var Kf=a.forwardRef((e,t)=>{const n=Tf(Yf,e.__scopeDialog),o=a.useRef(null),i=Ku(t,n.contentRef,o);return a.useEffect(()=>{const e=o.current;if(e)return Mf(e)},[]),r.jsx(qf,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wu(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Wu(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Wu(e.onFocusOutside,e=>e.preventDefault())})}),Uf=a.forwardRef((e,t)=>{const n=Tf(Yf,e.__scopeDialog),o=a.useRef(!1),i=a.useRef(!1);return r.jsx(qf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||n.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,a=n.triggerRef.current?.contains(r);a&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),qf=a.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,...l}=e,c=Tf(Yf,n),u=a.useRef(null),d=Ku(t,u);return Pd(),r.jsxs(r.Fragment,{children:[r.jsx(wd,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s,children:r.jsx(pd,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":np(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(ip,{titleId:c.titleId}),r.jsx(sp,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Zf="DialogTitle",Gf=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=Tf(Zf,n);return r.jsx(id.h2,{id:a.titleId,...o,ref:t})});Gf.displayName=Zf;var Jf="DialogDescription",Qf=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=Tf(Jf,n);return r.jsx(id.p,{id:a.descriptionId,...o,ref:t})});Qf.displayName=Jf;var ep="DialogClose",tp=a.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,a=Tf(ep,n);return r.jsx(id.button,{type:"button",...o,ref:t,onClick:Wu(e.onClick,()=>a.onOpenChange(!1))})});function np(e){return e?"open":"closed"}tp.displayName=ep;var rp="DialogTitleWarning",[op,ap]=function(e,t){const n=a.createContext(t),o=e=>{const{children:t,...o}=e,i=a.useMemo(()=>o,Object.values(o));return r.jsx(n.Provider,{value:i,children:t})};return o.displayName=e+"Provider",[o,function(r){const o=a.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(rp,{contentName:Yf,titleName:Zf,docsSlug:"dialog"}),ip=({titleId:e})=>{const t=ap(rp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},sp=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ap("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");if(t&&r){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},lp=$f,cp=If,up=Ff,dp=Hf,fp=Xf,pp=Gf,hp=Qf,mp=tp;const gp=lp,yp=cp,vp=up,bp=a.forwardRef(({className:e,...t},n)=>a.createElement(dp,{style:{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50,backgroundColor:"hsla(var(--background), 0.8)",backdropFilter:"blur(4px)"},className:e,...t,ref:n}));bp.displayName=dp.displayName;const wp=(e="right")=>{const t={position:"fixed",zIndex:50,gap:"16px",backgroundColor:"hsl(var(--background))",padding:"24px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"all 0.3s ease-in-out"};switch(e){case"top":return{...t,left:0,right:0,top:0,borderBottom:"1px solid hsl(var(--border))"};case"bottom":return{...t,left:0,right:0,bottom:0,borderTop:"1px solid hsl(var(--border))"};case"left":return{...t,top:0,bottom:0,left:0,height:"100%",width:"75%",borderRight:"1px solid hsl(var(--border))",maxWidth:"384px"};default:return{...t,top:0,bottom:0,right:0,height:"100%",width:"75%",borderLeft:"1px solid hsl(var(--border))",maxWidth:"384px"}}},xp=a.forwardRef(({side:e="right",className:t,children:n,...r},o)=>a.createElement(vp,null,a.createElement(bp,null),a.createElement(fp,{ref:o,style:wp(e),className:t,...r},n,a.createElement(mp,{style:{position:"absolute",right:"16px",top:"16px",borderRadius:"4px",opacity:.7,transition:"opacity 0.2s ease-in-out",cursor:"pointer",border:"none",background:"transparent",padding:"4px"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"}},a.createElement("svg",{style:{height:"16px",width:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})),a.createElement("span",{style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}},"Close")))));xp.displayName=fp.displayName;a.forwardRef(({className:e,...t},n)=>a.createElement(pp,{ref:n,style:{fontSize:"18px",fontWeight:600,color:"hsl(var(--foreground))"},className:e,...t})).displayName=pp.displayName;a.forwardRef(({className:e,...t},n)=>a.createElement(hp,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=hp.displayName;const Ep=(e,t,n={})=>{const{minNodeSpacing:r=200,containerWidth:o=600}=n;if(!e||0===e.length)return new Map;new Map(e.map(e=>[e.identifier,e]));const a=new Map,i=new Map;e.forEach(e=>a.set(e.identifier,[])),t.length>0?t.forEach(e=>{e.source&&e.target&&(a.get(e.source)?.push(e.target),i.set(e.target,e.source))}):e.forEach(e=>{e.parent&&e.parent.identifier!==e.identifier&&(a.get(e.parent.identifier)?.push(e.identifier),i.set(e.identifier,e.parent.identifier))});const s=e.filter(e=>!i.has(e.identifier)),l=new Map,c=(e,t)=>{l.set(e,t);for(const n of a.get(e)||[])c(n,t+1)};s.forEach(e=>c(e.identifier,0));const u=[];e.forEach(e=>{const t=l.get(e.identifier)??0;u[t]||(u[t]=[]),u[t].push(e.identifier)});const d=new Map,f=200,p=Math.max(250,r+50),h=e=>{const t=a.get(e)||[];if(0===t.length)return d.set(e,f),f;let n=0;for(const e of t)n+=h(e);return n+=(t.length-1)*p,d.set(e,n),n};s.forEach(e=>h(e.identifier));const m=new Map,g=Math.max(400,r+200),y=(e,t,n)=>{const r=d.get(e)||f,o=n*g+100,i=a.get(e)||[];if(0===i.length)m.set(e,{x:t+r/2-100,y:o});else{let r=t;for(const e of i){const t=d.get(e)||f;y(e,r,n+1),r+=t+p}const a=i[0],s=i[i.length-1],l=m.get(a),c=m.get(s),u=(l.x+c.x)/2;m.set(e,{x:u,y:o})}};let v=0;for(const e of s)v+=d.get(e.identifier)||f;s.length>1&&(v+=(s.length-1)*p*2);let b=Math.max(0,(o-v)/2);for(const e of s)y(e.identifier,b,0),b+=(d.get(e.identifier)||f)+2*p;const w=r,x=Array.from(m.keys());for(let e=0;e<x.length;e++)for(let t=e+1;t<x.length;t++){const n=m.get(x[e]),r=m.get(x[t]);if(Math.sqrt((r.x-n.x)**2+(r.y-n.y)**2)<w){const e=r.x-n.x,t=r.y-n.y,o=Math.sqrt(e*e+t*t);if(o>0){const a=w/o,i=(e*a-e)/2,s=(t*a-t)/2;n.x-=i,n.y-=s,r.x+=i,r.y+=s}else n.x-=w/2,r.x+=w/2}}return m},Sp={Agent:Pu,Tool:Pu,Coordinator:Pu},_p=({flowData:t,width:n="100%",height:r="1000px",className:o="",defaultZoom:a=1,defaultPan:i={x:0,y:0},disableAutoFit:s=!0,showTimeline:l=!1,minNodeSpacing:c=200,onInspect:u})=>{const{theme:d}=ql(),f=d.colors,p=t;if(!p)return e.createElement("div",{style:{width:"number"==typeof n?`${n}px`:n,height:"number"==typeof r?`${r}px`:r,border:`1px solid ${f.border}`,borderRadius:"8px",background:f.muted,position:"relative",minWidth:"800px",minHeight:"600px",display:"flex",alignItems:"center",justifyContent:"center"},className:o},e.createElement("div",{style:{textAlign:"center"}},e.createElement("div",{style:{fontSize:"16px",color:f.mutedForeground,marginBottom:"8px"}},"No flow data available"),e.createElement("div",{style:{fontSize:"14px",color:f.mutedForeground}},"Please provide flowData prop")));const h=e.useRef(null),m=e.useRef(null),[g,y]=e.useState({width:"number"==typeof n?n:1200,height:"number"==typeof r?r:600}),[v,b]=e.useState(0),[w,x]=e.useState(!1),E=e.useRef(null),[S,_]=e.useState(!1),C=e.useMemo(()=>{const e=p.stamps||p.steps||[];return e.length>0?Math.max(...e.map(e=>e.step)):0},[p.stamps,p.steps]);e.useEffect(()=>(w?E.current=setInterval(()=>{b(e=>e>=C?(x(!1),e):e+1)},250):E.current&&(clearInterval(E.current),E.current=null),()=>{E.current&&clearInterval(E.current)}),[w,C]),e.useEffect(()=>{const e=p.stamps||p.steps||[];e.length>0&&b(Math.max(...e.map(e=>e.step)))},[p.stamps,p.steps]),e.useEffect(()=>{const e=()=>{if(h.current){const e=h.current.getBoundingClientRect();y({width:Math.max(e.width||("number"==typeof n?n:1200),1200),height:e.height||("number"==typeof r?r:600)})}};if(e(),window.ResizeObserver&&h.current){const t=new ResizeObserver(e);return t.observe(h.current),()=>t.disconnect()}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n,r]);const k=e.useMemo(()=>{if(!p.nodes)return new Map;const e=Math.max(g.width||800,1200);return Ep(p.nodes,p.edges||[],{minNodeSpacing:c,containerWidth:e})},[p.nodes,p.edges,g.width,c]),N=e.useCallback(e=>p.nodes?p.nodes.filter(t=>t.stamp.step<=e):[],[p.nodes]),M=e.useCallback(e=>(p.edges||[]).filter(t=>t.stamp.step<=e),[p.edges]),R=e.useMemo(()=>{const e=N(v),t=M(v);return e.map(e=>{const n=k.get(e.identifier)||{x:0,y:0},r=e.stamp.step===v,o="Tool"===e.node_type?t.filter(t=>t.target===e.identifier&&t.details).map(e=>e.details):void 0;return{id:e.identifier,type:e.node_type||"Agent",position:n,data:{label:e.name||e.node_type,nodeType:e.node_type,details:e.details,isActive:r,id:e.identifier,edges:t,edgeDetails:o,onInspect:u},style:{filter:r?"drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3))":"none"}}})},[k,v,N,M,u]),O=e.useMemo(()=>M(v).filter(e=>e.source&&e.target).map(e=>{const t=e.stamp.step===v;return{id:e.identifier,type:"default",source:e.source,target:e.target,animated:t,bidirectional:!0,style:{stroke:t?f.primary:f.mutedForeground,strokeWidth:t?3:2},label:e.stamp?.identifier?lc(String(e.stamp.identifier),50):void 0,data:{label:e.stamp?.identifier?lc(String(e.stamp.identifier),50):void 0,source:e.source,target:e.target,step:e.stamp?.step,time:e.stamp?.time,details:e.details}}}),[v,M,f.primary,f.mutedForeground]),[P,A,T]=es(R),[$,D,I]=ts(O);e.useEffect(()=>{A(R)},[R,A]),e.useEffect(()=>{D(O)},[O,D]);const z=e.useCallback(e=>D(t=>Eo(e,t)),[D]),L=e.useCallback(e=>{b(e),x(!1)},[]);e.useCallback(()=>{x(e=>!e)},[]);const B=(e,t)=>{if(!m.current)return{x:0,y:0};const n=m.current.createSVGPoint();n.x=e,n.y=t;const r=n.matrixTransform(m.current.getScreenCTM()?.inverse());return{x:r.x,y:r.y}},F=ka();return e.useEffect(()=>{if(s||!F||0===R.length)return;const e=new Map;O.forEach(t=>{const n=e.get(t.source)||0;e.set(t.source,n+1);const r=e.get(t.target)||0;e.set(t.target,r+1)});let t="",n=0;e.forEach((e,r)=>{e>n&&(n=e,t=r)}),!t&&R.length>0&&(t=R[0].id),t&&setTimeout(()=>{F.fitView({nodes:[{id:t}],duration:1e3,padding:.2,minZoom:a,maxZoom:1})},500)},[R,O,F,s,a]),e.createElement("div",{ref:h,style:{width:"number"==typeof n?`${n}px`:n,height:"number"==typeof r?`${r}px`:r,border:`1px solid ${f.border}`,borderRadius:"8px",overflow:"hidden",position:"relative",minWidth:"800px",minHeight:"600px",background:f.background},className:o},l&&e.createElement(gp,{open:S,onOpenChange:_},e.createElement(yp,{asChild:!0},e.createElement("button",{style:{position:"absolute",top:"16px",left:"16px",zIndex:50,width:"40px",height:"40px",backgroundColor:f.card,border:`1px solid ${f.border}`,borderRadius:"8px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease-in-out",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=f.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=f.card},title:"Open Timeline"},e.createElement(xs,{size:20,style:{color:f.mutedForeground}}))),e.createElement(vp,null,e.createElement(fp,{style:{position:"fixed",top:0,bottom:0,left:0,height:"100%",width:"280px",zIndex:50,backgroundColor:f.background,borderRight:`1px solid ${f.border}`,boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"all 0.3s ease-in-out",padding:0},onPointerDownOutside:e=>e.preventDefault()},e.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%"}},e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(Vu,{stamps:p.stamps||p.steps||[],currentStep:v,onStepChange:L}))),e.createElement(mp,{style:{position:"absolute",right:"16px",top:"16px",borderRadius:"4px",opacity:.7,transition:"opacity 0.2s ease-in-out",cursor:"pointer",border:"none",background:"transparent",padding:"4px",color:f.mutedForeground},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"}},e.createElement("svg",{style:{height:"16px",width:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})),e.createElement("span",{style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}},"Close"))))),e.createElement(Ji,{nodes:P,edges:$,onNodesChange:T,onEdgesChange:I,onConnect:z,nodeTypes:Sp,edgeTypes:{default:t=>e.createElement(Zl,{...t,clientToSvgCoords:B,svgRef:m})},attributionPosition:"bottom-left",style:{width:"100%",height:"100%"},defaultViewport:{x:i.x,y:i.y,zoom:a},onInit:()=>{if(h.current){const e=h.current.querySelector("svg");e&&(m.current=e)}}},e.createElement(cs,{variant:ns.Lines,color:f.mutedBorder,gap:16})),e.createElement("style",null,`\n .react-flow__edge-label {\n font-size: 10px;\n background: ${f.card};\n color: ${f.cardForeground};\n padding: 2px 4px;\n border-radius: 4px;\n border: 1px solid ${f.border};\n max-width: 150px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .react-flow__edge {\n cursor: default !important;\n }\n\n .react-flow__edge-path {\n cursor: default !important;\n }\n `))};function Cp(e,[t,n]){return Math.min(n,Math.max(t,e))}var kp=a.createContext(void 0);const Np=["top","right","bottom","left"],Mp=Math.min,Rp=Math.max,Op=Math.round,Pp=Math.floor,Ap=e=>({x:e,y:e}),Tp={left:"right",right:"left",bottom:"top",top:"bottom"},$p={start:"end",end:"start"};function Dp(e,t,n){return Rp(e,Mp(t,n))}function Ip(e,t){return"function"==typeof e?e(t):e}function zp(e){return e.split("-")[0]}function Lp(e){return e.split("-")[1]}function Bp(e){return"x"===e?"y":"x"}function Fp(e){return"y"===e?"height":"width"}const jp=new Set(["top","bottom"]);function Hp(e){return jp.has(zp(e))?"y":"x"}function Vp(e){return Bp(Hp(e))}function Wp(e){return e.replace(/start|end/g,e=>$p[e])}const Yp=["left","right"],Xp=["right","left"],Kp=["top","bottom"],Up=["bottom","top"];function qp(e,t,n,r){const o=Lp(e);let a=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Xp:Yp:t?Yp:Xp;case"left":case"right":return t?Kp:Up;default:return[]}}(zp(e),"start"===n,r);return o&&(a=a.map(e=>e+"-"+o),t&&(a=a.concat(a.map(Wp)))),a}function Zp(e){return e.replace(/left|right|bottom|top/g,e=>Tp[e])}function Gp(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Jp(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Qp(e,t,n){let{reference:r,floating:o}=e;const a=Hp(t),i=Vp(t),s=Fp(i),l=zp(t),c="y"===a,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Lp(t)){case"start":p[i]-=f*(n&&c?-1:1);break;case"end":p[i]+=f*(n&&c?-1:1)}return p}async function eh(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Ip(t,e),h=Gp(p),m=s[f?"floating"===d?"reference":"floating":d],g=Jp(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(m)))||n?m:m.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===d?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,v=await(null==a.getOffsetParent?void 0:a.getOffsetParent(s.floating)),b=await(null==a.isElement?void 0:a.isElement(v))&&await(null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},w=Jp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-w.top+h.top)/b.y,bottom:(w.bottom-g.bottom+h.bottom)/b.y,left:(g.left-w.left+h.left)/b.x,right:(w.right-g.right+h.right)/b.x}}function th(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nh(e){return Np.some(t=>e[t]>=0)}const rh=new Set(["left","top"]);function oh(){return"undefined"!=typeof window}function ah(e){return lh(e)?(e.nodeName||"").toLowerCase():"#document"}function ih(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function sh(e){var t;return null==(t=(lh(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function lh(e){return!!oh()&&(e instanceof Node||e instanceof ih(e).Node)}function ch(e){return!!oh()&&(e instanceof Element||e instanceof ih(e).Element)}function uh(e){return!!oh()&&(e instanceof HTMLElement||e instanceof ih(e).HTMLElement)}function dh(e){return!(!oh()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ih(e).ShadowRoot)}const fh=new Set(["inline","contents"]);function ph(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ch(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!fh.has(o)}const hh=new Set(["table","td","th"]);function mh(e){return hh.has(ah(e))}const gh=[":popover-open",":modal"];function yh(e){return gh.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const vh=["transform","translate","scale","rotate","perspective"],bh=["transform","translate","scale","rotate","perspective","filter"],wh=["paint","layout","strict","content"];function xh(e){const t=Eh(),n=ch(e)?Ch(e):e;return vh.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||bh.some(e=>(n.willChange||"").includes(e))||wh.some(e=>(n.contain||"").includes(e))}function Eh(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Sh=new Set(["html","body","#document"]);function _h(e){return Sh.has(ah(e))}function Ch(e){return ih(e).getComputedStyle(e)}function kh(e){return ch(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Nh(e){if("html"===ah(e))return e;const t=e.assignedSlot||e.parentNode||dh(e)&&e.host||sh(e);return dh(t)?t.host:t}function Mh(e){const t=Nh(e);return _h(t)?e.ownerDocument?e.ownerDocument.body:e.body:uh(t)&&ph(t)?t:Mh(t)}function Rh(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Mh(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),i=ih(o);if(a){const e=Oh(i);return t.concat(i,i.visualViewport||[],ph(o)?o:[],e&&n?Rh(e):[])}return t.concat(o,Rh(o,[],n))}function Oh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ph(e){const t=Ch(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=uh(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,s=Op(n)!==a||Op(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Ah(e){return ch(e)?e:e.contextElement}function Th(e){const t=Ah(e);if(!uh(t))return Ap(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=Ph(t);let i=(a?Op(n.width):n.width)/r,s=(a?Op(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const $h=Ap(0);function Dh(e){const t=ih(e);return Eh()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:$h}function Ih(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=Ah(e);let i=Ap(1);t&&(r?ch(r)&&(i=Th(r)):i=Th(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ih(e))&&t}(a,n,r)?Dh(a):Ap(0);let l=(o.left+s.x)/i.x,c=(o.top+s.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(a){const e=ih(a),t=r&&ch(r)?ih(r):r;let n=e,o=Oh(n);for(;o&&r&&t!==n;){const e=Th(o),t=o.getBoundingClientRect(),r=Ch(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=a,c+=i,n=ih(o),o=Oh(n)}}return Jp({width:u,height:d,x:l,y:c})}function zh(e,t){const n=kh(e).scrollLeft;return t?t.left+n:Ih(sh(e)).left+n}function Lh(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-zh(e,n),y:n.top+t.scrollTop}}const Bh=new Set(["absolute","fixed"]);function Fh(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=ih(e),r=sh(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;const e=Eh();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}const c=zh(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(r.clientWidth-t.clientWidth-o);i<=25&&(a-=i)}else c<=25&&(a+=c);return{width:a,height:i,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=sh(e),n=kh(e),r=e.ownerDocument.body,o=Rp(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Rp(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+zh(e);const s=-n.scrollTop;return"rtl"===Ch(r).direction&&(i+=Rp(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:s}}(sh(e));else if(ch(t))r=function(e,t){const n=Ih(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=uh(e)?Th(e):Ap(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=Dh(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jp(r)}function jh(e,t){const n=Nh(e);return!(n===t||!ch(n)||_h(n))&&("fixed"===Ch(n).position||jh(n,t))}function Hh(e,t,n){const r=uh(t),o=sh(t),a="fixed"===n,i=Ih(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=Ap(0);function c(){l.x=zh(o)}if(r||!r&&!a)if(("body"!==ah(t)||ph(o))&&(s=kh(t)),r){const e=Ih(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();a&&!r&&o&&c();const u=!o||r||a?Ap(0):Lh(o,s);return{x:i.left+s.scrollLeft-l.x-u.x,y:i.top+s.scrollTop-l.y-u.y,width:i.width,height:i.height}}function Vh(e){return"static"===Ch(e).position}function Wh(e,t){if(!uh(e)||"fixed"===Ch(e).position)return null;if(t)return t(e);let n=e.offsetParent;return sh(e)===n&&(n=n.ownerDocument.body),n}function Yh(e,t){const n=ih(e);if(yh(e))return n;if(!uh(e)){let t=Nh(e);for(;t&&!_h(t);){if(ch(t)&&!Vh(t))return t;t=Nh(t)}return n}let r=Wh(e,t);for(;r&&mh(r)&&Vh(r);)r=Wh(r,t);return r&&_h(r)&&Vh(r)&&!xh(r)?n:r||function(e){let t=Nh(e);for(;uh(t)&&!_h(t);){if(xh(t))return t;if(yh(t))return null;t=Nh(t)}return null}(e)||n}const Xh={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,i=sh(r),s=!!t&&yh(t.floating);if(r===i||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=Ap(1);const u=Ap(0),d=uh(r);if((d||!d&&!a)&&(("body"!==ah(r)||ph(i))&&(l=kh(r)),uh(r))){const e=Ih(r);c=Th(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||d||a?Ap(0):Lh(i,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:sh,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a="clippingAncestors"===n?yh(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Rh(e,[],!1).filter(e=>ch(e)&&"body"!==ah(e)),o=null;const a="fixed"===Ch(e).position;let i=a?Nh(e):e;for(;ch(i)&&!_h(i);){const t=Ch(i),n=xh(i);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&Bh.has(o.position)||ph(i)&&!n&&jh(e,i))?r=r.filter(e=>e!==i):o=t,i=Nh(i)}return t.set(e,r),r}(t,this._c):[].concat(n),i=[...a,r],s=i[0],l=i.reduce((e,n)=>{const r=Fh(t,n,o);return e.top=Rp(r.top,e.top),e.right=Mp(r.right,e.right),e.bottom=Mp(r.bottom,e.bottom),e.left=Rp(r.left,e.left),e},Fh(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Yh,getElementRects:async function(e){const t=this.getOffsetParent||Yh,n=this.getDimensions,r=await n(e.floating);return{reference:Hh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ph(e);return{width:t,height:n}},getScale:Th,isElement:ch,isRTL:function(e){return"rtl"===Ch(e).direction}};function Kh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Uh(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Ah(e),u=o||a?[...c?Rh(c):[],...Rh(t)]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,r=null;const o=sh(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),a();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(s||t(),!f||!p)return;const h={rootMargin:-Pp(d)+"px "+-Pp(o.clientWidth-(u+f))+"px "+-Pp(o.clientHeight-(d+p))+"px "+-Pp(u)+"px",threshold:Rp(0,Mp(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return i();r?i(!1,r):n=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==r||Kh(c,e.getBoundingClientRect())||i(),m=!1}try{r=new IntersectionObserver(g,{...h,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,h)}r.observe(e)}(!0),a}(c,n):null;let f,p=-1,h=null;i&&(h=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let m=l?Ih(e):null;return l&&function t(){const r=Ih(e);m&&!Kh(m,r)&&n();m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const qh=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),i=zp(n),s=Lp(n),l="y"===Hp(n),c=rh.has(i)?-1:1,u=a&&l?-1:1,d=Ip(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return i===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:i}}}}},Zh=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ip(e,t),c={x:n,y:r},u=await eh(t,l),d=Hp(zp(o)),f=Bp(d);let p=c[f],h=c[d];if(a){const e="y"===f?"bottom":"right";p=Dp(p+u["y"===f?"top":"left"],p,p-u[e])}if(i){const e="y"===d?"bottom":"right";h=Dp(h+u["y"===d?"top":"left"],h,h-u[e])}const m=s.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:a,[d]:i}}}}}},Gh=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Ip(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const y=zp(o),v=Hp(s),b=zp(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(b||!m?[Zp(s)]:function(e){const t=Zp(e);return[Wp(e),t,Wp(t)]}(s)),E="none"!==h;!f&&E&&x.push(...qp(s,m,h,w));const S=[s,...x],_=await eh(t,g),C=[];let k=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&C.push(_[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Lp(e),o=Vp(e),a=Fp(o);let i="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Zp(i)),[i,Zp(i)]}(o,i,w);C.push(_[e[0]],_[e[1]])}if(k=[...k,{placement:o,overflows:C}],!C.every(e=>e<=0)){var N,M;const e=((null==(N=a.flip)?void 0:N.index)||0)+1,t=S[e];if(t){if(!("alignment"===d&&v!==Hp(t))||k.every(e=>Hp(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:k},reset:{placement:t}}}let n=null==(M=k.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:M.placement;if(!n)switch(p){case"bestFit":{var R;const e=null==(R=k.filter(e=>{if(E){const t=Hp(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Jh=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:s}=t,{apply:l=()=>{},...c}=Ip(e,t),u=await eh(t,c),d=zp(o),f=Lp(o),p="y"===Hp(o),{width:h,height:m}=a.floating;let g,y;"top"===d||"bottom"===d?(g=d,y=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g="end"===f?"top":"bottom");const v=m-u.top-u.bottom,b=h-u.left-u.right,w=Mp(m-u[g],v),x=Mp(h-u[y],b),E=!t.middlewareData.shift;let S=w,_=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(_=b),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=v),E&&!f){const e=Rp(u.left,0),t=Rp(u.right,0),n=Rp(u.top,0),r=Rp(u.bottom,0);p?_=h-2*(0!==e||0!==t?e+t:Rp(u.left,u.right)):S=m-2*(0!==n||0!==r?n+r:Rp(u.top,u.bottom))}await l({...t,availableWidth:_,availableHeight:S});const C=await i.getDimensions(s.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},Qh=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ip(e,t);switch(r){case"referenceHidden":{const e=th(await eh(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:nh(e)}}}case"escaped":{const e=th(await eh(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:nh(e)}}}default:return{}}}}},em=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Ip(e,t)||{};if(null==c)return{};const d=Gp(u),f={x:n,y:r},p=Vp(o),h=Fp(p),m=await i.getDimensions(c),g="y"===p,y=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=a.reference[h]+a.reference[p]-f[p]-a.floating[h],x=f[p]-a.reference[p],E=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c));let S=E?E[b]:0;S&&await(null==i.isElement?void 0:i.isElement(E))||(S=s.floating[b]||a.floating[h]);const _=w/2-x/2,C=S/2-m[h]/2-1,k=Mp(d[y],C),N=Mp(d[v],C),M=k,R=S-m[h]-N,O=S/2-m[h]/2+_,P=Dp(M,O,R),A=!l.arrow&&null!=Lp(o)&&O!==P&&a.reference[h]/2-(O<M?k:N)-m[h]/2<0,T=A?O<M?O-M:O-R:0;return{[p]:f[p]+T,data:{[p]:P,centerOffset:O-P-T,...A&&{alignmentOffset:T}},reset:A}}}),tm=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Ip(e,t),u={x:n,y:r},d=Hp(o),f=Bp(d);let p=u[f],h=u[d];const m=Ip(s,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var y,v;const e="y"===f?"width":"height",t=rh.has(zp(o)),n=a.reference[d]-a.floating[e]+(t&&(null==(y=i.offset)?void 0:y[d])||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:(null==(v=i.offset)?void 0:v[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[f]:p,[d]:h}}}},nm=(e,t,n)=>{const r=new Map,o={platform:Xh,...n},a={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Qp(c,r,l),f=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:a,fn:m}=s[n],{x:g,y:y,data:v,reset:b}=await m({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:i,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=y?y:d,p={...p,[a]:{...p[a],...v}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await i.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Qp(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:a})};var rm="undefined"!=typeof document?e.useLayoutEffect:function(){};function om(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!om(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!om(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function am(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function im(e,t){const n=am(e);return Math.round(t*n)/n}function sm(e){const t=a.useRef(e);return rm(()=>{t.current=e}),t}const lm=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?em({element:n.current,padding:r}).fn(t):{}:n?em({element:n,padding:r}).fn(t):{};var o}}),cm=(e,t)=>({...qh(e),options:[e,t]}),um=(e,t)=>({...Zh(e),options:[e,t]}),dm=(e,t)=>({...tm(e),options:[e,t]}),fm=(e,t)=>({...Gh(e),options:[e,t]}),pm=(e,t)=>({...Jh(e),options:[e,t]}),hm=(e,t)=>({...Qh(e),options:[e,t]}),mm=(e,t)=>({...lm(e),options:[e,t]});var gm=a.forwardRef((e,t)=>{const{children:n,width:o=10,height:a=5,...i}=e;return r.jsx(id.svg,{...i,ref:t,width:o,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});gm.displayName="Arrow";var ym=gm;function vm(e){const[t,n]=a.useState(void 0);return Zu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var bm="Popper",[wm,xm]=Uu(bm),[Em,Sm]=wm(bm),_m=e=>{const{__scopePopper:t,children:n}=e,[o,i]=a.useState(null);return r.jsx(Em,{scope:t,anchor:o,onAnchorChange:i,children:n})};_m.displayName=bm;var Cm="PopperAnchor",km=a.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...i}=e,s=Sm(Cm,n),l=a.useRef(null),c=Ku(t,l),u=a.useRef(null);return a.useEffect(()=>{const e=u.current;u.current=o?.current||l.current,e!==u.current&&s.onAnchorChange(u.current)}),o?null:r.jsx(id.div,{...i,ref:c})});km.displayName=Cm;var Nm="PopperContent",[Mm,Rm]=wm(Nm),Om=a.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:y,...v}=e,b=Sm(Nm,n),[w,x]=a.useState(null),E=Ku(t,e=>x(e)),[S,_]=a.useState(null),C=vm(S),k=C?.width??0,N=C?.height??0,M=o+("center"!==l?"-"+l:""),R="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(f)?f:[f],P=O.length>0,A={padding:R,boundary:O.filter($m),altBoundary:P},{refs:T,floatingStyles:$,placement:D,isPositioned:I,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[f,p]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=a.useState(r);om(h,r)||m(r);const[g,y]=a.useState(null),[v,b]=a.useState(null),w=a.useCallback(e=>{e!==_.current&&(_.current=e,y(e))},[]),x=a.useCallback(e=>{e!==C.current&&(C.current=e,b(e))},[]),E=s||g,S=l||v,_=a.useRef(null),C=a.useRef(null),k=a.useRef(f),N=null!=u,M=sm(u),R=sm(o),O=sm(d),P=a.useCallback(()=>{if(!_.current||!C.current)return;const e={placement:t,strategy:n,middleware:h};R.current&&(e.platform=R.current),nm(_.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};A.current&&!om(k.current,t)&&(k.current=t,i.flushSync(()=>{p(t)}))})},[h,t,n,R,O]);rm(()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);const A=a.useRef(!1);rm(()=>(A.current=!0,()=>{A.current=!1}),[]),rm(()=>{if(E&&(_.current=E),S&&(C.current=S),E&&S){if(M.current)return M.current(E,S,P);P()}},[E,S,P,M,N]);const T=a.useMemo(()=>({reference:_,floating:C,setReference:w,setFloating:x}),[w,x]),$=a.useMemo(()=>({reference:E,floating:S}),[E,S]),D=a.useMemo(()=>{const e={position:n,left:0,top:0};if(!$.floating)return e;const t=im($.floating,f.x),r=im($.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...am($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,$.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:P,refs:T,elements:$,floatingStyles:D}),[f,P,T,$,D])}({strategy:"fixed",placement:M,whileElementsMounted:(...e)=>Uh(...e,{animationFrame:"always"===g}),elements:{reference:b.anchor},middleware:[cm({mainAxis:s+N,alignmentAxis:c}),d&&um({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?dm():void 0,...A}),d&&fm({...A}),pm({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:a}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${n}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${o}px`),i.setProperty("--radix-popper-anchor-height",`${a}px`)}}),S&&mm({element:S,padding:u}),Dm({arrowWidth:k,arrowHeight:N}),m&&hm({strategy:"referenceHidden",...A})]}),[L,B]=Im(D),F=sd(y);Zu(()=>{I&&F?.()},[I,F]);const j=z.arrow?.x,H=z.arrow?.y,V=0!==z.arrow?.centerOffset,[W,Y]=a.useState();return Zu(()=>{w&&Y(window.getComputedStyle(w).zIndex)},[w]),r.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:I?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Mm,{scope:n,placedSide:L,onArrowChange:_,arrowX:j,arrowY:H,shouldHideArrow:V,children:r.jsx(id.div,{"data-side":L,"data-align":B,...v,ref:E,style:{...v.style,animation:I?void 0:"none"}})})})});Om.displayName=Nm;var Pm="PopperArrow",Am={top:"bottom",right:"left",bottom:"top",left:"right"},Tm=a.forwardRef(function(e,t){const{__scopePopper:n,...o}=e,a=Rm(Pm,n),i=Am[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]: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:r.jsx(ym,{...o,ref:t,style:{...o.style,display:"block"}})})});function $m(e){return null!==e}Tm.displayName=Pm;var Dm=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,a=0!==o.arrow?.centerOffset,i=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[l,c]=Im(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+i/2,f=(o.arrow?.y??0)+s/2;let p="",h="";return"bottom"===l?(p=a?u:`${d}px`,h=-s+"px"):"top"===l?(p=a?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(p=-s+"px",h=a?u:`${f}px`):"left"===l&&(p=`${r.floating.width+s}px`,h=a?u:`${f}px`),{data:{x:p,y:h}}}});function Im(e){const[t,n="center"]=e.split("-");return[t,n]}var zm=_m,Lm=km,Bm=Om,Fm=Tm;function jm(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hm=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"});a.forwardRef((e,t)=>r.jsx(id.span,{...e,ref:t,style:{...Hm,...e.style}})).displayName="VisuallyHidden";var Vm=[" ","Enter","ArrowUp","ArrowDown"],Wm=[" ","Enter"],Ym="Select",[Xm,Km,Um]=function(t){const n=t+"CollectionProvider",[o,a]=Uu(n),[i,s]=o(n,{collectionRef:{current:null},itemMap:new Map}),l=t=>{const{scope:n,children:o}=t,a=e.useRef(null),s=e.useRef(new Map).current;return r.jsx(i,{scope:n,itemMap:s,collectionRef:a,children:o})};l.displayName=n;const c=t+"CollectionSlot",u=nd(c),d=e.forwardRef((e,t)=>{const{scope:n,children:o}=e,a=Ku(t,s(c,n).collectionRef);return r.jsx(u,{ref:a,children:o})});d.displayName=c;const f=t+"CollectionItemSlot",p="data-radix-collection-item",h=nd(f),m=e.forwardRef((t,n)=>{const{scope:o,children:a,...i}=t,l=e.useRef(null),c=Ku(n,l),u=s(f,o);return e.useEffect(()=>(u.itemMap.set(l,{ref:l,...i}),()=>{u.itemMap.delete(l)})),r.jsx(h,{[p]:"",ref:c,children:a})});return m.displayName=f,[{Provider:l,Slot:d,ItemSlot:m},function(n){const r=s(t+"CollectionConsumer",n);return e.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},a]}(Ym),[qm,Zm]=Uu(Ym,[Um,xm]),Gm=xm(),[Jm,Qm]=qm(Ym),[eg,tg]=qm(Ym),ng=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:i,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:h,required:m,form:g}=e,y=Gm(t),[v,b]=a.useState(null),[w,x]=a.useState(null),[E,S]=a.useState(!1),_=function(e){const t=a.useContext(kp);return e||t||"ltr"}(d),[C,k]=td({prop:o,defaultProp:i??!1,onChange:s,caller:Ym}),[N,M]=td({prop:l,defaultProp:c,onChange:u,caller:Ym}),R=a.useRef(null),O=!v||(g||!!v.closest("form")),[P,A]=a.useState(new Set),T=Array.from(P).map(e=>e.props.value).join(";");return r.jsx(zm,{...y,children:r.jsxs(Jm,{required:m,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:E,onValueNodeHasChildrenChange:S,contentId:Qu(),value:N,onValueChange:M,open:C,onOpenChange:k,dir:_,triggerPointerDownPosRef:R,disabled:h,children:[r.jsx(Xm.Provider,{scope:t,children:r.jsx(eg,{scope:e.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{A(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?r.jsxs(Hg,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>M(e.target.value),disabled:h,form:g,children:[void 0===N?r.jsx("option",{value:""}):null,Array.from(P)]},T):null]})})};ng.displayName=Ym;var rg="SelectTrigger",og=a.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...i}=e,s=Gm(n),l=Qm(rg,n),c=l.disabled||o,u=Ku(t,l.onTriggerChange),d=Km(n),f=a.useRef("touch"),[p,h,m]=Wg(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===l.value),r=Yg(t,e,n);void 0!==r&&l.onValueChange(r.value)}),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return r.jsx(Lm,{asChild:!0,...s,children:r.jsx(id.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":Vg(l.value)?"":void 0,...i,ref:u,onClick:Wu(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Wu(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Wu(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||Vm.includes(e.key)&&(g(),e.preventDefault())})})})});og.displayName=rg;var ag="SelectValue",ig=a.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:a,children:i,placeholder:s="",...l}=e,c=Qm(ag,n),{onValueNodeHasChildrenChange:u}=c,d=void 0!==i,f=Ku(t,c.onValueNodeChange);return Zu(()=>{u(d)},[u,d]),r.jsx(id.span,{...l,ref:f,style:{pointerEvents:"none"},children:Vg(c.value)?r.jsx(r.Fragment,{children:s}):i})});ig.displayName=ag;var sg=a.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...a}=e;return r.jsx(id.span,{"aria-hidden":!0,...a,ref:t,children:o||"▼"})});sg.displayName="SelectIcon";var lg=e=>r.jsx(Nd,{asChild:!0,...e});lg.displayName="SelectPortal";var cg="SelectContent",ug=a.forwardRef((e,t)=>{const n=Qm(cg,e.__scopeSelect),[o,s]=a.useState();if(Zu(()=>{s(new DocumentFragment)},[]),!n.open){const t=o;return t?i.createPortal(r.jsx(fg,{scope:e.__scopeSelect,children:r.jsx(Xm.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),t):null}return r.jsx(mg,{...e,ref:t})});ug.displayName=cg;var dg=10,[fg,pg]=qm(cg),hg=nd("SelectContent.RemoveScroll"),mg=a.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v,...b}=e,w=Qm(cg,n),[x,E]=a.useState(null),[S,_]=a.useState(null),C=Ku(t,e=>E(e)),[k,N]=a.useState(null),[M,R]=a.useState(null),O=Km(n),[P,A]=a.useState(!1),T=a.useRef(!1);a.useEffect(()=>{if(x)return Mf(x)},[x]),Pd();const $=a.useCallback(e=>{const[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const n of e){if(n===o)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==o)return}},[O,S]),D=a.useCallback(()=>$([k,x]),[$,k,x]);a.useEffect(()=>{P&&D()},[P,D]);const{onOpenChange:I,triggerPointerDownPosRef:z}=w;a.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||I(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,I,z]),a.useEffect(()=>{const e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);const[L,B]=Wg(e=>{const t=O().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Yg(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),F=a.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==w.value&&w.value===t||r)&&(N(e),r&&(T.current=!0))},[w.value]),j=a.useCallback(()=>x?.focus(),[x]),H=a.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==w.value&&w.value===t||r)&&R(e)},[w.value]),V="popper"===o?yg:gg,W=V===yg?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v}:{};return r.jsx(fg,{scope:n,content:x,viewport:S,onViewportChange:_,itemRefCallback:F,selectedItem:k,onItemLeave:j,itemTextRefCallback:H,focusSelectedItem:D,selectedItemText:M,position:o,isPositioned:P,searchRef:L,children:r.jsx(xf,{as:hg,allowPinchZoom:!0,children:r.jsx(wd,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Wu(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:r.jsx(pd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:r.jsx(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...W,onPlaced:()=>A(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Wu(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||B(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>$(t)),e.preventDefault()}})})})})})})});mg.displayName="SelectContentImpl";var gg=a.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...i}=e,s=Qm(cg,n),l=pg(cg,n),[c,u]=a.useState(null),[d,f]=a.useState(null),p=Ku(t,e=>f(e)),h=Km(n),m=a.useRef(!1),g=a.useRef(!0),{viewport:y,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=l,x=a.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&d&&y&&v&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if("rtl"!==s.dir){const o=r.left-t.left,a=n.left-o,i=e.left-a,s=e.width+i,l=Math.max(s,t.width),u=window.innerWidth-dg,d=Cp(a,[dg,Math.max(dg,u-l)]);c.style.minWidth=s+"px",c.style.left=d+"px"}else{const o=t.right-r.right,a=window.innerWidth-n.right-o,i=window.innerWidth-e.right-a,s=e.width+i,l=Math.max(s,t.width),u=window.innerWidth-dg,d=Cp(a,[dg,Math.max(dg,u-l)]);c.style.minWidth=s+"px",c.style.right=d+"px"}const a=h(),i=window.innerHeight-2*dg,l=y.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),w=f+p+l+parseInt(u.paddingBottom,10)+g,x=Math.min(5*v.offsetHeight,w),E=window.getComputedStyle(y),S=parseInt(E.paddingTop,10),_=parseInt(E.paddingBottom,10),C=e.top+e.height/2-dg,k=i-C,N=v.offsetHeight/2,M=f+p+(v.offsetTop+N),R=w-M;if(M<=C){const e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom="0px";const t=d.clientHeight-y.offsetTop-y.offsetHeight,n=M+Math.max(k,N+(e?_:0)+t+g);c.style.height=n+"px"}else{const e=a.length>0&&v===a[0].ref.current;c.style.top="0px";const t=Math.max(C,f+y.offsetTop+(e?S:0)+N)+R;c.style.height=t+"px",y.scrollTop=M-C+y.offsetTop}c.style.margin=`${dg}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>m.current=!0)}},[h,s.trigger,s.valueNode,c,d,y,v,b,s.dir,o]);Zu(()=>x(),[x]);const[E,S]=a.useState();Zu(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const _=a.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return r.jsx(vg,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:_,children:r.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:r.jsx(id.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});gg.displayName="SelectItemAlignedPosition";var yg=a.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:a=dg,...i}=e,s=Gm(n);return r.jsx(Bm,{...s,...i,ref:t,align:o,collisionPadding:a,style:{boxSizing:"border-box",...i.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)"}})});yg.displayName="SelectPopperPosition";var[vg,bg]=qm(cg,{}),wg="SelectViewport",xg=a.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...i}=e,s=pg(wg,n),l=bg(wg,n),c=Ku(t,s.onViewportChange),u=a.useRef(0);return r.jsxs(r.Fragment,{children:[r.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}),r.jsx(Xm.Slot,{scope:n,children:r.jsx(id.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Wu(i.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*dg,o=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),i=Math.max(o,a);if(i<r){const o=i+e,a=Math.min(r,o),s=o-a;n.style.height=a+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop})})})]})});xg.displayName=wg;var Eg="SelectGroup",[Sg,_g]=qm(Eg);a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Qu();return r.jsx(Sg,{scope:n,id:a,children:r.jsx(id.div,{role:"group","aria-labelledby":a,...o,ref:t})})}).displayName=Eg;var Cg="SelectLabel",kg=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=_g(Cg,n);return r.jsx(id.div,{id:a.id,...o,ref:t})});kg.displayName=Cg;var Ng="SelectItem",[Mg,Rg]=qm(Ng),Og=a.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:i=!1,textValue:s,...l}=e,c=Qm(Ng,n),u=pg(Ng,n),d=c.value===o,[f,p]=a.useState(s??""),[h,m]=a.useState(!1),g=Ku(t,e=>u.itemRefCallback?.(e,o,i)),y=Qu(),v=a.useRef("touch"),b=()=>{i||(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 r.jsx(Mg,{scope:n,value:o,disabled:i,textId:y,isSelected:d,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:r.jsx(Xm.ItemSlot,{scope:n,value:o,disabled:i,textValue:f,children:r.jsx(id.div,{role:"option","aria-labelledby":y,"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,...l,ref:g,onFocus:Wu(l.onFocus,()=>m(!0)),onBlur:Wu(l.onBlur,()=>m(!1)),onClick:Wu(l.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:Wu(l.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:Wu(l.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:Wu(l.onPointerMove,e=>{v.current=e.pointerType,i?u.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Wu(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Wu(l.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(Wm.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});Og.displayName=Ng;var Pg="SelectItemText",Ag=a.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,...l}=e,c=Qm(Pg,n),u=pg(Pg,n),d=Rg(Pg,n),f=tg(Pg,n),[p,h]=a.useState(null),m=Ku(t,e=>h(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,y=a.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=f;return Zu(()=>(v(y),()=>b(y)),[v,b,y]),r.jsxs(r.Fragment,{children:[r.jsx(id.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?i.createPortal(l.children,c.valueNode):null]})});Ag.displayName=Pg;var Tg="SelectItemIndicator",$g=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Rg(Tg,n).isSelected?r.jsx(id.span,{"aria-hidden":!0,...o,ref:t}):null});$g.displayName=Tg;var Dg="SelectScrollUpButton",Ig=a.forwardRef((e,t)=>{const n=pg(Dg,e.__scopeSelect),o=bg(Dg,e.__scopeSelect),[i,s]=a.useState(!1),l=Ku(t,o.onScrollButtonChange);return Zu(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?r.jsx(Bg,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Ig.displayName=Dg;var zg="SelectScrollDownButton",Lg=a.forwardRef((e,t)=>{const n=pg(zg,e.__scopeSelect),o=bg(zg,e.__scopeSelect),[i,s]=a.useState(!1),l=Ku(t,o.onScrollButtonChange);return Zu(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?r.jsx(Bg,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Lg.displayName=zg;var Bg=a.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...i}=e,s=pg("SelectScrollButton",n),l=a.useRef(null),c=Km(n),u=a.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return a.useEffect(()=>()=>u(),[u]),Zu(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(id.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Wu(i.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(o,50))}),onPointerMove:Wu(i.onPointerMove,()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))}),onPointerLeave:Wu(i.onPointerLeave,()=>{u()})})}),Fg=a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return r.jsx(id.div,{"aria-hidden":!0,...o,ref:t})});Fg.displayName="SelectSeparator";var jg="SelectArrow";a.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Gm(n),i=Qm(jg,n),s=pg(jg,n);return i.open&&"popper"===s.position?r.jsx(Fm,{...a,...o,ref:t}):null}).displayName=jg;var Hg=a.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const i=a.useRef(null),s=Ku(o,i),l=jm(t);return a.useEffect(()=>{const e=i.current;if(!e)return;const n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,"value").set;if(l!==t&&r){const n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[l,t]),r.jsx(id.select,{...n,style:{...Hm,...n.style},ref:s,defaultValue:t})});function Vg(e){return""===e||void 0===e}function Wg(e){const t=sd(e),n=a.useRef(""),r=a.useRef(0),o=a.useCallback(e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(o)},[t]),i=a.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function Yg(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0]),o=r?t[0]:t,a=n?e.indexOf(n):-1;let i=function(e,t){return e.map((n,r)=>e[(t+r)%e.length])}(e,Math.max(a,0));1===o.length&&(i=i.filter(e=>e!==n));const s=i.find(e=>e.textValue.toLowerCase().startsWith(o.toLowerCase()));return s!==n?s:void 0}Hg.displayName="SelectBubbleInput";var Xg=og,Kg=sg,Ug=lg,qg=ug,Zg=xg,Gg=kg,Jg=Og,Qg=Ag,ey=$g,ty=Ig,ny=Lg,ry=Fg;const oy=ng,ay=ig,iy=rc(Xg)`
568
+ `,cf=({stamps:t,currentStep:n,onStepChange:o,onToggle:r})=>{const{theme:i}=hu(),a=t.length>0?Math.max(...t.map(e=>e.step)):0,s=t.length>0?Math.min(...t.map(e=>e.step)):0,l=a-s+1,c=e=>e<5e3?"latencyLow":e<=3e4?"latencyMedium":"latencyHigh";return e.createElement(Gd,{theme:i},e.createElement(Qd,{theme:i},e.createElement(Jd,{theme:i},"Timeline"),r&&e.createElement(ef,{onClick:r,title:"Collapse Panel",theme:i},e.createElement(Bl,{size:16}))),e.createElement(tf,null,Array.from({length:l},(r,a)=>{const l=s+a,u=l===n,d=l<n,f=t.some(e=>e.step===l),p=(e=>{const n=t.filter(t=>t.step===e);if(0===n.length)return null;const o=e-1,r=t.filter(e=>e.step===o);return 0===r.length?null:Math.min(...n.map(e=>e.time))-Math.max(...r.map(e=>e.time))})(l),h=(e=>{const n=t.filter(t=>t.step===e);return 0===n.length?`Step ${e}`:n[0]?.identifier||`Step ${e}`})(l);return e.createElement(nf,{key:l,isActive:u,isPast:d,hasStep:f,onClick:()=>f&&o(l),theme:i},e.createElement(of,null,e.createElement(rf,{isActive:u,isPast:d,hasStep:f,theme:i}),e.createElement(af,{isActive:u,theme:i},"Step ",l),p&&e.createElement("div",{style:{marginLeft:"auto"}},e.createElement(Tu,{variant:c(p)},(e=>e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`)(p)))),e.createElement(sf,{hasStep:f,theme:i},f?h:"No activity"),u&&e.createElement(lf,{theme:i}))})))};function uf(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),!1===n||!o.defaultPrevented)return t?.(o)}}function df(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ff(...e){return t=>{let n=!1;const o=e.map(e=>{const o=df(e,t);return n||"function"!=typeof o||(n=!0),o});if(n)return()=>{for(let t=0;t<o.length;t++){const n=o[t];"function"==typeof n?n():df(e[t],null)}}}}function pf(...e){return i.useCallback(ff(...e),e)}function hf(e,n=[]){let o=[];const r=()=>{const t=o.map(e=>i.createContext(e));return function(n){const o=n?.[e]||t;return i.useMemo(()=>({[`__scope${e}`]:{...n,[e]:o}}),[n,o])}};return r.scopeName=e,[function(n,r){const a=i.createContext(r),s=o.length;o=[...o,r];const l=n=>{const{scope:o,children:r,...l}=n,c=o?.[e]?.[s]||a,u=i.useMemo(()=>l,Object.values(l));return t.jsx(c.Provider,{value:u,children:r})};return l.displayName=n+"Provider",[l,function(t,o){const l=o?.[e]?.[s]||a,c=i.useContext(l);if(c)return c;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},mf(r,...n)]}function mf(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const o=n.reduce((t,{useScope:n,scopeName:o})=>({...t,...n(e)[`__scope${o}`]}),{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var gf=globalThis?.document?i.useLayoutEffect:()=>{},yf=i[" useId ".trim().toString()]||(()=>{}),vf=0;function bf(e){const[t,n]=i.useState(yf());return gf(()=>{e||n(e=>e??String(vf++))},[e]),e||(t?`radix-${t}`:"")}var xf=i[" useInsertionEffect ".trim().toString()]||gf;function wf({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,a,s]=function({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),a=i.useRef(t);return xf(()=>{a.current=t},[t]),i.useEffect(()=>{r.current!==n&&(a.current?.(n),r.current=n)},[n,r]),[n,o,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:r;{const t=i.useRef(void 0!==e);i.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",n=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${n}. 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.`)}t.current=l},[l,o])}const u=i.useCallback(t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)},[l,e,a,s]);return[c,u]}function Ef(e){const n=kf(e),o=i.forwardRef((e,o)=>{const{children:r,...a}=e,s=i.Children.toArray(r),l=s.find(Cf);if(l){const e=l.props.children,r=s.map(t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t);return t.jsx(n,{...a,ref:o,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(n,{...a,ref:o,children:r})});return o.displayName=`${e}.Slot`,o}function kf(e){const t=i.forwardRef((e,t)=>{const{children:n,...o}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),r=function(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...e)=>{const t=i(...e);return r(...e),t}:r&&(n[o]=r):"style"===o?n[o]={...r,...i}:"className"===o&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}(o,n.props);return n.type!==i.Fragment&&(r.ref=t?ff(t,e):e),i.cloneElement(n,r)}return i.Children.count(n)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sf=Symbol("radix.slottable");function Cf(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Sf}var _f=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const o=Ef(`Primitive.${n}`),r=i.forwardRef((e,r)=>{const{asChild:i,...a}=e,s=i?o:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:r})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{});function Nf(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}var Mf,Pf="dismissableLayer.update",Of="dismissableLayer.pointerDownOutside",Rf="dismissableLayer.focusOutside",$f=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Af=i.forwardRef((e,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext($f),[f,p]=i.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=pf(n,e=>p(e)),y=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(v),x=f?y.indexOf(f):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,E=x>=b,k=function(e,t=globalThis?.document){const n=Nf(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let o=function(){zf(Of,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",r.current),r.current=o,t.addEventListener("click",r.current,{once:!0})):o()}else t.removeEventListener("click",r.current);o.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}(e=>{const t=e.target,n=[...d.branches].some(e=>e.contains(t));E&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())},h),S=function(e,t=globalThis?.document){const n=Nf(e),o=i.useRef(!1);return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){zf(Rf,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(e=>{const t=e.target;[...d.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||c?.())},h);return function(e,t=globalThis?.document){const n=Nf(e);i.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{x===d.layers.size-1&&(r?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},h),i.useEffect(()=>{if(f)return o&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Mf=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Tf(),()=>{o&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=Mf)}},[f,h,o,d]),i.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Tf())},[f,d]),i.useEffect(()=>{const e=()=>m({});return document.addEventListener(Pf,e),()=>document.removeEventListener(Pf,e)},[]),t.jsx(_f.div,{...u,ref:g,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:uf(e.onFocusCapture,S.onFocusCapture),onBlurCapture:uf(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:uf(e.onPointerDownCapture,k.onPointerDownCapture)})});Af.displayName="DismissableLayer";var Df=i.forwardRef((e,n)=>{const o=i.useContext($f),r=i.useRef(null),a=pf(n,r);return i.useEffect(()=>{const e=r.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}},[o.branches]),t.jsx(_f.div,{...e,ref:a})});function Tf(){const e=new CustomEvent(Pf);document.dispatchEvent(e)}function zf(e,t,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?function(e,t){e&&a.flushSync(()=>e.dispatchEvent(t))}(r,i):r.dispatchEvent(i)}Df.displayName="DismissableLayerBranch";var If="focusScope.autoFocusOnMount",Lf="focusScope.autoFocusOnUnmount",jf={bubbles:!1,cancelable:!0},Bf=i.forwardRef((e,n)=>{const{loop:o=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=Nf(a),f=Nf(s),p=i.useRef(null),h=pf(n,e=>u(e)),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:Wf(p.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Wf(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Wf(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const o=new MutationObserver(n);return c&&o.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),o.disconnect()}}},[r,c,m.paused]),i.useEffect(()=>{if(c){Yf.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(If,jf);c.addEventListener(If,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(Wf(o,{select:t}),document.activeElement!==n)return}((e=Ff(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Wf(c))}return()=>{c.removeEventListener(If,d),setTimeout(()=>{const e=new CustomEvent(Lf,jf);c.addEventListener(Lf,f),c.dispatchEvent(e),e.defaultPrevented||Wf(t??document.body,{select:!0}),c.removeEventListener(Lf,f),Yf.remove(m)},0)}}var e},[c,d,f,m]);const g=i.useCallback(e=>{if(!o&&!r)return;if(m.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[r,i]=function(e){const t=Ff(e),n=Hf(t,e),o=Hf(t.reverse(),e);return[n,o]}(t);r&&i?e.shiftKey||n!==i?e.shiftKey&&n===r&&(e.preventDefault(),o&&Wf(i,{select:!0})):(e.preventDefault(),o&&Wf(r,{select:!0})):n===t&&e.preventDefault()}},[o,r,m.paused]);return t.jsx(_f.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});function Ff(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Hf(e,t){for(const n of e)if(!Vf(n,{upTo:t}))return n}function Vf(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Wf(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Bf.displayName="FocusScope";var Yf=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Xf(e,t),e.unshift(t)},remove(t){e=Xf(e,t),e[0]?.resume()}}}();function Xf(e,t){const n=[...e],o=n.indexOf(t);return-1!==o&&n.splice(o,1),n}var Zf=i.forwardRef((e,o)=>{const{container:r,...a}=e,[s,l]=i.useState(!1);gf(()=>l(!0),[]);const c=r||s&&globalThis?.document?.body;return c?n.createPortal(t.jsx(_f.div,{...a,ref:o}),c):null});Zf.displayName="Portal";var Kf=e=>{const{present:t,children:n}=e,o=function(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const e=qf(o.current);a.current="mounted"===l?e:"none"},[l]),gf(()=>{const t=o.current,n=r.current;if(n!==e){const o=a.current,i=qf(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&o!==i?"ANIMATION_OUT":"UNMOUNT")}r.current=e}},[e,c]),gf(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=qf(o.current).includes(CSS.escape(i.animationName));if(i.target===t&&a&&(c("ANIMATION_END"),!r.current)){const o=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=o)})}},s=e=>{e.target===t&&(a.current=qf(o.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,n(e)},[])}}(t),r="function"==typeof n?n({present:o.isPresent}):i.Children.only(n),a=pf(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r));return"function"==typeof n||o.isPresent?i.cloneElement(r,{ref:a}):null};function qf(e){return e?.animationName||"none"}Kf.displayName="Presence";var Uf=0;function Gf(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qf()),document.body.insertAdjacentElement("beforeend",e[1]??Qf()),Uf++,()=>{1===Uf&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Uf--}},[])}function Qf(){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 Jf=function(){return Jf=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Jf.apply(this,arguments)};function ep(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;var tp="right-scroll-bar-position",np="width-before-scroll-bar";function op(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var rp="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,ip=new WeakMap;function ap(t,n){var o,r,i,a=(o=n||null,r=function(e){return t.forEach(function(t){return op(t,e)})},(i=e.useState(function(){return{value:o,callback:r,facade:{get current(){return i.value},set current(e){var t=i.value;t!==e&&(i.value=e,i.callback(e,t))}}}})[0]).callback=r,i.facade);return rp(function(){var e=ip.get(a);if(e){var n=new Set(e),o=new Set(t),r=a.current;n.forEach(function(e){o.has(e)||op(e,null)}),o.forEach(function(e){n.has(e)||op(e,r)})}ip.set(a,t)},[t]),a}function sp(e){return e}var lp=function(e){var t=e.sideCar,n=ep(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 i.createElement(o,Jf({},n))};lp.isSideCarExport=!0;var cp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=sp);var n=[],o=!1,r={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(e){var r=t(e,o);return n.push(r),function(){n=n.filter(function(e){return e!==r})}},assignSyncMedium:function(e){for(o=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){o=!0;var t=[];if(n.length){var r=n;n=[],r.forEach(e),t=n}var i=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(i)};a(),n={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),n}}}};return r}(null);return t.options=Jf({async:!0,ssr:!1},e),t}(),up=function(){},dp=i.forwardRef(function(e,t){var n=i.useRef(null),o=i.useState({onScrollCapture:up,onWheelCapture:up,onTouchMoveCapture:up}),r=o[0],a=o[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,m=e.noIsolation,g=e.inert,y=e.allowPinchZoom,v=e.as,b=void 0===v?"div":v,x=e.gapMode,w=ep(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,k=ap([n,t]),S=Jf(Jf({},w),r);return i.createElement(i.Fragment,null,d&&i.createElement(E,{sideCar:cp,removeScrollBar:u,shards:f,noRelative:h,noIsolation:m,inert:g,setCallbacks:a,allowPinchZoom:!!y,lockRef:n,gapMode:x}),s?i.cloneElement(i.Children.only(l),Jf(Jf({},S),{ref:k})):i.createElement(b,Jf({},S,{className:c,ref:k}),l))});dp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dp.classNames={fullWidth:np,zeroRight:tp};function fp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var pp=function(){var e=0,t=null;return{add:function(n){var o,r;0==e&&(t=fp())&&(r=n,(o=t).styleSheet?o.styleSheet.cssText=r:o.appendChild(document.createTextNode(r)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hp=function(){var e,t=(e=pp(),function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,o=e.dynamic;return t(n,o),null}},mp={left:0,top:0,right:0,gap:0},gp=function(e){return parseInt(e||"",10)||0},yp=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return mp;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],o=t["padding"===e?"paddingTop":"marginTop"],r=t["padding"===e?"paddingRight":"marginRight"];return[gp(n),gp(o),gp(r)]}(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])}},vp=hp(),bp="data-scroll-locked",xp=function(e,t,n,o){var r=e.left,i=e.top,a=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(o,";\n padding-right: ").concat(s,"px ").concat(o,";\n }\n body[").concat(bp,"] {\n overflow: hidden ").concat(o,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(o,";"),"margin"===n&&"\n padding-left: ".concat(r,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(o,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),"\n }\n \n .").concat(tp," {\n right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(np," {\n margin-right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(tp," .").concat(tp," {\n right: 0 ").concat(o,";\n }\n \n .").concat(np," .").concat(np," {\n margin-right: 0 ").concat(o,";\n }\n \n body[").concat(bp,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},wp=function(){var e=parseInt(document.body.getAttribute(bp)||"0",10);return isFinite(e)?e:0},Ep=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=void 0===o?"margin":o;i.useEffect(function(){return document.body.setAttribute(bp,(wp()+1).toString()),function(){var e=wp()-1;e<=0?document.body.removeAttribute(bp):document.body.setAttribute(bp,e.toString())}},[]);var a=i.useMemo(function(){return yp(r)},[r]);return i.createElement(vp,{styles:xp(a,!t,r,n?"":"!important")})},kp=!1;if("undefined"!=typeof window)try{var Sp=Object.defineProperty({},"passive",{get:function(){return kp=!0,!0}});window.addEventListener("test",Sp,Sp),window.removeEventListener("test",Sp,Sp)}catch(e){kp=!1}var Cp=!!kp&&{passive:!1},_p=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Np=function(e,t){var n=t.ownerDocument,o=t;do{if("undefined"!=typeof ShadowRoot&&o instanceof ShadowRoot&&(o=o.host),Mp(e,o)){var r=Pp(e,o);if(r[1]>r[2])return!0}o=o.parentNode}while(o&&o!==n.body);return!1},Mp=function(e,t){return"v"===e?function(e){return _p(e,"overflowY")}(t):function(e){return _p(e,"overflowX")}(t)},Pp=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Op=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rp=function(e){return[e.deltaX,e.deltaY]},$p=function(e){return e&&"current"in e?e.current:e},Ap=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Dp=0,Tp=[];function zp(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ip,Lp=(Ip=function(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(Dp++)[0],a=i.useState(hp)[0],s=i.useRef(e);i.useEffect(function(){s.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var t=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map($p),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=i.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var r,i=Op(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-i[0],c="deltaY"in e?e.deltaY:a[1]-i[1],u=e.target,d=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=Np(d,u);if(!f)return!0;if(f?r=d:(r="v"===d?"h":"v",f=Np(d,u)),!f)return!1;if(!o.current&&"changedTouches"in e&&(l||c)&&(o.current=r),!r)return!0;var p=o.current||r;return function(e,t,n,o,r){var i=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=i*o,s=n.target,l=t.contains(s),c=!1,u=a>0,d=0,f=0;do{if(!s)break;var p=Pp(e,s),h=p[0],m=p[1]-p[2]-i*h;(h||m)&&Mp(e,s)&&(d+=m,f+=h);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(r&&Math.abs(d)<1||!r&&a>d)||!u&&(r&&Math.abs(f)<1||!r&&-a>f))&&(c=!0),c}(p,t,e,"h"===p?l:c,!0)},[]),c=i.useCallback(function(e){var n=e;if(Tp.length&&Tp[Tp.length-1]===a){var o="deltaY"in n?Rp(n):Op(n),r=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,r=o,t[0]===r[0]&&t[1]===r[1]);var t,r})[0];if(r&&r.should)n.cancelable&&n.preventDefault();else if(!r){var i=(s.current.shards||[]).map($p).filter(Boolean).filter(function(e){return e.contains(n.target)});(i.length>0?l(n,i[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=i.useCallback(function(e,n,o,r){var i={name:e,delta:n,target:o,should:r,shadowParent:zp(o)};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),d=i.useCallback(function(e){n.current=Op(e),o.current=void 0},[]),f=i.useCallback(function(t){u(t.type,Rp(t),t.target,l(t,e.lockRef.current))},[]),p=i.useCallback(function(t){u(t.type,Op(t),t.target,l(t,e.lockRef.current))},[]);i.useEffect(function(){return Tp.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Cp),document.addEventListener("touchmove",c,Cp),document.addEventListener("touchstart",d,Cp),function(){Tp=Tp.filter(function(e){return e!==a}),document.removeEventListener("wheel",c,Cp),document.removeEventListener("touchmove",c,Cp),document.removeEventListener("touchstart",d,Cp)}},[]);var h=e.removeScrollBar,m=e.inert;return i.createElement(i.Fragment,null,m?i.createElement(a,{styles:Ap(r)}):null,h?i.createElement(Ep,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},cp.useMedium(Ip),lp),jp=i.forwardRef(function(e,t){return i.createElement(dp,Jf({},e,{ref:t,sideCar:Lp}))});jp.classNames=dp.classNames;var Bp=jp,Fp=new WeakMap,Hp=new WeakMap,Vp={},Wp=0,Yp=function(e){return e&&(e.host||Yp(e.parentNode))},Xp=function(e,t,n,o){var r=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Yp(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);Vp[n]||(Vp[n]=new WeakMap);var i=Vp[n],a=[],s=new Set,l=new Set(r),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};r.forEach(c);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(o),r=null!==t&&"false"!==t,l=(Fp.get(e)||0)+1,c=(i.get(e)||0)+1;Fp.set(e,l),i.set(e,c),a.push(e),1===l&&r&&Hp.set(e,!0),1===c&&e.setAttribute(n,"true"),r||e.setAttribute(o,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),s.clear(),Wp++,function(){a.forEach(function(e){var t=Fp.get(e)-1,r=i.get(e)-1;Fp.set(e,t),i.set(e,r),t||(Hp.has(e)||e.removeAttribute(o),Hp.delete(e)),r||e.removeAttribute(n)}),--Wp||(Fp=new WeakMap,Fp=new WeakMap,Hp=new WeakMap,Vp={})}},Zp=function(e,t,n){void 0===n&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Xp(o,r,n,"aria-hidden")):function(){return null}},Kp="Dialog",[qp,Up]=hf(Kp),[Gp,Qp]=qp(Kp),Jp=e=>{const{__scopeDialog:n,children:o,open:r,defaultOpen:a,onOpenChange:s,modal:l=!0}=e,c=i.useRef(null),u=i.useRef(null),[d,f]=wf({prop:r,defaultProp:a??!1,onChange:s,caller:Kp});return t.jsx(Gp,{scope:n,triggerRef:c,contentRef:u,contentId:bf(),titleId:bf(),descriptionId:bf(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(e=>!e),[f]),modal:l,children:o})};Jp.displayName=Kp;var eh="DialogTrigger",th=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Qp(eh,o),a=pf(n,i.triggerRef);return t.jsx(_f.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":wh(i.open),...r,ref:a,onClick:uf(e.onClick,i.onOpenToggle)})});th.displayName=eh;var nh="DialogPortal",[oh,rh]=qp(nh,{forceMount:void 0}),ih=e=>{const{__scopeDialog:n,forceMount:o,children:r,container:a}=e,s=Qp(nh,n);return t.jsx(oh,{scope:n,forceMount:o,children:i.Children.map(r,e=>t.jsx(Kf,{present:o||s.open,children:t.jsx(Zf,{asChild:!0,container:a,children:e})}))})};ih.displayName=nh;var ah="DialogOverlay",sh=i.forwardRef((e,n)=>{const o=rh(ah,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=Qp(ah,e.__scopeDialog);return a.modal?t.jsx(Kf,{present:r||a.open,children:t.jsx(ch,{...i,ref:n})}):null});sh.displayName=ah;var lh=Ef("DialogOverlay.RemoveScroll"),ch=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Qp(ah,o);return t.jsx(Bp,{as:lh,allowPinchZoom:!0,shards:[i.contentRef],children:t.jsx(_f.div,{"data-state":wh(i.open),...r,ref:n,style:{pointerEvents:"auto",...r.style}})})}),uh="DialogContent",dh=i.forwardRef((e,n)=>{const o=rh(uh,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=Qp(uh,e.__scopeDialog);return t.jsx(Kf,{present:r||a.open,children:a.modal?t.jsx(fh,{...i,ref:n}):t.jsx(ph,{...i,ref:n})})});dh.displayName=uh;var fh=i.forwardRef((e,n)=>{const o=Qp(uh,e.__scopeDialog),r=i.useRef(null),a=pf(n,o.contentRef,r);return i.useEffect(()=>{const e=r.current;if(e)return Zp(e)},[]),t.jsx(hh,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:uf(e.onCloseAutoFocus,e=>{e.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:uf(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:uf(e.onFocusOutside,e=>e.preventDefault())})}),ph=i.forwardRef((e,n)=>{const o=Qp(uh,e.__scopeDialog),r=i.useRef(!1),a=i.useRef(!1);return t.jsx(hh,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||o.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));const n=t.target,i=o.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})}),hh=i.forwardRef((e,n)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=e,c=Qp(uh,o),u=i.useRef(null),d=pf(n,u);return Gf(),t.jsxs(t.Fragment,{children:[t.jsx(Bf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:t.jsx(Af,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":wh(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(Ch,{titleId:c.titleId}),t.jsx(_h,{contentRef:u,descriptionId:c.descriptionId})]})]})}),mh="DialogTitle",gh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Qp(mh,o);return t.jsx(_f.h2,{id:i.titleId,...r,ref:n})});gh.displayName=mh;var yh="DialogDescription",vh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Qp(yh,o);return t.jsx(_f.p,{id:i.descriptionId,...r,ref:n})});vh.displayName=yh;var bh="DialogClose",xh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Qp(bh,o);return t.jsx(_f.button,{type:"button",...r,ref:n,onClick:uf(e.onClick,()=>i.onOpenChange(!1))})});function wh(e){return e?"open":"closed"}xh.displayName=bh;var Eh="DialogTitleWarning",[kh,Sh]=function(e,n){const o=i.createContext(n),r=e=>{const{children:n,...r}=e,a=i.useMemo(()=>r,Object.values(r));return t.jsx(o.Provider,{value:a,children:n})};return r.displayName=e+"Provider",[r,function(t){const r=i.useContext(o);if(r)return r;if(void 0!==n)return n;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Eh,{contentName:uh,titleName:mh,docsSlug:"dialog"}),Ch=({titleId:e})=>{const t=Sh(Eh),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},_h=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Sh("DialogDescriptionWarning").contentName}}.`;return i.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");if(t&&o){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},Nh=Jp,Mh=th,Ph=ih,Oh=sh,Rh=dh,$h=gh,Ah=vh,Dh=xh;const Th=Nh,zh=Mh,Ih=Ph,Lh=i.forwardRef(({className:e,...t},n)=>i.createElement(Oh,{style:{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50,backgroundColor:"hsla(var(--background), 0.8)",backdropFilter:"blur(4px)"},className:e,...t,ref:n}));Lh.displayName=Oh.displayName;const jh=(e="right")=>{const t={position:"fixed",zIndex:50,gap:"16px",backgroundColor:"hsl(var(--background))",padding:"24px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"all 0.3s ease-in-out"};switch(e){case"top":return{...t,left:0,right:0,top:0,borderBottom:"1px solid hsl(var(--border))"};case"bottom":return{...t,left:0,right:0,bottom:0,borderTop:"1px solid hsl(var(--border))"};case"left":return{...t,top:0,bottom:0,left:0,height:"100%",width:"75%",borderRight:"1px solid hsl(var(--border))",maxWidth:"384px"};default:return{...t,top:0,bottom:0,right:0,height:"100%",width:"75%",borderLeft:"1px solid hsl(var(--border))",maxWidth:"384px"}}},Bh=i.forwardRef(({side:e="right",className:t,children:n,...o},r)=>i.createElement(Ih,null,i.createElement(Lh,null),i.createElement(Rh,{ref:r,style:jh(e),className:t,...o},n,i.createElement(Dh,{style:{position:"absolute",right:"16px",top:"16px",borderRadius:"4px",opacity:.7,transition:"opacity 0.2s ease-in-out",cursor:"pointer",border:"none",background:"transparent",padding:"4px"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"}},i.createElement("svg",{style:{height:"16px",width:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})),i.createElement("span",{style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}},"Close")))));Bh.displayName=Rh.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement($h,{ref:n,style:{fontSize:"18px",fontWeight:600,color:"hsl(var(--foreground))"},className:e,...t})).displayName=$h.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(Ah,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=Ah.displayName;const Fh=(e,t,n={})=>{const{minNodeSpacing:o=200,containerWidth:r=600}=n;if(!e||0===e.length)return new Map;new Map(e.map(e=>[e.identifier,e]));const i=new Map,a=new Map;e.forEach(e=>i.set(e.identifier,[])),t.length>0?t.forEach(e=>{e.source&&e.target&&(i.get(e.source)?.push(e.target),a.set(e.target,e.source))}):e.forEach(e=>{e.parent&&e.parent.identifier!==e.identifier&&(i.get(e.parent.identifier)?.push(e.identifier),a.set(e.identifier,e.parent.identifier))});const s=e.filter(e=>!a.has(e.identifier)),l=new Map,c=(e,t)=>{l.set(e,t);for(const n of i.get(e)||[])c(n,t+1)};s.forEach(e=>c(e.identifier,0));const u=[];e.forEach(e=>{const t=l.get(e.identifier)??0;u[t]||(u[t]=[]),u[t].push(e.identifier)});const d=new Map,f=200,p=Math.max(250,o+50),h=e=>{const t=i.get(e)||[];if(0===t.length)return d.set(e,f),f;let n=0;for(const e of t)n+=h(e);return n+=(t.length-1)*p,d.set(e,n),n};s.forEach(e=>h(e.identifier));const m=new Map,g=Math.max(400,o+200),y=(e,t,n)=>{const o=d.get(e)||f,r=n*g+100,a=i.get(e)||[];if(0===a.length)m.set(e,{x:t+o/2-100,y:r});else{let o=t;for(const e of a){const t=d.get(e)||f;y(e,o,n+1),o+=t+p}const i=a[0],s=a[a.length-1],l=m.get(i),c=m.get(s),u=(l.x+c.x)/2;m.set(e,{x:u,y:r})}};let v=0;for(const e of s)v+=d.get(e.identifier)||f;s.length>1&&(v+=(s.length-1)*p*2);let b=Math.max(0,(r-v)/2);for(const e of s)y(e.identifier,b,0),b+=(d.get(e.identifier)||f)+2*p;const x=o,w=Array.from(m.keys());for(let e=0;e<w.length;e++)for(let t=e+1;t<w.length;t++){const n=m.get(w[e]),o=m.get(w[t]);if(Math.sqrt((o.x-n.x)**2+(o.y-n.y)**2)<x){const e=o.x-n.x,t=o.y-n.y,r=Math.sqrt(e*e+t*t);if(r>0){const i=x/r,a=(e*i-e)/2,s=(t*i-t)/2;n.x-=a,n.y-=s,o.x+=a,o.y+=s}else n.x-=x/2,o.x+=x/2}}return m},Hh={Agent:Ud,Tool:Ud,Coordinator:Ud},Vh=({flowData:t,width:n="100%",height:o="1000px",className:r="",defaultZoom:i=1,defaultPan:a={x:0,y:0},disableAutoFit:s=!0,showTimeline:l=!1,minNodeSpacing:c=200,onInspect:u})=>{const{theme:d,isDarkMode:f}=hu(),p=d.colors,h=t;if(!h)return e.createElement("div",{style:{width:"number"==typeof n?`${n}px`:n,height:"number"==typeof o?`${o}px`:o,border:`1px solid ${p.border}`,borderRadius:"8px",background:p.muted,position:"relative",minWidth:"800px",minHeight:"600px",display:"flex",alignItems:"center",justifyContent:"center"},className:r},e.createElement("div",{style:{textAlign:"center"}},e.createElement("div",{style:{fontSize:"16px",color:p.mutedForeground,marginBottom:"8px"}},"No flow data available"),e.createElement("div",{style:{fontSize:"14px",color:p.mutedForeground}},"Please provide flowData prop")));const m=e.useRef(null),g=e.useRef(null),[y,v]=e.useState({width:"number"==typeof n?n:1200,height:"number"==typeof o?o:600}),[b,x]=e.useState(0),[w,E]=e.useState(!1),k=e.useRef(null),[S,C]=e.useState(!1),_=e.useMemo(()=>{const e=h.stamps||h.steps||[];return e.length>0?Math.max(...e.map(e=>e.step)):0},[h.stamps,h.steps]);e.useEffect(()=>(w?k.current=setInterval(()=>{x(e=>e>=_?(E(!1),e):e+1)},250):k.current&&(clearInterval(k.current),k.current=null),()=>{k.current&&clearInterval(k.current)}),[w,_]),e.useEffect(()=>{const e=h.stamps||h.steps||[];e.length>0&&x(Math.max(...e.map(e=>e.step)))},[h.stamps,h.steps]),e.useEffect(()=>{const e=()=>{if(m.current){const e=m.current.getBoundingClientRect();v({width:Math.max(e.width||("number"==typeof n?n:1200),1200),height:e.height||("number"==typeof o?o:600)})}};if(e(),window.ResizeObserver&&m.current){const t=new ResizeObserver(e);return t.observe(m.current),()=>t.disconnect()}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n,o]);const N=e.useMemo(()=>{if(!h.nodes)return new Map;const e=Math.max(y.width||800,1200);return Fh(h.nodes,h.edges||[],{minNodeSpacing:c,containerWidth:e})},[h.nodes,h.edges,y.width,c]),M=e.useCallback(e=>h.nodes?h.nodes.filter(t=>t.stamp.step<=e):[],[h.nodes]),P=e.useCallback(e=>(h.edges||[]).filter(t=>t.stamp.step<=e),[h.edges]),O=e.useMemo(()=>{const e=M(b),t=P(b);return e.map(e=>{const n=N.get(e.identifier)||{x:0,y:0},o=e.stamp.step===b,r="Tool"===e.node_type?t.filter(t=>t.target===e.identifier&&t.details).map(e=>e.details):void 0;return{id:e.identifier,type:e.node_type||"Agent",position:n,data:{label:e.name||e.node_type,nodeType:e.node_type,details:e.details,isActive:o,id:e.identifier,edges:t,edgeDetails:r,onInspect:u},style:{filter:o?"drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3))":"none"}}})},[N,b,M,P,u]),R=e.useMemo(()=>P(b).filter(e=>e.source&&e.target).map(e=>{const t=e.stamp.step===b;return{id:e.identifier,type:"default",source:e.source,target:e.target,animated:t,bidirectional:!0,style:{stroke:t?p.primary:p.mutedForeground,strokeWidth:t?3:2},label:e.stamp?.identifier?Nu(String(e.stamp.identifier),50):void 0,data:{label:e.stamp?.identifier?Nu(String(e.stamp.identifier),50):void 0,source:e.source,target:e.target,step:e.stamp?.step,time:e.stamp?.time,details:e.details}}}),[b,P,p.primary,p.mutedForeground]),[$,A,D]=function(t){const[n,o]=e.useState(t),r=e.useCallback(e=>o(t=>ha(e,t)),[]);return[n,o,r]}(O),[T,z,I]=function(t){const[n,o]=e.useState(t),r=e.useCallback(e=>o(t=>ma(e,t)),[]);return[n,o,r]}(R);e.useEffect(()=>{A(O)},[O,A]),e.useEffect(()=>{z(R)},[R,z]);const L=e.useCallback(e=>z(t=>xr(e,t)),[z]),j=e.useCallback(e=>{x(e),E(!1)},[]);e.useCallback(()=>{E(e=>!e)},[]);const B=(e,t)=>{if(!g.current)return{x:0,y:0};const n=g.current.createSVGPoint();n.x=e,n.y=t;const o=n.matrixTransform(g.current.getScreenCTM()?.inverse());return{x:o.x,y:o.y}},F=Na();return e.useEffect(()=>{if(s||!F||0===O.length)return;const e=new Map;R.forEach(t=>{const n=e.get(t.source)||0;e.set(t.source,n+1);const o=e.get(t.target)||0;e.set(t.target,o+1)});let t="",n=0;e.forEach((e,o)=>{e>n&&(n=e,t=o)}),!t&&O.length>0&&(t=O[0].id),t&&setTimeout(()=>{F.fitView({nodes:[{id:t}],duration:1e3,padding:.2,minZoom:i,maxZoom:1})},500)},[O,R,F,s,i]),e.createElement("div",{ref:m,style:{width:"number"==typeof n?`${n}px`:n,height:"number"==typeof o?`${o}px`:o,border:`1px solid ${p.border}`,borderRadius:"8px",overflow:"hidden",position:"relative",minWidth:"800px",minHeight:"600px",background:p.background},className:r},l&&e.createElement(Th,{open:S,onOpenChange:C},e.createElement(zh,{asChild:!0},e.createElement("button",{style:{position:"absolute",top:"16px",left:"16px",zIndex:50,width:"40px",height:"40px",backgroundColor:p.card,border:`1px solid ${p.border}`,borderRadius:"8px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease-in-out",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=p.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=p.card},title:"Open Timeline"},e.createElement(Bl,{size:20,style:{color:p.mutedForeground}}))),e.createElement(Ih,null,e.createElement(Rh,{style:{position:"fixed",top:0,bottom:0,left:0,height:"100%",width:"280px",zIndex:50,backgroundColor:p.background,borderRight:`1px solid ${p.border}`,boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"all 0.3s ease-in-out",padding:0},onPointerDownOutside:e=>e.preventDefault()},e.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%"}},e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(cf,{stamps:h.stamps||h.steps||[],currentStep:b,onStepChange:j}))),e.createElement(Dh,{style:{position:"absolute",right:"16px",top:"16px",borderRadius:"4px",opacity:.7,transition:"opacity 0.2s ease-in-out",cursor:"pointer",border:"none",background:"transparent",padding:"4px",color:p.mutedForeground},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"}},e.createElement("svg",{style:{height:"16px",width:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})),e.createElement("span",{style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}},"Close"))))),e.createElement(il,{colorMode:f?"dark":"light",nodes:$,edges:T,onNodesChange:D,onEdgesChange:I,onConnect:L,nodeTypes:Hh,edgeTypes:{default:t=>e.createElement(mu,{...t,clientToSvgCoords:B,svgRef:g})},attributionPosition:"bottom-left",style:{width:"100%",height:"100%"},defaultViewport:{x:a.x,y:a.y,zoom:i},onInit:()=>{if(m.current){const e=m.current.querySelector("svg");e&&(g.current=e)}}},e.createElement(dl,{variant:rl.Lines,color:p.mutedBorder,gap:16})),e.createElement("style",null,`\n .react-flow__edge-label {\n font-size: 10px;\n background: ${p.card};\n color: ${p.cardForeground};\n padding: 2px 4px;\n border-radius: 4px;\n border: 1px solid ${p.border};\n max-width: 150px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .react-flow__edge {\n cursor: default !important;\n }\n\n .react-flow__edge-path {\n cursor: default !important;\n }\n `))};function Wh(e,[t,n]){return Math.min(n,Math.max(t,e))}var Yh=i.createContext(void 0);const Xh=["top","right","bottom","left"],Zh=Math.min,Kh=Math.max,qh=Math.round,Uh=Math.floor,Gh=e=>({x:e,y:e}),Qh={left:"right",right:"left",bottom:"top",top:"bottom"},Jh={start:"end",end:"start"};function em(e,t,n){return Kh(e,Zh(t,n))}function tm(e,t){return"function"==typeof e?e(t):e}function nm(e){return e.split("-")[0]}function om(e){return e.split("-")[1]}function rm(e){return"x"===e?"y":"x"}function im(e){return"y"===e?"height":"width"}const am=new Set(["top","bottom"]);function sm(e){return am.has(nm(e))?"y":"x"}function lm(e){return rm(sm(e))}function cm(e){return e.replace(/start|end/g,e=>Jh[e])}const um=["left","right"],dm=["right","left"],fm=["top","bottom"],pm=["bottom","top"];function hm(e,t,n,o){const r=om(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?dm:um:t?um:dm;case"left":case"right":return t?fm:pm;default:return[]}}(nm(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(cm)))),i}function mm(e){return e.replace(/left|right|bottom|top/g,e=>Qh[e])}function gm(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function ym(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function vm(e,t,n){let{reference:o,floating:r}=e;const i=sm(t),a=lm(t),s=im(a),l=nm(t),c="y"===i,u=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,f=o[s]/2-r[s]/2;let p;switch(l){case"top":p={x:u,y:o.y-r.height};break;case"bottom":p={x:u,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:d};break;case"left":p={x:o.x-r.width,y:d};break;default:p={x:o.x,y:o.y}}switch(om(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function bm(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=tm(t,e),h=gm(p),m=s[f?"floating"===d?"reference":"floating":d],g=ym(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===d?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},x=ym(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function xm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wm(e){return Xh.some(t=>e[t]>=0)}const Em=new Set(["left","top"]);function km(){return"undefined"!=typeof window}function Sm(e){return Nm(e)?(e.nodeName||"").toLowerCase():"#document"}function Cm(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function _m(e){var t;return null==(t=(Nm(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Nm(e){return!!km()&&(e instanceof Node||e instanceof Cm(e).Node)}function Mm(e){return!!km()&&(e instanceof Element||e instanceof Cm(e).Element)}function Pm(e){return!!km()&&(e instanceof HTMLElement||e instanceof Cm(e).HTMLElement)}function Om(e){return!(!km()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Cm(e).ShadowRoot)}const Rm=new Set(["inline","contents"]);function $m(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Wm(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Rm.has(r)}const Am=new Set(["table","td","th"]);function Dm(e){return Am.has(Sm(e))}const Tm=[":popover-open",":modal"];function zm(e){return Tm.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Im=["transform","translate","scale","rotate","perspective"],Lm=["transform","translate","scale","rotate","perspective","filter"],jm=["paint","layout","strict","content"];function Bm(e){const t=Fm(),n=Mm(e)?Wm(e):e;return Im.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Lm.some(e=>(n.willChange||"").includes(e))||jm.some(e=>(n.contain||"").includes(e))}function Fm(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Hm=new Set(["html","body","#document"]);function Vm(e){return Hm.has(Sm(e))}function Wm(e){return Cm(e).getComputedStyle(e)}function Ym(e){return Mm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xm(e){if("html"===Sm(e))return e;const t=e.assignedSlot||e.parentNode||Om(e)&&e.host||_m(e);return Om(t)?t.host:t}function Zm(e){const t=Xm(e);return Vm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pm(t)&&$m(t)?t:Zm(t)}function Km(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Zm(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),a=Cm(r);if(i){const e=qm(a);return t.concat(a,a.visualViewport||[],$m(r)?r:[],e&&n?Km(e):[])}return t.concat(r,Km(r,[],n))}function qm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Um(e){const t=Wm(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Pm(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:o,s=qh(n)!==i||qh(o)!==a;return s&&(n=i,o=a),{width:n,height:o,$:s}}function Gm(e){return Mm(e)?e:e.contextElement}function Qm(e){const t=Gm(e);if(!Pm(t))return Gh(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Um(t);let a=(i?qh(n.width):n.width)/o,s=(i?qh(n.height):n.height)/r;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const Jm=Gh(0);function eg(e){const t=Cm(e);return Fm()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Jm}function tg(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=Gm(e);let a=Gh(1);t&&(o?Mm(o)&&(a=Qm(o)):a=Qm(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Cm(e))&&t}(i,n,o)?eg(i):Gh(0);let l=(r.left+s.x)/a.x,c=(r.top+s.y)/a.y,u=r.width/a.x,d=r.height/a.y;if(i){const e=Cm(i),t=o&&Mm(o)?Cm(o):o;let n=e,r=qm(n);for(;r&&o&&t!==n;){const e=Qm(r),t=r.getBoundingClientRect(),o=Wm(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,a=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Cm(r),r=qm(n)}}return ym({width:u,height:d,x:l,y:c})}function ng(e,t){const n=Ym(e).scrollLeft;return t?t.left+n:tg(_m(e)).left+n}function og(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ng(e,n),y:n.top+t.scrollTop}}const rg=new Set(["absolute","fixed"]);function ig(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Cm(e),o=_m(e),r=n.visualViewport;let i=o.clientWidth,a=o.clientHeight,s=0,l=0;if(r){i=r.width,a=r.height;const e=Fm();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}const c=ng(o);if(c<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-r);a<=25&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)o=function(e){const t=_m(e),n=Ym(e),o=e.ownerDocument.body,r=Kh(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Kh(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+ng(e);const s=-n.scrollTop;return"rtl"===Wm(o).direction&&(a+=Kh(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:a,y:s}}(_m(e));else if(Mm(t))o=function(e,t){const n=tg(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Pm(e)?Qm(e):Gh(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=eg(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ym(o)}function ag(e,t){const n=Xm(e);return!(n===t||!Mm(n)||Vm(n))&&("fixed"===Wm(n).position||ag(n,t))}function sg(e,t,n){const o=Pm(t),r=_m(t),i="fixed"===n,a=tg(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Gh(0);function c(){l.x=ng(r)}if(o||!o&&!i)if(("body"!==Sm(t)||$m(r))&&(s=Ym(t)),o){const e=tg(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else r&&c();i&&!o&&r&&c();const u=!r||o||i?Gh(0):og(r,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function lg(e){return"static"===Wm(e).position}function cg(e,t){if(!Pm(e)||"fixed"===Wm(e).position)return null;if(t)return t(e);let n=e.offsetParent;return _m(e)===n&&(n=n.ownerDocument.body),n}function ug(e,t){const n=Cm(e);if(zm(e))return n;if(!Pm(e)){let t=Xm(e);for(;t&&!Vm(t);){if(Mm(t)&&!lg(t))return t;t=Xm(t)}return n}let o=cg(e,t);for(;o&&Dm(o)&&lg(o);)o=cg(o,t);return o&&Vm(o)&&lg(o)&&!Bm(o)?n:o||function(e){let t=Xm(e);for(;Pm(t)&&!Vm(t);){if(Bm(t))return t;if(zm(t))return null;t=Xm(t)}return null}(e)||n}const dg={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,a=_m(o),s=!!t&&zm(t.floating);if(o===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Gh(1);const u=Gh(0),d=Pm(o);if((d||!d&&!i)&&(("body"!==Sm(o)||$m(a))&&(l=Ym(o)),Pm(o))){const e=tg(o);c=Qm(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const f=!a||d||i?Gh(0):og(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:_m,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i="clippingAncestors"===n?zm(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Km(e,[],!1).filter(e=>Mm(e)&&"body"!==Sm(e)),r=null;const i="fixed"===Wm(e).position;let a=i?Xm(e):e;for(;Mm(a)&&!Vm(a);){const t=Wm(a),n=Bm(a);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&rg.has(r.position)||$m(a)&&!n&&ag(e,a))?o=o.filter(e=>e!==a):r=t,a=Xm(a)}return t.set(e,o),o}(t,this._c):[].concat(n),a=[...i,o],s=a[0],l=a.reduce((e,n)=>{const o=ig(t,n,r);return e.top=Kh(o.top,e.top),e.right=Zh(o.right,e.right),e.bottom=Zh(o.bottom,e.bottom),e.left=Kh(o.left,e.left),e},ig(t,s,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:ug,getElementRects:async function(e){const t=this.getOffsetParent||ug,n=this.getDimensions,o=await n(e.floating);return{reference:sg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Um(e);return{width:t,height:n}},getScale:Qm,isElement:Mm,isRTL:function(e){return"rtl"===Wm(e).direction}};function fg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pg(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=o,c=Gm(e),u=r||i?[...c?Km(c):[],...Km(t)]:[];u.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=c&&s?function(e,t){let n,o=null;const r=_m(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(s||t(),!f||!p)return;const h={rootMargin:-Uh(d)+"px "+-Uh(r.clientWidth-(u+f))+"px "+-Uh(r.clientHeight-(d+p))+"px "+-Uh(u)+"px",threshold:Kh(0,Zh(1,l))||1};let m=!0;function g(t){const o=t[0].intersectionRatio;if(o!==l){if(!m)return a();o?a(!1,o):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==o||fg(c,e.getBoundingClientRect())||a(),m=!1}try{o=new IntersectionObserver(g,{...h,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,h)}o.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver(e=>{let[o]=e;o&&o.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let m=l?tg(e):null;return l&&function t(){const o=tg(e);m&&!fg(m,o)&&n();m=o,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const hg=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),a=nm(n),s=om(n),l="y"===sm(n),c=Em.has(a)?-1:1,u=i&&l?-1:1,d=tm(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:a}}}}},mg=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=tm(e,t),c={x:n,y:o},u=await bm(t,l),d=sm(nm(r)),f=rm(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=em(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=em(h+u["y"===d?"top":"left"],h,h-u[e])}const m=s.fn({...t,[f]:p,[d]:h});return{...m,data:{x:m.x-n,y:m.y-o,enabled:{[f]:i,[d]:a}}}}}},gg=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=tm(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=nm(r),v=sm(s),b=nm(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(b||!m?[mm(s)]:function(e){const t=mm(e);return[cm(e),t,cm(t)]}(s)),E="none"!==h;!f&&E&&w.push(...hm(s,m,h,x));const k=[s,...w],S=await bm(t,g),C=[];let _=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&C.push(S[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const o=om(e),r=lm(e),i=im(r);let a="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=mm(a)),[a,mm(a)]}(r,a,x);C.push(S[e[0]],S[e[1]])}if(_=[..._,{placement:r,overflows:C}],!C.every(e=>e<=0)){var N,M;const e=((null==(N=i.flip)?void 0:N.index)||0)+1,t=k[e];if(t){if(!("alignment"===d&&v!==sm(t))||_.every(e=>sm(e.placement)!==v||e.overflows[0]>0))return{data:{index:e,overflows:_},reset:{placement:t}}}let n=null==(M=_.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:M.placement;if(!n)switch(p){case"bestFit":{var P;const e=null==(P=_.filter(e=>{if(E){const t=sm(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:P[0];e&&(n=e);break}case"initialPlacement":n=s}if(r!==n)return{reset:{placement:n}}}return{}}}},yg=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=tm(e,t),u=await bm(t,c),d=nm(r),f=om(r),p="y"===sm(r),{width:h,height:m}=i.floating;let g,y;"top"===d||"bottom"===d?(g=d,y=f===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g="end"===f?"top":"bottom");const v=m-u.top-u.bottom,b=h-u.left-u.right,x=Zh(m-u[g],v),w=Zh(h-u[y],b),E=!t.middlewareData.shift;let k=x,S=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=b),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(k=v),E&&!f){const e=Kh(u.left,0),t=Kh(u.right,0),n=Kh(u.top,0),o=Kh(u.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:Kh(u.left,u.right)):k=m-2*(0!==n||0!==o?n+o:Kh(u.top,u.bottom))}await l({...t,availableWidth:S,availableHeight:k});const C=await a.getDimensions(s.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},vg=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=tm(e,t);switch(o){case"referenceHidden":{const e=xm(await bm(t,{...r,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:wm(e)}}}case"escaped":{const e=xm(await bm(t,{...r,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:wm(e)}}}default:return{}}}}},bg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=tm(e,t)||{};if(null==c)return{};const d=gm(u),f={x:n,y:o},p=lm(r),h=im(p),m=await a.getDimensions(c),g="y"===p,y=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[p]-f[p]-i.floating[h],w=f[p]-i.reference[p],E=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let k=E?E[b]:0;k&&await(null==a.isElement?void 0:a.isElement(E))||(k=s.floating[b]||i.floating[h]);const S=x/2-w/2,C=k/2-m[h]/2-1,_=Zh(d[y],C),N=Zh(d[v],C),M=_,P=k-m[h]-N,O=k/2-m[h]/2+S,R=em(M,O,P),$=!l.arrow&&null!=om(r)&&O!==R&&i.reference[h]/2-(O<M?_:N)-m[h]/2<0,A=$?O<M?O-M:O-P:0;return{[p]:f[p]+A,data:{[p]:R,centerOffset:O-R-A,...$&&{alignmentOffset:A}},reset:$}}}),xg=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=tm(e,t),u={x:n,y:o},d=sm(r),f=rm(d);let p=u[f],h=u[d];const m=tm(s,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+g.mainAxis,n=i.reference[f]+i.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var y,v;const e="y"===f?"width":"height",t=Em.has(nm(r)),n=i.reference[d]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[d])||0)+(t?0:g.crossAxis),o=i.reference[d]+i.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>o&&(h=o)}return{[f]:p,[d]:h}}}},wg=(e,t,n)=>{const o=new Map,r={platform:dg,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=vm(c,o,l),f=o,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:g,y:y,data:v,reset:b}=await m({x:u,y:d,initialPlacement:o,placement:f,strategy:r,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=y?y:d,p={...p,[i]:{...p[i],...v}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:r}):b.rects),({x:u,y:d}=vm(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var Eg="undefined"!=typeof document?e.useLayoutEffect:function(){};function kg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!kg(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!kg(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Sg(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cg(e,t){const n=Sg(e);return Math.round(t*n)/n}function _g(e){const t=i.useRef(e);return Eg(()=>{t.current=e}),t}const Ng=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:o}="function"==typeof e?e(t):e;return n&&(r=n,{}.hasOwnProperty.call(r,"current"))?null!=n.current?bg({element:n.current,padding:o}).fn(t):{}:n?bg({element:n,padding:o}).fn(t):{};var r}}),Mg=(e,t)=>({...hg(e),options:[e,t]}),Pg=(e,t)=>({...mg(e),options:[e,t]}),Og=(e,t)=>({...xg(e),options:[e,t]}),Rg=(e,t)=>({...gg(e),options:[e,t]}),$g=(e,t)=>({...yg(e),options:[e,t]}),Ag=(e,t)=>({...vg(e),options:[e,t]}),Dg=(e,t)=>({...Ng(e),options:[e,t]});var Tg=i.forwardRef((e,n)=>{const{children:o,width:r=10,height:i=5,...a}=e;return t.jsx(_f.svg,{...a,ref:n,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?o:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Tg.displayName="Arrow";var zg=Tg;function Ig(e){const[t,n]=i.useState(void 0);return gf(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const o=t[0];let r,i;if("borderBoxSize"in o){const e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}var Lg="Popper",[jg,Bg]=hf(Lg),[Fg,Hg]=jg(Lg),Vg=e=>{const{__scopePopper:n,children:o}=e,[r,a]=i.useState(null);return t.jsx(Fg,{scope:n,anchor:r,onAnchorChange:a,children:o})};Vg.displayName=Lg;var Wg="PopperAnchor",Yg=i.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:r,...a}=e,s=Hg(Wg,o),l=i.useRef(null),c=pf(n,l),u=i.useRef(null);return i.useEffect(()=>{const e=u.current;u.current=r?.current||l.current,e!==u.current&&s.onAnchorChange(u.current)}),r?null:t.jsx(_f.div,{...a,ref:c})});Yg.displayName=Wg;var Xg="PopperContent",[Zg,Kg]=jg(Xg),qg=i.forwardRef((e,n)=>{const{__scopePopper:o,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:y,...v}=e,b=Hg(Xg,o),[x,w]=i.useState(null),E=pf(n,e=>w(e)),[k,S]=i.useState(null),C=Ig(k),_=C?.width??0,N=C?.height??0,M=r+("center"!==l?"-"+l:""),P="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(f)?f:[f],R=O.length>0,$={padding:P,boundary:O.filter(Jg),altBoundary:R},{refs:A,floatingStyles:D,placement:T,isPositioned:z,middlewareData:I}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[f,p]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=i.useState(o);kg(h,o)||m(o);const[g,y]=i.useState(null),[v,b]=i.useState(null),x=i.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[]),w=i.useCallback(e=>{e!==C.current&&(C.current=e,b(e))},[]),E=s||g,k=l||v,S=i.useRef(null),C=i.useRef(null),_=i.useRef(f),N=null!=u,M=_g(u),P=_g(r),O=_g(d),R=i.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:t,strategy:n,middleware:h};P.current&&(e.platform=P.current),wg(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};$.current&&!kg(_.current,t)&&(_.current=t,a.flushSync(()=>{p(t)}))})},[h,t,n,P,O]);Eg(()=>{!1===d&&_.current.isPositioned&&(_.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);const $=i.useRef(!1);Eg(()=>($.current=!0,()=>{$.current=!1}),[]),Eg(()=>{if(E&&(S.current=E),k&&(C.current=k),E&&k){if(M.current)return M.current(E,k,R);R()}},[E,k,R,M,N]);const A=i.useMemo(()=>({reference:S,floating:C,setReference:x,setFloating:w}),[x,w]),D=i.useMemo(()=>({reference:E,floating:k}),[E,k]),T=i.useMemo(()=>{const e={position:n,left:0,top:0};if(!D.floating)return e;const t=Cg(D.floating,f.x),o=Cg(D.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+o+"px)",...Sg(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}},[n,c,D.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:R,refs:A,elements:D,floatingStyles:T}),[f,R,A,D,T])}({strategy:"fixed",placement:M,whileElementsMounted:(...e)=>pg(...e,{animationFrame:"always"===g}),elements:{reference:b.anchor},middleware:[Mg({mainAxis:s+N,alignmentAxis:c}),d&&Pg({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?Og():void 0,...$}),d&&Rg({...$}),$g({...$,apply:({elements:e,rects:t,availableWidth:n,availableHeight:o})=>{const{width:r,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${o}px`),a.setProperty("--radix-popper-anchor-width",`${r}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),k&&Dg({element:k,padding:u}),ey({arrowWidth:_,arrowHeight:N}),m&&Ag({strategy:"referenceHidden",...$})]}),[L,j]=ty(T),B=Nf(y);gf(()=>{z&&B?.()},[z,B]);const F=I.arrow?.x,H=I.arrow?.y,V=0!==I.arrow?.centerOffset,[W,Y]=i.useState();return gf(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),t.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:z?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(Zg,{scope:o,placedSide:L,onArrowChange:S,arrowX:F,arrowY:H,shouldHideArrow:V,children:t.jsx(_f.div,{"data-side":L,"data-align":j,...v,ref:E,style:{...v.style,animation:z?void 0:"none"}})})})});qg.displayName=Xg;var Ug="PopperArrow",Gg={top:"bottom",right:"left",bottom:"top",left:"right"},Qg=i.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=Kg(Ug,o),a=Gg[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(zg,{...r,ref:n,style:{...r.style,display:"block"}})})});function Jg(e){return null!==e}Qg.displayName=Ug;var ey=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,i=0!==r.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=ty(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(r.arrow?.x??0)+a/2,f=(r.arrow?.y??0)+s/2;let p="",h="";return"bottom"===l?(p=i?u:`${d}px`,h=-s+"px"):"top"===l?(p=i?u:`${d}px`,h=`${o.floating.height+s}px`):"right"===l?(p=-s+"px",h=i?u:`${f}px`):"left"===l&&(p=`${o.floating.width+s}px`,h=i?u:`${f}px`),{data:{x:p,y:h}}}});function ty(e){const[t,n="center"]=e.split("-");return[t,n]}var ny=Vg,oy=Yg,ry=qg,iy=Qg;function ay(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sy=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"});i.forwardRef((e,n)=>t.jsx(_f.span,{...e,ref:n,style:{...sy,...e.style}})).displayName="VisuallyHidden";var ly=[" ","Enter","ArrowUp","ArrowDown"],cy=[" ","Enter"],uy="Select",[dy,fy,py]=function(n){const o=n+"CollectionProvider",[r,i]=hf(o),[a,s]=r(o,{collectionRef:{current:null},itemMap:new Map}),l=n=>{const{scope:o,children:r}=n,i=e.useRef(null),s=e.useRef(new Map).current;return t.jsx(a,{scope:o,itemMap:s,collectionRef:i,children:r})};l.displayName=o;const c=n+"CollectionSlot",u=Ef(c),d=e.forwardRef((e,n)=>{const{scope:o,children:r}=e,i=pf(n,s(c,o).collectionRef);return t.jsx(u,{ref:i,children:r})});d.displayName=c;const f=n+"CollectionItemSlot",p="data-radix-collection-item",h=Ef(f),m=e.forwardRef((n,o)=>{const{scope:r,children:i,...a}=n,l=e.useRef(null),c=pf(o,l),u=s(f,r);return e.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)})),t.jsx(h,{[p]:"",ref:c,children:i})});return m.displayName=f,[{Provider:l,Slot:d,ItemSlot:m},function(t){const o=s(n+"CollectionConsumer",t);return e.useCallback(()=>{const e=o.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(o.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[o.collectionRef,o.itemMap])},i]}(uy),[hy,my]=hf(uy,[py,Bg]),gy=Bg(),[yy,vy]=hy(uy),[by,xy]=hy(uy),wy=e=>{const{__scopeSelect:n,children:o,open:r,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:h,required:m,form:g}=e,y=gy(n),[v,b]=i.useState(null),[x,w]=i.useState(null),[E,k]=i.useState(!1),S=function(e){const t=i.useContext(Yh);return e||t||"ltr"}(d),[C,_]=wf({prop:r,defaultProp:a??!1,onChange:s,caller:uy}),[N,M]=wf({prop:l,defaultProp:c,onChange:u,caller:uy}),P=i.useRef(null),O=!v||(g||!!v.closest("form")),[R,$]=i.useState(new Set),A=Array.from(R).map(e=>e.props.value).join(";");return t.jsx(ny,{...y,children:t.jsxs(yy,{required:m,scope:n,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:k,contentId:bf(),value:N,onValueChange:M,open:C,onOpenChange:_,dir:S,triggerPointerDownPosRef:P,disabled:h,children:[t.jsx(dy.Provider,{scope:n,children:t.jsx(by,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(e=>{$(t=>new Set(t).add(e))},[]),onNativeOptionRemove:i.useCallback(e=>{$(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:o})}),O?t.jsxs(sv,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>M(e.target.value),disabled:h,form:g,children:[void 0===N?t.jsx("option",{value:""}):null,Array.from(R)]},A):null]})})};wy.displayName=uy;var Ey="SelectTrigger",ky=i.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:r=!1,...a}=e,s=gy(o),l=vy(Ey,o),c=l.disabled||r,u=pf(n,l.onTriggerChange),d=fy(o),f=i.useRef("touch"),[p,h,m]=cv(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===l.value),o=uv(t,e,n);void 0!==o&&l.onValueChange(o.value)}),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(oy,{asChild:!0,...s,children:t.jsx(_f.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":lv(l.value)?"":void 0,...a,ref:u,onClick:uf(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:uf(a.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:uf(a.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||ly.includes(e.key)&&(g(),e.preventDefault())})})})});ky.displayName=Ey;var Sy="SelectValue",Cy=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:i,children:a,placeholder:s="",...l}=e,c=vy(Sy,o),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,f=pf(n,c.onValueNodeChange);return gf(()=>{u(d)},[u,d]),t.jsx(_f.span,{...l,ref:f,style:{pointerEvents:"none"},children:lv(c.value)?t.jsx(t.Fragment,{children:s}):a})});Cy.displayName=Sy;var _y=i.forwardRef((e,n)=>{const{__scopeSelect:o,children:r,...i}=e;return t.jsx(_f.span,{"aria-hidden":!0,...i,ref:n,children:r||"▼"})});_y.displayName="SelectIcon";var Ny=e=>t.jsx(Zf,{asChild:!0,...e});Ny.displayName="SelectPortal";var My="SelectContent",Py=i.forwardRef((e,n)=>{const o=vy(My,e.__scopeSelect),[r,s]=i.useState();if(gf(()=>{s(new DocumentFragment)},[]),!o.open){const n=r;return n?a.createPortal(t.jsx(Ry,{scope:e.__scopeSelect,children:t.jsx(dy.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Dy,{...e,ref:n})});Py.displayName=My;var Oy=10,[Ry,$y]=hy(My),Ay=Ef("SelectContent.RemoveScroll"),Dy=i.forwardRef((e,n)=>{const{__scopeSelect:o,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v,...b}=e,x=vy(My,o),[w,E]=i.useState(null),[k,S]=i.useState(null),C=pf(n,e=>E(e)),[_,N]=i.useState(null),[M,P]=i.useState(null),O=fy(o),[R,$]=i.useState(!1),A=i.useRef(!1);i.useEffect(()=>{if(w)return Zp(w)},[w]),Gf();const D=i.useCallback(e=>{const[t,...n]=O().map(e=>e.ref.current),[o]=n.slice(-1),r=document.activeElement;for(const n of e){if(n===r)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&k&&(k.scrollTop=0),n===o&&k&&(k.scrollTop=k.scrollHeight),n?.focus(),document.activeElement!==r)return}},[O,k]),T=i.useCallback(()=>D([_,w]),[D,_,w]);i.useEffect(()=>{R&&T()},[R,T]);const{onOpenChange:z,triggerPointerDownPosRef:I}=x;i.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||z(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[w,z,I]),i.useEffect(()=>{const e=()=>z(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[z]);const[L,j]=cv(e=>{const t=O().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),o=uv(t,e,n);o&&setTimeout(()=>o.ref.current.focus())}),B=i.useCallback((e,t,n)=>{const o=!A.current&&!n;(void 0!==x.value&&x.value===t||o)&&(N(e),o&&(A.current=!0))},[x.value]),F=i.useCallback(()=>w?.focus(),[w]),H=i.useCallback((e,t,n)=>{const o=!A.current&&!n;(void 0!==x.value&&x.value===t||o)&&P(e)},[x.value]),V="popper"===r?zy:Ty,W=V===zy?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v}:{};return t.jsx(Ry,{scope:o,content:w,viewport:k,onViewportChange:S,itemRefCallback:B,selectedItem:_,onItemLeave:F,itemTextRefCallback:H,focusSelectedItem:T,selectedItemText:M,position:r,isPositioned:R,searchRef:L,children:t.jsx(Bp,{as:Ay,allowPinchZoom:!0,children:t.jsx(Bf,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:uf(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(Af,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:t.jsx(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...W,onPlaced:()=>$(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:uf(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||j(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,o=t.indexOf(n);t=t.slice(o+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});Dy.displayName="SelectContentImpl";var Ty=i.forwardRef((e,n)=>{const{__scopeSelect:o,onPlaced:r,...a}=e,s=vy(My,o),l=$y(My,o),[c,u]=i.useState(null),[d,f]=i.useState(null),p=pf(n,e=>f(e)),h=fy(o),m=i.useRef(!1),g=i.useRef(!0),{viewport:y,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=l,w=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&d&&y&&v&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),o=b.getBoundingClientRect();if("rtl"!==s.dir){const r=o.left-t.left,i=n.left-r,a=e.left-i,s=e.width+a,l=Math.max(s,t.width),u=window.innerWidth-Oy,d=Wh(i,[Oy,Math.max(Oy,u-l)]);c.style.minWidth=s+"px",c.style.left=d+"px"}else{const r=t.right-o.right,i=window.innerWidth-n.right-r,a=window.innerWidth-e.right-i,s=e.width+a,l=Math.max(s,t.width),u=window.innerWidth-Oy,d=Wh(i,[Oy,Math.max(Oy,u-l)]);c.style.minWidth=s+"px",c.style.right=d+"px"}const i=h(),a=window.innerHeight-2*Oy,l=y.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),x=f+p+l+parseInt(u.paddingBottom,10)+g,w=Math.min(5*v.offsetHeight,x),E=window.getComputedStyle(y),k=parseInt(E.paddingTop,10),S=parseInt(E.paddingBottom,10),C=e.top+e.height/2-Oy,_=a-C,N=v.offsetHeight/2,M=f+p+(v.offsetTop+N),P=x-M;if(M<=C){const e=i.length>0&&v===i[i.length-1].ref.current;c.style.bottom="0px";const t=d.clientHeight-y.offsetTop-y.offsetHeight,n=M+Math.max(_,N+(e?S:0)+t+g);c.style.height=n+"px"}else{const e=i.length>0&&v===i[0].ref.current;c.style.top="0px";const t=Math.max(C,f+y.offsetTop+(e?k:0)+N)+P;c.style.height=t+"px",y.scrollTop=M-C+y.offsetTop}c.style.margin=`${Oy}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=a+"px",r?.(),requestAnimationFrame(()=>m.current=!0)}},[h,s.trigger,s.valueNode,c,d,y,v,b,s.dir,r]);gf(()=>w(),[w]);const[E,k]=i.useState();gf(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const S=i.useCallback(e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)},[w,x]);return t.jsx(Iy,{scope:o,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:S,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:t.jsx(_f.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Ty.displayName="SelectItemAlignedPosition";var zy=i.forwardRef((e,n)=>{const{__scopeSelect:o,align:r="start",collisionPadding:i=Oy,...a}=e,s=gy(o);return t.jsx(ry,{...s,...a,ref:n,align:r,collisionPadding:i,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)"}})});zy.displayName="SelectPopperPosition";var[Iy,Ly]=hy(My,{}),jy="SelectViewport",By=i.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:r,...a}=e,s=$y(jy,o),l=Ly(jy,o),c=pf(n,s.onViewportChange),u=i.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:r}),t.jsx(dy.Slot,{scope:o,children:t.jsx(_f.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:uf(a.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:o}=l;if(o?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const o=window.innerHeight-2*Oy,r=parseFloat(n.style.minHeight),i=parseFloat(n.style.height),a=Math.max(r,i);if(a<o){const r=a+e,i=Math.min(o,r),s=r-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop})})})]})});By.displayName=jy;var Fy="SelectGroup",[Hy,Vy]=hy(Fy);i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=bf();return t.jsx(Hy,{scope:o,id:i,children:t.jsx(_f.div,{role:"group","aria-labelledby":i,...r,ref:n})})}).displayName=Fy;var Wy="SelectLabel",Yy=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=Vy(Wy,o);return t.jsx(_f.div,{id:i.id,...r,ref:n})});Yy.displayName=Wy;var Xy="SelectItem",[Zy,Ky]=hy(Xy),qy=i.forwardRef((e,n)=>{const{__scopeSelect:o,value:r,disabled:a=!1,textValue:s,...l}=e,c=vy(Xy,o),u=$y(Xy,o),d=c.value===r,[f,p]=i.useState(s??""),[h,m]=i.useState(!1),g=pf(n,e=>u.itemRefCallback?.(e,r,a)),y=bf(),v=i.useRef("touch"),b=()=>{a||(c.onValueChange(r),c.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 t.jsx(Zy,{scope:o,value:r,disabled:a,textId:y,isSelected:d,onItemTextChange:i.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t.jsx(dy.ItemSlot,{scope:o,value:r,disabled:a,textValue:f,children:t.jsx(_f.div,{role:"option","aria-labelledby":y,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:g,onFocus:uf(l.onFocus,()=>m(!0)),onBlur:uf(l.onBlur,()=>m(!1)),onClick:uf(l.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:uf(l.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:uf(l.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:uf(l.onPointerMove,e=>{v.current=e.pointerType,a?u.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:uf(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:uf(l.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(cy.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});qy.displayName=Xy;var Uy="SelectItemText",Gy=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:s,...l}=e,c=vy(Uy,o),u=$y(Uy,o),d=Ky(Uy,o),f=xy(Uy,o),[p,h]=i.useState(null),m=pf(n,e=>h(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,y=i.useMemo(()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=f;return gf(()=>(v(y),()=>b(y)),[v,b,y]),t.jsxs(t.Fragment,{children:[t.jsx(_f.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})});Gy.displayName=Uy;var Qy="SelectItemIndicator",Jy=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return Ky(Qy,o).isSelected?t.jsx(_f.span,{"aria-hidden":!0,...r,ref:n}):null});Jy.displayName=Qy;var ev="SelectScrollUpButton",tv=i.forwardRef((e,n)=>{const o=$y(ev,e.__scopeSelect),r=Ly(ev,e.__scopeSelect),[a,s]=i.useState(!1),l=pf(n,r.onScrollButtonChange);return gf(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),a?t.jsx(rv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});tv.displayName=ev;var nv="SelectScrollDownButton",ov=i.forwardRef((e,n)=>{const o=$y(nv,e.__scopeSelect),r=Ly(nv,e.__scopeSelect),[a,s]=i.useState(!1),l=pf(n,r.onScrollButtonChange);return gf(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),a?t.jsx(rv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});ov.displayName=nv;var rv=i.forwardRef((e,n)=>{const{__scopeSelect:o,onAutoScroll:r,...a}=e,s=$y("SelectScrollButton",o),l=i.useRef(null),c=fy(o),u=i.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),gf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),t.jsx(_f.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:uf(a.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(r,50))}),onPointerMove:uf(a.onPointerMove,()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(r,50))}),onPointerLeave:uf(a.onPointerLeave,()=>{u()})})}),iv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return t.jsx(_f.div,{"aria-hidden":!0,...r,ref:n})});iv.displayName="SelectSeparator";var av="SelectArrow";i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=gy(o),a=vy(av,o),s=$y(av,o);return a.open&&"popper"===s.position?t.jsx(iy,{...i,...r,ref:n}):null}).displayName=av;var sv=i.forwardRef(({__scopeSelect:e,value:n,...o},r)=>{const a=i.useRef(null),s=pf(r,a),l=ay(n);return i.useEffect(()=>{const e=a.current;if(!e)return;const t=window.HTMLSelectElement.prototype,o=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&o){const t=new Event("change",{bubbles:!0});o.call(e,n),e.dispatchEvent(t)}},[l,n]),t.jsx(_f.select,{...o,style:{...sy,...o.style},ref:s,defaultValue:n})});function lv(e){return""===e||void 0===e}function cv(e){const t=Nf(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(e=>{const r=n.current+e;t(r),function e(t){n.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(r)},[t]),a=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,a]}function uv(e,t,n){const o=t.length>1&&Array.from(t).every(e=>e===t[0]),r=o?t[0]:t,i=n?e.indexOf(n):-1;let a=function(e,t){return e.map((n,o)=>e[(t+o)%e.length])}(e,Math.max(i,0));1===r.length&&(a=a.filter(e=>e!==n));const s=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return s!==n?s:void 0}sv.displayName="SelectBubbleInput";var dv=ky,fv=_y,pv=Ny,hv=Py,mv=By,gv=Yy,yv=qy,vv=Gy,bv=Jy,xv=tv,wv=ov,Ev=iv;const kv=wy,Sv=Cy,Cv=Eu(dv)`
569
569
  display: flex;
570
570
  height: 2.5rem;
571
571
  width: 100%;
572
572
  align-items: center;
573
573
  justify-content: space-between;
574
- border-radius: 0.375rem;
575
- border: 1px solid #e5e7eb;
576
- background-color: white;
574
+ border-radius: ${e=>e.$theme.borderRadius.md};
575
+ border: 1px solid ${e=>e.$theme.colors.border};
576
+ background-color: ${e=>e.$theme.colors.background};
577
+ color: ${e=>e.$theme.colors.foreground};
577
578
  padding: 0.5rem 0.75rem;
578
- font-size: 0.875rem;
579
+ font-size: ${e=>e.$theme.fontSize.sm};
579
580
  line-height: 1.25rem;
580
581
  outline: none;
581
- transition: all 0.2s ease-in-out;
582
+ transition: ${e=>e.$theme.transitions.normal};
583
+ gap: 0.5rem;
582
584
 
583
585
  &:focus {
584
586
  outline: none;
585
- box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
587
+ box-shadow: 0 0 0 2px ${e=>e.$theme.colors.ring};
586
588
  }
587
589
 
588
590
  &:disabled {
@@ -591,41 +593,43 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
591
593
  }
592
594
 
593
595
  &[data-placeholder] {
594
- color: #6b7280;
596
+ color: ${e=>e.$theme.colors.mutedForeground};
595
597
  }
596
- `,sy=rc(ys)`
598
+ `,_v=Eu(zl)`
597
599
  height: 1rem;
598
600
  width: 1rem;
599
601
  opacity: 0.5;
600
- `,ly=rc(ty)`
602
+ color: ${e=>e.$theme.colors.mutedForeground};
603
+ `,Nv=Eu(xv)`
601
604
  display: flex;
602
605
  cursor: default;
603
606
  align-items: center;
604
607
  justify-content: center;
605
608
  padding: 0.25rem;
606
- `,cy=rc(bs)`
609
+ `,Mv=Eu(Ll)`
607
610
  height: 1rem;
608
611
  width: 1rem;
609
- `,uy=rc(ny)`
612
+ color: ${e=>e.$theme.colors.mutedForeground};
613
+ `,Pv=Eu(wv)`
610
614
  display: flex;
611
615
  cursor: default;
612
616
  align-items: center;
613
617
  justify-content: center;
614
618
  padding: 0.25rem;
615
- `,dy=rc(ys)`
619
+ `,Ov=Eu(zl)`
616
620
  height: 1rem;
617
621
  width: 1rem;
618
- `,fy=rc(qg)`
622
+ color: ${e=>e.$theme.colors.mutedForeground};
623
+ `,Rv=Eu(hv)`
619
624
  position: relative;
620
625
  z-index: 50;
621
626
  min-width: 8rem;
622
627
  overflow: hidden;
623
- border-radius: 0.5rem;
624
- border: 1px solid #e5e7eb;
625
- background-color: white;
626
- box-shadow:
627
- 0 10px 15px -3px rgba(0, 0, 0, 0.1),
628
- 0 4px 6px -2px rgba(0, 0, 0, 0.05);
628
+ border-radius: ${e=>e.$theme.borderRadius.lg};
629
+ border: 1px solid ${e=>e.$theme.colors.border};
630
+ background-color: ${e=>e.$theme.colors.background};
631
+ color: ${e=>e.$theme.colors.foreground};
632
+ box-shadow: ${e=>e.$theme.shadows.lg};
629
633
  animation: slideDownAndFade 0.2s ease-out;
630
634
 
631
635
  @keyframes slideDownAndFade {
@@ -638,13 +642,13 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
638
642
  transform: translateY(0);
639
643
  }
640
644
  }
641
- `,py=rc(Gg)`
645
+ `,$v=Eu(gv)`
642
646
  padding: 0.375rem 0.75rem;
643
647
  padding-left: 2rem;
644
- font-size: 0.875rem;
645
- font-weight: 600;
646
- color: #374151;
647
- `,hy=rc(Jg)`
648
+ font-size: ${e=>e.$theme.fontSize.sm};
649
+ font-weight: ${e=>e.$theme.fontWeight.semibold};
650
+ color: ${e=>e.$theme.colors.foreground};
651
+ `,Av=Eu(yv)`
648
652
  position: relative;
649
653
  display: flex;
650
654
  cursor: default;
@@ -652,13 +656,14 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
652
656
  align-items: center;
653
657
  padding: 0.375rem 0.75rem;
654
658
  padding-left: 2rem;
655
- font-size: 0.875rem;
659
+ font-size: ${e=>e.$theme.fontSize.sm};
660
+ color: ${e=>e.$theme.colors.foreground};
656
661
  outline: none;
657
- transition: all 0.2s ease-in-out;
662
+ transition: ${e=>e.$theme.transitions.normal};
658
663
 
659
664
  &:focus {
660
- background-color: #f3f4f6;
661
- color: #1f2937;
665
+ background-color: ${e=>e.$theme.colors.accent};
666
+ color: ${e=>e.$theme.colors.accentForeground};
662
667
  }
663
668
 
664
669
  &[data-disabled] {
@@ -667,10 +672,10 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
667
672
  }
668
673
 
669
674
  &[data-state="checked"] {
670
- background-color: #f3f4f6;
671
- color: #1f2937;
675
+ background-color: ${e=>e.$theme.colors.accent};
676
+ color: ${e=>e.$theme.colors.accentForeground};
672
677
  }
673
- `,my=rc.span`
678
+ `,Dv=Eu.span`
674
679
  position: absolute;
675
680
  left: 0.5rem;
676
681
  display: flex;
@@ -678,61 +683,69 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
678
683
  width: 0.875rem;
679
684
  align-items: center;
680
685
  justify-content: center;
681
- `,gy=rc(gs)`
686
+ `,Tv=Eu(Tl)`
682
687
  height: 1rem;
683
688
  width: 1rem;
684
- `,yy=rc(ry)`
689
+ color: ${e=>e.$theme.colors.primary};
690
+ `,zv=Eu(Ev)`
685
691
  margin: 0.25rem -0.25rem;
686
692
  height: 1px;
687
- background-color: #e5e7eb;
688
- `,vy=a.forwardRef(({children:e,...t},n)=>a.createElement(iy,{ref:n,...t},e,a.createElement(Kg,{asChild:!0},a.createElement(sy,null))));vy.displayName=Xg.displayName;const by=a.forwardRef(({...e},t)=>a.createElement(ly,{ref:t,...e},a.createElement(cy,null)));by.displayName=ty.displayName;const wy=a.forwardRef(({...e},t)=>a.createElement(uy,{ref:t,...e},a.createElement(dy,null)));wy.displayName=ny.displayName;const xy=a.forwardRef(({children:e,position:t="popper",...n},r)=>a.createElement(Ug,null,a.createElement(fy,{ref:r,position:t,...n},a.createElement(by,null),a.createElement(Zg,{style:{padding:"4px"}},e),a.createElement(wy,null))));xy.displayName=qg.displayName;a.forwardRef(({...e},t)=>a.createElement(py,{ref:t,...e})).displayName=Gg.displayName;const Ey=a.forwardRef(({children:e,...t},n)=>a.createElement(hy,{ref:n,...t},a.createElement(my,null,a.createElement(ey,null,a.createElement(gy,null))),a.createElement(Qg,null,e)));Ey.displayName=Jg.displayName;a.forwardRef(({...e},t)=>a.createElement(yy,{ref:t,...e})).displayName=ry.displayName;const Sy=rc.div`
693
+ background-color: ${e=>e.$theme.colors.border};
694
+ `,Iv=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=hu();return i.createElement(Cv,{ref:n,$theme:o,...t},e,i.createElement(fv,{asChild:!0},i.createElement(_v,{$theme:o})))});Iv.displayName=dv.displayName;const Lv=i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(Nv,{ref:t,...e},i.createElement(Mv,{$theme:n}))});Lv.displayName=xv.displayName;const jv=i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(Pv,{ref:t,...e},i.createElement(Ov,{$theme:n}))});jv.displayName=wv.displayName;const Bv=i.forwardRef(({children:e,position:t="popper",...n},o)=>{const{theme:r}=hu();return i.createElement(pv,null,i.createElement(Rv,{ref:o,position:t,$theme:r,...n},i.createElement(Lv,null),i.createElement(mv,{style:{padding:"4px"}},e),i.createElement(jv,null)))});Bv.displayName=hv.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement($v,{ref:t,$theme:n,...e})}).displayName=gv.displayName;const Fv=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=hu();return i.createElement(Av,{ref:n,$theme:o,...t},i.createElement(Dv,null,i.createElement(bv,null,i.createElement(Tv,{$theme:o}))),i.createElement(vv,null,e))});Fv.displayName=yv.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(zv,{ref:t,$theme:n,...e})}).displayName=Ev.displayName;const Hv=Eu.div`
689
695
  display: flex;
690
696
  align-items: center;
691
697
  gap: 0.5rem;
692
- min-width: 300px;
693
- `,_y=rc.div`
694
- padding: 0.5rem 1rem;
695
- color: ${e=>e.theme.colors.mutedForeground};
696
- font-size: 0.875rem;
697
- background-color: ${e=>e.theme.colors.muted};
698
- border-radius: 0.375rem;
699
- border: 1px solid ${e=>e.theme.colors.border};
700
- `,Cy=rc.div`
701
- flex: 1;
702
- min-width: 0;
703
- `,ky=({loading:t,children:n,...r})=>e.createElement(Cy,r,n),Ny=rc.div`
698
+ width: 100%;
699
+ `,Vv=Eu.div`
704
700
  display: flex;
705
701
  align-items: center;
706
- justify-content: space-between;
702
+ height: 2.5rem;
703
+ padding: 0.5rem 0.75rem;
704
+ color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
705
+ font-size: ${()=>{const{theme:e}=hu();return e.fontSize.sm}};
706
+ background-color: ${()=>{const{theme:e}=hu();return e.colors.background}};
707
+ border-radius: ${()=>{const{theme:e}=hu();return e.borderRadius.md}};
708
+ border: 1px solid
709
+ ${()=>{const{theme:e}=hu();return e.colors.border}};
710
+ `,Wv=Eu.div`
711
+ flex: 1;
712
+ min-width: 0;
707
713
  width: 100%;
708
- `,My=rc.div`
709
- padding: 0.5rem 1rem;
710
- color: ${e=>e.theme.colors.mutedForeground};
711
- font-size: 0.875rem;
714
+ `,Yv=Eu.div`
715
+ padding: 0.5rem 0.75rem;
716
+ color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
717
+ font-size: ${()=>{const{theme:e}=hu();return e.fontSize.sm}};
712
718
  text-align: center;
713
- `,Ry=rc.button`
719
+ `,Xv=Eu.button`
714
720
  display: flex;
715
721
  align-items: center;
716
722
  justify-content: center;
717
- padding: 0.5rem;
718
- border: none;
719
- border-radius: 0.375rem;
720
- border: 1px solid ${e=>e.theme.colors.border};
721
- background-color: ${e=>e.theme.colors.card};
722
- color: ${e=>e.theme.colors.cardForeground};
723
- transition: all 0.2s ease-in-out;
723
+ height: 2.5rem;
724
+ width: 2.5rem;
725
+ border: 1px solid
726
+ ${()=>{const{theme:e}=hu();return e.colors.border}};
727
+ border-radius: ${()=>{const{theme:e}=hu();return e.borderRadius.md}};
728
+ background-color: ${()=>{const{theme:e}=hu();return e.colors.background}};
729
+ color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
730
+ transition: ${()=>{const{theme:e}=hu();return e.transitions.normal}};
724
731
  opacity: ${e=>e.disabled?.5:1};
725
732
  cursor: ${e=>e.disabled?"not-allowed":"pointer"};
726
733
 
727
734
  &:hover:not(:disabled) {
728
- background-color: ${e=>e.theme.colors.muted};
729
- color: ${e=>e.theme.colors.cardForeground};
735
+ background-color: ${()=>{const{theme:e}=hu();return e.colors.accent}};
736
+ color: ${()=>{const{theme:e}=hu();return e.colors.accentForeground}};
730
737
  }
731
- `,Oy=({loading:t,disabled:n,children:r,...o})=>e.createElement(Ry,{disabled:n||t,...o},r),Py=rc(ws)`
738
+
739
+ &:focus {
740
+ outline: none;
741
+ box-shadow: 0 0 0 2px
742
+ ${()=>{const{theme:e}=hu();return e.colors.ring}};
743
+ }
744
+ `,Zv=Eu(jl)`
732
745
  height: 1rem;
733
746
  width: 1rem;
734
747
  animation: spin 1s linear infinite;
735
- color: ${e=>e.theme.colors.mutedForeground};
748
+ color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
736
749
 
737
750
  @keyframes spin {
738
751
  from {
@@ -742,10 +755,11 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
742
755
  transform: rotate(360deg);
743
756
  }
744
757
  }
745
- `,Ay=rc(Es)`
758
+ `,Kv=Eu(Fl)`
746
759
  height: 1rem;
747
760
  width: 1rem;
748
- `;var Ty="Checkbox",[$y,Dy]=Uu(Ty),[Iy,zy]=$y(Ty);function Ly(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:i,disabled:s,form:l,name:c,onCheckedChange:u,required:d,value:f="on",internal_do_not_use_render:p}=e,[h,m]=td({prop:n,defaultProp:i??!1,onChange:u,caller:Ty}),[g,y]=a.useState(null),[v,b]=a.useState(null),w=a.useRef(!1),x=!g||(!!l||!!g.closest("form")),E={checked:h,disabled:s,setChecked:m,control:g,setControl:y,name:c,form:l,value:f,hasConsumerStoppedPropagationRef:w,required:d,defaultChecked:!Ky(i)&&i,isFormControl:x,bubbleInput:v,setBubbleInput:b};return r.jsx(Iy,{scope:t,...E,children:Xy(p)?p(E):o})}var By="CheckboxTrigger",Fy=a.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},i)=>{const{control:s,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:g}=zy(By,e),y=Ku(i,f),v=a.useRef(u);return a.useEffect(()=>{const e=s?.form;if(e){const t=()=>p(v.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[s,p]),r.jsx(id.button,{type:"button",role:"checkbox","aria-checked":Ky(u)?"mixed":u,"aria-required":d,"data-state":Uy(u),"data-disabled":c?"":void 0,disabled:c,value:l,...o,ref:y,onKeyDown:Wu(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:Wu(n,e=>{p(e=>!!Ky(e)||!e),g&&m&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});Fy.displayName=By;var jy=a.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:a,defaultChecked:i,required:s,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return r.jsx(Ly,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:s,onCheckedChange:u,name:o,form:d,value:c,internal_do_not_use_render:({isFormControl:e})=>r.jsxs(r.Fragment,{children:[r.jsx(Fy,{...f,ref:t,__scopeCheckbox:n}),e&&r.jsx(Yy,{__scopeCheckbox:n})]})})});jy.displayName=Ty;var Hy="CheckboxIndicator",Vy=a.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...a}=e,i=zy(Hy,n);return r.jsx(Md,{present:o||Ky(i.checked)||!0===i.checked,children:r.jsx(id.span,{"data-state":Uy(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Vy.displayName=Hy;var Wy="CheckboxBubbleInput",Yy=a.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:i,checked:s,defaultChecked:l,required:c,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:m}=zy(Wy,e),g=Ku(n,m),y=jm(s),v=vm(o);a.useEffect(()=>{const e=h;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set,r=!i.current;if(y!==s&&n){const t=new Event("click",{bubbles:r});e.indeterminate=Ky(s),n.call(e,!Ky(s)&&s),e.dispatchEvent(t)}},[h,y,s,i]);const b=a.useRef(!Ky(s)&&s);return r.jsx(id.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:u,name:d,value:f,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function Xy(e){return"function"==typeof e}function Ky(e){return"indeterminate"===e}function Uy(e){return Ky(e)?"indeterminate":e?"checked":"unchecked"}Yy.displayName=Wy;const qy=rc(jy)`
761
+ color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
762
+ `;var qv="Checkbox",[Uv,Gv]=hf(qv),[Qv,Jv]=Uv(qv);function eb(e){const{__scopeCheckbox:n,checked:o,children:r,defaultChecked:a,disabled:s,form:l,name:c,onCheckedChange:u,required:d,value:f="on",internal_do_not_use_render:p}=e,[h,m]=wf({prop:o,defaultProp:a??!1,onChange:u,caller:qv}),[g,y]=i.useState(null),[v,b]=i.useState(null),x=i.useRef(!1),w=!g||(!!l||!!g.closest("form")),E={checked:h,disabled:s,setChecked:m,control:g,setControl:y,name:c,form:l,value:f,hasConsumerStoppedPropagationRef:x,required:d,defaultChecked:!cb(a)&&a,isFormControl:w,bubbleInput:v,setBubbleInput:b};return t.jsx(Qv,{scope:n,...E,children:lb(p)?p(E):r})}var tb="CheckboxTrigger",nb=i.forwardRef(({__scopeCheckbox:e,onKeyDown:n,onClick:o,...r},a)=>{const{control:s,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:g}=Jv(tb,e),y=pf(a,f),v=i.useRef(u);return i.useEffect(()=>{const e=s?.form;if(e){const t=()=>p(v.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[s,p]),t.jsx(_f.button,{type:"button",role:"checkbox","aria-checked":cb(u)?"mixed":u,"aria-required":d,"data-state":ub(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onKeyDown:uf(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:uf(o,e=>{p(e=>!!cb(e)||!e),g&&m&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});nb.displayName=tb;var ob=i.forwardRef((e,n)=>{const{__scopeCheckbox:o,name:r,checked:i,defaultChecked:a,required:s,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return t.jsx(eb,{__scopeCheckbox:o,checked:i,defaultChecked:a,disabled:l,required:s,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:e})=>t.jsxs(t.Fragment,{children:[t.jsx(nb,{...f,ref:n,__scopeCheckbox:o}),e&&t.jsx(sb,{__scopeCheckbox:o})]})})});ob.displayName=qv;var rb="CheckboxIndicator",ib=i.forwardRef((e,n)=>{const{__scopeCheckbox:o,forceMount:r,...i}=e,a=Jv(rb,o);return t.jsx(Kf,{present:r||cb(a.checked)||!0===a.checked,children:t.jsx(_f.span,{"data-state":ub(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})});ib.displayName=rb;var ab="CheckboxBubbleInput",sb=i.forwardRef(({__scopeCheckbox:e,...n},o)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:l,required:c,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:m}=Jv(ab,e),g=pf(o,m),y=ay(s),v=Ig(r);i.useEffect(()=>{const e=h;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set,o=!a.current;if(y!==s&&n){const t=new Event("click",{bubbles:o});e.indeterminate=cb(s),n.call(e,!cb(s)&&s),e.dispatchEvent(t)}},[h,y,s,a]);const b=i.useRef(!cb(s)&&s);return t.jsx(_f.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,style:{...n.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function lb(e){return"function"==typeof e}function cb(e){return"indeterminate"===e}function ub(e){return cb(e)?"indeterminate":e?"checked":"unchecked"}sb.displayName=ab;const db=Eu(ob)`
749
763
  display: flex;
750
764
  align-items: center;
751
765
  justify-content: center;
@@ -772,22 +786,22 @@ var ps={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
772
786
  background-color: #6366f1;
773
787
  color: white;
774
788
  }
775
- `,Zy=rc(Vy)`
789
+ `,fb=Eu(ib)`
776
790
  display: flex;
777
791
  align-items: center;
778
792
  justify-content: center;
779
793
  color: currentColor;
780
- `,Gy=rc(gs)`
794
+ `,pb=Eu(Tl)`
781
795
  height: 1rem;
782
796
  width: 1rem;
783
- `,Jy=a.forwardRef(({className:e,...t},n)=>a.createElement(qy,{ref:n,...t},a.createElement(Zy,null,a.createElement(Gy,null))));Jy.displayName=jy.displayName;const Qy=e.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),ev=()=>{const t=e.useContext(Qy);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};function tv(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function nv(){return ov(/^iPad/)||ov(/^Mac/)&&navigator.maxTouchPoints>1}function rv(){return ov(/^iPhone/)||nv()}function ov(e){return"undefined"!=typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");const av="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function iv(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}const sv="undefined"!=typeof document&&window.visualViewport;function lv(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function cv(e){for(lv(e)&&(e=e.parentElement);e&&!lv(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const uv=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let dv,fv=0;function pv(e={}){let{isDisabled:t}=e;av(()=>{if(!t)return fv++,1===fv&&rv()&&(dv=function(){let e,t=0,n=n=>{e=cv(n.target),e===document.documentElement&&e===document.body||(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();let r=n.changedTouches[0].pageY,o=e.scrollTop,a=e.scrollHeight-e.clientHeight;0!==a&&((o<=0&&r>t||o>=a&&r<t)&&n.preventDefault(),t=r)},o=e=>{let t=e.target;gv(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},a=e=>{let t=e.target;gv(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",sv&&(sv.height<window.innerHeight?requestAnimationFrame(()=>{mv(t)}):sv.addEventListener("resize",()=>mv(t),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,c=iv(function(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}(document.documentElement,"paddingRight",window.innerWidth-document.documentElement.clientWidth+"px"));window.scrollTo(0,0);let u=iv(hv(document,"touchstart",n,{passive:!1,capture:!0}),hv(document,"touchmove",r,{passive:!1,capture:!0}),hv(document,"touchend",o,{passive:!1,capture:!0}),hv(document,"focus",a,!0),hv(window,"scroll",i));return()=>{c(),u(),window.scrollTo(s,l)}}()),()=>{fv--,0===fv&&(null==dv||dv())}},[t])}function hv(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function mv(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=cv(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function gv(e){return e instanceof HTMLInputElement&&!uv.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function yv(...e){return a.useCallback(function(...e){return t=>e.forEach(e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t))}(...e),e)}const vv=new WeakMap;function bv(e,t,n=!1){if(!(e&&e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||vv.set(e,r)}const wv=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function xv(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[wv(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[wv(t)?5:4]):null)}function Ev(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}const Sv={DURATION:.5,EASE:[.32,.72,0,1]},_v=16,Cv="vaul-dragging";function kv(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>null==n.current?void 0:n.current.call(n,...e),[])}function Nv({prop:t,defaultProp:n,onChange:r=()=>{}}){const[o,a]=function({defaultProp:t,onChange:n}){const r=e.useState(t),[o]=r,a=e.useRef(o),i=kv(n);return e.useEffect(()=>{a.current!==o&&(i(o),a.current=o)},[o,a,i]),r}({defaultProp:n,onChange:r}),i=void 0!==t,s=i?t:o,l=kv(r),c=e.useCallback(e=>{if(i){const n="function"==typeof e?e(t):e;n!==t&&l(n)}else a(e)},[i,t,a,l]);return[s,c]}let Mv=null;function Rv({open:t,onOpenChange:n,children:r,onDrag:o,onRelease:a,snapPoints:i,shouldScaleBackground:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=.25,scrollLockTimeout:u=100,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:p=i&&i.length-1,activeSnapPoint:h,setActiveSnapPoint:m,fixed:g,modal:y=!0,onClose:v,nested:b,noBodyStyles:w=!1,direction:x="bottom",defaultOpen:E=!1,disablePreventScroll:S=!0,snapToSequentialPoint:_=!1,preventScrollRestoration:C=!1,repositionInputs:k=!0,onAnimationEnd:N,container:M,autoFocus:R=!1}){var O,P;const[A=!1,T]=Nv({defaultProp:E,prop:t,onChange:e=>{null==n||n(e),e||b||ue(),setTimeout(()=>{null==N||N(e)},1e3*Sv.DURATION),e&&!y&&"undefined"!=typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[$,D]=e.useState(!1),[I,z]=e.useState(!1),[L,B]=e.useState(!1),F=e.useRef(null),j=e.useRef(null),H=e.useRef(null),V=e.useRef(null),W=e.useRef(null),Y=e.useRef(!1),X=e.useRef(null),K=e.useRef(0),U=e.useRef(!1),q=e.useRef(!E),Z=e.useRef(0),G=e.useRef(null),J=e.useRef((null==(O=G.current)?void 0:O.getBoundingClientRect().height)||0),Q=e.useRef((null==(P=G.current)?void 0:P.getBoundingClientRect().width)||0),ee=e.useRef(0),te=e.useCallback(e=>{i&&e===ie.length-1&&(j.current=new Date)},[]),{activeSnapPoint:ne,activeSnapPointIndex:re,setActiveSnapPoint:oe,onRelease:ae,snapPointsOffset:ie,onDrag:se,shouldFade:le,getPercentageDragged:ce}=function({activeSnapPointProp:t,setActiveSnapPointProp:n,snapPoints:r,drawerRef:o,overlayRef:a,fadeFromIndex:i,onSnapPointChange:s,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=Nv({prop:t,defaultProp:null==r?void 0:r[0],onChange:n}),[p,h]=e.useState("undefined"!=typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);e.useEffect(()=>{function e(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const m=e.useMemo(()=>d===(null==r?void 0:r[r.length-1])||null,[r,d]),g=e.useMemo(()=>{var e;return null!=(e=null==r?void 0:r.findIndex(e=>e===d))?e:null},[r,d]),y=r&&r.length>0&&(i||0===i)&&!Number.isNaN(i)&&r[i]===d||!r,v=e.useMemo(()=>{const e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:"undefined"!=typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var t;return null!=(t=null==r?void 0:r.map(t=>{const n="string"==typeof t;let r=0;if(n&&(r=parseInt(t,10)),wv(l)){const o=n?r:p?t*e.height:0;return p?"bottom"===l?e.height-o:-e.height+o:o}const o=n?r:p?t*e.width:0;return p?"right"===l?e.width-o:-e.width+o:o}))?t:[]},[r,p,c]),b=e.useMemo(()=>null!==g?null==v?void 0:v[g]:null,[v,g]),w=e.useCallback(e=>{var t;const n=null!=(t=null==v?void 0:v.findIndex(t=>t===e))?t:null;s(n),bv(o.current,{transition:`transform ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,transform:wv(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&n!==v.length-1&&void 0!==i&&n!==i&&n<i?bv(a.current,{transition:`opacity ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,opacity:"0"}):bv(a.current,{transition:`opacity ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,opacity:"1"}),f(null==r?void 0:r[Math.max(n,0)])},[o.current,r,v,i,a,f]);return e.useEffect(()=>{if(d||t){var e;const n=null!=(e=null==r?void 0:r.findIndex(e=>e===t||e===d))?e:-1;v&&-1!==n&&"number"==typeof v[n]&&w(v[n])}},[d,t,r,v,w]),{isLastSnapPoint:m,activeSnapPoint:d,shouldFade:y,getPercentageDragged:function(e,t){if(!r||"number"!=typeof g||!v||void 0===i)return null;const n=g===i-1;if(g>=i&&t)return 0;if(n&&!t)return 1;if(!y&&!n)return null;const o=n?g+1:g-1,a=n?v[o]-v[o-1]:v[o+1]-v[o],s=e/Math.abs(a);return n?1-s:s},setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:n,dismissible:o}){if(void 0===i)return;const s="bottom"===l||"right"===l?(null!=b?b:0)-e:(null!=b?b:0)+e,c=0===g,d=e>0;if(g===i-1&&bv(a.current,{transition:`opacity ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`}),!u&&n>2&&!d)return void(o?t():w(v[0]));if(!u&&n>2&&d&&v&&r)return void w(v[r.length-1]);const f=null==v?void 0:v.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-s)<Math.abs(e-s)?t:e),p=wv(l)?window.innerHeight:window.innerWidth;if(n>.4&&Math.abs(e)<.4*p){const e=d?1:-1;if(e>0&&m&&r)return void w(v[r.length-1]);if(c&&e<0&&o&&t(),null===g)return;return void w(v[g+e])}w(f)},onDrag:function({draggedDistance:e}){if(null===b)return;const t="bottom"===l||"right"===l?b-e:b+e;("bottom"===l||"right"===l)&&t<v[v.length-1]||("top"===l||"left"===l)&&t>v[v.length-1]||bv(o.current,{transform:wv(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:v}}({snapPoints:i,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:G,fadeFromIndex:p,overlayRef:F,onSnapPointChange:te,direction:x,container:M,snapToSequentialPoint:_});pv({isDisabled:!A||I||!y||L||!$||!k||!S});const{restorePositionSetting:ue}=function({isOpen:t,modal:n,nested:r,hasBeenOpened:o,preventScrollRestoration:a,noBodyStyles:i}){const[s,l]=e.useState(()=>"undefined"!=typeof window?window.location.href:""),c=e.useRef(0),u=e.useCallback(()=>{if(tv()&&null===Mv&&t&&!i){Mv={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:-c.current+"px",left:-e+"px",right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=-(c.current+e)+"px")}),300)}},[t]),d=e.useCallback(()=>{if(tv()&&null!==Mv&&!i){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Mv),window.requestAnimationFrame(()=>{a&&s!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),Mv=null}},[s]);return e.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),e.useEffect(()=>{if(n)return()=>{"undefined"!=typeof document&&(document.querySelector("[data-vaul-drawer]")||d())}},[n,d]),e.useEffect(()=>{!r&&o&&(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),n||window.setTimeout(()=>{d()},500)):d())},[t,o,s,n,r,u,d]),{restorePositionSetting:d}}({isOpen:A,modal:y,nested:null!=b&&b,hasBeenOpened:$,preventScrollRestoration:C,noBodyStyles:w});function de(){return(window.innerWidth-26)/window.innerWidth}function fe(e,t){var n;let r=e;const o=null==(n=window.getSelection())?void 0:n.toString(),a=G.current?xv(G.current,x):null,i=new Date;if("SELECT"===r.tagName)return!1;if(r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===x||"left"===x)return!0;if(j.current&&i.getTime()-j.current.getTime()<500)return!1;if(null!==a&&("bottom"===x?a>0:a<0))return!0;if(o&&o.length>0)return!1;if(W.current&&i.getTime()-W.current.getTime()<u&&0===a)return W.current=i,!1;if(t)return W.current=i,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return W.current=new Date,!1;if("dialog"===r.getAttribute("role"))return!0}r=r.parentNode}return!0}function pe(e){!function(){if(!I||!G.current)return;G.current.classList.remove(Cv),Y.current=!1,z(!1),V.current=new Date}(),null==v||v(),e||T(!1),setTimeout(()=>{i&&oe(i[0])},1e3*Sv.DURATION)}function he(){if(!G.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=xv(G.current,x);bv(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`}),bv(F.current,{transition:`opacity ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,opacity:"1"}),s&&t&&t>0&&A&&bv(e,{borderRadius:"8px",overflow:"hidden",...wv(x)?{transform:`scale(${de()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${de()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Sv.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Sv.EASE.join(",")})`},!0)}return e.useEffect(()=>{window.requestAnimationFrame(()=>{q.current=!0})},[]),e.useEffect(()=>{var e;function t(){if(!G.current||!k)return;if(gv(document.activeElement)||U.current){var e;const t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight;let r=n-t;const o=G.current.getBoundingClientRect().height||0,a=o>.8*n;ee.current||(ee.current=o);const s=G.current.getBoundingClientRect().top;if(Math.abs(Z.current-r)>60&&(U.current=!U.current),i&&i.length>0&&ie&&re){r+=ie[re]||0}if(Z.current=r,o>t||U.current){const e=G.current.getBoundingClientRect().height;let n=e;e>t&&(n=t-(a?s:26)),G.current.style.height=g?e-Math.max(r,0)+"px":`${Math.max(n,t-s)}px`}else(function(){const e=navigator.userAgent;return"undefined"!=typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))})()||(G.current.style.height=`${ee.current}px`);i&&i.length>0&&!U.current?G.current.style.bottom="0px":G.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[re,i,ie]),e.useEffect(()=>(A&&(bv(document.documentElement,{scrollBehavior:"auto"}),j.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let n=vv.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[A]),e.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),e.createElement(lp,{defaultOpen:E,onOpenChange:e=>{(d||e)&&(e?D(!0):pe(!0),T(e))},open:A},e.createElement(Qy.Provider,{value:{activeSnapPoint:ne,snapPoints:i,setActiveSnapPoint:oe,drawerRef:G,overlayRef:F,onOpenChange:n,onPress:function(e){var t,n;(d||i)&&(G.current&&!G.current.contains(e.target)||(J.current=(null==(t=G.current)?void 0:t.getBoundingClientRect().height)||0,Q.current=(null==(n=G.current)?void 0:n.getBoundingClientRect().width)||0,z(!0),H.current=new Date,rv()&&window.addEventListener("touchend",()=>Y.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),K.current=wv(x)?e.pageY:e.pageX))},onRelease:function(e){if(!I||!G.current)return;G.current.classList.remove(Cv),Y.current=!1,z(!1),V.current=new Date;const t=xv(G.current,x);if(!e||!fe(e.target,!1)||!t||Number.isNaN(t))return;if(null===H.current)return;const n=V.current.getTime()-H.current.getTime(),r=K.current-(wv(x)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(B(!0),setTimeout(()=>{B(!1)},200)),i){return ae({draggedDistance:r*("bottom"===x||"right"===x?1:-1),closeDrawer:pe,velocity:o,dismissible:d}),void(null==a||a(e,!0))}if("bottom"===x||"right"===x?r>0:r<0)return he(),void(null==a||a(e,!0));if(o>.4)return pe(),void(null==a||a(e,!1));var s;const l=Math.min(null!=(s=G.current.getBoundingClientRect().height)?s:0,window.innerHeight);var u;const f=Math.min(null!=(u=G.current.getBoundingClientRect().width)?u:0,window.innerWidth),p="left"===x||"right"===x;if(Math.abs(t)>=(p?f:l)*c)return pe(),void(null==a||a(e,!1));null==a||a(e,!0),he()},onDrag:function(e){var t;if(G.current&&I){const n="bottom"===x||"right"===x?1:-1,r=(K.current-(wv(x)?e.pageY:e.pageX))*n,a=r>0,l=i&&!d&&!a;if(l&&0===re)return;const c=Math.abs(r),u=document.querySelector("[data-vaul-drawer-wrapper]");let f=c/("bottom"===x||"top"===x?J.current:Q.current);const h=ce(c,a);if(null!==h&&(f=h),l&&f>=1)return;if(!Y.current&&!fe(e.target,a))return;if(G.current.classList.add(Cv),Y.current=!0,bv(G.current,{transition:"none"}),bv(F.current,{transition:"none"}),i&&se({draggedDistance:r}),a&&!i){const e=(t=r,8*(Math.log(t+1)-2)),o=Math.min(-1*e,0)*n;return void bv(G.current,{transform:wv(x)?`translate3d(0, ${o}px, 0)`:`translate3d(${o}px, 0, 0)`})}const m=1-f;if((le||p&&re===p-1)&&(null==o||o(e,f),bv(F.current,{opacity:`${m}`,transition:"none"},!0)),u&&F.current&&s){const e=Math.min(de()+f*(1-de()),1),t=8-8*f,n=Math.max(0,14-14*f);bv(u,{borderRadius:`${t}px`,transform:wv(x)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){const e=c*n;bv(G.current,{transform:wv(x)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:d,shouldAnimate:q,handleOnly:f,isOpen:A,isDragging:I,shouldFade:le,closeDrawer:pe,onNestedDrag:function(e,t){if(t<0)return;const n=(window.innerWidth-_v)/window.innerWidth,r=n+t*(1-n),o=t*_v-16;bv(G.current,{transform:wv(x)?`scale(${r}) translate3d(0, ${o}px, 0)`:`scale(${r}) translate3d(${o}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){const t=e?(window.innerWidth-_v)/window.innerWidth:1,n=e?-16:0;X.current&&window.clearTimeout(X.current),bv(G.current,{transition:`transform ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,transform:wv(x)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&G.current&&(X.current=setTimeout(()=>{const e=xv(G.current,x);bv(G.current,{transition:"none",transform:wv(x)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const n=wv(x)?window.innerHeight:window.innerWidth,r=t?(n-_v)/n:1,o=t?-16:0;t&&bv(G.current,{transition:`transform ${Sv.DURATION}s cubic-bezier(${Sv.EASE.join(",")})`,transform:wv(x)?`scale(${r}) translate3d(0, ${o}px, 0)`:`scale(${r}) translate3d(${o}px, 0, 0)`})},keyboardIsOpen:U,modal:y,snapPointsOffset:ie,activeSnapPointIndex:re,direction:x,shouldScaleBackground:s,setBackgroundColorOnScale:l,noBodyStyles:w,container:M,autoFocus:R}},r))}const Ov=e.forwardRef(function({...t},n){const{overlayRef:r,snapPoints:o,onRelease:a,shouldFade:i,isOpen:s,modal:l,shouldAnimate:c}=ev(),u=yv(n,r),d=o&&o.length>0;if(!l)return null;const f=e.useCallback(e=>a(e),[a]);return e.createElement(dp,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":s&&d?"true":"false","data-vaul-snap-points-overlay":s&&i?"true":"false","data-vaul-animate":(null==c?void 0:c.current)?"true":"false",...t})});Ov.displayName="Drawer.Overlay";const Pv=e.forwardRef(function({onPointerDownOutside:t,style:n,onOpenAutoFocus:r,...o},a){const{drawerRef:i,onPress:s,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:p,isOpen:h,direction:m,snapPoints:g,container:y,handleOnly:v,shouldAnimate:b,autoFocus:w}=ev(),[x,E]=e.useState(!1),S=yv(a,i),_=e.useRef(null),C=e.useRef(null),k=e.useRef(!1),N=g&&g.length>0;!function(){const{direction:t,isOpen:n,shouldScaleBackground:r,setBackgroundColorOnScale:o,noBodyStyles:a}=ev(),i=e.useRef(null),s=e.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}e.useEffect(()=>{if(n&&r){i.current&&clearTimeout(i.current);const e=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!e)return;o&&!a&&Ev(document.body,{background:"black"}),Ev(e,{transformOrigin:wv(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Sv.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Sv.EASE.join(",")})`});const n=Ev(e,{borderRadius:"8px",overflow:"hidden",...wv(t)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),i.current=window.setTimeout(()=>{s?document.body.style.background=s:document.body.style.removeProperty("background")},1e3*Sv.DURATION)}}},[n,r,s])}();function M(e){_.current=null,k.current=!1,l(e)}return e.useEffect(()=>{N&&window.requestAnimationFrame(()=>{E(!0)})},[]),e.createElement(fp,{"data-vaul-drawer-direction":m,"data-vaul-drawer":"","data-vaul-delayed-snap-points":x?"true":"false","data-vaul-snap-points":h&&N?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":(null==b?void 0:b.current)?"true":"false",...o,ref:S,style:d&&d.length>0?{"--snap-point-height":`${d[null!=f?f:0]}px`,...n}:n,onPointerDown:e=>{v||(null==o.onPointerDown||o.onPointerDown.call(o,e),_.current={x:e.pageX,y:e.pageY},s(e))},onOpenAutoFocus:e=>{null==r||r(e),w||e.preventDefault()},onPointerDownOutside:e=>{null==t||t(e),p&&!e.defaultPrevented?u.current&&(u.current=!1):e.preventDefault()},onFocusOutside:e=>{p||e.preventDefault()},onPointerMove:e=>{if(C.current=e,v)return;if(null==o.onPointerMove||o.onPointerMove.call(o,e),!_.current)return;const t=e.pageY-_.current.y,n=e.pageX-_.current.x,r="touch"===e.pointerType?10:2,a=((e,t,n=0)=>{if(k.current)return!0;const r=Math.abs(e.y),o=Math.abs(e.x),a=o>r,i=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*i<0)&&o>=0&&o<=n)return a}else if(!(e.y*i<0)&&r>=0&&r<=n)return!a;return k.current=!0,!0})({x:n,y:t},m,r);a?c(e):(Math.abs(n)>r||Math.abs(t)>r)&&(_.current=null)},onPointerUp:e=>{null==o.onPointerUp||o.onPointerUp.call(o,e),_.current=null,k.current=!1,l(e)},onPointerOut:e=>{null==o.onPointerOut||o.onPointerOut.call(o,e),M(C.current)},onContextMenu:e=>{null==o.onContextMenu||o.onContextMenu.call(o,e),C.current&&M(C.current)}})});Pv.displayName="Drawer.Content";const Av=e.forwardRef(function({preventCycle:t=!1,children:n,...r},o){const{closeDrawer:a,isDragging:i,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:p,onDrag:h}=ev(),m=e.useRef(null),g=e.useRef(!1);function y(){m.current&&window.clearTimeout(m.current),g.current=!1}return e.createElement("div",{onClick:function(){g.current?y():window.setTimeout(()=>{!function(){if(i||t||g.current)return void y();if(y(),!s||0===s.length)return void(u||a());if(l===s[s.length-1]&&u)return void a();const e=s.findIndex(e=>e===l);if(-1===e)return;const n=s[e+1];c(n)}()},120)},onPointerCancel:y,onPointerDown:e=>{d&&p(e),m.current=window.setTimeout(()=>{g.current=!0},250)},onPointerMove:e=>{d&&h(e)},ref:o,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},e.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},n))});Av.displayName="Drawer.Handle";const Tv={Root:Rv,NestedRoot:function({onDrag:t,onOpenChange:n,open:r,...o}){const{onNestedDrag:a,onNestedOpenChange:i,onNestedRelease:s}=ev();if(!a)throw new Error("Drawer.NestedRoot must be placed in another drawer");return e.createElement(Rv,{nested:!0,open:r,onClose:()=>{i(!1)},onDrag:(e,n)=>{a(e,n),null==t||t(e,n)},onOpenChange:e=>{e&&i(e),null==n||n(e)},onRelease:s,...o})},Content:Pv,Overlay:Ov,Trigger:cp,Portal:function(t){const n=ev(),{container:r=n.container,...o}=t;return e.createElement(up,{container:r,...o})},Handle:Av,Close:mp,Title:pp,Description:hp},$v=({shouldScaleBackground:e=!0,...t})=>a.createElement(Tv.Root,{shouldScaleBackground:e,...t});$v.displayName="Drawer";const Dv=Tv.Portal,Iv=a.forwardRef(({className:e,...t},n)=>a.createElement(Tv.Overlay,{ref:n,style:{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50,backgroundColor:"rgba(0, 0, 0, 0.8)"},className:e,...t}));Iv.displayName=Tv.Overlay.displayName;const zv=a.forwardRef(({className:e,children:t,...n},r)=>a.createElement(Dv,null,a.createElement(Iv,null),a.createElement(Tv.Content,{ref:r,style:{position:"fixed",left:0,right:0,top:0,zIndex:50,marginTop:"96px",display:"flex",height:"auto",flexDirection:"column",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))"},className:e,...n},a.createElement("div",{style:{margin:"16px auto 0",height:"8px",width:"100px",borderRadius:"9999px",backgroundColor:"hsl(var(--muted))"}}),t)));zv.displayName="DrawerContent";a.forwardRef(({className:e,...t},n)=>a.createElement(Tv.Title,{ref:n,style:{fontSize:"18px",fontWeight:600,lineHeight:1,letterSpacing:"-0.025em"},className:e,...t})).displayName=Tv.Title.displayName;a.forwardRef(({className:e,...t},n)=>a.createElement(Tv.Description,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=Tv.Description.displayName;const Lv={div:(e,...t)=>rc.div`
784
- ${e.map((n,r)=>{if(0===r)return n;const o=t[r-1];return"function"==typeof o?n+`(${e=>{const t=dc(e.theme);return o({...e,theme:t})}})`+e[r]:n+o+e[r]}).join("")}
785
- `,button:(e,...t)=>rc.button`
786
- ${e.map((n,r)=>{if(0===r)return n;const o=t[r-1];return"function"==typeof o?n+`(${e=>{const t=dc(e.theme);return o({...e,theme:t})}})`+e[r]:n+o+e[r]}).join("")}
787
- `,span:(e,...t)=>rc.span`
788
- ${e.map((n,r)=>{if(0===r)return n;const o=t[r-1];return"function"==typeof o?n+`(${e=>{const t=dc(e.theme);return o({...e,theme:t})}})`+e[r]:n+o+e[r]}).join("")}
789
- `,h3:(e,...t)=>rc.h3`
790
- ${e.map((n,r)=>{if(0===r)return n;const o=t[r-1];return"function"==typeof o?n+`(${e=>{const t=dc(e.theme);return o({...e,theme:t})}})`+e[r]:n+o+e[r]}).join("")}
791
- `,textarea:(e,...t)=>rc.textarea`
792
- ${e.map((n,r)=>{if(0===r)return n;const o=t[r-1];return"function"==typeof o?n+`(${e=>{const t=dc(e.theme);return o({...e,theme:t})}})`+e[r]:n+o+e[r]}).join("")}
793
- `};exports.AgenticFlowVisualizer=_p,exports.AnthropicIcon=Vc,exports.Badge=gc,exports.Checkbox=Jy,exports.Drawer=$v,exports.Edge=Zl,exports.FileSelector=({files:t,currentFile:n,onFileSelect:r,onRefresh:o,loading:a=!1,disabled:i=!1})=>{const{theme:s}=ql();return e.createElement(Sy,null,0!==t.length||a?e.createElement(oy,{value:n||"",onValueChange:r,disabled:i||a},e.createElement(ky,{disabled:i,loading:a},e.createElement(vy,null,e.createElement(Ny,null,e.createElement(ay,{placeholder:a?"Loading sessions...":0===t.length?"No sessions found":"Select an Agent Session..."})))),e.createElement(xy,null,0!==t.length||a?t.map(t=>e.createElement(Ey,{key:t.name,value:t.name},t.name)):e.createElement(My,{theme:s},"No agent sessions available"))):e.createElement(_y,{theme:s},"No agent sessions available"),t.length>0&&e.createElement(Oy,{onClick:e=>{e.stopPropagation(),o()},disabled:a||i,loading:a,title:a?"Loading...":"Refresh files",theme:s},a?e.createElement(Py,{theme:s}):e.createElement(Ay,null)))},exports.GlobalStyles=()=>null,exports.GoogleIcon=Hc,exports.JsonTreeViewer=Fc,exports.Node=Pu,exports.OpenAIIcon=jc,exports.SafeThemeProvider=({children:t,theme:n,fallbackTheme:r=Yl})=>{const o=dc(n||r);return e.createElement(Wl,{theme:o},t)},exports.Select=oy,exports.Sheet=gp,exports.ThemeProvider=({children:t,theme:n})=>{const[r,o]=e.useState(()=>{if(n)return n;return"dark"===localStorage.getItem("theme")?Xl:Yl});e.useEffect(()=>{n&&o(n)},[n]),e.useEffect(()=>{if(n)return;const e=()=>{const e=localStorage.getItem("theme");o("dark"===e?Xl:Yl)};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[n]);const a=e.useMemo(()=>({theme:r,setTheme:o}),[r]);return e.createElement(Ul.Provider,{value:a},e.createElement(Wl,{theme:r},t))},exports.Timeline=Vu,exports.Visualizer=t=>e.createElement(Wi,null,e.createElement(_p,t)),exports.calculateAutoLayout=Ep,exports.cn=function(...e){return function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=oc(e))&&(r&&(r+=" "),r+=t);return r}(e)},exports.conditionalStyle=function(e,t,n=""){return e?t:n},exports.createSafeTheme=dc,exports.darkTheme=Xl,exports.defaultTheme=Kl,exports.formatCurrency=ic,exports.formatLatency=sc,exports.getColor=function(e,t){return e.colors[t]||e.colors.foreground},exports.getSafeColor=cc,exports.getSafeSpacing=uc,exports.getSafeThemeValue=function(e,t,n){if(!e)return console.warn(`Theme is undefined, using fallback for path: ${t}`),n;const r=t.split(".");let o=e;for(const e of r){if(void 0===o?.[e])return console.warn(`Theme property '${t}' not found, using fallback`),n;o=o[e]}return o},exports.getSpacing=function(e,t){return e.spacing[t]||e.spacing.md},exports.lightTheme=Yl,exports.safeStyled=Lv,exports.safeThemeColor=(e,t)=>n=>cc(n.theme,e,t),exports.safeThemeSpacing=(e,t)=>n=>uc(n.theme,e,t),exports.safeThemeValue=(e,t)=>n=>cc(n.theme,e,t),exports.toTitleCase=ac,exports.truncateText=lc,exports.useComponentTheme=e=>{const{theme:t}=ql();return e||t},exports.useSafeTheme=()=>Yl,exports.useTheme=ql,exports.useThemeValue=()=>{const{theme:e}=ql();return e};
797
+ `,hb=i.forwardRef(({className:e,...t},n)=>i.createElement(db,{ref:n,...t},i.createElement(fb,null,i.createElement(pb,null))));hb.displayName=ob.displayName;const mb=e.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),gb=()=>{const t=e.useContext(mb);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};function yb(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function vb(){return xb(/^iPad/)||xb(/^Mac/)&&navigator.maxTouchPoints>1}function bb(){return xb(/^iPhone/)||vb()}function xb(e){return"undefined"!=typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"undefined"==typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");const wb="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function Eb(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}const kb="undefined"!=typeof document&&window.visualViewport;function Sb(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Cb(e){for(Sb(e)&&(e=e.parentElement);e&&!Sb(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const _b=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Nb,Mb=0;function Pb(e={}){let{isDisabled:t}=e;wb(()=>{if(!t)return Mb++,1===Mb&&bb()&&(Nb=function(){let e,t=0,n=n=>{e=Cb(n.target),e===document.documentElement&&e===document.body||(t=n.changedTouches[0].pageY)},o=n=>{if(!e||e===document.documentElement||e===document.body)return void n.preventDefault();let o=n.changedTouches[0].pageY,r=e.scrollTop,i=e.scrollHeight-e.clientHeight;0!==i&&((r<=0&&o>t||r>=i&&o<t)&&n.preventDefault(),t=o)},r=e=>{let t=e.target;$b(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},i=e=>{let t=e.target;$b(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",kb&&(kb.height<window.innerHeight?requestAnimationFrame(()=>{Rb(t)}):kb.addEventListener("resize",()=>Rb(t),{once:!0}))}))},a=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,c=Eb(function(e,t,n){let o=e.style[t];return e.style[t]=n,()=>{e.style[t]=o}}(document.documentElement,"paddingRight",window.innerWidth-document.documentElement.clientWidth+"px"));window.scrollTo(0,0);let u=Eb(Ob(document,"touchstart",n,{passive:!1,capture:!0}),Ob(document,"touchmove",o,{passive:!1,capture:!0}),Ob(document,"touchend",r,{passive:!1,capture:!0}),Ob(document,"focus",i,!0),Ob(window,"scroll",a));return()=>{c(),u(),window.scrollTo(s,l)}}()),()=>{Mb--,0===Mb&&(null==Nb||Nb())}},[t])}function Ob(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function Rb(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Cb(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,o=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=o-n)}e=t.parentElement}}function $b(e){return e instanceof HTMLInputElement&&!_b.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Ab(...e){return i.useCallback(function(...e){return t=>e.forEach(e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t))}(...e),e)}const Db=new WeakMap;function Tb(e,t,n=!1){if(!(e&&e instanceof HTMLElement))return;let o={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(o[t]=e.style[t],e.style[t]=n)}),n||Db.set(e,o)}const zb=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Ib(e,t){if(!e)return null;const n=window.getComputedStyle(e),o=n.transform||n.webkitTransform||n.mozTransform;let r=o.match(/^matrix3d\((.+)\)$/);return r?parseFloat(r[1].split(", ")[zb(t)?13:12]):(r=o.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[zb(t)?5:4]):null)}function Lb(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}const jb={DURATION:.5,EASE:[.32,.72,0,1]},Bb=16,Fb="vaul-dragging";function Hb(t){const n=e.useRef(t);return e.useEffect(()=>{n.current=t}),e.useMemo(()=>(...e)=>null==n.current?void 0:n.current.call(n,...e),[])}function Vb({prop:t,defaultProp:n,onChange:o=()=>{}}){const[r,i]=function({defaultProp:t,onChange:n}){const o=e.useState(t),[r]=o,i=e.useRef(r),a=Hb(n);return e.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),o}({defaultProp:n,onChange:o}),a=void 0!==t,s=a?t:r,l=Hb(o),c=e.useCallback(e=>{if(a){const n="function"==typeof e?e(t):e;n!==t&&l(n)}else i(e)},[a,t,i,l]);return[s,c]}let Wb=null;function Yb({open:t,onOpenChange:n,children:o,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:s=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=.25,scrollLockTimeout:u=100,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:p=a&&a.length-1,activeSnapPoint:h,setActiveSnapPoint:m,fixed:g,modal:y=!0,onClose:v,nested:b,noBodyStyles:x=!1,direction:w="bottom",defaultOpen:E=!1,disablePreventScroll:k=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:C=!1,repositionInputs:_=!0,onAnimationEnd:N,container:M,autoFocus:P=!1}){var O,R;const[$=!1,A]=Vb({defaultProp:E,prop:t,onChange:e=>{null==n||n(e),e||b||ue(),setTimeout(()=>{null==N||N(e)},1e3*jb.DURATION),e&&!y&&"undefined"!=typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[D,T]=e.useState(!1),[z,I]=e.useState(!1),[L,j]=e.useState(!1),B=e.useRef(null),F=e.useRef(null),H=e.useRef(null),V=e.useRef(null),W=e.useRef(null),Y=e.useRef(!1),X=e.useRef(null),Z=e.useRef(0),K=e.useRef(!1),q=e.useRef(!E),U=e.useRef(0),G=e.useRef(null),Q=e.useRef((null==(O=G.current)?void 0:O.getBoundingClientRect().height)||0),J=e.useRef((null==(R=G.current)?void 0:R.getBoundingClientRect().width)||0),ee=e.useRef(0),te=e.useCallback(e=>{a&&e===ae.length-1&&(F.current=new Date)},[]),{activeSnapPoint:ne,activeSnapPointIndex:oe,setActiveSnapPoint:re,onRelease:ie,snapPointsOffset:ae,onDrag:se,shouldFade:le,getPercentageDragged:ce}=function({activeSnapPointProp:t,setActiveSnapPointProp:n,snapPoints:o,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:s,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=Vb({prop:t,defaultProp:null==o?void 0:o[0],onChange:n}),[p,h]=e.useState("undefined"!=typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);e.useEffect(()=>{function e(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const m=e.useMemo(()=>d===(null==o?void 0:o[o.length-1])||null,[o,d]),g=e.useMemo(()=>{var e;return null!=(e=null==o?void 0:o.findIndex(e=>e===d))?e:null},[o,d]),y=o&&o.length>0&&(a||0===a)&&!Number.isNaN(a)&&o[a]===d||!o,v=e.useMemo(()=>{const e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:"undefined"!=typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var t;return null!=(t=null==o?void 0:o.map(t=>{const n="string"==typeof t;let o=0;if(n&&(o=parseInt(t,10)),zb(l)){const r=n?o:p?t*e.height:0;return p?"bottom"===l?e.height-r:-e.height+r:r}const r=n?o:p?t*e.width:0;return p?"right"===l?e.width-r:-e.width+r:r}))?t:[]},[o,p,c]),b=e.useMemo(()=>null!==g?null==v?void 0:v[g]:null,[v,g]),x=e.useCallback(e=>{var t;const n=null!=(t=null==v?void 0:v.findIndex(t=>t===e))?t:null;s(n),Tb(r.current,{transition:`transform ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,transform:zb(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&n!==v.length-1&&void 0!==a&&n!==a&&n<a?Tb(i.current,{transition:`opacity ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,opacity:"0"}):Tb(i.current,{transition:`opacity ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,opacity:"1"}),f(null==o?void 0:o[Math.max(n,0)])},[r.current,o,v,a,i,f]);return e.useEffect(()=>{if(d||t){var e;const n=null!=(e=null==o?void 0:o.findIndex(e=>e===t||e===d))?e:-1;v&&-1!==n&&"number"==typeof v[n]&&x(v[n])}},[d,t,o,v,x]),{isLastSnapPoint:m,activeSnapPoint:d,shouldFade:y,getPercentageDragged:function(e,t){if(!o||"number"!=typeof g||!v||void 0===a)return null;const n=g===a-1;if(g>=a&&t)return 0;if(n&&!t)return 1;if(!y&&!n)return null;const r=n?g+1:g-1,i=n?v[r]-v[r-1]:v[r+1]-v[r],s=e/Math.abs(i);return n?1-s:s},setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:n,dismissible:r}){if(void 0===a)return;const s="bottom"===l||"right"===l?(null!=b?b:0)-e:(null!=b?b:0)+e,c=0===g,d=e>0;if(g===a-1&&Tb(i.current,{transition:`opacity ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`}),!u&&n>2&&!d)return void(r?t():x(v[0]));if(!u&&n>2&&d&&v&&o)return void x(v[o.length-1]);const f=null==v?void 0:v.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-s)<Math.abs(e-s)?t:e),p=zb(l)?window.innerHeight:window.innerWidth;if(n>.4&&Math.abs(e)<.4*p){const e=d?1:-1;if(e>0&&m&&o)return void x(v[o.length-1]);if(c&&e<0&&r&&t(),null===g)return;return void x(v[g+e])}x(f)},onDrag:function({draggedDistance:e}){if(null===b)return;const t="bottom"===l||"right"===l?b-e:b+e;("bottom"===l||"right"===l)&&t<v[v.length-1]||("top"===l||"left"===l)&&t>v[v.length-1]||Tb(r.current,{transform:zb(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:v}}({snapPoints:a,activeSnapPointProp:h,setActiveSnapPointProp:m,drawerRef:G,fadeFromIndex:p,overlayRef:B,onSnapPointChange:te,direction:w,container:M,snapToSequentialPoint:S});Pb({isDisabled:!$||z||!y||L||!D||!_||!k});const{restorePositionSetting:ue}=function({isOpen:t,modal:n,nested:o,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){const[s,l]=e.useState(()=>"undefined"!=typeof window?window.location.href:""),c=e.useRef(0),u=e.useCallback(()=>{if(yb()&&null===Wb&&t&&!a){Wb={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:-c.current+"px",left:-e+"px",right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=-(c.current+e)+"px")}),300)}},[t]),d=e.useCallback(()=>{if(yb()&&null!==Wb&&!a){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Wb),window.requestAnimationFrame(()=>{i&&s!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),Wb=null}},[s]);return e.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),e.useEffect(()=>{if(n)return()=>{"undefined"!=typeof document&&(document.querySelector("[data-vaul-drawer]")||d())}},[n,d]),e.useEffect(()=>{!o&&r&&(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),n||window.setTimeout(()=>{d()},500)):d())},[t,r,s,n,o,u,d]),{restorePositionSetting:d}}({isOpen:$,modal:y,nested:null!=b&&b,hasBeenOpened:D,preventScrollRestoration:C,noBodyStyles:x});function de(){return(window.innerWidth-26)/window.innerWidth}function fe(e,t){var n;let o=e;const r=null==(n=window.getSelection())?void 0:n.toString(),i=G.current?Ib(G.current,w):null,a=new Date;if("SELECT"===o.tagName)return!1;if(o.hasAttribute("data-vaul-no-drag")||o.closest("[data-vaul-no-drag]"))return!1;if("right"===w||"left"===w)return!0;if(F.current&&a.getTime()-F.current.getTime()<500)return!1;if(null!==i&&("bottom"===w?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(W.current&&a.getTime()-W.current.getTime()<u&&0===i)return W.current=a,!1;if(t)return W.current=a,!1;for(;o;){if(o.scrollHeight>o.clientHeight){if(0!==o.scrollTop)return W.current=new Date,!1;if("dialog"===o.getAttribute("role"))return!0}o=o.parentNode}return!0}function pe(e){!function(){if(!z||!G.current)return;G.current.classList.remove(Fb),Y.current=!1,I(!1),V.current=new Date}(),null==v||v(),e||A(!1),setTimeout(()=>{a&&re(a[0])},1e3*jb.DURATION)}function he(){if(!G.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=Ib(G.current,w);Tb(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`}),Tb(B.current,{transition:`opacity ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,opacity:"1"}),s&&t&&t>0&&$&&Tb(e,{borderRadius:"8px",overflow:"hidden",...zb(w)?{transform:`scale(${de()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${de()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${jb.DURATION}s`,transitionTimingFunction:`cubic-bezier(${jb.EASE.join(",")})`},!0)}return e.useEffect(()=>{window.requestAnimationFrame(()=>{q.current=!0})},[]),e.useEffect(()=>{var e;function t(){if(!G.current||!_)return;if($b(document.activeElement)||K.current){var e;const t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight;let o=n-t;const r=G.current.getBoundingClientRect().height||0,i=r>.8*n;ee.current||(ee.current=r);const s=G.current.getBoundingClientRect().top;if(Math.abs(U.current-o)>60&&(K.current=!K.current),a&&a.length>0&&ae&&oe){o+=ae[oe]||0}if(U.current=o,r>t||K.current){const e=G.current.getBoundingClientRect().height;let n=e;e>t&&(n=t-(i?s:26)),G.current.style.height=g?e-Math.max(o,0)+"px":`${Math.max(n,t-s)}px`}else(function(){const e=navigator.userAgent;return"undefined"!=typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))})()||(G.current.style.height=`${ee.current}px`);a&&a.length>0&&!K.current?G.current.style.bottom="0px":G.current.style.bottom=`${Math.max(o,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[oe,a,ae]),e.useEffect(()=>($&&(Tb(document.documentElement,{scrollBehavior:"auto"}),F.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let n=Db.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[$]),e.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),e.createElement(Nh,{defaultOpen:E,onOpenChange:e=>{(d||e)&&(e?T(!0):pe(!0),A(e))},open:$},e.createElement(mb.Provider,{value:{activeSnapPoint:ne,snapPoints:a,setActiveSnapPoint:re,drawerRef:G,overlayRef:B,onOpenChange:n,onPress:function(e){var t,n;(d||a)&&(G.current&&!G.current.contains(e.target)||(Q.current=(null==(t=G.current)?void 0:t.getBoundingClientRect().height)||0,J.current=(null==(n=G.current)?void 0:n.getBoundingClientRect().width)||0,I(!0),H.current=new Date,bb()&&window.addEventListener("touchend",()=>Y.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),Z.current=zb(w)?e.pageY:e.pageX))},onRelease:function(e){if(!z||!G.current)return;G.current.classList.remove(Fb),Y.current=!1,I(!1),V.current=new Date;const t=Ib(G.current,w);if(!e||!fe(e.target,!1)||!t||Number.isNaN(t))return;if(null===H.current)return;const n=V.current.getTime()-H.current.getTime(),o=Z.current-(zb(w)?e.pageY:e.pageX),r=Math.abs(o)/n;if(r>.05&&(j(!0),setTimeout(()=>{j(!1)},200)),a){return ie({draggedDistance:o*("bottom"===w||"right"===w?1:-1),closeDrawer:pe,velocity:r,dismissible:d}),void(null==i||i(e,!0))}if("bottom"===w||"right"===w?o>0:o<0)return he(),void(null==i||i(e,!0));if(r>.4)return pe(),void(null==i||i(e,!1));var s;const l=Math.min(null!=(s=G.current.getBoundingClientRect().height)?s:0,window.innerHeight);var u;const f=Math.min(null!=(u=G.current.getBoundingClientRect().width)?u:0,window.innerWidth),p="left"===w||"right"===w;if(Math.abs(t)>=(p?f:l)*c)return pe(),void(null==i||i(e,!1));null==i||i(e,!0),he()},onDrag:function(e){var t;if(G.current&&z){const n="bottom"===w||"right"===w?1:-1,o=(Z.current-(zb(w)?e.pageY:e.pageX))*n,i=o>0,l=a&&!d&&!i;if(l&&0===oe)return;const c=Math.abs(o),u=document.querySelector("[data-vaul-drawer-wrapper]");let f=c/("bottom"===w||"top"===w?Q.current:J.current);const h=ce(c,i);if(null!==h&&(f=h),l&&f>=1)return;if(!Y.current&&!fe(e.target,i))return;if(G.current.classList.add(Fb),Y.current=!0,Tb(G.current,{transition:"none"}),Tb(B.current,{transition:"none"}),a&&se({draggedDistance:o}),i&&!a){const e=(t=o,8*(Math.log(t+1)-2)),r=Math.min(-1*e,0)*n;return void Tb(G.current,{transform:zb(w)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`})}const m=1-f;if((le||p&&oe===p-1)&&(null==r||r(e,f),Tb(B.current,{opacity:`${m}`,transition:"none"},!0)),u&&B.current&&s){const e=Math.min(de()+f*(1-de()),1),t=8-8*f,n=Math.max(0,14-14*f);Tb(u,{borderRadius:`${t}px`,transform:zb(w)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!a){const e=c*n;Tb(G.current,{transform:zb(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:d,shouldAnimate:q,handleOnly:f,isOpen:$,isDragging:z,shouldFade:le,closeDrawer:pe,onNestedDrag:function(e,t){if(t<0)return;const n=(window.innerWidth-Bb)/window.innerWidth,o=n+t*(1-n),r=t*Bb-16;Tb(G.current,{transform:zb(w)?`scale(${o}) translate3d(0, ${r}px, 0)`:`scale(${o}) translate3d(${r}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){const t=e?(window.innerWidth-Bb)/window.innerWidth:1,n=e?-16:0;X.current&&window.clearTimeout(X.current),Tb(G.current,{transition:`transform ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,transform:zb(w)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&G.current&&(X.current=setTimeout(()=>{const e=Ib(G.current,w);Tb(G.current,{transition:"none",transform:zb(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const n=zb(w)?window.innerHeight:window.innerWidth,o=t?(n-Bb)/n:1,r=t?-16:0;t&&Tb(G.current,{transition:`transform ${jb.DURATION}s cubic-bezier(${jb.EASE.join(",")})`,transform:zb(w)?`scale(${o}) translate3d(0, ${r}px, 0)`:`scale(${o}) translate3d(${r}px, 0, 0)`})},keyboardIsOpen:K,modal:y,snapPointsOffset:ae,activeSnapPointIndex:oe,direction:w,shouldScaleBackground:s,setBackgroundColorOnScale:l,noBodyStyles:x,container:M,autoFocus:P}},o))}const Xb=e.forwardRef(function({...t},n){const{overlayRef:o,snapPoints:r,onRelease:i,shouldFade:a,isOpen:s,modal:l,shouldAnimate:c}=gb(),u=Ab(n,o),d=r&&r.length>0;if(!l)return null;const f=e.useCallback(e=>i(e),[i]);return e.createElement(Oh,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":s&&d?"true":"false","data-vaul-snap-points-overlay":s&&a?"true":"false","data-vaul-animate":(null==c?void 0:c.current)?"true":"false",...t})});Xb.displayName="Drawer.Overlay";const Zb=e.forwardRef(function({onPointerDownOutside:t,style:n,onOpenAutoFocus:o,...r},i){const{drawerRef:a,onPress:s,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:p,isOpen:h,direction:m,snapPoints:g,container:y,handleOnly:v,shouldAnimate:b,autoFocus:x}=gb(),[w,E]=e.useState(!1),k=Ab(i,a),S=e.useRef(null),C=e.useRef(null),_=e.useRef(!1),N=g&&g.length>0;!function(){const{direction:t,isOpen:n,shouldScaleBackground:o,setBackgroundColorOnScale:r,noBodyStyles:i}=gb(),a=e.useRef(null),s=e.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}e.useEffect(()=>{if(n&&o){a.current&&clearTimeout(a.current);const e=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!e)return;r&&!i&&Lb(document.body,{background:"black"}),Lb(e,{transformOrigin:zb(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${jb.DURATION}s`,transitionTimingFunction:`cubic-bezier(${jb.EASE.join(",")})`});const n=Lb(e,{borderRadius:"8px",overflow:"hidden",...zb(t)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{s?document.body.style.background=s:document.body.style.removeProperty("background")},1e3*jb.DURATION)}}},[n,o,s])}();function M(e){S.current=null,_.current=!1,l(e)}return e.useEffect(()=>{N&&window.requestAnimationFrame(()=>{E(!0)})},[]),e.createElement(Rh,{"data-vaul-drawer-direction":m,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":h&&N?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":(null==b?void 0:b.current)?"true":"false",...r,ref:k,style:d&&d.length>0?{"--snap-point-height":`${d[null!=f?f:0]}px`,...n}:n,onPointerDown:e=>{v||(null==r.onPointerDown||r.onPointerDown.call(r,e),S.current={x:e.pageX,y:e.pageY},s(e))},onOpenAutoFocus:e=>{null==o||o(e),x||e.preventDefault()},onPointerDownOutside:e=>{null==t||t(e),p&&!e.defaultPrevented?u.current&&(u.current=!1):e.preventDefault()},onFocusOutside:e=>{p||e.preventDefault()},onPointerMove:e=>{if(C.current=e,v)return;if(null==r.onPointerMove||r.onPointerMove.call(r,e),!S.current)return;const t=e.pageY-S.current.y,n=e.pageX-S.current.x,o="touch"===e.pointerType?10:2,i=((e,t,n=0)=>{if(_.current)return!0;const o=Math.abs(e.y),r=Math.abs(e.x),i=r>o,a=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*a<0)&&r>=0&&r<=n)return i}else if(!(e.y*a<0)&&o>=0&&o<=n)return!i;return _.current=!0,!0})({x:n,y:t},m,o);i?c(e):(Math.abs(n)>o||Math.abs(t)>o)&&(S.current=null)},onPointerUp:e=>{null==r.onPointerUp||r.onPointerUp.call(r,e),S.current=null,_.current=!1,l(e)},onPointerOut:e=>{null==r.onPointerOut||r.onPointerOut.call(r,e),M(C.current)},onContextMenu:e=>{null==r.onContextMenu||r.onContextMenu.call(r,e),C.current&&M(C.current)}})});Zb.displayName="Drawer.Content";const Kb=e.forwardRef(function({preventCycle:t=!1,children:n,...o},r){const{closeDrawer:i,isDragging:a,snapPoints:s,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:p,onDrag:h}=gb(),m=e.useRef(null),g=e.useRef(!1);function y(){m.current&&window.clearTimeout(m.current),g.current=!1}return e.createElement("div",{onClick:function(){g.current?y():window.setTimeout(()=>{!function(){if(a||t||g.current)return void y();if(y(),!s||0===s.length)return void(u||i());if(l===s[s.length-1]&&u)return void i();const e=s.findIndex(e=>e===l);if(-1===e)return;const n=s[e+1];c(n)}()},120)},onPointerCancel:y,onPointerDown:e=>{d&&p(e),m.current=window.setTimeout(()=>{g.current=!0},250)},onPointerMove:e=>{d&&h(e)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...o},e.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},n))});Kb.displayName="Drawer.Handle";const qb={Root:Yb,NestedRoot:function({onDrag:t,onOpenChange:n,open:o,...r}){const{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:s}=gb();if(!i)throw new Error("Drawer.NestedRoot must be placed in another drawer");return e.createElement(Yb,{nested:!0,open:o,onClose:()=>{a(!1)},onDrag:(e,n)=>{i(e,n),null==t||t(e,n)},onOpenChange:e=>{e&&a(e),null==n||n(e)},onRelease:s,...r})},Content:Zb,Overlay:Xb,Trigger:Mh,Portal:function(t){const n=gb(),{container:o=n.container,...r}=t;return e.createElement(Ph,{container:o,...r})},Handle:Kb,Close:Dh,Title:$h,Description:Ah},Ub=({shouldScaleBackground:e=!0,...t})=>i.createElement(qb.Root,{shouldScaleBackground:e,...t});Ub.displayName="Drawer";const Gb=qb.Portal,Qb=i.forwardRef(({className:e,...t},n)=>i.createElement(qb.Overlay,{ref:n,style:{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50,backgroundColor:"rgba(0, 0, 0, 0.8)"},className:e,...t}));Qb.displayName=qb.Overlay.displayName;const Jb=i.forwardRef(({className:e,children:t,...n},o)=>i.createElement(Gb,null,i.createElement(Qb,null),i.createElement(qb.Content,{ref:o,style:{position:"fixed",left:0,right:0,top:0,zIndex:50,marginTop:"96px",display:"flex",height:"auto",flexDirection:"column",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))"},className:e,...n},i.createElement("div",{style:{margin:"16px auto 0",height:"8px",width:"100px",borderRadius:"9999px",backgroundColor:"hsl(var(--muted))"}}),t)));Jb.displayName="DrawerContent";i.forwardRef(({className:e,...t},n)=>i.createElement(qb.Title,{ref:n,style:{fontSize:"18px",fontWeight:600,lineHeight:1,letterSpacing:"-0.025em"},className:e,...t})).displayName=qb.Title.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(qb.Description,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=qb.Description.displayName;const ex={div:(e,...t)=>Eu.div`
798
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=Ou(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
799
+ `,button:(e,...t)=>Eu.button`
800
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=Ou(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
801
+ `,span:(e,...t)=>Eu.span`
802
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=Ou(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
803
+ `,h3:(e,...t)=>Eu.h3`
804
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=Ou(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
805
+ `,textarea:(e,...t)=>Eu.textarea`
806
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=Ou(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
807
+ `};exports.AgenticFlowVisualizer=Vh,exports.AnthropicIcon=ld,exports.Badge=Tu,exports.Checkbox=hb,exports.Drawer=Ub,exports.Edge=mu,exports.FileSelector=({files:t,currentFile:n,onFileSelect:o,onRefresh:r,loading:i=!1,disabled:a=!1})=>e.createElement(Hv,null,0!==t.length||i?e.createElement(kv,{value:n||"",onValueChange:o,disabled:a||i},e.createElement(Wv,null,e.createElement(Iv,null,e.createElement(Sv,{placeholder:i?"Loading sessions...":0===t.length?"No sessions found":"Select an Agent Session..."}))),e.createElement(Bv,null,0!==t.length||i?t.map(t=>e.createElement(Fv,{key:t.name,value:t.name},t.name)):e.createElement(Yv,null,"No agent sessions available"))):e.createElement(Vv,null,"No agent sessions available"),t.length>0&&e.createElement(Xv,{onClick:e=>{e.stopPropagation(),r()},disabled:i||a,title:i?"Loading...":"Refresh files"},i?e.createElement(Zv,null):e.createElement(Kv,null))),exports.GlobalStyles=()=>null,exports.GoogleIcon=sd,exports.JsonTreeViewer=id,exports.Node=Ud,exports.OpenAIIcon=ad,exports.SafeThemeProvider=({children:t,theme:n,fallbackTheme:o=uu})=>{const r=Ou(n||o);return e.createElement(cu,{theme:r},t)},exports.Select=kv,exports.Sheet=Th,exports.ThemeProvider=({children:t,theme:n})=>{const[o,r]=e.useState(()=>{if(n)return n;return"dark"===localStorage.getItem("theme")?du:uu});e.useEffect(()=>{n&&r(n)},[n]),e.useEffect(()=>{if(n)return;const e=()=>{const e=localStorage.getItem("theme");r("dark"===e?du:uu)};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[n]);const i=e.useMemo(()=>({theme:o,setTheme:r,isDarkMode:o===du}),[o]);return e.createElement(pu.Provider,{value:i},e.createElement(cu,{theme:o},t))},exports.Timeline=cf,exports.Visualizer=t=>e.createElement(tl,null,e.createElement(Vh,t)),exports.calculateAutoLayout=Fh,exports.cn=function(...e){return function(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ku(e))&&(o&&(o+=" "),o+=t);return o}(e)},exports.conditionalStyle=function(e,t,n=""){return e?t:n},exports.createSafeTheme=Ou,exports.darkTheme=du,exports.defaultTheme=fu,exports.formatCurrency=Cu,exports.formatLatency=_u,exports.getColor=function(e,t){return e.colors[t]||e.colors.foreground},exports.getSafeColor=Mu,exports.getSafeSpacing=Pu,exports.getSafeThemeValue=function(e,t,n){if(!e)return console.warn(`Theme is undefined, using fallback for path: ${t}`),n;const o=t.split(".");let r=e;for(const e of o){if(void 0===r?.[e])return console.warn(`Theme property '${t}' not found, using fallback`),n;r=r[e]}return r},exports.getSpacing=function(e,t){return e.spacing[t]||e.spacing.md},exports.lightTheme=uu,exports.safeStyled=ex,exports.safeThemeColor=(e,t)=>n=>Mu(n.theme,e,t),exports.safeThemeSpacing=(e,t)=>n=>Pu(n.theme,e,t),exports.safeThemeValue=(e,t)=>n=>Mu(n.theme,e,t),exports.toTitleCase=Su,exports.truncateText=Nu,exports.useComponentTheme=e=>{const{theme:t}=hu();return e||t},exports.useSafeTheme=()=>uu,exports.useTheme=hu,exports.useThemeValue=()=>{const{theme:e}=hu();return e};