@railtownai/railtracks-visualizer 0.0.24 → 0.0.25

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,29 +1,30 @@
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))}");
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 R(e){return new Array(e.length)}function O(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 O(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 O(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(p[s])===l&&(r[s]=l)}function T(e){return e.__data__}function D(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))}}O.prototype={constructor:O,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,T);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=D(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(R),this._parents)},exit:function(){return new ke(this._exit||this._groups.map(R),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 Re(e){e.preventDefault(),e.stopImmediatePropagation()}function Oe(e){var t=e.document.documentElement,n=Ce(e).on("dragstart.drag",Re,Me);"onselectstart"in t?n.on("selectstart.drag",Re,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",Re,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 Te(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 De(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=De,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),Oe(a.view),Pe(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function m(o){if(Re(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),Re(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])&&(Re(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 Te("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 Te(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(){}Te.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,Rt=new RegExp(Pt.source,"g");function Ot(e,t){var n,o,r,i=Pt.lastIndex=Rt.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=Pt.exec(e))&&(o=Rt.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=Rt.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):Ot: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,Tt=180/Math.PI,Dt={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)*Tt,skewX:Math.atan(l)*Tt,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?Dt:zt(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),jt=It(function(e){return null==e?Dt:(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):Dt)},", ",")",")");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):Ot)(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 Rn=Se.prototype.constructor;function On(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 Tn(){return++$n}var Dn=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:Dn.selectChild,selectChildren:Dn.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 Rn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Tn(),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:Dn.call,nodes:Dn.nodes,node:Dn.node,size:Dn.size,empty:Dn.empty,each:Dn.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,On(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=On(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]:Dn[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=Tn(),(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;Oe(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 Ro({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 Oo({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 To(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 Do=(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)=>[Do(e.x,o,t.width-o)*n,Do(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 Rr(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 Or={nodeOrigin:[0,0],nodeExtent:fo,elevateNodesOnSelect:!0,defaults:{}},$r={...Or,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 Tr(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&&Dr(e,t,n,o)}return i}function Dr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=Ar(Or,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=To(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}=Ro({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),R=Xr(i,S),O=s?.getBoundingClientRect();let $=!1;if(!O||!R)return;const A=Yr(r,R,o,l,t);if(!A)return;let T=dr(e,O),D=!1,z=null,I=!1,L=null;function j(){if(!u||!O)return;const[e,t]=zo(T,O,E);f({x:e,y:t}),N=requestAnimationFrame(j)}const B={...A,nodeId:r,type:R,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:T,toHandle:null,toPosition:Eo[B.position],toNode:null};function V(){$=!0,b(H),h?.(e,{nodeId:r,handleId:o,handleType:R})}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();T=dr(e,O),_=Wr(Ko(T,i,!1,[1,1]),n,l,B),D||(j(),D=!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):T,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),D=!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:R,x:O,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 R=si(_,m,g),O=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])),R=Math.max(R,e),O=Math.max(O,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])),R=Math.max(R,e),O=Math.max(O,t)}if(r){if(u){const e=si(_/k,y,v)*k;if(R=Math.max(R,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,R=Math.max(R,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,R=Math.max(R,e)}}if(d){const e=si(N*k,m,g)/k;if(O=Math.max(O,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,O=Math.max(O,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,O=Math.max(O,e)}}}C+=C<0?O:-O,S+=S<0?R:-R,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,T=R!==_,D=O!==k&&A,z=$!==S&&T;if(!(D||z||A||T))return;if((D||z||1===M[0]||1===M[1])&&(N.x=D?O:p.x,N.y=z?$:p.y,p.x=N.x,p.y=N.y,w.length>0)){const e=O-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]*(R-_)},E.push(n)}if((A||T)&&(N.width=!A||l&&"horizontal"!==l?p.width:P,N.height=!T||l&&"vertical"!==l?p.height:R,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,Ri=e=>e;function Oi(e,t=Ri,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)=>Oi(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 Ti=e.createContext(null),Di=Ti.Provider,zi=Qn();function Ii(t,n){const o=e.useContext(Ti);if(null===o)throw new Error(zi);return Oi(o,t,n)}function Li(){const t=e.useContext(Ti);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 Oo({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 Ra={position:"absolute",width:"100%",height:"100%",top:0,left:0},Oa=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(Oa,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:Ra,children:g})}const Aa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ta(){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 Da=(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}))},R=f?e=>f(e):void 0,O=!0===i||Array.isArray(i)&&i.includes(0);return t.jsxs("div",{className:s(["react-flow__pane",{draggable:O,dragging:x,selection:n}]),onClick:E?void 0:Da(P,k),onContextMenu:Da(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():d?.(e)},k),onWheel:Da(R,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:Ra,children:[g,t.jsx(Ta,{})]})}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}=Ro({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 R=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)},O=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:R,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:O,onTouchStart:O,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&&R(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:R,preventScrolling:O,onSelectionContextMenu:$,noWheelClassName:A,noPanClassName:T,disableKeyboardA11y:D,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:R,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:A,noPanClassName:T,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:T,disableKeyboardA11y:D})]})})}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),R=!!(E.focusable||p&&void 0===E.focusable),O=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}),T=ja({nodeRef:A,disabled:E.hidden||!N,noDragClassName:m,handleSelector:E.dragHandle,nodeId:n,isSelectable:M,nodeClickDistance:x}),D=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:T}]),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}=O.getState();M&&(!t||!N||r>0)&&La({id:n,store:O,nodeRef:A}),o&&o(e,{...k.userNode})},onDoubleClick:V,onKeyDown:R?e=>{if(!cr(e.nativeEvent)&&!y)if(po.includes(e.key)&&M){const t="Escape"===e.key;La({id:n,store:O,unselect:t,nodeRef:A})}else if(N&&E.selected&&Object.prototype.hasOwnProperty.call(Xa,e.key)){e.preventDefault();const{ariaLabelConfig:t}=O.getState();O.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),D({direction:Xa[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:R?0:void 0,onFocus:R?()=>{if(y||!A.current?.matches(":focus-visible"))return;const{transform:e,width:t,height:o,autoPanOnNodeFocus:r,setCenter:i}=O.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??(R?"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:T,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:Ra,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=Rr(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 Rs={default:Ps,straight:_s,step:ks,smoothstep:xs,simplebezier:ys},Os={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,Ts="react-flow__edgeupdater";function Ds({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([Ts,`${Ts}-${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(Ds,{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(Ds,{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]||Rs[S];void 0===C&&(x?.("011",so(S)),S="default",C=v?.default||Rs.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),[R,O]=e.useState(!1),[$,A]=e.useState(!1),T=Li(),{zIndex:D,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,...Os};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||Os}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),Ai),H=e.useMemo(()=>E.markerStart?`url('#${Rr(E.markerStart,y)}')`:void 0,[E.markerStart,y]),V=e.useMemo(()=>E.markerEnd?`url('#${Rr(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:D},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:R,selectable:M}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=T.getState();M&&(T.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}=T.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:O,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:R,minZoom:O,maxZoom:$,preventScrolling:A,defaultMarkerColor:T,zoomOnScroll:D,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:D,zoomOnPinch:z,zoomOnDoubleClick:B,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:j,panOnDrag:F,defaultViewport:P,translateExtent:R,minZoom:O,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:T,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=Tr(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=Tr(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=To(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&&Dr(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(Or,n);for(const n of e.values())if(n.parentId)Dr(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]||(Tr(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(Di,{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(Ti)?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:R,onDelete:O,onSelectionChange:$,onSelectionDragStart:A,onSelectionDrag:T,onSelectionDragStop:D,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:Re=0,nodeClickDistance:Oe=0,children:$e,onReconnect:Ae,onReconnectStart:Te,onReconnectEnd:De,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:Re,nodeClickDistance:Oe,onSelectionContextMenu:z,onSelectionStart:I,onSelectionEnd:L,onReconnect:Ae,onReconnectStart:Te,onReconnectEnd:De,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:R,onDelete:O,onNodeDragStart:_,onNodeDrag:N,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:A,onSelectionDragStop:D,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:Re,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,...Ra,"--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:R,flowWidth:O,flowHeight:$,ariaLabelConfig:A}=Ii(_l,Ai),T=n?.width??200,D=n?.height??150,z=_.width/T,I=_.height/D,L=Math.max(z,I),j=L*T,B=L*D,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:R,width:O,height:$,inversePan:w,pannable:v,zoomStep:E,zoomable:b})},[v,b,w,E,R,O,$]);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:T,height:D,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 R=P.split("-");return t.jsx("div",{className:s(["react-flow__resize-control","nodrag",...R,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 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};
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)},Rl=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ol=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 $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=e=>{if("string"==typeof e.content)return"string";if(Array.isArray(e.content)&&e.content.length>0){const t=e.content[0];if(t&&"object"==typeof t&&t.identifier&&t.name&&t.arguments)return"toolCallList"}return"other"},$u=e=>e.map(e=>{const t=Object.entries(e.arguments).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(", ");return`${e.name}(${t})`}).join("\n"),Au=Eu.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:Rl("lucide",i),...!a&&!Ol(l)&&{"aria-hidden":"true"},...l},[...s.map(([t,n])=>e.createElement(t,n)),...Array.isArray(a)?a:[a]])),Tl=(t,n)=>{const o=e.forwardRef(({className:o,...r},i)=>{return e.createElement(Al,{ref:i,iconNode:n,className:Rl(`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},Dl=Tl("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),zl=Tl("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Il=Tl("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Ll=Tl("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),jl=Tl("cloud-lightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]),Bl=Tl("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Fl=Tl("message-square",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),Hl=Tl("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Vl=Tl("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"}]]),Wl=Tl("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Yl=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}(),Xl="-ms-",Zl="-moz-",Kl="-webkit-",ql="comm",Ul="rule",Gl="decl",Ql="@keyframes",Jl=Math.abs,ec=String.fromCharCode,tc=Object.assign;function nc(e){return e.trim()}function oc(e,t,n){return e.replace(t,n)}function rc(e,t){return e.indexOf(t)}function ic(e,t){return 0|e.charCodeAt(t)}function ac(e,t,n){return e.slice(t,n)}function sc(e){return e.length}function lc(e){return e.length}function cc(e,t){return t.push(e),e}var uc=1,dc=1,fc=0,pc=0,hc=0,mc="";function gc(e,t,n,o,r,i,a){return{value:e,root:t,parent:n,type:o,props:r,children:i,line:uc,column:dc,length:a,return:""}}function yc(e,t){return tc(gc("",null,null,"",null,null,0),e,{length:-e.length},t)}function vc(){return hc=pc>0?ic(mc,--pc):0,dc--,10===hc&&(dc=1,uc--),hc}function bc(){return hc=pc<fc?ic(mc,pc++):0,dc++,10===hc&&(dc=1,uc++),hc}function xc(){return ic(mc,pc)}function wc(){return pc}function Ec(e,t){return ac(mc,e,t)}function kc(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 Sc(e){return uc=dc=1,fc=sc(mc=e),pc=0,[]}function Cc(e){return mc="",e}function _c(e){return nc(Ec(pc-1,Pc(91===e?e+2:40===e?e+1:e)))}function Nc(e){for(;(hc=xc())&&hc<33;)bc();return kc(e)>2||kc(hc)>3?"":" "}function Mc(e,t){for(;--t&&bc()&&!(hc<48||hc>102||hc>57&&hc<65||hc>70&&hc<97););return Ec(e,wc()+(t<6&&32==xc()&&32==bc()))}function Pc(e){for(;bc();)switch(hc){case e:return pc;case 34:case 39:34!==e&&39!==e&&Pc(hc);break;case 40:41===e&&Pc(e);break;case 92:bc()}return pc}function Rc(e,t){for(;bc()&&e+hc!==57&&(e+hc!==84||47!==xc()););return"/*"+Ec(t,pc-1)+"*"+ec(47===e?e:bc())}function Oc(e){for(;!kc(xc());)bc();return Ec(e,pc)}function $c(e){return Cc(Ac("",null,null,null,[""],e=Sc(e),0,[0],e))}function Ac(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=bc()){case 40:if(108!=h&&58==ic(k,d-1)){-1!=rc(k+=oc(_c(v),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:k+=_c(v);break;case 9:case 10:case 13:case 32:k+=Nc(h);break;case 92:k+=Mc(wc()-1,7);continue;case 47:switch(xc()){case 42:case 47:cc(Dc(Rc(bc(),wc()),t,n),l);break;default:k+="/"}break;case 123*m:s[c++]=sc(k)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:-1==y&&(k=oc(k,/\f/g,"")),p>0&&sc(k)-d&&cc(p>32?zc(k+";",o,n,d-1):zc(oc(k," ","")+";",o,n,d-2),l);break;case 59:k+=";";default:if(cc(E=Tc(k,t,n,c,u,r,s,b,x=[],w=[],d),i),123===v)if(0===u)Ac(k,t,E,E,x,i,d,s,w);else switch(99===f&&110===ic(k,3)?100:f){case 100:case 108:case 109:case 115:Ac(e,E,E,o&&cc(Tc(e,E,E,0,0,r,s,b,r,x=[],d),w),r,w,d,s,o?x:w);break;default:Ac(k,E,E,E,[""],w,0,s,w)}}c=u=p=0,m=y=1,b=k="",d=a;break;case 58:d=1+sc(k),p=h;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==vc())continue;switch(k+=ec(v),v*m){case 38:y=u>0?1:(k+="\f",-1);break;case 44:s[c++]=(sc(k)-1)*y,y=1;break;case 64:45===xc()&&(k+=_c(bc())),f=xc(),u=d=sc(b=k+=Oc(wc())),v++;break;case 45:45===h&&2==sc(k)&&(m=0)}}return i}function Tc(e,t,n,o,r,i,a,s,l,c,u){for(var d=r-1,f=0===r?i:[""],p=lc(f),h=0,m=0,g=0;h<o;++h)for(var y=0,v=ac(e,d+1,d=Jl(m=a[h])),b=e;y<p;++y)(b=nc(m>0?f[y]+" "+v:oc(v,/&\f/g,f[y])))&&(l[g++]=b);return gc(e,t,n,0===r?Ul:s,l,c,u)}function Dc(e,t,n){return gc(e,t,n,ql,ec(hc),ac(e,2,-2),0)}function zc(e,t,n,o){return gc(e,t,n,Gl,ac(e,0,o),ac(e,o+1,-1),o)}function Ic(e,t){for(var n="",o=lc(e),r=0;r<o;r++)n+=t(e[r],r,e,t)||"";return n}function Lc(e,t,n,o){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case Gl:return e.return=e.return||e.value;case ql:return"";case Ql:return e.return=e.value+"{"+Ic(e.children,o)+"}";case Ul:e.value=e.props.join(",")}return sc(n=Ic(e.children,o))?e.return=e.value+"{"+n+"}":""}var jc=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 Bc(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var Fc=function(e,t,n){for(var o=0,r=0;o=r,r=xc(),38===o&&12===r&&(t[n]=1),!kc(r);)bc();return Ec(e,pc)},Hc=function(e,t){return Cc(function(e,t){var n=-1,o=44;do{switch(kc(o)){case 0:38===o&&12===xc()&&(t[n]=1),e[n]+=Fc(pc-1,t,n);break;case 2:e[n]+=_c(o);break;case 4:if(44===o){e[++n]=58===xc()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=ec(o)}}while(o=bc());return e}(Sc(e),t))},Vc=new WeakMap,Wc=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)||Vc.get(n))&&!o){Vc.set(e,!0);for(var r=[],i=Hc(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]}}},Yc=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Xc(e,t){switch(function(e,t){return 45^ic(e,0)?(((t<<2^ic(e,0))<<2^ic(e,1))<<2^ic(e,2))<<2^ic(e,3):0}(e,t)){case 5103:return Kl+"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 Kl+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Kl+e+Zl+e+Xl+e+e;case 6828:case 4268:return Kl+e+Xl+e+e;case 6165:return Kl+e+Xl+"flex-"+e+e;case 5187:return Kl+e+oc(e,/(\w+).+(:[^]+)/,Kl+"box-$1$2"+Xl+"flex-$1$2")+e;case 5443:return Kl+e+Xl+"flex-item-"+oc(e,/flex-|-self/,"")+e;case 4675:return Kl+e+Xl+"flex-line-pack"+oc(e,/align-content|flex-|-self/,"")+e;case 5548:return Kl+e+Xl+oc(e,"shrink","negative")+e;case 5292:return Kl+e+Xl+oc(e,"basis","preferred-size")+e;case 6060:return Kl+"box-"+oc(e,"-grow","")+Kl+e+Xl+oc(e,"grow","positive")+e;case 4554:return Kl+oc(e,/([^-])(transform)/g,"$1"+Kl+"$2")+e;case 6187:return oc(oc(oc(e,/(zoom-|grab)/,Kl+"$1"),/(image-set)/,Kl+"$1"),e,"")+e;case 5495:case 3959:return oc(e,/(image-set\([^]*)/,Kl+"$1$`$1");case 4968:return oc(oc(e,/(.+:)(flex-)?(.*)/,Kl+"box-pack:$3"+Xl+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Kl+e+e;case 4095:case 3583:case 4068:case 2532:return oc(e,/(.+)-inline(.+)/,Kl+"$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(sc(e)-1-t>6)switch(ic(e,t+1)){case 109:if(45!==ic(e,t+4))break;case 102:return oc(e,/(.+:)(.+)-([^]+)/,"$1"+Kl+"$2-$3$1"+Zl+(108==ic(e,t+3)?"$3":"$2-$3"))+e;case 115:return~rc(e,"stretch")?Xc(oc(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==ic(e,t+1))break;case 6444:switch(ic(e,sc(e)-3-(~rc(e,"!important")&&10))){case 107:return oc(e,":",":"+Kl)+e;case 101:return oc(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Kl+(45===ic(e,14)?"inline-":"")+"box$3$1"+Kl+"$2$3$1"+Xl+"$2box$3")+e}break;case 5936:switch(ic(e,t+11)){case 114:return Kl+e+Xl+oc(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Kl+e+Xl+oc(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Kl+e+Xl+oc(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Kl+e+Xl+e+e}return e}var Zc=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case Gl:e.return=Xc(e.value,e.length);break;case Ql:return Ic([yc(e,{value:oc(e.value,"@","@"+Kl)})],o);case Ul: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 Ic([yc(e,{props:[oc(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return Ic([yc(e,{props:[oc(t,/:(plac\w+)/,":"+Kl+"input-$1")]}),yc(e,{props:[oc(t,/:(plac\w+)/,":-moz-$1")]}),yc(e,{props:[oc(t,/:(plac\w+)/,Xl+"input-$1")]})],o)}return""})}}],Kc=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||Zc,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=[Lc,(c=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&c(e)})],d=function(e){var t=lc(e);return function(n,o,r,i){for(var a="",s=0;s<t;s++)a+=e[s](n,o,r,i)||"";return a}}([Wc,Yc].concat(i,u));r=function(e,t,n,o){l=n,Ic($c(e?e+"{"+t.styles+"}":t.styles),d),o&&(f.inserted[t.name]=!0)};var f={key:t,sheet:new Yl({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 qc(){return qc=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},qc.apply(null,arguments)}var Uc=function(e,t,n){var o=e.key+"-"+t.name;!1===n&&void 0===e.registered[o]&&(e.registered[o]=t.styles)};var Gc={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},Qc=/[A-Z]|^ms/g,Jc=/_EMO_([^_]+?)_([^]*?)_EMO_/g,eu=function(e){return 45===e.charCodeAt(1)},tu=function(e){return null!=e&&"boolean"!=typeof e},nu=Bc(function(e){return eu(e)?e:e.replace(Qc,"-$&").toLowerCase()}),ou=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Jc,function(e,t,n){return iu={name:t,styles:n,next:iu},t})}return 1===Gc[e]||eu(e)||"number"!=typeof t||0===t?t:t+"px"};function ru(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 iu={name:r.name,styles:r.styles,next:iu},r.name;var i=n;if(void 0!==i.styles){var a=i.next;if(void 0!==a)for(;void 0!==a;)iu={name:a.name,styles:a.styles,next:iu},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+=ru(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]+"}":tu(s)&&(o+=nu(i)+":"+ou(i,s)+";")}else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var l=ru(e,t,a);switch(i){case"animation":case"animationName":o+=nu(i)+":"+l+";";break;default:o+=i+"{"+l+"}"}}else for(var c=0;c<a.length;c++)tu(a[c])&&(o+=nu(i)+":"+ou(i,a[c])+";")}return o}(e,t,n);case"function":if(void 0!==e){var s=iu,l=n(e);return iu=s,ru(e,t,l)}}var c=n;if(null==t)return c;var u=t[c];return void 0!==u?u:c}var iu,au=/label:\s*([^\s;{]+)\s*(;|$)/g;var su=!!i.useInsertionEffect&&i.useInsertionEffect||function(e){return e()},lu=i.createContext("undefined"!=typeof HTMLElement?Kc({key:"css"}):null);lu.Provider;var cu=i.createContext({}),uu=jc(function(e){return jc(function(t){return function(e,t){return"function"==typeof t?t(e):qc({},e,t)}(e,t)})}),du=function(e){var t=i.useContext(cu);return e.theme!==t&&(t=uu(t)(e.theme)),i.createElement(cu.Provider,{value:t},e.children)};const fu={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%)",success:"hsl(142.1 76.2% 36.3%)",successForeground:"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"}},pu={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%)",success:"hsl(142.1 76.2% 36.3%)",successForeground:"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:fu.spacing,borderRadius:fu.borderRadius,fontSize:fu.fontSize,fontWeight:fu.fontWeight,shadows:fu.shadows,transitions:fu.transitions},hu=fu,mu=e.createContext(void 0),gu=()=>{const t=e.useContext(mu);return void 0===t?{theme:fu,setTheme:()=>{console.warn("Theme context not available. setTheme called but ignored.")},isDarkMode:!1}:t},yu=({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}=gu(),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 vu=/^((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)-.*))$/,bu=Bc(function(e){return vu.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),xu=function(e){return"theme"!==e},wu=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?bu:xu},Eu=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},ku=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return Uc(t,n,o),su(function(){return function(e,t,n){Uc(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},Su=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=Eu(n,o,s),u=c||wu(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(cu)}"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="";iu=void 0;var i=e[0];null==i||void 0===i.raw?(o=!1,r+=ru(n,t,i)):r+=i[0];for(var a=1;a<e.length;a++)r+=ru(n,t,e[a]),o&&(r+=i[a]);au.lastIndex=0;for(var s,l="";null!==(s=au.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:iu}}(p.concat(g),t.registered,y);m+=t.key+"-"+b.name,void 0!==a&&(m+=" "+a);var x=d&&void 0===c?wu(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(ku,{cache:t,serialized:b,isStringTag:"string"==typeof h}),i.createElement(h,w))},e.forwardRef(function(t,n){var o=e.useContext(lu);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,qc({},o,n,{shouldForwardProp:Eu(v,n,!0)})).apply(void 0,p)},v}}.bind(null);function Cu(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=Cu(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function _u(e){return e.split(/[-_\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}function Nu(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 Mu(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 Pu(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}function Ru(e,t,n="#000000"){return e?.colors?.[t]?e.colors[t]:(console.warn(`Theme color '${t}' not found, using fallback: ${n}`),n)}function Ou(e,t,n="1rem"){return e?.spacing?.[t]?e.spacing[t]:(console.warn(`Theme spacing '${t}' not found, using fallback: ${n}`),n)}function $u(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){Su[e]=Su(e)});const Au=e=>{const{content:t}=e;if("string"==typeof t)return"string";if(!t||"object"!=typeof t)return"other";if(Array.isArray(t)&&t.length>0){const e=t[0];if(e?.identifier&&e?.name&&e?.arguments)return"toolCallList"}return t.identifier&&t.name&&void 0!==t.result?"toolResponse":"other"},Tu=e=>e.map(e=>{const t=Object.entries(e.arguments).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(", ");return`${e.name}(${t})`}).join("\n"),Du=Su.div`
16
16
  position: relative;
17
17
  display: inline-block;
18
- `,Du=Eu.div`
18
+ `,zu=Su.div`
19
19
  position: absolute;
20
20
  z-index: 1000;
21
21
  padding: 8px 12px;
22
+ font-weight: 400;
22
23
  background-color: ${({themeColors:e})=>e.popover};
23
24
  color: ${({themeColors:e})=>e.popoverForeground};
24
25
  border: 1px solid ${({themeColors:e})=>e.border};
25
26
  border-radius: 6px;
26
- font-size: 14px;
27
+ font-size: 12px;
27
28
  line-height: 1.4;
28
29
  white-space: nowrap;
29
30
  box-shadow:
@@ -47,7 +48,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
47
48
 
48
49
  /* Placement-specific positioning and arrow */
49
50
  ${({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
- `,Tu=({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(Au,{onMouseEnter:c,onMouseLeave:u,onFocus:c,onBlur:u},e,i.createElement(Du,{isVisible:a,placement:n,themeColors:r.colors,role:"tooltip"},t))},zu=Eu.div`
51
+ `,Iu=({children:e,content:t,placement:n="top",delay:o=300})=>{const{theme:r}=gu(),[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(Du,{onMouseEnter:c,onMouseLeave:u,onFocus:c,onBlur:u},e,i.createElement(zu,{isVisible:a,placement:n,themeColors:r.colors,role:"tooltip"},t))},Lu=Su.div`
51
52
  display: inline-flex;
52
53
  align-items: center;
53
54
  border-radius: 9999px;
@@ -64,11 +65,11 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
64
65
  }
65
66
 
66
67
  ${({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
- `,Iu=({variant:e="default",children:t,title:n,placement:o="top"})=>{const{theme:r}=hu(),a=r.colors,s=i.createElement(zu,{variant:e,themeColors:a},t);return n?i.createElement(Tu,{content:n,placement:o},s):s},Lu=({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"})),ju=({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"})),Bu=({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"})),Fu=1.2,Hu=({isVisible:t,onClose:r,nodeData:i,triggerRef:a})=>{const[s,l]=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,c="right";a+o>t&&(a=e.left-o-i,c="left"),s<0?s=20:s+r>n&&(s=n-r-20),l({top:s,left:a,arrowPosition:c})}else{const e=Math.max(20,(t-o)/2),i=Math.max(20,(n-r)/2);l({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 c=Dd(i.details?.internals?.llm_details||[]),u=Td(i.details?.internals?.llm_details||[]),d=zd(i.details?.internals?.llm_details||[]),f=Id(i.details?.internals?.llm_details||[]),p=e.createElement(Vu,{style:{top:s.top,left:s.left}},e.createElement(Wu,{"data-popover-content":!0,$arrowPosition:s.arrowPosition},e.createElement(Yu,null,e.createElement(Xu,null,e.createElement(nd,null,((t,n)=>{if("tool"===t)return"🔧";if("coordinator"===t)return"🎯";if("agent"===t){if("OpenAI"===n)return e.createElement(Lu,null);if("Anthropic"===n)return e.createElement(Bu,null);if("Google"===n||"Vertex_AI"===n)return e.createElement(ju,null)}return"🤖"})(i.nodeType||"Agent",c?.model_provider)),e.createElement("span",null,i.label||"Agent Node")),e.createElement(Zu,null,e.createElement(Ku,{onClick:r},e.createElement(Hl,{size:16})))),e.createElement(qu,null,e.createElement(Uu,null,e.createElement(Qu,null,e.createElement(Ju,null,e.createElement(ed,null,"Type:"),e.createElement(td,null,i.nodeType)),e.createElement(Ju,null,e.createElement(ed,null,"ID:"),e.createElement(td,null,i.id||"N/A")))),c&&e.createElement(Uu,null,e.createElement(Gu,null,"🤖 LLM Details"),e.createElement(Qu,null,e.createElement(Ju,null,e.createElement(ed,null,"Model:"),e.createElement(td,null,c.model_name)),e.createElement(Ju,null,e.createElement(ed,null,"Provider:"),e.createElement(td,null,c.model_provider)),e.createElement(Ju,null,e.createElement(ed,null,"Input Tokens:"),e.createElement(td,null,d?e.createElement(o,{end:d,duration:Fu,separator:",",useEasing:!0}):"N/A")),e.createElement(Ju,null,e.createElement(ed,null,"Output Tokens:"),e.createElement(td,null,f?e.createElement(o,{end:f,duration:Fu,separator:",",useEasing:!0}):"N/A")),e.createElement(Ju,null,e.createElement(ed,null,"Total Cost:"),e.createElement(td,null,"~",Cu(u))),c.system_fingerprint&&e.createElement(Ju,null,e.createElement(ed,null,"System Fingerprint:"),e.createElement(td,null,c.system_fingerprint)))),i.details?.internals?.llm_details.length>0&&e.createElement(Uu,null,e.createElement("table",null,e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"#"),e.createElement("th",{style:{textAlign:"right"}},"Input Tokens"),e.createElement("th",{style:{textAlign:"right"}},"Output Tokens"),e.createElement("th",{style:{textAlign:"right"}},"Total Cost"),e.createElement("th",{style:{textAlign:"right"}},"Latency"))),e.createElement("tbody",null,i.details?.internals?.llm_details.map((t,n)=>e.createElement("tr",null,e.createElement("td",null,n+1),e.createElement("td",{style:{textAlign:"right"}},t.input_tokens?e.createElement(o,{end:t.input_tokens,duration:Fu,separator:",",useEasing:!0}):"N/A"),e.createElement("td",{style:{textAlign:"right"}},t.output_tokens?e.createElement(o,{end:t.output_tokens,duration:Fu,separator:",",useEasing:!0}):"N/A"),e.createElement("td",{style:{textAlign:"right"}},t.total_cost?Cu(t.total_cost):"N/A"),e.createElement("td",{style:{textAlign:"right"}},"0ms")))))))));return n.createPortal(p,document.body)},Vu=Eu.div`
68
+ `,ju=({variant:e="default",children:t,title:n,placement:o="top"})=>{const{theme:r}=gu(),a=r.colors,s=i.createElement(Lu,{variant:e,themeColors:a},t);return n?i.createElement(Iu,{content:n,placement:o},s):s},Bu=({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"})),Fu=({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"})),Hu=({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"})),Vu=1.2,Wu=({isVisible:t,onClose:r,nodeData:i,triggerRef:a})=>{const[s,l]=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,c="right";a+o>t&&(a=e.left-o-i,c="left"),s<0?s=20:s+r>n&&(s=n-r-20),l({top:s,left:a,arrowPosition:c})}else{const e=Math.max(20,(t-o)/2),i=Math.max(20,(n-r)/2);l({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 c=rf(i.details?.internals?.llm_details||[]),u=af(i.details?.internals?.llm_details||[]),d=sf(i.details?.internals?.llm_details||[]),f=lf(i.details?.internals?.llm_details||[]),p=cf(i.details?.internals?.llm_details||[]),h=e.createElement(Yu,{style:{top:s.top,left:s.left}},e.createElement(Xu,{"data-popover-content":!0,$arrowPosition:s.arrowPosition},e.createElement(Zu,null,e.createElement(Ku,null,e.createElement(od,null,((t,n)=>{if("tool"===t)return"🔧";if("coordinator"===t)return"🎯";if("agent"===t){if("OpenAI"===n)return e.createElement(Bu,null);if("Anthropic"===n)return e.createElement(Hu,null);if("Google"===n||"Vertex_AI"===n)return e.createElement(Fu,null)}return"🤖"})(i.nodeType||"Agent",c?.model_provider)),e.createElement("span",null,i.label||"Agent Node")),e.createElement(qu,null,e.createElement(Uu,{onClick:r},e.createElement(Wl,{size:16})))),e.createElement(Gu,null,c&&e.createElement(Qu,null,e.createElement(Ju,null,e.createElement(ed,null,e.createElement(td,null,"Model"),e.createElement(nd,null,c.model_name)),e.createElement(ed,null,e.createElement(td,null,"Provider"),e.createElement(nd,null,c.model_provider)),e.createElement(ed,null,e.createElement(td,null,"Input Tokens"),e.createElement(nd,null,d?e.createElement(o,{end:d,duration:Vu,separator:",",useEasing:!0}):"N/A")),e.createElement(ed,null,e.createElement(td,null,"Output Tokens"),e.createElement(nd,null,f?e.createElement(o,{end:f,duration:Vu,separator:",",useEasing:!0}):"N/A")),e.createElement(ed,null,e.createElement(td,null,"Total Cost"),e.createElement(nd,null,"~",Nu(u))),c.system_fingerprint&&e.createElement(ed,null,e.createElement(td,null,"System Fingerprint"),e.createElement(nd,null,c.system_fingerprint)),p>0&&e.createElement(ed,null,e.createElement(td,null,"Total Latency"),e.createElement(nd,null,Mu(p))))),i.details?.internals?.llm_details.length>0&&e.createElement(Qu,null,e.createElement("table",null,e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"#"),e.createElement("th",{style:{textAlign:"right"}},"Input Tokens"),e.createElement("th",{style:{textAlign:"right"}},"Output Tokens"),e.createElement("th",{style:{textAlign:"right"}},"Total Cost"),e.createElement("th",{style:{textAlign:"right"}},"Latency"))),e.createElement("tbody",null,i.details?.internals?.llm_details.map((t,n)=>e.createElement("tr",null,e.createElement("td",null,n+1),e.createElement("td",{style:{textAlign:"right"}},t.input_tokens?e.createElement(o,{end:t.input_tokens,duration:Vu,separator:",",useEasing:!0}):"N/A"),e.createElement("td",{style:{textAlign:"right"}},t.output_tokens?e.createElement(o,{end:t.output_tokens,duration:Vu,separator:",",useEasing:!0}):"N/A"),e.createElement("td",{style:{textAlign:"right"}},t.total_cost?Nu(t.total_cost):"N/A"),e.createElement("td",{style:{textAlign:"right"}},t.latency?Mu(t.latency):"N/A")))))))));return n.createPortal(h,document.body)},Yu=Su.div`
68
69
  position: fixed;
69
70
  z-index: 99999;
70
71
  pointer-events: none;
71
- `,Wu=Eu.div`
72
+ `,Xu=Su.div`
72
73
  width: 400px;
73
74
  max-height: 600px;
74
75
  background-color: ${e=>e.theme?.colors?.background||"hsl(0 0% 100%)"};
@@ -120,7 +121,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
120
121
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
121
122
  padding-bottom: 0.5rem;
122
123
  }
123
- `,Yu=Eu.div`
124
+ `,Zu=Su.div`
124
125
  display: flex;
125
126
  justify-content: space-between;
126
127
  align-items: center;
@@ -129,19 +130,19 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
129
130
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
130
131
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
131
132
  border-radius: 0.5rem 0.5rem 0 0;
132
- `,Xu=Eu.div`
133
+ `,Ku=Su.div`
133
134
  display: flex;
134
135
  align-items: center;
135
136
  gap: 0.5rem;
136
137
  font-weight: 600;
137
138
  font-size: 0.875rem;
138
139
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
139
- `,Zu=Eu.div`
140
+ `,qu=Su.div`
140
141
  display: flex;
141
142
  align-items: center;
142
143
  gap: 0.5rem;
143
144
  justify-content: flex-start;
144
- `,Ku=Eu.button`
145
+ `,Uu=Su.button`
145
146
  display: flex;
146
147
  align-items: center;
147
148
  justify-content: center;
@@ -163,71 +164,42 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
163
164
  outline: 2px solid ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
164
165
  outline-offset: 2px;
165
166
  }
166
- `;Eu.button`
167
- display: flex;
168
- align-items: center;
169
- justify-content: center;
170
- width: 24px;
171
- height: 24px;
172
- border: none;
173
- border-radius: 0.25rem;
174
- background-color: transparent;
175
- color: ${e=>e.theme?.colors?.foreground||"hsl(215.4 16.3% 46.9%)"};
176
- cursor: pointer;
177
- transition: all 0.2s ease-in-out;
178
-
179
- &:hover {
180
- background-color: ${e=>e.theme?.colors?.muted||"hsl(210 40% 96%)"};
181
- color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
182
- }
183
-
184
- &:focus {
185
- outline: 2px solid ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
186
- outline-offset: 2px;
187
- }
188
- `;const qu=Eu.div`
167
+ `,Gu=Su.div`
189
168
  max-height: 500px;
190
169
  overflow-y: auto;
191
170
  padding: 1rem;
192
171
  display: flex;
193
172
  flex-direction: column;
194
173
  gap: 1rem;
195
- `,Uu=Eu.div`
174
+ `,Qu=Su.div`
196
175
  display: flex;
197
176
  flex-direction: column;
198
177
  gap: 0.75rem;
199
- `,Gu=Eu.h3`
200
- font-size: 1rem;
201
- font-weight: 600;
202
- color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
203
- margin: 0;
204
- padding-bottom: 0.5rem;
205
- border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
206
- `,Qu=Eu.div`
178
+ `,Ju=Su.div`
207
179
  display: grid;
208
180
  grid-template-columns: 1fr 1fr;
209
181
  gap: 0.75rem;
210
- `,Ju=Eu.div`
182
+ `,ed=Su.div`
211
183
  display: flex;
212
184
  flex-direction: column;
213
185
  gap: 0.25rem;
214
- `,ed=Eu.span`
186
+ `,td=Su.span`
215
187
  font-size: 0.875rem;
216
188
  font-weight: 500;
217
189
  color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
218
- `,td=Eu.span`
190
+ `,nd=Su.span`
219
191
  font-size: 0.875rem;
220
192
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
221
193
  word-break: break-word;
222
- `,nd=Eu.div`
194
+ `,od=Su.div`
223
195
  font-size: 1.25rem;
224
196
  display: flex;
225
197
  align-items: center;
226
198
  justify-content: center;
227
199
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
228
- `,od=({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(rd,null,e.createElement(id,{onClick:e=>{e.stopPropagation(),r(e)},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=a.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},e.createElement(ad,{style:{color:a.mutedForeground}},t),e.createElement(ld,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(sd,{onClick:e=>{e.stopPropagation()},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}}))},rd=Eu.div`
200
+ `,rd=({label:t,content:n,isExpanded:o,onToggle:r})=>{const{theme:i}=gu(),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(id,null,e.createElement(ad,{onClick:e=>{e.stopPropagation(),r(e)},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=a.muted},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},e.createElement(sd,null,t),e.createElement(cd,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(ld,{onClick:e=>{e.stopPropagation()},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}}))},id=Su.div`
229
201
  width: 100%;
230
- `,id=Eu.div`
202
+ `,ad=Su.div`
231
203
  display: flex;
232
204
  justify-content: space-between;
233
205
  align-items: center;
@@ -241,10 +213,11 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
241
213
  &:hover {
242
214
  background-color: transparent;
243
215
  }
244
- `,ad=Eu.span`
245
- font-weight: 600;
216
+ `,sd=Su.span`
246
217
  font-size: 0.75rem;
247
- `,sd=Eu.textarea`
218
+ font-weight: 500;
219
+ color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
220
+ `,ld=Su.textarea`
248
221
  box-sizing: border-box;
249
222
  width: 100%;
250
223
  border-radius: 0.25rem;
@@ -260,33 +233,36 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
260
233
  }
261
234
 
262
235
  transition: all 0.2s ease-in-out;
263
- `,ld=Eu.div`
236
+ `,cd=Su.div`
264
237
  transition: transform 0.2s ease-in-out;
265
- `,cd=({content:t,language:n="text"})=>{const{theme:o}=hu(),r=o?.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%)",background:"hsl(0 0% 100%)"};return e.createElement(ud,{style:{width:"100%",border:`1px solid ${r.border}`,backgroundColor:r.muted,color:r.foreground}},e.createElement(dd,{style:{borderBottom:`1px solid ${r.border}`,backgroundColor:r.background}},e.createElement(fd,{style:{color:r.mutedForeground}},n)),e.createElement(pd,{style:{color:r.foreground}},t))},ud=Eu.div`
238
+ `,ud=({content:t,language:n="text",showHeader:o=!1})=>{const{theme:r}=gu(),i=r?.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%)",background:"hsl(0 0% 100%)"};return e.createElement(dd,{style:{width:"100%",border:`1px solid ${i.border}`,backgroundColor:i.muted,color:i.foreground}},o&&e.createElement(fd,{style:{borderBottom:`1px solid ${i.border}`,backgroundColor:i.background}},e.createElement(pd,{style:{color:i.mutedForeground}},n)),e.createElement(hd,{style:{color:i.foreground}},t))},dd=Su.div`
239
+ box-sizing: border-box;
266
240
  border-radius: 0.375rem;
267
241
  overflow: hidden;
268
242
  font-family: monospace;
269
243
  font-size: 0.75rem;
270
244
  line-height: 1.4;
271
- `,dd=Eu.div`
245
+ max-height: 150px;
246
+ overflow-y: auto;
247
+ `,fd=Su.div`
272
248
  padding: 0.5rem 0.75rem;
273
249
  display: flex;
274
250
  justify-content: space-between;
275
251
  align-items: center;
276
- `,fd=Eu.span`
252
+ `,pd=Su.span`
277
253
  font-size: 0.625rem;
278
254
  font-weight: 500;
279
255
  text-transform: uppercase;
280
256
  letter-spacing: 0.05em;
281
- `,pd=Eu.pre`
257
+ `,hd=Su.pre`
282
258
  margin: 0;
283
259
  padding: 0.75rem;
284
260
  white-space: pre-wrap;
285
261
  word-break: break-word;
286
262
  overflow-x: auto;
287
- `,hd=Eu.div`
263
+ `,md=Su.div`
288
264
  user-select: none;
289
- `,md=Eu.div`
265
+ `,gd=Su.div`
290
266
  display: flex;
291
267
  align-items: center;
292
268
  gap: 0.25rem;
@@ -298,7 +274,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
298
274
  &:hover {
299
275
  background-color: ${e=>e.isExpandable?e.themeColors.muted:"transparent"};
300
276
  }
301
- `,gd=Eu.div`
277
+ `,yd=Su.div`
302
278
  width: 0.5rem;
303
279
  height: 0.5rem;
304
280
  flex-shrink: 0;
@@ -306,31 +282,31 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
306
282
  align-items: center;
307
283
  justify-content: center;
308
284
  color: ${e=>e.themeColors.mutedForeground};
309
- `,yd=Eu.span`
285
+ `,vd=Su.span`
310
286
  font-weight: 500;
311
287
  color: ${e=>e.themeColors.foreground};
312
288
  font-size: 0.75rem;
313
- `,vd=Eu.span`
289
+ `,bd=Su.span`
314
290
  font-size: 0.75rem;
315
291
  color: ${e=>e.themeColors.primary};
316
- `,bd=Eu.span`
292
+ `,xd=Su.span`
317
293
  font-size: 0.75rem;
318
294
  color: ${e=>e.themeColors.mutedForeground};
319
- `,xd=Eu.div`
320
- border-left: 1px solid ${e=>e.themeColors.border};
295
+ `,wd=Su.div`
321
296
  margin-left: 0.5rem;
322
- `,wd=Eu.div`
297
+ `,Ed=Su.div`
323
298
  width: 100%;
299
+ box-sizing: border-box;
324
300
  background-color: ${e=>e.themeColors.muted};
325
301
  border-radius: 0.5rem;
326
302
  border: 1px solid ${e=>e.themeColors.border};
327
303
  overflow: hidden;
328
- `,Ed=Eu.div`
304
+ `,kd=Su.div`
329
305
  width: 100%;
330
306
  max-height: 16rem;
331
307
  overflow-y: auto;
332
308
  padding: 0.5rem;
333
- `,kd=Eu.div`
309
+ `,Sd=Su.div`
334
310
  width: 100%;
335
311
  padding: 1rem;
336
312
  text-align: center;
@@ -339,7 +315,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
339
315
  background-color: ${e=>e.themeColors.muted};
340
316
  border-radius: 0.5rem;
341
317
  border: 1px solid ${e=>e.themeColors.border};
342
- `,Sd=Eu.div`
318
+ `,Cd=Su.div`
343
319
  width: 100%;
344
320
  padding: 0.5rem;
345
321
  background-color: ${e=>e.themeColors.muted};
@@ -348,7 +324,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
348
324
  font-size: 0.75rem;
349
325
  color: ${e=>e.themeColors.foreground};
350
326
  word-break: break-all;
351
- `;Eu.div`
327
+ `;Su.div`
352
328
  width: 100%;
353
329
  padding: 1rem;
354
330
  text-align: center;
@@ -358,14 +334,14 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
358
334
  border-radius: 0.5rem;
359
335
  border: 1px solid ${e=>e.themeColors.border};
360
336
  margin-bottom: 0.5rem;
361
- `;const Cd=Eu.span`
337
+ `;const _d=Su.span`
362
338
  font-weight: 500;
363
339
  color: ${e=>e.themeColors.cardForeground};
364
340
  font-size: 0.875rem;
365
- `,_d=Eu.span`
341
+ `,Nd=Su.span`
366
342
  color: ${e=>e.themeColors.foreground};
367
343
  font-size: 0.875rem;
368
- `,Nd=Eu.div`
344
+ `,Md=Su.div`
369
345
  width: 100%;
370
346
  padding: 1rem;
371
347
  text-align: center;
@@ -374,13 +350,93 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
374
350
  background-color: ${e=>e.themeColors.muted};
375
351
  border-radius: 0.5rem;
376
352
  border: 1px solid ${e=>e.themeColors.border};
377
- `,Md=Eu.span`
353
+ `,Pd=Su.span`
378
354
  color: ${e=>e.themeColors.mutedForeground};
379
- `,Pd=(e,t=["input","output"],n=[])=>Object.entries(e).filter(([e])=>!n.includes(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)}),Od=({data:t,label:n,depth:o,maxDepth:r,path:i,priorityKeys:a,excludeKeys:s,expanded:l})=>{const[c,u]=e.useState(l||!1),{theme:d}=hu(),f=d.colors,p=null!==t&&"object"==typeof t&&!Array.isArray(t),h=Array.isArray(t),m=(p||h)&&o<r,g=m&&Object.keys(t).length>0;return e.createElement(hd,null,e.createElement(md,{isExpandable:m,themeColors:f,onClick:e=>{e.stopPropagation(),m&&u(!c)},style:{paddingLeft:12*o+8+"px"}},e.createElement(gd,{themeColors:f},m&&g?c?e.createElement(zl,{size:12}):e.createElement(Il,{size:12}):e.createElement("div",{style:{width:"12px",height:"12px"}})),e.createElement(yd,{themeColors:f},n,":"),!m&&e.createElement(vd,{valueType:(y=t,null===y?"null":void 0===y?"undefined":typeof y),themeColors:f},(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)),m&&!g&&e.createElement(bd,{themeColors:f},h?"[]":"{}"),m&&g&&!c&&e.createElement(bd,{themeColors:f},h?`[${Object.keys(t).length} items]`:`{${Object.keys(t).length} keys}`)),c&&g&&e.createElement(xd,{themeColors:f},Pd(t,a,s).map(([t,n])=>e.createElement(Od,{key:`${i}.${t}`,data:n,label:t,depth:o+1,maxDepth:r,path:`${i}.${t}`,priorityKeys:a,excludeKeys:s,expanded:l}))));var y},Rd=({data:t,maxDepth:n=4,initialExpanded:o=!1,expanded:r=!1,className:i="",priorityKeys:a=["input","output"],excludeKeys:s=[]})=>{const{theme:l}=hu(),c=l.colors;return null==t?e.createElement(kd,{themeColors:c,className:i},"No data available"):"object"!=typeof t?e.createElement(Sd,{themeColors:c,className:i},e.createElement(Cd,{themeColors:c},"Value:")," ",e.createElement(_d,{themeColors:c},String(t))):0===Object.keys(t).length?e.createElement(Nd,{themeColors:c,className:i},e.createElement(Md,{themeColors:c},Array.isArray(t)?"Empty array":"Empty object")):e.createElement(wd,{themeColors:c,className:i},e.createElement(Ed,null,(()=>{const o=Pd(t,a,s);return 0===o.length?e.createElement(Nd,{themeColors:c},e.createElement(Md,{themeColors:c},Array.isArray(t)?"Empty array":"Empty object")):o.map(([t,o])=>e.createElement(Od,{key:t,data:o,label:t,depth:0,maxDepth:n,path:t,priorityKeys:a,excludeKeys:s,expanded:r}))})()))},$d=({data:t})=>{const[n,o]=e.useState(!1),r=Ru(t),i=()=>{o(!n)};switch(console.log("contentType",r),r){case"string":return e.createElement(od,{label:"Output",content:t.content,isExpanded:n,onToggle:i});case"toolResponse":case"other":default:return e.createElement(e.Fragment,null,e.createElement(Ad,null,"Output"),e.createElement(Rd,{data:t,expanded:!0}));case"toolCallList":const o=$u(t.content);return e.createElement(e.Fragment,null,e.createElement(Ad,null,"Output"),e.createElement(cd,{content:o,language:"tool-calls"}))}},Ad=Eu.span`
355
+ `,Rd=(e,t=["input","output"],n=[])=>Object.entries(e).filter(([e])=>!n.includes(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)}),Od=({data:t,label:n,depth:o,maxDepth:r,path:i,priorityKeys:a,excludeKeys:s,expanded:l})=>{const[c,u]=e.useState(l||!1),{theme:d}=gu(),f=d.colors,p=null!==t&&"object"==typeof t&&!Array.isArray(t),h=Array.isArray(t),m=(p||h)&&o<r,g=m&&Object.keys(t).length>0;return e.createElement(md,null,e.createElement(gd,{isExpandable:m,themeColors:f,onClick:e=>{e.stopPropagation(),m&&u(!c)},style:{paddingLeft:12*o+8+"px"}},e.createElement(yd,{themeColors:f},m&&g?c?e.createElement(zl,{size:12}):e.createElement(Il,{size:12}):e.createElement("div",{style:{width:"12px",height:"12px"}})),e.createElement(vd,{themeColors:f},n,":"),!m&&e.createElement(bd,{valueType:(y=t,null===y?"null":void 0===y?"undefined":typeof y),themeColors:f},(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)),m&&!g&&e.createElement(xd,{themeColors:f},h?"[]":"{}"),m&&g&&!c&&e.createElement(xd,{themeColors:f},h?`[${Object.keys(t).length} items]`:`{${Object.keys(t).length} keys}`)),c&&g&&e.createElement(wd,{themeColors:f},Rd(t,a,s).map(([t,n])=>e.createElement(Od,{key:`${i}.${t}`,data:n,label:t,depth:o+1,maxDepth:r,path:`${i}.${t}`,priorityKeys:a,excludeKeys:s,expanded:l}))));var y},$d=({data:t,maxDepth:n=4,initialExpanded:o=!1,expanded:r=!1,className:i="",priorityKeys:a=["input","output"],excludeKeys:s=[]})=>{const{theme:l}=gu(),c=l.colors;return null==t?e.createElement(Sd,{themeColors:c,className:i},"No data available"):"object"!=typeof t?e.createElement(Cd,{themeColors:c,className:i},e.createElement(_d,{themeColors:c},"Value:")," ",e.createElement(Nd,{themeColors:c},String(t))):0===Object.keys(t).length?e.createElement(Md,{themeColors:c,className:i},e.createElement(Pd,{themeColors:c},Array.isArray(t)?"Empty array":"Empty object")):e.createElement(Ed,{themeColors:c,className:i},e.createElement(kd,null,(()=>{const o=Rd(t,a,s);return 0===o.length?e.createElement(Md,{themeColors:c},e.createElement(Pd,{themeColors:c},Array.isArray(t)?"Empty array":"Empty object")):o.map(([t,o])=>e.createElement(Od,{key:t,data:o,label:t,depth:0,maxDepth:n,path:t,priorityKeys:a,excludeKeys:s,expanded:r}))})()))},Ad=({data:t})=>{const[n,o]=e.useState(!1),r=Au(t),i=()=>{o(!n)};switch(console.log(r),r){case"string":return e.createElement(Dd,null,e.createElement(rd,{label:"Output",content:t.content,isExpanded:n,onToggle:i}));case"toolResponse":return e.createElement(Dd,null,e.createElement(Td,null,"Output - Tool Response"),e.createElement($d,{data:t,expanded:!0}));case"toolCallList":const o=Tu(t.content);return e.createElement(e.Fragment,null,e.createElement(Dd,null,e.createElement(Td,null,e.createElement("span",null,"Output - Tool Calls"),e.createElement("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"}},e.createElement(jl,{size:14}),t.content.length)),e.createElement(ud,{content:o,language:"tool-calls",showHeader:!1})));default:return e.createElement(e.Fragment,null,e.createElement(Dd,null,e.createElement(Td,null,"Output"),e.createElement($d,{data:t,expanded:!0})))}},Td=Su.span`
356
+ margin: 0;
357
+ padding: 0;
358
+ font-size: 0.75rem;
359
+ font-weight: 500;
360
+ display: flex;
361
+ justify-content: space-between;
362
+ align-items: center;
363
+ color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
364
+
365
+ & span {
366
+ color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
367
+ }
368
+ `,Dd=Su.div`
369
+ width: 100%;
370
+ display: flex;
371
+ flex-direction: column;
372
+ padding-bottom: 0.5rem;
373
+ gap: 0.5rem;
374
+ max-height: 200px;
375
+ overflow-y: auto;
376
+ `;var zd=e.useLayoutEffect,Id=function(e,t){"function"!=typeof e?e.current=t:e(t)},Ld={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},jd=function(e){Object.keys(Ld).forEach(function(t){e.style.setProperty(t,Ld[t],"important")})},Bd=null,Fd=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize};var Hd=function(){},Vd=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],Wd=!!document.documentElement.currentStyle,Yd=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,o=(n=t,Vd.reduce(function(e,t){return e[t]=n[t],e},{})),r=o.boxSizing;return""===r?null:(Wd&&"border-box"===r&&(o.width=parseFloat(o.width)+parseFloat(o.borderRightWidth)+parseFloat(o.borderLeftWidth)+parseFloat(o.paddingRight)+parseFloat(o.paddingLeft)+"px"),{sizingStyle:o,paddingSize:parseFloat(o.paddingBottom)+parseFloat(o.paddingTop),borderSize:parseFloat(o.borderBottomWidth)+parseFloat(o.borderTopWidth)})};function Xd(t,n,o){var r,a,s=(r=o,a=e.useRef(r),zd(function(){a.current=r}),a);i.useLayoutEffect(function(){var e=function(e){return s.current(e)};if(t)return t.addEventListener(n,e),function(){return t.removeEventListener(n,e)}},[])}var Zd=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Kd=function(t,n){var o=t.cacheMeasurements,r=t.maxRows,a=t.minRows,s=t.onChange,l=void 0===s?Hd:s,c=t.onHeightChange,u=void 0===c?Hd:c,d=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(t,Zd),f=void 0!==d.value,p=i.useRef(null),h=function(t,n){var o=e.useRef();return e.useCallback(function(e){t.current=e,o.current&&Id(o.current,null),o.current=n,n&&Id(n,e)},[n])}(p,n),m=i.useRef(0),g=i.useRef(),y=function(){var e=p.current,t=o&&g.current?g.current:Yd(e);if(t){g.current=t;var n=function(e,t,n,o){void 0===n&&(n=1),void 0===o&&(o=1/0),Bd||((Bd=document.createElement("textarea")).setAttribute("tabindex","-1"),Bd.setAttribute("aria-hidden","true"),jd(Bd)),null===Bd.parentNode&&document.body.appendChild(Bd);var r=e.paddingSize,i=e.borderSize,a=e.sizingStyle,s=a.boxSizing;Object.keys(a).forEach(function(e){var t=e;Bd.style[t]=a[t]}),jd(Bd),Bd.value=t;var l=Fd(Bd,e);Bd.value=t,l=Fd(Bd,e),Bd.value="x";var c=Bd.scrollHeight-r,u=c*n;"border-box"===s&&(u=u+r+i),l=Math.max(u,l);var d=c*o;return"border-box"===s&&(d=d+r+i),[l=Math.min(d,l),c]}(t,e.value||e.placeholder||"x",a,r),i=n[0],s=n[1];m.current!==i&&(m.current=i,e.style.setProperty("height",i+"px","important"),u(i,{rowHeight:s}))}};return i.useLayoutEffect(y),function(e,t){Xd(document.body,"reset",function(n){e.current.form===n.target&&t(n)})}(p,function(){if(!f){var e=p.current.value;requestAnimationFrame(function(){var t=p.current;t&&e!==t.value&&y()})}}),Xd(window,"resize",y),function(e){Xd(document.fonts,"loadingdone",e)}(y),i.createElement("textarea",qc({},d,{onChange:function(e){f||y(),l(e)},ref:h}))},qd=i.forwardRef(Kd);const Ud=({input:t})=>{const{theme:n}=gu(),o=n?.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%)"};if(!t||0===t.length)return null;return e.createElement(Gd,null,e.createElement(Jd,null,e.createElement("h3",null,"Input"),e.createElement("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"}},e.createElement(Fl,{size:12}),t.length)),e.createElement(Qd,null,t.map((t,n)=>{return e.createElement(ef,{key:n},e.createElement(tf,null,e.createElement(nf,null,(e=>{switch(e.toLowerCase()){case"system":return"⚙️";case"user":return"👤";case"assistant":return"🤖";default:return"🔧"}})(t.role)," ",(i=t.role).charAt(0).toUpperCase()+i.slice(1))),e.createElement(of,{onClick:e=>{e.stopPropagation()},defaultValue:(r=t.content,("string"==typeof r?r:JSON.stringify(r))||""),readOnly:!0,style:{border:`1px solid ${o.border}`,backgroundColor:o.muted,color:o.foreground}}));var r,i})))},Gd=Su.div`
377
+ width: 100%;
378
+ display: flex;
379
+ flex-direction: column;
380
+ gap: 0.5rem;
381
+ `,Qd=Su.div`
382
+ width: 100%;
383
+ display: flex;
384
+ flex-direction: column;
385
+ padding-bottom: 0.5rem;
386
+ gap: 0.5rem;
387
+ max-height: 200px;
388
+ overflow-y: auto;
389
+ `,Jd=Su.div`
390
+ display: flex;
391
+ align-items: center;
392
+ justify-content: space-between;
393
+ font-weight: 500;
394
+ font-size: 0.75rem;
395
+ color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
396
+
397
+ & h3 {
398
+ margin: 0;
399
+ padding: 0;
400
+ font-size: 0.75rem;
401
+ font-weight: 500;
402
+ color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
403
+ }
404
+
405
+ & span {
406
+ font-size: 0.75rem;
407
+ font-weight: 500;
408
+ opacity: 0.5;
409
+ color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
410
+ }
411
+ `,ef=Su.div`
412
+ width: 100%;
413
+ display: flex;
414
+ flex-direction: column;
415
+ gap: 0.25rem;
416
+ `,tf=Su.div`
417
+ display: flex;
418
+ align-items: center;
419
+ gap: 0.25rem;
420
+ `,nf=Su.span`
380
421
  font-weight: 600;
381
422
  font-size: 0.75rem;
382
423
  color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
383
- `,Dd=e=>e?e[e.length-1]:null,Td=e=>e?e.reduce((e,t)=>e+(t.total_cost||0),0):0,zd=e=>e?e.reduce((e,t)=>e+(t.input_tokens||0),0):0,Id=e=>e?e.reduce((e,t)=>e+(t.output_tokens||0),0):0,Ld=({input:t})=>{const{theme:n}=hu(),o=n?.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%)"};if(!t||0===t.length)return null;return e.createElement(Zd,null,e.createElement(Kd,null,"Input"),t.map((t,n)=>{return e.createElement(qd,{key:n},e.createElement(Ud,null,e.createElement(Gd,null,(e=>{switch(e.toLowerCase()){case"system":return"⚙️";case"user":return"👤";case"assistant":return"🤖";default:return"🔧"}})(t.role)," ",(i=t.role).charAt(0).toUpperCase()+i.slice(1))),e.createElement(Qd,{value:(r=t.content,("string"==typeof r?r:JSON.stringify(r))||""),readOnly:!0,rows:Math.max(2,Math.ceil((t.content?.toString().length||0)/60)),style:{border:`1px solid ${o.border}`,backgroundColor:o.muted,color:o.foreground}}));var r,i}))},jd=({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%)"};e.useState(!1);const[a,s]=e.useState(!1),l=e.useRef(null),c=t.edges?.some(e=>e.source===n)||!1,u=t.edges?.some(e=>e.target===n)||!1,d=t.label||Su("Agent")||"Agent",f=t.details?.internals?.llm_details?.[0]?.model_provider,p=(t=>"OpenAI"===t?e.createElement(Lu,null):"Anthropic"===t?e.createElement(Bu,null):"Google"===t||"Vertex_AI"===t?e.createElement(ju,null):"🤖")(f),h=t.details?.internals?.llm_details?.[0]?.model_name||"Unknown",m=Cu(Td(t.details?.internals?.llm_details||[])),g=Dd(t.details?.internals?.llm_details||[]),y=g?.input||[],v=g?.output||null;return e.createElement(e.Fragment,null,e.createElement(Bd,{ref:l,onClick:()=>{s(!0),o&&o(t)}},u&&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(Fd,null,e.createElement(Hd,null,e.createElement(Vd,null,p),e.createElement(Wd,null,d)),e.createElement(Yd,null,e.createElement(Iu,{variant:"gray",title:h},h),e.createElement(Iu,{variant:"cost",title:t.details?.internals?.llm_details?.[0]?.total_cost?.toString()||""},m))),e.createElement(Xd,null,e.createElement(Ld,{input:y}),v?e.createElement($d,{data:v}):null),c&&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(Hu,{isVisible:a,onClose:()=>{s(!1)},nodeData:{...t,id:n},triggerRef:l}))},Bd=Eu.div`
424
+ `,of=Su(qd)`
425
+ box-sizing: border-box;
426
+ width: 100%;
427
+ border-radius: 0.25rem;
428
+ padding: 0.5rem;
429
+ resize: none;
430
+ font-family: inherit;
431
+ font-size: 0.75rem;
432
+ &:focus {
433
+ outline: none;
434
+ border-color: ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
435
+ box-shadow: 0 0 0 1px ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
436
+ }
437
+
438
+ transition: all 0.2s ease-in-out;
439
+ `,rf=e=>e?e[e.length-1]:null,af=e=>e?e.reduce((e,t)=>e+(t.total_cost||0),0):0,sf=e=>e?e.reduce((e,t)=>e+(t.input_tokens||0),0):0,lf=e=>e?e.reduce((e,t)=>e+(t.output_tokens||0),0):0,cf=e=>e?e.reduce((e,t)=>e+(t.latency||0),0):0,uf=({data:t,id:n,onInspect:o})=>{const{theme:r}=gu(),i=r?.colors||{primary:"hsl(221.2 83.2% 53.3%)",background:"hsl(0 0% 100%)"},[a,s]=e.useState(!1),l=e.useRef(null),c=t.edges?.some(e=>e.source===n)||!1,u=t.edges?.some(e=>e.target===n)||!1,d=t.label||_u("Agent")||"Agent",f=t.details?.internals?.llm_details?.[0]?.model_provider,p=(t=>"OpenAI"===t?e.createElement(Bu,null):"Anthropic"===t?e.createElement(Hu,null):"Google"===t||"Vertex_AI"===t?e.createElement(Fu,null):"🤖")(f),h=t.details?.internals?.llm_details?.[0]?.model_name||"Unknown",m=Nu(af(t.details?.internals?.llm_details||[])),g=rf(t.details?.internals?.llm_details||[]),y=g?.input||[],v=g?.output||null;return e.createElement(e.Fragment,null,e.createElement(df,{ref:l,onClick:()=>{s(!0),o&&o(t)},className:"nowheel"},u&&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(ff,null,e.createElement(pf,null,e.createElement(hf,null,p),e.createElement(mf,null,d)),e.createElement(gf,null,e.createElement(ju,{variant:"gray",title:h},h),e.createElement(ju,{variant:"cost",title:t.details?.internals?.llm_details?.[0]?.total_cost?.toString()||""},m))),e.createElement(yf,null,e.createElement(Ud,{input:y}),v?e.createElement(Ad,{data:v}):null),c&&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(Wu,{isVisible:a,onClose:()=>{s(!1)},nodeData:{...t,id:n},triggerRef:l}))},df=Su.div`
384
440
  border-radius: 0.5rem;
385
441
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
386
442
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -396,80 +452,41 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
396
452
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
397
453
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
398
454
  }
399
- `,Fd=Eu.div`
455
+ `,ff=Su.div`
400
456
  display: flex;
401
457
  justify-content: space-between;
402
458
  align-items: center;
403
459
  gap: 0.5rem;
404
460
  padding: 0.75rem;
405
461
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
406
- `,Hd=Eu.div`
462
+ `,pf=Su.div`
407
463
  display: flex;
408
464
  align-items: center;
409
465
  gap: 0.5rem;
410
- `,Vd=Eu.div`
466
+ `,hf=Su.div`
411
467
  font-size: 1.25rem;
412
468
  display: flex;
413
469
  align-items: center;
414
470
  justify-content: center;
415
471
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
416
- `,Wd=Eu.div`
472
+ `,mf=Su.div`
417
473
  font-weight: 600;
418
474
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
419
475
  font-size: 0.875rem;
420
476
  word-break: break-words;
421
- `,Yd=Eu.div`
477
+ `,gf=Su.div`
422
478
  display: flex;
423
479
  gap: 0.5rem;
424
480
  justify-content: flex-end;
425
481
  align-items: center;
426
- `,Xd=Eu.div`
482
+ `,yf=Su.div`
427
483
  padding: 0.75rem;
428
484
  display: flex;
429
485
  flex-direction: column;
430
486
  align-items: flex-start;
431
487
  justify-content: center;
432
488
  gap: 0.5rem;
433
- `,Zd=Eu.div`
434
- width: 100%;
435
- display: flex;
436
- flex-direction: column;
437
- gap: 0.5rem;
438
- `,Kd=Eu.span`
439
- font-weight: 600;
440
- font-size: 0.75rem;
441
- color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
442
- `,qd=Eu.div`
443
- width: 100%;
444
- display: flex;
445
- flex-direction: column;
446
- gap: 0.25rem;
447
- `,Ud=Eu.div`
448
- display: flex;
449
- align-items: center;
450
- gap: 0.25rem;
451
- `,Gd=Eu.span`
452
- font-weight: 600;
453
- font-size: 0.75rem;
454
- color: ${e=>e.theme?.colors?.mutedForeground||"hsl(215.4 16.3% 46.9%)"};
455
- `,Qd=Eu.textarea`
456
- box-sizing: border-box;
457
- width: 100%;
458
- border-radius: 0.25rem;
459
- padding: 0.5rem;
460
- resize: none;
461
- min-height: 40px;
462
- font-family: inherit;
463
- font-size: 0.75rem;
464
-
465
- &:focus {
466
- outline: none;
467
- border-color: ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
468
- box-shadow: 0 0 0 1px ${e=>e.theme?.colors?.primary||"hsl(221.2 83.2% 53.3%)"};
469
- }
470
-
471
- transition: all 0.2s ease-in-out;
472
- `,Jd=({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(ef,{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(tf,null,e.createElement(nf,null,e.createElement(of,null,"🎯"),e.createElement(rf,null,l)),e.createElement(af,null,e.createElement(Iu,{variant:"gray"},"Coordinator"))),e.createElement(sf,null,e.createElement(Rd,{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}))},ef=Eu.div`
489
+ `,vf=({data:t,id:n,onInspect:o})=>{const{theme:r}=gu(),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||_u("Coordinator")||"Coordinator";return e.createElement(bf,{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(xf,null,e.createElement(wf,null,e.createElement(Ef,null,"🎯"),e.createElement(kf,null,l)),e.createElement(Sf,null,e.createElement(ju,{variant:"gray"},"Coordinator"))),e.createElement(Cf,null,e.createElement($d,{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}))},bf=Su.div`
473
490
  border-radius: 0.5rem;
474
491
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
475
492
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -485,41 +502,41 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
485
502
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
486
503
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
487
504
  }
488
- `,tf=Eu.div`
505
+ `,xf=Su.div`
489
506
  display: flex;
490
507
  justify-content: space-between;
491
508
  align-items: center;
492
509
  gap: 0.5rem;
493
510
  padding: 0.75rem;
494
511
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
495
- `,nf=Eu.div`
512
+ `,wf=Su.div`
496
513
  display: flex;
497
514
  align-items: center;
498
515
  gap: 0.5rem;
499
- `,of=Eu.div`
516
+ `,Ef=Su.div`
500
517
  font-size: 1.25rem;
501
518
  display: flex;
502
519
  align-items: center;
503
520
  justify-content: center;
504
521
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
505
- `,rf=Eu.div`
522
+ `,kf=Su.div`
506
523
  font-weight: 600;
507
524
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
508
525
  font-size: 0.875rem;
509
526
  word-break: break-words;
510
- `,af=Eu.div`
527
+ `,Sf=Su.div`
511
528
  display: flex;
512
529
  gap: 0.5rem;
513
530
  justify-content: flex-end;
514
531
  align-items: center;
515
- `,sf=Eu.div`
532
+ `,Cf=Su.div`
516
533
  padding: 0.75rem;
517
534
  display: flex;
518
535
  flex-direction: column;
519
536
  align-items: flex-start;
520
537
  justify-content: center;
521
538
  gap: 0.5rem;
522
- `,lf=({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(cf,{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(uf,null,e.createElement(df,null,e.createElement(ff,null,"🔧"),e.createElement(pf,null,l)),null!=c&&e.createElement(hf,null,e.createElement(Iu,{variant:"latency"},_u(c)))),e.createElement(mf,null,e.createElement(Rd,{excludeKeys:["latency"],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,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}))},cf=Eu.div`
539
+ `,_f=({data:t,id:n,onInspect:o})=>{const{theme:r}=gu(),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||_u("Tool")||"Tool",c=t.details?.internals?.latency?.total_time;return e.createElement(Nf,{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(Mf,null,e.createElement(Pf,null,e.createElement(Rf,null,"🔧"),e.createElement(Of,null,l)),null!=c&&e.createElement($f,null,e.createElement(ju,{variant:"latency"},Mu(c)))),e.createElement(Af,null,e.createElement($d,{excludeKeys:["latency"],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,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}))},Nf=Su.div`
523
540
  border-radius: 0.5rem;
524
541
  background-color: ${e=>e.theme?.colors?.card||"hsl(0 0% 100%)"};
525
542
  border: 2px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
@@ -535,60 +552,60 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
535
552
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
536
553
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
537
554
  }
538
- `,uf=Eu.div`
555
+ `,Mf=Su.div`
539
556
  display: flex;
540
557
  justify-content: space-between;
541
558
  align-items: center;
542
559
  gap: 0.5rem;
543
560
  padding: 0.75rem;
544
561
  border-bottom: 1px solid ${e=>e.theme?.colors?.border||"hsl(214.3 31.8% 91.4%)"};
545
- `,df=Eu.div`
562
+ `,Pf=Su.div`
546
563
  display: flex;
547
564
  align-items: center;
548
565
  gap: 0.5rem;
549
- `,ff=Eu.div`
566
+ `,Rf=Su.div`
550
567
  font-size: 1.25rem;
551
568
  display: flex;
552
569
  align-items: center;
553
570
  justify-content: center;
554
571
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
555
- `,pf=Eu.div`
572
+ `,Of=Su.div`
556
573
  font-weight: 600;
557
574
  color: ${e=>e.theme?.colors?.foreground||"hsl(222.2 84% 4.9%)"};
558
575
  font-size: 0.875rem;
559
576
  word-break: break-words;
560
- `,hf=Eu.div`
577
+ `,$f=Su.div`
561
578
  display: flex;
562
579
  gap: 0.5rem;
563
580
  justify-content: flex-end;
564
581
  align-items: center;
565
- `,mf=Eu.div`
582
+ `,Af=Su.div`
566
583
  padding: 0.75rem;
567
584
  display: flex;
568
585
  flex-direction: column;
569
586
  align-items: flex-start;
570
587
  justify-content: center;
571
588
  gap: 0.5rem;
572
- `,gf=({data:t,id:n})=>{const o=t.nodeType||"Agent",r=t.onInspect;switch(o){case"Agent":default:return e.createElement(jd,{data:t,id:n,onInspect:r});case"Tool":return e.createElement(lf,{data:t,id:n,onInspect:r});case"Coordinator":return e.createElement(Jd,{data:t,id:n,onInspect:r})}},yf=Eu.div`
589
+ `,Tf=({data:t,id:n})=>{const o=t.nodeType||"Agent",r=t.onInspect;switch(o){case"Agent":default:return e.createElement(uf,{data:t,id:n,onInspect:r});case"Tool":return e.createElement(_f,{data:t,id:n,onInspect:r});case"Coordinator":return e.createElement(vf,{data:t,id:n,onInspect:r})}},Df=Su.div`
573
590
  background-color: ${e=>e.theme.colors.card};
574
591
  border: 1px solid ${e=>e.theme.colors.border};
575
592
  border-radius: 0.5rem;
576
593
  overflow: hidden;
577
594
  width: 100%;
578
595
  max-width: 400px;
579
- `,vf=Eu.div`
596
+ `,zf=Su.div`
580
597
  display: flex;
581
598
  justify-content: space-between;
582
599
  align-items: center;
583
600
  padding: 0.75rem;
584
601
  border-bottom: 1px solid ${e=>e.theme.colors.border};
585
602
  background-color: ${e=>e.theme.colors.muted};
586
- `,bf=Eu.h3`
603
+ `,If=Su.h3`
587
604
  margin: 0;
588
605
  font-size: 0.875rem;
589
606
  font-weight: 600;
590
607
  color: ${e=>e.theme.colors.cardForeground};
591
- `,xf=Eu.button`
608
+ `,Lf=Su.button`
592
609
  display: flex;
593
610
  align-items: center;
594
611
  justify-content: center;
@@ -604,11 +621,11 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
604
621
  background-color: ${e=>e.theme.colors.accent};
605
622
  color: ${e=>e.theme.colors.accentForeground};
606
623
  }
607
- `,wf=Eu.div`
624
+ `,jf=Su.div`
608
625
  padding: 0.75rem;
609
626
  max-height: 400px;
610
627
  overflow-y: auto;
611
- `,Ef=Eu.div`
628
+ `,Bf=Su.div`
612
629
  position: relative;
613
630
  padding: 0.5rem;
614
631
  border-radius: 0.375rem;
@@ -621,26 +638,26 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
621
638
  &:hover {
622
639
  background-color: ${e=>e.hasStep&&!e.isActive?e.theme.colors.accent:e.isActive?e.theme.colors.primary:"transparent"};
623
640
  }
624
- `,kf=Eu.div`
641
+ `,Ff=Su.div`
625
642
  display: flex;
626
643
  align-items: center;
627
644
  gap: 0.5rem;
628
645
  margin-bottom: 0.25rem;
629
- `,Sf=Eu.div`
646
+ `,Hf=Su.div`
630
647
  width: 0.5rem;
631
648
  height: 0.5rem;
632
649
  border-radius: 50%;
633
650
  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};
634
651
  flex-shrink: 0;
635
- `,Cf=Eu.span`
652
+ `,Vf=Su.span`
636
653
  font-weight: 600;
637
654
  font-size: 0.75rem;
638
655
  color: ${e=>e.isActive?e.theme.colors.primaryForeground:e.theme.colors.cardForeground};
639
- `,_f=Eu.div`
656
+ `,Wf=Su.div`
640
657
  font-size: 0.75rem;
641
658
  color: ${e=>e.hasStep?e.theme.colors.cardForeground:e.theme.colors.mutedForeground};
642
659
  font-style: ${e=>e.hasStep?"normal":"italic"};
643
- `,Nf=Eu.div`
660
+ `,Yf=Su.div`
644
661
  position: absolute;
645
662
  top: 0;
646
663
  left: 0;
@@ -660,7 +677,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
660
677
  opacity: 0.5;
661
678
  }
662
679
  }
