1?this.each((t==null?she:typeof t=="function"?lhe:ahe)(e,t,n??"")):Tf(this.node(),e)}function Tf(e,t){return e.style.getPropertyValue(t)||EF(e).getComputedStyle(e,null).getPropertyValue(t)}function che(e){return function(){delete this[e]}}function dhe(e,t){return function(){this[e]=t}}function fhe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hhe(e,t){return arguments.length>1?this.each((t==null?che:typeof t=="function"?fhe:dhe)(e,t)):this.node()[e]}function AF(e){return e.trim().split(/^|\s+/)}function VT(e){return e.classList||new PF(e)}function PF(e){this._node=e,this._names=AF(e.getAttribute("class")||"")}PF.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function RF(e,t){for(var n=VT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function zhe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function L3(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}L3.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Qhe(e){return!e.ctrlKey&&!e.button}function Zhe(){return this.parentNode}function Jhe(e,t){return t??{x:e.x,y:e.y}}function epe(){return navigator.maxTouchPoints||"ontouchstart"in this}function tpe(){var e=Qhe,t=Zhe,n=Jhe,r=epe,i={},o=Pb("start","drag","end"),s=0,a,l,u,d,f=0;function p(S){S.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",_,Yhe).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(S,C){if(!(d||!e.call(this,S,C))){var T=y(this,t.call(this,S,C),S,C,"mouse");T&&(jo(S.view).on("mousemove.drag",m,Tg).on("mouseup.drag",v,Tg),MF(S.view),px(S),u=!1,a=S.clientX,l=S.clientY,T("start",S))}}function m(S){if(ef(S),!u){var C=S.clientX-a,T=S.clientY-l;u=C*C+T*T>f}i.mouse("drag",S)}function v(S){jo(S.view).on("mousemove.drag mouseup.drag",null),NF(S.view,u),ef(S),i.mouse("end",S)}function x(S,C){if(e.call(this,S,C)){var T=S.changedTouches,E=t.call(this,S,C),P=T.length,k,O;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?w0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?w0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rpe.exec(e))?new xi(t[1],t[2],t[3],1):(t=ipe.exec(e))?new xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ope.exec(e))?w0(t[1],t[2],t[3],t[4]):(t=spe.exec(e))?w0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ape.exec(e))?xR(t[1],t[2]/100,t[3]/100,1):(t=lpe.exec(e))?xR(t[1],t[2]/100,t[3]/100,t[4]):yR.hasOwnProperty(e)?bR(yR[e]):e==="transparent"?new xi(NaN,NaN,NaN,0):null}function bR(e){return new xi(e>>16&255,e>>8&255,e&255,1)}function w0(e,t,n,r){return r<=0&&(e=t=n=NaN),new xi(e,t,n,r)}function dpe(e){return e instanceof vm||(e=Pg(e)),e?(e=e.rgb(),new xi(e.r,e.g,e.b,e.opacity)):new xi}function D3(e,t,n,r){return arguments.length===1?dpe(e):new xi(e,t,n,r??1)}function xi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}jT(xi,D3,LF(vm,{brighter(e){return e=e==null?M1:Math.pow(M1,e),new xi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Eg:Math.pow(Eg,e),new xi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xi(Hu(this.r),Hu(this.g),Hu(this.b),N1(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:SR,formatHex:SR,formatHex8:fpe,formatRgb:wR,toString:wR}));function SR(){return`#${Fu(this.r)}${Fu(this.g)}${Fu(this.b)}`}function fpe(){return`#${Fu(this.r)}${Fu(this.g)}${Fu(this.b)}${Fu((isNaN(this.opacity)?1:this.opacity)*255)}`}function wR(){const e=N1(this.opacity);return`${e===1?"rgb(":"rgba("}${Hu(this.r)}, ${Hu(this.g)}, ${Hu(this.b)}${e===1?")":`, ${e})`}`}function N1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fu(e){return e=Hu(e),(e<16?"0":"")+e.toString(16)}function xR(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Go(e,t,n,r)}function DF(e){if(e instanceof Go)return new Go(e.h,e.s,e.l,e.opacity);if(e instanceof vm||(e=Pg(e)),!e)return new Go;if(e instanceof Go)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new Go(s,a,l,e.opacity)}function hpe(e,t,n,r){return arguments.length===1?DF(e):new Go(e,t,n,r??1)}function Go(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}jT(Go,hpe,LF(vm,{brighter(e){return e=e==null?M1:Math.pow(M1,e),new Go(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Eg:Math.pow(Eg,e),new Go(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new xi(gx(e>=240?e-240:e+120,i,r),gx(e,i,r),gx(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Go(CR(this.h),x0(this.s),x0(this.l),N1(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=N1(this.opacity);return`${e===1?"hsl(":"hsla("}${CR(this.h)}, ${x0(this.s)*100}%, ${x0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function CR(e){return e=(e||0)%360,e<0?e+360:e}function x0(e){return Math.max(0,Math.min(1,e||0))}function gx(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const $F=e=>()=>e;function ppe(e,t){return function(n){return e+n*t}}function gpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function mpe(e){return(e=+e)==1?FF:function(t,n){return n-t?gpe(t,n,e):$F(isNaN(t)?n:t)}}function FF(e,t){var n=t-e;return n?ppe(e,n):$F(isNaN(e)?t:e)}const TR=function e(t){var n=mpe(t);function r(i,o){var s=n((i=D3(i)).r,(o=D3(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=FF(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=a(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function cl(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var $3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mx=new RegExp($3.source,"g");function ype(e){return function(){return e}}function vpe(e){return function(t){return e(t)+""}}function _pe(e,t){var n=$3.lastIndex=mx.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=$3.exec(e))&&(i=mx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:cl(r,i)})),n=mx.lastIndex;return n180?d+=360:d-u>180&&(u+=360),p.push({i:f.push(i(f)+"rotate(",null,r)-2,x:cl(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function a(u,d,f,p){u!==d?p.push({i:f.push(i(f)+"skewX(",null,r)-2,x:cl(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function l(u,d,f,p,g,m){if(u!==f||d!==p){var v=g.push(i(g)+"scale(",null,",",null,")");m.push({i:v-4,x:cl(u,f)},{i:v-2,x:cl(d,p)})}else(f!==1||p!==1)&&g.push(i(g)+"scale("+f+","+p+")")}return function(u,d){var f=[],p=[];return u=e(u),d=e(d),o(u.translateX,u.translateY,d.translateX,d.translateY,f,p),s(u.rotate,d.rotate,f,p),a(u.skewX,d.skewX,f,p),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,p),u=d=null,function(g){for(var m=-1,v=p.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Ef}function PR(){oc=(D1=Rg.now())+Ob,Ef=dp=0;try{Rpe()}finally{Ef=0,kpe(),oc=0}}function Ope(){var e=Rg.now(),t=e-D1;t>zF&&(Ob-=t,D1=e)}function kpe(){for(var e,t=L1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:L1=n);fp=e,B3(r)}function B3(e){if(!Ef){dp&&(dp=clearTimeout(dp));var t=e-oc;t>24?(e<1/0&&(dp=setTimeout(PR,e-Rg.now()-Ob)),Gh&&(Gh=clearInterval(Gh))):(Gh||(D1=Rg.now(),Gh=setInterval(Ope,zF)),Ef=1,VF(PR))}}function RR(e,t,n){var r=new $1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Ipe=Pb("start","end","cancel","interrupt"),Mpe=[],GF=0,OR=1,U3=2,pv=3,kR=4,z3=5,gv=6;function kb(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Npe(e,n,{name:t,index:r,group:i,on:Ipe,tween:Mpe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:GF})}function HT(e,t){var n=rs(e,t);if(n.state>GF)throw new Error("too late; already scheduled");return n}function Bs(e,t){var n=rs(e,t);if(n.state>pv)throw new Error("too late; already running");return n}function rs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Npe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=jF(o,0,n.time);function o(u){n.state=OR,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,f,p,g;if(n.state!==OR)return l();for(d in r)if(g=r[d],g.name===n.name){if(g.state===pv)return RR(s);g.state===kR?(g.state=gv,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+dU3&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function cge(e,t,n){var r,i,o=uge(t)?HT:Bs;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function dge(e,t){var n=this._id;return arguments.length<2?rs(this.node(),n).on.on(e):this.each(cge(n,e,t))}function fge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hge(){return this.on("end.remove",fge(this._id))}function pge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zT(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function Bge(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ma(e,t,n){this.k=e,this.x=t,this.y=n}ma.prototype={constructor:ma,scale:function(e){return e===1?this:new ma(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ma(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 Il=new ma(1,0,0);ma.prototype;function yx(e){e.stopImmediatePropagation()}function Hh(e){e.preventDefault(),e.stopImmediatePropagation()}function Uge(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zge(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function IR(){return this.__zoom||Il}function Vge(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jge(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gge(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Hge(){var e=Uge,t=zge,n=Gge,r=Vge,i=jge,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ape,u=Pb("start","zoom","end"),d,f,p,g=500,m=150,v=0,x=10;function _(A){A.property("__zoom",IR).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",O).filter(i).on("touchstart.zoom",M).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(A,N,F,B){var D=A.selection?A.selection():A;D.property("__zoom",IR),A!==D?C(A,N,F,B):D.interrupt().each(function(){T(this,arguments).event(B).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},_.scaleBy=function(A,N,F,B){_.scaleTo(A,function(){var D=this.__zoom.k,V=typeof N=="function"?N.apply(this,arguments):N;return D*V},F,B)},_.scaleTo=function(A,N,F,B){_.transform(A,function(){var D=t.apply(this,arguments),V=this.__zoom,j=F==null?S(D):typeof F=="function"?F.apply(this,arguments):F,q=V.invert(j),Z=typeof N=="function"?N.apply(this,arguments):N;return n(y(b(V,Z),j,q),D,s)},F,B)},_.translateBy=function(A,N,F,B){_.transform(A,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof F=="function"?F.apply(this,arguments):F),t.apply(this,arguments),s)},null,B)},_.translateTo=function(A,N,F,B,D){_.transform(A,function(){var V=t.apply(this,arguments),j=this.__zoom,q=B==null?S(V):typeof B=="function"?B.apply(this,arguments):B;return n(Il.translate(q[0],q[1]).scale(j.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof F=="function"?-F.apply(this,arguments):-F),V,s)},B,D)};function b(A,N){return N=Math.max(o[0],Math.min(o[1],N)),N===A.k?A:new ma(N,A.x,A.y)}function y(A,N,F){var B=N[0]-F[0]*A.k,D=N[1]-F[1]*A.k;return B===A.x&&D===A.y?A:new ma(A.k,B,D)}function S(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function C(A,N,F,B){A.on("start.zoom",function(){T(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(B).end()}).tween("zoom",function(){var D=this,V=arguments,j=T(D,V).event(B),q=t.apply(D,V),Z=F==null?S(q):typeof F=="function"?F.apply(D,V):F,ee=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),ie=D.__zoom,se=typeof N=="function"?N.apply(D,V):N,le=l(ie.invert(Z).concat(ee/ie.k),se.invert(Z).concat(ee/se.k));return function(W){if(W===1)W=se;else{var ne=le(W),fe=ee/ne[2];W=new ma(fe,Z[0]-ne[0]*fe,Z[1]-ne[1]*fe)}j.zoom(null,W)}})}function T(A,N,F){return!F&&A.__zooming||new E(A,N)}function E(A,N){this.that=A,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,N),this.taps=0}E.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,N){return this.mouse&&A!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var N=jo(this.that).datum();u.call(A,this.that,new Bge(A,{sourceEvent:this.sourceEvent,target:_,type:A,transform:this.that.__zoom,dispatch:u}),N)}};function P(A,...N){if(!e.apply(this,arguments))return;var F=T(this,N).event(A),B=this.__zoom,D=Math.max(o[0],Math.min(o[1],B.k*Math.pow(2,r.apply(this,arguments)))),V=gs(A);if(F.wheel)(F.mouse[0][0]!==V[0]||F.mouse[0][1]!==V[1])&&(F.mouse[1]=B.invert(F.mouse[0]=V)),clearTimeout(F.wheel);else{if(B.k===D)return;F.mouse=[V,B.invert(V)],mv(this),F.start()}Hh(A),F.wheel=setTimeout(j,m),F.zoom("mouse",n(y(b(B,D),F.mouse[0],F.mouse[1]),F.extent,s));function j(){F.wheel=null,F.end()}}function k(A,...N){if(p||!e.apply(this,arguments))return;var F=A.currentTarget,B=T(this,N,!0).event(A),D=jo(A.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",ee,!0),V=gs(A,F),j=A.clientX,q=A.clientY;MF(A.view),yx(A),B.mouse=[V,this.__zoom.invert(V)],mv(this),B.start();function Z(ie){if(Hh(ie),!B.moved){var se=ie.clientX-j,le=ie.clientY-q;B.moved=se*se+le*le>v}B.event(ie).zoom("mouse",n(y(B.that.__zoom,B.mouse[0]=gs(ie,F),B.mouse[1]),B.extent,s))}function ee(ie){D.on("mousemove.zoom mouseup.zoom",null),NF(ie.view,B.moved),Hh(ie),B.event(ie).end()}}function O(A,...N){if(e.apply(this,arguments)){var F=this.__zoom,B=gs(A.changedTouches?A.changedTouches[0]:A,this),D=F.invert(B),V=F.k*(A.shiftKey?.5:2),j=n(y(b(F,V),B,D),t.apply(this,N),s);Hh(A),a>0?jo(this).transition().duration(a).call(C,j,B,A):jo(this).call(_.transform,j,B,A)}}function M(A,...N){if(e.apply(this,arguments)){var F=A.touches,B=F.length,D=T(this,N,A.changedTouches.length===B).event(A),V,j,q,Z;for(yx(A),j=0;j"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`},KF=Wl.error001();function Nn(e,t){const n=L.useContext(Ib);if(n===null)throw new Error(KF);return hfe(n,e,t)}const qr=()=>{const e=L.useContext(Ib);if(e===null)throw new Error(KF);return L.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},qge=e=>e.userSelectionActive?"none":"all";function Kge({position:e,children:t,className:n,style:r,...i}){const o=Nn(qge),s=`${e}`.split("-");return ue.jsx("div",{className:Eo(["react-flow__panel",n,...s]),style:{...r,pointerEvents:o},...i,children:t})}function Xge({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.jsx(Kge,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:ue.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Yge=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...d})=>{const f=L.useRef(null),[p,g]=L.useState({x:0,y:0,width:0,height:0}),m=Eo(["react-flow__edge-textwrapper",u]);return L.useEffect(()=>{if(f.current){const v=f.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),typeof n>"u"||!n?null:ue.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:m,visibility:p.width?"visible":"hidden",...d,children:[i&&ue.jsx("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),ue.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:f,style:r,children:n}),l]})};var Qge=L.memo(Yge);const qT=e=>({width:e.offsetWidth,height:e.offsetHeight}),Af=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),KT=(e={x:0,y:0},t)=>({x:Af(e.x,t[0][0],t[1][0]),y:Af(e.y,t[0][1],t[1][1])}),MR=(e,t,n)=>en?-Af(Math.abs(e-n),1,50)/50:0,XF=(e,t)=>{const n=MR(e.x,35,t.width-35)*20,r=MR(e.y,35,t.height-35)*20;return[n,r]},YF=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},QF=(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)}),F1=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ZF=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),NR=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),LIe=(e,t)=>ZF(QF(F1(e),F1(t))),V3=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Zge=e=>_o(e.width)&&_o(e.height)&&_o(e.x)&&_o(e.y),_o=e=>!isNaN(e)&&isFinite(e),nr=Symbol.for("internals"),JF=["Enter"," ","Escape"],Jge=(e,t)=>{},eme=e=>"nativeEvent"in e;function j3(e){var i,o;const t=eme(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const eB=e=>"clientX"in e,Ml=(e,t)=>{var o,s;const n=eB(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},_m=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:g=20})=>ue.jsxs(ue.Fragment,{children:[ue.jsx("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:p}),g&&ue.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}),i&&_o(n)&&_o(r)?ue.jsx(Qge,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]});_m.displayName="BaseEdge";function Wh(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function tB({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[x,_,b]=rB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return ue.jsx(_m,{path:x,labelX:_,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:v})});XT.displayName="SimpleBezierEdge";const DR={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},tme=({source:e,sourcePosition:t=Ne.Bottom,target:n})=>t===Ne.Left||t===Ne.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function nme({source:e,sourcePosition:t=Ne.Bottom,target:n,targetPosition:r=Ne.Top,center:i,offset:o}){const s=DR[t],a=DR[r],l={x:e.x+s.x*o,y:e.y+s.y*o},u={x:n.x+a.x*o,y:n.y+a.y*o},d=tme({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",p=d[f];let g=[],m,v;const[x,_,b,y]=tB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*a[f]===-1){m=i.x||x,v=i.y||_;const C=[{x:m,y:l.y},{x:m,y:u.y}],T=[{x:l.x,y:v},{x:u.x,y:v}];s[f]===p?g=f==="x"?C:T:g=f==="x"?T:C}else{const C=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?g=s.x===p?T:C:g=s.y===p?C:T,t!==r){const E=f==="x"?"y":"x",P=s[f]===a[E],k=l[E]>u[E],O=l[E]{let y="";return b>0&&b{const[_,b,y]=G3({sourceX:e,sourceY:t,sourcePosition:f,targetX:n,targetY:r,targetPosition:p,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset});return ue.jsx(_m,{path:_,labelX:b,labelY:y,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:g,markerStart:m,interactionWidth:x})});Mb.displayName="SmoothStepEdge";const YT=L.memo(e=>{var t;return ue.jsx(Mb,{...e,pathOptions:L.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});YT.displayName="StepEdge";function ime({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=tB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const QT=L.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[m,v,x]=ime({sourceX:e,sourceY:t,targetX:n,targetY:r});return ue.jsx(_m,{path:m,labelX:v,labelY:x,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:p,interactionWidth:g})});QT.displayName="StraightEdge";function E0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function FR({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Ne.Left:return[t-E0(t-r,o),n];case Ne.Right:return[t+E0(r-t,o),n];case Ne.Top:return[t,n-E0(n-i,o)];case Ne.Bottom:return[t,n+E0(i-n,o)]}}function iB({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:r,targetY:i,targetPosition:o=Ne.Top,curvature:s=.25}){const[a,l]=FR({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[u,d]=FR({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[f,p,g,m]=nB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${l} ${u},${d} ${r},${i}`,f,p,g,m]}const U1=L.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Ne.Bottom,targetPosition:o=Ne.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,pathOptions:v,interactionWidth:x})=>{const[_,b,y]=iB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:v==null?void 0:v.curvature});return ue.jsx(_m,{path:_,labelX:b,labelY:y,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:x})});U1.displayName="BezierEdge";const ZT=L.createContext(null),ome=ZT.Provider;ZT.Consumer;const sme=()=>L.useContext(ZT),ame=e=>"id"in e&&"source"in e&&"target"in e,lme=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,H3=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,ume=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),oB=(e,t)=>{if(!e.source||!e.target)return t;let n;return ame(e)?n={...e}:n={...e,id:lme(e)},ume(n,t)?t:t.concat(n)},sB=({x:e,y:t},[n,r,i],o,[s,a])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},cme=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),rf=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},aB=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:s}=rf(i,t).positionAbsolute;return QF(r,F1({x:o,y:s,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ZF(n)},lB=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1,a=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(d=>{const{width:f,height:p,selectable:g=!0,hidden:m=!1}=d;if(s&&!g||m)return!1;const{positionAbsolute:v}=rf(d,a),x={x:v.x,y:v.y,width:f||0,height:p||0},_=V3(l,x),b=typeof f>"u"||typeof p>"u"||f===null||p===null,y=o&&_>0,S=(f||0)*(p||0);(b||y||_>=S||d.dragging)&&u.push(d)}),u},uB=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},cB=(e,t,n,r,i,o=.1)=>{const s=t/(e.width*(1+o)),a=n/(e.height*(1+o)),l=Math.min(s,a),u=Af(l,r,i),d=e.x+e.width/2,f=e.y+e.height/2,p=t/2-d*u,g=n/2-f*u;return[p,g,u]},Pu=(e,t=0)=>e.transition().duration(t);function BR(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var s,a;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+o.x+o.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),i},[])}function dme(e,t,n,r,i,o){const{x:s,y:a}=Ml(e),u=t.elementsFromPoint(s,a).find(m=>m.classList.contains("react-flow__handle"));if(u){const m=u.getAttribute("data-nodeid");if(m){const v=JT(void 0,u),x=u.getAttribute("data-handleid"),_=o({nodeId:m,id:x,type:v});if(_)return{handle:{id:x,type:v,nodeId:m,x:n.x,y:n.y},validHandleResult:_}}}let d=[],f=1/0;if(i.forEach(m=>{const v=Math.sqrt((m.x-n.x)**2+(m.y-n.y)**2);if(v<=r){const x=o(m);v<=f&&(vm.isValid),g=d.some(({handle:m})=>m.type==="target");return d.find(({handle:m,validHandleResult:v})=>g?m.type==="target":p?v.isValid:!0)||d[0]}const fme={source:null,target:null,sourceHandle:null,targetHandle:null},dB=()=>({handleDomNode:null,isValid:!1,connection:fme,endHandle:null});function fB(e,t,n,r,i,o,s){const a=i==="target",l=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...dB(),handleDomNode:l};if(l){const d=JT(void 0,l),f=l.getAttribute("data-nodeid"),p=l.getAttribute("data-handleid"),g=l.classList.contains("connectable"),m=l.classList.contains("connectableend"),v={source:a?f:n,sourceHandle:a?p:r,target:a?n:f,targetHandle:a?r:p};u.connection=v,g&&m&&(t===sc.Strict?a&&d==="source"||!a&&d==="target":f!==n||p!==r)&&(u.endHandle={nodeId:f,handleId:p,type:d},u.isValid=o(v))}return u}function hme({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[nr]){const{handleBounds:s}=o[nr];let a=[],l=[];s&&(a=BR(o,s,"source",`${t}-${n}-${r}`),l=BR(o,s,"target",`${t}-${n}-${r}`)),i.push(...a,...l)}return i},[])}function JT(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function vx(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function pme(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function hB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:s,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const d=YF(e.target),{connectionMode:f,domNode:p,autoPanOnConnect:g,connectionRadius:m,onConnectStart:v,panBy:x,getNodes:_,cancelConnection:b}=o();let y=0,S;const{x:C,y:T}=Ml(e),E=d==null?void 0:d.elementFromPoint(C,T),P=JT(l,E),k=p==null?void 0:p.getBoundingClientRect();if(!k||!P)return;let O,M=Ml(e,k),G=!1,U=null,A=!1,N=null;const F=hme({nodes:_(),nodeId:n,handleId:t,handleType:P}),B=()=>{if(!g)return;const[j,q]=XF(M,k);x({x:j,y:q}),y=requestAnimationFrame(B)};s({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:P,connectionStartHandle:{nodeId:n,handleId:t,type:P},connectionEndHandle:null}),v==null||v(e,{nodeId:n,handleId:t,handleType:P});function D(j){const{transform:q}=o();M=Ml(j,k);const{handle:Z,validHandleResult:ee}=dme(j,d,sB(M,q,!1,[1,1]),m,F,ie=>fB(ie,f,n,t,i?"target":"source",a,d));if(S=Z,G||(B(),G=!0),N=ee.handleDomNode,U=ee.connection,A=ee.isValid,s({connectionPosition:S&&A?cme({x:S.x,y:S.y},q):M,connectionStatus:pme(!!S,A),connectionEndHandle:ee.endHandle}),!S&&!A&&!N)return vx(O);U.source!==U.target&&N&&(vx(O),O=N,N.classList.add("connecting","react-flow__handle-connecting"),N.classList.toggle("valid",A),N.classList.toggle("react-flow__handle-valid",A))}function V(j){var q,Z;(S||N)&&U&&A&&(r==null||r(U)),(Z=(q=o()).onConnectEnd)==null||Z.call(q,j),l&&(u==null||u(j)),vx(O),b(),cancelAnimationFrame(y),G=!1,A=!1,U=null,N=null,d.removeEventListener("mousemove",D),d.removeEventListener("mouseup",V),d.removeEventListener("touchmove",D),d.removeEventListener("touchend",V)}d.addEventListener("mousemove",D),d.addEventListener("mouseup",V),d.addEventListener("touchmove",D),d.addEventListener("touchend",V)}const UR=()=>!0,gme=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),mme=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:s}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},pB=L.forwardRef(({type:e="source",position:t=Ne.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:s,onConnect:a,children:l,className:u,onMouseDown:d,onTouchStart:f,...p},g)=>{var k,O;const m=s||null,v=e==="target",x=qr(),_=sme(),{connectOnClick:b,noPanClassName:y}=Nn(gme,Ri),{connecting:S,clickConnecting:C}=Nn(mme(_,m,e),Ri);_||(O=(k=x.getState()).onError)==null||O.call(k,"010",Wl.error010());const T=M=>{const{defaultEdgeOptions:G,onConnect:U,hasDefaultEdges:A}=x.getState(),N={...G,...M};if(A){const{edges:F,setEdges:B}=x.getState();B(oB(N,F))}U==null||U(N),a==null||a(N)},E=M=>{if(!_)return;const G=eB(M);i&&(G&&M.button===0||!G)&&hB({event:M,handleId:m,nodeId:_,onConnect:T,isTarget:v,getState:x.getState,setState:x.setState,isValidConnection:n||x.getState().isValidConnection||UR}),G?d==null||d(M):f==null||f(M)},P=M=>{const{onClickConnectStart:G,onClickConnectEnd:U,connectionClickStartHandle:A,connectionMode:N,isValidConnection:F}=x.getState();if(!_||!A&&!i)return;if(!A){G==null||G(M,{nodeId:_,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:m}});return}const B=YF(M.target),D=n||F||UR,{connection:V,isValid:j}=fB({nodeId:_,id:m,type:e},N,A.nodeId,A.handleId||null,A.type,D,B);j&&T(V),U==null||U(M),x.setState({connectionClickStartHandle:null})};return ue.jsx("div",{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${m}-${e}`,className:Eo(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,u,{source:!v,target:v,connectable:r,connectablestart:i,connectableend:o,connecting:C,connectionindicator:r&&(i&&!S||o&&S)}]),onMouseDown:E,onTouchStart:E,onClick:b?P:void 0,ref:g,...p,children:l})});pB.displayName="Handle";var z1=L.memo(pB);const gB=({data:e,isConnectable:t,targetPosition:n=Ne.Top,sourcePosition:r=Ne.Bottom})=>ue.jsxs(ue.Fragment,{children:[ue.jsx(z1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.jsx(z1,{type:"source",position:r,isConnectable:t})]});gB.displayName="DefaultNode";var W3=L.memo(gB);const mB=({data:e,isConnectable:t,sourcePosition:n=Ne.Bottom})=>ue.jsxs(ue.Fragment,{children:[e==null?void 0:e.label,ue.jsx(z1,{type:"source",position:n,isConnectable:t})]});mB.displayName="InputNode";var yB=L.memo(mB);const vB=({data:e,isConnectable:t,targetPosition:n=Ne.Top})=>ue.jsxs(ue.Fragment,{children:[ue.jsx(z1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});vB.displayName="OutputNode";var _B=L.memo(vB);const eE=()=>null;eE.displayName="GroupNode";const yme=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),A0=e=>e.id;function vme(e,t){return Ri(e.selectedNodes.map(A0),t.selectedNodes.map(A0))&&Ri(e.selectedEdges.map(A0),t.selectedEdges.map(A0))}const bB=L.memo(({onSelectionChange:e})=>{const t=qr(),{selectedNodes:n,selectedEdges:r}=Nn(yme,vme);return L.useEffect(()=>{var o,s;const i={nodes:n,edges:r};e==null||e(i),(s=(o=t.getState()).onSelectionChange)==null||s.call(o,i)},[n,r,e]),null});bB.displayName="SelectionListener";const _me=e=>!!e.onSelectionChange;function bme({onSelectionChange:e}){const t=Nn(_me);return e||t?ue.jsx(bB,{onSelectionChange:e}):null}const Sme=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function rd(e,t){L.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function at(e,t,n){L.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const wme=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:d,nodesFocusable:f,edgesFocusable:p,edgesUpdatable:g,elevateNodesOnSelect:m,minZoom:v,maxZoom:x,nodeExtent:_,onNodesChange:b,onEdgesChange:y,elementsSelectable:S,connectionMode:C,snapGrid:T,snapToGrid:E,translateExtent:P,connectOnClick:k,defaultEdgeOptions:O,fitView:M,fitViewOptions:G,onNodesDelete:U,onEdgesDelete:A,onNodeDrag:N,onNodeDragStart:F,onNodeDragStop:B,onSelectionDrag:D,onSelectionDragStart:V,onSelectionDragStop:j,noPanClassName:q,nodeOrigin:Z,rfId:ee,autoPanOnConnect:ie,autoPanOnNodeDrag:se,onError:le,connectionRadius:W,isValidConnection:ne})=>{const{setNodes:fe,setEdges:pe,setDefaultNodesAndEdges:ve,setMinZoom:ye,setMaxZoom:We,setTranslateExtent:Me,setNodeExtent:Ee,reset:lt}=Nn(Sme,Ri),_e=qr();return L.useEffect(()=>{const jt=r==null?void 0:r.map(Wn=>({...Wn,...O}));return ve(n,jt),()=>{lt()}},[]),at("defaultEdgeOptions",O,_e.setState),at("connectionMode",C,_e.setState),at("onConnect",i,_e.setState),at("onConnectStart",o,_e.setState),at("onConnectEnd",s,_e.setState),at("onClickConnectStart",a,_e.setState),at("onClickConnectEnd",l,_e.setState),at("nodesDraggable",u,_e.setState),at("nodesConnectable",d,_e.setState),at("nodesFocusable",f,_e.setState),at("edgesFocusable",p,_e.setState),at("edgesUpdatable",g,_e.setState),at("elementsSelectable",S,_e.setState),at("elevateNodesOnSelect",m,_e.setState),at("snapToGrid",E,_e.setState),at("snapGrid",T,_e.setState),at("onNodesChange",b,_e.setState),at("onEdgesChange",y,_e.setState),at("connectOnClick",k,_e.setState),at("fitViewOnInit",M,_e.setState),at("fitViewOnInitOptions",G,_e.setState),at("onNodesDelete",U,_e.setState),at("onEdgesDelete",A,_e.setState),at("onNodeDrag",N,_e.setState),at("onNodeDragStart",F,_e.setState),at("onNodeDragStop",B,_e.setState),at("onSelectionDrag",D,_e.setState),at("onSelectionDragStart",V,_e.setState),at("onSelectionDragStop",j,_e.setState),at("noPanClassName",q,_e.setState),at("nodeOrigin",Z,_e.setState),at("rfId",ee,_e.setState),at("autoPanOnConnect",ie,_e.setState),at("autoPanOnNodeDrag",se,_e.setState),at("onError",le,_e.setState),at("connectionRadius",W,_e.setState),at("isValidConnection",ne,_e.setState),rd(e,fe),rd(t,pe),rd(v,ye),rd(x,We),rd(P,Me),rd(_,Ee),null},zR={display:"none"},xme={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},SB="react-flow__node-desc",wB="react-flow__edge-desc",Cme="react-flow__aria-live",Tme=e=>e.ariaLiveMessage;function Eme({rfId:e}){const t=Nn(Tme);return ue.jsx("div",{id:`${Cme}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xme,children:t})}function Ame({rfId:e,disableKeyboardA11y:t}){return ue.jsxs(ue.Fragment,{children:[ue.jsxs("div",{id:`${SB}-${e}`,style:zR,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),ue.jsx("div",{id:`${wB}-${e}`,style:zR,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&ue.jsx(Eme,{rfId:e})]})}const Pme=(e,t,n)=>n===Ne.Left?e-t:n===Ne.Right?e+t:e,Rme=(e,t,n)=>n===Ne.Top?e-t:n===Ne.Bottom?e+t:e,VR="react-flow__edgeupdater",jR=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:s,type:a})=>ue.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:s,className:Eo([VR,`${VR}-${a}`]),cx:Pme(t,r,e),cy:Rme(n,r,e),r,stroke:"transparent",fill:"transparent"}),Ome=()=>!0;var id=e=>{const t=({id:n,className:r,type:i,data:o,onClick:s,onEdgeDoubleClick:a,selected:l,animated:u,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:v,style:x,source:_,target:b,sourceX:y,sourceY:S,targetX:C,targetY:T,sourcePosition:E,targetPosition:P,elementsSelectable:k,hidden:O,sourceHandleId:M,targetHandleId:G,onContextMenu:U,onMouseEnter:A,onMouseMove:N,onMouseLeave:F,edgeUpdaterRadius:B,onEdgeUpdate:D,onEdgeUpdateStart:V,onEdgeUpdateEnd:j,markerEnd:q,markerStart:Z,rfId:ee,ariaLabel:ie,isFocusable:se,isUpdatable:le,pathOptions:W,interactionWidth:ne})=>{const fe=L.useRef(null),[pe,ve]=L.useState(!1),[ye,We]=L.useState(!1),Me=qr(),Ee=L.useMemo(()=>`url(#${H3(Z,ee)})`,[Z,ee]),lt=L.useMemo(()=>`url(#${H3(q,ee)})`,[q,ee]);if(O)return null;const _e=sn=>{const{edges:Gt,addSelectedEdges:vr}=Me.getState();if(k&&(Me.setState({nodesSelectionActive:!1}),vr([n])),s){const Nr=Gt.find(Xr=>Xr.id===n);s(sn,Nr)}},jt=Wh(n,Me.getState,a),Wn=Wh(n,Me.getState,U),Bt=Wh(n,Me.getState,A),it=Wh(n,Me.getState,N),mt=Wh(n,Me.getState,F),Jt=(sn,Gt)=>{if(sn.button!==0)return;const{edges:vr,isValidConnection:Nr}=Me.getState(),Xr=Gt?b:_,Ii=(Gt?G:M)||null,An=Gt?"target":"source",Yr=Nr||Ome,Vs=Gt,Ji=vr.find(kt=>kt.id===n);We(!0),V==null||V(sn,Ji,An);const js=kt=>{We(!1),j==null||j(kt,Ji,An)};hB({event:sn,handleId:Ii,nodeId:Xr,onConnect:kt=>D==null?void 0:D(Ji,kt),isTarget:Vs,getState:Me.getState,setState:Me.setState,isValidConnection:Yr,edgeUpdaterType:An,onEdgeUpdateEnd:js})},Mr=sn=>Jt(sn,!0),yr=sn=>Jt(sn,!1),hi=()=>ve(!0),wn=()=>ve(!1),on=!k&&!s,qn=sn=>{var Gt;if(JF.includes(sn.key)&&k){const{unselectNodesAndEdges:vr,addSelectedEdges:Nr,edges:Xr}=Me.getState();sn.key==="Escape"?((Gt=fe.current)==null||Gt.blur(),vr({edges:[Xr.find(An=>An.id===n)]})):Nr([n])}};return ue.jsxs("g",{className:Eo(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:on,updating:pe}]),onClick:_e,onDoubleClick:jt,onContextMenu:Wn,onMouseEnter:Bt,onMouseMove:it,onMouseLeave:mt,onKeyDown:se?qn:void 0,tabIndex:se?0:void 0,role:se?"button":void 0,"data-testid":`rf__edge-${n}`,"aria-label":ie===null?void 0:ie||`Edge from ${_} to ${b}`,"aria-describedby":se?`${wB}-${ee}`:void 0,ref:fe,children:[!ye&&ue.jsx(e,{id:n,source:_,target:b,selected:l,animated:u,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:v,data:o,style:x,sourceX:y,sourceY:S,targetX:C,targetY:T,sourcePosition:E,targetPosition:P,sourceHandleId:M,targetHandleId:G,markerStart:Ee,markerEnd:lt,pathOptions:W,interactionWidth:ne}),le&&ue.jsxs(ue.Fragment,{children:[(le==="source"||le===!0)&&ue.jsx(jR,{position:E,centerX:y,centerY:S,radius:B,onMouseDown:Mr,onMouseEnter:hi,onMouseOut:wn,type:"source"}),(le==="target"||le===!0)&&ue.jsx(jR,{position:P,centerX:C,centerY:T,radius:B,onMouseDown:yr,onMouseEnter:hi,onMouseOut:wn,type:"target"})]})]})};return t.displayName="EdgeWrapper",L.memo(t)};function kme(e){const t={default:id(e.default||U1),straight:id(e.bezier||QT),step:id(e.step||YT),smoothstep:id(e.step||Mb),simplebezier:id(e.simplebezier||XT)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=id(e[o]||U1),i),n);return{...t,...r}}function GR(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case Ne.Top:return{x:r+o/2,y:i};case Ne.Right:return{x:r+o,y:i+s/2};case Ne.Bottom:return{x:r+o/2,y:i+s};case Ne.Left:return{x:r,y:i+s/2}}}function HR(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Ime=(e,t,n,r,i,o)=>{const s=GR(n,e,t),a=GR(o,r,i);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function Mme({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:s,height:a,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const d=F1({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:a/l[2]}),f=Math.max(0,Math.min(d.x2,u.x2)-Math.max(d.x,u.x)),p=Math.max(0,Math.min(d.y2,u.y2)-Math.max(d.y,u.y));return Math.ceil(f*p)>0}function WR(e){var r,i,o,s,a;const t=((r=e==null?void 0:e[nr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}function xB(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:xB(n,t):!1}function qR(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Nme(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!xB(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,s;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((s=i.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function Lme(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function CB(e,t,n,r,i=[0,0],o){const s=Lme(e,e.extent||r);let a=s;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const d=n.get(e.parentNode),{x:f,y:p}=rf(d,i).positionAbsolute;a=d&&_o(f)&&_o(p)&&_o(d.width)&&_o(d.height)?[[f+e.width*i[0],p+e.height*i[1]],[f+d.width-e.width+e.width*i[0],p+d.height-e.height+e.height*i[1]]]:a}else o==null||o("005",Wl.error005()),a=s;else if(e.extent&&e.parentNode){const d=n.get(e.parentNode),{x:f,y:p}=rf(d,i).positionAbsolute;a=[[e.extent[0][0]+f,e.extent[0][1]+p],[e.extent[1][0]+f,e.extent[1][1]+p]]}let l={x:0,y:0};if(e.parentNode){const d=n.get(e.parentNode);l=rf(d,i).positionAbsolute}const u=a?KT(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function _x({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const KR=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...qT(l)}})};function qh(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);n(r,{...i})}}function q3({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:s,nodeInternals:a}=t.getState(),l=a.get(e);t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(o({nodes:[l]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function Dme(){const e=qr();return L.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function bx(e){return(t,n,r)=>e==null?void 0:e(t,r)}function TB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:s}){const a=qr(),[l,u]=L.useState(!1),d=L.useRef([]),f=L.useRef({x:null,y:null}),p=L.useRef(0),g=L.useRef(null),m=L.useRef({x:0,y:0}),v=L.useRef(null),x=L.useRef(!1),_=Dme();return L.useEffect(()=>{if(e!=null&&e.current){const b=jo(e.current),y=({x:C,y:T})=>{const{nodeInternals:E,onNodeDrag:P,onSelectionDrag:k,updateNodePositions:O,nodeExtent:M,snapGrid:G,snapToGrid:U,nodeOrigin:A,onError:N}=a.getState();f.current={x:C,y:T};let F=!1;if(d.current=d.current.map(D=>{const V={x:C-D.distance.x,y:T-D.distance.y};U&&(V.x=G[0]*Math.round(V.x/G[0]),V.y=G[1]*Math.round(V.y/G[1]));const j=CB(D,V,E,M,A,N);return F=F||D.position.x!==j.position.x||D.position.y!==j.position.y,D.position=j.position,D.positionAbsolute=j.positionAbsolute,D}),!F)return;O(d.current,!0,!0),u(!0);const B=i?P:bx(k);if(B&&v.current){const[D,V]=_x({nodeId:i,dragItems:d.current,nodeInternals:E});B(v.current,D,V)}},S=()=>{if(!g.current)return;const[C,T]=XF(m.current,g.current);if(C!==0||T!==0){const{transform:E,panBy:P}=a.getState();f.current.x=(f.current.x??0)-C/E[2],f.current.y=(f.current.y??0)-T/E[2],P({x:C,y:T})&&y(f.current)}p.current=requestAnimationFrame(S)};if(t)b.on(".drag",null);else{const C=tpe().on("start",T=>{var F;const{nodeInternals:E,multiSelectionActive:P,domNode:k,nodesDraggable:O,unselectNodesAndEdges:M,onNodeDragStart:G,onSelectionDragStart:U}=a.getState(),A=i?G:bx(U);!s&&!P&&i&&((F=E.get(i))!=null&&F.selected||M()),i&&o&&s&&q3({id:i,store:a,nodeRef:e});const N=_(T);if(f.current=N,d.current=Nme(E,O,N,i),A&&d.current){const[B,D]=_x({nodeId:i,dragItems:d.current,nodeInternals:E});A(T.sourceEvent,B,D)}g.current=(k==null?void 0:k.getBoundingClientRect())||null,m.current=Ml(T.sourceEvent,g.current)}).on("drag",T=>{const E=_(T),{autoPanOnNodeDrag:P}=a.getState();!x.current&&P&&(x.current=!0,S()),(f.current.x!==E.xSnapped||f.current.y!==E.ySnapped)&&d.current&&(v.current=T.sourceEvent,m.current=Ml(T.sourceEvent,g.current),y(E))}).on("end",T=>{if(u(!1),x.current=!1,cancelAnimationFrame(p.current),d.current){const{updateNodePositions:E,nodeInternals:P,onNodeDragStop:k,onSelectionDragStop:O}=a.getState(),M=i?k:bx(O);if(E(d.current,!1,!1),M){const[G,U]=_x({nodeId:i,dragItems:d.current,nodeInternals:P});M(T.sourceEvent,G,U)}}}).filter(T=>{const E=T.target;return!T.button&&(!n||!qR(E,`.${n}`,e))&&(!r||qR(E,r,e))});return b.call(C),()=>{b.on(".drag",null)}}}},[e,t,n,r,o,a,i,s,_]),l}function EB(){const e=qr();return L.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:s,snapToGrid:a,snapGrid:l,onError:u,nodesDraggable:d}=e.getState(),f=s().filter(b=>b.selected&&(b.draggable||d&&typeof b.draggable>"u")),p=a?l[0]:5,g=a?l[1]:5,m=n.isShiftPressed?4:1,v=n.x*p*m,x=n.y*g*m,_=f.map(b=>{if(b.positionAbsolute){const y={x:b.positionAbsolute.x+v,y:b.positionAbsolute.y+x};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:S,position:C}=CB(b,y,r,i,void 0,u);b.position=C,b.positionAbsolute=S}return b});o(_,!0,!1)},[])}const of={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Kh=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:u,onClick:d,onMouseEnter:f,onMouseMove:p,onMouseLeave:g,onContextMenu:m,onDoubleClick:v,style:x,className:_,isDraggable:b,isSelectable:y,isConnectable:S,isFocusable:C,selectNodesOnDrag:T,sourcePosition:E,targetPosition:P,hidden:k,resizeObserver:O,dragHandle:M,zIndex:G,isParent:U,noDragClassName:A,noPanClassName:N,initialized:F,disableKeyboardA11y:B,ariaLabel:D,rfId:V})=>{const j=qr(),q=L.useRef(null),Z=L.useRef(E),ee=L.useRef(P),ie=L.useRef(r),se=y||b||d||f||p||g,le=EB(),W=qh(n,j.getState,f),ne=qh(n,j.getState,p),fe=qh(n,j.getState,g),pe=qh(n,j.getState,m),ve=qh(n,j.getState,v),ye=Ee=>{if(y&&(!T||!b)&&q3({id:n,store:j,nodeRef:q}),d){const lt=j.getState().nodeInternals.get(n);d(Ee,{...lt})}},We=Ee=>{if(!j3(Ee))if(JF.includes(Ee.key)&&y){const lt=Ee.key==="Escape";q3({id:n,store:j,unselect:lt,nodeRef:q})}else!B&&b&&u&&Object.prototype.hasOwnProperty.call(of,Ee.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${Ee.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~s}`}),le({x:of[Ee.key].x,y:of[Ee.key].y,isShiftPressed:Ee.shiftKey}))};L.useEffect(()=>{if(q.current&&!k){const Ee=q.current;return O==null||O.observe(Ee),()=>O==null?void 0:O.unobserve(Ee)}},[k]),L.useEffect(()=>{const Ee=ie.current!==r,lt=Z.current!==E,_e=ee.current!==P;q.current&&(Ee||lt||_e)&&(Ee&&(ie.current=r),lt&&(Z.current=E),_e&&(ee.current=P),j.getState().updateNodeDimensions([{id:n,nodeElement:q.current,forceUpdate:!0}]))},[n,r,E,P]);const Me=TB({nodeRef:q,disabled:k||!b,noDragClassName:A,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:T});return k?null:ue.jsx("div",{className:Eo(["react-flow__node",`react-flow__node-${r}`,{[N]:b},_,{selected:u,selectable:y,parent:U,dragging:Me}]),ref:q,style:{zIndex:G,transform:`translate(${a}px,${l}px)`,pointerEvents:se?"all":"none",visibility:F?"visible":"hidden",...x},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:W,onMouseMove:ne,onMouseLeave:fe,onContextMenu:pe,onClick:ye,onDoubleClick:ve,onKeyDown:C?We:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":B?void 0:`${SB}-${V}`,"aria-label":D,children:ue.jsx(ome,{value:n,children:ue.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:s,selected:u,isConnectable:S,sourcePosition:E,targetPosition:P,dragging:Me,dragHandle:M,zIndex:G})})})};return t.displayName="NodeWrapper",L.memo(t)};function $me(e){const t={input:Kh(e.input||yB),default:Kh(e.default||W3),output:Kh(e.output||_B),group:Kh(e.group||eE)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=Kh(e[o]||W3),i),n);return{...t,...r}}const Fme=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},Bme=typeof document<"u"?document:null;var kg=(e=null,t={target:Bme})=>{const[n,r]=L.useState(!1),i=L.useRef(!1),o=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),d=u.reduce((f,p)=>f.concat(...p),[]);return[u,d]}return[[],[]]},[e]);return L.useEffect(()=>{var l,u;if(e!==null){const d=g=>{if(i.current=g.ctrlKey||g.metaKey||g.shiftKey,!i.current&&j3(g))return!1;const m=YR(g.code,a);o.current.add(g[m]),XR(s,o.current,!1)&&(g.preventDefault(),r(!0))},f=g=>{if(!i.current&&j3(g))return!1;const m=YR(g.code,a);XR(s,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(g[m]),i.current=!1},p=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",d),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",f),window.addEventListener("blur",p),()=>{var g,m;(g=t==null?void 0:t.target)==null||g.removeEventListener("keydown",d),(m=t==null?void 0:t.target)==null||m.removeEventListener("keyup",f),window.removeEventListener("blur",p)}}},[e,r]),n};function XR(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function YR(e,t){return t.includes(e)?"code":"key"}function AB(e,t,n,r){var s,a;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=rf(i,r);return AB(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((s=i[nr])==null?void 0:s.z)??0)>(n.z??0)?((a=i[nr])==null?void 0:a.z)??0:n.z??0},r)}function PB(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:s,z:a}=AB(r,e,{...r.position,z:((i=r[nr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:s},r[nr].z=a,n!=null&&n[r.id]&&(r[nr].isParent=!0)}})}function Sx(e,t,n,r){const i=new Map,o={},s=r?1e3:0;return e.forEach(a=>{var f;const l=(_o(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),d={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(d.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(d,nr,{enumerable:!1,value:{handleBounds:(f=u==null?void 0:u[nr])==null?void 0:f.handleBounds,z:l}}),i.set(a.id,d)}),PB(i,n,o),i}function RB(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:d,nodeOrigin:f}=e(),p=t.initial&&!u&&d;if(a&&l&&(p||!t.initial)){const m=n().filter(x=>{var b;const _=t.includeHiddenNodes?x.width&&x.height:!x.hidden;return(b=t.nodes)!=null&&b.length?_&&t.nodes.some(y=>y.id===x.id):_}),v=m.every(x=>x.width&&x.height);if(m.length>0&&v){const x=aB(m,f),[_,b,y]=cB(x,r,i,t.minZoom??o,t.maxZoom??s,t.padding??.1),S=Il.translate(_,b).scale(y);return typeof t.duration=="number"&&t.duration>0?a.transform(Pu(l,t.duration),S):a.transform(l,S),!0}}return!1}function Ume(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[nr]:r[nr],selected:n.selected})}),new Map(t)}function zme(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function P0({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Ume(e,i)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:zme(t,o)}),a==null||a(t))}const od=()=>{},Vme={zoomIn:od,zoomOut:od,zoomTo:od,getZoom:()=>1,setViewport:od,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:od,fitBounds:od,project:e=>e,viewportInitialized:!1},jme=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Gme=()=>{const e=qr(),{d3Zoom:t,d3Selection:n}=Nn(jme,Ri);return L.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Pu(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Pu(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Pu(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[s,a,l]=e.getState().transform,u=Il.translate(i.x??s,i.y??a).scale(i.zoom??l);t.transform(Pu(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,s]=e.getState().transform;return{x:i,y:o,zoom:s}},fitView:i=>RB(e.getState,i),setCenter:(i,o,s)=>{const{width:a,height:l,maxZoom:u}=e.getState(),d=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,f=a/2-i*d,p=l/2-o*d,g=Il.translate(f,p).scale(d);t.transform(Pu(n,s==null?void 0:s.duration),g)},fitBounds:(i,o)=>{const{width:s,height:a,minZoom:l,maxZoom:u}=e.getState(),[d,f,p]=cB(i,s,a,l,u,(o==null?void 0:o.padding)??.1),g=Il.translate(d,f).scale(p);t.transform(Pu(n,o==null?void 0:o.duration),g)},project:i=>{const{transform:o,snapToGrid:s,snapGrid:a}=e.getState();return sB(i,o,s,a)},viewportInitialized:!0}:Vme,[t,n])};function OB(){const e=Gme(),t=qr(),n=L.useCallback(()=>t.getState().getNodes().map(v=>({...v})),[]),r=L.useCallback(v=>t.getState().nodeInternals.get(v),[]),i=L.useCallback(()=>{const{edges:v=[]}=t.getState();return v.map(x=>({...x}))},[]),o=L.useCallback(v=>{const{edges:x=[]}=t.getState();return x.find(_=>_.id===v)},[]),s=L.useCallback(v=>{const{getNodes:x,setNodes:_,hasDefaultNodes:b,onNodesChange:y}=t.getState(),S=x(),C=typeof v=="function"?v(S):v;if(b)_(C);else if(y){const T=C.length===0?S.map(E=>({type:"remove",id:E.id})):C.map(E=>({item:E,type:"reset"}));y(T)}},[]),a=L.useCallback(v=>{const{edges:x=[],setEdges:_,hasDefaultEdges:b,onEdgesChange:y}=t.getState(),S=typeof v=="function"?v(x):v;if(b)_(S);else if(y){const C=S.length===0?x.map(T=>({type:"remove",id:T.id})):S.map(T=>({item:T,type:"reset"}));y(C)}},[]),l=L.useCallback(v=>{const x=Array.isArray(v)?v:[v],{getNodes:_,setNodes:b,hasDefaultNodes:y,onNodesChange:S}=t.getState();if(y){const T=[..._(),...x];b(T)}else if(S){const C=x.map(T=>({item:T,type:"add"}));S(C)}},[]),u=L.useCallback(v=>{const x=Array.isArray(v)?v:[v],{edges:_=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:S}=t.getState();if(y)b([..._,...x]);else if(S){const C=x.map(T=>({item:T,type:"add"}));S(C)}},[]),d=L.useCallback(()=>{const{getNodes:v,edges:x=[],transform:_}=t.getState(),[b,y,S]=_;return{nodes:v().map(C=>({...C})),edges:x.map(C=>({...C})),viewport:{x:b,y,zoom:S}}},[]),f=L.useCallback(({nodes:v,edges:x})=>{const{nodeInternals:_,getNodes:b,edges:y,hasDefaultNodes:S,hasDefaultEdges:C,onNodesDelete:T,onEdgesDelete:E,onNodesChange:P,onEdgesChange:k}=t.getState(),O=(v||[]).map(N=>N.id),M=(x||[]).map(N=>N.id),G=b().reduce((N,F)=>{const B=!O.includes(F.id)&&F.parentNode&&N.find(V=>V.id===F.parentNode);return(typeof F.deletable=="boolean"?F.deletable:!0)&&(O.includes(F.id)||B)&&N.push(F),N},[]),U=y.filter(N=>typeof N.deletable=="boolean"?N.deletable:!0),A=U.filter(N=>M.includes(N.id));if(G||A){const N=uB(G,U),F=[...A,...N],B=F.reduce((D,V)=>(D.includes(V.id)||D.push(V.id),D),[]);if((C||S)&&(C&&t.setState({edges:y.filter(D=>!B.includes(D.id))}),S&&(G.forEach(D=>{_.delete(D.id)}),t.setState({nodeInternals:new Map(_)}))),B.length>0&&(E==null||E(F),k&&k(B.map(D=>({id:D,type:"remove"})))),G.length>0&&(T==null||T(G),P)){const D=G.map(V=>({id:V.id,type:"remove"}));P(D)}}},[]),p=L.useCallback(v=>{const x=Zge(v),_=x?null:t.getState().nodeInternals.get(v.id);return[x?v:NR(_),_,x]},[]),g=L.useCallback((v,x=!0,_)=>{const[b,y,S]=p(v);return b?(_||t.getState().getNodes()).filter(C=>{if(!S&&(C.id===y.id||!C.positionAbsolute))return!1;const T=NR(C),E=V3(T,b);return x&&E>0||E>=v.width*v.height}):[]},[]),m=L.useCallback((v,x,_=!0)=>{const[b]=p(v);if(!b)return!1;const y=V3(b,x);return _&&y>0||y>=v.width*v.height},[]);return L.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:s,setEdges:a,addNodes:l,addEdges:u,toObject:d,deleteElements:f,getIntersectingNodes:g,isNodeIntersecting:m}),[e,n,r,i,o,s,a,l,u,d,f,g,m])}var Hme=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=qr(),{deleteElements:r}=OB(),i=kg(e),o=kg(t);L.useEffect(()=>{if(i){const{edges:s,getNodes:a}=n.getState(),l=a().filter(d=>d.selected),u=s.filter(d=>d.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),L.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Wme(e){const t=qr();L.useEffect(()=>{let n;const r=()=>{var o,s;if(!e.current)return;const i=qT(e.current);(i.height===0||i.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",Wl.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const tE={position:"absolute",width:"100%",height:"100%",top:0,left:0},qme=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,wx=e=>({x:e.x,y:e.y,zoom:e.k}),sd=(e,t)=>e.target.closest(`.${t}`),QR=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kme=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Xme=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=nf.Free,zoomOnDoubleClick:u=!0,elementsSelectable:d,panOnDrag:f=!0,defaultViewport:p,translateExtent:g,minZoom:m,maxZoom:v,zoomActivationKeyCode:x,preventScrolling:_=!0,children:b,noWheelClassName:y,noPanClassName:S})=>{const C=L.useRef(),T=qr(),E=L.useRef(!1),P=L.useRef(!1),k=L.useRef(null),O=L.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:G,d3ZoomHandler:U,userSelectionActive:A}=Nn(Kme,Ri),N=kg(x),F=L.useRef(0);return Wme(k),L.useEffect(()=>{if(k.current){const B=k.current.getBoundingClientRect(),D=Hge().scaleExtent([m,v]).translateExtent(g),V=jo(k.current).call(D),j=Il.translate(p.x,p.y).scale(Af(p.zoom,m,v)),q=[[0,0],[B.width,B.height]],Z=D.constrain()(j,q,g);D.transform(V,Z),T.setState({d3Zoom:D,d3Selection:V,d3ZoomHandler:V.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:k.current.closest(".react-flow")})}},[]),L.useEffect(()=>{G&&M&&(s&&!N&&!A?G.on("wheel.zoom",B=>{if(sd(B,y))return!1;B.preventDefault(),B.stopImmediatePropagation();const D=G.property("__zoom").k||1;if(B.ctrlKey&&o){const Z=gs(B),ee=-B.deltaY*(B.deltaMode===1?.05:B.deltaMode?1:.002)*10,ie=D*Math.pow(2,ee);M.scaleTo(G,ie,Z);return}const V=B.deltaMode===1?20:1,j=l===nf.Vertical?0:B.deltaX*V,q=l===nf.Horizontal?0:B.deltaY*V;M.translateBy(G,-(j/D)*a,-(q/D)*a)},{passive:!1}):typeof U<"u"&&G.on("wheel.zoom",function(B,D){if(!_||sd(B,y))return null;B.preventDefault(),U.call(this,B,D)},{passive:!1}))},[A,s,l,G,M,U,N,o,_,y]),L.useEffect(()=>{M&&M.on("start",B=>{var V;if(!B.sourceEvent)return null;F.current=B.sourceEvent.button;const{onViewportChangeStart:D}=T.getState();if(E.current=!0,((V=B.sourceEvent)==null?void 0:V.type)==="mousedown"&&T.setState({paneDragging:!0}),t||D){const j=wx(B.transform);O.current=j,D==null||D(j),t==null||t(B.sourceEvent,j)}})},[M,t]),L.useEffect(()=>{M&&(A&&!E.current?M.on("zoom",null):A||M.on("zoom",B=>{const{onViewportChange:D}=T.getState();if(T.setState({transform:[B.transform.x,B.transform.y,B.transform.k]}),P.current=!!(r&&QR(f,F.current??0)),e||D){const V=wx(B.transform);D==null||D(V),e==null||e(B.sourceEvent,V)}}))},[A,M,e,f,r]),L.useEffect(()=>{M&&M.on("end",B=>{if(!B.sourceEvent)return null;const{onViewportChangeEnd:D}=T.getState();if(E.current=!1,T.setState({paneDragging:!1}),r&&QR(f,F.current??0)&&!P.current&&r(B.sourceEvent),P.current=!1,(n||D)&&qme(O.current,B.transform)){const V=wx(B.transform);O.current=V,clearTimeout(C.current),C.current=setTimeout(()=>{D==null||D(V),n==null||n(B.sourceEvent,V)},s?150:0)}})},[M,s,f,n,r]),L.useEffect(()=>{M&&M.filter(B=>{const D=N||i,V=o&&B.ctrlKey;if(B.button===1&&B.type==="mousedown"&&(sd(B,"react-flow__node")||sd(B,"react-flow__edge")))return!0;if(!f&&!D&&!s&&!u&&!o||A||!u&&B.type==="dblclick"||sd(B,y)&&B.type==="wheel"||sd(B,S)&&B.type!=="wheel"||!o&&B.ctrlKey&&B.type==="wheel"||!D&&!s&&!V&&B.type==="wheel"||!f&&(B.type==="mousedown"||B.type==="touchstart")||Array.isArray(f)&&!f.includes(B.button)&&(B.type==="mousedown"||B.type==="touchstart"))return!1;const j=Array.isArray(f)&&f.includes(B.button)||!B.button||B.button<=1;return(!B.ctrlKey||B.type==="wheel")&&j})},[A,M,i,o,s,u,f,d,N]),ue.jsx("div",{className:"react-flow__renderer",ref:k,style:tE,children:b})},Yme=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qme(){const{userSelectionActive:e,userSelectionRect:t}=Nn(Yme,Ri);return e&&t?ue.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function ZR(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function kB(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(a=>a.id===i.id);if(o.length===0)return r.push(i),r;const s={...i};for(const a of o)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&ZR(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&ZR(r,s);break}case"remove":return r}return r.push(s),r},n)}function IB(e,t){return kB(e,t)}function Zme(e,t){return kB(e,t)}const dl=(e,t)=>({id:e,type:"select",selected:t});function Ld(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(dl(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(dl(r.id,!1))),n},[])}const xx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Jme=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),MB=L.memo(({isSelecting:e,selectionMode:t=Og.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:d,children:f})=>{const p=L.useRef(null),g=qr(),m=L.useRef(0),v=L.useRef(0),x=L.useRef(),{userSelectionActive:_,elementsSelectable:b,dragging:y}=Nn(Jme,Ri),S=()=>{g.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,v.current=0},C=U=>{o==null||o(U),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},T=U=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){U.preventDefault();return}s==null||s(U)},E=a?U=>a(U):void 0,P=U=>{const{resetSelectedElements:A,domNode:N}=g.getState();if(x.current=N==null?void 0:N.getBoundingClientRect(),!b||!e||U.button!==0||U.target!==p.current||!x.current)return;const{x:F,y:B}=Ml(U,x.current);A(),g.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),r==null||r(U)},k=U=>{const{userSelectionRect:A,nodeInternals:N,edges:F,transform:B,onNodesChange:D,onEdgesChange:V,nodeOrigin:j,getNodes:q}=g.getState();if(!e||!x.current||!A)return;g.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Z=Ml(U,x.current),ee=A.startX??0,ie=A.startY??0,se={...A,x:Z.xpe.id),fe=W.map(pe=>pe.id);if(m.current!==fe.length){m.current=fe.length;const pe=Ld(le,fe);pe.length&&(D==null||D(pe))}if(v.current!==ne.length){v.current=ne.length;const pe=Ld(F,ne);pe.length&&(V==null||V(pe))}g.setState({userSelectionRect:se})},O=U=>{if(U.button!==0)return;const{userSelectionRect:A}=g.getState();!_&&A&&U.target===p.current&&(C==null||C(U)),g.setState({nodesSelectionActive:m.current>0}),S(),i==null||i(U)},M=U=>{_&&(g.setState({nodesSelectionActive:m.current>0}),i==null||i(U)),S()},G=b&&(e||_);return ue.jsxs("div",{className:Eo(["react-flow__pane",{dragging:y,selection:e}]),onClick:G?void 0:xx(C,p),onContextMenu:xx(T,p),onWheel:xx(E,p),onMouseEnter:G?void 0:l,onMouseDown:G?P:void 0,onMouseMove:G?k:u,onMouseUp:G?O:void 0,onMouseLeave:G?M:d,ref:p,style:tE,children:[f,ue.jsx(Qme,{})]})});MB.displayName="Pane";const eye=e=>{const t=e.getNodes().filter(n=>n.selected);return{...aB(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function tye({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=qr(),{width:i,height:o,x:s,y:a,transformString:l,userSelectionActive:u}=Nn(eye,Ri),d=EB(),f=L.useRef(null);if(L.useEffect(()=>{var m;n||(m=f.current)==null||m.focus({preventScroll:!0})},[n]),TB({nodeRef:f}),u||!i||!o)return null;const p=e?m=>{const v=r.getState().getNodes().filter(x=>x.selected);e(m,v)}:void 0,g=m=>{Object.prototype.hasOwnProperty.call(of,m.key)&&d({x:of[m.key].x,y:of[m.key].y,isShiftPressed:m.shiftKey})};return ue.jsx("div",{className:Eo(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:ue.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:i,height:o,top:a,left:s}})})}var nye=L.memo(tye);const rye=e=>e.nodesSelectionActive,NB=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:u,onMoveEnd:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:g,onSelectionStart:m,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:_,zoomActivationKeyCode:b,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:k,panOnDrag:O,defaultViewport:M,translateExtent:G,minZoom:U,maxZoom:A,preventScrolling:N,onSelectionContextMenu:F,noWheelClassName:B,noPanClassName:D,disableKeyboardA11y:V})=>{const j=Nn(rye),q=kg(f),ee=kg(_)||O,ie=q||p&&ee!==!0;return Hme({deleteKeyCode:a,multiSelectionKeyCode:x}),ue.jsx(Xme,{onMove:l,onMoveStart:u,onMoveEnd:d,onPaneContextMenu:o,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:k,panOnDrag:!q&&ee,defaultViewport:M,translateExtent:G,minZoom:U,maxZoom:A,zoomActivationKeyCode:b,preventScrolling:N,noWheelClassName:B,noPanClassName:D,children:ue.jsxs(MB,{onSelectionStart:m,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,panOnDrag:ee,isSelecting:!!ie,selectionMode:g,children:[e,j&&ue.jsx(nye,{onSelectionContextMenu:F,noPanClassName:D,disableKeyboardA11y:V})]})})};NB.displayName="FlowRenderer";var iye=L.memo(NB);function oye(e){return Nn(L.useCallback(n=>e?lB(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}const sye=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),LB=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:s}=Nn(sye,Ri),a=oye(e.onlyRenderVisibleElements),l=L.useRef(),u=L.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(f=>{const p=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));o(p)});return l.current=d,d},[]);return L.useEffect(()=>()=>{var d;(d=l==null?void 0:l.current)==null||d.disconnect()},[]),ue.jsx("div",{className:"react-flow__nodes",style:tE,children:a.map(d=>{var C,T;let f=d.type||"default";e.nodeTypes[f]||(s==null||s("003",Wl.error003(f)),f="default");const p=e.nodeTypes[f]||e.nodeTypes.default,g=!!(d.draggable||t&&typeof d.draggable>"u"),m=!!(d.selectable||i&&typeof d.selectable>"u"),v=!!(d.connectable||n&&typeof d.connectable>"u"),x=!!(d.focusable||r&&typeof d.focusable>"u"),_=e.nodeExtent?KT(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,b=(_==null?void 0:_.x)??0,y=(_==null?void 0:_.y)??0,S=Fme({x:b,y,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.jsx(p,{id:d.id,className:d.className,style:d.style,type:f,data:d.data,sourcePosition:d.sourcePosition||Ne.Bottom,targetPosition:d.targetPosition||Ne.Top,hidden:d.hidden,xPos:b,yPos:y,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:g,isSelectable:m,isConnectable:v,isFocusable:x,resizeObserver:u,dragHandle:d.dragHandle,zIndex:((C=d[nr])==null?void 0:C.z)??0,isParent:!!((T=d[nr])!=null&&T.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel},d.id)})})};LB.displayName="NodeRenderer";var aye=L.memo(LB);const lye=[{level:0,isMaxLevel:!0,edges:[]}];function uye(e,t,n=!1){let r=-1;const i=e.reduce((s,a)=>{var d,f;const l=_o(a.zIndex);let u=l?a.zIndex:0;if(n){const p=t.get(a.target),g=t.get(a.source),m=a.selected||(p==null?void 0:p.selected)||(g==null?void 0:g.selected),v=Math.max(((d=g==null?void 0:g[nr])==null?void 0:d.z)||0,((f=p==null?void 0:p[nr])==null?void 0:f.z)||0,1e3);u=(l?a.zIndex:0)+(m?v:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),o=Object.entries(i).map(([s,a])=>{const l=+s;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?lye:o}function cye(e,t,n){const r=Nn(L.useCallback(i=>e?i.edges.filter(o=>{const s=t.get(o.source),a=t.get(o.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&Mme({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return uye(r,t,n)}const dye=({color:e="none",strokeWidth:t=1})=>ue.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),fye=({color:e="none",strokeWidth:t=1})=>ue.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),JR={[B1.Arrow]:dye,[B1.ArrowClosed]:fye};function hye(e){const t=qr();return L.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(JR,e)?JR[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",Wl.error009(e)),null)},[e])}const pye=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=hye(t);return l?ue.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:ue.jsx(l,{color:n,strokeWidth:s})}):null},gye=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=H3(s,t);r.includes(a)||(i.push({id:a,color:s.color||e,...s}),r.push(a))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},DB=({defaultColor:e,rfId:t})=>{const n=Nn(L.useCallback(gye({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,s)=>o.id!==i[s].id)));return ue.jsx("defs",{children:n.map(r=>ue.jsx(pye,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};DB.displayName="MarkerDefinitions";var mye=L.memo(DB);const yye=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),$B=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:g,onEdgeUpdateStart:m,onEdgeUpdateEnd:v,children:x})=>{const{edgesFocusable:_,edgesUpdatable:b,elementsSelectable:y,width:S,height:C,connectionMode:T,nodeInternals:E,onError:P}=Nn(yye,Ri),k=cye(t,E,n);return S?ue.jsxs(ue.Fragment,{children:[k.map(({level:O,edges:M,isMaxLevel:G})=>ue.jsxs("svg",{style:{zIndex:O},width:S,height:C,className:"react-flow__edges react-flow__container",children:[G&&ue.jsx(mye,{defaultColor:e,rfId:r}),ue.jsx("g",{children:M.map(U=>{const[A,N,F]=WR(E.get(U.source)),[B,D,V]=WR(E.get(U.target));if(!F||!V)return null;let j=U.type||"default";i[j]||(P==null||P("011",Wl.error011(j)),j="default");const q=i[j]||i.default,Z=T===sc.Strict?D.target:(D.target??[]).concat(D.source??[]),ee=HR(N.source,U.sourceHandle),ie=HR(Z,U.targetHandle),se=(ee==null?void 0:ee.position)||Ne.Bottom,le=(ie==null?void 0:ie.position)||Ne.Top,W=!!(U.focusable||_&&typeof U.focusable>"u"),ne=typeof s<"u"&&(U.updatable||b&&typeof U.updatable>"u");if(!ee||!ie)return P==null||P("008",Wl.error008(ee,U)),null;const{sourceX:fe,sourceY:pe,targetX:ve,targetY:ye}=Ime(A,ee,se,B,ie,le);return ue.jsx(q,{id:U.id,className:Eo([U.className,o]),type:j,data:U.data,selected:!!U.selected,animated:!!U.animated,hidden:!!U.hidden,label:U.label,labelStyle:U.labelStyle,labelShowBg:U.labelShowBg,labelBgStyle:U.labelBgStyle,labelBgPadding:U.labelBgPadding,labelBgBorderRadius:U.labelBgBorderRadius,style:U.style,source:U.source,target:U.target,sourceHandleId:U.sourceHandle,targetHandleId:U.targetHandle,markerEnd:U.markerEnd,markerStart:U.markerStart,sourceX:fe,sourceY:pe,targetX:ve,targetY:ye,sourcePosition:se,targetPosition:le,elementsSelectable:y,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:g,onEdgeUpdateStart:m,onEdgeUpdateEnd:v,rfId:r,ariaLabel:U.ariaLabel,isFocusable:W,isUpdatable:ne,pathOptions:"pathOptions"in U?U.pathOptions:void 0,interactionWidth:U.interactionWidth},U.id)})})]},O)),x]}):null};$B.displayName="EdgeRenderer";var vye=L.memo($B);const _ye=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function bye({children:e}){const t=Nn(_ye);return ue.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function Sye(e){const t=OB(),n=L.useRef(!1);L.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const wye={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top},FB=({nodeId:e,handleType:t,style:n,type:r=yl.Bezier,CustomComponent:i,connectionStatus:o})=>{var T,E,P;const{fromNode:s,handleId:a,toX:l,toY:u,connectionMode:d}=Nn(L.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),Ri),f=(T=s==null?void 0:s[nr])==null?void 0:T.handleBounds;let p=f==null?void 0:f[t];if(d===sc.Loose&&(p=p||(f==null?void 0:f[t==="source"?"target":"source"])),!s||!p)return null;const g=a?p.find(k=>k.id===a):p[0],m=g?g.x+g.width/2:(s.width??0)/2,v=g?g.y+g.height/2:s.height??0,x=(((E=s.positionAbsolute)==null?void 0:E.x)??0)+m,_=(((P=s.positionAbsolute)==null?void 0:P.y)??0)+v,b=g==null?void 0:g.position,y=b?wye[b]:null;if(!b||!y)return null;if(i)return ue.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:g,fromX:x,fromY:_,toX:l,toY:u,fromPosition:b,toPosition:y,connectionStatus:o});let S="";const C={sourceX:x,sourceY:_,sourcePosition:b,targetX:l,targetY:u,targetPosition:y};return r===yl.Bezier?[S]=iB(C):r===yl.Step?[S]=G3({...C,borderRadius:0}):r===yl.SmoothStep?[S]=G3(C):r===yl.SimpleBezier?[S]=rB(C):S=`M${x},${_} ${l},${u}`,ue.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:n})};FB.displayName="ConnectionLine";const xye=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Cye({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:s,width:a,height:l,connectionStatus:u}=Nn(xye,Ri);return!(i&&o&&a&&s)?null:ue.jsx("svg",{style:e,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:ue.jsx("g",{className:Eo(["react-flow__connection",u]),children:ue.jsx(FB,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}const BB=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,onSelectionContextMenu:m,onSelectionStart:v,onSelectionEnd:x,connectionLineType:_,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:S,selectionKeyCode:C,selectionOnDrag:T,selectionMode:E,multiSelectionKeyCode:P,panActivationKeyCode:k,zoomActivationKeyCode:O,deleteKeyCode:M,onlyRenderVisibleElements:G,elementsSelectable:U,selectNodesOnDrag:A,defaultViewport:N,translateExtent:F,minZoom:B,maxZoom:D,preventScrolling:V,defaultMarkerColor:j,zoomOnScroll:q,zoomOnPinch:Z,panOnScroll:ee,panOnScrollSpeed:ie,panOnScrollMode:se,zoomOnDoubleClick:le,panOnDrag:W,onPaneClick:ne,onPaneMouseEnter:fe,onPaneMouseMove:pe,onPaneMouseLeave:ve,onPaneScroll:ye,onPaneContextMenu:We,onEdgeUpdate:Me,onEdgeContextMenu:Ee,onEdgeMouseEnter:lt,onEdgeMouseMove:_e,onEdgeMouseLeave:jt,edgeUpdaterRadius:Wn,onEdgeUpdateStart:Bt,onEdgeUpdateEnd:it,noDragClassName:mt,noWheelClassName:Jt,noPanClassName:Mr,elevateEdgesOnSelect:yr,disableKeyboardA11y:hi,nodeOrigin:wn,nodeExtent:on,rfId:qn})=>(Sye(o),ue.jsx(iye,{onPaneClick:ne,onPaneMouseEnter:fe,onPaneMouseMove:pe,onPaneMouseLeave:ve,onPaneContextMenu:We,onPaneScroll:ye,deleteKeyCode:M,selectionKeyCode:C,selectionOnDrag:T,selectionMode:E,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:P,panActivationKeyCode:k,zoomActivationKeyCode:O,elementsSelectable:U,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:q,zoomOnPinch:Z,zoomOnDoubleClick:le,panOnScroll:ee,panOnScrollSpeed:ie,panOnScrollMode:se,panOnDrag:W,defaultViewport:N,translateExtent:F,minZoom:B,maxZoom:D,onSelectionContextMenu:m,preventScrolling:V,noDragClassName:mt,noWheelClassName:Jt,noPanClassName:Mr,disableKeyboardA11y:hi,children:ue.jsxs(bye,{children:[ue.jsx(vye,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:Me,onlyRenderVisibleElements:G,onEdgeContextMenu:Ee,onEdgeMouseEnter:lt,onEdgeMouseMove:_e,onEdgeMouseLeave:jt,onEdgeUpdateStart:Bt,onEdgeUpdateEnd:it,edgeUpdaterRadius:Wn,defaultMarkerColor:j,noPanClassName:Mr,elevateEdgesOnSelect:!!yr,disableKeyboardA11y:hi,rfId:qn,children:ue.jsx(Cye,{style:b,type:_,component:y,containerStyle:S})}),ue.jsx("div",{className:"react-flow__edgelabel-renderer"}),ue.jsx(aye,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,selectNodesOnDrag:A,onlyRenderVisibleElements:G,noPanClassName:Mr,noDragClassName:mt,disableKeyboardA11y:hi,nodeOrigin:wn,nodeExtent:on,rfId:qn})]})}));BB.displayName="GraphView";var Tye=L.memo(BB);const K3=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],il={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:K3,nodeExtent:K3,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:sc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Jge,isValidConnection:void 0},Eye=()=>dfe((e,t)=>({...il,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:Sx(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",s=i?Sx(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:u}=t(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const f=window.getComputedStyle(d),{m22:p}=new window.DOMMatrixReadOnly(f.transform),g=n.reduce((v,x)=>{const _=i.get(x.id);if(_){const b=qT(x.nodeElement);!!(b.width&&b.height&&(_.width!==b.width||_.height!==b.height||x.forceUpdate))&&(i.set(_.id,{..._,[nr]:{..._[nr],handleBounds:{source:KR(".source",x.nodeElement,p,u),target:KR(".target",x.nodeElement,p,u)}},...b}),v.push({id:_.id,type:"dimensions",dimensions:b}))}return v},[]);PB(i,u);const m=s||o&&!s&&RB(t,{initial:!0,...a});e({nodeInternals:new Map(i),fitViewOnInitDone:m}),(g==null?void 0:g.length)>0&&(r==null||r(g))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:i};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=IB(n,a()),d=Sx(u,i,s,l);e({nodeInternals:d})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>dl(l,!0)):(s=Ld(o(),n),a=Ld(i,[])),P0({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>dl(l,!0)):(s=Ld(i,n),a=Ld(o(),[])),P0({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),s=n||o(),a=r||i,l=s.map(d=>(d.selected=!1,dl(d.id,!1))),u=a.map(d=>dl(d.id,!1));P0({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(a=>a.selected).map(a=>dl(a.id,!1)),s=n.filter(a=>a.selected).map(a=>dl(a.id,!1));P0({changedNodes:o,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=KT(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:s,d3Selection:a,translateExtent:l}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=Il.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),d=[[0,0],[i,o]],f=s==null?void 0:s.constrain()(u,d,l);return s.transform(a,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>e({connectionNodeId:il.connectionNodeId,connectionHandleId:il.connectionHandleId,connectionHandleType:il.connectionHandleType,connectionStatus:il.connectionStatus,connectionStartHandle:il.connectionStartHandle,connectionEndHandle:il.connectionEndHandle}),reset:()=>e({...il})})),UB=({children:e})=>{const t=L.useRef(null);return t.current||(t.current=Eye()),ue.jsx(Wge,{value:t.current,children:e})};UB.displayName="ReactFlowProvider";const zB=({children:e})=>L.useContext(Ib)?ue.jsx(ue.Fragment,{children:e}):ue.jsx(UB,{children:e});zB.displayName="ReactFlowWrapper";function eO(e,t){return L.useRef(null),L.useMemo(()=>t(e),[e])}const Aye={input:yB,default:W3,output:_B,group:eE},Pye={default:U1,straight:QT,step:YT,smoothstep:Mb,simplebezier:XT},Rye=[0,0],Oye=[15,15],kye={x:0,y:0,zoom:1},Iye={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Mye=L.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=Aye,edgeTypes:s=Pye,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:p,onConnect:g,onConnectStart:m,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:_,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:T,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:k,onNodesDelete:O,onEdgesDelete:M,onSelectionChange:G,onSelectionDragStart:U,onSelectionDrag:A,onSelectionDragStop:N,onSelectionContextMenu:F,onSelectionStart:B,onSelectionEnd:D,connectionMode:V=sc.Strict,connectionLineType:j=yl.Bezier,connectionLineStyle:q,connectionLineComponent:Z,connectionLineContainerStyle:ee,deleteKeyCode:ie="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:le=!1,selectionMode:W=Og.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:fe="Meta",zoomActivationKeyCode:pe="Meta",snapToGrid:ve=!1,snapGrid:ye=Oye,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:Me=!0,nodesDraggable:Ee,nodesConnectable:lt,nodesFocusable:_e,nodeOrigin:jt=Rye,edgesFocusable:Wn,edgesUpdatable:Bt,elementsSelectable:it,defaultViewport:mt=kye,minZoom:Jt=.5,maxZoom:Mr=2,translateExtent:yr=K3,preventScrolling:hi=!0,nodeExtent:wn,defaultMarkerColor:on="#b1b1b7",zoomOnScroll:qn=!0,zoomOnPinch:sn=!0,panOnScroll:Gt=!1,panOnScrollSpeed:vr=.5,panOnScrollMode:Nr=nf.Free,zoomOnDoubleClick:Xr=!0,panOnDrag:Ii=!0,onPaneClick:An,onPaneMouseEnter:Yr,onPaneMouseMove:Vs,onPaneMouseLeave:Ji,onPaneScroll:js,onPaneContextMenu:Xt,children:kt,onEdgeUpdate:Kn,onEdgeContextMenu:$n,onEdgeDoubleClick:or,onEdgeMouseEnter:_r,onEdgeMouseMove:br,onEdgeMouseLeave:eo,onEdgeUpdateStart:Sr,onEdgeUpdateEnd:Xn,edgeUpdaterRadius:Mi=10,onNodesChange:os,onEdgesChange:to,noDragClassName:Va="nodrag",noWheelClassName:Ao="nowheel",noPanClassName:wr="nopan",fitView:Gs=!1,fitViewOptions:Zf,connectOnClick:Jf=!0,attributionPosition:eh,proOptions:th,defaultEdgeOptions:Po,elevateNodesOnSelect:nh=!0,elevateEdgesOnSelect:rh=!1,disableKeyboardA11y:kc=!1,autoPanOnConnect:ih=!0,autoPanOnNodeDrag:oh=!0,connectionRadius:sh=20,isValidConnection:ss,onError:ah,style:Ro,id:ja,...lh},Ga)=>{const cu=eO(o,$me),Ic=eO(s,kme),Ha=ja||"1";return ue.jsx("div",{...lh,style:{...Ro,...Iye},ref:Ga,className:Eo(["react-flow",i]),"data-testid":"rf__wrapper",id:ja,children:ue.jsxs(zB,{children:[ue.jsx(Tye,{onInit:u,onMove:d,onMoveStart:f,onMoveEnd:p,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:T,nodeTypes:cu,edgeTypes:Ic,connectionLineType:j,connectionLineStyle:q,connectionLineComponent:Z,connectionLineContainerStyle:ee,selectionKeyCode:se,selectionOnDrag:le,selectionMode:W,deleteKeyCode:ie,multiSelectionKeyCode:fe,panActivationKeyCode:ne,zoomActivationKeyCode:pe,onlyRenderVisibleElements:We,selectNodesOnDrag:Me,defaultViewport:mt,translateExtent:yr,minZoom:Jt,maxZoom:Mr,preventScrolling:hi,zoomOnScroll:qn,zoomOnPinch:sn,zoomOnDoubleClick:Xr,panOnScroll:Gt,panOnScrollSpeed:vr,panOnScrollMode:Nr,panOnDrag:Ii,onPaneClick:An,onPaneMouseEnter:Yr,onPaneMouseMove:Vs,onPaneMouseLeave:Ji,onPaneScroll:js,onPaneContextMenu:Xt,onSelectionContextMenu:F,onSelectionStart:B,onSelectionEnd:D,onEdgeUpdate:Kn,onEdgeContextMenu:$n,onEdgeDoubleClick:or,onEdgeMouseEnter:_r,onEdgeMouseMove:br,onEdgeMouseLeave:eo,onEdgeUpdateStart:Sr,onEdgeUpdateEnd:Xn,edgeUpdaterRadius:Mi,defaultMarkerColor:on,noDragClassName:Va,noWheelClassName:Ao,noPanClassName:wr,elevateEdgesOnSelect:rh,rfId:Ha,disableKeyboardA11y:kc,nodeOrigin:jt,nodeExtent:wn}),ue.jsx(wme,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:m,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:_,nodesDraggable:Ee,nodesConnectable:lt,nodesFocusable:_e,edgesFocusable:Wn,edgesUpdatable:Bt,elementsSelectable:it,elevateNodesOnSelect:nh,minZoom:Jt,maxZoom:Mr,nodeExtent:wn,onNodesChange:os,onEdgesChange:to,snapToGrid:ve,snapGrid:ye,connectionMode:V,translateExtent:yr,connectOnClick:Jf,defaultEdgeOptions:Po,fitView:Gs,fitViewOptions:Zf,onNodesDelete:O,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:k,onSelectionDrag:A,onSelectionDragStart:U,onSelectionDragStop:N,noPanClassName:wr,nodeOrigin:jt,rfId:Ha,autoPanOnConnect:ih,autoPanOnNodeDrag:oh,onError:ah,connectionRadius:sh,isValidConnection:ss}),ue.jsx(bme,{onSelectionChange:G}),kt,ue.jsx(Xge,{proOptions:th,position:eh}),ue.jsx(Ame,{rfId:Ha,disableKeyboardA11y:kc})]})})});Mye.displayName="ReactFlow";var VB={},Nb={},Lb={};Object.defineProperty(Lb,"__esModule",{value:!0});Lb.createLogMethods=void 0;var Nye=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};Lb.createLogMethods=Nye;var nE={},Db={};Object.defineProperty(Db,"__esModule",{value:!0});Db.boolean=void 0;const Lye=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Db.boolean=Lye;var $b={};Object.defineProperty($b,"__esModule",{value:!0});$b.isBooleanable=void 0;const Dye=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};$b.isBooleanable=Dye;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Db;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=$b;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(nE);var tO=Object.prototype.toString,jB=function(t){var n=tO.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&tO.call(t.callee)==="[object Function]"),r},Cx,nO;function $ye(){if(nO)return Cx;nO=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=jB,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(p){var g=p.constructor;return g&&g.prototype===p},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if(typeof window>"u")return!1;for(var p in window)try{if(!u["$"+p]&&t.call(window,p)&&window[p]!==null&&typeof window[p]=="object")try{l(window[p])}catch{return!0}}catch{return!0}return!1}(),f=function(p){if(typeof window>"u"||!d)return l(p);try{return l(p)}catch{return!1}};e=function(g){var m=g!==null&&typeof g=="object",v=n.call(g)==="[object Function]",x=r(g),_=m&&n.call(g)==="[object String]",b=[];if(!m&&!v&&!x)throw new TypeError("Object.keys called on a non-object");var y=s&&v;if(_&&g.length>0&&!t.call(g,0))for(var S=0;S0)for(var C=0;C"u"||!ur?dt:ur(Uint8Array),qu={"%AggregateError%":typeof AggregateError>"u"?dt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?dt:ArrayBuffer,"%ArrayIteratorPrototype%":ad&&ur?ur([][Symbol.iterator]()):dt,"%AsyncFromSyncIteratorPrototype%":dt,"%AsyncFunction%":bd,"%AsyncGenerator%":bd,"%AsyncGeneratorFunction%":bd,"%AsyncIteratorPrototype%":bd,"%Atomics%":typeof Atomics>"u"?dt:Atomics,"%BigInt%":typeof BigInt>"u"?dt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?dt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?dt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?dt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?dt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?dt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?dt:FinalizationRegistry,"%Function%":HB,"%GeneratorFunction%":bd,"%Int8Array%":typeof Int8Array>"u"?dt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?dt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?dt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ad&&ur?ur(ur([][Symbol.iterator]())):dt,"%JSON%":typeof JSON=="object"?JSON:dt,"%Map%":typeof Map>"u"?dt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ad||!ur?dt:ur(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?dt:Promise,"%Proxy%":typeof Proxy>"u"?dt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?dt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?dt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ad||!ur?dt:ur(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?dt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ad&&ur?ur(""[Symbol.iterator]()):dt,"%Symbol%":ad?Symbol:dt,"%SyntaxError%":Pf,"%ThrowTypeError%":Jye,"%TypedArray%":t0e,"%TypeError%":sf,"%Uint8Array%":typeof Uint8Array>"u"?dt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?dt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?dt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?dt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?dt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?dt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?dt:WeakSet};if(ur)try{null.error}catch(e){var n0e=ur(ur(e));qu["%Error.prototype%"]=n0e}var r0e=function e(t){var n;if(t==="%AsyncFunction%")n=Ex("async function () {}");else if(t==="%GeneratorFunction%")n=Ex("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=Ex("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&ur&&(n=ur(i.prototype))}return qu[t]=n,n},aO={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bm=GB,V1=Zye,i0e=bm.call(Function.call,Array.prototype.concat),o0e=bm.call(Function.apply,Array.prototype.splice),lO=bm.call(Function.call,String.prototype.replace),j1=bm.call(Function.call,String.prototype.slice),s0e=bm.call(Function.call,RegExp.prototype.exec),a0e=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,l0e=/\\(\\)?/g,u0e=function(t){var n=j1(t,0,1),r=j1(t,-1);if(n==="%"&&r!=="%")throw new Pf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Pf("invalid intrinsic syntax, expected opening `%`");var i=[];return lO(t,a0e,function(o,s,a,l){i[i.length]=a?lO(l,l0e,"$1"):s||o}),i},c0e=function(t,n){var r=t,i;if(V1(aO,r)&&(i=aO[r],r="%"+i[0]+"%"),V1(qu,r)){var o=qu[r];if(o===bd&&(o=r0e(r)),typeof o>"u"&&!n)throw new sf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Pf("intrinsic "+t+" does not exist!")},d0e=function(t,n){if(typeof t!="string"||t.length===0)throw new sf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new sf('"allowMissing" argument must be a boolean');if(s0e(/^%?[^%]*%?$/,t)===null)throw new Pf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=u0e(t),i=r.length>0?r[0]:"",o=c0e("%"+i+"%",n),s=o.name,a=o.value,l=!1,u=o.alias;u&&(i=u[0],o0e(r,i0e([0,1],u)));for(var d=1,f=!0;d=r.length){var v=Wu(a,p);f=!!v,f&&"get"in v&&!("originalValue"in v.get)?a=v.get:a=a[p]}else f=V1(a,p),a=a[p];f&&!l&&(qu[s]=a)}}return a},f0e=d0e,X3=f0e("%Object.defineProperty%",!0),Y3=function(){if(X3)try{return X3({},"a",{value:1}),!0}catch{return!1}return!1};Y3.hasArrayLengthDefineBug=function(){if(!Y3())return null;try{return X3([],"length",{value:1}).length!==1}catch{return!0}};var h0e=Y3,p0e=Uye,g0e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",m0e=Object.prototype.toString,y0e=Array.prototype.concat,WB=Object.defineProperty,v0e=function(e){return typeof e=="function"&&m0e.call(e)==="[object Function]"},_0e=h0e(),qB=WB&&_0e,b0e=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!v0e(r)||!r())return}qB?WB(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},KB=function(e,t){var n=arguments.length>2?arguments[2]:{},r=p0e(t);g0e&&(r=y0e.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};zb.testComparisonRange=z0e;var Vb={};Object.defineProperty(Vb,"__esModule",{value:!0});Vb.testRange=void 0;var V0e=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};Vb.testRange=V0e;(function(e){var t=He&&He.__assign||function(){return t=Object.assign||function(d){for(var f,p=1,g=arguments.length;p0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,H0e.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};jb.highlight=q0e;var Gb={},tU={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(He,function(){function t(u,d,f){return this.id=++t.highestId,this.name=u,this.symbols=d,this.postprocess=f,this}t.highestId=0,t.prototype.toString=function(u){var d=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+d};function n(u,d,f,p){this.rule=u,this.dot=d,this.reference=f,this.data=[],this.wantedBy=p,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var d=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return d.left=this,d.right=u,d.isComplete&&(d.data=d.build(),d.right=void 0),d},n.prototype.build=function(){var u=[],d=this;do u.push(d.right.data),d=d.left;while(d.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))};function r(u,d){this.grammar=u,this.index=d,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var d=this.states,f=this.wants,p=this.completed,g=0;g{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const nR={notify(){},get:()=>[]};function gde(e,t){let n,r=nR;function i(f){return l(),r.subscribe(f)}function o(){r.notify()}function s(){d.onStateChange&&d.onStateChange()}function a(){return!!n}function l(){n||(n=t?t.addNestedSub(s):e.subscribe(s),r=pde())}function u(){n&&(n(),n=void 0,r.clear(),r=nR)}const d={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:s,isSubscribed:a,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return d}const mde=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",yde=mde?L.useLayoutEffect:L.useEffect;function rR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function P1(e,t){if(rR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=gde(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),a=L.useMemo(()=>e.getState(),[e]);yde(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const l=t||Gl;return Lt.createElement(l.Provider,{value:s},n)}function I$(e=Gl){const t=e===Gl?C$:ET(e);return function(){const{store:r}=t();return r}}const M$=I$();function _de(e=Gl){const t=e===Gl?M$:I$(e);return function(){return t().dispatch}}const N$=_de();tde(w$.useSyncExternalStoreWithSelector);Qce(bs.unstable_batchedUpdates);var bde=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n{const r=wg.get(),i=Sg.get(),o=S1.get();return cce({baseUrl:`${r??""}/api/v1`,prepareHeaders:a=>(i&&a.set("Authorization",`Bearer ${i}`),o&&a.set("project-id",o),a)})(e,t,n)},Hl=Lde({baseQuery:$de,reducerPath:"api",tagTypes:Dde,endpoints:()=>({})}),Fde=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Gde=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),k3=Symbol("encodeFragmentIdentifier");function Hde(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Fn(t,e),"[",i,"]"].join("")]:[...n,[Fn(t,e),"[",Fn(i,e),"]=",Fn(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Fn(t,e),"[]"].join("")]:[...n,[Fn(t,e),"[]=",Fn(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Fn(t,e),":list="].join("")]:[...n,[Fn(t,e),":list=",Fn(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Fn(n,e),t,Fn(i,e)].join("")]:[[r,Fn(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Fn(t,e)]:[...n,[Fn(t,e),"=",Fn(r,e)].join("")]}}function Wde(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),s=typeof r=="string"&&!o&&da(r,e).includes(e.arrayFormatSeparator);r=s?da(r,e):r;const a=o||s?r.split(e.arrayFormatSeparator).map(l=>da(l,e)):r===null?r:da(r,e);i[n]=a};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&da(r,e);return}const s=r===null?[]:r.split(e.arrayFormatSeparator).map(a=>da(a,e));if(i[n]===void 0){i[n]=s;return}i[n]=[...i[n],...s]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function $$(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Fn(e,t){return t.encode?t.strict?Gde(e):encodeURIComponent(e):e}function da(e,t){return t.decode?zde(e):e}function F$(e){return Array.isArray(e)?e.sort():typeof e=="object"?F$(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function B$(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function qde(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function uR(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function IT(e){e=B$(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function MT(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},$$(t.arrayFormatSeparator);const n=Wde(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[s,a]=D$(o,"=");s===void 0&&(s=o),a=a===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:da(a,t),n(da(s,t),a,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))o[s]=uR(a,t);else r[i]=uR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const s=r[o];return s&&typeof s=="object"&&!Array.isArray(s)?i[o]=F$(s):i[o]=s,i},Object.create(null))}function U$(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},$$(t.arrayFormatSeparator);const n=s=>t.skipNull&&jde(e[s])||t.skipEmptyString&&e[s]==="",r=Hde(t),i={};for(const[s,a]of Object.entries(e))n(s)||(i[s]=a);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(s=>{const a=e[s];return a===void 0?"":a===null?Fn(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Fn(s,t)+"[]":a.reduce(r(s),[]).join("&"):Fn(s,t)+"="+Fn(a,t)}).filter(s=>s.length>0).join("&")}function z$(e,t){var i;t={decode:!0,...t};let[n,r]=D$(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:MT(IT(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:da(r,t)}:{}}}function V$(e,t){t={encode:!0,strict:!0,[k3]:!0,...t};const n=B$(e.url).split("?")[0]||"",r=IT(e.url),i={...MT(r,{sort:!1}),...e.query};let o=U$(i,t);o&&(o=`?${o}`);let s=qde(e.url);if(e.fragmentIdentifier){const a=new URL(n);a.hash=e.fragmentIdentifier,s=t[k3]?a.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${s}`}function j$(e,t,n){n={parseFragmentIdentifier:!0,[k3]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=z$(e,n);return V$({url:r,query:Vde(i,t),fragmentIdentifier:o},n)}function Kde(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return j$(e,r,n)}const fv=Object.freeze(Object.defineProperty({__proto__:null,exclude:Kde,extract:IT,parse:MT,parseUrl:z$,pick:j$,stringify:U$,stringifyUrl:V$},Symbol.toStringTag,{value:"Module"})),jh=(e,t)=>{if(!e)return!1;const n=O1.selectAll(e);if(n.length>1){const r=new Date(t.created_at),i=n[n.length-1];if(!i)return!1;const o=new Date(i.created_at);return r>=o}else if([0,1].includes(n.length))return!0;return!1},rl=e=>Vr.includes(e.image_category)?Vr:wl,pn=eu({selectId:e=>e.image_name,sortComparer:(e,t)=>Fde(t.updated_at,e.updated_at)}),O1=pn.getSelectors(),Bo=e=>`images/?${fv.stringify(e,{arrayFormat:"none"})}`,Ui=Hl.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:Ke}];return t&&i.push(...t.items.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:Ke}];return t&&i.push(...t.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:Vr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Bo({board_id:t??"none",categories:wl,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:Ke}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:$ke,useListAllBoardsQuery:Fke,useGetBoardImagesTotalQuery:Bke,useGetBoardAssetsTotalQuery:Uke,useCreateBoardMutation:zke,useUpdateBoardMutation:Vke,useListAllImageNamesForBoardQuery:jke}=Ui,Se=Hl.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Bo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Bo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Bo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return pn.addMany(pn.getInitialState(),n)},merge:(t,n)=>{pn.addMany(t,O1.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;O1.selectAll(i).forEach(o=>{n(Se.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Bo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,s={board_id:o??"none",categories:rl(t)},a=n(Se.util.updateQueryData("listImages",s,l=>{pn.removeOne(l,i)}));try{await r}catch{a.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=Que.keyBy(t,"image_name");i.deleted_images.forEach(s=>{const a=o[s];if(a){const l={board_id:a.board_id??"none",categories:rl(a)};n(Se.util.updateQueryData("listImages",l,u=>{pn.removeOne(u,s)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(Se.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const a=rl(t);if(n)s.push(r(Se.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:a},l=>{pn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:a},u=Se.endpoints.listImages.select(l)(o()),{data:d}=Vr.includes(t.image_category)?Ui.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Ui.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=u.data&&u.data.ids.length>=(d??0),p=jh(u.data,t);(f||p)&&s.push(r(Se.util.updateQueryData("listImages",l,g=>{pn.upsertOne(g,t)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(Se.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{s.forEach(a=>a.undo())}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:s})=>{const a=new FormData;return a.append("file",t),{url:"images/upload",method:"POST",body:a,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:s}}},async onQueryStarted({file:t,image_category:n,is_intermediate:r,postUploadAction:i,session_id:o,board_id:s},{dispatch:a,queryFulfilled:l}){try{const{data:u}=await l;if(u.is_intermediate)return;a(Se.util.upsertQueryData("getImageDTO",u.image_name,u));const d=rl(u);a(Se.util.updateQueryData("listImages",{board_id:u.board_id??"none",categories:d},f=>{pn.addOne(f,u)})),a(Se.util.invalidateTags([{type:"BoardImagesTotal",id:u.board_id??"none"},{type:"BoardAssetsTotal",id:u.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:(t,n,r)=>[{type:"Board",id:Ke},{type:"ImageList",id:Bo({board_id:"none",categories:Vr})},{type:"ImageList",id:Bo({board_id:"none",categories:wl})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_board_images:s}=o;s.forEach(u=>{n(Se.util.updateQueryData("getImageDTO",u,d=>{d.board_id=void 0}))});const a=[{categories:Vr},{categories:wl}],l=s.map(u=>({id:u,changes:{board_id:void 0}}));a.forEach(u=>{n(Se.util.updateQueryData("listImages",u,d=>{pn.updateMany(d,l)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:(t,n,r)=>[{type:"Board",id:Ke},{type:"ImageList",id:Bo({board_id:"none",categories:Vr})},{type:"ImageList",id:Bo({board_id:"none",categories:wl})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_images:s}=o;[{categories:Vr},{categories:wl}].forEach(l=>{n(Se.util.updateQueryData("listImages",l,u=>{pn.removeMany(u,s)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[],a=rl(n);if(s.push(r(Se.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){s.push(r(Se.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:a},g=>{pn.removeOne(g,n.image_name)})));const l={board_id:t??"none",categories:a},u=Se.endpoints.listImages.select(l)(o()),{data:d}=Vr.includes(n.image_category)?Ui.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Ui.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=u.data&&u.data.ids.length>=(d??0),p=jh(u.data,n);(f||p)&&s.push(r(Se.util.updateQueryData("listImages",l,g=>{pn.addOne(g,n)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=rl(t),s=[];s.push(n(Se.util.updateQueryData("getImageDTO",t.image_name,p=>{p.board_id=void 0}))),s.push(n(Se.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},p=>{pn.removeOne(p,t.image_name)})));const a={board_id:"none",categories:o},l=Se.endpoints.listImages.select(a)(i()),{data:u}=Vr.includes(t.image_category)?Ui.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Ui.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=l.data&&l.data.ids.length>=(u??0),f=jh(l.data,t);(d||f)&&s.push(n(Se.util.updateQueryData("listImages",a,p=>{pn.upsertOne(p,t)})));try{await r}catch{s.forEach(p=>p.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var s;const o=(s=r[0])==null?void 0:s.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:s}=await i,{added_image_names:a}=s;a.forEach(l=>{r(Se.util.updateQueryData("getImageDTO",l,_=>{_.board_id=t}));const u=n.find(_=>_.image_name===l);if(!u)return;const d=rl(u),f=u.board_id;r(Se.util.updateQueryData("listImages",{board_id:f??"none",categories:d},_=>{pn.removeOne(_,u.image_name)}));const p={board_id:t,categories:d},g=Se.endpoints.listImages.select(p)(o()),{data:m}=Vr.includes(u.image_category)?Ui.endpoints.getBoardImagesTotal.select(t??"none")(o()):Ui.endpoints.getBoardAssetsTotal.select(t??"none")(o()),v=g.data&&g.data.ids.length>=(m??0),x=(m||0)>=F9?jh(g.data,u):!0;(v||x)&&r(Se.util.updateQueryData("listImages",p,_=>{pn.upsertOne(_,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(s=>{var l;const a=(l=r.find(u=>u.image_name===s))==null?void 0:l.board_id;!a||i.includes(a)||(o.push({type:"Board",id:a}),o.push({type:"BoardImagesTotal",id:a}),o.push({type:"BoardAssetsTotal",id:a}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:s}=o;s.forEach(a=>{n(Se.util.updateQueryData("getImageDTO",a,v=>{v.board_id=void 0}));const l=t.find(v=>v.image_name===a);if(!l)return;const u=rl(l);n(Se.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},v=>{pn.removeOne(v,l.image_name)}));const d={board_id:"none",categories:u},f=Se.endpoints.listImages.select(d)(i()),{data:p}=Vr.includes(l.image_category)?Ui.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Ui.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),g=f.data&&f.data.ids.length>=(p??0),m=(p||0)>=F9?jh(f.data,l):!0;(g||m)&&n(Se.util.updateQueryData("listImages",d,v=>{pn.upsertOne(v,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:Gke,useListImagesQuery:Hke,useLazyListImagesQuery:Wke,useGetImageDTOQuery:qke,useGetImageMetadataQuery:Kke,useDeleteImageMutation:Xke,useDeleteImagesMutation:Yke,useUploadImageMutation:Qke,useClearIntermediatesMutation:Zke,useAddImagesToBoardMutation:Jke,useRemoveImagesFromBoardMutation:eIe,useAddImageToBoardMutation:tIe,useRemoveImageFromBoardMutation:nIe,useChangeImageIsIntermediateMutation:rIe,useChangeImageSessionIdMutation:iIe,useDeleteBoardAndImagesMutation:oIe,useDeleteBoardMutation:sIe}=Se,G$=Re("socket/socketConnected"),H$=Re("socket/appSocketConnected"),W$=Re("socket/socketDisconnected"),q$=Re("socket/appSocketDisconnected"),NT=Re("socket/socketSubscribed"),K$=Re("socket/appSocketSubscribed"),X$=Re("socket/socketUnsubscribed"),Y$=Re("socket/appSocketUnsubscribed"),Q$=Re("socket/socketInvocationStarted"),Z$=Re("socket/appSocketInvocationStarted"),LT=Re("socket/socketInvocationComplete"),J$=Re("socket/appSocketInvocationComplete"),eF=Re("socket/socketInvocationError"),DT=Re("socket/appSocketInvocationError"),tF=Re("socket/socketGraphExecutionStateComplete"),nF=Re("socket/appSocketGraphExecutionStateComplete"),rF=Re("socket/socketGeneratorProgress"),iF=Re("socket/appSocketGeneratorProgress"),oF=Re("socket/socketModelLoadStarted"),Xde=Re("socket/appSocketModelLoadStarted"),sF=Re("socket/socketModelLoadCompleted"),Yde=Re("socket/appSocketModelLoadCompleted"),aF=Re("socket/socketSessionRetrievalError"),lF=Re("socket/appSocketSessionRetrievalError"),uF=Re("socket/socketInvocationRetrievalError"),cF=Re("socket/appSocketInvocationRetrievalError"),$T=Re("controlNet/imageProcessed"),_d={none:{type:"none",label:"none",description:"",default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",label:"Canny",description:"",default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",label:"Content Shuffle",description:"",default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",label:"HED",description:"",default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",label:"Lineart Anime",description:"",default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",label:"Lineart",description:"",default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",label:"Mediapipe Face",description:"",default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",label:"Depth (Midas)",description:"",default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",label:"M-LSD",description:"",default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",label:"Normal BAE",description:"",default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",label:"Openpose",description:"",default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",label:"PIDI",description:"",default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",label:"Depth (Zoe)",description:"",default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},b0={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor"},cR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:_d.canny_image_processor.default,shouldAutoConfig:!0},I3={controlNets:{},isEnabled:!1,pendingControlImages:[]},dF=yn({name:"controlNet",initialState:I3,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??cR,controlNetId:n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=Ur(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...cR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetToggled:(e,t)=>{const{controlNetId:n}=t.payload,r=e.controlNets[n];r&&(r.isEnabled=!r.isEnabled)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const s in b0)if(r.model_name.includes(s)){o=b0[s];break}o?(i.processorType=o,i.processorNode=_d[o].default):(i.processorType="none",i.processorNode=_d.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=_d[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let s;for(const a in b0)if((o=r.model)!=null&&o.model_name.includes(a)){s=b0[a];break}s?(r.processorType=s,r.processorNode=_d[s].default):(r.processorType="none",r.processorNode=_d.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({...I3})},extraReducers:e=>{e.addCase($T,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(DT,t=>{t.pendingControlImages=[]}),e.addMatcher(i$,t=>{t.pendingControlImages=[]}),e.addMatcher(Se.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;tc(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:aIe,controlNetAdded:lIe,controlNetDuplicated:uIe,controlNetAddedFromImage:cIe,controlNetRemoved:fF,controlNetImageChanged:FT,controlNetProcessedImageChanged:Qde,controlNetToggled:dIe,controlNetModelChanged:dR,controlNetWeightChanged:fIe,controlNetBeginStepPctChanged:hIe,controlNetEndStepPctChanged:pIe,controlNetControlModeChanged:gIe,controlNetResizeModeChanged:mIe,controlNetProcessorParamsChanged:Zde,controlNetProcessorTypeChanged:Jde,controlNetReset:BT,controlNetAutoConfigToggled:fR}=dF.actions,efe=dF.reducer,hF={isEnabled:!1,maxPrompts:100,combinatorial:!0},tfe=hF,pF=yn({name:"dynamicPrompts",initialState:tfe,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=hF.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},isEnabledToggled:e=>{e.isEnabled=!e.isEnabled}}}),{isEnabledToggled:yIe,maxPromptsChanged:vIe,maxPromptsReset:_Ie,combinatorialToggled:bIe}=pF.actions,nfe=pF.reducer,gF={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",shouldShowDeleteButton:!1,boardSearchText:""},mF=yn({name:"gallery",initialState:gF,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},shouldShowDeleteButtonChanged:(e,t)=>{e.shouldShowDeleteButton=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(ife,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(Ui.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Rs,shouldAutoSwitchChanged:SIe,autoAssignBoardOnClickChanged:wIe,setGalleryImageMinimumWidth:xIe,boardIdSelected:M3,autoAddBoardIdChanged:CIe,galleryViewChanged:k1,selectionChanged:TIe,shouldShowDeleteButtonChanged:EIe,boardSearchTextChanged:AIe}=mF.actions,rfe=mF.reducer,ife=Co(Se.endpoints.deleteBoard.matchFulfilled,Se.endpoints.deleteBoardAndImages.matchFulfilled),ofe={imagesToDelete:[],isModalOpen:!1},yF=yn({name:"deleteImageModal",initialState:ofe,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:UT,imagesToDeleteSelected:sfe,imageDeletionCanceled:PIe}=yF.actions,afe=yF.reducer,lfe={isModalOpen:!1,imagesToChange:[]},vF=yn({name:"changeBoardModal",initialState:lfe,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:RIe,imagesToChangeSelected:OIe,changeBoardReset:kIe}=vF.actions,ufe=vF.reducer,hR={weight:.75},cfe={loras:{}},_F=yn({name:"lora",initialState:cfe,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...hR}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=hR.weight)}}}),{loraAdded:IIe,loraRemoved:bF,loraWeightChanged:MIe,loraWeightReset:NIe,lorasCleared:LIe}=_F.actions,dfe=_F.reducer;function Eo(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??typeof d!="object"?d:Object.assign({},t,d),n.forEach(p=>p(t,f))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,a),a},ffe=e=>e?pR(e):pR,{useSyncExternalStoreWithSelector:hfe}=Xce;function pfe(e,t=e.getState,n){const r=hfe(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return L.useDebugValue(r),r}function Ri(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function Pb(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}hv.prototype=Pb.prototype={constructor:hv,on:function(e,t){var n=this._,r=mfe(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),mR.hasOwnProperty(t)?{space:mR[t],local:e}:e}function vfe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===N3&&t.documentElement.namespaceURI===N3?t.createElement(e):t.createElementNS(n,e)}}function _fe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function SF(e){var t=Rb(e);return(t.local?_fe:vfe)(t)}function bfe(){}function zT(e){return e==null?bfe:function(){return this.querySelector(e)}}function Sfe(e){typeof e!="function"&&(e=zT(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=y&&(y=b+1);!(C=x[y])&&++y=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Wfe(e){e||(e=qfe);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function Kfe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xfe(){return Array.from(this)}function Yfe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ahe:typeof t=="function"?uhe:lhe)(e,t,n??"")):Tf(this.node(),e)}function Tf(e,t){return e.style.getPropertyValue(t)||EF(e).getComputedStyle(e,null).getPropertyValue(t)}function dhe(e){return function(){delete this[e]}}function fhe(e,t){return function(){this[e]=t}}function hhe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function phe(e,t){return arguments.length>1?this.each((t==null?dhe:typeof t=="function"?hhe:fhe)(e,t)):this.node()[e]}function AF(e){return e.trim().split(/^|\s+/)}function VT(e){return e.classList||new PF(e)}function PF(e){this._node=e,this._names=AF(e.getAttribute("class")||"")}PF.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function RF(e,t){for(var n=VT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Vhe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function L3(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}L3.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zhe(e){return!e.ctrlKey&&!e.button}function Jhe(){return this.parentNode}function epe(e,t){return t??{x:e.x,y:e.y}}function tpe(){return navigator.maxTouchPoints||"ontouchstart"in this}function npe(){var e=Zhe,t=Jhe,n=epe,r=tpe,i={},o=Pb("start","drag","end"),s=0,a,l,u,d,f=0;function p(S){S.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",_,Qhe).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(S,C){if(!(d||!e.call(this,S,C))){var T=y(this,t.call(this,S,C),S,C,"mouse");T&&(jo(S.view).on("mousemove.drag",m,Tg).on("mouseup.drag",v,Tg),MF(S.view),px(S),u=!1,a=S.clientX,l=S.clientY,T("start",S))}}function m(S){if(ef(S),!u){var C=S.clientX-a,T=S.clientY-l;u=C*C+T*T>f}i.mouse("drag",S)}function v(S){jo(S.view).on("mousemove.drag mouseup.drag",null),NF(S.view,u),ef(S),i.mouse("end",S)}function x(S,C){if(e.call(this,S,C)){var T=S.changedTouches,E=t.call(this,S,C),P=T.length,k,O;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?w0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?w0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ipe.exec(e))?new Ci(t[1],t[2],t[3],1):(t=ope.exec(e))?new Ci(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=spe.exec(e))?w0(t[1],t[2],t[3],t[4]):(t=ape.exec(e))?w0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lpe.exec(e))?xR(t[1],t[2]/100,t[3]/100,1):(t=upe.exec(e))?xR(t[1],t[2]/100,t[3]/100,t[4]):yR.hasOwnProperty(e)?bR(yR[e]):e==="transparent"?new Ci(NaN,NaN,NaN,0):null}function bR(e){return new Ci(e>>16&255,e>>8&255,e&255,1)}function w0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ci(e,t,n,r)}function fpe(e){return e instanceof vm||(e=Pg(e)),e?(e=e.rgb(),new Ci(e.r,e.g,e.b,e.opacity)):new Ci}function D3(e,t,n,r){return arguments.length===1?fpe(e):new Ci(e,t,n,r??1)}function Ci(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}jT(Ci,D3,LF(vm,{brighter(e){return e=e==null?M1:Math.pow(M1,e),new Ci(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Eg:Math.pow(Eg,e),new Ci(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ci(Hu(this.r),Hu(this.g),Hu(this.b),N1(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:SR,formatHex:SR,formatHex8:hpe,formatRgb:wR,toString:wR}));function SR(){return`#${Fu(this.r)}${Fu(this.g)}${Fu(this.b)}`}function hpe(){return`#${Fu(this.r)}${Fu(this.g)}${Fu(this.b)}${Fu((isNaN(this.opacity)?1:this.opacity)*255)}`}function wR(){const e=N1(this.opacity);return`${e===1?"rgb(":"rgba("}${Hu(this.r)}, ${Hu(this.g)}, ${Hu(this.b)}${e===1?")":`, ${e})`}`}function N1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fu(e){return e=Hu(e),(e<16?"0":"")+e.toString(16)}function xR(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Go(e,t,n,r)}function DF(e){if(e instanceof Go)return new Go(e.h,e.s,e.l,e.opacity);if(e instanceof vm||(e=Pg(e)),!e)return new Go;if(e instanceof Go)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new Go(s,a,l,e.opacity)}function ppe(e,t,n,r){return arguments.length===1?DF(e):new Go(e,t,n,r??1)}function Go(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}jT(Go,ppe,LF(vm,{brighter(e){return e=e==null?M1:Math.pow(M1,e),new Go(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Eg:Math.pow(Eg,e),new Go(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ci(gx(e>=240?e-240:e+120,i,r),gx(e,i,r),gx(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Go(CR(this.h),x0(this.s),x0(this.l),N1(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=N1(this.opacity);return`${e===1?"hsl(":"hsla("}${CR(this.h)}, ${x0(this.s)*100}%, ${x0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function CR(e){return e=(e||0)%360,e<0?e+360:e}function x0(e){return Math.max(0,Math.min(1,e||0))}function gx(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const $F=e=>()=>e;function gpe(e,t){return function(n){return e+n*t}}function mpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ype(e){return(e=+e)==1?FF:function(t,n){return n-t?mpe(t,n,e):$F(isNaN(t)?n:t)}}function FF(e,t){var n=t-e;return n?gpe(e,n):$F(isNaN(e)?t:e)}const TR=function e(t){var n=ype(t);function r(i,o){var s=n((i=D3(i)).r,(o=D3(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=FF(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=a(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function cl(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var $3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mx=new RegExp($3.source,"g");function vpe(e){return function(){return e}}function _pe(e){return function(t){return e(t)+""}}function bpe(e,t){var n=$3.lastIndex=mx.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=$3.exec(e))&&(i=mx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:cl(r,i)})),n=mx.lastIndex;return n180?d+=360:d-u>180&&(u+=360),p.push({i:f.push(i(f)+"rotate(",null,r)-2,x:cl(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function a(u,d,f,p){u!==d?p.push({i:f.push(i(f)+"skewX(",null,r)-2,x:cl(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function l(u,d,f,p,g,m){if(u!==f||d!==p){var v=g.push(i(g)+"scale(",null,",",null,")");m.push({i:v-4,x:cl(u,f)},{i:v-2,x:cl(d,p)})}else(f!==1||p!==1)&&g.push(i(g)+"scale("+f+","+p+")")}return function(u,d){var f=[],p=[];return u=e(u),d=e(d),o(u.translateX,u.translateY,d.translateX,d.translateY,f,p),s(u.rotate,d.rotate,f,p),a(u.skewX,d.skewX,f,p),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,p),u=d=null,function(g){for(var m=-1,v=p.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Ef}function PR(){oc=(D1=Rg.now())+Ob,Ef=dp=0;try{Ope()}finally{Ef=0,Ipe(),oc=0}}function kpe(){var e=Rg.now(),t=e-D1;t>zF&&(Ob-=t,D1=e)}function Ipe(){for(var e,t=L1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:L1=n);fp=e,B3(r)}function B3(e){if(!Ef){dp&&(dp=clearTimeout(dp));var t=e-oc;t>24?(e<1/0&&(dp=setTimeout(PR,e-Rg.now()-Ob)),Gh&&(Gh=clearInterval(Gh))):(Gh||(D1=Rg.now(),Gh=setInterval(kpe,zF)),Ef=1,VF(PR))}}function RR(e,t,n){var r=new $1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Mpe=Pb("start","end","cancel","interrupt"),Npe=[],GF=0,OR=1,U3=2,pv=3,kR=4,z3=5,gv=6;function kb(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Lpe(e,n,{name:t,index:r,group:i,on:Mpe,tween:Npe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:GF})}function HT(e,t){var n=rs(e,t);if(n.state>GF)throw new Error("too late; already scheduled");return n}function Bs(e,t){var n=rs(e,t);if(n.state>pv)throw new Error("too late; already running");return n}function rs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Lpe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=jF(o,0,n.time);function o(u){n.state=OR,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,f,p,g;if(n.state!==OR)return l();for(d in r)if(g=r[d],g.name===n.name){if(g.state===pv)return RR(s);g.state===kR?(g.state=gv,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+dU3&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function dge(e,t,n){var r,i,o=cge(t)?HT:Bs;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function fge(e,t){var n=this._id;return arguments.length<2?rs(this.node(),n).on.on(e):this.each(dge(n,e,t))}function hge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pge(){return this.on("end.remove",hge(this._id))}function gge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zT(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s