@markus-global/cli 0.12.5-rc.3 → 0.12.5-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-ui/assets/{AsyncState-BBjWt0U4.js → AsyncState-CeDmMBla.js} +1 -1
- package/dist/web-ui/assets/{ChatComponents-BM9ia4hU.js → ChatComponents-u_iLnHEf.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-qTQ3LGXo.js → ContentRenderer-CHzFmlGx.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-DvipfOxG.js → DeliverableShareModal-By9CYH0Q.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-BPy0ggqv.js → Deliverables-Cn_DRg-F.js} +1 -1
- package/dist/web-ui/assets/{MarkdownMessage-CRj69Rnh.js → MarkdownMessage-BX6YVVx8.js} +1 -1
- package/dist/web-ui/assets/{Search-C46Sjd5C.js → Search-BGSuNeNO.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-LdFPpuOR.js → SendToChat-BR3-e7d4.js} +1 -1
- package/dist/web-ui/assets/{Settings-AG1s3e8i.js → Settings-DJyCWAY9.js} +1 -1
- package/dist/web-ui/assets/{Store-DO5KoBp1.js → Store-Cl-05eXo.js} +1 -1
- package/dist/web-ui/assets/{Switch-BZ1GkhRR.js → Switch-DGrHkwcq.js} +1 -1
- package/dist/web-ui/assets/{Team-D5iZnF6B.js → Team-DfNOc2Oj.js} +4 -4
- package/dist/web-ui/assets/{Work-Drx3sVyM.js → Work-Cwkb9n7H.js} +1 -1
- package/dist/web-ui/assets/{arc-Eq03OxxX.js → arc-DUrpNW2s.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BBdoQyhl.js → architectureDiagram-3BPJPVTR-_itbdqjs.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-CiHhkXz1.js → blockDiagram-GPEHLZMM-7gcaAgpE.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BNuNa7JZ.js → c4Diagram-AAUBKEIU-BqKuOXWt.js} +1 -1
- package/dist/web-ui/assets/channel-BNcjWETI.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-CHUGrp-l.js → chunk-2J33WTMH-DmFCktA6.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-d_lgDORf.js → chunk-4BX2VUAB-w8YtZlZ5.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-D3qv6MEj.js → chunk-55IACEB6-4k-E46Qp.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-zcDvjE2C.js → chunk-727SXJPM-C1-6Iiik.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-Cu6Z10dm.js → chunk-AQP2D5EJ-CO4NtkeR.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-CIFOVD2g.js → chunk-FMBD7UC4-CS_sseZh.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-tQ2G7DnL.js → chunk-ND2GUHAM-D7-BkEUG.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-C-cdIAYv.js → chunk-QZHKN3VN-BPCz16Gj.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-v3_2DQPV.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-v3_2DQPV.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DmSgdwYx.js → cose-bilkent-S5V4N54A-CpYmq76O.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-wjgriNhd.js → dagre-BM42HDAG-DrBF0YKT.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-a-NcMwjk.js → diagram-2AECGRRQ-CzQkjw5L.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-SpkaU5yE.js → diagram-5GNKFQAL-SneRBO1C.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-CUgGNLiQ.js → diagram-KO2AKTUF-C8iAMOJw.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-B8fsKgAc.js → diagram-LMA3HP47-C2lb4oU1.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-BzlaeBBK.js → diagram-OG6HWLK6-P-NuPlh6.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-BCuJY_I2.js → docx-preview-YtzS0xMU.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-BbKnb5vg.js → erDiagram-TEJ5UH35-BXcYtaBT.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-v-NewzE2.js → flowDiagram-I6XJVG4X-Dm48mLdd.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-B2AU3vrG.js → ganttDiagram-6RSMTGT7-BXrfFYnN.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-Dwxnlf1q.js → gitGraphDiagram-PVQCEYII-CxO9AKdS.js} +1 -1
- package/dist/web-ui/assets/{index-D5uPD4Tz.js → index-CudHikwU.js} +6 -6
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-BdzCNxZz.js → infoDiagram-5YYISTIA-DSP5_m8e.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-CLyFQ2jy.js → ishikawaDiagram-YF4QCWOH-Bsmqh7_N.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-B3LiOP2U.js → journeyDiagram-JHISSGLW-CCBod5iD.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-B8Oj05-K.js → kanban-definition-UN3LZRKU-BGbAEz6s.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-DMZzuUz0.js → mermaid.core-B17l8z4S.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-VJJ6L2az.js → mindmap-definition-RKZ34NQL-7pahuML0.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-DS0GmvNe.js → pieDiagram-4H26LBE5-AtMgK6F2.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-B5zgEbvf.js → quadrantDiagram-W4KKPZXB-DxwCSN_z.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-BC9P_pkc.js → requirementDiagram-4Y6WPE33-DQ4GULQe.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-DWJUUU8z.js → sankeyDiagram-5OEKKPKP-DJaWWRUa.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CwDKp_Kn.js → sequenceDiagram-3UESZ5HK-ChrFC_0T.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-D3xJAfNC.js → stateDiagram-AJRCARHV-DZthn0Xq.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-CFMNtQOk.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-Bs2r0u8I.js → timeline-definition-PNZ67QCA-BM0bxJB9.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-Dn7ElyME.js → vennDiagram-CIIHVFJN-Buu596v7.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-DzsSSCmk.js → wardley-L42UT6IY-FsFYXKCE.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-CQAHS6du.js → wardleyDiagram-YWT4CUSO-CEl-G6gD.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-a8vJ9G8_.js → xychartDiagram-2RQKCTM6-c-k0Gyas.js} +1 -1
- package/dist/web-ui/index.html +1 -1
- package/docs/architecture/desktop-auto-update.md +46 -2
- package/package.json +1 -1
- package/dist/web-ui/assets/channel-h2PMJJlX.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-D1AgiP6_.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-D1AgiP6_.js +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DMjww8Bc.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as ze,j as r,bl as zf,bm as Ff,a3 as Hf,bn as Vf,r as p,k as ee,aD as Wf,a as wr,a1 as Kf,l as kn,n as Gt,P as st,$ as ol,b as Uf,c as Yf,Q as Gf,R as al,bo as Xf,bp as Zf,U as Bt,bc as Ft,bq as Fr,W as Hr,X as Qf,br as qa,bs as cr,bt as za,i as Jf,a7 as js,d as eh,b1 as th,bu as Uc,bv as nh,A as Fa,b6 as Ha,b5 as il,Z as sh,t as rh}from"./index-D5uPD4Tz.js";import{t as Yc,a1 as Gc,a2 as oh,a3 as ll,a4 as cl,a5 as ah,a6 as ih,a7 as Xc,a8 as lh,P as ch}from"./ChatComponents-BM9ia4hU.js";import{S as Zc,a as Qc,r as Jc,s as dh}from"./SendToChat-LdFPpuOR.js";import{L as uh,P as fh}from"./AsyncState-BBjWt0U4.js";import{MarkdownMessage as dr}from"./MarkdownMessage-CRj69Rnh.js";import{ContentRenderer as hh}from"./ContentRenderer-qTQ3LGXo.js";import{s as Ht,g as ed,j as Va,T as ta,k as na,t as mh}from"./transform-BqqRT-Iy.js";import{i as sa}from"./value-wA6veExk.js";import"./chatChips-DVIRVTpT.js";function ph(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tn(e,t){if(e=ph(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const gh={passive:!1},ur={capture:!0,passive:!1};function ra(e){e.stopImmediatePropagation()}function Ts(e){e.preventDefault(),e.stopImmediatePropagation()}function td(e){var t=e.document.documentElement,n=Ht(e).on("dragstart.drag",Ts,ur);"onselectstart"in t?n.on("selectstart.drag",Ts,ur):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nd(e,t){var n=e.document.documentElement,s=Ht(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ts,ur),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Vr=e=>()=>e;function Na(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}Na.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xh(e){return!e.ctrlKey&&!e.button}function bh(){return this.parentNode}function yh(e,t){return t??{x:e.x,y:e.y}}function wh(){return navigator.maxTouchPoints||"ontouchstart"in this}function sd(){var e=xh,t=bh,n=yh,s=wh,o={},a=ed("start","drag","end"),i=0,l,c,d,h,u=0;function m(k){k.on("mousedown.drag",f).filter(s).on("touchstart.drag",w).on("touchmove.drag",v,gh).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(k,C){if(!(h||!e.call(this,k,C))){var j=b(this,t.call(this,k,C),k,C,"mouse");j&&(Ht(k.view).on("mousemove.drag",g,ur).on("mouseup.drag",x,ur),td(k.view),ra(k),d=!1,l=k.clientX,c=k.clientY,j("start",k))}}function g(k){if(Ts(k),!d){var C=k.clientX-l,j=k.clientY-c;d=C*C+j*j>u}o.mouse("drag",k)}function x(k){Ht(k.view).on("mousemove.drag mouseup.drag",null),nd(k.view,d),Ts(k),o.mouse("end",k)}function w(k,C){if(e.call(this,k,C)){var j=k.changedTouches,A=t.call(this,k,C),S=j.length,T,P;for(T=0;T<S;++T)(P=b(this,A,k,C,j[T].identifier,j[T]))&&(ra(k),P("start",k,j[T]))}}function v(k){var C=k.changedTouches,j=C.length,A,S;for(A=0;A<j;++A)(S=o[C[A].identifier])&&(Ts(k),S("drag",k,C[A]))}function y(k){var C=k.changedTouches,j=C.length,A,S;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<j;++A)(S=o[C[A].identifier])&&(ra(k),S("end",k,C[A]))}function b(k,C,j,A,S,T){var P=a.copy(),M=tn(T||j,C),D,z,E;if((E=n.call(k,new Na("beforestart",{sourceEvent:j,target:m,identifier:S,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:P}),A))!=null)return D=E.x-M[0]||0,z=E.y-M[1]||0,function B(L,$,R){var q=M,H;switch(L){case"start":o[S]=B,H=i++;break;case"end":delete o[S],--i;case"drag":M=tn(R||$,C),H=i;break}P.call(L,k,new Na(L,{sourceEvent:$,subject:E,target:m,identifier:S,active:H,x:M[0]+D,y:M[1]+z,dx:M[0]-q[0],dy:M[1]-q[1],dispatch:P}),A)}}return m.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Vr(!!k),m):e},m.container=function(k){return arguments.length?(t=typeof k=="function"?k:Vr(k),m):t},m.subject=function(k){return arguments.length?(n=typeof k=="function"?k:Vr(k),m):n},m.touchable=function(k){return arguments.length?(s=typeof k=="function"?k:Vr(!!k),m):s},m.on=function(){var k=a.on.apply(a,arguments);return k===a?m:k},m.clickDistance=function(k){return arguments.length?(u=(k=+k)*k,m):Math.sqrt(u)},m}var kh=1e-12;function dl(e){return((e=Math.exp(e))+1/e)/2}function vh(e){return((e=Math.exp(e))-1/e)/2}function jh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ao=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],h=i[0],u=i[1],m=i[2],f=h-l,g=u-c,x=f*f+g*g,w,v;if(x<kh)v=Math.log(m/d)/t,w=function(A){return[l+A*f,c+A*g,d*Math.exp(t*A*v)]};else{var y=Math.sqrt(x),b=(m*m-d*d+s*x)/(2*d*n*y),k=(m*m-d*d-s*x)/(2*m*n*y),C=Math.log(Math.sqrt(b*b+1)-b),j=Math.log(Math.sqrt(k*k+1)-k);v=(j-C)/t,w=function(A){var S=A*v,T=dl(C),P=d/(n*y)*(T*jh(t*S+C)-vh(C));return[l+P*f,c+P*g,d*T/dl(t*S+C)]}}return w.duration=v*1e3*t/Math.SQRT2,w}return o.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},o})(Math.SQRT2,2,4),Wr=e=>()=>e;function Nh(e,{sourceEvent:t,target:n,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function oa(e){e.stopImmediatePropagation()}function nr(e){e.preventDefault(),e.stopImmediatePropagation()}function Sh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ch(){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 ul(){return this.__zoom||Va}function Eh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ih(){return navigator.maxTouchPoints||"ontouchstart"in this}function Th(e,t,n){var s=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}function rd(){var e=Sh,t=Ch,n=Th,s=Eh,o=Ih,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ao,d=ed("start","zoom","end"),h,u,m,f=500,g=150,x=0,w=10;function v(E){E.property("__zoom",ul).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(E,B,L,$){var R=E.selection?E.selection():E;R.property("__zoom",ul),E!==R?C(E,B,L,$):R.interrupt().each(function(){j(this,arguments).event($).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(E,B,L,$){v.scaleTo(E,function(){var R=this.__zoom.k,q=typeof B=="function"?B.apply(this,arguments):B;return R*q},L,$)},v.scaleTo=function(E,B,L,$){v.transform(E,function(){var R=t.apply(this,arguments),q=this.__zoom,H=L==null?k(R):typeof L=="function"?L.apply(this,arguments):L,K=q.invert(H),O=typeof B=="function"?B.apply(this,arguments):B;return n(b(y(q,O),H,K),R,i)},L,$)},v.translateBy=function(E,B,L,$){v.transform(E,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,$)},v.translateTo=function(E,B,L,$,R){v.transform(E,function(){var q=t.apply(this,arguments),H=this.__zoom,K=$==null?k(q):typeof $=="function"?$.apply(this,arguments):$;return n(Va.translate(K[0],K[1]).scale(H.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof L=="function"?-L.apply(this,arguments):-L),q,i)},$,R)};function y(E,B){return B=Math.max(a[0],Math.min(a[1],B)),B===E.k?E:new ta(B,E.x,E.y)}function b(E,B,L){var $=B[0]-L[0]*E.k,R=B[1]-L[1]*E.k;return $===E.x&&R===E.y?E:new ta(E.k,$,R)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function C(E,B,L,$){E.on("start.zoom",function(){j(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event($).end()}).tween("zoom",function(){var R=this,q=arguments,H=j(R,q).event($),K=t.apply(R,q),O=L==null?k(K):typeof L=="function"?L.apply(R,q):L,Y=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),_=R.__zoom,I=typeof B=="function"?B.apply(R,q):B,V=c(_.invert(O).concat(Y/_.k),I.invert(O).concat(Y/I.k));return function(W){if(W===1)W=I;else{var F=V(W),Z=Y/F[2];W=new ta(Z,O[0]-F[0]*Z,O[1]-F[1]*Z)}H.zoom(null,W)}})}function j(E,B,L){return!L&&E.__zooming||new A(E,B)}function A(E,B){this.that=E,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,B),this.taps=0}A.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,B){return this.mouse&&E!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var B=Ht(this.that).datum();d.call(E,this.that,new Nh(E,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function S(E,...B){if(!e.apply(this,arguments))return;var L=j(this,B).event(E),$=this.__zoom,R=Math.max(a[0],Math.min(a[1],$.k*Math.pow(2,s.apply(this,arguments)))),q=tn(E);if(L.wheel)(L.mouse[0][0]!==q[0]||L.mouse[0][1]!==q[1])&&(L.mouse[1]=$.invert(L.mouse[0]=q)),clearTimeout(L.wheel);else{if($.k===R)return;L.mouse=[q,$.invert(q)],na(this),L.start()}nr(E),L.wheel=setTimeout(H,g),L.zoom("mouse",n(b(y($,R),L.mouse[0],L.mouse[1]),L.extent,i));function H(){L.wheel=null,L.end()}}function T(E,...B){if(m||!e.apply(this,arguments))return;var L=E.currentTarget,$=j(this,B,!0).event(E),R=Ht(E.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",Y,!0),q=tn(E,L),H=E.clientX,K=E.clientY;td(E.view),oa(E),$.mouse=[q,this.__zoom.invert(q)],na(this),$.start();function O(_){if(nr(_),!$.moved){var I=_.clientX-H,V=_.clientY-K;$.moved=I*I+V*V>x}$.event(_).zoom("mouse",n(b($.that.__zoom,$.mouse[0]=tn(_,L),$.mouse[1]),$.extent,i))}function Y(_){R.on("mousemove.zoom mouseup.zoom",null),nd(_.view,$.moved),nr(_),$.event(_).end()}}function P(E,...B){if(e.apply(this,arguments)){var L=this.__zoom,$=tn(E.changedTouches?E.changedTouches[0]:E,this),R=L.invert($),q=L.k*(E.shiftKey?.5:2),H=n(b(y(L,q),$,R),t.apply(this,B),i);nr(E),l>0?Ht(this).transition().duration(l).call(C,H,$,E):Ht(this).call(v.transform,H,$,E)}}function M(E,...B){if(e.apply(this,arguments)){var L=E.touches,$=L.length,R=j(this,B,E.changedTouches.length===$).event(E),q,H,K,O;for(oa(E),H=0;H<$;++H)K=L[H],O=tn(K,this),O=[O,this.__zoom.invert(O),K.identifier],R.touch0?!R.touch1&&R.touch0[2]!==O[2]&&(R.touch1=O,R.taps=0):(R.touch0=O,q=!0,R.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(R.taps<2&&(u=O[0],h=setTimeout(function(){h=null},f)),na(this),R.start())}}function D(E,...B){if(this.__zooming){var L=j(this,B).event(E),$=E.changedTouches,R=$.length,q,H,K,O;for(nr(E),q=0;q<R;++q)H=$[q],K=tn(H,this),L.touch0&&L.touch0[2]===H.identifier?L.touch0[0]=K:L.touch1&&L.touch1[2]===H.identifier&&(L.touch1[0]=K);if(H=L.that.__zoom,L.touch1){var Y=L.touch0[0],_=L.touch0[1],I=L.touch1[0],V=L.touch1[1],W=(W=I[0]-Y[0])*W+(W=I[1]-Y[1])*W,F=(F=V[0]-_[0])*F+(F=V[1]-_[1])*F;H=y(H,Math.sqrt(W/F)),K=[(Y[0]+I[0])/2,(Y[1]+I[1])/2],O=[(_[0]+V[0])/2,(_[1]+V[1])/2]}else if(L.touch0)K=L.touch0[0],O=L.touch0[1];else return;L.zoom("touch",n(b(H,K,O),L.extent,i))}}function z(E,...B){if(this.__zooming){var L=j(this,B).event(E),$=E.changedTouches,R=$.length,q,H;for(oa(E),m&&clearTimeout(m),m=setTimeout(function(){m=null},f),q=0;q<R;++q)H=$[q],L.touch0&&L.touch0[2]===H.identifier?delete L.touch0:L.touch1&&L.touch1[2]===H.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(H=tn(H,this),Math.hypot(u[0]-H[0],u[1]-H[1])<w)){var K=Ht(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return v.wheelDelta=function(E){return arguments.length?(s=typeof E=="function"?E:Wr(+E),v):s},v.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Wr(!!E),v):e},v.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Wr(!!E),v):o},v.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Wr([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),v):t},v.scaleExtent=function(E){return arguments.length?(a[0]=+E[0],a[1]=+E[1],v):[a[0],a[1]]},v.translateExtent=function(E){return arguments.length?(i[0][0]=+E[0][0],i[1][0]=+E[1][0],i[0][1]=+E[0][1],i[1][1]=+E[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(E){return arguments.length?(n=E,v):n},v.duration=function(E){return arguments.length?(l=+E,v):l},v.interpolate=function(E){return arguments.length?(c=E,v):c},v.on=function(){var E=d.on.apply(d,arguments);return E===d?v:E},v.clickDistance=function(E){return arguments.length?(x=(E=+E)*E,v):Math.sqrt(x)},v.tapDistance=function(E){return arguments.length?(w=+E,v):w},v}const od=new Set(["completed","failed","rejected","cancelled","archived"]);function fr(e){return!!e&&od.has(e)}const ad=new Set(["completed","rejected","cancelled","archived"]);function Mh(e,t={}){const n=[];for(let s=0;s<e.length;s++){const o=e[s];if(o.toStatus!=="review")continue;const a=e[s+1],i=!a,l=`review:${o.id}`,c=t.reviewerId??o.changedById??"",d=t.reviewerName??void 0??(c?t.reviewerNameOf?.(c):void 0)??null;n.push({id:l,reviewerId:c,reviewerName:d,reviewerType:t.reviewerType??null,status:i?"reviewing":"completed",queuedAt:o.createdAt,completedAt:a?a.createdAt:null,round:n.length+1,outcome:a?Ah(a.toStatus):null,decidedByName:a?a.changedByName??null:null,note:a?a.reason??null:null})}return n}function Ah(e){return e==="completed"?"approved":e==="in_progress"?"revision_requested":"closed"}function fl(e){return e.find(t=>t.status==="reviewing")??null}function _h(e){return e.some(t=>t.status==="reviewing")}function Kr(e){return e?new Date(e).getTime():Number.NaN}function Lh(e,t,n="all"){const s=[];if(n!=="review")for(const o of e){const a=o.firstAt??"";Number.isNaN(Kr(a))||s.push({kind:"execution",key:`exec:${o.round}`,round:o.round,startedAt:a,endedAt:o.lastAt??null,toolCount:o.toolCount??0,logCount:o.logCount??0,status:o.status??""})}if(n!=="execution")for(const o of t)Number.isNaN(Kr(o.queuedAt))||s.push({kind:"review",key:o.id,round:o.round,startedAt:o.queuedAt,endedAt:o.completedAt,session:o});return s.sort((o,a)=>{const i=Kr(o.startedAt)-Kr(a.startedAt);return i!==0?i:o.kind!==a.kind?o.kind==="execution"?-1:1:o.round-a.round})}const hl=6e4,Rh=/^(Reviewing task from\b|Task Review$)/;function Dh(e){const t=(e.label??"").trim();return t?Rh.test(t):!1}function id(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return!1;const s=new Date(t.queuedAt).getTime();if(Number.isNaN(s))return!1;const o=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(o)?!1:n>=s-hl&&n<=o+hl}function Oh(e,t){const n=new Date(t.queuedAt).getTime(),s=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(n)||Number.isNaN(s)?[]:e.filter(o=>!Dh(o)||o.taskId&&o.taskId!==t.taskId?!1:id(o.startedAt,t)).sort((o,a)=>new Date(o.startedAt).getTime()-new Date(a.startedAt).getTime())}const $h=["30m","1h","2h","4h","8h","12h","1d","1w"],Ph={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function ml(e){return Ph[e]??"freq4h"}function Bh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Sa(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:Bh()}}function ld(e){const t=/^(\d{1,2}):(\d{2})$/.exec((e??"").trim());if(!t)return[9,0];const n=Math.min(23,Math.max(0,parseInt(t[1],10))),s=Math.min(59,Math.max(0,parseInt(t[2],10)));return[n,s]}function qh(e){const[t,n]=ld(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function zh(e,t,n){if(e==="cron")return"";const[s,o]=ld(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function Fh(e){const t=/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\S+)$/.exec((e??"").trim());if(!t)return null;const n=parseInt(t[1],10),s=parseInt(t[2],10);if(n>59||s>23)return null;const o=t[3],a=`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(o==="*")return{calendar:"daily",weekdays:[1,2,3,4,5],time:a};if(o==="1-5")return{calendar:"weekdays",weekdays:[1,2,3,4,5],time:a};if(/^\d(,\d)*$/.test(o)){const i=o.split(",").map(l=>parseInt(l,10)).filter(l=>l>=0&&l<=6);if(i.length>0)return{calendar:"weekly",weekdays:i,time:a}}return null}function Hh(e){const t=Sa();if(!e)return t;if(e.timezone&&(t.timezone=e.timezone),t.maxRuns=e.maxRuns&&e.maxRuns>0?String(e.maxRuns):"",e.cron){const n=Fh(e.cron);t.mode="calendar",n?(t.calendar=n.calendar,t.weekdays=n.weekdays,t.time=n.time):(t.calendar="cron",t.cron=e.cron)}else e.every&&(t.mode="interval",t.every=e.every);return t}function cd(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():zh(e.calendar,e.weekdays,e.time),e.timezone&&(t.timezone=e.timezone));const n=parseInt(e.maxRuns,10);return e.maxRuns.trim()!==""&&Number.isFinite(n)&&n>0&&(t.maxRuns=n),t}const Vh=[1,2,3,4,5,6,0];function Wh({options:e,value:t,onChange:n,size:s="md"}){const o=s==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm";return r.jsx("div",{className:"inline-flex rounded-lg border border-border-default overflow-hidden",children:e.map(a=>r.jsx("button",{type:"button",onClick:()=>n(a.value),className:`${o} transition-colors ${t===a.value?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function dd({value:e,onChange:t,compact:n=!1}){const{t:s}=ze(),o=h=>t({...e,...h}),a=`px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg outline-none focus:border-brand-500 ${n?"text-xs":"text-sm"}`,i=h=>{const m=e.weekdays.includes(h)?e.weekdays.filter(f=>f!==h):[...e.weekdays,h];o({weekdays:m})};let l;if(e.mode==="interval")l=s(`work:task.${ml(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const h=qh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:h});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:h});else{const u=[...e.weekdays].sort((m,f)=>m-f).map(m=>s(`work:task.weekdayShort.${m}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:h}):s("work:task.scheduleNoDays")}}const c=e.calendar==="daily"||e.calendar==="weekdays"||e.calendar==="weekly",d="text-fg-tertiary shrink-0 text-xs w-20";return r.jsxs("div",{className:"rounded-lg border border-border-default/70 bg-surface-elevated/40 p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatMode")}),r.jsx(Wh,{size:n?"sm":"md",value:e.mode,onChange:h=>o({mode:h}),options:[{value:"interval",label:s("work:task.scheduleByInterval")},{value:"calendar",label:s("work:task.scheduleByCalendar")}]})]}),e.mode==="interval"?r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleEveryLabel")}),r.jsx("select",{value:e.every,onChange:h=>o({every:h.target.value}),className:a,children:$h.map(h=>r.jsx("option",{value:h,children:s(`work:task.${ml(h)}`)},h))})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatLabel")}),r.jsxs("select",{value:e.calendar,onChange:h=>o({calendar:h.target.value}),className:a,children:[r.jsx("option",{value:"daily",children:s("work:task.scheduleCalendarDaily")}),r.jsx("option",{value:"weekdays",children:s("work:task.scheduleCalendarWeekdays")}),r.jsx("option",{value:"weekly",children:s("work:task.scheduleCalendarWeekly")}),r.jsx("option",{value:"cron",children:s("work:task.scheduleCalendarCron")})]}),c&&r.jsx("input",{type:"time",value:e.time,onChange:h=>o({time:h.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:Vh.map(h=>{const u=e.weekdays.includes(h);return r.jsx("button",{type:"button",onClick:()=>i(h),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${h}`)},h)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:h=>o({cron:h.target.value}),placeholder:"0 9 * * 1-5",className:`${a} w-full font-mono`})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleMaxRuns")}),r.jsx("input",{value:e.maxRuns,onChange:h=>o({maxRuns:h.target.value.replace(/\D/g,"")}),placeholder:s("work:task.scheduleMaxRunsPlaceholder"),className:`${a} w-20`})]}),r.jsxs("div",{className:"text-[11px] text-fg-secondary pt-1 border-t border-border-default/50",children:[s("work:task.schedulePreview",{desc:l}),r.jsxs("span",{className:"text-fg-tertiary",children:[" · ",s("work:task.scheduleTimezoneNote",{tz:e.timezone})]})]})]})}function jt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=jt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const un={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},hr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ud=["Enter"," ","Escape"],fd={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var _s;(function(e){e.Strict="strict",e.Loose="loose"})(_s||(_s={}));var ts;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ts||(ts={}));var mr;(function(e){e.Partial="partial",e.Full="full"})(mr||(mr={}));const hd={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ln;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ln||(Ln={}));var Ls;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ls||(Ls={}));var ve;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ve||(ve={}));const pl={[ve.Left]:ve.Right,[ve.Right]:ve.Left,[ve.Top]:ve.Bottom,[ve.Bottom]:ve.Top};function md(e){return e===null?null:e?"valid":"invalid"}const pd=e=>"id"in e&&"source"in e&&"target"in e,Kh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wa=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),kr=(e,t=[0,0])=>{const{width:n,height:s}=Sn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},Uh=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,o)=>{const a=typeof o=="string";let i=!t.nodeLookup&&!a?o:void 0;t.nodeLookup&&(i=a?t.nodeLookup.get(o):Wa(o)?o:t.nodeLookup.get(o.id));const l=i?po(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return To(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mo(n)},vr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=To(n,po(o)),s=!0)}),s?Mo(n):{x:0,y:0,width:0,height:0}},Ka=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...Nr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:h,selectable:u=!0,hidden:m=!1}=d;if(i&&!u||m)continue;const f=h.width??d.width??d.initialWidth??null,g=h.height??d.height??d.initialHeight??null,x=pr(l,Ds(d)),w=(f??0)*(g??0),v=a&&x>0;(!d.internals.handleBounds||v||x>=w||d.dragging)&&c.push(d)}return c},Yh=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function Gh(e,t){const n=new Map,s=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!s||s.has(o.id))&&n.set(o.id,o)}),n}async function Xh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=Gh(e,i),c=vr(l),d=Ua(c,t,n,i?.minZoom??o,i?.maxZoom??a,i?.padding??.1);return await s.setViewport(d,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function gd({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:o,onError:a}){const i=n.get(e),l=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",un.error005());else{const f=l.measured.width,g=l.measured.height;f&&g&&(u=[[c,d],[c+f,d+g]])}else l&&Os(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const m=Os(u)?ns(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",un.error015()),{position:{x:m.x-c+(i.measured.width??0)*h[0],y:m.y-d+(i.measured.height??0)*h[1]},positionAbsolute:m}}async function Zh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(m=>m.id)),i=[];for(const m of n){if(m.deletable===!1)continue;const f=a.has(m.id),g=!f&&m.parentId&&i.find(x=>x.id===m.parentId);(f||g)&&i.push(m)}const l=new Set(t.map(m=>m.id)),c=s.filter(m=>m.deletable!==!1),h=Yh(i,c);for(const m of c)l.has(m.id)&&!h.find(g=>g.id===m.id)&&h.push(m);if(!o)return{edges:h,nodes:i};const u=await o({nodes:i,edges:h});return typeof u=="boolean"?u?{edges:h,nodes:i}:{edges:[],nodes:[]}:u}const Rs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ns=(e={x:0,y:0},t,n)=>({x:Rs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Rs(e.y,t[0][1],t[1][1]-(n?.height??0))});function xd(e,t,n){const{width:s,height:o}=Sn(n),{x:a,y:i}=n.internals.positionAbsolute;return ns(e,[[a,i],[a+s,i+o]],t)}const gl=(e,t,n)=>e<t?Rs(Math.abs(e-t),1,t)/t:e>n?-Rs(Math.abs(e-n),1,t)/t:0,bd=(e,t,n=15,s=40)=>{const o=gl(e.x,s,t.width-s)*n,a=gl(e.y,s,t.height-s)*n;return[o,a]},To=(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)}),Ca=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Mo=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Ds=(e,t=[0,0])=>{const{x:n,y:s}=Wa(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:s,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},po=(e,t=[0,0])=>{const{x:n,y:s}=Wa(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:s,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:s+(e.measured?.height??e.height??e.initialHeight??0)}},yd=(e,t)=>Mo(To(Ca(e),Ca(t))),pr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},xl=e=>nn(e.width)&&nn(e.height)&&nn(e.x)&&nn(e.y),nn=e=>!isNaN(e)&&isFinite(e),Qh=(e,t)=>{},jr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Nr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?jr(l,i):l},go=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function ws(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Jh(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=ws(e,n),o=ws(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=ws(e.top??e.y??0,n),o=ws(e.bottom??e.y??0,n),a=ws(e.left??e.x??0,t),i=ws(e.right??e.x??0,t);return{top:s,right:i,bottom:o,left:a,x:a+i,y:s+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function em(e,t,n,s,o,a){const{x:i,y:l}=go(e,[t,n,s]),{x:c,y:d}=go({x:e.x+e.width,y:e.y+e.height},[t,n,s]),h=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(u)}}const Ua=(e,t,n,s,o,a)=>{const i=Jh(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),h=Rs(d,s,o),u=e.x+e.width/2,m=e.y+e.height/2,f=t/2-u*h,g=n/2-m*h,x=em(e,f,g,h,t,n),w={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:f-w.left+w.right,y:g-w.top+w.bottom,zoom:h}},gr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Os(e){return e!=null&&e!=="parent"}function Sn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function wd(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function kd(e,t={width:0,height:0},n,s,o){const a={...e},i=s.get(n);if(i){const l=i.origin||o;a.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function bl(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tm(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function nm(e){return{...fd,...e||{}}}function ar(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=sn(e),l=Nr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?jr(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Ya=e=>({width:e.offsetWidth,height:e.offsetHeight}),vd=e=>e?.getRootNode?.()||window?.document,sm=["INPUT","SELECT","TEXTAREA"];function jd(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sm.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Nd=e=>"clientX"in e,sn=(e,t)=>{const n=Nd(e),s=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:s-(t?.left??0),y:o-(t?.top??0)}},yl=(e,t,n,s,o)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...Ya(i)}})};function Sd({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:i,targetControlY:l}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+a*.375+l*.375+s*.125,h=Math.abs(c-e),u=Math.abs(d-t);return[c,d,h,u]}function Ur(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wl({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case ve.Left:return[t-Ur(t-s,a),n];case ve.Right:return[t+Ur(s-t,a),n];case ve.Top:return[t,n-Ur(n-o,a)];case ve.Bottom:return[t,n+Ur(o-n,a)]}}function Cd({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:o,targetPosition:a=ve.Top,curvature:i=.25}){const[l,c]=wl({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,h]=wl({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,m,f,g]=Sd({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${t} C${l},${c} ${d},${h} ${s},${o}`,u,m,f,g]}function Ed({sourceX:e,sourceY:t,targetX:n,targetY:s}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,i=Math.abs(s-t)/2,l=s<t?s+i:s-i;return[a,l,o,i]}function rm({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:o=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const i=o&&n?s+1e3:s,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+l}function om({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=To(po(e),po(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:s/o[2]};return pr(i,Mo(a))>0}const am=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,im=(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)),lm=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||am;let o;return pd(e)?o={...e}:o={...e,id:s(e)},im(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Id({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=Ed({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const kl={[ve.Left]:{x:-1,y:0},[ve.Right]:{x:1,y:0},[ve.Top]:{x:0,y:-1},[ve.Bottom]:{x:0,y:1}},cm=({source:e,sourcePosition:t=ve.Bottom,target:n})=>t===ve.Left||t===ve.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},vl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dm({source:e,sourcePosition:t=ve.Bottom,target:n,targetPosition:s=ve.Top,center:o,offset:a,stepPosition:i}){const l=kl[t],c=kl[s],d={x:e.x+l.x*a,y:e.y+l.y*a},h={x:n.x+c.x*a,y:n.y+c.y*a},u=cm({source:d,sourcePosition:t,target:h}),m=u.x!==0?"x":"y",f=u[m];let g=[],x,w;const v={x:0,y:0},y={x:0,y:0},[,,b,k]=Ed({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[m]*c[m]===-1){m==="x"?(x=o.x??d.x+(h.x-d.x)*i,w=o.y??(d.y+h.y)/2):(x=o.x??(d.x+h.x)/2,w=o.y??d.y+(h.y-d.y)*i);const j=[{x,y:d.y},{x,y:h.y}],A=[{x:d.x,y:w},{x:h.x,y:w}];l[m]===f?g=m==="x"?j:A:g=m==="x"?A:j}else{const j=[{x:d.x,y:h.y}],A=[{x:h.x,y:d.y}];if(m==="x"?g=l.x===f?A:j:g=l.y===f?j:A,t===s){const D=Math.abs(e[m]-n[m]);if(D<=a){const z=Math.min(a-1,a-D);l[m]===f?v[m]=(d[m]>e[m]?-1:1)*z:y[m]=(h[m]>n[m]?-1:1)*z}}if(t!==s){const D=m==="x"?"y":"x",z=l[m]===c[D],E=d[D]>h[D],B=d[D]<h[D];(l[m]===1&&(!z&&E||z&&B)||l[m]!==1&&(!z&&B||z&&E))&&(g=m==="x"?j:A)}const S={x:d.x+v.x,y:d.y+v.y},T={x:h.x+y.x,y:h.y+y.y},P=Math.max(Math.abs(S.x-g[0].x),Math.abs(T.x-g[0].x)),M=Math.max(Math.abs(S.y-g[0].y),Math.abs(T.y-g[0].y));P>=M?(x=(S.x+T.x)/2,w=g[0].y):(x=g[0].x,w=(S.y+T.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:h.x+y.x,y:h.y+y.y},n],x,w,b,k]}function um(e,t,n,s){const o=Math.min(vl(e,t)/2,vl(t,n)/2,s),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${a},${i+o*c}Q ${a},${i} ${a+o*l},${i}`}function Ea({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:o,targetPosition:a=ve.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[u,m,f,g,x]=dm({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:h});return[u.reduce((v,y,b)=>{let k="";return b>0&&b<u.length-1?k=um(u[b-1],y,u[b+1],i):k=`${b===0?"M":"L"}${y.x} ${y.y}`,v+=k,v},""),m,f,g,x]}function jl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function fm(e){const{sourceNode:t,targetNode:n}=e;if(!jl(t)||!jl(n))return null;const s=t.internals.handleBounds||Nl(t.handles),o=n.internals.handleBounds||Nl(n.handles),a=Sl(s?.source??[],e.sourceHandle),i=Sl(e.connectionMode===_s.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",un.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||ve.Bottom,c=i?.position||ve.Top,d=ss(t,a,l),h=ss(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function Nl(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function ss(e,t,n=ve.Left,s=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??Sn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case ve.Top:return{x:o+i/2,y:a};case ve.Right:return{x:o+i,y:a+l/2};case ve.Bottom:return{x:o+i/2,y:a+l};case ve.Left:return{x:o,y:a+l/2}}}function Sl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ia(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function hm(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:o}){const a=new Set;return e.reduce((i,l)=>([l.markerStart||s,l.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=Ia(c,t);a.has(d)||(i.push({id:d,color:c.color||n,...c}),a.add(d))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const Td=1e3,mm=10,Ga={nodeOrigin:[0,0],nodeExtent:hr,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},pm={...Ga,checkEquality:!0};function Xa(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function gm(e,t,n){const s=Xa(Ga,n);for(const o of e.values())if(o.parentId)Qa(o,e,t,s);else{const a=kr(o,s.nodeOrigin),i=Os(o.extent)?o.extent:s.nodeExtent,l=ns(a,i,Sn(o));o.internals.positionAbsolute=l}}function xm(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],s=[];for(const o of e.handles){const a={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(a):o.type==="target"&&s.push(a)}return{source:n,target:s}}function Za(e){return e==="manual"}function Ta(e,t,n,s={}){const o=Xa(pm,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Za(o.zIndexMode)?Td:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let h=i.get(d.id);if(o.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{const u=kr(d,o.nodeOrigin),m=Os(d.extent)?d.extent:o.nodeExtent,f=ns(u,m,Sn(d));h={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:f,handleBounds:xm(d,h),z:Md(d,l,o.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Qa(h,t,n,s,a)}return c}function bm(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Qa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Xa(Ga,s),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bm(e,n),o&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++o.i,h.internals.z=h.internals.z+o.i*mm),o&&h.internals.rootParentIndex!==void 0&&(o.i=h.internals.rootParentIndex);const u=a&&!Za(c)?Td:0,{x:m,y:f,z:g}=ym(e,h,i,l,u,c),{positionAbsolute:x}=e.internals,w=m!==x.x||f!==x.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:m,y:f}:x,z:g}})}function Md(e,t,n){const s=nn(e.zIndex)?e.zIndex:0;return Za(n)?s:s+(e.selected?t:0)}function ym(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=Sn(e),d=kr(e,n),h=Os(e.extent)?ns(d,e.extent,c):d;let u=ns({x:i+h.x,y:l+h.y},s,c);e.extent==="parent"&&(u=xd(u,c,t));const m=Md(e,o,a),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=m?f+1:m}}function Ja(e,t,n,s=[0,0]){const o=[],a=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=a.get(i.parentId)?.expandedRect??Ds(l),d=yd(c,i.rect);a.set(i.parentId,{expandedRect:d,parent:l})}return a.size>0&&a.forEach(({expandedRect:i,parent:l},c)=>{const d=l.internals.positionAbsolute,h=Sn(l),u=l.origin??s,m=i.x<d.x?Math.round(Math.abs(d.x-i.x)):0,f=i.y<d.y?Math.round(Math.abs(d.y-i.y)):0,g=Math.max(h.width,Math.round(i.width)),x=Math.max(h.height,Math.round(i.height)),w=(g-h.width)*u[0],v=(x-h.height)*u[1];(m>0||f>0||w||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-m+w,y:l.position.y-f+v}}),n.get(c)?.forEach(y=>{e.some(b=>b.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+m,y:y.position.y+f}})})),(h.width<i.width||h.height<i.height||m||f)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(m?u[0]*m-w:0),height:x+(f?u[1]*f-v:0)}})}),o}function wm(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(h.transform),m=[];for(const f of e.values()){const g=t.get(f.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Ya(f.nodeElement),w=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!g.internals.handleBounds||f.force))){const y=f.nodeElement.getBoundingClientRect(),b=Os(g.extent)?g.extent:a;let{positionAbsolute:k}=g.internals;g.parentId&&g.extent==="parent"?k=xd(k,x,t.get(g.parentId)):b&&(k=ns(k,b,x));const C={...g,measured:x,internals:{...g.internals,positionAbsolute:k,handleBounds:{source:yl("source",f.nodeElement,y,u,g.id),target:yl("target",f.nodeElement,y,u,g.id)}}};t.set(g.id,C),g.parentId&&Qa(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,w&&(d.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&m.push({id:g.id,parentId:g.parentId,rect:Ds(C,o)}))}}if(m.length>0){const f=Ja(m,t,n,o);d.push(...f)}return{changes:d,updatedInternals:c}}async function km({delta:e,panZoom:t,transform:n,translateExtent:s,width:o,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,a]],s),l=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(l)}function Cl(e,t,n,s,o,a){let i=o;const l=s.get(i)||new Map;s.set(i,l.set(n,t)),i=`${o}-${e}`;const c=s.get(i)||new Map;if(s.set(i,c.set(n,t)),a){i=`${o}-${e}-${a}`;const d=s.get(i)||new Map;s.set(i,d.set(n,t))}}function Ad(e,t,n){e.clear(),t.clear();for(const s of n){const{source:o,target:a,sourceHandle:i=null,targetHandle:l=null}=s,c={edgeId:s.id,source:o,target:a,sourceHandle:i,targetHandle:l},d=`${o}-${i}--${a}-${l}`,h=`${a}-${l}--${o}-${i}`;Cl("source",c,h,e,o,i),Cl("target",c,d,e,a,l),t.set(s.id,s)}}function _d(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_d(n,t):!1}function El(e,t,n){let s=e;do{if(s?.matches?.(t))return!0;if(s===n)return!1;s=s?.parentElement}while(s);return!1}function vm(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!_d(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(a);l&&o.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function aa({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){const o=[];for(const[i,l]of t){const c=n.get(i)?.internals.userNode;c&&o.push({...c,position:l.position,dragging:s})}if(!e)return[o[0],o];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:s}:o[0],o]}function jm({dragItems:e,snapGrid:t,x:n,y:s}){const o=e.values().next().value;if(!o)return null;const a={x:n-o.distance.x,y:s-o.distance.y},i=jr(a,t);return{x:i.x-a.x,y:i.y-a.y}}function Nm({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:o}){let a={x:null,y:null},i=0,l=new Map,c=!1,d={x:0,y:0},h=null,u=!1,m=null,f=!1,g=!1,x=null;function w({noDragClassName:y,handleSelector:b,domNode:k,isSelectable:C,nodeId:j,nodeClickDistance:A=0}){m=Ht(k);function S({x:D,y:z}){const{nodeLookup:E,nodeExtent:B,snapGrid:L,snapToGrid:$,nodeOrigin:R,onNodeDrag:q,onSelectionDrag:H,onError:K,updateNodePositions:O}=t();a={x:D,y:z};let Y=!1;const _=l.size>1,I=_&&B?Ca(vr(l)):null,V=_&&$?jm({dragItems:l,snapGrid:L,x:D,y:z}):null;for(const[W,F]of l){if(!E.has(W))continue;let Z={x:D-F.distance.x,y:z-F.distance.y};$&&(Z=V?{x:Math.round(Z.x+V.x),y:Math.round(Z.y+V.y)}:jr(Z,L));let te=null;if(_&&B&&!F.extent&&I){const{positionAbsolute:be}=F.internals,Ne=be.x-I.x+B[0][0],Ie=be.x+F.measured.width-I.x2+B[1][0],Ce=be.y-I.y+B[0][1],Fe=be.y+F.measured.height-I.y2+B[1][1];te=[[Ne,Ce],[Ie,Fe]]}const{position:ce,positionAbsolute:oe}=gd({nodeId:W,nextPosition:Z,nodeLookup:E,nodeExtent:te||B,nodeOrigin:R,onError:K});Y=Y||F.position.x!==ce.x||F.position.y!==ce.y,F.position=ce,F.internals.positionAbsolute=oe}if(g=g||Y,!!Y&&(O(l,!0),x&&(s||q||!j&&H))){const[W,F]=aa({nodeId:j,dragItems:l,nodeLookup:E});s?.(x,l,W,F),q?.(x,W,F),j||H?.(x,F)}}async function T(){if(!h)return;const{transform:D,panBy:z,autoPanSpeed:E,autoPanOnNodeDrag:B}=t();if(!B){c=!1,cancelAnimationFrame(i);return}const[L,$]=bd(d,h,E);(L!==0||$!==0)&&(a.x=(a.x??0)-L/D[2],a.y=(a.y??0)-$/D[2],await z({x:L,y:$})&&S(a)),i=requestAnimationFrame(T)}function P(D){const{nodeLookup:z,multiSelectionActive:E,nodesDraggable:B,transform:L,snapGrid:$,snapToGrid:R,selectNodesOnDrag:q,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:O}=t();u=!0,(!q||!C)&&!E&&j&&(z.get(j)?.selected||O()),C&&q&&j&&e?.(j);const Y=ar(D.sourceEvent,{transform:L,snapGrid:$,snapToGrid:R,containerBounds:h});if(a=Y,l=vm(z,B,Y,j),l.size>0&&(n||H||!j&&K)){const[_,I]=aa({nodeId:j,dragItems:l,nodeLookup:z});n?.(D.sourceEvent,l,_,I),H?.(D.sourceEvent,_,I),j||K?.(D.sourceEvent,I)}}const M=sd().clickDistance(A).on("start",D=>{const{domNode:z,nodeDragThreshold:E,transform:B,snapGrid:L,snapToGrid:$}=t();h=z?.getBoundingClientRect()||null,f=!1,g=!1,x=D.sourceEvent,E===0&&P(D),a=ar(D.sourceEvent,{transform:B,snapGrid:L,snapToGrid:$,containerBounds:h}),d=sn(D.sourceEvent,h)}).on("drag",D=>{const{autoPanOnNodeDrag:z,transform:E,snapGrid:B,snapToGrid:L,nodeDragThreshold:$,nodeLookup:R}=t(),q=ar(D.sourceEvent,{transform:E,snapGrid:B,snapToGrid:L,containerBounds:h});if(x=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!R.has(j))&&(f=!0),!f){if(!c&&z&&u&&(c=!0,T()),!u){const H=sn(D.sourceEvent,h),K=H.x-d.x,O=H.y-d.y;Math.sqrt(K*K+O*O)>$&&P(D)}(a.x!==q.xSnapped||a.y!==q.ySnapped)&&l&&u&&(d=sn(D.sourceEvent,h),S(q))}}).on("end",D=>{if(!(!u||f)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:z,updateNodePositions:E,onNodeDragStop:B,onSelectionDragStop:L}=t();if(g&&(E(l,!1),g=!1),o||B||!j&&L){const[$,R]=aa({nodeId:j,dragItems:l,nodeLookup:z,dragging:!1});o?.(D.sourceEvent,l,$,R),B?.(D.sourceEvent,$,R),j||L?.(D.sourceEvent,R)}}}).filter(D=>{const z=D.target;return!D.button&&(!y||!El(z,`.${y}`,k))&&(!b||El(z,b,k))});m.call(M)}function v(){m?.on(".drag",null)}return{update:w,destroy:v}}function Sm(e,t,n){const s=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())pr(o,Ds(a))>0&&s.push(a);return s}const Cm=250;function Em(e,t,n,s){let o=[],a=1/0;const i=Sm(e,n,t+Cm);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(s.nodeId===d.nodeId&&s.type===d.type&&s.id===d.id)continue;const{x:h,y:u}=ss(l,d,d.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(u-e.y,2));m>t||(m<a?(o=[{...d,x:h,y:u}],a=m):m===a&&o.push({...d,x:h,y:u}))}}if(!o.length)return null;if(o.length>1){const l=s.type==="source"?"target":"source";return o.find(c=>c.type===l)??o[0]}return o[0]}function Ld(e,t,n,s,o,a=!1){const i=s.get(e);if(!i)return null;const l=o==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?l?.find(d=>d.id===n):l?.[0])??null;return c&&a?{...c,...ss(i,c,c.position,!0)}:c}function Rd(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Im(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Dd=()=>!0;function Tm(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:u,panBy:m,cancelConnection:f,onConnectStart:g,onConnect:x,onConnectEnd:w,isValidConnection:v=Dd,onReconnectEnd:y,updateConnection:b,getTransform:k,getFromHandle:C,autoPanSpeed:j,dragThreshold:A=1,handleDomNode:S}){const T=vd(e.target);let P=0,M;const{x:D,y:z}=sn(e),E=Rd(a,S),B=l?.getBoundingClientRect();let L=!1;if(!B||!E)return;const $=Ld(o,E,s,c,t);if(!$)return;let R=sn(e,B),q=!1,H=null,K=!1,O=null;function Y(){if(!h||!B)return;const[ce,oe]=bd(R,B,j);m({x:ce,y:oe}),P=requestAnimationFrame(Y)}const _={...$,nodeId:o,type:E,position:$.position},I=c.get(o);let W={inProgress:!0,isValid:null,from:ss(I,_,ve.Left,!0),fromHandle:_,fromPosition:_.position,fromNode:I,to:R,toHandle:null,toPosition:pl[_.position],toNode:null,pointer:R};function F(){L=!0,b(W),g?.(e,{nodeId:o,handleId:s,handleType:E})}A===0&&F();function Z(ce){if(!L){const{x:Fe,y:Be}=sn(ce),Re=Fe-D,$e=Be-z;if(!(Re*Re+$e*$e>A*A))return;F()}if(!C()||!_){te(ce);return}const oe=k();R=sn(ce,B),M=Em(Nr(R,oe,!1,[1,1]),n,c,_),q||(Y(),q=!0);const be=Od(ce,{handle:M,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:T,lib:d,flowId:u,nodeLookup:c});O=be.handleDomNode,H=be.connection,K=Im(!!M,be.isValid);const Ne=c.get(o),Ie=Ne?ss(Ne,_,ve.Left,!0):W.from,Ce={...W,from:Ie,isValid:K,to:be.toHandle&&K?go({x:be.toHandle.x,y:be.toHandle.y},oe):R,toHandle:be.toHandle,toPosition:K&&be.toHandle?be.toHandle.position:pl[_.position],toNode:be.toHandle?c.get(be.toHandle.nodeId):null,pointer:R};b(Ce),W=Ce}function te(ce){if(!("touches"in ce&&ce.touches.length>0)){if(L){(M||O)&&H&&K&&x?.(H);const{inProgress:oe,...be}=W,Ne={...be,toPosition:W.toHandle?W.toPosition:null};w?.(ce,Ne),a&&y?.(ce,Ne)}f(),cancelAnimationFrame(P),q=!1,K=!1,H=null,O=null,T.removeEventListener("mousemove",Z),T.removeEventListener("mouseup",te),T.removeEventListener("touchmove",Z),T.removeEventListener("touchend",te)}}T.addEventListener("mousemove",Z),T.addEventListener("mouseup",te),T.addEventListener("touchmove",Z),T.addEventListener("touchend",te)}function Od(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=Dd,nodeLookup:h}){const u=a==="target",m=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:g}=sn(e),x=i.elementFromPoint(f,g),w=x?.classList.contains(`${l}-flow__handle`)?x:m,v={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=Rd(void 0,w),b=w.getAttribute("data-nodeid"),k=w.getAttribute("data-handleid"),C=w.classList.contains("connectable"),j=w.classList.contains("connectableend");if(!b||!y)return v;const A={source:u?b:s,sourceHandle:u?k:o,target:u?s:b,targetHandle:u?o:k};v.connection=A;const T=C&&j&&(n===_s.Strict?u&&y==="source"||!u&&y==="target":b!==s||k!==o);v.isValid=T&&d(A),v.toHandle=Ld(b,y,k,h,n,!0)}return v}const Ma={onPointerDown:Tm,isValid:Od};function Mm({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=Ht(e);function a({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:u=!0,zoomable:m=!0,inversePan:f=!1}){const g=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const k=n(),C=b.sourceEvent.ctrlKey&&gr()?10:1,j=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*h,A=k[2]*Math.pow(2,j*C);t.scaleTo(A)};let x=[0,0];const w=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(x=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},v=b=>{const k=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const C=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],j=[C[0]-x[0],C[1]-x[1]];x=C;const A=s()*Math.max(k[2],Math.log(k[2]))*(f?-1:1),S={x:k[0]-j[0]*A,y:k[1]-j[1]*A},T=[[0,0],[c,d]];t.setViewportConstrained({x:S.x,y:S.y,zoom:k[2]},T,l)},y=rd().on("start",w).on("zoom",u?v:null).on("zoom.wheel",m?g:null);o.call(y,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:tn}}const Ao=e=>({x:e.x,y:e.y,zoom:e.k}),ia=({x:e,y:t,zoom:n})=>Va.translate(e,t).scale(n),Ns=(e,t)=>e.target.closest(`.${t}`),$d=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Am=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,la=(e,t=0,n=Am,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},Pd=e=>{const t=e.ctrlKey&&gr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _m({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(Ns(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(h.ctrlKey&&i){const w=tn(h),v=Pd(h),y=u*Math.pow(2,v);s.scaleTo(n,y,w,h);return}const m=h.deltaMode===1?20:1;let f=o===ts.Vertical?0:h.deltaX*m,g=o===ts.Horizontal?0:h.deltaY*m;!gr()&&h.shiftKey&&o!==ts.Vertical&&(f=h.deltaY*m,g=0),s.translateBy(n,-(f/u)*a,-(g/u)*a,{internal:!0});const x=Ao(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,x),e.panScrollTimeout=setTimeout(()=>{d?.(h,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,x))}}function Lm({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=Ns(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Rm({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=Ao(s.transform);e.mouseButton=s.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,s.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(s.sourceEvent,o)}}function Dm({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&$d(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,Ao(a.transform))}}function Om({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&$d(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=Ao(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function $m({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return u=>{const m=e||t,f=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Ns(u,`${d}-flow__node`)||Ns(u,`${d}-flow__edge`)))return!0;if(!s&&!m&&!o&&!a&&!n||i||h&&!g||Ns(u,l)&&g||Ns(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!m&&!o&&!f&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Pm({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:o,onPanZoom:a,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),u=rd().scaleExtent([t,n]).translateExtent(s),m=Ht(e).call(u);y({x:o.x,y:o.y,zoom:Rs(o.zoom,t,n)},[[0,0],[h.width,h.height]],s);const f=m.on("wheel.zoom"),g=m.on("dblclick.zoom");u.wheelDelta(Pd);function x(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).transform(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function w({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:z,userSelectionActive:E,panOnScroll:B,panOnDrag:L,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:q,zoomOnPinch:H,zoomOnScroll:K,zoomOnDoubleClick:O,zoomActivationKeyPressed:Y,lib:_,onTransformChange:I,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:F}){E&&!d.isZoomingOrPanning&&v();const Z=B&&!Y&&!E;u.clickDistance(F?1/0:!nn(W)||W<0?0:W);const te=Z?_m({zoomPanValues:d,noWheelClassName:M,d3Selection:m,d3Zoom:u,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):Lm({noWheelClassName:M,preventScrolling:q,d3ZoomHandler:f});if(m.on("wheel.zoom",te,{passive:!1}),!E){const oe=Rm({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",oe);const be=Dm({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!z,onPanZoom:a,onTransformChange:I});u.on("zoom",be);const Ne=Om({zoomPanValues:d,panOnDrag:L,panOnScroll:B,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});u.on("end",Ne)}const ce=$m({zoomActivationKeyPressed:Y,panOnDrag:L,zoomOnScroll:K,panOnScroll:B,zoomOnDoubleClick:O,zoomOnPinch:H,userSelectionActive:E,noPanClassName:D,noWheelClassName:M,lib:_,connectionInProgress:V});u.filter(ce),O?m.on("dblclick.zoom",g):m.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function y(M,D,z){const E=ia(M),B=u?.constrain()(E,D,z);return B&&await x(B),new Promise(L=>L(B))}async function b(M,D){const z=ia(M);return await x(z,D),new Promise(E=>E(z))}function k(M){if(m){const D=ia(M),z=m.property("__zoom");(z.k!==M.zoom||z.x!==M.x||z.y!==M.y)&&u?.transform(m,D,null,{sync:!0})}}function C(){const M=m?mh(m.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function j(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).scaleTo(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function A(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).scaleBy(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function S(M){u?.scaleExtent(M)}function T(M){u?.translateExtent(M)}function P(M){const D=!nn(M)||M<0?0:M;u?.clickDistance(D)}return{update:w,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:C,scaleTo:j,scaleBy:A,setScaleExtent:S,setTranslateExtent:T,syncViewport:k,setClickDistance:P}}var $s;(function(e){e.Line="line",e.Handle="handle"})($s||($s={}));function Bm({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:o,affectsY:a}){const i=e-t,l=n-s,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&o&&(c[0]=c[0]*-1),l&&a&&(c[1]=c[1]*-1),c}function Il(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:o}}function Mn(e,t){return Math.max(0,t-e)}function An(e,t){return Math.max(0,e-t)}function Yr(e,t,n){return Math.max(0,t-e,e-n)}function Tl(e,t){return e?!t:t}function qm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:h,isVertical:u}=t,m=h&&u,{xSnapped:f,ySnapped:g}=n,{minWidth:x,maxWidth:w,minHeight:v,maxHeight:y}=s,{x:b,y:k,width:C,height:j,aspectRatio:A}=e;let S=Math.floor(h?f-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0);const P=C+(c?-S:S),M=j+(d?-T:T),D=-a[0]*C,z=-a[1]*j;let E=Yr(P,x,w),B=Yr(M,v,y);if(i){let R=0,q=0;c&&S<0?R=Mn(b+S+D,i[0][0]):!c&&S>0&&(R=An(b+P+D,i[1][0])),d&&T<0?q=Mn(k+T+z,i[0][1]):!d&&T>0&&(q=An(k+M+z,i[1][1])),E=Math.max(E,R),B=Math.max(B,q)}if(l){let R=0,q=0;c&&S>0?R=An(b+S,l[0][0]):!c&&S<0&&(R=Mn(b+P,l[1][0])),d&&T>0?q=An(k+T,l[0][1]):!d&&T<0&&(q=Mn(k+M,l[1][1])),E=Math.max(E,R),B=Math.max(B,q)}if(o){if(h){const R=Yr(P/A,v,y)*A;if(E=Math.max(E,R),i){let q=0;!c&&!d||c&&!d&&m?q=An(k+z+P/A,i[1][1])*A:q=Mn(k+z+(c?S:-S)/A,i[0][1])*A,E=Math.max(E,q)}if(l){let q=0;!c&&!d||c&&!d&&m?q=Mn(k+P/A,l[1][1])*A:q=An(k+(c?S:-S)/A,l[0][1])*A,E=Math.max(E,q)}}if(u){const R=Yr(M*A,x,w)/A;if(B=Math.max(B,R),i){let q=0;!c&&!d||d&&!c&&m?q=An(b+M*A+D,i[1][0])/A:q=Mn(b+(d?T:-T)*A+D,i[0][0])/A,B=Math.max(B,q)}if(l){let q=0;!c&&!d||d&&!c&&m?q=Mn(b+M*A,l[1][0])/A:q=An(b+(d?T:-T)*A,l[0][0])/A,B=Math.max(B,q)}}}T=T+(T<0?B:-B),S=S+(S<0?E:-E),o&&(m?P>M*A?T=(Tl(c,d)?-S:S)/A:S=(Tl(c,d)?-T:T)*A:h?(T=S/A,d=c):(S=T*A,c=d));const L=c?b+S:b,$=d?k+T:k;return{width:C+(c?-S:S),height:j+(d?-T:T),x:a[0]*S*(c?-1:1)+L,y:a[1]*T*(d?-1:1)+$}}const Bd={width:0,height:0,x:0,y:0},zm={...Bd,pointerX:0,pointerY:0,aspectRatio:1};function Fm(e){return[[0,0],[e.measured.width,e.measured.height]]}function Hm(e,t,n){const s=t.position.x+e.position.x,o=t.position.y+e.position.y,a=e.measured.width??0,i=e.measured.height??0,l=n[0]*a,c=n[1]*i;return[[s-l,o-c],[s+a-l,o+i-c]]}function Vm({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=Ht(e);let i={controlDirection:Il("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:h,keepAspectRatio:u,resizeDirection:m,onResizeStart:f,onResize:g,onResizeEnd:x,shouldResize:w}){let v={...Bd},y={...zm};i={boundaries:h,resizeDirection:m,keepAspectRatio:u,controlDirection:Il(d)};let b,k=null,C=[],j,A,S,T=!1;const P=sd().on("start",M=>{const{nodeLookup:D,transform:z,snapGrid:E,snapToGrid:B,nodeOrigin:L,paneDomNode:$}=n();if(b=D.get(t),!b)return;k=$?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:q}=ar(M.sourceEvent,{transform:z,snapGrid:E,snapToGrid:B,containerBounds:k});v={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},y={...v,pointerX:R,pointerY:q,aspectRatio:v.width/v.height},j=void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(j=D.get(b.parentId),A=j&&b.extent==="parent"?Fm(j):void 0),C=[],S=void 0;for(const[H,K]of D)if(K.parentId===t&&(C.push({id:H,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const O=Hm(K,b,K.origin??L);S?S=[[Math.min(O[0][0],S[0][0]),Math.min(O[0][1],S[0][1])],[Math.max(O[1][0],S[1][0]),Math.max(O[1][1],S[1][1])]]:S=O}f?.(M,{...v})}).on("drag",M=>{const{transform:D,snapGrid:z,snapToGrid:E,nodeOrigin:B}=n(),L=ar(M.sourceEvent,{transform:D,snapGrid:z,snapToGrid:E,containerBounds:k}),$=[];if(!b)return;const{x:R,y:q,width:H,height:K}=v,O={},Y=b.origin??B,{width:_,height:I,x:V,y:W}=qm(y,i.controlDirection,L,i.boundaries,i.keepAspectRatio,Y,A,S),F=_!==H,Z=I!==K,te=V!==R&&F,ce=W!==q&&Z;if(!te&&!ce&&!F&&!Z)return;if((te||ce||Y[0]===1||Y[1]===1)&&(O.x=te?V:v.x,O.y=ce?W:v.y,v.x=O.x,v.y=O.y,C.length>0)){const Ie=V-R,Ce=W-q;for(const Fe of C)Fe.position={x:Fe.position.x-Ie+Y[0]*(_-H),y:Fe.position.y-Ce+Y[1]*(I-K)},$.push(Fe)}if((F||Z)&&(O.width=F&&(!i.resizeDirection||i.resizeDirection==="horizontal")?_:v.width,O.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?I:v.height,v.width=O.width,v.height=O.height),j&&b.expandParent){const Ie=Y[0]*(O.width??0);O.x&&O.x<Ie&&(v.x=Ie,y.x=y.x-(O.x-Ie));const Ce=Y[1]*(O.height??0);O.y&&O.y<Ce&&(v.y=Ce,y.y=y.y-(O.y-Ce))}const oe=Bm({width:v.width,prevWidth:H,height:v.height,prevHeight:K,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),be={...v,direction:oe};w?.(M,be)!==!1&&(T=!0,g?.(M,be),s(O,$))}).on("end",M=>{T&&(x?.(M,{...v}),o?.({...v}),T=!1)});a.call(P)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var ca={exports:{}},da={};var Ml;function Wm(){if(Ml)return da;Ml=1;var e=zf(),t=Ff();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return da.useSyncExternalStoreWithSelector=function(d,h,u,m,f){var g=a(null);if(g.current===null){var x={hasValue:!1,value:null};g.current=x}else x=g.current;g=l(function(){function v(j){if(!y){if(y=!0,b=j,j=m(j),f!==void 0&&x.hasValue){var A=x.value;if(f(A,j))return k=A}return k=j}if(A=k,s(b,j))return A;var S=m(j);return f!==void 0&&f(A,S)?(b=j,A):(b=j,k=S)}var y=!1,b,k,C=u===void 0?null:u;return[function(){return v(h())},C===null?void 0:function(){return v(C())}]},[h,u,m,f]);var w=o(d,g[0],g[1]);return i(function(){x.hasValue=!0,x.value=w},[w]),c(w),w},da}var Al;function Km(){return Al||(Al=1,ca.exports=Wm()),ca.exports}var Um=Km();const Ym=Hf(Um),Gm={},_l=e=>{let t;const n=new Set,s=(h,u)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const f=t;t=u??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(g=>g(t,f))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(Gm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,o,c);return c},Xm=e=>e?_l(e):_l,{useDebugValue:Zm}=Vf,{useSyncExternalStoreWithSelector:Qm}=Ym,Jm=e=>e;function qd(e,t=Jm,n){const s=Qm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zm(s),s}const Ll=(e,t)=>{const n=Xm(e),s=(o,a=t)=>qd(n,o,a);return Object.assign(s,n),s},ep=(e,t)=>e?Ll(e,t):Ll;function ct(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e)if(!Object.is(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const _o=p.createContext(null),tp=_o.Provider,zd=un.error001();function Ke(e,t){const n=p.useContext(_o);if(n===null)throw new Error(zd);return qd(n,e,t)}function it(){const e=p.useContext(_o);if(e===null)throw new Error(zd);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Rl={display:"none"},np={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fd="react-flow__node-desc",Hd="react-flow__edge-desc",sp="react-flow__aria-live",rp=e=>e.ariaLiveMessage,op=e=>e.ariaLabelConfig;function ap({rfId:e}){const t=Ke(rp);return r.jsx("div",{id:`${sp}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:np,children:t})}function ip({rfId:e,disableKeyboardA11y:t}){const n=Ke(op);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${Fd}-${e}`,style:Rl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${Hd}-${e}`,style:Rl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(ap,{rfId:e})]})}const Lo=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:jt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});Lo.displayName="Panel";function lp({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(Lo,{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:r.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const cp=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},Gr=e=>e.id;function dp(e,t){return ct(e.selectedNodes.map(Gr),t.selectedNodes.map(Gr))&&ct(e.selectedEdges.map(Gr),t.selectedEdges.map(Gr))}function up({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:s}=Ke(cp,dp);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const fp=e=>!!e.onSelectionChangeHandlers;function hp({onSelectionChange:e}){const t=Ke(fp);return e||t?r.jsx(up,{onSelectionChange:e}):null}const Vd=[0,0],mp={x:0,y:0,zoom:1},pp=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Dl=[...pp,"rfId"],gp=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Ol={translateExtent:hr,nodeOrigin:Vd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function xp(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Ke(gp,ct),d=it();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=Ol,l()}),[]);const h=p.useRef(Ol);return p.useEffect(()=>{for(const u of Dl){const m=e[u],f=h.current[u];m!==f&&(typeof e[u]>"u"||(u==="nodes"?t(m):u==="edges"?n(m):u==="minZoom"?s(m):u==="maxZoom"?o(m):u==="translateExtent"?a(m):u==="nodeExtent"?i(m):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:nm(m)}):u==="fitView"?d.setState({fitViewQueued:m}):u==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[u]:m})))}h.current=e},Dl.map(u=>e[u])),null}function $l(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bp(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=$l(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:$l()?.matches?"dark":"light"}const Pl=typeof document<"u"?document:null;function xr(e=null,t={target:Pl,actInsideInputWithModifier:!0}){const[n,s]=p.useState(!1),o=p.useRef(!1),a=p.useRef(new Set([])),[i,l]=p.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
1
|
+
import{u as ze,j as r,bl as zf,bm as Ff,a3 as Hf,bn as Vf,r as p,k as ee,aD as Wf,a as wr,a1 as Kf,l as kn,n as Gt,P as st,$ as ol,b as Uf,c as Yf,Q as Gf,R as al,bo as Xf,bp as Zf,U as Bt,bc as Ft,bq as Fr,W as Hr,X as Qf,br as qa,bs as cr,bt as za,i as Jf,a7 as js,d as eh,b1 as th,bu as Uc,bv as nh,A as Fa,b6 as Ha,b5 as il,Z as sh,t as rh}from"./index-CudHikwU.js";import{t as Yc,a1 as Gc,a2 as oh,a3 as ll,a4 as cl,a5 as ah,a6 as ih,a7 as Xc,a8 as lh,P as ch}from"./ChatComponents-u_iLnHEf.js";import{S as Zc,a as Qc,r as Jc,s as dh}from"./SendToChat-BR3-e7d4.js";import{L as uh,P as fh}from"./AsyncState-CeDmMBla.js";import{MarkdownMessage as dr}from"./MarkdownMessage-BX6YVVx8.js";import{ContentRenderer as hh}from"./ContentRenderer-CHzFmlGx.js";import{s as Ht,g as ed,j as Va,T as ta,k as na,t as mh}from"./transform-BqqRT-Iy.js";import{i as sa}from"./value-wA6veExk.js";import"./chatChips-DVIRVTpT.js";function ph(e){let t;for(;t=e.sourceEvent;)e=t;return e}function tn(e,t){if(e=ph(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const gh={passive:!1},ur={capture:!0,passive:!1};function ra(e){e.stopImmediatePropagation()}function Ts(e){e.preventDefault(),e.stopImmediatePropagation()}function td(e){var t=e.document.documentElement,n=Ht(e).on("dragstart.drag",Ts,ur);"onselectstart"in t?n.on("selectstart.drag",Ts,ur):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nd(e,t){var n=e.document.documentElement,s=Ht(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ts,ur),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Vr=e=>()=>e;function Na(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}Na.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xh(e){return!e.ctrlKey&&!e.button}function bh(){return this.parentNode}function yh(e,t){return t??{x:e.x,y:e.y}}function wh(){return navigator.maxTouchPoints||"ontouchstart"in this}function sd(){var e=xh,t=bh,n=yh,s=wh,o={},a=ed("start","drag","end"),i=0,l,c,d,h,u=0;function m(k){k.on("mousedown.drag",f).filter(s).on("touchstart.drag",w).on("touchmove.drag",v,gh).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(k,C){if(!(h||!e.call(this,k,C))){var j=b(this,t.call(this,k,C),k,C,"mouse");j&&(Ht(k.view).on("mousemove.drag",g,ur).on("mouseup.drag",x,ur),td(k.view),ra(k),d=!1,l=k.clientX,c=k.clientY,j("start",k))}}function g(k){if(Ts(k),!d){var C=k.clientX-l,j=k.clientY-c;d=C*C+j*j>u}o.mouse("drag",k)}function x(k){Ht(k.view).on("mousemove.drag mouseup.drag",null),nd(k.view,d),Ts(k),o.mouse("end",k)}function w(k,C){if(e.call(this,k,C)){var j=k.changedTouches,A=t.call(this,k,C),S=j.length,T,P;for(T=0;T<S;++T)(P=b(this,A,k,C,j[T].identifier,j[T]))&&(ra(k),P("start",k,j[T]))}}function v(k){var C=k.changedTouches,j=C.length,A,S;for(A=0;A<j;++A)(S=o[C[A].identifier])&&(Ts(k),S("drag",k,C[A]))}function y(k){var C=k.changedTouches,j=C.length,A,S;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<j;++A)(S=o[C[A].identifier])&&(ra(k),S("end",k,C[A]))}function b(k,C,j,A,S,T){var P=a.copy(),M=tn(T||j,C),D,z,E;if((E=n.call(k,new Na("beforestart",{sourceEvent:j,target:m,identifier:S,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:P}),A))!=null)return D=E.x-M[0]||0,z=E.y-M[1]||0,function B(L,$,R){var q=M,H;switch(L){case"start":o[S]=B,H=i++;break;case"end":delete o[S],--i;case"drag":M=tn(R||$,C),H=i;break}P.call(L,k,new Na(L,{sourceEvent:$,subject:E,target:m,identifier:S,active:H,x:M[0]+D,y:M[1]+z,dx:M[0]-q[0],dy:M[1]-q[1],dispatch:P}),A)}}return m.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Vr(!!k),m):e},m.container=function(k){return arguments.length?(t=typeof k=="function"?k:Vr(k),m):t},m.subject=function(k){return arguments.length?(n=typeof k=="function"?k:Vr(k),m):n},m.touchable=function(k){return arguments.length?(s=typeof k=="function"?k:Vr(!!k),m):s},m.on=function(){var k=a.on.apply(a,arguments);return k===a?m:k},m.clickDistance=function(k){return arguments.length?(u=(k=+k)*k,m):Math.sqrt(u)},m}var kh=1e-12;function dl(e){return((e=Math.exp(e))+1/e)/2}function vh(e){return((e=Math.exp(e))-1/e)/2}function jh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ao=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],h=i[0],u=i[1],m=i[2],f=h-l,g=u-c,x=f*f+g*g,w,v;if(x<kh)v=Math.log(m/d)/t,w=function(A){return[l+A*f,c+A*g,d*Math.exp(t*A*v)]};else{var y=Math.sqrt(x),b=(m*m-d*d+s*x)/(2*d*n*y),k=(m*m-d*d-s*x)/(2*m*n*y),C=Math.log(Math.sqrt(b*b+1)-b),j=Math.log(Math.sqrt(k*k+1)-k);v=(j-C)/t,w=function(A){var S=A*v,T=dl(C),P=d/(n*y)*(T*jh(t*S+C)-vh(C));return[l+P*f,c+P*g,d*T/dl(t*S+C)]}}return w.duration=v*1e3*t/Math.SQRT2,w}return o.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},o})(Math.SQRT2,2,4),Wr=e=>()=>e;function Nh(e,{sourceEvent:t,target:n,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function oa(e){e.stopImmediatePropagation()}function nr(e){e.preventDefault(),e.stopImmediatePropagation()}function Sh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ch(){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 ul(){return this.__zoom||Va}function Eh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ih(){return navigator.maxTouchPoints||"ontouchstart"in this}function Th(e,t,n){var s=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}function rd(){var e=Sh,t=Ch,n=Th,s=Eh,o=Ih,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ao,d=ed("start","zoom","end"),h,u,m,f=500,g=150,x=0,w=10;function v(E){E.property("__zoom",ul).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(E,B,L,$){var R=E.selection?E.selection():E;R.property("__zoom",ul),E!==R?C(E,B,L,$):R.interrupt().each(function(){j(this,arguments).event($).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(E,B,L,$){v.scaleTo(E,function(){var R=this.__zoom.k,q=typeof B=="function"?B.apply(this,arguments):B;return R*q},L,$)},v.scaleTo=function(E,B,L,$){v.transform(E,function(){var R=t.apply(this,arguments),q=this.__zoom,H=L==null?k(R):typeof L=="function"?L.apply(this,arguments):L,K=q.invert(H),O=typeof B=="function"?B.apply(this,arguments):B;return n(b(y(q,O),H,K),R,i)},L,$)},v.translateBy=function(E,B,L,$){v.transform(E,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,$)},v.translateTo=function(E,B,L,$,R){v.transform(E,function(){var q=t.apply(this,arguments),H=this.__zoom,K=$==null?k(q):typeof $=="function"?$.apply(this,arguments):$;return n(Va.translate(K[0],K[1]).scale(H.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof L=="function"?-L.apply(this,arguments):-L),q,i)},$,R)};function y(E,B){return B=Math.max(a[0],Math.min(a[1],B)),B===E.k?E:new ta(B,E.x,E.y)}function b(E,B,L){var $=B[0]-L[0]*E.k,R=B[1]-L[1]*E.k;return $===E.x&&R===E.y?E:new ta(E.k,$,R)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function C(E,B,L,$){E.on("start.zoom",function(){j(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event($).end()}).tween("zoom",function(){var R=this,q=arguments,H=j(R,q).event($),K=t.apply(R,q),O=L==null?k(K):typeof L=="function"?L.apply(R,q):L,Y=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),_=R.__zoom,I=typeof B=="function"?B.apply(R,q):B,V=c(_.invert(O).concat(Y/_.k),I.invert(O).concat(Y/I.k));return function(W){if(W===1)W=I;else{var F=V(W),Z=Y/F[2];W=new ta(Z,O[0]-F[0]*Z,O[1]-F[1]*Z)}H.zoom(null,W)}})}function j(E,B,L){return!L&&E.__zooming||new A(E,B)}function A(E,B){this.that=E,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,B),this.taps=0}A.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,B){return this.mouse&&E!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var B=Ht(this.that).datum();d.call(E,this.that,new Nh(E,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function S(E,...B){if(!e.apply(this,arguments))return;var L=j(this,B).event(E),$=this.__zoom,R=Math.max(a[0],Math.min(a[1],$.k*Math.pow(2,s.apply(this,arguments)))),q=tn(E);if(L.wheel)(L.mouse[0][0]!==q[0]||L.mouse[0][1]!==q[1])&&(L.mouse[1]=$.invert(L.mouse[0]=q)),clearTimeout(L.wheel);else{if($.k===R)return;L.mouse=[q,$.invert(q)],na(this),L.start()}nr(E),L.wheel=setTimeout(H,g),L.zoom("mouse",n(b(y($,R),L.mouse[0],L.mouse[1]),L.extent,i));function H(){L.wheel=null,L.end()}}function T(E,...B){if(m||!e.apply(this,arguments))return;var L=E.currentTarget,$=j(this,B,!0).event(E),R=Ht(E.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",Y,!0),q=tn(E,L),H=E.clientX,K=E.clientY;td(E.view),oa(E),$.mouse=[q,this.__zoom.invert(q)],na(this),$.start();function O(_){if(nr(_),!$.moved){var I=_.clientX-H,V=_.clientY-K;$.moved=I*I+V*V>x}$.event(_).zoom("mouse",n(b($.that.__zoom,$.mouse[0]=tn(_,L),$.mouse[1]),$.extent,i))}function Y(_){R.on("mousemove.zoom mouseup.zoom",null),nd(_.view,$.moved),nr(_),$.event(_).end()}}function P(E,...B){if(e.apply(this,arguments)){var L=this.__zoom,$=tn(E.changedTouches?E.changedTouches[0]:E,this),R=L.invert($),q=L.k*(E.shiftKey?.5:2),H=n(b(y(L,q),$,R),t.apply(this,B),i);nr(E),l>0?Ht(this).transition().duration(l).call(C,H,$,E):Ht(this).call(v.transform,H,$,E)}}function M(E,...B){if(e.apply(this,arguments)){var L=E.touches,$=L.length,R=j(this,B,E.changedTouches.length===$).event(E),q,H,K,O;for(oa(E),H=0;H<$;++H)K=L[H],O=tn(K,this),O=[O,this.__zoom.invert(O),K.identifier],R.touch0?!R.touch1&&R.touch0[2]!==O[2]&&(R.touch1=O,R.taps=0):(R.touch0=O,q=!0,R.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(R.taps<2&&(u=O[0],h=setTimeout(function(){h=null},f)),na(this),R.start())}}function D(E,...B){if(this.__zooming){var L=j(this,B).event(E),$=E.changedTouches,R=$.length,q,H,K,O;for(nr(E),q=0;q<R;++q)H=$[q],K=tn(H,this),L.touch0&&L.touch0[2]===H.identifier?L.touch0[0]=K:L.touch1&&L.touch1[2]===H.identifier&&(L.touch1[0]=K);if(H=L.that.__zoom,L.touch1){var Y=L.touch0[0],_=L.touch0[1],I=L.touch1[0],V=L.touch1[1],W=(W=I[0]-Y[0])*W+(W=I[1]-Y[1])*W,F=(F=V[0]-_[0])*F+(F=V[1]-_[1])*F;H=y(H,Math.sqrt(W/F)),K=[(Y[0]+I[0])/2,(Y[1]+I[1])/2],O=[(_[0]+V[0])/2,(_[1]+V[1])/2]}else if(L.touch0)K=L.touch0[0],O=L.touch0[1];else return;L.zoom("touch",n(b(H,K,O),L.extent,i))}}function z(E,...B){if(this.__zooming){var L=j(this,B).event(E),$=E.changedTouches,R=$.length,q,H;for(oa(E),m&&clearTimeout(m),m=setTimeout(function(){m=null},f),q=0;q<R;++q)H=$[q],L.touch0&&L.touch0[2]===H.identifier?delete L.touch0:L.touch1&&L.touch1[2]===H.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(H=tn(H,this),Math.hypot(u[0]-H[0],u[1]-H[1])<w)){var K=Ht(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return v.wheelDelta=function(E){return arguments.length?(s=typeof E=="function"?E:Wr(+E),v):s},v.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Wr(!!E),v):e},v.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Wr(!!E),v):o},v.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Wr([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),v):t},v.scaleExtent=function(E){return arguments.length?(a[0]=+E[0],a[1]=+E[1],v):[a[0],a[1]]},v.translateExtent=function(E){return arguments.length?(i[0][0]=+E[0][0],i[1][0]=+E[1][0],i[0][1]=+E[0][1],i[1][1]=+E[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(E){return arguments.length?(n=E,v):n},v.duration=function(E){return arguments.length?(l=+E,v):l},v.interpolate=function(E){return arguments.length?(c=E,v):c},v.on=function(){var E=d.on.apply(d,arguments);return E===d?v:E},v.clickDistance=function(E){return arguments.length?(x=(E=+E)*E,v):Math.sqrt(x)},v.tapDistance=function(E){return arguments.length?(w=+E,v):w},v}const od=new Set(["completed","failed","rejected","cancelled","archived"]);function fr(e){return!!e&&od.has(e)}const ad=new Set(["completed","rejected","cancelled","archived"]);function Mh(e,t={}){const n=[];for(let s=0;s<e.length;s++){const o=e[s];if(o.toStatus!=="review")continue;const a=e[s+1],i=!a,l=`review:${o.id}`,c=t.reviewerId??o.changedById??"",d=t.reviewerName??void 0??(c?t.reviewerNameOf?.(c):void 0)??null;n.push({id:l,reviewerId:c,reviewerName:d,reviewerType:t.reviewerType??null,status:i?"reviewing":"completed",queuedAt:o.createdAt,completedAt:a?a.createdAt:null,round:n.length+1,outcome:a?Ah(a.toStatus):null,decidedByName:a?a.changedByName??null:null,note:a?a.reason??null:null})}return n}function Ah(e){return e==="completed"?"approved":e==="in_progress"?"revision_requested":"closed"}function fl(e){return e.find(t=>t.status==="reviewing")??null}function _h(e){return e.some(t=>t.status==="reviewing")}function Kr(e){return e?new Date(e).getTime():Number.NaN}function Lh(e,t,n="all"){const s=[];if(n!=="review")for(const o of e){const a=o.firstAt??"";Number.isNaN(Kr(a))||s.push({kind:"execution",key:`exec:${o.round}`,round:o.round,startedAt:a,endedAt:o.lastAt??null,toolCount:o.toolCount??0,logCount:o.logCount??0,status:o.status??""})}if(n!=="execution")for(const o of t)Number.isNaN(Kr(o.queuedAt))||s.push({kind:"review",key:o.id,round:o.round,startedAt:o.queuedAt,endedAt:o.completedAt,session:o});return s.sort((o,a)=>{const i=Kr(o.startedAt)-Kr(a.startedAt);return i!==0?i:o.kind!==a.kind?o.kind==="execution"?-1:1:o.round-a.round})}const hl=6e4,Rh=/^(Reviewing task from\b|Task Review$)/;function Dh(e){const t=(e.label??"").trim();return t?Rh.test(t):!1}function id(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return!1;const s=new Date(t.queuedAt).getTime();if(Number.isNaN(s))return!1;const o=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(o)?!1:n>=s-hl&&n<=o+hl}function Oh(e,t){const n=new Date(t.queuedAt).getTime(),s=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(n)||Number.isNaN(s)?[]:e.filter(o=>!Dh(o)||o.taskId&&o.taskId!==t.taskId?!1:id(o.startedAt,t)).sort((o,a)=>new Date(o.startedAt).getTime()-new Date(a.startedAt).getTime())}const $h=["30m","1h","2h","4h","8h","12h","1d","1w"],Ph={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function ml(e){return Ph[e]??"freq4h"}function Bh(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Sa(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:Bh()}}function ld(e){const t=/^(\d{1,2}):(\d{2})$/.exec((e??"").trim());if(!t)return[9,0];const n=Math.min(23,Math.max(0,parseInt(t[1],10))),s=Math.min(59,Math.max(0,parseInt(t[2],10)));return[n,s]}function qh(e){const[t,n]=ld(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function zh(e,t,n){if(e==="cron")return"";const[s,o]=ld(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function Fh(e){const t=/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\S+)$/.exec((e??"").trim());if(!t)return null;const n=parseInt(t[1],10),s=parseInt(t[2],10);if(n>59||s>23)return null;const o=t[3],a=`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(o==="*")return{calendar:"daily",weekdays:[1,2,3,4,5],time:a};if(o==="1-5")return{calendar:"weekdays",weekdays:[1,2,3,4,5],time:a};if(/^\d(,\d)*$/.test(o)){const i=o.split(",").map(l=>parseInt(l,10)).filter(l=>l>=0&&l<=6);if(i.length>0)return{calendar:"weekly",weekdays:i,time:a}}return null}function Hh(e){const t=Sa();if(!e)return t;if(e.timezone&&(t.timezone=e.timezone),t.maxRuns=e.maxRuns&&e.maxRuns>0?String(e.maxRuns):"",e.cron){const n=Fh(e.cron);t.mode="calendar",n?(t.calendar=n.calendar,t.weekdays=n.weekdays,t.time=n.time):(t.calendar="cron",t.cron=e.cron)}else e.every&&(t.mode="interval",t.every=e.every);return t}function cd(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():zh(e.calendar,e.weekdays,e.time),e.timezone&&(t.timezone=e.timezone));const n=parseInt(e.maxRuns,10);return e.maxRuns.trim()!==""&&Number.isFinite(n)&&n>0&&(t.maxRuns=n),t}const Vh=[1,2,3,4,5,6,0];function Wh({options:e,value:t,onChange:n,size:s="md"}){const o=s==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm";return r.jsx("div",{className:"inline-flex rounded-lg border border-border-default overflow-hidden",children:e.map(a=>r.jsx("button",{type:"button",onClick:()=>n(a.value),className:`${o} transition-colors ${t===a.value?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function dd({value:e,onChange:t,compact:n=!1}){const{t:s}=ze(),o=h=>t({...e,...h}),a=`px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg outline-none focus:border-brand-500 ${n?"text-xs":"text-sm"}`,i=h=>{const m=e.weekdays.includes(h)?e.weekdays.filter(f=>f!==h):[...e.weekdays,h];o({weekdays:m})};let l;if(e.mode==="interval")l=s(`work:task.${ml(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const h=qh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:h});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:h});else{const u=[...e.weekdays].sort((m,f)=>m-f).map(m=>s(`work:task.weekdayShort.${m}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:h}):s("work:task.scheduleNoDays")}}const c=e.calendar==="daily"||e.calendar==="weekdays"||e.calendar==="weekly",d="text-fg-tertiary shrink-0 text-xs w-20";return r.jsxs("div",{className:"rounded-lg border border-border-default/70 bg-surface-elevated/40 p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatMode")}),r.jsx(Wh,{size:n?"sm":"md",value:e.mode,onChange:h=>o({mode:h}),options:[{value:"interval",label:s("work:task.scheduleByInterval")},{value:"calendar",label:s("work:task.scheduleByCalendar")}]})]}),e.mode==="interval"?r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleEveryLabel")}),r.jsx("select",{value:e.every,onChange:h=>o({every:h.target.value}),className:a,children:$h.map(h=>r.jsx("option",{value:h,children:s(`work:task.${ml(h)}`)},h))})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatLabel")}),r.jsxs("select",{value:e.calendar,onChange:h=>o({calendar:h.target.value}),className:a,children:[r.jsx("option",{value:"daily",children:s("work:task.scheduleCalendarDaily")}),r.jsx("option",{value:"weekdays",children:s("work:task.scheduleCalendarWeekdays")}),r.jsx("option",{value:"weekly",children:s("work:task.scheduleCalendarWeekly")}),r.jsx("option",{value:"cron",children:s("work:task.scheduleCalendarCron")})]}),c&&r.jsx("input",{type:"time",value:e.time,onChange:h=>o({time:h.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:Vh.map(h=>{const u=e.weekdays.includes(h);return r.jsx("button",{type:"button",onClick:()=>i(h),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${h}`)},h)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:h=>o({cron:h.target.value}),placeholder:"0 9 * * 1-5",className:`${a} w-full font-mono`})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleMaxRuns")}),r.jsx("input",{value:e.maxRuns,onChange:h=>o({maxRuns:h.target.value.replace(/\D/g,"")}),placeholder:s("work:task.scheduleMaxRunsPlaceholder"),className:`${a} w-20`})]}),r.jsxs("div",{className:"text-[11px] text-fg-secondary pt-1 border-t border-border-default/50",children:[s("work:task.schedulePreview",{desc:l}),r.jsxs("span",{className:"text-fg-tertiary",children:[" · ",s("work:task.scheduleTimezoneNote",{tz:e.timezone})]})]})]})}function jt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=jt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const un={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},hr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ud=["Enter"," ","Escape"],fd={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var _s;(function(e){e.Strict="strict",e.Loose="loose"})(_s||(_s={}));var ts;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ts||(ts={}));var mr;(function(e){e.Partial="partial",e.Full="full"})(mr||(mr={}));const hd={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ln;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ln||(Ln={}));var Ls;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ls||(Ls={}));var ve;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ve||(ve={}));const pl={[ve.Left]:ve.Right,[ve.Right]:ve.Left,[ve.Top]:ve.Bottom,[ve.Bottom]:ve.Top};function md(e){return e===null?null:e?"valid":"invalid"}const pd=e=>"id"in e&&"source"in e&&"target"in e,Kh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wa=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),kr=(e,t=[0,0])=>{const{width:n,height:s}=Sn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},Uh=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,o)=>{const a=typeof o=="string";let i=!t.nodeLookup&&!a?o:void 0;t.nodeLookup&&(i=a?t.nodeLookup.get(o):Wa(o)?o:t.nodeLookup.get(o.id));const l=i?po(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return To(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mo(n)},vr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=To(n,po(o)),s=!0)}),s?Mo(n):{x:0,y:0,width:0,height:0}},Ka=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...Nr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:h,selectable:u=!0,hidden:m=!1}=d;if(i&&!u||m)continue;const f=h.width??d.width??d.initialWidth??null,g=h.height??d.height??d.initialHeight??null,x=pr(l,Ds(d)),w=(f??0)*(g??0),v=a&&x>0;(!d.internals.handleBounds||v||x>=w||d.dragging)&&c.push(d)}return c},Yh=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function Gh(e,t){const n=new Map,s=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!s||s.has(o.id))&&n.set(o.id,o)}),n}async function Xh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=Gh(e,i),c=vr(l),d=Ua(c,t,n,i?.minZoom??o,i?.maxZoom??a,i?.padding??.1);return await s.setViewport(d,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function gd({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:o,onError:a}){const i=n.get(e),l=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",un.error005());else{const f=l.measured.width,g=l.measured.height;f&&g&&(u=[[c,d],[c+f,d+g]])}else l&&Os(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const m=Os(u)?ns(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",un.error015()),{position:{x:m.x-c+(i.measured.width??0)*h[0],y:m.y-d+(i.measured.height??0)*h[1]},positionAbsolute:m}}async function Zh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(m=>m.id)),i=[];for(const m of n){if(m.deletable===!1)continue;const f=a.has(m.id),g=!f&&m.parentId&&i.find(x=>x.id===m.parentId);(f||g)&&i.push(m)}const l=new Set(t.map(m=>m.id)),c=s.filter(m=>m.deletable!==!1),h=Yh(i,c);for(const m of c)l.has(m.id)&&!h.find(g=>g.id===m.id)&&h.push(m);if(!o)return{edges:h,nodes:i};const u=await o({nodes:i,edges:h});return typeof u=="boolean"?u?{edges:h,nodes:i}:{edges:[],nodes:[]}:u}const Rs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ns=(e={x:0,y:0},t,n)=>({x:Rs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Rs(e.y,t[0][1],t[1][1]-(n?.height??0))});function xd(e,t,n){const{width:s,height:o}=Sn(n),{x:a,y:i}=n.internals.positionAbsolute;return ns(e,[[a,i],[a+s,i+o]],t)}const gl=(e,t,n)=>e<t?Rs(Math.abs(e-t),1,t)/t:e>n?-Rs(Math.abs(e-n),1,t)/t:0,bd=(e,t,n=15,s=40)=>{const o=gl(e.x,s,t.width-s)*n,a=gl(e.y,s,t.height-s)*n;return[o,a]},To=(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)}),Ca=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Mo=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Ds=(e,t=[0,0])=>{const{x:n,y:s}=Wa(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:s,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},po=(e,t=[0,0])=>{const{x:n,y:s}=Wa(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:s,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:s+(e.measured?.height??e.height??e.initialHeight??0)}},yd=(e,t)=>Mo(To(Ca(e),Ca(t))),pr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},xl=e=>nn(e.width)&&nn(e.height)&&nn(e.x)&&nn(e.y),nn=e=>!isNaN(e)&&isFinite(e),Qh=(e,t)=>{},jr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Nr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?jr(l,i):l},go=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function ws(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Jh(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=ws(e,n),o=ws(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=ws(e.top??e.y??0,n),o=ws(e.bottom??e.y??0,n),a=ws(e.left??e.x??0,t),i=ws(e.right??e.x??0,t);return{top:s,right:i,bottom:o,left:a,x:a+i,y:s+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function em(e,t,n,s,o,a){const{x:i,y:l}=go(e,[t,n,s]),{x:c,y:d}=go({x:e.x+e.width,y:e.y+e.height},[t,n,s]),h=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(u)}}const Ua=(e,t,n,s,o,a)=>{const i=Jh(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),h=Rs(d,s,o),u=e.x+e.width/2,m=e.y+e.height/2,f=t/2-u*h,g=n/2-m*h,x=em(e,f,g,h,t,n),w={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:f-w.left+w.right,y:g-w.top+w.bottom,zoom:h}},gr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Os(e){return e!=null&&e!=="parent"}function Sn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function wd(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function kd(e,t={width:0,height:0},n,s,o){const a={...e},i=s.get(n);if(i){const l=i.origin||o;a.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function bl(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tm(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function nm(e){return{...fd,...e||{}}}function ar(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=sn(e),l=Nr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?jr(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Ya=e=>({width:e.offsetWidth,height:e.offsetHeight}),vd=e=>e?.getRootNode?.()||window?.document,sm=["INPUT","SELECT","TEXTAREA"];function jd(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sm.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Nd=e=>"clientX"in e,sn=(e,t)=>{const n=Nd(e),s=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:s-(t?.left??0),y:o-(t?.top??0)}},yl=(e,t,n,s,o)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...Ya(i)}})};function Sd({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:i,targetControlY:l}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+a*.375+l*.375+s*.125,h=Math.abs(c-e),u=Math.abs(d-t);return[c,d,h,u]}function Ur(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wl({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case ve.Left:return[t-Ur(t-s,a),n];case ve.Right:return[t+Ur(s-t,a),n];case ve.Top:return[t,n-Ur(n-o,a)];case ve.Bottom:return[t,n+Ur(o-n,a)]}}function Cd({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:o,targetPosition:a=ve.Top,curvature:i=.25}){const[l,c]=wl({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,h]=wl({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,m,f,g]=Sd({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${t} C${l},${c} ${d},${h} ${s},${o}`,u,m,f,g]}function Ed({sourceX:e,sourceY:t,targetX:n,targetY:s}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,i=Math.abs(s-t)/2,l=s<t?s+i:s-i;return[a,l,o,i]}function rm({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:o=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const i=o&&n?s+1e3:s,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+l}function om({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=To(po(e),po(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:s/o[2]};return pr(i,Mo(a))>0}const am=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,im=(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)),lm=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||am;let o;return pd(e)?o={...e}:o={...e,id:s(e)},im(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Id({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=Ed({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const kl={[ve.Left]:{x:-1,y:0},[ve.Right]:{x:1,y:0},[ve.Top]:{x:0,y:-1},[ve.Bottom]:{x:0,y:1}},cm=({source:e,sourcePosition:t=ve.Bottom,target:n})=>t===ve.Left||t===ve.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},vl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dm({source:e,sourcePosition:t=ve.Bottom,target:n,targetPosition:s=ve.Top,center:o,offset:a,stepPosition:i}){const l=kl[t],c=kl[s],d={x:e.x+l.x*a,y:e.y+l.y*a},h={x:n.x+c.x*a,y:n.y+c.y*a},u=cm({source:d,sourcePosition:t,target:h}),m=u.x!==0?"x":"y",f=u[m];let g=[],x,w;const v={x:0,y:0},y={x:0,y:0},[,,b,k]=Ed({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[m]*c[m]===-1){m==="x"?(x=o.x??d.x+(h.x-d.x)*i,w=o.y??(d.y+h.y)/2):(x=o.x??(d.x+h.x)/2,w=o.y??d.y+(h.y-d.y)*i);const j=[{x,y:d.y},{x,y:h.y}],A=[{x:d.x,y:w},{x:h.x,y:w}];l[m]===f?g=m==="x"?j:A:g=m==="x"?A:j}else{const j=[{x:d.x,y:h.y}],A=[{x:h.x,y:d.y}];if(m==="x"?g=l.x===f?A:j:g=l.y===f?j:A,t===s){const D=Math.abs(e[m]-n[m]);if(D<=a){const z=Math.min(a-1,a-D);l[m]===f?v[m]=(d[m]>e[m]?-1:1)*z:y[m]=(h[m]>n[m]?-1:1)*z}}if(t!==s){const D=m==="x"?"y":"x",z=l[m]===c[D],E=d[D]>h[D],B=d[D]<h[D];(l[m]===1&&(!z&&E||z&&B)||l[m]!==1&&(!z&&B||z&&E))&&(g=m==="x"?j:A)}const S={x:d.x+v.x,y:d.y+v.y},T={x:h.x+y.x,y:h.y+y.y},P=Math.max(Math.abs(S.x-g[0].x),Math.abs(T.x-g[0].x)),M=Math.max(Math.abs(S.y-g[0].y),Math.abs(T.y-g[0].y));P>=M?(x=(S.x+T.x)/2,w=g[0].y):(x=g[0].x,w=(S.y+T.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:h.x+y.x,y:h.y+y.y},n],x,w,b,k]}function um(e,t,n,s){const o=Math.min(vl(e,t)/2,vl(t,n)/2,s),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${a},${i+o*c}Q ${a},${i} ${a+o*l},${i}`}function Ea({sourceX:e,sourceY:t,sourcePosition:n=ve.Bottom,targetX:s,targetY:o,targetPosition:a=ve.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[u,m,f,g,x]=dm({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:h});return[u.reduce((v,y,b)=>{let k="";return b>0&&b<u.length-1?k=um(u[b-1],y,u[b+1],i):k=`${b===0?"M":"L"}${y.x} ${y.y}`,v+=k,v},""),m,f,g,x]}function jl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function fm(e){const{sourceNode:t,targetNode:n}=e;if(!jl(t)||!jl(n))return null;const s=t.internals.handleBounds||Nl(t.handles),o=n.internals.handleBounds||Nl(n.handles),a=Sl(s?.source??[],e.sourceHandle),i=Sl(e.connectionMode===_s.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",un.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||ve.Bottom,c=i?.position||ve.Top,d=ss(t,a,l),h=ss(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function Nl(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function ss(e,t,n=ve.Left,s=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??Sn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case ve.Top:return{x:o+i/2,y:a};case ve.Right:return{x:o+i,y:a+l/2};case ve.Bottom:return{x:o+i/2,y:a+l};case ve.Left:return{x:o,y:a+l/2}}}function Sl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ia(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function hm(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:o}){const a=new Set;return e.reduce((i,l)=>([l.markerStart||s,l.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=Ia(c,t);a.has(d)||(i.push({id:d,color:c.color||n,...c}),a.add(d))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const Td=1e3,mm=10,Ga={nodeOrigin:[0,0],nodeExtent:hr,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},pm={...Ga,checkEquality:!0};function Xa(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function gm(e,t,n){const s=Xa(Ga,n);for(const o of e.values())if(o.parentId)Qa(o,e,t,s);else{const a=kr(o,s.nodeOrigin),i=Os(o.extent)?o.extent:s.nodeExtent,l=ns(a,i,Sn(o));o.internals.positionAbsolute=l}}function xm(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],s=[];for(const o of e.handles){const a={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(a):o.type==="target"&&s.push(a)}return{source:n,target:s}}function Za(e){return e==="manual"}function Ta(e,t,n,s={}){const o=Xa(pm,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Za(o.zIndexMode)?Td:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let h=i.get(d.id);if(o.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{const u=kr(d,o.nodeOrigin),m=Os(d.extent)?d.extent:o.nodeExtent,f=ns(u,m,Sn(d));h={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:f,handleBounds:xm(d,h),z:Md(d,l,o.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Qa(h,t,n,s,a)}return c}function bm(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Qa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Xa(Ga,s),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bm(e,n),o&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++o.i,h.internals.z=h.internals.z+o.i*mm),o&&h.internals.rootParentIndex!==void 0&&(o.i=h.internals.rootParentIndex);const u=a&&!Za(c)?Td:0,{x:m,y:f,z:g}=ym(e,h,i,l,u,c),{positionAbsolute:x}=e.internals,w=m!==x.x||f!==x.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:m,y:f}:x,z:g}})}function Md(e,t,n){const s=nn(e.zIndex)?e.zIndex:0;return Za(n)?s:s+(e.selected?t:0)}function ym(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=Sn(e),d=kr(e,n),h=Os(e.extent)?ns(d,e.extent,c):d;let u=ns({x:i+h.x,y:l+h.y},s,c);e.extent==="parent"&&(u=xd(u,c,t));const m=Md(e,o,a),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=m?f+1:m}}function Ja(e,t,n,s=[0,0]){const o=[],a=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=a.get(i.parentId)?.expandedRect??Ds(l),d=yd(c,i.rect);a.set(i.parentId,{expandedRect:d,parent:l})}return a.size>0&&a.forEach(({expandedRect:i,parent:l},c)=>{const d=l.internals.positionAbsolute,h=Sn(l),u=l.origin??s,m=i.x<d.x?Math.round(Math.abs(d.x-i.x)):0,f=i.y<d.y?Math.round(Math.abs(d.y-i.y)):0,g=Math.max(h.width,Math.round(i.width)),x=Math.max(h.height,Math.round(i.height)),w=(g-h.width)*u[0],v=(x-h.height)*u[1];(m>0||f>0||w||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-m+w,y:l.position.y-f+v}}),n.get(c)?.forEach(y=>{e.some(b=>b.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+m,y:y.position.y+f}})})),(h.width<i.width||h.height<i.height||m||f)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(m?u[0]*m-w:0),height:x+(f?u[1]*f-v:0)}})}),o}function wm(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(h.transform),m=[];for(const f of e.values()){const g=t.get(f.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Ya(f.nodeElement),w=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!g.internals.handleBounds||f.force))){const y=f.nodeElement.getBoundingClientRect(),b=Os(g.extent)?g.extent:a;let{positionAbsolute:k}=g.internals;g.parentId&&g.extent==="parent"?k=xd(k,x,t.get(g.parentId)):b&&(k=ns(k,b,x));const C={...g,measured:x,internals:{...g.internals,positionAbsolute:k,handleBounds:{source:yl("source",f.nodeElement,y,u,g.id),target:yl("target",f.nodeElement,y,u,g.id)}}};t.set(g.id,C),g.parentId&&Qa(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,w&&(d.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&m.push({id:g.id,parentId:g.parentId,rect:Ds(C,o)}))}}if(m.length>0){const f=Ja(m,t,n,o);d.push(...f)}return{changes:d,updatedInternals:c}}async function km({delta:e,panZoom:t,transform:n,translateExtent:s,width:o,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,a]],s),l=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(l)}function Cl(e,t,n,s,o,a){let i=o;const l=s.get(i)||new Map;s.set(i,l.set(n,t)),i=`${o}-${e}`;const c=s.get(i)||new Map;if(s.set(i,c.set(n,t)),a){i=`${o}-${e}-${a}`;const d=s.get(i)||new Map;s.set(i,d.set(n,t))}}function Ad(e,t,n){e.clear(),t.clear();for(const s of n){const{source:o,target:a,sourceHandle:i=null,targetHandle:l=null}=s,c={edgeId:s.id,source:o,target:a,sourceHandle:i,targetHandle:l},d=`${o}-${i}--${a}-${l}`,h=`${a}-${l}--${o}-${i}`;Cl("source",c,h,e,o,i),Cl("target",c,d,e,a,l),t.set(s.id,s)}}function _d(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_d(n,t):!1}function El(e,t,n){let s=e;do{if(s?.matches?.(t))return!0;if(s===n)return!1;s=s?.parentElement}while(s);return!1}function vm(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!_d(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(a);l&&o.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function aa({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){const o=[];for(const[i,l]of t){const c=n.get(i)?.internals.userNode;c&&o.push({...c,position:l.position,dragging:s})}if(!e)return[o[0],o];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:s}:o[0],o]}function jm({dragItems:e,snapGrid:t,x:n,y:s}){const o=e.values().next().value;if(!o)return null;const a={x:n-o.distance.x,y:s-o.distance.y},i=jr(a,t);return{x:i.x-a.x,y:i.y-a.y}}function Nm({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:o}){let a={x:null,y:null},i=0,l=new Map,c=!1,d={x:0,y:0},h=null,u=!1,m=null,f=!1,g=!1,x=null;function w({noDragClassName:y,handleSelector:b,domNode:k,isSelectable:C,nodeId:j,nodeClickDistance:A=0}){m=Ht(k);function S({x:D,y:z}){const{nodeLookup:E,nodeExtent:B,snapGrid:L,snapToGrid:$,nodeOrigin:R,onNodeDrag:q,onSelectionDrag:H,onError:K,updateNodePositions:O}=t();a={x:D,y:z};let Y=!1;const _=l.size>1,I=_&&B?Ca(vr(l)):null,V=_&&$?jm({dragItems:l,snapGrid:L,x:D,y:z}):null;for(const[W,F]of l){if(!E.has(W))continue;let Z={x:D-F.distance.x,y:z-F.distance.y};$&&(Z=V?{x:Math.round(Z.x+V.x),y:Math.round(Z.y+V.y)}:jr(Z,L));let te=null;if(_&&B&&!F.extent&&I){const{positionAbsolute:be}=F.internals,Ne=be.x-I.x+B[0][0],Ie=be.x+F.measured.width-I.x2+B[1][0],Ce=be.y-I.y+B[0][1],Fe=be.y+F.measured.height-I.y2+B[1][1];te=[[Ne,Ce],[Ie,Fe]]}const{position:ce,positionAbsolute:oe}=gd({nodeId:W,nextPosition:Z,nodeLookup:E,nodeExtent:te||B,nodeOrigin:R,onError:K});Y=Y||F.position.x!==ce.x||F.position.y!==ce.y,F.position=ce,F.internals.positionAbsolute=oe}if(g=g||Y,!!Y&&(O(l,!0),x&&(s||q||!j&&H))){const[W,F]=aa({nodeId:j,dragItems:l,nodeLookup:E});s?.(x,l,W,F),q?.(x,W,F),j||H?.(x,F)}}async function T(){if(!h)return;const{transform:D,panBy:z,autoPanSpeed:E,autoPanOnNodeDrag:B}=t();if(!B){c=!1,cancelAnimationFrame(i);return}const[L,$]=bd(d,h,E);(L!==0||$!==0)&&(a.x=(a.x??0)-L/D[2],a.y=(a.y??0)-$/D[2],await z({x:L,y:$})&&S(a)),i=requestAnimationFrame(T)}function P(D){const{nodeLookup:z,multiSelectionActive:E,nodesDraggable:B,transform:L,snapGrid:$,snapToGrid:R,selectNodesOnDrag:q,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:O}=t();u=!0,(!q||!C)&&!E&&j&&(z.get(j)?.selected||O()),C&&q&&j&&e?.(j);const Y=ar(D.sourceEvent,{transform:L,snapGrid:$,snapToGrid:R,containerBounds:h});if(a=Y,l=vm(z,B,Y,j),l.size>0&&(n||H||!j&&K)){const[_,I]=aa({nodeId:j,dragItems:l,nodeLookup:z});n?.(D.sourceEvent,l,_,I),H?.(D.sourceEvent,_,I),j||K?.(D.sourceEvent,I)}}const M=sd().clickDistance(A).on("start",D=>{const{domNode:z,nodeDragThreshold:E,transform:B,snapGrid:L,snapToGrid:$}=t();h=z?.getBoundingClientRect()||null,f=!1,g=!1,x=D.sourceEvent,E===0&&P(D),a=ar(D.sourceEvent,{transform:B,snapGrid:L,snapToGrid:$,containerBounds:h}),d=sn(D.sourceEvent,h)}).on("drag",D=>{const{autoPanOnNodeDrag:z,transform:E,snapGrid:B,snapToGrid:L,nodeDragThreshold:$,nodeLookup:R}=t(),q=ar(D.sourceEvent,{transform:E,snapGrid:B,snapToGrid:L,containerBounds:h});if(x=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!R.has(j))&&(f=!0),!f){if(!c&&z&&u&&(c=!0,T()),!u){const H=sn(D.sourceEvent,h),K=H.x-d.x,O=H.y-d.y;Math.sqrt(K*K+O*O)>$&&P(D)}(a.x!==q.xSnapped||a.y!==q.ySnapped)&&l&&u&&(d=sn(D.sourceEvent,h),S(q))}}).on("end",D=>{if(!(!u||f)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:z,updateNodePositions:E,onNodeDragStop:B,onSelectionDragStop:L}=t();if(g&&(E(l,!1),g=!1),o||B||!j&&L){const[$,R]=aa({nodeId:j,dragItems:l,nodeLookup:z,dragging:!1});o?.(D.sourceEvent,l,$,R),B?.(D.sourceEvent,$,R),j||L?.(D.sourceEvent,R)}}}).filter(D=>{const z=D.target;return!D.button&&(!y||!El(z,`.${y}`,k))&&(!b||El(z,b,k))});m.call(M)}function v(){m?.on(".drag",null)}return{update:w,destroy:v}}function Sm(e,t,n){const s=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())pr(o,Ds(a))>0&&s.push(a);return s}const Cm=250;function Em(e,t,n,s){let o=[],a=1/0;const i=Sm(e,n,t+Cm);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(s.nodeId===d.nodeId&&s.type===d.type&&s.id===d.id)continue;const{x:h,y:u}=ss(l,d,d.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(u-e.y,2));m>t||(m<a?(o=[{...d,x:h,y:u}],a=m):m===a&&o.push({...d,x:h,y:u}))}}if(!o.length)return null;if(o.length>1){const l=s.type==="source"?"target":"source";return o.find(c=>c.type===l)??o[0]}return o[0]}function Ld(e,t,n,s,o,a=!1){const i=s.get(e);if(!i)return null;const l=o==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?l?.find(d=>d.id===n):l?.[0])??null;return c&&a?{...c,...ss(i,c,c.position,!0)}:c}function Rd(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Im(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Dd=()=>!0;function Tm(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:u,panBy:m,cancelConnection:f,onConnectStart:g,onConnect:x,onConnectEnd:w,isValidConnection:v=Dd,onReconnectEnd:y,updateConnection:b,getTransform:k,getFromHandle:C,autoPanSpeed:j,dragThreshold:A=1,handleDomNode:S}){const T=vd(e.target);let P=0,M;const{x:D,y:z}=sn(e),E=Rd(a,S),B=l?.getBoundingClientRect();let L=!1;if(!B||!E)return;const $=Ld(o,E,s,c,t);if(!$)return;let R=sn(e,B),q=!1,H=null,K=!1,O=null;function Y(){if(!h||!B)return;const[ce,oe]=bd(R,B,j);m({x:ce,y:oe}),P=requestAnimationFrame(Y)}const _={...$,nodeId:o,type:E,position:$.position},I=c.get(o);let W={inProgress:!0,isValid:null,from:ss(I,_,ve.Left,!0),fromHandle:_,fromPosition:_.position,fromNode:I,to:R,toHandle:null,toPosition:pl[_.position],toNode:null,pointer:R};function F(){L=!0,b(W),g?.(e,{nodeId:o,handleId:s,handleType:E})}A===0&&F();function Z(ce){if(!L){const{x:Fe,y:Be}=sn(ce),Re=Fe-D,$e=Be-z;if(!(Re*Re+$e*$e>A*A))return;F()}if(!C()||!_){te(ce);return}const oe=k();R=sn(ce,B),M=Em(Nr(R,oe,!1,[1,1]),n,c,_),q||(Y(),q=!0);const be=Od(ce,{handle:M,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:T,lib:d,flowId:u,nodeLookup:c});O=be.handleDomNode,H=be.connection,K=Im(!!M,be.isValid);const Ne=c.get(o),Ie=Ne?ss(Ne,_,ve.Left,!0):W.from,Ce={...W,from:Ie,isValid:K,to:be.toHandle&&K?go({x:be.toHandle.x,y:be.toHandle.y},oe):R,toHandle:be.toHandle,toPosition:K&&be.toHandle?be.toHandle.position:pl[_.position],toNode:be.toHandle?c.get(be.toHandle.nodeId):null,pointer:R};b(Ce),W=Ce}function te(ce){if(!("touches"in ce&&ce.touches.length>0)){if(L){(M||O)&&H&&K&&x?.(H);const{inProgress:oe,...be}=W,Ne={...be,toPosition:W.toHandle?W.toPosition:null};w?.(ce,Ne),a&&y?.(ce,Ne)}f(),cancelAnimationFrame(P),q=!1,K=!1,H=null,O=null,T.removeEventListener("mousemove",Z),T.removeEventListener("mouseup",te),T.removeEventListener("touchmove",Z),T.removeEventListener("touchend",te)}}T.addEventListener("mousemove",Z),T.addEventListener("mouseup",te),T.addEventListener("touchmove",Z),T.addEventListener("touchend",te)}function Od(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=Dd,nodeLookup:h}){const u=a==="target",m=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:g}=sn(e),x=i.elementFromPoint(f,g),w=x?.classList.contains(`${l}-flow__handle`)?x:m,v={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=Rd(void 0,w),b=w.getAttribute("data-nodeid"),k=w.getAttribute("data-handleid"),C=w.classList.contains("connectable"),j=w.classList.contains("connectableend");if(!b||!y)return v;const A={source:u?b:s,sourceHandle:u?k:o,target:u?s:b,targetHandle:u?o:k};v.connection=A;const T=C&&j&&(n===_s.Strict?u&&y==="source"||!u&&y==="target":b!==s||k!==o);v.isValid=T&&d(A),v.toHandle=Ld(b,y,k,h,n,!0)}return v}const Ma={onPointerDown:Tm,isValid:Od};function Mm({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=Ht(e);function a({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:u=!0,zoomable:m=!0,inversePan:f=!1}){const g=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const k=n(),C=b.sourceEvent.ctrlKey&&gr()?10:1,j=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*h,A=k[2]*Math.pow(2,j*C);t.scaleTo(A)};let x=[0,0];const w=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(x=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},v=b=>{const k=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const C=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],j=[C[0]-x[0],C[1]-x[1]];x=C;const A=s()*Math.max(k[2],Math.log(k[2]))*(f?-1:1),S={x:k[0]-j[0]*A,y:k[1]-j[1]*A},T=[[0,0],[c,d]];t.setViewportConstrained({x:S.x,y:S.y,zoom:k[2]},T,l)},y=rd().on("start",w).on("zoom",u?v:null).on("zoom.wheel",m?g:null);o.call(y,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:tn}}const Ao=e=>({x:e.x,y:e.y,zoom:e.k}),ia=({x:e,y:t,zoom:n})=>Va.translate(e,t).scale(n),Ns=(e,t)=>e.target.closest(`.${t}`),$d=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Am=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,la=(e,t=0,n=Am,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},Pd=e=>{const t=e.ctrlKey&&gr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _m({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(Ns(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(h.ctrlKey&&i){const w=tn(h),v=Pd(h),y=u*Math.pow(2,v);s.scaleTo(n,y,w,h);return}const m=h.deltaMode===1?20:1;let f=o===ts.Vertical?0:h.deltaX*m,g=o===ts.Horizontal?0:h.deltaY*m;!gr()&&h.shiftKey&&o!==ts.Vertical&&(f=h.deltaY*m,g=0),s.translateBy(n,-(f/u)*a,-(g/u)*a,{internal:!0});const x=Ao(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,x),e.panScrollTimeout=setTimeout(()=>{d?.(h,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,x))}}function Lm({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=Ns(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Rm({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=Ao(s.transform);e.mouseButton=s.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,s.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(s.sourceEvent,o)}}function Dm({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&$d(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,Ao(a.transform))}}function Om({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&$d(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=Ao(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function $m({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return u=>{const m=e||t,f=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Ns(u,`${d}-flow__node`)||Ns(u,`${d}-flow__edge`)))return!0;if(!s&&!m&&!o&&!a&&!n||i||h&&!g||Ns(u,l)&&g||Ns(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!m&&!o&&!f&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Pm({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:o,onPanZoom:a,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),u=rd().scaleExtent([t,n]).translateExtent(s),m=Ht(e).call(u);y({x:o.x,y:o.y,zoom:Rs(o.zoom,t,n)},[[0,0],[h.width,h.height]],s);const f=m.on("wheel.zoom"),g=m.on("dblclick.zoom");u.wheelDelta(Pd);function x(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).transform(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function w({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:z,userSelectionActive:E,panOnScroll:B,panOnDrag:L,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:q,zoomOnPinch:H,zoomOnScroll:K,zoomOnDoubleClick:O,zoomActivationKeyPressed:Y,lib:_,onTransformChange:I,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:F}){E&&!d.isZoomingOrPanning&&v();const Z=B&&!Y&&!E;u.clickDistance(F?1/0:!nn(W)||W<0?0:W);const te=Z?_m({zoomPanValues:d,noWheelClassName:M,d3Selection:m,d3Zoom:u,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):Lm({noWheelClassName:M,preventScrolling:q,d3ZoomHandler:f});if(m.on("wheel.zoom",te,{passive:!1}),!E){const oe=Rm({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",oe);const be=Dm({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!z,onPanZoom:a,onTransformChange:I});u.on("zoom",be);const Ne=Om({zoomPanValues:d,panOnDrag:L,panOnScroll:B,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});u.on("end",Ne)}const ce=$m({zoomActivationKeyPressed:Y,panOnDrag:L,zoomOnScroll:K,panOnScroll:B,zoomOnDoubleClick:O,zoomOnPinch:H,userSelectionActive:E,noPanClassName:D,noWheelClassName:M,lib:_,connectionInProgress:V});u.filter(ce),O?m.on("dblclick.zoom",g):m.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function y(M,D,z){const E=ia(M),B=u?.constrain()(E,D,z);return B&&await x(B),new Promise(L=>L(B))}async function b(M,D){const z=ia(M);return await x(z,D),new Promise(E=>E(z))}function k(M){if(m){const D=ia(M),z=m.property("__zoom");(z.k!==M.zoom||z.x!==M.x||z.y!==M.y)&&u?.transform(m,D,null,{sync:!0})}}function C(){const M=m?mh(m.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function j(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).scaleTo(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function A(M,D){return m?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?sa:ao).scaleBy(la(m,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function S(M){u?.scaleExtent(M)}function T(M){u?.translateExtent(M)}function P(M){const D=!nn(M)||M<0?0:M;u?.clickDistance(D)}return{update:w,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:C,scaleTo:j,scaleBy:A,setScaleExtent:S,setTranslateExtent:T,syncViewport:k,setClickDistance:P}}var $s;(function(e){e.Line="line",e.Handle="handle"})($s||($s={}));function Bm({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:o,affectsY:a}){const i=e-t,l=n-s,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&o&&(c[0]=c[0]*-1),l&&a&&(c[1]=c[1]*-1),c}function Il(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:o}}function Mn(e,t){return Math.max(0,t-e)}function An(e,t){return Math.max(0,e-t)}function Yr(e,t,n){return Math.max(0,t-e,e-n)}function Tl(e,t){return e?!t:t}function qm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:h,isVertical:u}=t,m=h&&u,{xSnapped:f,ySnapped:g}=n,{minWidth:x,maxWidth:w,minHeight:v,maxHeight:y}=s,{x:b,y:k,width:C,height:j,aspectRatio:A}=e;let S=Math.floor(h?f-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0);const P=C+(c?-S:S),M=j+(d?-T:T),D=-a[0]*C,z=-a[1]*j;let E=Yr(P,x,w),B=Yr(M,v,y);if(i){let R=0,q=0;c&&S<0?R=Mn(b+S+D,i[0][0]):!c&&S>0&&(R=An(b+P+D,i[1][0])),d&&T<0?q=Mn(k+T+z,i[0][1]):!d&&T>0&&(q=An(k+M+z,i[1][1])),E=Math.max(E,R),B=Math.max(B,q)}if(l){let R=0,q=0;c&&S>0?R=An(b+S,l[0][0]):!c&&S<0&&(R=Mn(b+P,l[1][0])),d&&T>0?q=An(k+T,l[0][1]):!d&&T<0&&(q=Mn(k+M,l[1][1])),E=Math.max(E,R),B=Math.max(B,q)}if(o){if(h){const R=Yr(P/A,v,y)*A;if(E=Math.max(E,R),i){let q=0;!c&&!d||c&&!d&&m?q=An(k+z+P/A,i[1][1])*A:q=Mn(k+z+(c?S:-S)/A,i[0][1])*A,E=Math.max(E,q)}if(l){let q=0;!c&&!d||c&&!d&&m?q=Mn(k+P/A,l[1][1])*A:q=An(k+(c?S:-S)/A,l[0][1])*A,E=Math.max(E,q)}}if(u){const R=Yr(M*A,x,w)/A;if(B=Math.max(B,R),i){let q=0;!c&&!d||d&&!c&&m?q=An(b+M*A+D,i[1][0])/A:q=Mn(b+(d?T:-T)*A+D,i[0][0])/A,B=Math.max(B,q)}if(l){let q=0;!c&&!d||d&&!c&&m?q=Mn(b+M*A,l[1][0])/A:q=An(b+(d?T:-T)*A,l[0][0])/A,B=Math.max(B,q)}}}T=T+(T<0?B:-B),S=S+(S<0?E:-E),o&&(m?P>M*A?T=(Tl(c,d)?-S:S)/A:S=(Tl(c,d)?-T:T)*A:h?(T=S/A,d=c):(S=T*A,c=d));const L=c?b+S:b,$=d?k+T:k;return{width:C+(c?-S:S),height:j+(d?-T:T),x:a[0]*S*(c?-1:1)+L,y:a[1]*T*(d?-1:1)+$}}const Bd={width:0,height:0,x:0,y:0},zm={...Bd,pointerX:0,pointerY:0,aspectRatio:1};function Fm(e){return[[0,0],[e.measured.width,e.measured.height]]}function Hm(e,t,n){const s=t.position.x+e.position.x,o=t.position.y+e.position.y,a=e.measured.width??0,i=e.measured.height??0,l=n[0]*a,c=n[1]*i;return[[s-l,o-c],[s+a-l,o+i-c]]}function Vm({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=Ht(e);let i={controlDirection:Il("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:h,keepAspectRatio:u,resizeDirection:m,onResizeStart:f,onResize:g,onResizeEnd:x,shouldResize:w}){let v={...Bd},y={...zm};i={boundaries:h,resizeDirection:m,keepAspectRatio:u,controlDirection:Il(d)};let b,k=null,C=[],j,A,S,T=!1;const P=sd().on("start",M=>{const{nodeLookup:D,transform:z,snapGrid:E,snapToGrid:B,nodeOrigin:L,paneDomNode:$}=n();if(b=D.get(t),!b)return;k=$?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:q}=ar(M.sourceEvent,{transform:z,snapGrid:E,snapToGrid:B,containerBounds:k});v={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},y={...v,pointerX:R,pointerY:q,aspectRatio:v.width/v.height},j=void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(j=D.get(b.parentId),A=j&&b.extent==="parent"?Fm(j):void 0),C=[],S=void 0;for(const[H,K]of D)if(K.parentId===t&&(C.push({id:H,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const O=Hm(K,b,K.origin??L);S?S=[[Math.min(O[0][0],S[0][0]),Math.min(O[0][1],S[0][1])],[Math.max(O[1][0],S[1][0]),Math.max(O[1][1],S[1][1])]]:S=O}f?.(M,{...v})}).on("drag",M=>{const{transform:D,snapGrid:z,snapToGrid:E,nodeOrigin:B}=n(),L=ar(M.sourceEvent,{transform:D,snapGrid:z,snapToGrid:E,containerBounds:k}),$=[];if(!b)return;const{x:R,y:q,width:H,height:K}=v,O={},Y=b.origin??B,{width:_,height:I,x:V,y:W}=qm(y,i.controlDirection,L,i.boundaries,i.keepAspectRatio,Y,A,S),F=_!==H,Z=I!==K,te=V!==R&&F,ce=W!==q&&Z;if(!te&&!ce&&!F&&!Z)return;if((te||ce||Y[0]===1||Y[1]===1)&&(O.x=te?V:v.x,O.y=ce?W:v.y,v.x=O.x,v.y=O.y,C.length>0)){const Ie=V-R,Ce=W-q;for(const Fe of C)Fe.position={x:Fe.position.x-Ie+Y[0]*(_-H),y:Fe.position.y-Ce+Y[1]*(I-K)},$.push(Fe)}if((F||Z)&&(O.width=F&&(!i.resizeDirection||i.resizeDirection==="horizontal")?_:v.width,O.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?I:v.height,v.width=O.width,v.height=O.height),j&&b.expandParent){const Ie=Y[0]*(O.width??0);O.x&&O.x<Ie&&(v.x=Ie,y.x=y.x-(O.x-Ie));const Ce=Y[1]*(O.height??0);O.y&&O.y<Ce&&(v.y=Ce,y.y=y.y-(O.y-Ce))}const oe=Bm({width:v.width,prevWidth:H,height:v.height,prevHeight:K,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),be={...v,direction:oe};w?.(M,be)!==!1&&(T=!0,g?.(M,be),s(O,$))}).on("end",M=>{T&&(x?.(M,{...v}),o?.({...v}),T=!1)});a.call(P)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var ca={exports:{}},da={};var Ml;function Wm(){if(Ml)return da;Ml=1;var e=zf(),t=Ff();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return da.useSyncExternalStoreWithSelector=function(d,h,u,m,f){var g=a(null);if(g.current===null){var x={hasValue:!1,value:null};g.current=x}else x=g.current;g=l(function(){function v(j){if(!y){if(y=!0,b=j,j=m(j),f!==void 0&&x.hasValue){var A=x.value;if(f(A,j))return k=A}return k=j}if(A=k,s(b,j))return A;var S=m(j);return f!==void 0&&f(A,S)?(b=j,A):(b=j,k=S)}var y=!1,b,k,C=u===void 0?null:u;return[function(){return v(h())},C===null?void 0:function(){return v(C())}]},[h,u,m,f]);var w=o(d,g[0],g[1]);return i(function(){x.hasValue=!0,x.value=w},[w]),c(w),w},da}var Al;function Km(){return Al||(Al=1,ca.exports=Wm()),ca.exports}var Um=Km();const Ym=Hf(Um),Gm={},_l=e=>{let t;const n=new Set,s=(h,u)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const f=t;t=u??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(g=>g(t,f))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(Gm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,o,c);return c},Xm=e=>e?_l(e):_l,{useDebugValue:Zm}=Vf,{useSyncExternalStoreWithSelector:Qm}=Ym,Jm=e=>e;function qd(e,t=Jm,n){const s=Qm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zm(s),s}const Ll=(e,t)=>{const n=Xm(e),s=(o,a=t)=>qd(n,o,a);return Object.assign(s,n),s},ep=(e,t)=>e?Ll(e,t):Ll;function ct(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e)if(!Object.is(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const _o=p.createContext(null),tp=_o.Provider,zd=un.error001();function Ke(e,t){const n=p.useContext(_o);if(n===null)throw new Error(zd);return qd(n,e,t)}function it(){const e=p.useContext(_o);if(e===null)throw new Error(zd);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Rl={display:"none"},np={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fd="react-flow__node-desc",Hd="react-flow__edge-desc",sp="react-flow__aria-live",rp=e=>e.ariaLiveMessage,op=e=>e.ariaLabelConfig;function ap({rfId:e}){const t=Ke(rp);return r.jsx("div",{id:`${sp}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:np,children:t})}function ip({rfId:e,disableKeyboardA11y:t}){const n=Ke(op);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${Fd}-${e}`,style:Rl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${Hd}-${e}`,style:Rl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(ap,{rfId:e})]})}const Lo=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:jt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});Lo.displayName="Panel";function lp({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(Lo,{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:r.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const cp=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},Gr=e=>e.id;function dp(e,t){return ct(e.selectedNodes.map(Gr),t.selectedNodes.map(Gr))&&ct(e.selectedEdges.map(Gr),t.selectedEdges.map(Gr))}function up({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:s}=Ke(cp,dp);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const fp=e=>!!e.onSelectionChangeHandlers;function hp({onSelectionChange:e}){const t=Ke(fp);return e||t?r.jsx(up,{onSelectionChange:e}):null}const Vd=[0,0],mp={x:0,y:0,zoom:1},pp=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Dl=[...pp,"rfId"],gp=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Ol={translateExtent:hr,nodeOrigin:Vd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function xp(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Ke(gp,ct),d=it();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=Ol,l()}),[]);const h=p.useRef(Ol);return p.useEffect(()=>{for(const u of Dl){const m=e[u],f=h.current[u];m!==f&&(typeof e[u]>"u"||(u==="nodes"?t(m):u==="edges"?n(m):u==="minZoom"?s(m):u==="maxZoom"?o(m):u==="translateExtent"?a(m):u==="nodeExtent"?i(m):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:nm(m)}):u==="fitView"?d.setState({fitViewQueued:m}):u==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[u]:m})))}h.current=e},Dl.map(u=>e[u])),null}function $l(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bp(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=$l(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:$l()?.matches?"dark":"light"}const Pl=typeof document<"u"?document:null;function xr(e=null,t={target:Pl,actInsideInputWithModifier:!0}){const[n,s]=p.useState(!1),o=p.useRef(!1),a=p.useRef(new Set([])),[i,l]=p.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as ln,X as an,Y as B,$ as q,a0 as Y,a1 as un,a2 as y,a3 as tn,a4 as G,a5 as _,a6 as rn,a7 as o,a8 as on,a9 as sn,aa as fn}from"./mermaid.core-
|
|
1
|
+
import{W as ln,X as an,Y as B,$ as q,a0 as Y,a1 as un,a2 as y,a3 as tn,a4 as G,a5 as _,a6 as rn,a7 as o,a8 as on,a9 as sn,aa as fn}from"./mermaid.core-B17l8z4S.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,$,a){var O=I-l,i=D-h,n=$-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function N(l,h,I,D,v,A,$){var a=l-I,O=h-D,i=($?A:-A)/G(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,j=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*G(on(0,T*T*R-P*P)),W=(P*g-m*S)/R,X=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=W-j,e=X-t,r=w-j,z=p-t;return x*x+e*e>r*r+z*z&&(W=w,X=p),{cx:W,cy:X,x01:-n,y01:-d,x11:W*(v/T-1),y11:X*(v/T-1)}}function hn(){var l=cn,h=yn,I=Y(0),D=null,v=gn,A=dn,$=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,j=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(j>tn-y)a.moveTo(s*B(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*B(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=j,S=j,W=$.apply(this,arguments)/2,X=W>y&&(D?+D.apply(this,arguments):G(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(X>y){var z=sn(X/u*q(W)),H=sn(X/s*q(W));(P-=z*2)>y?(z*=t?1:-1,R+=z,T-=z):(P=0,R=T=(f+c)/2),(S-=H*2)>y?(H*=t?1:-1,m+=H,g-=H):(S=0,m=g=(f+c)/2)}var C=s*B(m),F=s*q(m),J=u*B(T),K=u*q(T);if(w>y){var L=s*B(g),M=s*q(g),Q=u*B(R),U=u*q(R),E;if(j<an)if(E=pn(C,F,Q,U,L,M,J,K)){var V=C-E[0],Z=F-E[1],k=L-E[0],b=M-E[1],nn=1/q(fn((V*k+Z*b)/(G(V*V+Z*Z)*G(k*k+b*b)))/2),en=G(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=N(Q,U,C,F,s,x,t),r=N(L,M,J,K,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(C,F),a.arc(0,0,s,m,g,!t)):a.moveTo(C,F),!(u>y)||!(P>y)?a.lineTo(J,K):p>y?(e=N(J,K,L,M,u,-p,t),r=N(C,F,Q,U,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[B(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Y(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Y(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:Y(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:Y(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Y(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:Y(+n),i):A},i.padAngle=function(n){return arguments.length?($=typeof n=="function"?n:Y(+n),i):$},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|