663
- `,Mf=({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(yf,{theme:i},e.createElement(vf,{theme:i},e.createElement(bf,{theme:i},"Timeline"),r&&e.createElement(xf,{onClick:r,title:"Collapse Panel",theme:i},e.createElement(Bl,{size:16}))),e.createElement(wf,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(Ef,{key:l,isActive:u,isPast:d,hasStep:f,onClick:()=>f&&o(l),theme:i},e.createElement(kf,null,e.createElement(Sf,{isActive:u,isPast:d,hasStep:f,theme:i}),e.createElement(Cf,{isActive:u,theme:i},"Step ",l),p&&e.createElement("div",{style:{marginLeft:"auto"}},e.createElement(Iu,{variant:c(p)},(e=>e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`)(p)))),e.createElement(_f,{hasStep:f,theme:i},f?h:"No activity"),u&&e.createElement(Nf,{theme:i}))})))};function Pf(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),!1===n||!o.defaultPrevented)return t?.(o)}}function Of(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Rf(...e){return t=>{let n=!1;const o=e.map(e=>{const o=Of(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():Of(e[t],null)}}}}function $f(...e){return i.useCallback(Rf(...e),e)}function Af(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}\``)}]},Df(r,...n)]}function Df(...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 Tf=globalThis?.document?i.useLayoutEffect:()=>{},zf=i[" useId ".trim().toString()]||(()=>{}),If=0;function Lf(e){const[t,n]=i.useState(zf());return Tf(()=>{e||n(e=>e??String(If++))},[e]),e||(t?`radix-${t}`:"")}var jf=i[" useInsertionEffect ".trim().toString()]||Tf;function Bf({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 jf(()=>{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 Ff(e){const n=Hf(e),o=i.forwardRef((e,o)=>{const{children:r,...a}=e,s=i.Children.toArray(r),l=s.find(Wf);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 Hf(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?Rf(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 Vf=Symbol("radix.slottable");function Wf(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Vf}var Yf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const o=Ff(`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 Xf(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}var Zf,Kf="dismissableLayer.update",qf="dismissableLayer.pointerDownOutside",Uf="dismissableLayer.focusOutside",Gf=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qf=i.forwardRef((e,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Gf),[f,p]=i.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=$f(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=Xf(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let o=function(){tp(qf,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=Xf(e),o=i.useRef(!1);return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){tp(Uf,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=Xf(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&&(Zf=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ep(),()=>{o&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=Zf)}},[f,h,o,d]),i.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ep())},[f,d]),i.useEffect(()=>{const e=()=>m({});return document.addEventListener(Kf,e),()=>document.removeEventListener(Kf,e)},[]),t.jsx(Yf.div,{...u,ref:g,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:Pf(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Pf(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Pf(e.onPointerDownCapture,k.onPointerDownCapture)})});Qf.displayName="DismissableLayer";var Jf=i.forwardRef((e,n)=>{const o=i.useContext(Gf),r=i.useRef(null),a=$f(n,r);return i.useEffect(()=>{const e=r.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}},[o.branches]),t.jsx(Yf.div,{...e,ref:a})});function ep(){const e=new CustomEvent(Kf);document.dispatchEvent(e)}function tp(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)}Jf.displayName="DismissableLayerBranch";var np="focusScope.autoFocusOnMount",op="focusScope.autoFocusOnUnmount",rp={bubbles:!1,cancelable:!0},ip=i.forwardRef((e,n)=>{const{loop:o=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=Xf(a),f=Xf(s),p=i.useRef(null),h=$f(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:cp(p.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||cp(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&cp(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){up.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(np,rp);c.addEventListener(np,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(cp(o,{select:t}),document.activeElement!==n)return}((e=ap(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&cp(c))}return()=>{c.removeEventListener(np,d),setTimeout(()=>{const e=new CustomEvent(op,rp);c.addEventListener(op,f),c.dispatchEvent(e),e.defaultPrevented||cp(t??document.body,{select:!0}),c.removeEventListener(op,f),up.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=ap(e),n=sp(t,e),o=sp(t.reverse(),e);return[n,o]}(t);r&&i?e.shiftKey||n!==i?e.shiftKey&&n===r&&(e.preventDefault(),o&&cp(i,{select:!0})):(e.preventDefault(),o&&cp(r,{select:!0})):n===t&&e.preventDefault()}},[o,r,m.paused]);return t.jsx(Yf.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});function ap(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 sp(e,t){for(const n of e)if(!lp(n,{upTo:t}))return n}function lp(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 cp(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()}}ip.displayName="FocusScope";var up=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=dp(e,t),e.unshift(t)},remove(t){e=dp(e,t),e[0]?.resume()}}}();function dp(e,t){const n=[...e],o=n.indexOf(t);return-1!==o&&n.splice(o,1),n}var fp=i.forwardRef((e,o)=>{const{container:r,...a}=e,[s,l]=i.useState(!1);Tf(()=>l(!0),[]);const c=r||s&&globalThis?.document?.body;return c?n.createPortal(t.jsx(Yf.div,{...a,ref:o}),c):null});fp.displayName="Portal";var pp=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=hp(o.current);a.current="mounted"===l?e:"none"},[l]),Tf(()=>{const t=o.current,n=r.current;if(n!==e){const o=a.current,i=hp(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]),Tf(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=hp(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=hp(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=$f(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 hp(e){return e?.animationName||"none"}pp.displayName="Presence";var mp=0;function gp(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yp()),document.body.insertAdjacentElement("beforeend",e[1]??yp()),mp++,()=>{1===mp&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),mp--}},[])}function yp(){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 vp=function(){return vp=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},vp.apply(this,arguments)};function bp(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 xp="right-scroll-bar-position",wp="width-before-scroll-bar";function Ep(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var kp="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,Sp=new WeakMap;function Cp(t,n){var o,r,i,a=(o=n||null,r=function(e){return t.forEach(function(t){return Ep(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 kp(function(){var e=Sp.get(a);if(e){var n=new Set(e),o=new Set(t),r=a.current;n.forEach(function(e){o.has(e)||Ep(e,null)}),o.forEach(function(e){n.has(e)||Ep(e,r)})}Sp.set(a,t)},[t]),a}function _p(e){return e}var Np=function(e){var t=e.sideCar,n=bp(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,vp({},n))};Np.isSideCarExport=!0;var Mp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=_p);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=vp({async:!0,ssr:!1},e),t}(),Pp=function(){},Op=i.forwardRef(function(e,t){var n=i.useRef(null),o=i.useState({onScrollCapture:Pp,onWheelCapture:Pp,onTouchMoveCapture:Pp}),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=bp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,k=Cp([n,t]),S=vp(vp({},w),r);return i.createElement(i.Fragment,null,d&&i.createElement(E,{sideCar:Mp,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),vp(vp({},S),{ref:k})):i.createElement(b,vp({},S,{className:c,ref:k}),l))});Op.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Op.classNames={fullWidth:wp,zeroRight:xp};function Rp(){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 $p=function(){var e=0,t=null;return{add:function(n){var o,r;0==e&&(t=Rp())&&(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)}}},Ap=function(){var e,t=(e=$p(),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}},Dp={left:0,top:0,right:0,gap:0},Tp=function(e){return parseInt(e||"",10)||0},zp=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Dp;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[Tp(n),Tp(o),Tp(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])}},Ip=Ap(),Lp="data-scroll-locked",jp=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(Lp,"] {\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(xp," {\n right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(wp," {\n margin-right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(xp," .").concat(xp," {\n right: 0 ").concat(o,";\n }\n \n .").concat(wp," .").concat(wp," {\n margin-right: 0 ").concat(o,";\n }\n \n body[").concat(Lp,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Bp=function(){var e=parseInt(document.body.getAttribute(Lp)||"0",10);return isFinite(e)?e:0},Fp=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(Lp,(Bp()+1).toString()),function(){var e=Bp()-1;e<=0?document.body.removeAttribute(Lp):document.body.setAttribute(Lp,e.toString())}},[]);var a=i.useMemo(function(){return zp(r)},[r]);return i.createElement(Ip,{styles:jp(a,!t,r,n?"":"!important")})},Hp=!1;if("undefined"!=typeof window)try{var Vp=Object.defineProperty({},"passive",{get:function(){return Hp=!0,!0}});window.addEventListener("test",Vp,Vp),window.removeEventListener("test",Vp,Vp)}catch(e){Hp=!1}var Wp=!!Hp&&{passive:!1},Yp=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])},Xp=function(e,t){var n=t.ownerDocument,o=t;do{if("undefined"!=typeof ShadowRoot&&o instanceof ShadowRoot&&(o=o.host),Zp(e,o)){var r=Kp(e,o);if(r[1]>r[2])return!0}o=o.parentNode}while(o&&o!==n.body);return!1},Zp=function(e,t){return"v"===e?function(e){return Yp(e,"overflowY")}(t):function(e){return Yp(e,"overflowX")}(t)},Kp=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},qp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Up=function(e){return[e.deltaX,e.deltaY]},Gp=function(e){return e&&"current"in e?e.current:e},Qp=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Jp=0,eh=[];function th(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var nh,oh=(nh=function(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(Jp++)[0],a=i.useState(Ap)[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(Gp),!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=qp(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=Xp(d,u);if(!f)return!0;if(f?r=d:(r="v"===d?"h":"v",f=Xp(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=Kp(e,s),h=p[0],m=p[1]-p[2]-i*h;(h||m)&&Zp(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(eh.length&&eh[eh.length-1]===a){var o="deltaY"in n?Up(n):qp(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(Gp).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:th(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=qp(e),o.current=void 0},[]),f=i.useCallback(function(t){u(t.type,Up(t),t.target,l(t,e.lockRef.current))},[]),p=i.useCallback(function(t){u(t.type,qp(t),t.target,l(t,e.lockRef.current))},[]);i.useEffect(function(){return eh.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Wp),document.addEventListener("touchmove",c,Wp),document.addEventListener("touchstart",d,Wp),function(){eh=eh.filter(function(e){return e!==a}),document.removeEventListener("wheel",c,Wp),document.removeEventListener("touchmove",c,Wp),document.removeEventListener("touchstart",d,Wp)}},[]);var h=e.removeScrollBar,m=e.inert;return i.createElement(i.Fragment,null,m?i.createElement(a,{styles:Qp(r)}):null,h?i.createElement(Fp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Mp.useMedium(nh),Np),rh=i.forwardRef(function(e,t){return i.createElement(Op,vp({},e,{ref:t,sideCar:oh}))});rh.classNames=Op.classNames;var ih=rh,ah=new WeakMap,sh=new WeakMap,lh={},ch=0,uh=function(e){return e&&(e.host||uh(e.parentNode))},dh=function(e,t,n,o){var r=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=uh(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]);lh[n]||(lh[n]=new WeakMap);var i=lh[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=(ah.get(e)||0)+1,c=(i.get(e)||0)+1;ah.set(e,l),i.set(e,c),a.push(e),1===l&&r&&sh.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(),ch++,function(){a.forEach(function(e){var t=ah.get(e)-1,r=i.get(e)-1;ah.set(e,t),i.set(e,r),t||(sh.has(e)||e.removeAttribute(o),sh.delete(e)),r||e.removeAttribute(n)}),--ch||(ah=new WeakMap,ah=new WeakMap,sh=new WeakMap,lh={})}},fh=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"))),dh(o,r,n,"aria-hidden")):function(){return null}},ph="Dialog",[hh,mh]=Af(ph),[gh,yh]=hh(ph),vh=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]=Bf({prop:r,defaultProp:a??!1,onChange:s,caller:ph});return t.jsx(gh,{scope:n,triggerRef:c,contentRef:u,contentId:Lf(),titleId:Lf(),descriptionId:Lf(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(e=>!e),[f]),modal:l,children:o})};vh.displayName=ph;var bh="DialogTrigger",xh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=yh(bh,o),a=$f(n,i.triggerRef);return t.jsx(Yf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Bh(i.open),...r,ref:a,onClick:Pf(e.onClick,i.onOpenToggle)})});xh.displayName=bh;var wh="DialogPortal",[Eh,kh]=hh(wh,{forceMount:void 0}),Sh=e=>{const{__scopeDialog:n,forceMount:o,children:r,container:a}=e,s=yh(wh,n);return t.jsx(Eh,{scope:n,forceMount:o,children:i.Children.map(r,e=>t.jsx(pp,{present:o||s.open,children:t.jsx(fp,{asChild:!0,container:a,children:e})}))})};Sh.displayName=wh;var Ch="DialogOverlay",_h=i.forwardRef((e,n)=>{const o=kh(Ch,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=yh(Ch,e.__scopeDialog);return a.modal?t.jsx(pp,{present:r||a.open,children:t.jsx(Mh,{...i,ref:n})}):null});_h.displayName=Ch;var Nh=Ff("DialogOverlay.RemoveScroll"),Mh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=yh(Ch,o);return t.jsx(ih,{as:Nh,allowPinchZoom:!0,shards:[i.contentRef],children:t.jsx(Yf.div,{"data-state":Bh(i.open),...r,ref:n,style:{pointerEvents:"auto",...r.style}})})}),Ph="DialogContent",Oh=i.forwardRef((e,n)=>{const o=kh(Ph,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=yh(Ph,e.__scopeDialog);return t.jsx(pp,{present:r||a.open,children:a.modal?t.jsx(Rh,{...i,ref:n}):t.jsx($h,{...i,ref:n})})});Oh.displayName=Ph;var Rh=i.forwardRef((e,n)=>{const o=yh(Ph,e.__scopeDialog),r=i.useRef(null),a=$f(n,o.contentRef,r);return i.useEffect(()=>{const e=r.current;if(e)return fh(e)},[]),t.jsx(Ah,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pf(e.onCloseAutoFocus,e=>{e.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:Pf(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Pf(e.onFocusOutside,e=>e.preventDefault())})}),$h=i.forwardRef((e,n)=>{const o=yh(Ph,e.__scopeDialog),r=i.useRef(!1),a=i.useRef(!1);return t.jsx(Ah,{...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()}})}),Ah=i.forwardRef((e,n)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=e,c=yh(Ph,o),u=i.useRef(null),d=$f(n,u);return gp(),t.jsxs(t.Fragment,{children:[t.jsx(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:t.jsx(Qf,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Bh(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(Wh,{titleId:c.titleId}),t.jsx(Yh,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Dh="DialogTitle",Th=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=yh(Dh,o);return t.jsx(Yf.h2,{id:i.titleId,...r,ref:n})});Th.displayName=Dh;var zh="DialogDescription",Ih=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=yh(zh,o);return t.jsx(Yf.p,{id:i.descriptionId,...r,ref:n})});Ih.displayName=zh;var Lh="DialogClose",jh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=yh(Lh,o);return t.jsx(Yf.button,{type:"button",...r,ref:n,onClick:Pf(e.onClick,()=>i.onOpenChange(!1))})});function Bh(e){return e?"open":"closed"}jh.displayName=Lh;var Fh="DialogTitleWarning",[Hh,Vh]=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}\``)}]}(Fh,{contentName:Ph,titleName:Dh,docsSlug:"dialog"}),Wh=({titleId:e})=>{const t=Vh(Fh),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},Yh=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vh("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},Xh=vh,Zh=xh,Kh=Sh,qh=_h,Uh=Oh,Gh=Th,Qh=Ih,Jh=jh;const em=Xh,tm=Zh,nm=Kh,om=i.forwardRef(({className:e,...t},n)=>i.createElement(qh,{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}));om.displayName=qh.displayName;const rm=(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"}}},im=i.forwardRef(({side:e="right",className:t,children:n,...o},r)=>i.createElement(nm,null,i.createElement(om,null),i.createElement(Uh,{ref:r,style:rm(e),className:t,...o},n,i.createElement(Jh,{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")))));im.displayName=Uh.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(Gh,{ref:n,style:{fontSize:"18px",fontWeight:600,color:"hsl(var(--foreground))"},className:e,...t})).displayName=Gh.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(Qh,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=Qh.displayName;const am=(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},sm={Agent:gf,Tool:gf,Coordinator:gf},lm=({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=400,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 am(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(em,{open:S,onOpenChange:C},e.createElement(tm,{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(nm,null,e.createElement(Uh,{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(Mf,{stamps:h.stamps||h.steps||[],currentStep:b,onStepChange:j}))),e.createElement(Jh,{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:sm,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 cm(e,[t,n]){return Math.min(n,Math.max(t,e))}var um=i.createContext(void 0);const dm=["top","right","bottom","left"],fm=Math.min,pm=Math.max,hm=Math.round,mm=Math.floor,gm=e=>({x:e,y:e}),ym={left:"right",right:"left",bottom:"top",top:"bottom"},vm={start:"end",end:"start"};function bm(e,t,n){return pm(e,fm(t,n))}function xm(e,t){return"function"==typeof e?e(t):e}function wm(e){return e.split("-")[0]}function Em(e){return e.split("-")[1]}function km(e){return"x"===e?"y":"x"}function Sm(e){return"y"===e?"height":"width"}const Cm=new Set(["top","bottom"]);function _m(e){return Cm.has(wm(e))?"y":"x"}function Nm(e){return km(_m(e))}function Mm(e){return e.replace(/start|end/g,e=>vm[e])}const Pm=["left","right"],Om=["right","left"],Rm=["top","bottom"],$m=["bottom","top"];function Am(e,t,n,o){const r=Em(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Om:Pm:t?Pm:Om;case"left":case"right":return t?Rm:$m;default:return[]}}(wm(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(Mm)))),i}function Dm(e){return e.replace(/left|right|bottom|top/g,e=>ym[e])}function Tm(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 zm(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 Im(e,t,n){let{reference:o,floating:r}=e;const i=_m(t),a=Nm(t),s=Sm(a),l=wm(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(Em(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function Lm(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}=xm(t,e),h=Tm(p),m=s[f?"floating"===d?"reference":"floating":d],g=zm(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=zm(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 jm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bm(e){return dm.some(t=>e[t]>=0)}const Fm=new Set(["left","top"]);function Hm(){return"undefined"!=typeof window}function Vm(e){return Xm(e)?(e.nodeName||"").toLowerCase():"#document"}function Wm(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ym(e){var t;return null==(t=(Xm(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Xm(e){return!!Hm()&&(e instanceof Node||e instanceof Wm(e).Node)}function Zm(e){return!!Hm()&&(e instanceof Element||e instanceof Wm(e).Element)}function Km(e){return!!Hm()&&(e instanceof HTMLElement||e instanceof Wm(e).HTMLElement)}function qm(e){return!(!Hm()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Wm(e).ShadowRoot)}const Um=new Set(["inline","contents"]);function Gm(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=cg(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Um.has(r)}const Qm=new Set(["table","td","th"]);function Jm(e){return Qm.has(Vm(e))}const eg=[":popover-open",":modal"];function tg(e){return eg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const ng=["transform","translate","scale","rotate","perspective"],og=["transform","translate","scale","rotate","perspective","filter"],rg=["paint","layout","strict","content"];function ig(e){const t=ag(),n=Zm(e)?cg(e):e;return ng.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||og.some(e=>(n.willChange||"").includes(e))||rg.some(e=>(n.contain||"").includes(e))}function ag(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const sg=new Set(["html","body","#document"]);function lg(e){return sg.has(Vm(e))}function cg(e){return Wm(e).getComputedStyle(e)}function ug(e){return Zm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dg(e){if("html"===Vm(e))return e;const t=e.assignedSlot||e.parentNode||qm(e)&&e.host||Ym(e);return qm(t)?t.host:t}function fg(e){const t=dg(e);return lg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Km(t)&&Gm(t)?t:fg(t)}function pg(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=fg(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),a=Wm(r);if(i){const e=hg(a);return t.concat(a,a.visualViewport||[],Gm(r)?r:[],e&&n?pg(e):[])}return t.concat(r,pg(r,[],n))}function hg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mg(e){const t=cg(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Km(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:o,s=hm(n)!==i||hm(o)!==a;return s&&(n=i,o=a),{width:n,height:o,$:s}}function gg(e){return Zm(e)?e:e.contextElement}function yg(e){const t=gg(e);if(!Km(t))return gm(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=mg(t);let a=(i?hm(n.width):n.width)/o,s=(i?hm(n.height):n.height)/r;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const vg=gm(0);function bg(e){const t=Wm(e);return ag()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:vg}function xg(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=gg(e);let a=gm(1);t&&(o?Zm(o)&&(a=yg(o)):a=yg(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Wm(e))&&t}(i,n,o)?bg(i):gm(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=Wm(i),t=o&&Zm(o)?Wm(o):o;let n=e,r=hg(n);for(;r&&o&&t!==n;){const e=yg(r),t=r.getBoundingClientRect(),o=cg(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=Wm(r),r=hg(n)}}return zm({width:u,height:d,x:l,y:c})}function wg(e,t){const n=ug(e).scrollLeft;return t?t.left+n:xg(Ym(e)).left+n}function Eg(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wg(e,n),y:n.top+t.scrollTop}}const kg=new Set(["absolute","fixed"]);function Sg(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Wm(e),o=Ym(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=ag();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}const c=wg(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=Ym(e),n=ug(e),o=e.ownerDocument.body,r=pm(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=pm(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+wg(e);const s=-n.scrollTop;return"rtl"===cg(o).direction&&(a+=pm(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:a,y:s}}(Ym(e));else if(Zm(t))o=function(e,t){const n=xg(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Km(e)?yg(e):gm(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=bg(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zm(o)}function Cg(e,t){const n=dg(e);return!(n===t||!Zm(n)||lg(n))&&("fixed"===cg(n).position||Cg(n,t))}function _g(e,t,n){const o=Km(t),r=Ym(t),i="fixed"===n,a=xg(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=gm(0);function c(){l.x=wg(r)}if(o||!o&&!i)if(("body"!==Vm(t)||Gm(r))&&(s=ug(t)),o){const e=xg(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?gm(0):Eg(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 Ng(e){return"static"===cg(e).position}function Mg(e,t){if(!Km(e)||"fixed"===cg(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ym(e)===n&&(n=n.ownerDocument.body),n}function Pg(e,t){const n=Wm(e);if(tg(e))return n;if(!Km(e)){let t=dg(e);for(;t&&!lg(t);){if(Zm(t)&&!Ng(t))return t;t=dg(t)}return n}let o=Mg(e,t);for(;o&&Jm(o)&&Ng(o);)o=Mg(o,t);return o&&lg(o)&&Ng(o)&&!ig(o)?n:o||function(e){let t=dg(e);for(;Km(t)&&!lg(t);){if(ig(t))return t;if(tg(t))return null;t=dg(t)}return null}(e)||n}const Og={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,a=Ym(o),s=!!t&&tg(t.floating);if(o===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=gm(1);const u=gm(0),d=Km(o);if((d||!d&&!i)&&(("body"!==Vm(o)||Gm(a))&&(l=ug(o)),Km(o))){const e=xg(o);c=yg(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const f=!a||d||i?gm(0):Eg(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:Ym,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i="clippingAncestors"===n?tg(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=pg(e,[],!1).filter(e=>Zm(e)&&"body"!==Vm(e)),r=null;const i="fixed"===cg(e).position;let a=i?dg(e):e;for(;Zm(a)&&!lg(a);){const t=cg(a),n=ig(a);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&kg.has(r.position)||Gm(a)&&!n&&Cg(e,a))?o=o.filter(e=>e!==a):r=t,a=dg(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=Sg(t,n,r);return e.top=pm(o.top,e.top),e.right=fm(o.right,e.right),e.bottom=fm(o.bottom,e.bottom),e.left=pm(o.left,e.left),e},Sg(t,s,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Pg,getElementRects:async function(e){const t=this.getOffsetParent||Pg,n=this.getDimensions,o=await n(e.floating);return{reference:_g(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}=mg(e);return{width:t,height:n}},getScale:yg,isElement:Zm,isRTL:function(e){return"rtl"===cg(e).direction}};function Rg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $g(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=gg(e),u=r||i?[...c?pg(c):[],...pg(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=Ym(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:-mm(d)+"px "+-mm(r.clientWidth-(u+f))+"px "+-mm(r.clientHeight-(d+p))+"px "+-mm(u)+"px",threshold:pm(0,fm(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||Rg(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?xg(e):null;return l&&function t(){const o=xg(e);m&&!Rg(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 Ag=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=wm(n),s=Em(n),l="y"===_m(n),c=Fm.has(a)?-1:1,u=i&&l?-1:1,d=xm(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}}}}},Dg=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}=xm(e,t),c={x:n,y:o},u=await Lm(t,l),d=_m(wm(r)),f=km(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=bm(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=bm(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}}}}}},Tg=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}=xm(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=wm(r),v=_m(s),b=wm(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(b||!m?[Dm(s)]:function(e){const t=Dm(e);return[Mm(e),t,Mm(t)]}(s)),E="none"!==h;!f&&E&&w.push(...Am(s,m,h,x));const k=[s,...w],S=await Lm(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=Em(e),r=Nm(e),i=Sm(r);let a="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Dm(a)),[a,Dm(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!==_m(t))||_.every(e=>_m(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=_m(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{}}}},zg=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}=xm(e,t),u=await Lm(t,c),d=wm(r),f=Em(r),p="y"===_m(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=fm(m-u[g],v),w=fm(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=pm(u.left,0),t=pm(u.right,0),n=pm(u.top,0),o=pm(u.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:pm(u.left,u.right)):k=m-2*(0!==n||0!==o?n+o:pm(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}}:{}}}},Ig=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=xm(e,t);switch(o){case"referenceHidden":{const e=jm(await Lm(t,{...r,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Bm(e)}}}case"escaped":{const e=jm(await Lm(t,{...r,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Bm(e)}}}default:return{}}}}},Lg=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}=xm(e,t)||{};if(null==c)return{};const d=Tm(u),f={x:n,y:o},p=Nm(r),h=Sm(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,_=fm(d[y],C),N=fm(d[v],C),M=_,P=k-m[h]-N,O=k/2-m[h]/2+S,R=bm(M,O,P),$=!l.arrow&&null!=Em(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:$}}}),jg=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}=xm(e,t),u={x:n,y:o},d=_m(r),f=km(d);let p=u[f],h=u[d];const m=xm(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=Fm.has(wm(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}}}},Bg=(e,t,n)=>{const o=new Map,r={platform:Og,...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}=Im(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}=Im(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var Fg="undefined"!=typeof document?e.useLayoutEffect:function(){};function Hg(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(!Hg(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)&&!Hg(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Vg(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wg(e,t){const n=Vg(e);return Math.round(t*n)/n}function Yg(e){const t=i.useRef(e);return Fg(()=>{t.current=e}),t}const Xg=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?Lg({element:n.current,padding:o}).fn(t):{}:n?Lg({element:n,padding:o}).fn(t):{};var r}}),Zg=(e,t)=>({...Ag(e),options:[e,t]}),Kg=(e,t)=>({...Dg(e),options:[e,t]}),qg=(e,t)=>({...jg(e),options:[e,t]}),Ug=(e,t)=>({...Tg(e),options:[e,t]}),Gg=(e,t)=>({...zg(e),options:[e,t]}),Qg=(e,t)=>({...Ig(e),options:[e,t]}),Jg=(e,t)=>({...Xg(e),options:[e,t]});var ey=i.forwardRef((e,n)=>{const{children:o,width:r=10,height:i=5,...a}=e;return t.jsx(Yf.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"})})});ey.displayName="Arrow";var ty=ey;function ny(e){const[t,n]=i.useState(void 0);return Tf(()=>{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 oy="Popper",[ry,iy]=Af(oy),[ay,sy]=ry(oy),ly=e=>{const{__scopePopper:n,children:o}=e,[r,a]=i.useState(null);return t.jsx(ay,{scope:n,anchor:r,onAnchorChange:a,children:o})};ly.displayName=oy;var cy="PopperAnchor",uy=i.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:r,...a}=e,s=sy(cy,o),l=i.useRef(null),c=$f(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(Yf.div,{...a,ref:c})});uy.displayName=cy;var dy="PopperContent",[fy,py]=ry(dy),hy=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=sy(dy,o),[x,w]=i.useState(null),E=$f(n,e=>w(e)),[k,S]=i.useState(null),C=ny(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(vy),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);Hg(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=Yg(u),P=Yg(r),O=Yg(d),R=i.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:t,strategy:n,middleware:h};P.current&&(e.platform=P.current),Bg(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==O.current};$.current&&!Hg(_.current,t)&&(_.current=t,a.flushSync(()=>{p(t)}))})},[h,t,n,P,O]);Fg(()=>{!1===d&&_.current.isPositioned&&(_.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);const $=i.useRef(!1);Fg(()=>($.current=!0,()=>{$.current=!1}),[]),Fg(()=>{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=Wg(D.floating,f.x),o=Wg(D.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+o+"px)",...Vg(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)=>$g(...e,{animationFrame:"always"===g}),elements:{reference:b.anchor},middleware:[Zg({mainAxis:s+N,alignmentAxis:c}),d&&Kg({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?qg():void 0,...$}),d&&Ug({...$}),Gg({...$,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&&Jg({element:k,padding:u}),by({arrowWidth:_,arrowHeight:N}),m&&Qg({strategy:"referenceHidden",...$})]}),[L,j]=xy(T),B=Xf(y);Tf(()=>{z&&B?.()},[z,B]);const F=I.arrow?.x,H=I.arrow?.y,V=0!==I.arrow?.centerOffset,[W,Y]=i.useState();return Tf(()=>{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(fy,{scope:o,placedSide:L,onArrowChange:S,arrowX:F,arrowY:H,shouldHideArrow:V,children:t.jsx(Yf.div,{"data-side":L,"data-align":j,...v,ref:E,style:{...v.style,animation:z?void 0:"none"}})})})});hy.displayName=dy;var my="PopperArrow",gy={top:"bottom",right:"left",bottom:"top",left:"right"},yy=i.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=py(my,o),a=gy[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(ty,{...r,ref:n,style:{...r.style,display:"block"}})})});function vy(e){return null!==e}yy.displayName=my;var by=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]=xy(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 xy(e){const[t,n="center"]=e.split("-");return[t,n]}var wy=ly,Ey=uy,ky=hy,Sy=yy;function Cy(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 _y=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(Yf.span,{...e,ref:n,style:{..._y,...e.style}})).displayName="VisuallyHidden";var Ny=[" ","Enter","ArrowUp","ArrowDown"],My=[" ","Enter"],Py="Select",[Oy,Ry,$y]=function(n){const o=n+"CollectionProvider",[r,i]=Af(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=Ff(c),d=e.forwardRef((e,n)=>{const{scope:o,children:r}=e,i=$f(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=Ff(f),m=e.forwardRef((n,o)=>{const{scope:r,children:i,...a}=n,l=e.useRef(null),c=$f(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]}(Py),[Ay,Dy]=Af(Py,[$y,iy]),Ty=iy(),[zy,Iy]=Ay(Py),[Ly,jy]=Ay(Py),By=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=Ty(n),[v,b]=i.useState(null),[x,w]=i.useState(null),[E,k]=i.useState(!1),S=function(e){const t=i.useContext(um);return e||t||"ltr"}(d),[C,_]=Bf({prop:r,defaultProp:a??!1,onChange:s,caller:Py}),[N,M]=Bf({prop:l,defaultProp:c,onChange:u,caller:Py}),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(wy,{...y,children:t.jsxs(zy,{required:m,scope:n,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:k,contentId:Lf(),value:N,onValueChange:M,open:C,onOpenChange:_,dir:S,triggerPointerDownPosRef:P,disabled:h,children:[t.jsx(Oy.Provider,{scope:n,children:t.jsx(Ly,{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(_v,{"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]})})};By.displayName=Py;var Fy="SelectTrigger",Hy=i.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:r=!1,...a}=e,s=Ty(o),l=Iy(Fy,o),c=l.disabled||r,u=$f(n,l.onTriggerChange),d=Ry(o),f=i.useRef("touch"),[p,h,m]=Mv(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===l.value),o=Pv(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(Ey,{asChild:!0,...s,children:t.jsx(Yf.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":Nv(l.value)?"":void 0,...a,ref:u,onClick:Pf(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Pf(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:Pf(a.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||Ny.includes(e.key)&&(g(),e.preventDefault())})})})});Hy.displayName=Fy;var Vy="SelectValue",Wy=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:i,children:a,placeholder:s="",...l}=e,c=Iy(Vy,o),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,f=$f(n,c.onValueNodeChange);return Tf(()=>{u(d)},[u,d]),t.jsx(Yf.span,{...l,ref:f,style:{pointerEvents:"none"},children:Nv(c.value)?t.jsx(t.Fragment,{children:s}):a})});Wy.displayName=Vy;var Yy=i.forwardRef((e,n)=>{const{__scopeSelect:o,children:r,...i}=e;return t.jsx(Yf.span,{"aria-hidden":!0,...i,ref:n,children:r||"▼"})});Yy.displayName="SelectIcon";var Xy=e=>t.jsx(fp,{asChild:!0,...e});Xy.displayName="SelectPortal";var Zy="SelectContent",Ky=i.forwardRef((e,n)=>{const o=Iy(Zy,e.__scopeSelect),[r,s]=i.useState();if(Tf(()=>{s(new DocumentFragment)},[]),!o.open){const n=r;return n?a.createPortal(t.jsx(Uy,{scope:e.__scopeSelect,children:t.jsx(Oy.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Jy,{...e,ref:n})});Ky.displayName=Zy;var qy=10,[Uy,Gy]=Ay(Zy),Qy=Ff("SelectContent.RemoveScroll"),Jy=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=Iy(Zy,o),[w,E]=i.useState(null),[k,S]=i.useState(null),C=$f(n,e=>E(e)),[_,N]=i.useState(null),[M,P]=i.useState(null),O=Ry(o),[R,$]=i.useState(!1),A=i.useRef(!1);i.useEffect(()=>{if(w)return fh(w)},[w]),gp();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]=Mv(e=>{const t=O().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),o=Pv(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?tv:ev,W=V===tv?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v}:{};return t.jsx(Uy,{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(ih,{as:Qy,allowPinchZoom:!0,children:t.jsx(ip,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Pf(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(Qf,{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:Pf(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()}})})})})})})});Jy.displayName="SelectContentImpl";var ev=i.forwardRef((e,n)=>{const{__scopeSelect:o,onPlaced:r,...a}=e,s=Iy(Zy,o),l=Gy(Zy,o),[c,u]=i.useState(null),[d,f]=i.useState(null),p=$f(n,e=>f(e)),h=Ry(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-qy,d=cm(i,[qy,Math.max(qy,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-qy,d=cm(i,[qy,Math.max(qy,u-l)]);c.style.minWidth=s+"px",c.style.right=d+"px"}const i=h(),a=window.innerHeight-2*qy,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-qy,_=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=`${qy}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]);Tf(()=>w(),[w]);const[E,k]=i.useState();Tf(()=>{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(nv,{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(Yf.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});ev.displayName="SelectItemAlignedPosition";var tv=i.forwardRef((e,n)=>{const{__scopeSelect:o,align:r="start",collisionPadding:i=qy,...a}=e,s=Ty(o);return t.jsx(ky,{...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)"}})});tv.displayName="SelectPopperPosition";var[nv,ov]=Ay(Zy,{}),rv="SelectViewport",iv=i.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:r,...a}=e,s=Gy(rv,o),l=ov(rv,o),c=$f(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(Oy.Slot,{scope:o,children:t.jsx(Yf.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Pf(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*qy,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})})})]})});iv.displayName=rv;var av="SelectGroup",[sv,lv]=Ay(av);i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=Lf();return t.jsx(sv,{scope:o,id:i,children:t.jsx(Yf.div,{role:"group","aria-labelledby":i,...r,ref:n})})}).displayName=av;var cv="SelectLabel",uv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=lv(cv,o);return t.jsx(Yf.div,{id:i.id,...r,ref:n})});uv.displayName=cv;var dv="SelectItem",[fv,pv]=Ay(dv),hv=i.forwardRef((e,n)=>{const{__scopeSelect:o,value:r,disabled:a=!1,textValue:s,...l}=e,c=Iy(dv,o),u=Gy(dv,o),d=c.value===r,[f,p]=i.useState(s??""),[h,m]=i.useState(!1),g=$f(n,e=>u.itemRefCallback?.(e,r,a)),y=Lf(),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(fv,{scope:o,value:r,disabled:a,textId:y,isSelected:d,onItemTextChange:i.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t.jsx(Oy.ItemSlot,{scope:o,value:r,disabled:a,textValue:f,children:t.jsx(Yf.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:Pf(l.onFocus,()=>m(!0)),onBlur:Pf(l.onBlur,()=>m(!1)),onClick:Pf(l.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:Pf(l.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:Pf(l.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:Pf(l.onPointerMove,e=>{v.current=e.pointerType,a?u.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pf(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Pf(l.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(My.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});hv.displayName=dv;var mv="SelectItemText",gv=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:s,...l}=e,c=Iy(mv,o),u=Gy(mv,o),d=pv(mv,o),f=jy(mv,o),[p,h]=i.useState(null),m=$f(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 Tf(()=>(v(y),()=>b(y)),[v,b,y]),t.jsxs(t.Fragment,{children:[t.jsx(Yf.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})});gv.displayName=mv;var yv="SelectItemIndicator",vv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return pv(yv,o).isSelected?t.jsx(Yf.span,{"aria-hidden":!0,...r,ref:n}):null});vv.displayName=yv;var bv="SelectScrollUpButton",xv=i.forwardRef((e,n)=>{const o=Gy(bv,e.__scopeSelect),r=ov(bv,e.__scopeSelect),[a,s]=i.useState(!1),l=$f(n,r.onScrollButtonChange);return Tf(()=>{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(kv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});xv.displayName=bv;var wv="SelectScrollDownButton",Ev=i.forwardRef((e,n)=>{const o=Gy(wv,e.__scopeSelect),r=ov(wv,e.__scopeSelect),[a,s]=i.useState(!1),l=$f(n,r.onScrollButtonChange);return Tf(()=>{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(kv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Ev.displayName=wv;var kv=i.forwardRef((e,n)=>{const{__scopeSelect:o,onAutoScroll:r,...a}=e,s=Gy("SelectScrollButton",o),l=i.useRef(null),c=Ry(o),u=i.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),Tf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),t.jsx(Yf.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:Pf(a.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(r,50))}),onPointerMove:Pf(a.onPointerMove,()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(r,50))}),onPointerLeave:Pf(a.onPointerLeave,()=>{u()})})}),Sv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return t.jsx(Yf.div,{"aria-hidden":!0,...r,ref:n})});Sv.displayName="SelectSeparator";var Cv="SelectArrow";i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=Ty(o),a=Iy(Cv,o),s=Gy(Cv,o);return a.open&&"popper"===s.position?t.jsx(Sy,{...i,...r,ref:n}):null}).displayName=Cv;var _v=i.forwardRef(({__scopeSelect:e,value:n,...o},r)=>{const a=i.useRef(null),s=$f(r,a),l=Cy(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(Yf.select,{...o,style:{..._y,...o.style},ref:s,defaultValue:n})});function Nv(e){return""===e||void 0===e}function Mv(e){const t=Xf(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 Pv(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}_v.displayName="SelectBubbleInput";var Ov=Hy,Rv=Yy,$v=Xy,Av=Ky,Dv=iv,Tv=uv,zv=hv,Iv=gv,Lv=vv,jv=xv,Bv=Ev,Fv=Sv;const Hv=By,Vv=Wy,Wv=Eu(Ov)`
680
+ `,Xf=({stamps:t,currentStep:n,onStepChange:o,onToggle:r})=>{const{theme:i}=gu(),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(Df,{theme:i},e.createElement(zf,{theme:i},e.createElement(If,{theme:i},"Timeline"),r&&e.createElement(Lf,{onClick:r,title:"Collapse Panel",theme:i},e.createElement(Hl,{size:16}))),e.createElement(jf,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(Bf,{key:l,isActive:u,isPast:d,hasStep:f,onClick:()=>f&&o(l),theme:i},e.createElement(Ff,null,e.createElement(Hf,{isActive:u,isPast:d,hasStep:f,theme:i}),e.createElement(Vf,{isActive:u,theme:i},"Step ",l),p&&e.createElement("div",{style:{marginLeft:"auto"}},e.createElement(ju,{variant:c(p)},Mu(p)))),e.createElement(Wf,{hasStep:f,theme:i},f?h:"No activity"),u&&e.createElement(Yf,{theme:i}))})))};function Zf(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),!1===n||!o.defaultPrevented)return t?.(o)}}function Kf(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function qf(...e){return t=>{let n=!1;const o=e.map(e=>{const o=Kf(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():Kf(e[t],null)}}}}function Uf(...e){return i.useCallback(qf(...e),e)}function Gf(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}\``)}]},Qf(r,...n)]}function Qf(...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 Jf=globalThis?.document?i.useLayoutEffect:()=>{},ep=i[" useId ".trim().toString()]||(()=>{}),tp=0;function np(e){const[t,n]=i.useState(ep());return Jf(()=>{e||n(e=>e??String(tp++))},[e]),e||(t?`radix-${t}`:"")}var op=i[" useInsertionEffect ".trim().toString()]||Jf;function rp({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 op(()=>{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 ip(e){const n=ap(e),o=i.forwardRef((e,o)=>{const{children:r,...a}=e,s=i.Children.toArray(r),l=s.find(lp);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 ap(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?qf(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 sp=Symbol("radix.slottable");function lp(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===sp}var cp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const o=ip(`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 up(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}var dp,fp="dismissableLayer.update",pp="dismissableLayer.pointerDownOutside",hp="dismissableLayer.focusOutside",mp=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gp=i.forwardRef((e,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(mp),[f,p]=i.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=Uf(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=up(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let o=function(){bp(pp,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=up(e),o=i.useRef(!1);return i.useEffect(()=>{const e=e=>{if(e.target&&!o.current){bp(hp,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=up(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&&(dp=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),vp(),()=>{o&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=dp)}},[f,h,o,d]),i.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),vp())},[f,d]),i.useEffect(()=>{const e=()=>m({});return document.addEventListener(fp,e),()=>document.removeEventListener(fp,e)},[]),t.jsx(cp.div,{...u,ref:g,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:Zf(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Zf(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Zf(e.onPointerDownCapture,k.onPointerDownCapture)})});gp.displayName="DismissableLayer";var yp=i.forwardRef((e,n)=>{const o=i.useContext(mp),r=i.useRef(null),a=Uf(n,r);return i.useEffect(()=>{const e=r.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}},[o.branches]),t.jsx(cp.div,{...e,ref:a})});function vp(){const e=new CustomEvent(fp);document.dispatchEvent(e)}function bp(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)}yp.displayName="DismissableLayerBranch";var xp="focusScope.autoFocusOnMount",wp="focusScope.autoFocusOnUnmount",Ep={bubbles:!1,cancelable:!0},kp=i.forwardRef((e,n)=>{const{loop:o=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=up(a),f=up(s),p=i.useRef(null),h=Uf(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:Np(p.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Np(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Np(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){Mp.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(xp,Ep);c.addEventListener(xp,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(Np(o,{select:t}),document.activeElement!==n)return}((e=Sp(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Np(c))}return()=>{c.removeEventListener(xp,d),setTimeout(()=>{const e=new CustomEvent(wp,Ep);c.addEventListener(wp,f),c.dispatchEvent(e),e.defaultPrevented||Np(t??document.body,{select:!0}),c.removeEventListener(wp,f),Mp.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=Sp(e),n=Cp(t,e),o=Cp(t.reverse(),e);return[n,o]}(t);r&&i?e.shiftKey||n!==i?e.shiftKey&&n===r&&(e.preventDefault(),o&&Np(i,{select:!0})):(e.preventDefault(),o&&Np(r,{select:!0})):n===t&&e.preventDefault()}},[o,r,m.paused]);return t.jsx(cp.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});function Sp(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 Cp(e,t){for(const n of e)if(!_p(n,{upTo:t}))return n}function _p(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 Np(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()}}kp.displayName="FocusScope";var Mp=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Pp(e,t),e.unshift(t)},remove(t){e=Pp(e,t),e[0]?.resume()}}}();function Pp(e,t){const n=[...e],o=n.indexOf(t);return-1!==o&&n.splice(o,1),n}var Rp=i.forwardRef((e,o)=>{const{container:r,...a}=e,[s,l]=i.useState(!1);Jf(()=>l(!0),[]);const c=r||s&&globalThis?.document?.body;return c?n.createPortal(t.jsx(cp.div,{...a,ref:o}),c):null});Rp.displayName="Portal";var Op=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=$p(o.current);a.current="mounted"===l?e:"none"},[l]),Jf(()=>{const t=o.current,n=r.current;if(n!==e){const o=a.current,i=$p(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]),Jf(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=$p(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=$p(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=Uf(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 $p(e){return e?.animationName||"none"}Op.displayName="Presence";var Ap=0;function Tp(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dp()),document.body.insertAdjacentElement("beforeend",e[1]??Dp()),Ap++,()=>{1===Ap&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ap--}},[])}function Dp(){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 zp=function(){return zp=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},zp.apply(this,arguments)};function Ip(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 Lp="right-scroll-bar-position",jp="width-before-scroll-bar";function Bp(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Fp="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,Hp=new WeakMap;function Vp(t,n){var o,r,i,a=(o=n||null,r=function(e){return t.forEach(function(t){return Bp(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 Fp(function(){var e=Hp.get(a);if(e){var n=new Set(e),o=new Set(t),r=a.current;n.forEach(function(e){o.has(e)||Bp(e,null)}),o.forEach(function(e){n.has(e)||Bp(e,r)})}Hp.set(a,t)},[t]),a}function Wp(e){return e}var Yp=function(e){var t=e.sideCar,n=Ip(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,zp({},n))};Yp.isSideCarExport=!0;var Xp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Wp);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=zp({async:!0,ssr:!1},e),t}(),Zp=function(){},Kp=i.forwardRef(function(e,t){var n=i.useRef(null),o=i.useState({onScrollCapture:Zp,onWheelCapture:Zp,onTouchMoveCapture:Zp}),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=Ip(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,k=Vp([n,t]),S=zp(zp({},w),r);return i.createElement(i.Fragment,null,d&&i.createElement(E,{sideCar:Xp,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),zp(zp({},S),{ref:k})):i.createElement(b,zp({},S,{className:c,ref:k}),l))});Kp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Kp.classNames={fullWidth:jp,zeroRight:Lp};function qp(){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 Up=function(){var e=0,t=null;return{add:function(n){var o,r;0==e&&(t=qp())&&(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)}}},Gp=function(){var e,t=(e=Up(),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}},Qp={left:0,top:0,right:0,gap:0},Jp=function(e){return parseInt(e||"",10)||0},eh=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Qp;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[Jp(n),Jp(o),Jp(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])}},th=Gp(),nh="data-scroll-locked",oh=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(nh,"] {\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(Lp," {\n right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(jp," {\n margin-right: ").concat(s,"px ").concat(o,";\n }\n \n .").concat(Lp," .").concat(Lp," {\n right: 0 ").concat(o,";\n }\n \n .").concat(jp," .").concat(jp," {\n margin-right: 0 ").concat(o,";\n }\n \n body[").concat(nh,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},rh=function(){var e=parseInt(document.body.getAttribute(nh)||"0",10);return isFinite(e)?e:0},ih=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(nh,(rh()+1).toString()),function(){var e=rh()-1;e<=0?document.body.removeAttribute(nh):document.body.setAttribute(nh,e.toString())}},[]);var a=i.useMemo(function(){return eh(r)},[r]);return i.createElement(th,{styles:oh(a,!t,r,n?"":"!important")})},ah=!1;if("undefined"!=typeof window)try{var sh=Object.defineProperty({},"passive",{get:function(){return ah=!0,!0}});window.addEventListener("test",sh,sh),window.removeEventListener("test",sh,sh)}catch(e){ah=!1}var lh=!!ah&&{passive:!1},ch=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])},uh=function(e,t){var n=t.ownerDocument,o=t;do{if("undefined"!=typeof ShadowRoot&&o instanceof ShadowRoot&&(o=o.host),dh(e,o)){var r=fh(e,o);if(r[1]>r[2])return!0}o=o.parentNode}while(o&&o!==n.body);return!1},dh=function(e,t){return"v"===e?function(e){return ch(e,"overflowY")}(t):function(e){return ch(e,"overflowX")}(t)},fh=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},ph=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hh=function(e){return[e.deltaX,e.deltaY]},mh=function(e){return e&&"current"in e?e.current:e},gh=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},yh=0,vh=[];function bh(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var xh,wh=(xh=function(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(yh++)[0],a=i.useState(Gp)[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(mh),!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=ph(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=uh(d,u);if(!f)return!0;if(f?r=d:(r="v"===d?"h":"v",f=uh(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=fh(e,s),h=p[0],m=p[1]-p[2]-i*h;(h||m)&&dh(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(vh.length&&vh[vh.length-1]===a){var o="deltaY"in n?hh(n):ph(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(mh).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:bh(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=ph(e),o.current=void 0},[]),f=i.useCallback(function(t){u(t.type,hh(t),t.target,l(t,e.lockRef.current))},[]),p=i.useCallback(function(t){u(t.type,ph(t),t.target,l(t,e.lockRef.current))},[]);i.useEffect(function(){return vh.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,lh),document.addEventListener("touchmove",c,lh),document.addEventListener("touchstart",d,lh),function(){vh=vh.filter(function(e){return e!==a}),document.removeEventListener("wheel",c,lh),document.removeEventListener("touchmove",c,lh),document.removeEventListener("touchstart",d,lh)}},[]);var h=e.removeScrollBar,m=e.inert;return i.createElement(i.Fragment,null,m?i.createElement(a,{styles:gh(r)}):null,h?i.createElement(ih,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Xp.useMedium(xh),Yp),Eh=i.forwardRef(function(e,t){return i.createElement(Kp,zp({},e,{ref:t,sideCar:wh}))});Eh.classNames=Kp.classNames;var kh=Eh,Sh=new WeakMap,Ch=new WeakMap,_h={},Nh=0,Mh=function(e){return e&&(e.host||Mh(e.parentNode))},Ph=function(e,t,n,o){var r=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Mh(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]);_h[n]||(_h[n]=new WeakMap);var i=_h[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=(Sh.get(e)||0)+1,c=(i.get(e)||0)+1;Sh.set(e,l),i.set(e,c),a.push(e),1===l&&r&&Ch.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(),Nh++,function(){a.forEach(function(e){var t=Sh.get(e)-1,r=i.get(e)-1;Sh.set(e,t),i.set(e,r),t||(Ch.has(e)||e.removeAttribute(o),Ch.delete(e)),r||e.removeAttribute(n)}),--Nh||(Sh=new WeakMap,Sh=new WeakMap,Ch=new WeakMap,_h={})}},Rh=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"))),Ph(o,r,n,"aria-hidden")):function(){return null}},Oh="Dialog",[$h,Ah]=Gf(Oh),[Th,Dh]=$h(Oh),zh=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]=rp({prop:r,defaultProp:a??!1,onChange:s,caller:Oh});return t.jsx(Th,{scope:n,triggerRef:c,contentRef:u,contentId:np(),titleId:np(),descriptionId:np(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(e=>!e),[f]),modal:l,children:o})};zh.displayName=Oh;var Ih="DialogTrigger",Lh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Dh(Ih,o),a=Uf(n,i.triggerRef);return t.jsx(cp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":rm(i.open),...r,ref:a,onClick:Zf(e.onClick,i.onOpenToggle)})});Lh.displayName=Ih;var jh="DialogPortal",[Bh,Fh]=$h(jh,{forceMount:void 0}),Hh=e=>{const{__scopeDialog:n,forceMount:o,children:r,container:a}=e,s=Dh(jh,n);return t.jsx(Bh,{scope:n,forceMount:o,children:i.Children.map(r,e=>t.jsx(Op,{present:o||s.open,children:t.jsx(Rp,{asChild:!0,container:a,children:e})}))})};Hh.displayName=jh;var Vh="DialogOverlay",Wh=i.forwardRef((e,n)=>{const o=Fh(Vh,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=Dh(Vh,e.__scopeDialog);return a.modal?t.jsx(Op,{present:r||a.open,children:t.jsx(Xh,{...i,ref:n})}):null});Wh.displayName=Vh;var Yh=ip("DialogOverlay.RemoveScroll"),Xh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Dh(Vh,o);return t.jsx(kh,{as:Yh,allowPinchZoom:!0,shards:[i.contentRef],children:t.jsx(cp.div,{"data-state":rm(i.open),...r,ref:n,style:{pointerEvents:"auto",...r.style}})})}),Zh="DialogContent",Kh=i.forwardRef((e,n)=>{const o=Fh(Zh,e.__scopeDialog),{forceMount:r=o.forceMount,...i}=e,a=Dh(Zh,e.__scopeDialog);return t.jsx(Op,{present:r||a.open,children:a.modal?t.jsx(qh,{...i,ref:n}):t.jsx(Uh,{...i,ref:n})})});Kh.displayName=Zh;var qh=i.forwardRef((e,n)=>{const o=Dh(Zh,e.__scopeDialog),r=i.useRef(null),a=Uf(n,o.contentRef,r);return i.useEffect(()=>{const e=r.current;if(e)return Rh(e)},[]),t.jsx(Gh,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Zf(e.onCloseAutoFocus,e=>{e.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:Zf(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Zf(e.onFocusOutside,e=>e.preventDefault())})}),Uh=i.forwardRef((e,n)=>{const o=Dh(Zh,e.__scopeDialog),r=i.useRef(!1),a=i.useRef(!1);return t.jsx(Gh,{...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()}})}),Gh=i.forwardRef((e,n)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=e,c=Dh(Zh,o),u=i.useRef(null),d=Uf(n,u);return Tp(),t.jsxs(t.Fragment,{children:[t.jsx(kp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:t.jsx(gp,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":rm(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(lm,{titleId:c.titleId}),t.jsx(cm,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Qh="DialogTitle",Jh=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Dh(Qh,o);return t.jsx(cp.h2,{id:i.titleId,...r,ref:n})});Jh.displayName=Qh;var em="DialogDescription",tm=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Dh(em,o);return t.jsx(cp.p,{id:i.descriptionId,...r,ref:n})});tm.displayName=em;var nm="DialogClose",om=i.forwardRef((e,n)=>{const{__scopeDialog:o,...r}=e,i=Dh(nm,o);return t.jsx(cp.button,{type:"button",...r,ref:n,onClick:Zf(e.onClick,()=>i.onOpenChange(!1))})});function rm(e){return e?"open":"closed"}om.displayName=nm;var im="DialogTitleWarning",[am,sm]=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}\``)}]}(im,{contentName:Zh,titleName:Qh,docsSlug:"dialog"}),lm=({titleId:e})=>{const t=sm(im),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},cm=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sm("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},um=zh,dm=Lh,fm=Hh,pm=Wh,hm=Kh,mm=Jh,gm=tm,ym=om;const vm=um,bm=dm,xm=fm,wm=i.forwardRef(({className:e,...t},n)=>i.createElement(pm,{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}));wm.displayName=pm.displayName;const Em=(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"}}},km=i.forwardRef(({side:e="right",className:t,children:n,...o},r)=>i.createElement(xm,null,i.createElement(wm,null),i.createElement(hm,{ref:r,style:Em(e),className:t,...o},n,i.createElement(ym,{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")))));km.displayName=hm.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(mm,{ref:n,style:{fontSize:"18px",fontWeight:600,color:"hsl(var(--foreground))"},className:e,...t})).displayName=mm.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(gm,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=gm.displayName;const Sm=(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},Cm={Agent:Tf,Tool:Tf,Coordinator:Tf},_m=({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=400,onInspect:u})=>{const{theme:d,isDarkMode:f}=gu(),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 Sm(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]),R=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]),O=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?Pu(String(e.stamp.identifier),50):void 0,data:{label:e.stamp?.identifier?Pu(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,T]=function(t){const[n,o]=e.useState(t),r=e.useCallback(e=>o(t=>ha(e,t)),[]);return[n,o,r]}(R),[D,z,I]=function(t){const[n,o]=e.useState(t),r=e.useCallback(e=>o(t=>ma(e,t)),[]);return[n,o,r]}(O);e.useEffect(()=>{A(R)},[R,A]),e.useEffect(()=>{z(O)},[O,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===R.length)return;const e=new Map;O.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&&R.length>0&&(t=R[0].id),t&&setTimeout(()=>{F.fitView({nodes:[{id:t}],duration:1e3,padding:.2,minZoom:i,maxZoom:1})},500)},[R,O,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(vm,{open:S,onOpenChange:C},e.createElement(bm,{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(Hl,{size:20,style:{color:p.mutedForeground}}))),e.createElement(xm,null,e.createElement(hm,{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(Xf,{stamps:h.stamps||h.steps||[],currentStep:b,onStepChange:j}))),e.createElement(ym,{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:D,onNodesChange:T,onEdgesChange:I,onConnect:L,nodeTypes:Cm,edgeTypes:{default:t=>e.createElement(yu,{...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 Nm(e,[t,n]){return Math.min(n,Math.max(t,e))}var Mm=i.createContext(void 0);const Pm=["top","right","bottom","left"],Rm=Math.min,Om=Math.max,$m=Math.round,Am=Math.floor,Tm=e=>({x:e,y:e}),Dm={left:"right",right:"left",bottom:"top",top:"bottom"},zm={start:"end",end:"start"};function Im(e,t,n){return Om(e,Rm(t,n))}function Lm(e,t){return"function"==typeof e?e(t):e}function jm(e){return e.split("-")[0]}function Bm(e){return e.split("-")[1]}function Fm(e){return"x"===e?"y":"x"}function Hm(e){return"y"===e?"height":"width"}const Vm=new Set(["top","bottom"]);function Wm(e){return Vm.has(jm(e))?"y":"x"}function Ym(e){return Fm(Wm(e))}function Xm(e){return e.replace(/start|end/g,e=>zm[e])}const Zm=["left","right"],Km=["right","left"],qm=["top","bottom"],Um=["bottom","top"];function Gm(e,t,n,o){const r=Bm(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Km:Zm:t?Zm:Km;case"left":case"right":return t?qm:Um;default:return[]}}(jm(e),"start"===n,o);return r&&(i=i.map(e=>e+"-"+r),t&&(i=i.concat(i.map(Xm)))),i}function Qm(e){return e.replace(/left|right|bottom|top/g,e=>Dm[e])}function Jm(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 eg(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 tg(e,t,n){let{reference:o,floating:r}=e;const i=Wm(t),a=Ym(t),s=Hm(a),l=jm(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(Bm(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function ng(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}=Lm(t,e),h=Jm(p),m=s[f?"floating"===d?"reference":"floating":d],g=eg(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=eg(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 og(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rg(e){return Pm.some(t=>e[t]>=0)}const ig=new Set(["left","top"]);function ag(){return"undefined"!=typeof window}function sg(e){return ug(e)?(e.nodeName||"").toLowerCase():"#document"}function lg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function cg(e){var t;return null==(t=(ug(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ug(e){return!!ag()&&(e instanceof Node||e instanceof lg(e).Node)}function dg(e){return!!ag()&&(e instanceof Element||e instanceof lg(e).Element)}function fg(e){return!!ag()&&(e instanceof HTMLElement||e instanceof lg(e).HTMLElement)}function pg(e){return!(!ag()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof lg(e).ShadowRoot)}const hg=new Set(["inline","contents"]);function mg(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ng(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!hg.has(r)}const gg=new Set(["table","td","th"]);function yg(e){return gg.has(sg(e))}const vg=[":popover-open",":modal"];function bg(e){return vg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const xg=["transform","translate","scale","rotate","perspective"],wg=["transform","translate","scale","rotate","perspective","filter"],Eg=["paint","layout","strict","content"];function kg(e){const t=Sg(),n=dg(e)?Ng(e):e;return xg.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||wg.some(e=>(n.willChange||"").includes(e))||Eg.some(e=>(n.contain||"").includes(e))}function Sg(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Cg=new Set(["html","body","#document"]);function _g(e){return Cg.has(sg(e))}function Ng(e){return lg(e).getComputedStyle(e)}function Mg(e){return dg(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pg(e){if("html"===sg(e))return e;const t=e.assignedSlot||e.parentNode||pg(e)&&e.host||cg(e);return pg(t)?t.host:t}function Rg(e){const t=Pg(e);return _g(t)?e.ownerDocument?e.ownerDocument.body:e.body:fg(t)&&mg(t)?t:Rg(t)}function Og(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Rg(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),a=lg(r);if(i){const e=$g(a);return t.concat(a,a.visualViewport||[],mg(r)?r:[],e&&n?Og(e):[])}return t.concat(r,Og(r,[],n))}function $g(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ag(e){const t=Ng(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=fg(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:o,s=$m(n)!==i||$m(o)!==a;return s&&(n=i,o=a),{width:n,height:o,$:s}}function Tg(e){return dg(e)?e:e.contextElement}function Dg(e){const t=Tg(e);if(!fg(t))return Tm(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Ag(t);let a=(i?$m(n.width):n.width)/o,s=(i?$m(n.height):n.height)/r;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const zg=Tm(0);function Ig(e){const t=lg(e);return Sg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:zg}function Lg(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=Tg(e);let a=Tm(1);t&&(o?dg(o)&&(a=Dg(o)):a=Dg(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==lg(e))&&t}(i,n,o)?Ig(i):Tm(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=lg(i),t=o&&dg(o)?lg(o):o;let n=e,r=$g(n);for(;r&&o&&t!==n;){const e=Dg(r),t=r.getBoundingClientRect(),o=Ng(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=lg(r),r=$g(n)}}return eg({width:u,height:d,x:l,y:c})}function jg(e,t){const n=Mg(e).scrollLeft;return t?t.left+n:Lg(cg(e)).left+n}function Bg(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-jg(e,n),y:n.top+t.scrollTop}}const Fg=new Set(["absolute","fixed"]);function Hg(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=lg(e),o=cg(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=Sg();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}const c=jg(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=cg(e),n=Mg(e),o=e.ownerDocument.body,r=Om(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Om(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+jg(e);const s=-n.scrollTop;return"rtl"===Ng(o).direction&&(a+=Om(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:a,y:s}}(cg(e));else if(dg(t))o=function(e,t){const n=Lg(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=fg(e)?Dg(e):Tm(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=Ig(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return eg(o)}function Vg(e,t){const n=Pg(e);return!(n===t||!dg(n)||_g(n))&&("fixed"===Ng(n).position||Vg(n,t))}function Wg(e,t,n){const o=fg(t),r=cg(t),i="fixed"===n,a=Lg(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Tm(0);function c(){l.x=jg(r)}if(o||!o&&!i)if(("body"!==sg(t)||mg(r))&&(s=Mg(t)),o){const e=Lg(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?Tm(0):Bg(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 Yg(e){return"static"===Ng(e).position}function Xg(e,t){if(!fg(e)||"fixed"===Ng(e).position)return null;if(t)return t(e);let n=e.offsetParent;return cg(e)===n&&(n=n.ownerDocument.body),n}function Zg(e,t){const n=lg(e);if(bg(e))return n;if(!fg(e)){let t=Pg(e);for(;t&&!_g(t);){if(dg(t)&&!Yg(t))return t;t=Pg(t)}return n}let o=Xg(e,t);for(;o&&yg(o)&&Yg(o);)o=Xg(o,t);return o&&_g(o)&&Yg(o)&&!kg(o)?n:o||function(e){let t=Pg(e);for(;fg(t)&&!_g(t);){if(kg(t))return t;if(bg(t))return null;t=Pg(t)}return null}(e)||n}const Kg={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,a=cg(o),s=!!t&&bg(t.floating);if(o===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Tm(1);const u=Tm(0),d=fg(o);if((d||!d&&!i)&&(("body"!==sg(o)||mg(a))&&(l=Mg(o)),fg(o))){const e=Lg(o);c=Dg(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const f=!a||d||i?Tm(0):Bg(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:cg,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i="clippingAncestors"===n?bg(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Og(e,[],!1).filter(e=>dg(e)&&"body"!==sg(e)),r=null;const i="fixed"===Ng(e).position;let a=i?Pg(e):e;for(;dg(a)&&!_g(a);){const t=Ng(a),n=kg(a);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&Fg.has(r.position)||mg(a)&&!n&&Vg(e,a))?o=o.filter(e=>e!==a):r=t,a=Pg(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=Hg(t,n,r);return e.top=Om(o.top,e.top),e.right=Rm(o.right,e.right),e.bottom=Rm(o.bottom,e.bottom),e.left=Om(o.left,e.left),e},Hg(t,s,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Zg,getElementRects:async function(e){const t=this.getOffsetParent||Zg,n=this.getDimensions,o=await n(e.floating);return{reference:Wg(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}=Ag(e);return{width:t,height:n}},getScale:Dg,isElement:dg,isRTL:function(e){return"rtl"===Ng(e).direction}};function qg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ug(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=Tg(e),u=r||i?[...c?Og(c):[],...Og(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=cg(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:-Am(d)+"px "+-Am(r.clientWidth-(u+f))+"px "+-Am(r.clientHeight-(d+p))+"px "+-Am(u)+"px",threshold:Om(0,Rm(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||qg(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?Lg(e):null;return l&&function t(){const o=Lg(e);m&&!qg(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 Gg=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=jm(n),s=Bm(n),l="y"===Wm(n),c=ig.has(a)?-1:1,u=i&&l?-1:1,d=Lm(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}}}}},Qg=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}=Lm(e,t),c={x:n,y:o},u=await ng(t,l),d=Wm(jm(r)),f=Fm(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Im(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";h=Im(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}}}}}},Jg=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}=Lm(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=jm(r),v=Wm(s),b=jm(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(b||!m?[Qm(s)]:function(e){const t=Qm(e);return[Xm(e),t,Xm(t)]}(s)),E="none"!==h;!f&&E&&w.push(...Gm(s,m,h,x));const k=[s,...w],S=await ng(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=Bm(e),r=Ym(e),i=Hm(r);let a="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Qm(a)),[a,Qm(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!==Wm(t))||_.every(e=>Wm(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=Wm(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{}}}},ey=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}=Lm(e,t),u=await ng(t,c),d=jm(r),f=Bm(r),p="y"===Wm(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=Rm(m-u[g],v),w=Rm(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=Om(u.left,0),t=Om(u.right,0),n=Om(u.top,0),o=Om(u.bottom,0);p?S=h-2*(0!==e||0!==t?e+t:Om(u.left,u.right)):k=m-2*(0!==n||0!==o?n+o:Om(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}}:{}}}},ty=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=Lm(e,t);switch(o){case"referenceHidden":{const e=og(await ng(t,{...r,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:rg(e)}}}case"escaped":{const e=og(await ng(t,{...r,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:rg(e)}}}default:return{}}}}},ny=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}=Lm(e,t)||{};if(null==c)return{};const d=Jm(u),f={x:n,y:o},p=Ym(r),h=Hm(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,_=Rm(d[y],C),N=Rm(d[v],C),M=_,P=k-m[h]-N,R=k/2-m[h]/2+S,O=Im(M,R,P),$=!l.arrow&&null!=Bm(r)&&R!==O&&i.reference[h]/2-(R<M?_:N)-m[h]/2<0,A=$?R<M?R-M:R-P:0;return{[p]:f[p]+A,data:{[p]:O,centerOffset:R-O-A,...$&&{alignmentOffset:A}},reset:$}}}),oy=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}=Lm(e,t),u={x:n,y:o},d=Wm(r),f=Fm(d);let p=u[f],h=u[d];const m=Lm(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=ig.has(jm(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}}}},ry=(e,t,n)=>{const o=new Map,r={platform:Kg,...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}=tg(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}=tg(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var iy="undefined"!=typeof document?e.useLayoutEffect:function(){};function ay(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(!ay(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)&&!ay(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function sy(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ly(e,t){const n=sy(e);return Math.round(t*n)/n}function cy(e){const t=i.useRef(e);return iy(()=>{t.current=e}),t}const uy=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?ny({element:n.current,padding:o}).fn(t):{}:n?ny({element:n,padding:o}).fn(t):{};var r}}),dy=(e,t)=>({...Gg(e),options:[e,t]}),fy=(e,t)=>({...Qg(e),options:[e,t]}),py=(e,t)=>({...oy(e),options:[e,t]}),hy=(e,t)=>({...Jg(e),options:[e,t]}),my=(e,t)=>({...ey(e),options:[e,t]}),gy=(e,t)=>({...ty(e),options:[e,t]}),yy=(e,t)=>({...uy(e),options:[e,t]});var vy=i.forwardRef((e,n)=>{const{children:o,width:r=10,height:i=5,...a}=e;return t.jsx(cp.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"})})});vy.displayName="Arrow";var by=vy;function xy(e){const[t,n]=i.useState(void 0);return Jf(()=>{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 wy="Popper",[Ey,ky]=Gf(wy),[Sy,Cy]=Ey(wy),_y=e=>{const{__scopePopper:n,children:o}=e,[r,a]=i.useState(null);return t.jsx(Sy,{scope:n,anchor:r,onAnchorChange:a,children:o})};_y.displayName=wy;var Ny="PopperAnchor",My=i.forwardRef((e,n)=>{const{__scopePopper:o,virtualRef:r,...a}=e,s=Cy(Ny,o),l=i.useRef(null),c=Uf(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(cp.div,{...a,ref:c})});My.displayName=Ny;var Py="PopperContent",[Ry,Oy]=Ey(Py),$y=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=Cy(Py,o),[x,w]=i.useState(null),E=Uf(n,e=>w(e)),[k,S]=i.useState(null),C=xy(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},R=Array.isArray(f)?f:[f],O=R.length>0,$={padding:P,boundary:R.filter(zy),altBoundary:O},{refs:A,floatingStyles:T,placement:D,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);ay(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=cy(u),P=cy(r),R=cy(d),O=i.useCallback(()=>{if(!S.current||!C.current)return;const e={placement:t,strategy:n,middleware:h};P.current&&(e.platform=P.current),ry(S.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};$.current&&!ay(_.current,t)&&(_.current=t,a.flushSync(()=>{p(t)}))})},[h,t,n,P,R]);iy(()=>{!1===d&&_.current.isPositioned&&(_.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);const $=i.useRef(!1);iy(()=>($.current=!0,()=>{$.current=!1}),[]),iy(()=>{if(E&&(S.current=E),k&&(C.current=k),E&&k){if(M.current)return M.current(E,k,O);O()}},[E,k,O,M,N]);const A=i.useMemo(()=>({reference:S,floating:C,setReference:x,setFloating:w}),[x,w]),T=i.useMemo(()=>({reference:E,floating:k}),[E,k]),D=i.useMemo(()=>{const e={position:n,left:0,top:0};if(!T.floating)return e;const t=ly(T.floating,f.x),o=ly(T.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+o+"px)",...sy(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}},[n,c,T.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:O,refs:A,elements:T,floatingStyles:D}),[f,O,A,T,D])}({strategy:"fixed",placement:M,whileElementsMounted:(...e)=>Ug(...e,{animationFrame:"always"===g}),elements:{reference:b.anchor},middleware:[dy({mainAxis:s+N,alignmentAxis:c}),d&&fy({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?py():void 0,...$}),d&&hy({...$}),my({...$,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&&yy({element:k,padding:u}),Iy({arrowWidth:_,arrowHeight:N}),m&&gy({strategy:"referenceHidden",...$})]}),[L,j]=Ly(D),B=up(y);Jf(()=>{z&&B?.()},[z,B]);const F=I.arrow?.x,H=I.arrow?.y,V=0!==I.arrow?.centerOffset,[W,Y]=i.useState();return Jf(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),t.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:z?T.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(Ry,{scope:o,placedSide:L,onArrowChange:S,arrowX:F,arrowY:H,shouldHideArrow:V,children:t.jsx(cp.div,{"data-side":L,"data-align":j,...v,ref:E,style:{...v.style,animation:z?void 0:"none"}})})})});$y.displayName=Py;var Ay="PopperArrow",Ty={top:"bottom",right:"left",bottom:"top",left:"right"},Dy=i.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=Oy(Ay,o),a=Ty[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(by,{...r,ref:n,style:{...r.style,display:"block"}})})});function zy(e){return null!==e}Dy.displayName=Ay;var Iy=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]=Ly(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 Ly(e){const[t,n="center"]=e.split("-");return[t,n]}var jy=_y,By=My,Fy=$y,Hy=Dy;function Vy(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 Wy=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(cp.span,{...e,ref:n,style:{...Wy,...e.style}})).displayName="VisuallyHidden";var Yy=[" ","Enter","ArrowUp","ArrowDown"],Xy=[" ","Enter"],Zy="Select",[Ky,qy,Uy]=function(n){const o=n+"CollectionProvider",[r,i]=Gf(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=ip(c),d=e.forwardRef((e,n)=>{const{scope:o,children:r}=e,i=Uf(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=ip(f),m=e.forwardRef((n,o)=>{const{scope:r,children:i,...a}=n,l=e.useRef(null),c=Uf(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]}(Zy),[Gy,Qy]=Gf(Zy,[Uy,ky]),Jy=ky(),[ev,tv]=Gy(Zy),[nv,ov]=Gy(Zy),rv=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=Jy(n),[v,b]=i.useState(null),[x,w]=i.useState(null),[E,k]=i.useState(!1),S=function(e){const t=i.useContext(Mm);return e||t||"ltr"}(d),[C,_]=rp({prop:r,defaultProp:a??!1,onChange:s,caller:Zy}),[N,M]=rp({prop:l,defaultProp:c,onChange:u,caller:Zy}),P=i.useRef(null),R=!v||(g||!!v.closest("form")),[O,$]=i.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(";");return t.jsx(jy,{...y,children:t.jsxs(ev,{required:m,scope:n,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:k,contentId:np(),value:N,onValueChange:M,open:C,onOpenChange:_,dir:S,triggerPointerDownPosRef:P,disabled:h,children:[t.jsx(Ky.Provider,{scope:n,children:t.jsx(nv,{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})}),R?t.jsxs(Wv,{"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(O)]},A):null]})})};rv.displayName=Zy;var iv="SelectTrigger",av=i.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:r=!1,...a}=e,s=Jy(o),l=tv(iv,o),c=l.disabled||r,u=Uf(n,l.onTriggerChange),d=qy(o),f=i.useRef("touch"),[p,h,m]=Xv(e=>{const t=d().filter(e=>!e.disabled),n=t.find(e=>e.value===l.value),o=Zv(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(By,{asChild:!0,...s,children:t.jsx(cp.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":Yv(l.value)?"":void 0,...a,ref:u,onClick:Zf(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Zf(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:Zf(a.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||Yy.includes(e.key)&&(g(),e.preventDefault())})})})});av.displayName=iv;var sv="SelectValue",lv=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:i,children:a,placeholder:s="",...l}=e,c=tv(sv,o),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,f=Uf(n,c.onValueNodeChange);return Jf(()=>{u(d)},[u,d]),t.jsx(cp.span,{...l,ref:f,style:{pointerEvents:"none"},children:Yv(c.value)?t.jsx(t.Fragment,{children:s}):a})});lv.displayName=sv;var cv=i.forwardRef((e,n)=>{const{__scopeSelect:o,children:r,...i}=e;return t.jsx(cp.span,{"aria-hidden":!0,...i,ref:n,children:r||"▼"})});cv.displayName="SelectIcon";var uv=e=>t.jsx(Rp,{asChild:!0,...e});uv.displayName="SelectPortal";var dv="SelectContent",fv=i.forwardRef((e,n)=>{const o=tv(dv,e.__scopeSelect),[r,s]=i.useState();if(Jf(()=>{s(new DocumentFragment)},[]),!o.open){const n=r;return n?a.createPortal(t.jsx(hv,{scope:e.__scopeSelect,children:t.jsx(Ky.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(yv,{...e,ref:n})});fv.displayName=dv;var pv=10,[hv,mv]=Gy(dv),gv=ip("SelectContent.RemoveScroll"),yv=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=tv(dv,o),[w,E]=i.useState(null),[k,S]=i.useState(null),C=Uf(n,e=>E(e)),[_,N]=i.useState(null),[M,P]=i.useState(null),R=qy(o),[O,$]=i.useState(!1),A=i.useRef(!1);i.useEffect(()=>{if(w)return Rh(w)},[w]),Tp();const T=i.useCallback(e=>{const[t,...n]=R().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}},[R,k]),D=i.useCallback(()=>T([_,w]),[T,_,w]);i.useEffect(()=>{O&&D()},[O,D]);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]=Xv(e=>{const t=R().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),o=Zv(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?bv:vv,W=V===bv?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:y,avoidCollisions:v}:{};return t.jsx(hv,{scope:o,content:w,viewport:k,onViewportChange:S,itemRefCallback:B,selectedItem:_,onItemLeave:F,itemTextRefCallback:H,focusSelectedItem:D,selectedItemText:M,position:r,isPositioned:O,searchRef:L,children:t.jsx(kh,{as:gv,allowPinchZoom:!0,children:t.jsx(kp,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Zf(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t.jsx(gp,{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:Zf(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=R().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(()=>T(t)),e.preventDefault()}})})})})})})});yv.displayName="SelectContentImpl";var vv=i.forwardRef((e,n)=>{const{__scopeSelect:o,onPlaced:r,...a}=e,s=tv(dv,o),l=mv(dv,o),[c,u]=i.useState(null),[d,f]=i.useState(null),p=Uf(n,e=>f(e)),h=qy(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-pv,d=Nm(i,[pv,Math.max(pv,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-pv,d=Nm(i,[pv,Math.max(pv,u-l)]);c.style.minWidth=s+"px",c.style.right=d+"px"}const i=h(),a=window.innerHeight-2*pv,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-pv,_=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=`${pv}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]);Jf(()=>w(),[w]);const[E,k]=i.useState();Jf(()=>{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(xv,{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(cp.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});vv.displayName="SelectItemAlignedPosition";var bv=i.forwardRef((e,n)=>{const{__scopeSelect:o,align:r="start",collisionPadding:i=pv,...a}=e,s=Jy(o);return t.jsx(Fy,{...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)"}})});bv.displayName="SelectPopperPosition";var[xv,wv]=Gy(dv,{}),Ev="SelectViewport",kv=i.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:r,...a}=e,s=mv(Ev,o),l=wv(Ev,o),c=Uf(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(Ky.Slot,{scope:o,children:t.jsx(cp.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Zf(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*pv,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})})})]})});kv.displayName=Ev;var Sv="SelectGroup",[Cv,_v]=Gy(Sv);i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=np();return t.jsx(Cv,{scope:o,id:i,children:t.jsx(cp.div,{role:"group","aria-labelledby":i,...r,ref:n})})}).displayName=Sv;var Nv="SelectLabel",Mv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=_v(Nv,o);return t.jsx(cp.div,{id:i.id,...r,ref:n})});Mv.displayName=Nv;var Pv="SelectItem",[Rv,Ov]=Gy(Pv),$v=i.forwardRef((e,n)=>{const{__scopeSelect:o,value:r,disabled:a=!1,textValue:s,...l}=e,c=tv(Pv,o),u=mv(Pv,o),d=c.value===r,[f,p]=i.useState(s??""),[h,m]=i.useState(!1),g=Uf(n,e=>u.itemRefCallback?.(e,r,a)),y=np(),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(Rv,{scope:o,value:r,disabled:a,textId:y,isSelected:d,onItemTextChange:i.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t.jsx(Ky.ItemSlot,{scope:o,value:r,disabled:a,textValue:f,children:t.jsx(cp.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:Zf(l.onFocus,()=>m(!0)),onBlur:Zf(l.onBlur,()=>m(!1)),onClick:Zf(l.onClick,()=>{"mouse"!==v.current&&b()}),onPointerUp:Zf(l.onPointerUp,()=>{"mouse"===v.current&&b()}),onPointerDown:Zf(l.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:Zf(l.onPointerMove,e=>{v.current=e.pointerType,a?u.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Zf(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Zf(l.onKeyDown,e=>{""!==u.searchRef?.current&&" "===e.key||(Xy.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});$v.displayName=Pv;var Av="SelectItemText",Tv=i.forwardRef((e,n)=>{const{__scopeSelect:o,className:r,style:s,...l}=e,c=tv(Av,o),u=mv(Av,o),d=Ov(Av,o),f=ov(Av,o),[p,h]=i.useState(null),m=Uf(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 Jf(()=>(v(y),()=>b(y)),[v,b,y]),t.jsxs(t.Fragment,{children:[t.jsx(cp.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})});Tv.displayName=Av;var Dv="SelectItemIndicator",zv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return Ov(Dv,o).isSelected?t.jsx(cp.span,{"aria-hidden":!0,...r,ref:n}):null});zv.displayName=Dv;var Iv="SelectScrollUpButton",Lv=i.forwardRef((e,n)=>{const o=mv(Iv,e.__scopeSelect),r=wv(Iv,e.__scopeSelect),[a,s]=i.useState(!1),l=Uf(n,r.onScrollButtonChange);return Jf(()=>{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(Fv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});Lv.displayName=Iv;var jv="SelectScrollDownButton",Bv=i.forwardRef((e,n)=>{const o=mv(jv,e.__scopeSelect),r=wv(jv,e.__scopeSelect),[a,s]=i.useState(!1),l=Uf(n,r.onScrollButtonChange);return Jf(()=>{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(Fv,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});Bv.displayName=jv;var Fv=i.forwardRef((e,n)=>{const{__scopeSelect:o,onAutoScroll:r,...a}=e,s=mv("SelectScrollButton",o),l=i.useRef(null),c=qy(o),u=i.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),Jf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),t.jsx(cp.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:Zf(a.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(r,50))}),onPointerMove:Zf(a.onPointerMove,()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(r,50))}),onPointerLeave:Zf(a.onPointerLeave,()=>{u()})})}),Hv=i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e;return t.jsx(cp.div,{"aria-hidden":!0,...r,ref:n})});Hv.displayName="SelectSeparator";var Vv="SelectArrow";i.forwardRef((e,n)=>{const{__scopeSelect:o,...r}=e,i=Jy(o),a=tv(Vv,o),s=mv(Vv,o);return a.open&&"popper"===s.position?t.jsx(Hy,{...i,...r,ref:n}):null}).displayName=Vv;var Wv=i.forwardRef(({__scopeSelect:e,value:n,...o},r)=>{const a=i.useRef(null),s=Uf(r,a),l=Vy(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(cp.select,{...o,style:{...Wy,...o.style},ref:s,defaultValue:n})});function Yv(e){return""===e||void 0===e}function Xv(e){const t=up(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 Zv(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}Wv.displayName="SelectBubbleInput";var Kv=av,qv=cv,Uv=uv,Gv=fv,Qv=kv,Jv=Mv,eb=$v,tb=Tv,nb=zv,ob=Lv,rb=Bv,ib=Hv;const ab=rv,sb=lv,lb=Su(Kv)`
664
681
  display: flex;
665
682
  height: 2.5rem;
666
683
  width: 100%;
@@ -690,32 +707,32 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
690
707
  &[data-placeholder] {
691
708
  color: ${e=>e.$theme.colors.mutedForeground};
692
709
  }
693
- `,Yv=Eu(zl)`
710
+ `,cb=Su(zl)`
694
711
  height: 1rem;
695
712
  width: 1rem;
696
713
  opacity: 0.5;
697
714
  color: ${e=>e.$theme.colors.mutedForeground};
698
- `,Xv=Eu(jv)`
715
+ `,ub=Su(ob)`
699
716
  display: flex;
700
717
  cursor: default;
701
718
  align-items: center;
702
719
  justify-content: center;
703
720
  padding: 0.25rem;
704
- `,Zv=Eu(Ll)`
721
+ `,db=Su(Ll)`
705
722
  height: 1rem;
706
723
  width: 1rem;
707
724
  color: ${e=>e.$theme.colors.mutedForeground};
708
- `,Kv=Eu(Bv)`
725
+ `,fb=Su(rb)`
709
726
  display: flex;
710
727
  cursor: default;
711
728
  align-items: center;
712
729
  justify-content: center;
713
730
  padding: 0.25rem;
714
- `,qv=Eu(zl)`
731
+ `,pb=Su(zl)`
715
732
  height: 1rem;
716
733
  width: 1rem;
717
734
  color: ${e=>e.$theme.colors.mutedForeground};
718
- `,Uv=Eu(Av)`
735
+ `,hb=Su(Gv)`
719
736
  position: relative;
720
737
  z-index: 50;
721
738
  min-width: 8rem;
@@ -737,13 +754,13 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
737
754
  transform: translateY(0);
738
755
  }
739
756
  }
740
- `,Gv=Eu(Tv)`
757
+ `,mb=Su(Jv)`
741
758
  padding: 0.375rem 0.75rem;
742
759
  padding-left: 2rem;
743
760
  font-size: ${e=>e.$theme.fontSize.sm};
744
761
  font-weight: ${e=>e.$theme.fontWeight.semibold};
745
762
  color: ${e=>e.$theme.colors.foreground};
746
- `,Qv=Eu(zv)`
763
+ `,gb=Su(eb)`
747
764
  position: relative;
748
765
  display: flex;
749
766
  cursor: default;
@@ -770,7 +787,7 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
770
787
  background-color: ${e=>e.$theme.colors.accent};
771
788
  color: ${e=>e.$theme.colors.accentForeground};
772
789
  }
773
- `,Jv=Eu.span`
790
+ `,yb=Su.span`
774
791
  position: absolute;
775
792
  left: 0.5rem;
776
793
  display: flex;
@@ -778,69 +795,69 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
778
795
  width: 0.875rem;
779
796
  align-items: center;
780
797
  justify-content: center;
781
- `,eb=Eu(Tl)`
798
+ `,vb=Su(Dl)`
782
799
  height: 1rem;
783
800
  width: 1rem;
784
801
  color: ${e=>e.$theme.colors.primary};
785
- `,tb=Eu(Fv)`
802
+ `,bb=Su(ib)`
786
803
  margin: 0.25rem -0.25rem;
787
804
  height: 1px;
788
805
  background-color: ${e=>e.$theme.colors.border};
789
- `,nb=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=hu();return i.createElement(Wv,{ref:n,$theme:o,...t},e,i.createElement(Rv,{asChild:!0},i.createElement(Yv,{$theme:o})))});nb.displayName=Ov.displayName;const ob=i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(Xv,{ref:t,...e},i.createElement(Zv,{$theme:n}))});ob.displayName=jv.displayName;const rb=i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(Kv,{ref:t,...e},i.createElement(qv,{$theme:n}))});rb.displayName=Bv.displayName;const ib=i.forwardRef(({children:e,position:t="popper",...n},o)=>{const{theme:r}=hu();return i.createElement($v,null,i.createElement(Uv,{ref:o,position:t,$theme:r,...n},i.createElement(ob,null),i.createElement(Dv,{style:{padding:"4px"}},e),i.createElement(rb,null)))});ib.displayName=Av.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(Gv,{ref:t,$theme:n,...e})}).displayName=Tv.displayName;const ab=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=hu();return i.createElement(Qv,{ref:n,$theme:o,...t},i.createElement(Jv,null,i.createElement(Lv,null,i.createElement(eb,{$theme:o}))),i.createElement(Iv,null,e))});ab.displayName=zv.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=hu();return i.createElement(tb,{ref:t,$theme:n,...e})}).displayName=Fv.displayName;const sb=Eu.div`
806
+ `,xb=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=gu();return i.createElement(lb,{ref:n,$theme:o,...t},e,i.createElement(qv,{asChild:!0},i.createElement(cb,{$theme:o})))});xb.displayName=Kv.displayName;const wb=i.forwardRef(({...e},t)=>{const{theme:n}=gu();return i.createElement(ub,{ref:t,...e},i.createElement(db,{$theme:n}))});wb.displayName=ob.displayName;const Eb=i.forwardRef(({...e},t)=>{const{theme:n}=gu();return i.createElement(fb,{ref:t,...e},i.createElement(pb,{$theme:n}))});Eb.displayName=rb.displayName;const kb=i.forwardRef(({children:e,position:t="popper",...n},o)=>{const{theme:r}=gu();return i.createElement(Uv,null,i.createElement(hb,{ref:o,position:t,$theme:r,...n},i.createElement(wb,null),i.createElement(Qv,{style:{padding:"4px"}},e),i.createElement(Eb,null)))});kb.displayName=Gv.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=gu();return i.createElement(mb,{ref:t,$theme:n,...e})}).displayName=Jv.displayName;const Sb=i.forwardRef(({children:e,...t},n)=>{const{theme:o}=gu();return i.createElement(gb,{ref:n,$theme:o,...t},i.createElement(yb,null,i.createElement(nb,null,i.createElement(vb,{$theme:o}))),i.createElement(tb,null,e))});Sb.displayName=eb.displayName;i.forwardRef(({...e},t)=>{const{theme:n}=gu();return i.createElement(bb,{ref:t,$theme:n,...e})}).displayName=ib.displayName;const Cb=Su.div`
790
807
  display: flex;
791
808
  align-items: center;
792
809
  gap: 0.5rem;
793
810
  width: 100%;
794
- `,lb=Eu.div`
811
+ `,_b=Su.div`
795
812
  display: flex;
796
813
  align-items: center;
797
814
  height: 2.5rem;
798
815
  padding: 0.5rem 0.75rem;
799
- color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
800
- font-size: ${()=>{const{theme:e}=hu();return e.fontSize.sm}};
801
- background-color: ${()=>{const{theme:e}=hu();return e.colors.background}};
802
- border-radius: ${()=>{const{theme:e}=hu();return e.borderRadius.md}};
816
+ color: ${()=>{const{theme:e}=gu();return e.colors.mutedForeground}};
817
+ font-size: ${()=>{const{theme:e}=gu();return e.fontSize.sm}};
818
+ background-color: ${()=>{const{theme:e}=gu();return e.colors.background}};
819
+ border-radius: ${()=>{const{theme:e}=gu();return e.borderRadius.md}};
803
820
  border: 1px solid
804
- ${()=>{const{theme:e}=hu();return e.colors.border}};
805
- `,cb=Eu.div`
821
+ ${()=>{const{theme:e}=gu();return e.colors.border}};
822
+ `,Nb=Su.div`
806
823
  flex: 1;
807
824
  min-width: 0;
808
825
  width: 100%;
809
- `,ub=Eu.div`
826
+ `,Mb=Su.div`
810
827
  padding: 0.5rem 0.75rem;
811
- color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
812
- font-size: ${()=>{const{theme:e}=hu();return e.fontSize.sm}};
828
+ color: ${()=>{const{theme:e}=gu();return e.colors.mutedForeground}};
829
+ font-size: ${()=>{const{theme:e}=gu();return e.fontSize.sm}};
813
830
  text-align: center;
814
- `,db=Eu.button`
831
+ `,Pb=Su.button`
815
832
  display: flex;
816
833
  align-items: center;
817
834
  justify-content: center;
818
835
  height: 2.5rem;
819
836
  width: 2.5rem;
820
837
  border: 1px solid
821
- ${()=>{const{theme:e}=hu();return e.colors.border}};
822
- border-radius: ${()=>{const{theme:e}=hu();return e.borderRadius.md}};
823
- background-color: ${()=>{const{theme:e}=hu();return e.colors.background}};
824
- color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
825
- transition: ${()=>{const{theme:e}=hu();return e.transitions.normal}};
838
+ ${()=>{const{theme:e}=gu();return e.colors.border}};
839
+ border-radius: ${()=>{const{theme:e}=gu();return e.borderRadius.md}};
840
+ background-color: ${()=>{const{theme:e}=gu();return e.colors.background}};
841
+ color: ${()=>{const{theme:e}=gu();return e.colors.mutedForeground}};
842
+ transition: ${()=>{const{theme:e}=gu();return e.transitions.normal}};
826
843
  opacity: ${e=>e.disabled?.5:1};
827
844
  cursor: ${e=>e.disabled?"not-allowed":"pointer"};
828
845
 
829
846
  &:hover:not(:disabled) {
830
- background-color: ${()=>{const{theme:e}=hu();return e.colors.accent}};
831
- color: ${()=>{const{theme:e}=hu();return e.colors.accentForeground}};
847
+ background-color: ${()=>{const{theme:e}=gu();return e.colors.accent}};
848
+ color: ${()=>{const{theme:e}=gu();return e.colors.accentForeground}};
832
849
  }
833
850
 
834
851
  &:focus {
835
852
  outline: none;
836
853
  box-shadow: 0 0 0 2px
837
- ${()=>{const{theme:e}=hu();return e.colors.ring}};
854
+ ${()=>{const{theme:e}=gu();return e.colors.ring}};
838
855
  }
839
- `,fb=Eu(jl)`
856
+ `,Rb=Su(Bl)`
840
857
  height: 1rem;
841
858
  width: 1rem;
842
859
  animation: spin 1s linear infinite;
843
- color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
860
+ color: ${()=>{const{theme:e}=gu();return e.colors.mutedForeground}};
844
861
 
845
862
  @keyframes spin {
846
863
  from {
@@ -850,11 +867,11 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
850
867
  transform: rotate(360deg);
851
868
  }
852
869
  }
853
- `,pb=Eu(Fl)`
870
+ `,Ob=Su(Vl)`
854
871
  height: 1rem;
855
872
  width: 1rem;
856
- color: ${()=>{const{theme:e}=hu();return e.colors.mutedForeground}};
857
- `;var hb="Checkbox",[mb,gb]=Af(hb),[yb,vb]=mb(hb);function bb(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]=Bf({prop:o,defaultProp:a??!1,onChange:u,caller:hb}),[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:!Mb(a)&&a,isFormControl:w,bubbleInput:v,setBubbleInput:b};return t.jsx(yb,{scope:n,...E,children:Nb(p)?p(E):r})}var xb="CheckboxTrigger",wb=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}=vb(xb,e),y=$f(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(Yf.button,{type:"button",role:"checkbox","aria-checked":Mb(u)?"mixed":u,"aria-required":d,"data-state":Pb(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onKeyDown:Pf(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:Pf(o,e=>{p(e=>!!Mb(e)||!e),g&&m&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});wb.displayName=xb;var Eb=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(bb,{__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(wb,{...f,ref:n,__scopeCheckbox:o}),e&&t.jsx(_b,{__scopeCheckbox:o})]})})});Eb.displayName=hb;var kb="CheckboxIndicator",Sb=i.forwardRef((e,n)=>{const{__scopeCheckbox:o,forceMount:r,...i}=e,a=vb(kb,o);return t.jsx(pp,{present:r||Mb(a.checked)||!0===a.checked,children:t.jsx(Yf.span,{"data-state":Pb(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})});Sb.displayName=kb;var Cb="CheckboxBubbleInput",_b=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}=vb(Cb,e),g=$f(o,m),y=Cy(s),v=ny(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=Mb(s),n.call(e,!Mb(s)&&s),e.dispatchEvent(t)}},[h,y,s,a]);const b=i.useRef(!Mb(s)&&s);return t.jsx(Yf.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 Nb(e){return"function"==typeof e}function Mb(e){return"indeterminate"===e}function Pb(e){return Mb(e)?"indeterminate":e?"checked":"unchecked"}_b.displayName=Cb;const Ob=Eu(Eb)`
873
+ color: ${()=>{const{theme:e}=gu();return e.colors.mutedForeground}};
874
+ `;var $b="Checkbox",[Ab,Tb]=Gf($b),[Db,zb]=Ab($b);function Ib(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]=rp({prop:o,defaultProp:a??!1,onChange:u,caller:$b}),[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:!Xb(a)&&a,isFormControl:w,bubbleInput:v,setBubbleInput:b};return t.jsx(Db,{scope:n,...E,children:Yb(p)?p(E):r})}var Lb="CheckboxTrigger",jb=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}=zb(Lb,e),y=Uf(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(cp.button,{type:"button",role:"checkbox","aria-checked":Xb(u)?"mixed":u,"aria-required":d,"data-state":Zb(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onKeyDown:Zf(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:Zf(o,e=>{p(e=>!!Xb(e)||!e),g&&m&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});jb.displayName=Lb;var Bb=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(Ib,{__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(jb,{...f,ref:n,__scopeCheckbox:o}),e&&t.jsx(Wb,{__scopeCheckbox:o})]})})});Bb.displayName=$b;var Fb="CheckboxIndicator",Hb=i.forwardRef((e,n)=>{const{__scopeCheckbox:o,forceMount:r,...i}=e,a=zb(Fb,o);return t.jsx(Op,{present:r||Xb(a.checked)||!0===a.checked,children:t.jsx(cp.span,{"data-state":Zb(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})});Hb.displayName=Fb;var Vb="CheckboxBubbleInput",Wb=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}=zb(Vb,e),g=Uf(o,m),y=Vy(s),v=xy(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=Xb(s),n.call(e,!Xb(s)&&s),e.dispatchEvent(t)}},[h,y,s,a]);const b=i.useRef(!Xb(s)&&s);return t.jsx(cp.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 Yb(e){return"function"==typeof e}function Xb(e){return"indeterminate"===e}function Zb(e){return Xb(e)?"indeterminate":e?"checked":"unchecked"}Wb.displayName=Vb;const Kb=Su(Bb)`
858
875
  display: flex;
859
876
  align-items: center;
860
877
  justify-content: center;
@@ -881,22 +898,22 @@ var $l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
881
898
  background-color: #6366f1;
882
899
  color: white;
883
900
  }
884
- `,Rb=Eu(Sb)`
901
+ `,qb=Su(Hb)`
885
902
  display: flex;
886
903
  align-items: center;
887
904
  justify-content: center;
888
905
  color: currentColor;
889
- `,$b=Eu(Tl)`
906
+ `,Ub=Su(Dl)`
890
907
  height: 1rem;
891
908
  width: 1rem;
892
- `,Ab=i.forwardRef(({className:e,...t},n)=>i.createElement(Ob,{ref:n,...t},i.createElement(Rb,null,i.createElement($b,null))));Ab.displayName=Eb.displayName;const Db=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}),Tb=()=>{const t=e.useContext(Db);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};function zb(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Ib(){return jb(/^iPad/)||jb(/^Mac/)&&navigator.maxTouchPoints>1}function Lb(){return jb(/^iPhone/)||Ib()}function jb(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 Bb="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function Fb(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}const Hb="undefined"!=typeof document&&window.visualViewport;function Vb(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Wb(e){for(Vb(e)&&(e=e.parentElement);e&&!Vb(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Yb=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Xb,Zb=0;function Kb(e={}){let{isDisabled:t}=e;Bb(()=>{if(!t)return Zb++,1===Zb&&Lb()&&(Xb=function(){let e,t=0,n=n=>{e=Wb(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;Gb(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},i=e=>{let t=e.target;Gb(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",Hb&&(Hb.height<window.innerHeight?requestAnimationFrame(()=>{Ub(t)}):Hb.addEventListener("resize",()=>Ub(t),{once:!0}))}))},a=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,c=Fb(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=Fb(qb(document,"touchstart",n,{passive:!1,capture:!0}),qb(document,"touchmove",o,{passive:!1,capture:!0}),qb(document,"touchend",r,{passive:!1,capture:!0}),qb(document,"focus",i,!0),qb(window,"scroll",a));return()=>{c(),u(),window.scrollTo(s,l)}}()),()=>{Zb--,0===Zb&&(null==Xb||Xb())}},[t])}function qb(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function Ub(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Wb(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 Gb(e){return e instanceof HTMLInputElement&&!Yb.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Qb(...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 Jb=new WeakMap;function ex(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||Jb.set(e,o)}const tx=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function nx(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(", ")[tx(t)?13:12]):(r=o.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[tx(t)?5:4]):null)}function ox(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}const rx={DURATION:.5,EASE:[.32,.72,0,1]},ix=16,ax="vaul-dragging";function sx(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 lx({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=sx(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=sx(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 cx=null;function ux({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]=lx({defaultProp:E,prop:t,onChange:e=>{null==n||n(e),e||b||ue(),setTimeout(()=>{null==N||N(e)},1e3*rx.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]=lx({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)),tx(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),ex(r.current,{transition:`transform ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`,transform:tx(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&n!==v.length-1&&void 0!==a&&n!==a&&n<a?ex(i.current,{transition:`opacity ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`,opacity:"0"}):ex(i.current,{transition:`opacity ${rx.DURATION}s cubic-bezier(${rx.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&&ex(i.current,{transition:`opacity ${rx.DURATION}s cubic-bezier(${rx.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=tx(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]||ex(r.current,{transform:tx(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});Kb({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(zb()&&null===cx&&t&&!a){cx={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(zb()&&null!==cx&&!a){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,cx),window.requestAnimationFrame(()=>{i&&s!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),cx=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?nx(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(ax),Y.current=!1,I(!1),V.current=new Date}(),null==v||v(),e||A(!1),setTimeout(()=>{a&&re(a[0])},1e3*rx.DURATION)}function he(){if(!G.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=nx(G.current,w);ex(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`}),ex(B.current,{transition:`opacity ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`,opacity:"1"}),s&&t&&t>0&&$&&ex(e,{borderRadius:"8px",overflow:"hidden",...tx(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:`${rx.DURATION}s`,transitionTimingFunction:`cubic-bezier(${rx.EASE.join(",")})`},!0)}return e.useEffect(()=>{window.requestAnimationFrame(()=>{q.current=!0})},[]),e.useEffect(()=>{var e;function t(){if(!G.current||!_)return;if(Gb(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(()=>($&&(ex(document.documentElement,{scrollBehavior:"auto"}),F.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let n=Jb.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[$]),e.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),e.createElement(Xh,{defaultOpen:E,onOpenChange:e=>{(d||e)&&(e?T(!0):pe(!0),A(e))},open:$},e.createElement(Db.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,Lb()&&window.addEventListener("touchend",()=>Y.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),Z.current=tx(w)?e.pageY:e.pageX))},onRelease:function(e){if(!z||!G.current)return;G.current.classList.remove(ax),Y.current=!1,I(!1),V.current=new Date;const t=nx(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-(tx(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-(tx(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(ax),Y.current=!0,ex(G.current,{transition:"none"}),ex(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 ex(G.current,{transform:tx(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),ex(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);ex(u,{borderRadius:`${t}px`,transform:tx(w)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!a){const e=c*n;ex(G.current,{transform:tx(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-ix)/window.innerWidth,o=n+t*(1-n),r=t*ix-16;ex(G.current,{transform:tx(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-ix)/window.innerWidth:1,n=e?-16:0;X.current&&window.clearTimeout(X.current),ex(G.current,{transition:`transform ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`,transform:tx(w)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&G.current&&(X.current=setTimeout(()=>{const e=nx(G.current,w);ex(G.current,{transition:"none",transform:tx(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const n=tx(w)?window.innerHeight:window.innerWidth,o=t?(n-ix)/n:1,r=t?-16:0;t&&ex(G.current,{transition:`transform ${rx.DURATION}s cubic-bezier(${rx.EASE.join(",")})`,transform:tx(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 dx=e.forwardRef(function({...t},n){const{overlayRef:o,snapPoints:r,onRelease:i,shouldFade:a,isOpen:s,modal:l,shouldAnimate:c}=Tb(),u=Qb(n,o),d=r&&r.length>0;if(!l)return null;const f=e.useCallback(e=>i(e),[i]);return e.createElement(qh,{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})});dx.displayName="Drawer.Overlay";const fx=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}=Tb(),[w,E]=e.useState(!1),k=Qb(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}=Tb(),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&&ox(document.body,{background:"black"}),ox(e,{transformOrigin:tx(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${rx.DURATION}s`,transitionTimingFunction:`cubic-bezier(${rx.EASE.join(",")})`});const n=ox(e,{borderRadius:"8px",overflow:"hidden",...tx(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*rx.DURATION)}}},[n,o,s])}();function M(e){S.current=null,_.current=!1,l(e)}return e.useEffect(()=>{N&&window.requestAnimationFrame(()=>{E(!0)})},[]),e.createElement(Uh,{"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)}})});fx.displayName="Drawer.Content";const px=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}=Tb(),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))});px.displayName="Drawer.Handle";const hx={Root:ux,NestedRoot:function({onDrag:t,onOpenChange:n,open:o,...r}){const{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:s}=Tb();if(!i)throw new Error("Drawer.NestedRoot must be placed in another drawer");return e.createElement(ux,{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:fx,Overlay:dx,Trigger:Zh,Portal:function(t){const n=Tb(),{container:o=n.container,...r}=t;return e.createElement(Kh,{container:o,...r})},Handle:px,Close:Jh,Title:Gh,Description:Qh},mx=({shouldScaleBackground:e=!0,...t})=>i.createElement(hx.Root,{shouldScaleBackground:e,...t});mx.displayName="Drawer";const gx=hx.Portal,yx=i.forwardRef(({className:e,...t},n)=>i.createElement(hx.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}));yx.displayName=hx.Overlay.displayName;const vx=i.forwardRef(({className:e,children:t,...n},o)=>i.createElement(gx,null,i.createElement(yx,null),i.createElement(hx.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)));vx.displayName="DrawerContent";i.forwardRef(({className:e,...t},n)=>i.createElement(hx.Title,{ref:n,style:{fontSize:"18px",fontWeight:600,lineHeight:1,letterSpacing:"-0.025em"},className:e,...t})).displayName=hx.Title.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement(hx.Description,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=hx.Description.displayName;const bx={div:(e,...t)=>Eu.div`
893
- ${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("")}
894
- `,button:(e,...t)=>Eu.button`
895
- ${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("")}
896
- `,span:(e,...t)=>Eu.span`
897
- ${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("")}
898
- `,h3:(e,...t)=>Eu.h3`
899
- ${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("")}
900
- `,textarea:(e,...t)=>Eu.textarea`
901
- ${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("")}
902
- `};exports.AgenticFlowVisualizer=lm,exports.AnthropicIcon=Bu,exports.Badge=Iu,exports.Checkbox=Ab,exports.Drawer=mx,exports.Edge=mu,exports.FileSelector=({files:t,currentFile:n,onFileSelect:o,onRefresh:r,loading:i=!1,disabled:a=!1})=>e.createElement(sb,null,0!==t.length||i?e.createElement(Hv,{value:n||"",onValueChange:o,disabled:a||i},e.createElement(cb,null,e.createElement(nb,null,e.createElement(Vv,{placeholder:i?"Loading sessions...":0===t.length?"No sessions found":"Select an Agent Session..."}))),e.createElement(ib,null,0!==t.length||i?t.map(t=>e.createElement(ab,{key:t.name,value:t.name},t.name)):e.createElement(ub,null,"No agent sessions available"))):e.createElement(lb,null,"No agent sessions available"),t.length>0&&e.createElement(db,{onClick:e=>{e.stopPropagation(),r()},disabled:i||a,title:i?"Loading...":"Refresh files"},i?e.createElement(fb,null):e.createElement(pb,null))),exports.GlobalStyles=()=>null,exports.GoogleIcon=ju,exports.JsonTreeViewer=Rd,exports.Node=gf,exports.OpenAIIcon=Lu,exports.SafeThemeProvider=({children:t,theme:n,fallbackTheme:o=uu})=>{const r=Ou(n||o);return e.createElement(cu,{theme:r},t)},exports.Select=Hv,exports.Sheet=em,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=Mf,exports.Visualizer=t=>e.createElement(tl,null,e.createElement(lm,t)),exports.calculateAutoLayout=am,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.detectContentType=Ru,exports.formatCurrency=Cu,exports.formatLatency=_u,exports.formatToolCalls=$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=bx,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};
909
+ `,Gb=i.forwardRef(({className:e,...t},n)=>i.createElement(Kb,{ref:n,...t},i.createElement(qb,null,i.createElement(Ub,null))));Gb.displayName=Bb.displayName;const Qb=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}),Jb=()=>{const t=e.useContext(Qb);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};function ex(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function tx(){return ox(/^iPad/)||ox(/^Mac/)&&navigator.maxTouchPoints>1}function nx(){return ox(/^iPhone/)||tx()}function ox(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 rx="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function ix(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}const ax="undefined"!=typeof document&&window.visualViewport;function sx(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function lx(e){for(sx(e)&&(e=e.parentElement);e&&!sx(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const cx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ux,dx=0;function fx(e={}){let{isDisabled:t}=e;rx(()=>{if(!t)return dx++,1===dx&&nx()&&(ux=function(){let e,t=0,n=n=>{e=lx(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;mx(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},i=e=>{let t=e.target;mx(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",ax&&(ax.height<window.innerHeight?requestAnimationFrame(()=>{hx(t)}):ax.addEventListener("resize",()=>hx(t),{once:!0}))}))},a=()=>{window.scrollTo(0,0)},s=window.pageXOffset,l=window.pageYOffset,c=ix(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=ix(px(document,"touchstart",n,{passive:!1,capture:!0}),px(document,"touchmove",o,{passive:!1,capture:!0}),px(document,"touchend",r,{passive:!1,capture:!0}),px(document,"focus",i,!0),px(window,"scroll",a));return()=>{c(),u(),window.scrollTo(s,l)}}()),()=>{dx--,0===dx&&(null==ux||ux())}},[t])}function px(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function hx(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=lx(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 mx(e){return e instanceof HTMLInputElement&&!cx.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function gx(...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 yx=new WeakMap;function vx(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||yx.set(e,o)}const bx=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function xx(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(", ")[bx(t)?13:12]):(r=o.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[bx(t)?5:4]):null)}function wx(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}const Ex={DURATION:.5,EASE:[.32,.72,0,1]},kx=16,Sx="vaul-dragging";function Cx(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 _x({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=Cx(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=Cx(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 Nx=null;function Mx({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 R,O;const[$=!1,A]=_x({defaultProp:E,prop:t,onChange:e=>{null==n||n(e),e||b||ue(),setTimeout(()=>{null==N||N(e)},1e3*Ex.DURATION),e&&!y&&"undefined"!=typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[T,D]=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==(R=G.current)?void 0:R.getBoundingClientRect().height)||0),J=e.useRef((null==(O=G.current)?void 0:O.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]=_x({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)),bx(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),vx(r.current,{transition:`transform ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`,transform:bx(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&n!==v.length-1&&void 0!==a&&n!==a&&n<a?vx(i.current,{transition:`opacity ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`,opacity:"0"}):vx(i.current,{transition:`opacity ${Ex.DURATION}s cubic-bezier(${Ex.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&&vx(i.current,{transition:`opacity ${Ex.DURATION}s cubic-bezier(${Ex.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=bx(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]||vx(r.current,{transform:bx(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});fx({isDisabled:!$||z||!y||L||!T||!_||!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(ex()&&null===Nx&&t&&!a){Nx={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(ex()&&null!==Nx&&!a){const e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Nx),window.requestAnimationFrame(()=>{i&&s!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),Nx=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:T,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?xx(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(Sx),Y.current=!1,I(!1),V.current=new Date}(),null==v||v(),e||A(!1),setTimeout(()=>{a&&re(a[0])},1e3*Ex.DURATION)}function he(){if(!G.current)return;const e=document.querySelector("[data-vaul-drawer-wrapper]"),t=xx(G.current,w);vx(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`}),vx(B.current,{transition:`opacity ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`,opacity:"1"}),s&&t&&t>0&&$&&vx(e,{borderRadius:"8px",overflow:"hidden",...bx(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:`${Ex.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ex.EASE.join(",")})`},!0)}return e.useEffect(()=>{window.requestAnimationFrame(()=>{q.current=!0})},[]),e.useEffect(()=>{var e;function t(){if(!G.current||!_)return;if(mx(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(()=>($&&(vx(document.documentElement,{scrollBehavior:"auto"}),F.current=new Date),()=>{!function(e,t){if(!(e&&e instanceof HTMLElement))return;let n=yx.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[$]),e.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),e.createElement(um,{defaultOpen:E,onOpenChange:e=>{(d||e)&&(e?D(!0):pe(!0),A(e))},open:$},e.createElement(Qb.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,nx()&&window.addEventListener("touchend",()=>Y.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),Z.current=bx(w)?e.pageY:e.pageX))},onRelease:function(e){if(!z||!G.current)return;G.current.classList.remove(Sx),Y.current=!1,I(!1),V.current=new Date;const t=xx(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-(bx(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-(bx(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(Sx),Y.current=!0,vx(G.current,{transition:"none"}),vx(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 vx(G.current,{transform:bx(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),vx(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);vx(u,{borderRadius:`${t}px`,transform:bx(w)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!a){const e=c*n;vx(G.current,{transform:bx(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-kx)/window.innerWidth,o=n+t*(1-n),r=t*kx-16;vx(G.current,{transform:bx(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-kx)/window.innerWidth:1,n=e?-16:0;X.current&&window.clearTimeout(X.current),vx(G.current,{transition:`transform ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`,transform:bx(w)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&G.current&&(X.current=setTimeout(()=>{const e=xx(G.current,w);vx(G.current,{transition:"none",transform:bx(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){const n=bx(w)?window.innerHeight:window.innerWidth,o=t?(n-kx)/n:1,r=t?-16:0;t&&vx(G.current,{transition:`transform ${Ex.DURATION}s cubic-bezier(${Ex.EASE.join(",")})`,transform:bx(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 Px=e.forwardRef(function({...t},n){const{overlayRef:o,snapPoints:r,onRelease:i,shouldFade:a,isOpen:s,modal:l,shouldAnimate:c}=Jb(),u=gx(n,o),d=r&&r.length>0;if(!l)return null;const f=e.useCallback(e=>i(e),[i]);return e.createElement(pm,{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})});Px.displayName="Drawer.Overlay";const Rx=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}=Jb(),[w,E]=e.useState(!1),k=gx(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}=Jb(),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&&wx(document.body,{background:"black"}),wx(e,{transformOrigin:bx(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Ex.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ex.EASE.join(",")})`});const n=wx(e,{borderRadius:"8px",overflow:"hidden",...bx(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*Ex.DURATION)}}},[n,o,s])}();function M(e){S.current=null,_.current=!1,l(e)}return e.useEffect(()=>{N&&window.requestAnimationFrame(()=>{E(!0)})},[]),e.createElement(hm,{"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)}})});Rx.displayName="Drawer.Content";const Ox=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}=Jb(),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))});Ox.displayName="Drawer.Handle";const $x={Root:Mx,NestedRoot:function({onDrag:t,onOpenChange:n,open:o,...r}){const{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:s}=Jb();if(!i)throw new Error("Drawer.NestedRoot must be placed in another drawer");return e.createElement(Mx,{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:Rx,Overlay:Px,Trigger:dm,Portal:function(t){const n=Jb(),{container:o=n.container,...r}=t;return e.createElement(fm,{container:o,...r})},Handle:Ox,Close:ym,Title:mm,Description:gm},Ax=({shouldScaleBackground:e=!0,...t})=>i.createElement($x.Root,{shouldScaleBackground:e,...t});Ax.displayName="Drawer";const Tx=$x.Portal,Dx=i.forwardRef(({className:e,...t},n)=>i.createElement($x.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}));Dx.displayName=$x.Overlay.displayName;const zx=i.forwardRef(({className:e,children:t,...n},o)=>i.createElement(Tx,null,i.createElement(Dx,null),i.createElement($x.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)));zx.displayName="DrawerContent";i.forwardRef(({className:e,...t},n)=>i.createElement($x.Title,{ref:n,style:{fontSize:"18px",fontWeight:600,lineHeight:1,letterSpacing:"-0.025em"},className:e,...t})).displayName=$x.Title.displayName;i.forwardRef(({className:e,...t},n)=>i.createElement($x.Description,{ref:n,style:{fontSize:"14px",color:"hsl(var(--muted-foreground))"},className:e,...t})).displayName=$x.Description.displayName;const Ix={div:(e,...t)=>Su.div`
910
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=$u(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
911
+ `,button:(e,...t)=>Su.button`
912
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=$u(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
913
+ `,span:(e,...t)=>Su.span`
914
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=$u(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
915
+ `,h3:(e,...t)=>Su.h3`
916
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=$u(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
917
+ `,textarea:(e,...t)=>Su.textarea`
918
+ ${e.map((n,o)=>{if(0===o)return n;const r=t[o-1];return"function"==typeof r?n+`(${e=>{const t=$u(e.theme);return r({...e,theme:t})}})`+e[o]:n+r+e[o]}).join("")}
919
+ `};exports.AgenticFlowVisualizer=_m,exports.AnthropicIcon=Hu,exports.Badge=ju,exports.Checkbox=Gb,exports.Drawer=Ax,exports.Edge=yu,exports.FileSelector=({files:t,currentFile:n,onFileSelect:o,onRefresh:r,loading:i=!1,disabled:a=!1})=>e.createElement(Cb,null,0!==t.length||i?e.createElement(ab,{value:n||"",onValueChange:o,disabled:a||i},e.createElement(Nb,null,e.createElement(xb,null,e.createElement(sb,{placeholder:i?"Loading sessions...":0===t.length?"No sessions found":"Select an Agent Session..."}))),e.createElement(kb,null,0!==t.length||i?t.map(t=>e.createElement(Sb,{key:t.name,value:t.name},t.name)):e.createElement(Mb,null,"No agent sessions available"))):e.createElement(_b,null,"No agent sessions available"),t.length>0&&e.createElement(Pb,{onClick:e=>{e.stopPropagation(),r()},disabled:i||a,title:i?"Loading...":"Refresh files"},i?e.createElement(Rb,null):e.createElement(Ob,null))),exports.GlobalStyles=()=>null,exports.GoogleIcon=Fu,exports.JsonTreeViewer=$d,exports.Node=Tf,exports.OpenAIIcon=Bu,exports.SafeThemeProvider=({children:t,theme:n,fallbackTheme:o=fu})=>{const r=$u(n||o);return e.createElement(du,{theme:r},t)},exports.Select=ab,exports.Sheet=vm,exports.ThemeProvider=({children:t,theme:n})=>{const[o,r]=e.useState(()=>{if(n)return n;return"dark"===localStorage.getItem("theme")?pu:fu});e.useEffect(()=>{n&&r(n)},[n]),e.useEffect(()=>{if(n)return;const e=()=>{const e=localStorage.getItem("theme");r("dark"===e?pu:fu)};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[n]);const i=e.useMemo(()=>({theme:o,setTheme:r,isDarkMode:o===pu}),[o]);return e.createElement(mu.Provider,{value:i},e.createElement(du,{theme:o},t))},exports.Timeline=Xf,exports.Visualizer=t=>e.createElement(tl,null,e.createElement(_m,t)),exports.calculateAutoLayout=Sm,exports.cn=function(...e){return function(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Cu(e))&&(o&&(o+=" "),o+=t);return o}(e)},exports.conditionalStyle=function(e,t,n=""){return e?t:n},exports.createSafeTheme=$u,exports.darkTheme=pu,exports.defaultTheme=hu,exports.detectContentType=Au,exports.formatCurrency=Nu,exports.formatLatency=Mu,exports.formatToolCalls=Tu,exports.getColor=function(e,t){return e.colors[t]||e.colors.foreground},exports.getSafeColor=Ru,exports.getSafeSpacing=Ou,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=fu,exports.safeStyled=Ix,exports.safeThemeColor=(e,t)=>n=>Ru(n.theme,e,t),exports.safeThemeSpacing=(e,t)=>n=>Ou(n.theme,e,t),exports.safeThemeValue=(e,t)=>n=>Ru(n.theme,e,t),exports.toTitleCase=_u,exports.truncateText=Pu,exports.useComponentTheme=e=>{const{theme:t}=gu();return e||t},exports.useSafeTheme=()=>fu,exports.useTheme=gu,exports.useThemeValue=()=>{const{theme:e}=gu();return e};