@skill-map/cli 0.53.2 → 0.53.3

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.
Files changed (27) hide show
  1. package/dist/cli/tutorial/sm-tutorial/SKILL.md +19 -10
  2. package/dist/cli/tutorial/sm-tutorial/references/_core.md +53 -5
  3. package/dist/cli/tutorial/sm-tutorial/references/_manifest.yml +22 -9
  4. package/dist/cli/tutorial/sm-tutorial/references/fixtures.md +10 -13
  5. package/dist/cli/tutorial/sm-tutorial/references/part-authoring.md +2 -2
  6. package/dist/cli/tutorial/sm-tutorial/references/part-cli.md +1 -1
  7. package/dist/cli/tutorial/sm-tutorial/references/part-connect-harness.md +12 -9
  8. package/dist/cli/tutorial/sm-tutorial/references/part-fundamentals.md +16 -22
  9. package/dist/cli/tutorial/sm-tutorial/references/part-live-site.md +111 -112
  10. package/dist/cli/tutorial/sm-tutorial/references/part-maintain.md +2 -2
  11. package/dist/cli/tutorial/sm-tutorial/references/part-mcp.md +4 -4
  12. package/dist/cli/tutorial/sm-tutorial/references/part-plugins.md +1 -1
  13. package/dist/cli/tutorial/sm-tutorial/references/part-project-kickoff.md +11 -13
  14. package/dist/cli/tutorial/sm-tutorial/references/part-run-harness.md +155 -0
  15. package/dist/cli/tutorial/sm-tutorial/references/part-settings.md +2 -2
  16. package/dist/cli.js +3 -3
  17. package/dist/index.js +3 -3
  18. package/dist/kernel/index.js +3 -3
  19. package/dist/ui/{chunk-UHNBYD6J.js → chunk-22XUPND3.js} +3 -3
  20. package/dist/ui/{chunk-OFDQMBSJ.js → chunk-4CXAL43H.js} +1 -1
  21. package/dist/ui/{chunk-IUZM6XLN.js → chunk-HWQTV6ZL.js} +1 -1
  22. package/dist/ui/{chunk-UV5Q423S.js → chunk-ISIHN6HU.js} +2 -2
  23. package/dist/ui/{chunk-EQ72PEHT.js → chunk-NBXEOYS4.js} +1 -1
  24. package/dist/ui/index.html +2 -2
  25. package/dist/ui/{main-TXPLL7VU.js → main-Z4RJNI4X.js} +3 -3
  26. package/dist/ui/{styles-Q4NCOJQY.css → styles-L6FZYH7X.css} +1 -1
  27. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{a as Xn,b as Zn,d as sb,e as lb,f as cb,g as hb,h as fb,i as bo}from"./chunk-GEI6INVH.js";import{A as kb,B as Ib,C as Eb,D as Jn,E as Mb,G as Db,H as Pb,I as Nf,J as Af,K as Rb,a as is,b as po,c as Y0,d as X0,e as ho,f as Z0,g as vr,h as Rf,i as Q0,j as on,k as fo,l as cs,m as mb,n as ds,o as _b,p as gb,q as bb,r as vb,s as yb,t as Cb,u as us,w as xb,x as wb,y as Tb,z as Sb}from"./chunk-IUZM6XLN.js";import{f as Ja,i as es}from"./chunk-UBQUCSQ4.js";import{a as Qn,b as db,c as go,g as ls,h as Vt}from"./chunk-OFDQMBSJ.js";import"./chunk-P2DAPRK7.js";import{a as q0,b as G0,c as j0,d as U0,e as eb,f as tb,g as os,h as as,i as ss,j as nb,k as ib,l as _o,n as ob,o as Ff,p as rb,q as ab,r as ub,s as pb}from"./chunk-JXRIGHET.js";import{A as uo,B as ns,C as Te,D as $0,E as W0,F as br,G as Ee,H as K0,I as Sn,J as Ve,K as ze,L as J0,M as mo,N as we,O as Of,P as rs,Q as _n,R as kn,a as pt,c as Df,d as B0,e as Pf,f as V0,g as lo,i as bt,j as Le,k as nn,l as St,o as Yn,p as H0,q as co,r as Lt,s as Bt,t as kt,u as It,v as Bn,w as Ie,x as Tn}from"./chunk-GBKHMJ4B.js";import{f as Wn,g as M0,h as so,i as fn,j as Kn,k as Rt,l as gt,p as $t}from"./chunk-LCOYSPKE.js";import{B as Mf,Ca as z0,D as R0,F as O0,H as F0,J as ts,O as _r,T as N0,V as A0,W as L0,a as mn,b as hr,ba as gr,k as fr,l as If,m as D0,n as P0,p as Mi,t as wn,u as ut,w as Ef,z as mr}from"./chunk-4SG4352Z.js";import{$ as xt,$a as S,$b as I0,Ab as _e,Bb as le,Cb as Ya,Db as Xa,Ea as ki,Eb as $,Ec as j,Fa as lr,Fb as ot,Fc as xe,Ga as Wa,Gb as A,Ha as l,Ib as d,J as Cn,Jb as pn,K as y,Kb as $e,L as mt,Lb as en,Ma as ao,Mb as xn,N as be,Na as x0,Nb as Q,O as oo,Ob as J,P as p,Pa as w0,Pb as Tf,Qa as un,Qb as hn,Ra as Ka,Rb as jt,Sb as yt,T as C0,Tb as Ne,U as Ln,Ub as ue,V as w,Vb as Pt,W as T,Wa as z,Wb as H,X as W,Xa as _t,Xb as b,Y as ja,Ya as je,Yb as x,Z as dt,Za as wt,Zb as Se,_ as Ua,_a as Z,_b as k0,ac as cr,ba as ne,bc as dr,ca as Jt,cc as ur,d as io,dc as Ut,ec as Tt,fc as Ce,g as P,ga as X,gc as ke,hc as At,ia as de,ic as Re,ja as ro,jb as O,jc as $n,ka as G,kb as T0,kc as Ii,la as Qe,lb as S0,lc as Sf,mb as M,mc as Za,n as y0,nb as D,nc as pr,ob as wf,oc as E0,pa as $a,pb as Ue,pc as We,qb as re,rb as ae,rc as tn,sb as m,sc as E,t as Ga,tb as f,tc as Ke,ub as _,uc as B,vb as F,vc as nt,wb as se,wc as Qa,xb as fe,xc as kf,yb as ie,yc as Ei,zb as me}from"./chunk-Q2A6FWC7.js";import{a as ge,b as Dt,c as no,e as v,g as a3}from"./chunk-WCABR6TI.js";var IC=v((Y_e,kC)=>{"use strict";function uz(){this.__data__=[],this.size=0}kC.exports=uz});var Wi=v((X_e,EC)=>{"use strict";function pz(t,o){return t===o||t!==t&&o!==o}EC.exports=pz});var da=v((Z_e,MC)=>{"use strict";var hz=Wi();function fz(t,o){for(var e=t.length;e--;)if(hz(t[e][0],o))return e;return-1}MC.exports=fz});var PC=v((Q_e,DC)=>{"use strict";var mz=da(),_z=Array.prototype,gz=_z.splice;function bz(t){var o=this.__data__,e=mz(o,t);if(e<0)return!1;var n=o.length-1;return e==n?o.pop():gz.call(o,e,1),--this.size,!0}DC.exports=bz});var OC=v((J_e,RC)=>{"use strict";var vz=da();function yz(t){var o=this.__data__,e=vz(o,t);return e<0?void 0:o[e][1]}RC.exports=yz});var NC=v((ege,FC)=>{"use strict";var Cz=da();function xz(t){return Cz(this.__data__,t)>-1}FC.exports=xz});var LC=v((tge,AC)=>{"use strict";var wz=da();function Tz(t,o){var e=this.__data__,n=wz(e,t);return n<0?(++this.size,e.push([t,o])):e[n][1]=o,this}AC.exports=Tz});var ua=v((nge,BC)=>{"use strict";var Sz=IC(),kz=PC(),Iz=OC(),Ez=NC(),Mz=LC();function Go(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}Go.prototype.clear=Sz;Go.prototype.delete=kz;Go.prototype.get=Iz;Go.prototype.has=Ez;Go.prototype.set=Mz;BC.exports=Go});var zC=v((ige,VC)=>{"use strict";var Dz=ua();function Pz(){this.__data__=new Dz,this.size=0}VC.exports=Pz});var qC=v((oge,HC)=>{"use strict";function Rz(t){var o=this.__data__,e=o.delete(t);return this.size=o.size,e}HC.exports=Rz});var jC=v((rge,GC)=>{"use strict";function Oz(t){return this.__data__.get(t)}GC.exports=Oz});var $C=v((age,UC)=>{"use strict";function Fz(t){return this.__data__.has(t)}UC.exports=Fz});var D_=v((sge,WC)=>{"use strict";var Nz=typeof global=="object"&&global&&global.Object===Object&&global;WC.exports=Nz});var sn=v((lge,KC)=>{"use strict";var Az=D_(),Lz=typeof self=="object"&&self&&self.Object===Object&&self,Bz=Az||Lz||Function("return this")();KC.exports=Bz});var Ki=v((cge,YC)=>{"use strict";var Vz=sn(),zz=Vz.Symbol;YC.exports=zz});var JC=v((dge,QC)=>{"use strict";var XC=Ki(),ZC=Object.prototype,Hz=ZC.hasOwnProperty,qz=ZC.toString,pa=XC?XC.toStringTag:void 0;function Gz(t){var o=Hz.call(t,pa),e=t[pa];try{t[pa]=void 0;var n=!0}catch{}var i=qz.call(t);return n&&(o?t[pa]=e:delete t[pa]),i}QC.exports=Gz});var t1=v((uge,e1)=>{"use strict";var jz=Object.prototype,Uz=jz.toString;function $z(t){return Uz.call(t)}e1.exports=$z});var mi=v((pge,o1)=>{"use strict";var n1=Ki(),Wz=JC(),Kz=t1(),Yz="[object Null]",Xz="[object Undefined]",i1=n1?n1.toStringTag:void 0;function Zz(t){return t==null?t===void 0?Xz:Yz:i1&&i1 in Object(t)?Wz(t):Kz(t)}o1.exports=Zz});var Yt=v((hge,r1)=>{"use strict";function Qz(t){var o=typeof t;return t!=null&&(o=="object"||o=="function")}r1.exports=Qz});var jo=v((fge,a1)=>{"use strict";var Jz=mi(),eH=Yt(),tH="[object AsyncFunction]",nH="[object Function]",iH="[object GeneratorFunction]",oH="[object Proxy]";function rH(t){if(!eH(t))return!1;var o=Jz(t);return o==nH||o==iH||o==tH||o==oH}a1.exports=rH});var l1=v((mge,s1)=>{"use strict";var aH=sn(),sH=aH["__core-js_shared__"];s1.exports=sH});var u1=v((_ge,d1)=>{"use strict";var P_=l1(),c1=(function(){var t=/[^.]+$/.exec(P_&&P_.keys&&P_.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function lH(t){return!!c1&&c1 in t}d1.exports=lH});var R_=v((gge,p1)=>{"use strict";var cH=Function.prototype,dH=cH.toString;function uH(t){if(t!=null){try{return dH.call(t)}catch{}try{return t+""}catch{}}return""}p1.exports=uH});var f1=v((bge,h1)=>{"use strict";var pH=jo(),hH=u1(),fH=Yt(),mH=R_(),_H=/[\\^$.*+?()[\]{}|]/g,gH=/^\[object .+?Constructor\]$/,bH=Function.prototype,vH=Object.prototype,yH=bH.toString,CH=vH.hasOwnProperty,xH=RegExp("^"+yH.call(CH).replace(_H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wH(t){if(!fH(t)||hH(t))return!1;var o=pH(t)?xH:gH;return o.test(mH(t))}h1.exports=wH});var _1=v((vge,m1)=>{"use strict";function TH(t,o){return t?.[o]}m1.exports=TH});var _i=v((yge,g1)=>{"use strict";var SH=f1(),kH=_1();function IH(t,o){var e=kH(t,o);return SH(e)?e:void 0}g1.exports=IH});var Mh=v((Cge,b1)=>{"use strict";var EH=_i(),MH=sn(),DH=EH(MH,"Map");b1.exports=DH});var ha=v((xge,v1)=>{"use strict";var PH=_i(),RH=PH(Object,"create");v1.exports=RH});var x1=v((wge,C1)=>{"use strict";var y1=ha();function OH(){this.__data__=y1?y1(null):{},this.size=0}C1.exports=OH});var T1=v((Tge,w1)=>{"use strict";function FH(t){var o=this.has(t)&&delete this.__data__[t];return this.size-=o?1:0,o}w1.exports=FH});var k1=v((Sge,S1)=>{"use strict";var NH=ha(),AH="__lodash_hash_undefined__",LH=Object.prototype,BH=LH.hasOwnProperty;function VH(t){var o=this.__data__;if(NH){var e=o[t];return e===AH?void 0:e}return BH.call(o,t)?o[t]:void 0}S1.exports=VH});var E1=v((kge,I1)=>{"use strict";var zH=ha(),HH=Object.prototype,qH=HH.hasOwnProperty;function GH(t){var o=this.__data__;return zH?o[t]!==void 0:qH.call(o,t)}I1.exports=GH});var D1=v((Ige,M1)=>{"use strict";var jH=ha(),UH="__lodash_hash_undefined__";function $H(t,o){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=jH&&o===void 0?UH:o,this}M1.exports=$H});var R1=v((Ege,P1)=>{"use strict";var WH=x1(),KH=T1(),YH=k1(),XH=E1(),ZH=D1();function Uo(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}Uo.prototype.clear=WH;Uo.prototype.delete=KH;Uo.prototype.get=YH;Uo.prototype.has=XH;Uo.prototype.set=ZH;P1.exports=Uo});var N1=v((Mge,F1)=>{"use strict";var O1=R1(),QH=ua(),JH=Mh();function eq(){this.size=0,this.__data__={hash:new O1,map:new(JH||QH),string:new O1}}F1.exports=eq});var L1=v((Dge,A1)=>{"use strict";function tq(t){var o=typeof t;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?t!=="__proto__":t===null}A1.exports=tq});var fa=v((Pge,B1)=>{"use strict";var nq=L1();function iq(t,o){var e=t.__data__;return nq(o)?e[typeof o=="string"?"string":"hash"]:e.map}B1.exports=iq});var z1=v((Rge,V1)=>{"use strict";var oq=fa();function rq(t){var o=oq(this,t).delete(t);return this.size-=o?1:0,o}V1.exports=rq});var q1=v((Oge,H1)=>{"use strict";var aq=fa();function sq(t){return aq(this,t).get(t)}H1.exports=sq});var j1=v((Fge,G1)=>{"use strict";var lq=fa();function cq(t){return lq(this,t).has(t)}G1.exports=cq});var $1=v((Nge,U1)=>{"use strict";var dq=fa();function uq(t,o){var e=dq(this,t),n=e.size;return e.set(t,o),this.size+=e.size==n?0:1,this}U1.exports=uq});var Dh=v((Age,W1)=>{"use strict";var pq=N1(),hq=z1(),fq=q1(),mq=j1(),_q=$1();function $o(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}$o.prototype.clear=pq;$o.prototype.delete=hq;$o.prototype.get=fq;$o.prototype.has=mq;$o.prototype.set=_q;W1.exports=$o});var Y1=v((Lge,K1)=>{"use strict";var gq=ua(),bq=Mh(),vq=Dh(),yq=200;function Cq(t,o){var e=this.__data__;if(e instanceof gq){var n=e.__data__;if(!bq||n.length<yq-1)return n.push([t,o]),this.size=++e.size,this;e=this.__data__=new vq(n)}return e.set(t,o),this.size=e.size,this}K1.exports=Cq});var ma=v((Bge,X1)=>{"use strict";var xq=ua(),wq=zC(),Tq=qC(),Sq=jC(),kq=$C(),Iq=Y1();function Wo(t){var o=this.__data__=new xq(t);this.size=o.size}Wo.prototype.clear=wq;Wo.prototype.delete=Tq;Wo.prototype.get=Sq;Wo.prototype.has=kq;Wo.prototype.set=Iq;X1.exports=Wo});var Ph=v((Vge,Z1)=>{"use strict";function Eq(t,o){for(var e=-1,n=t==null?0:t.length;++e<n&&o(t[e],e,t)!==!1;);return t}Z1.exports=Eq});var O_=v((zge,Q1)=>{"use strict";var Mq=_i(),Dq=(function(){try{var t=Mq(Object,"defineProperty");return t({},"",{}),t}catch{}})();Q1.exports=Dq});var _a=v((Hge,ex)=>{"use strict";var J1=O_();function Pq(t,o,e){o=="__proto__"&&J1?J1(t,o,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[o]=e}ex.exports=Pq});var ga=v((qge,tx)=>{"use strict";var Rq=_a(),Oq=Wi(),Fq=Object.prototype,Nq=Fq.hasOwnProperty;function Aq(t,o,e){var n=t[o];(!(Nq.call(t,o)&&Oq(n,e))||e===void 0&&!(o in t))&&Rq(t,o,e)}tx.exports=Aq});var Ko=v((Gge,nx)=>{"use strict";var Lq=ga(),Bq=_a();function Vq(t,o,e,n){var i=!e;e||(e={});for(var r=-1,a=o.length;++r<a;){var s=o[r],c=n?n(e[s],t[s],s,e,t):void 0;c===void 0&&(c=t[s]),i?Bq(e,s,c):Lq(e,s,c)}return e}nx.exports=Vq});var ox=v((jge,ix)=>{"use strict";function zq(t,o){for(var e=-1,n=Array(t);++e<t;)n[e]=o(e);return n}ix.exports=zq});var yn=v((Uge,rx)=>{"use strict";function Hq(t){return t!=null&&typeof t=="object"}rx.exports=Hq});var sx=v(($ge,ax)=>{"use strict";var qq=mi(),Gq=yn(),jq="[object Arguments]";function Uq(t){return Gq(t)&&qq(t)==jq}ax.exports=Uq});var Yo=v((Wge,dx)=>{"use strict";var lx=sx(),$q=yn(),cx=Object.prototype,Wq=cx.hasOwnProperty,Kq=cx.propertyIsEnumerable,Yq=lx((function(){return arguments})())?lx:function(t){return $q(t)&&Wq.call(t,"callee")&&!Kq.call(t,"callee")};dx.exports=Yq});var lt=v((Kge,ux)=>{"use strict";var Xq=Array.isArray;ux.exports=Xq});var hx=v((Yge,px)=>{"use strict";function Zq(){return!1}px.exports=Zq});var Yi=v((ba,Xo)=>{"use strict";var Qq=sn(),Jq=hx(),_x=typeof ba=="object"&&ba&&!ba.nodeType&&ba,fx=_x&&typeof Xo=="object"&&Xo&&!Xo.nodeType&&Xo,eG=fx&&fx.exports===_x,mx=eG?Qq.Buffer:void 0,tG=mx?mx.isBuffer:void 0,nG=tG||Jq;Xo.exports=nG});var va=v((Xge,gx)=>{"use strict";var iG=9007199254740991,oG=/^(?:0|[1-9]\d*)$/;function rG(t,o){var e=typeof t;return o=o??iG,!!o&&(e=="number"||e!="symbol"&&oG.test(t))&&t>-1&&t%1==0&&t<o}gx.exports=rG});var Rh=v((Zge,bx)=>{"use strict";var aG=9007199254740991;function sG(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=aG}bx.exports=sG});var yx=v((Qge,vx)=>{"use strict";var lG=mi(),cG=Rh(),dG=yn(),uG="[object Arguments]",pG="[object Array]",hG="[object Boolean]",fG="[object Date]",mG="[object Error]",_G="[object Function]",gG="[object Map]",bG="[object Number]",vG="[object Object]",yG="[object RegExp]",CG="[object Set]",xG="[object String]",wG="[object WeakMap]",TG="[object ArrayBuffer]",SG="[object DataView]",kG="[object Float32Array]",IG="[object Float64Array]",EG="[object Int8Array]",MG="[object Int16Array]",DG="[object Int32Array]",PG="[object Uint8Array]",RG="[object Uint8ClampedArray]",OG="[object Uint16Array]",FG="[object Uint32Array]",Je={};Je[kG]=Je[IG]=Je[EG]=Je[MG]=Je[DG]=Je[PG]=Je[RG]=Je[OG]=Je[FG]=!0;Je[uG]=Je[pG]=Je[TG]=Je[hG]=Je[SG]=Je[fG]=Je[mG]=Je[_G]=Je[gG]=Je[bG]=Je[vG]=Je[yG]=Je[CG]=Je[xG]=Je[wG]=!1;function NG(t){return dG(t)&&cG(t.length)&&!!Je[lG(t)]}vx.exports=NG});var ya=v((Jge,Cx)=>{"use strict";function AG(t){return function(o){return t(o)}}Cx.exports=AG});var Oh=v((Ca,Zo)=>{"use strict";var LG=D_(),xx=typeof Ca=="object"&&Ca&&!Ca.nodeType&&Ca,xa=xx&&typeof Zo=="object"&&Zo&&!Zo.nodeType&&Zo,BG=xa&&xa.exports===xx,F_=BG&&LG.process,VG=(function(){try{var t=xa&&xa.require&&xa.require("util").types;return t||F_&&F_.binding&&F_.binding("util")}catch{}})();Zo.exports=VG});var Qo=v((e0e,Sx)=>{"use strict";var zG=yx(),HG=ya(),wx=Oh(),Tx=wx&&wx.isTypedArray,qG=Tx?HG(Tx):zG;Sx.exports=qG});var N_=v((t0e,kx)=>{"use strict";var GG=ox(),jG=Yo(),UG=lt(),$G=Yi(),WG=va(),KG=Qo(),YG=Object.prototype,XG=YG.hasOwnProperty;function ZG(t,o){var e=UG(t),n=!e&&jG(t),i=!e&&!n&&$G(t),r=!e&&!n&&!i&&KG(t),a=e||n||i||r,s=a?GG(t.length,String):[],c=s.length;for(var u in t)(o||XG.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||r&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||WG(u,c)))&&s.push(u);return s}kx.exports=ZG});var wa=v((n0e,Ix)=>{"use strict";var QG=Object.prototype;function JG(t){var o=t&&t.constructor,e=typeof o=="function"&&o.prototype||QG;return t===e}Ix.exports=JG});var A_=v((i0e,Ex)=>{"use strict";function ej(t,o){return function(e){return t(o(e))}}Ex.exports=ej});var Dx=v((o0e,Mx)=>{"use strict";var tj=A_(),nj=tj(Object.keys,Object);Mx.exports=nj});var Fh=v((r0e,Px)=>{"use strict";var ij=wa(),oj=Dx(),rj=Object.prototype,aj=rj.hasOwnProperty;function sj(t){if(!ij(t))return oj(t);var o=[];for(var e in Object(t))aj.call(t,e)&&e!="constructor"&&o.push(e);return o}Px.exports=sj});var Pn=v((a0e,Rx)=>{"use strict";var lj=jo(),cj=Rh();function dj(t){return t!=null&&cj(t.length)&&!lj(t)}Rx.exports=dj});var Hn=v((s0e,Ox)=>{"use strict";var uj=N_(),pj=Fh(),hj=Pn();function fj(t){return hj(t)?uj(t):pj(t)}Ox.exports=fj});var Nx=v((l0e,Fx)=>{"use strict";var mj=Ko(),_j=Hn();function gj(t,o){return t&&mj(o,_j(o),t)}Fx.exports=gj});var Lx=v((c0e,Ax)=>{"use strict";function bj(t){var o=[];if(t!=null)for(var e in Object(t))o.push(e);return o}Ax.exports=bj});var Vx=v((d0e,Bx)=>{"use strict";var vj=Yt(),yj=wa(),Cj=Lx(),xj=Object.prototype,wj=xj.hasOwnProperty;function Tj(t){if(!vj(t))return Cj(t);var o=yj(t),e=[];for(var n in t)n=="constructor"&&(o||!wj.call(t,n))||e.push(n);return e}Bx.exports=Tj});var gi=v((u0e,zx)=>{"use strict";var Sj=N_(),kj=Vx(),Ij=Pn();function Ej(t){return Ij(t)?Sj(t,!0):kj(t)}zx.exports=Ej});var qx=v((p0e,Hx)=>{"use strict";var Mj=Ko(),Dj=gi();function Pj(t,o){return t&&Mj(o,Dj(o),t)}Hx.exports=Pj});var L_=v((Ta,Jo)=>{"use strict";var Rj=sn(),$x=typeof Ta=="object"&&Ta&&!Ta.nodeType&&Ta,Gx=$x&&typeof Jo=="object"&&Jo&&!Jo.nodeType&&Jo,Oj=Gx&&Gx.exports===$x,jx=Oj?Rj.Buffer:void 0,Ux=jx?jx.allocUnsafe:void 0;function Fj(t,o){if(o)return t.slice();var e=t.length,n=Ux?Ux(e):new t.constructor(e);return t.copy(n),n}Jo.exports=Fj});var B_=v((h0e,Wx)=>{"use strict";function Nj(t,o){var e=-1,n=t.length;for(o||(o=Array(n));++e<n;)o[e]=t[e];return o}Wx.exports=Nj});var V_=v((f0e,Kx)=>{"use strict";function Aj(t,o){for(var e=-1,n=t==null?0:t.length,i=0,r=[];++e<n;){var a=t[e];o(a,e,t)&&(r[i++]=a)}return r}Kx.exports=Aj});var z_=v((m0e,Yx)=>{"use strict";function Lj(){return[]}Yx.exports=Lj});var Nh=v((_0e,Zx)=>{"use strict";var Bj=V_(),Vj=z_(),zj=Object.prototype,Hj=zj.propertyIsEnumerable,Xx=Object.getOwnPropertySymbols,qj=Xx?function(t){return t==null?[]:(t=Object(t),Bj(Xx(t),function(o){return Hj.call(t,o)}))}:Vj;Zx.exports=qj});var Jx=v((g0e,Qx)=>{"use strict";var Gj=Ko(),jj=Nh();function Uj(t,o){return Gj(t,jj(t),o)}Qx.exports=Uj});var Ah=v((b0e,ew)=>{"use strict";function $j(t,o){for(var e=-1,n=o.length,i=t.length;++e<n;)t[i+e]=o[e];return t}ew.exports=$j});var Sa=v((v0e,tw)=>{"use strict";var Wj=A_(),Kj=Wj(Object.getPrototypeOf,Object);tw.exports=Kj});var H_=v((y0e,nw)=>{"use strict";var Yj=Ah(),Xj=Sa(),Zj=Nh(),Qj=z_(),Jj=Object.getOwnPropertySymbols,eU=Jj?function(t){for(var o=[];t;)Yj(o,Zj(t)),t=Xj(t);return o}:Qj;nw.exports=eU});var ow=v((C0e,iw)=>{"use strict";var tU=Ko(),nU=H_();function iU(t,o){return tU(t,nU(t),o)}iw.exports=iU});var q_=v((x0e,rw)=>{"use strict";var oU=Ah(),rU=lt();function aU(t,o,e){var n=o(t);return rU(t)?n:oU(n,e(t))}rw.exports=aU});var G_=v((w0e,aw)=>{"use strict";var sU=q_(),lU=Nh(),cU=Hn();function dU(t){return sU(t,cU,lU)}aw.exports=dU});var lw=v((T0e,sw)=>{"use strict";var uU=q_(),pU=H_(),hU=gi();function fU(t){return uU(t,hU,pU)}sw.exports=fU});var dw=v((S0e,cw)=>{"use strict";var mU=_i(),_U=sn(),gU=mU(_U,"DataView");cw.exports=gU});var pw=v((k0e,uw)=>{"use strict";var bU=_i(),vU=sn(),yU=bU(vU,"Promise");uw.exports=yU});var j_=v((I0e,hw)=>{"use strict";var CU=_i(),xU=sn(),wU=CU(xU,"Set");hw.exports=wU});var mw=v((E0e,fw)=>{"use strict";var TU=_i(),SU=sn(),kU=TU(SU,"WeakMap");fw.exports=kU});var Zi=v((M0e,xw)=>{"use strict";var U_=dw(),$_=Mh(),W_=pw(),K_=j_(),Y_=mw(),Cw=mi(),er=R_(),_w="[object Map]",IU="[object Object]",gw="[object Promise]",bw="[object Set]",vw="[object WeakMap]",yw="[object DataView]",EU=er(U_),MU=er($_),DU=er(W_),PU=er(K_),RU=er(Y_),Xi=Cw;(U_&&Xi(new U_(new ArrayBuffer(1)))!=yw||$_&&Xi(new $_)!=_w||W_&&Xi(W_.resolve())!=gw||K_&&Xi(new K_)!=bw||Y_&&Xi(new Y_)!=vw)&&(Xi=function(t){var o=Cw(t),e=o==IU?t.constructor:void 0,n=e?er(e):"";if(n)switch(n){case EU:return yw;case MU:return _w;case DU:return gw;case PU:return bw;case RU:return vw}return o});xw.exports=Xi});var Tw=v((D0e,ww)=>{"use strict";var OU=Object.prototype,FU=OU.hasOwnProperty;function NU(t){var o=t.length,e=new t.constructor(o);return o&&typeof t[0]=="string"&&FU.call(t,"index")&&(e.index=t.index,e.input=t.input),e}ww.exports=NU});var X_=v((P0e,Sw)=>{"use strict";var AU=sn(),LU=AU.Uint8Array;Sw.exports=LU});var Lh=v((R0e,Iw)=>{"use strict";var kw=X_();function BU(t){var o=new t.constructor(t.byteLength);return new kw(o).set(new kw(t)),o}Iw.exports=BU});var Mw=v((O0e,Ew)=>{"use strict";var VU=Lh();function zU(t,o){var e=o?VU(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}Ew.exports=zU});var Pw=v((F0e,Dw)=>{"use strict";var HU=/\w*$/;function qU(t){var o=new t.constructor(t.source,HU.exec(t));return o.lastIndex=t.lastIndex,o}Dw.exports=qU});var Aw=v((N0e,Nw)=>{"use strict";var Rw=Ki(),Ow=Rw?Rw.prototype:void 0,Fw=Ow?Ow.valueOf:void 0;function GU(t){return Fw?Object(Fw.call(t)):{}}Nw.exports=GU});var Z_=v((A0e,Lw)=>{"use strict";var jU=Lh();function UU(t,o){var e=o?jU(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}Lw.exports=UU});var Vw=v((L0e,Bw)=>{"use strict";var $U=Lh(),WU=Mw(),KU=Pw(),YU=Aw(),XU=Z_(),ZU="[object Boolean]",QU="[object Date]",JU="[object Map]",e$="[object Number]",t$="[object RegExp]",n$="[object Set]",i$="[object String]",o$="[object Symbol]",r$="[object ArrayBuffer]",a$="[object DataView]",s$="[object Float32Array]",l$="[object Float64Array]",c$="[object Int8Array]",d$="[object Int16Array]",u$="[object Int32Array]",p$="[object Uint8Array]",h$="[object Uint8ClampedArray]",f$="[object Uint16Array]",m$="[object Uint32Array]";function _$(t,o,e){var n=t.constructor;switch(o){case r$:return $U(t);case ZU:case QU:return new n(+t);case a$:return WU(t,e);case s$:case l$:case c$:case d$:case u$:case p$:case h$:case f$:case m$:return XU(t,e);case JU:return new n;case e$:case i$:return new n(t);case t$:return KU(t);case n$:return new n;case o$:return YU(t)}}Bw.exports=_$});var Q_=v((B0e,Hw)=>{"use strict";var g$=Yt(),zw=Object.create,b$=(function(){function t(){}return function(o){if(!g$(o))return{};if(zw)return zw(o);t.prototype=o;var e=new t;return t.prototype=void 0,e}})();Hw.exports=b$});var J_=v((V0e,qw)=>{"use strict";var v$=Q_(),y$=Sa(),C$=wa();function x$(t){return typeof t.constructor=="function"&&!C$(t)?v$(y$(t)):{}}qw.exports=x$});var jw=v((z0e,Gw)=>{"use strict";var w$=Zi(),T$=yn(),S$="[object Map]";function k$(t){return T$(t)&&w$(t)==S$}Gw.exports=k$});var Kw=v((H0e,Ww)=>{"use strict";var I$=jw(),E$=ya(),Uw=Oh(),$w=Uw&&Uw.isMap,M$=$w?E$($w):I$;Ww.exports=M$});var Xw=v((q0e,Yw)=>{"use strict";var D$=Zi(),P$=yn(),R$="[object Set]";function O$(t){return P$(t)&&D$(t)==R$}Yw.exports=O$});var eT=v((G0e,Jw)=>{"use strict";var F$=Xw(),N$=ya(),Zw=Oh(),Qw=Zw&&Zw.isSet,A$=Qw?N$(Qw):F$;Jw.exports=A$});var eg=v((j0e,oT)=>{"use strict";var L$=ma(),B$=Ph(),V$=ga(),z$=Nx(),H$=qx(),q$=L_(),G$=B_(),j$=Jx(),U$=ow(),$$=G_(),W$=lw(),K$=Zi(),Y$=Tw(),X$=Vw(),Z$=J_(),Q$=lt(),J$=Yi(),eW=Kw(),tW=Yt(),nW=eT(),iW=Hn(),oW=gi(),rW=1,aW=2,sW=4,tT="[object Arguments]",lW="[object Array]",cW="[object Boolean]",dW="[object Date]",uW="[object Error]",nT="[object Function]",pW="[object GeneratorFunction]",hW="[object Map]",fW="[object Number]",iT="[object Object]",mW="[object RegExp]",_W="[object Set]",gW="[object String]",bW="[object Symbol]",vW="[object WeakMap]",yW="[object ArrayBuffer]",CW="[object DataView]",xW="[object Float32Array]",wW="[object Float64Array]",TW="[object Int8Array]",SW="[object Int16Array]",kW="[object Int32Array]",IW="[object Uint8Array]",EW="[object Uint8ClampedArray]",MW="[object Uint16Array]",DW="[object Uint32Array]",Ze={};Ze[tT]=Ze[lW]=Ze[yW]=Ze[CW]=Ze[cW]=Ze[dW]=Ze[xW]=Ze[wW]=Ze[TW]=Ze[SW]=Ze[kW]=Ze[hW]=Ze[fW]=Ze[iT]=Ze[mW]=Ze[_W]=Ze[gW]=Ze[bW]=Ze[IW]=Ze[EW]=Ze[MW]=Ze[DW]=!0;Ze[uW]=Ze[nT]=Ze[vW]=!1;function Bh(t,o,e,n,i,r){var a,s=o&rW,c=o&aW,u=o&sW;if(e&&(a=i?e(t,n,i,r):e(t)),a!==void 0)return a;if(!tW(t))return t;var h=Q$(t);if(h){if(a=Y$(t),!s)return G$(t,a)}else{var g=K$(t),C=g==nT||g==pW;if(J$(t))return q$(t,s);if(g==iT||g==tT||C&&!i){if(a=c||C?{}:Z$(t),!s)return c?U$(t,H$(a,t)):j$(t,z$(a,t))}else{if(!Ze[g])return i?t:{};a=X$(t,g,s)}}r||(r=new L$);var k=r.get(t);if(k)return k;r.set(t,a),nW(t)?t.forEach(function(q){a.add(Bh(q,o,e,q,t,r))}):eW(t)&&t.forEach(function(q,Y){a.set(Y,Bh(q,o,e,Y,t,r))});var I=u?c?W$:$$:c?oW:iW,N=h?void 0:I(t);return B$(N||t,function(q,Y){N&&(Y=q,q=t[Y]),V$(a,Y,Bh(q,o,e,Y,t,r))}),a}oT.exports=Bh});var aT=v((U0e,rT)=>{"use strict";var PW=eg(),RW=4;function OW(t){return PW(t,RW)}rT.exports=OW});var Vh=v(($0e,sT)=>{"use strict";function FW(t){return function(){return t}}sT.exports=FW});var cT=v((W0e,lT)=>{"use strict";function NW(t){return function(o,e,n){for(var i=-1,r=Object(o),a=n(o),s=a.length;s--;){var c=a[t?s:++i];if(e(r[c],c,r)===!1)break}return o}}lT.exports=NW});var zh=v((K0e,dT)=>{"use strict";var AW=cT(),LW=AW();dT.exports=LW});var Hh=v((Y0e,uT)=>{"use strict";var BW=zh(),VW=Hn();function zW(t,o){return t&&BW(t,o,VW)}uT.exports=zW});var hT=v((X0e,pT)=>{"use strict";var HW=Pn();function qW(t,o){return function(e,n){if(e==null)return e;if(!HW(e))return t(e,n);for(var i=e.length,r=o?i:-1,a=Object(e);(o?r--:++r<i)&&n(a[r],r,a)!==!1;);return e}}pT.exports=qW});var ka=v((Z0e,fT)=>{"use strict";var GW=Hh(),jW=hT(),UW=jW(GW);fT.exports=UW});var bi=v((Q0e,mT)=>{"use strict";function $W(t){return t}mT.exports=$W});var tg=v((J0e,_T)=>{"use strict";var WW=bi();function KW(t){return typeof t=="function"?t:WW}_T.exports=KW});var ng=v((ebe,gT)=>{"use strict";var YW=Ph(),XW=ka(),ZW=tg(),QW=lt();function JW(t,o){var e=QW(t)?YW:XW;return e(t,ZW(o))}gT.exports=JW});var ig=v((tbe,bT)=>{"use strict";bT.exports=ng()});var yT=v((nbe,vT)=>{"use strict";var eK=ka();function tK(t,o){var e=[];return eK(t,function(n,i,r){o(n,i,r)&&e.push(n)}),e}vT.exports=tK});var xT=v((ibe,CT)=>{"use strict";var nK="__lodash_hash_undefined__";function iK(t){return this.__data__.set(t,nK),this}CT.exports=iK});var TT=v((obe,wT)=>{"use strict";function oK(t){return this.__data__.has(t)}wT.exports=oK});var og=v((rbe,ST)=>{"use strict";var rK=Dh(),aK=xT(),sK=TT();function qh(t){var o=-1,e=t==null?0:t.length;for(this.__data__=new rK;++o<e;)this.add(t[o])}qh.prototype.add=qh.prototype.push=aK;qh.prototype.has=sK;ST.exports=qh});var IT=v((abe,kT)=>{"use strict";function lK(t,o){for(var e=-1,n=t==null?0:t.length;++e<n;)if(o(t[e],e,t))return!0;return!1}kT.exports=lK});var rg=v((sbe,ET)=>{"use strict";function cK(t,o){return t.has(o)}ET.exports=cK});var ag=v((lbe,MT)=>{"use strict";var dK=og(),uK=IT(),pK=rg(),hK=1,fK=2;function mK(t,o,e,n,i,r){var a=e&hK,s=t.length,c=o.length;if(s!=c&&!(a&&c>s))return!1;var u=r.get(t),h=r.get(o);if(u&&h)return u==o&&h==t;var g=-1,C=!0,k=e&fK?new dK:void 0;for(r.set(t,o),r.set(o,t);++g<s;){var I=t[g],N=o[g];if(n)var q=a?n(N,I,g,o,t,r):n(I,N,g,t,o,r);if(q!==void 0){if(q)continue;C=!1;break}if(k){if(!uK(o,function(Y,ee){if(!pK(k,ee)&&(I===Y||i(I,Y,e,n,r)))return k.push(ee)})){C=!1;break}}else if(!(I===N||i(I,N,e,n,r))){C=!1;break}}return r.delete(t),r.delete(o),C}MT.exports=mK});var PT=v((cbe,DT)=>{"use strict";function _K(t){var o=-1,e=Array(t.size);return t.forEach(function(n,i){e[++o]=[i,n]}),e}DT.exports=_K});var Gh=v((dbe,RT)=>{"use strict";function gK(t){var o=-1,e=Array(t.size);return t.forEach(function(n){e[++o]=n}),e}RT.exports=gK});var LT=v((ube,AT)=>{"use strict";var OT=Ki(),FT=X_(),bK=Wi(),vK=ag(),yK=PT(),CK=Gh(),xK=1,wK=2,TK="[object Boolean]",SK="[object Date]",kK="[object Error]",IK="[object Map]",EK="[object Number]",MK="[object RegExp]",DK="[object Set]",PK="[object String]",RK="[object Symbol]",OK="[object ArrayBuffer]",FK="[object DataView]",NT=OT?OT.prototype:void 0,sg=NT?NT.valueOf:void 0;function NK(t,o,e,n,i,r,a){switch(e){case FK:if(t.byteLength!=o.byteLength||t.byteOffset!=o.byteOffset)return!1;t=t.buffer,o=o.buffer;case OK:return!(t.byteLength!=o.byteLength||!r(new FT(t),new FT(o)));case TK:case SK:case EK:return bK(+t,+o);case kK:return t.name==o.name&&t.message==o.message;case MK:case PK:return t==o+"";case IK:var s=yK;case DK:var c=n&xK;if(s||(s=CK),t.size!=o.size&&!c)return!1;var u=a.get(t);if(u)return u==o;n|=wK,a.set(t,o);var h=vK(s(t),s(o),n,i,r,a);return a.delete(t),h;case RK:if(sg)return sg.call(t)==sg.call(o)}return!1}AT.exports=NK});var zT=v((pbe,VT)=>{"use strict";var BT=G_(),AK=1,LK=Object.prototype,BK=LK.hasOwnProperty;function VK(t,o,e,n,i,r){var a=e&AK,s=BT(t),c=s.length,u=BT(o),h=u.length;if(c!=h&&!a)return!1;for(var g=c;g--;){var C=s[g];if(!(a?C in o:BK.call(o,C)))return!1}var k=r.get(t),I=r.get(o);if(k&&I)return k==o&&I==t;var N=!0;r.set(t,o),r.set(o,t);for(var q=a;++g<c;){C=s[g];var Y=t[C],ee=o[C];if(n)var ce=a?n(ee,Y,C,o,t,r):n(Y,ee,C,t,o,r);if(!(ce===void 0?Y===ee||i(Y,ee,e,n,r):ce)){N=!1;break}q||(q=C=="constructor")}if(N&&!q){var Oe=t.constructor,De=o.constructor;Oe!=De&&"constructor"in t&&"constructor"in o&&!(typeof Oe=="function"&&Oe instanceof Oe&&typeof De=="function"&&De instanceof De)&&(N=!1)}return r.delete(t),r.delete(o),N}VT.exports=VK});var KT=v((hbe,WT)=>{"use strict";var lg=ma(),zK=ag(),HK=LT(),qK=zT(),HT=Zi(),qT=lt(),GT=Yi(),GK=Qo(),jK=1,jT="[object Arguments]",UT="[object Array]",jh="[object Object]",UK=Object.prototype,$T=UK.hasOwnProperty;function $K(t,o,e,n,i,r){var a=qT(t),s=qT(o),c=a?UT:HT(t),u=s?UT:HT(o);c=c==jT?jh:c,u=u==jT?jh:u;var h=c==jh,g=u==jh,C=c==u;if(C&&GT(t)){if(!GT(o))return!1;a=!0,h=!1}if(C&&!h)return r||(r=new lg),a||GK(t)?zK(t,o,e,n,i,r):HK(t,o,c,e,n,i,r);if(!(e&jK)){var k=h&&$T.call(t,"__wrapped__"),I=g&&$T.call(o,"__wrapped__");if(k||I){var N=k?t.value():t,q=I?o.value():o;return r||(r=new lg),i(N,q,e,n,r)}}return C?(r||(r=new lg),qK(t,o,e,n,i,r)):!1}WT.exports=$K});var cg=v((fbe,ZT)=>{"use strict";var WK=KT(),YT=yn();function XT(t,o,e,n,i){return t===o?!0:t==null||o==null||!YT(t)&&!YT(o)?t!==t&&o!==o:WK(t,o,e,n,XT,i)}ZT.exports=XT});var JT=v((mbe,QT)=>{"use strict";var KK=ma(),YK=cg(),XK=1,ZK=2;function QK(t,o,e,n){var i=e.length,r=i,a=!n;if(t==null)return!r;for(t=Object(t);i--;){var s=e[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<r;){s=e[i];var c=s[0],u=t[c],h=s[1];if(a&&s[2]){if(u===void 0&&!(c in t))return!1}else{var g=new KK;if(n)var C=n(u,h,c,t,o,g);if(!(C===void 0?YK(h,u,XK|ZK,n,g):C))return!1}}return!0}QT.exports=QK});var dg=v((_be,e2)=>{"use strict";var JK=Yt();function eY(t){return t===t&&!JK(t)}e2.exports=eY});var n2=v((gbe,t2)=>{"use strict";var tY=dg(),nY=Hn();function iY(t){for(var o=nY(t),e=o.length;e--;){var n=o[e],i=t[n];o[e]=[n,i,tY(i)]}return o}t2.exports=iY});var ug=v((bbe,i2)=>{"use strict";function oY(t,o){return function(e){return e==null?!1:e[t]===o&&(o!==void 0||t in Object(e))}}i2.exports=oY});var r2=v((vbe,o2)=>{"use strict";var rY=JT(),aY=n2(),sY=ug();function lY(t){var o=aY(t);return o.length==1&&o[0][2]?sY(o[0][0],o[0][1]):function(e){return e===t||rY(e,t,o)}}o2.exports=lY});var Qi=v((ybe,a2)=>{"use strict";var cY=mi(),dY=yn(),uY="[object Symbol]";function pY(t){return typeof t=="symbol"||dY(t)&&cY(t)==uY}a2.exports=pY});var Uh=v((Cbe,s2)=>{"use strict";var hY=lt(),fY=Qi(),mY=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_Y=/^\w*$/;function gY(t,o){if(hY(t))return!1;var e=typeof t;return e=="number"||e=="symbol"||e=="boolean"||t==null||fY(t)?!0:_Y.test(t)||!mY.test(t)||o!=null&&t in Object(o)}s2.exports=gY});var d2=v((xbe,c2)=>{"use strict";var l2=Dh(),bY="Expected a function";function pg(t,o){if(typeof t!="function"||o!=null&&typeof o!="function")throw new TypeError(bY);var e=function(){var n=arguments,i=o?o.apply(this,n):n[0],r=e.cache;if(r.has(i))return r.get(i);var a=t.apply(this,n);return e.cache=r.set(i,a)||r,a};return e.cache=new(pg.Cache||l2),e}pg.Cache=l2;c2.exports=pg});var p2=v((wbe,u2)=>{"use strict";var vY=d2(),yY=500;function CY(t){var o=vY(t,function(n){return e.size===yY&&e.clear(),n}),e=o.cache;return o}u2.exports=CY});var f2=v((Tbe,h2)=>{"use strict";var xY=p2(),wY=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,TY=/\\(\\)?/g,SY=xY(function(t){var o=[];return t.charCodeAt(0)===46&&o.push(""),t.replace(wY,function(e,n,i,r){o.push(i?r.replace(TY,"$1"):n||e)}),o});h2.exports=SY});var Ia=v((Sbe,m2)=>{"use strict";function kY(t,o){for(var e=-1,n=t==null?0:t.length,i=Array(n);++e<n;)i[e]=o(t[e],e,t);return i}m2.exports=kY});var C2=v((kbe,y2)=>{"use strict";var _2=Ki(),IY=Ia(),EY=lt(),MY=Qi(),DY=1/0,g2=_2?_2.prototype:void 0,b2=g2?g2.toString:void 0;function v2(t){if(typeof t=="string")return t;if(EY(t))return IY(t,v2)+"";if(MY(t))return b2?b2.call(t):"";var o=t+"";return o=="0"&&1/t==-DY?"-0":o}y2.exports=v2});var hg=v((Ibe,x2)=>{"use strict";var PY=C2();function RY(t){return t==null?"":PY(t)}x2.exports=RY});var Ea=v((Ebe,w2)=>{"use strict";var OY=lt(),FY=Uh(),NY=f2(),AY=hg();function LY(t,o){return OY(t)?t:FY(t,o)?[t]:NY(AY(t))}w2.exports=LY});var tr=v((Mbe,T2)=>{"use strict";var BY=Qi(),VY=1/0;function zY(t){if(typeof t=="string"||BY(t))return t;var o=t+"";return o=="0"&&1/t==-VY?"-0":o}T2.exports=zY});var Ma=v((Dbe,S2)=>{"use strict";var HY=Ea(),qY=tr();function GY(t,o){o=HY(o,t);for(var e=0,n=o.length;t!=null&&e<n;)t=t[qY(o[e++])];return e&&e==n?t:void 0}S2.exports=GY});var I2=v((Pbe,k2)=>{"use strict";var jY=Ma();function UY(t,o,e){var n=t==null?void 0:jY(t,o);return n===void 0?e:n}k2.exports=UY});var M2=v((Rbe,E2)=>{"use strict";function $Y(t,o){return t!=null&&o in Object(t)}E2.exports=$Y});var fg=v((Obe,D2)=>{"use strict";var WY=Ea(),KY=Yo(),YY=lt(),XY=va(),ZY=Rh(),QY=tr();function JY(t,o,e){o=WY(o,t);for(var n=-1,i=o.length,r=!1;++n<i;){var a=QY(o[n]);if(!(r=t!=null&&e(t,a)))break;t=t[a]}return r||++n!=i?r:(i=t==null?0:t.length,!!i&&ZY(i)&&XY(a,i)&&(YY(t)||KY(t)))}D2.exports=JY});var mg=v((Fbe,P2)=>{"use strict";var eX=M2(),tX=fg();function nX(t,o){return t!=null&&tX(t,o,eX)}P2.exports=nX});var O2=v((Nbe,R2)=>{"use strict";var iX=cg(),oX=I2(),rX=mg(),aX=Uh(),sX=dg(),lX=ug(),cX=tr(),dX=1,uX=2;function pX(t,o){return aX(t)&&sX(o)?lX(cX(t),o):function(e){var n=oX(e,t);return n===void 0&&n===o?rX(e,t):iX(o,n,dX|uX)}}R2.exports=pX});var _g=v((Abe,F2)=>{"use strict";function hX(t){return function(o){return o?.[t]}}F2.exports=hX});var A2=v((Lbe,N2)=>{"use strict";var fX=Ma();function mX(t){return function(o){return fX(o,t)}}N2.exports=mX});var B2=v((Bbe,L2)=>{"use strict";var _X=_g(),gX=A2(),bX=Uh(),vX=tr();function yX(t){return bX(t)?_X(vX(t)):gX(t)}L2.exports=yX});var Rn=v((Vbe,V2)=>{"use strict";var CX=r2(),xX=O2(),wX=bi(),TX=lt(),SX=B2();function kX(t){return typeof t=="function"?t:t==null?wX:typeof t=="object"?TX(t)?xX(t[0],t[1]):CX(t):SX(t)}V2.exports=kX});var gg=v((zbe,z2)=>{"use strict";var IX=V_(),EX=yT(),MX=Rn(),DX=lt();function PX(t,o){var e=DX(t)?IX:EX;return e(t,MX(o,3))}z2.exports=PX});var q2=v((Hbe,H2)=>{"use strict";var RX=Object.prototype,OX=RX.hasOwnProperty;function FX(t,o){return t!=null&&OX.call(t,o)}H2.exports=FX});var bg=v((qbe,G2)=>{"use strict";var NX=q2(),AX=fg();function LX(t,o){return t!=null&&AX(t,o,NX)}G2.exports=LX});var U2=v((Gbe,j2)=>{"use strict";var BX=Fh(),VX=Zi(),zX=Yo(),HX=lt(),qX=Pn(),GX=Yi(),jX=wa(),UX=Qo(),$X="[object Map]",WX="[object Set]",KX=Object.prototype,YX=KX.hasOwnProperty;function XX(t){if(t==null)return!0;if(qX(t)&&(HX(t)||typeof t=="string"||typeof t.splice=="function"||GX(t)||UX(t)||zX(t)))return!t.length;var o=VX(t);if(o==$X||o==WX)return!t.size;if(jX(t))return!BX(t).length;for(var e in t)if(YX.call(t,e))return!1;return!0}j2.exports=XX});var vg=v((jbe,$2)=>{"use strict";function ZX(t){return t===void 0}$2.exports=ZX});var yg=v((Ube,W2)=>{"use strict";var QX=ka(),JX=Pn();function eZ(t,o){var e=-1,n=JX(t)?Array(t.length):[];return QX(t,function(i,r,a){n[++e]=o(i,r,a)}),n}W2.exports=eZ});var Cg=v(($be,K2)=>{"use strict";var tZ=Ia(),nZ=Rn(),iZ=yg(),oZ=lt();function rZ(t,o){var e=oZ(t)?tZ:iZ;return e(t,nZ(o,3))}K2.exports=rZ});var X2=v((Wbe,Y2)=>{"use strict";function aZ(t,o,e,n){var i=-1,r=t==null?0:t.length;for(n&&r&&(e=t[++i]);++i<r;)e=o(e,t[i],i,t);return e}Y2.exports=aZ});var Q2=v((Kbe,Z2)=>{"use strict";function sZ(t,o,e,n,i){return i(t,function(r,a,s){e=n?(n=!1,r):o(e,r,a,s)}),e}Z2.exports=sZ});var xg=v((Ybe,J2)=>{"use strict";var lZ=X2(),cZ=ka(),dZ=Rn(),uZ=Q2(),pZ=lt();function hZ(t,o,e){var n=pZ(t)?lZ:uZ,i=arguments.length<3;return n(t,dZ(o,4),e,i,cZ)}J2.exports=hZ});var tS=v((Xbe,eS)=>{"use strict";var fZ=mi(),mZ=lt(),_Z=yn(),gZ="[object String]";function bZ(t){return typeof t=="string"||!mZ(t)&&_Z(t)&&fZ(t)==gZ}eS.exports=bZ});var iS=v((Zbe,nS)=>{"use strict";var vZ=_g(),yZ=vZ("length");nS.exports=yZ});var rS=v((Qbe,oS)=>{"use strict";var CZ="\\ud800-\\udfff",xZ="\\u0300-\\u036f",wZ="\\ufe20-\\ufe2f",TZ="\\u20d0-\\u20ff",SZ=xZ+wZ+TZ,kZ="\\ufe0e\\ufe0f",IZ="\\u200d",EZ=RegExp("["+IZ+CZ+SZ+kZ+"]");function MZ(t){return EZ.test(t)}oS.exports=MZ});var fS=v((Jbe,hS)=>{"use strict";var sS="\\ud800-\\udfff",DZ="\\u0300-\\u036f",PZ="\\ufe20-\\ufe2f",RZ="\\u20d0-\\u20ff",OZ=DZ+PZ+RZ,FZ="\\ufe0e\\ufe0f",NZ="["+sS+"]",wg="["+OZ+"]",Tg="\\ud83c[\\udffb-\\udfff]",AZ="(?:"+wg+"|"+Tg+")",lS="[^"+sS+"]",cS="(?:\\ud83c[\\udde6-\\uddff]){2}",dS="[\\ud800-\\udbff][\\udc00-\\udfff]",LZ="\\u200d",uS=AZ+"?",pS="["+FZ+"]?",BZ="(?:"+LZ+"(?:"+[lS,cS,dS].join("|")+")"+pS+uS+")*",VZ=pS+uS+BZ,zZ="(?:"+[lS+wg+"?",wg,cS,dS,NZ].join("|")+")",aS=RegExp(Tg+"(?="+Tg+")|"+zZ+VZ,"g");function HZ(t){for(var o=aS.lastIndex=0;aS.test(t);)++o;return o}hS.exports=HZ});var _S=v((eve,mS)=>{"use strict";var qZ=iS(),GZ=rS(),jZ=fS();function UZ(t){return GZ(t)?jZ(t):qZ(t)}mS.exports=UZ});var bS=v((tve,gS)=>{"use strict";var $Z=Fh(),WZ=Zi(),KZ=Pn(),YZ=tS(),XZ=_S(),ZZ="[object Map]",QZ="[object Set]";function JZ(t){if(t==null)return 0;if(KZ(t))return YZ(t)?XZ(t):t.length;var o=WZ(t);return o==ZZ||o==QZ?t.size:$Z(t).length}gS.exports=JZ});var yS=v((nve,vS)=>{"use strict";var eQ=Ph(),tQ=Q_(),nQ=Hh(),iQ=Rn(),oQ=Sa(),rQ=lt(),aQ=Yi(),sQ=jo(),lQ=Yt(),cQ=Qo();function dQ(t,o,e){var n=rQ(t),i=n||aQ(t)||cQ(t);if(o=iQ(o,4),e==null){var r=t&&t.constructor;i?e=n?new r:[]:lQ(t)?e=sQ(r)?tQ(oQ(t)):{}:e={}}return(i?eQ:nQ)(t,function(a,s,c){return o(e,a,s,c)}),e}vS.exports=dQ});var TS=v((ive,wS)=>{"use strict";var CS=Ki(),uQ=Yo(),pQ=lt(),xS=CS?CS.isConcatSpreadable:void 0;function hQ(t){return pQ(t)||uQ(t)||!!(xS&&t&&t[xS])}wS.exports=hQ});var $h=v((ove,kS)=>{"use strict";var fQ=Ah(),mQ=TS();function SS(t,o,e,n,i){var r=-1,a=t.length;for(e||(e=mQ),i||(i=[]);++r<a;){var s=t[r];o>0&&e(s)?o>1?SS(s,o-1,e,n,i):fQ(i,s):n||(i[i.length]=s)}return i}kS.exports=SS});var ES=v((rve,IS)=>{"use strict";function _Q(t,o,e){switch(e.length){case 0:return t.call(o);case 1:return t.call(o,e[0]);case 2:return t.call(o,e[0],e[1]);case 3:return t.call(o,e[0],e[1],e[2])}return t.apply(o,e)}IS.exports=_Q});var Sg=v((ave,DS)=>{"use strict";var gQ=ES(),MS=Math.max;function bQ(t,o,e){return o=MS(o===void 0?t.length-1:o,0),function(){for(var n=arguments,i=-1,r=MS(n.length-o,0),a=Array(r);++i<r;)a[i]=n[o+i];i=-1;for(var s=Array(o+1);++i<o;)s[i]=n[i];return s[o]=e(a),gQ(t,this,s)}}DS.exports=bQ});var OS=v((sve,RS)=>{"use strict";var vQ=Vh(),PS=O_(),yQ=bi(),CQ=PS?function(t,o){return PS(t,"toString",{configurable:!0,enumerable:!1,value:vQ(o),writable:!0})}:yQ;RS.exports=CQ});var NS=v((lve,FS)=>{"use strict";var xQ=800,wQ=16,TQ=Date.now;function SQ(t){var o=0,e=0;return function(){var n=TQ(),i=wQ-(n-e);if(e=n,i>0){if(++o>=xQ)return arguments[0]}else o=0;return t.apply(void 0,arguments)}}FS.exports=SQ});var kg=v((cve,AS)=>{"use strict";var kQ=OS(),IQ=NS(),EQ=IQ(kQ);AS.exports=EQ});var Da=v((dve,LS)=>{"use strict";var MQ=bi(),DQ=Sg(),PQ=kg();function RQ(t,o){return PQ(DQ(t,o,MQ),t+"")}LS.exports=RQ});var Ig=v((uve,BS)=>{"use strict";function OQ(t,o,e,n){for(var i=t.length,r=e+(n?1:-1);n?r--:++r<i;)if(o(t[r],r,t))return r;return-1}BS.exports=OQ});var zS=v((pve,VS)=>{"use strict";function FQ(t){return t!==t}VS.exports=FQ});var qS=v((hve,HS)=>{"use strict";function NQ(t,o,e){for(var n=e-1,i=t.length;++n<i;)if(t[n]===o)return n;return-1}HS.exports=NQ});var jS=v((fve,GS)=>{"use strict";var AQ=Ig(),LQ=zS(),BQ=qS();function VQ(t,o,e){return o===o?BQ(t,o,e):AQ(t,LQ,e)}GS.exports=VQ});var $S=v((mve,US)=>{"use strict";var zQ=jS();function HQ(t,o){var e=t==null?0:t.length;return!!e&&zQ(t,o,0)>-1}US.exports=HQ});var KS=v((_ve,WS)=>{"use strict";function qQ(t,o,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(o,t[n]))return!0;return!1}WS.exports=qQ});var XS=v((gve,YS)=>{"use strict";function GQ(){}YS.exports=GQ});var QS=v((bve,ZS)=>{"use strict";var Eg=j_(),jQ=XS(),UQ=Gh(),$Q=1/0,WQ=Eg&&1/UQ(new Eg([,-0]))[1]==$Q?function(t){return new Eg(t)}:jQ;ZS.exports=WQ});var ek=v((vve,JS)=>{"use strict";var KQ=og(),YQ=$S(),XQ=KS(),ZQ=rg(),QQ=QS(),JQ=Gh(),eJ=200;function tJ(t,o,e){var n=-1,i=YQ,r=t.length,a=!0,s=[],c=s;if(e)a=!1,i=XQ;else if(r>=eJ){var u=o?null:QQ(t);if(u)return JQ(u);a=!1,i=ZQ,c=new KQ}else c=o?[]:s;e:for(;++n<r;){var h=t[n],g=o?o(h):h;if(h=e||h!==0?h:0,a&&g===g){for(var C=c.length;C--;)if(c[C]===g)continue e;o&&c.push(g),s.push(h)}else i(c,g,e)||(c!==s&&c.push(g),s.push(h))}return s}JS.exports=tJ});var Mg=v((yve,tk)=>{"use strict";var nJ=Pn(),iJ=yn();function oJ(t){return iJ(t)&&nJ(t)}tk.exports=oJ});var ik=v((Cve,nk)=>{"use strict";var rJ=$h(),aJ=Da(),sJ=ek(),lJ=Mg(),cJ=aJ(function(t){return sJ(rJ(t,1,lJ,!0))});nk.exports=cJ});var rk=v((xve,ok)=>{"use strict";var dJ=Ia();function uJ(t,o){return dJ(o,function(e){return t[e]})}ok.exports=uJ});var Dg=v((wve,ak)=>{"use strict";var pJ=rk(),hJ=Hn();function fJ(t){return t==null?[]:pJ(t,hJ(t))}ak.exports=fJ});var Xt=v((Tve,sk)=>{"use strict";var Wh;if(typeof no=="function")try{Wh={clone:aT(),constant:Vh(),each:ig(),filter:gg(),has:bg(),isArray:lt(),isEmpty:U2(),isFunction:jo(),isUndefined:vg(),keys:Hn(),map:Cg(),reduce:xg(),size:bS(),transform:yS(),union:ik(),values:Dg()}}catch{}Wh||(Wh=window._);sk.exports=Wh});var Kh=v((kve,uk)=>{"use strict";var ve=Xt();uk.exports=Pe;var mJ="\0",Ji="\0",lk="";function Pe(t){this._isDirected=ve.has(t,"directed")?t.directed:!0,this._isMultigraph=ve.has(t,"multigraph")?t.multigraph:!1,this._isCompound=ve.has(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=ve.constant(void 0),this._defaultEdgeLabelFn=ve.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Ji]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}Pe.prototype._nodeCount=0;Pe.prototype._edgeCount=0;Pe.prototype.isDirected=function(){return this._isDirected};Pe.prototype.isMultigraph=function(){return this._isMultigraph};Pe.prototype.isCompound=function(){return this._isCompound};Pe.prototype.setGraph=function(t){return this._label=t,this};Pe.prototype.graph=function(){return this._label};Pe.prototype.setDefaultNodeLabel=function(t){return ve.isFunction(t)||(t=ve.constant(t)),this._defaultNodeLabelFn=t,this};Pe.prototype.nodeCount=function(){return this._nodeCount};Pe.prototype.nodes=function(){return ve.keys(this._nodes)};Pe.prototype.sources=function(){var t=this;return ve.filter(this.nodes(),function(o){return ve.isEmpty(t._in[o])})};Pe.prototype.sinks=function(){var t=this;return ve.filter(this.nodes(),function(o){return ve.isEmpty(t._out[o])})};Pe.prototype.setNodes=function(t,o){var e=arguments,n=this;return ve.each(t,function(i){e.length>1?n.setNode(i,o):n.setNode(i)}),this};Pe.prototype.setNode=function(t,o){return ve.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=o),this):(this._nodes[t]=arguments.length>1?o:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Ji,this._children[t]={},this._children[Ji][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)};Pe.prototype.node=function(t){return this._nodes[t]};Pe.prototype.hasNode=function(t){return ve.has(this._nodes,t)};Pe.prototype.removeNode=function(t){var o=this;if(ve.has(this._nodes,t)){var e=function(n){o.removeEdge(o._edgeObjs[n])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ve.each(this.children(t),function(n){o.setParent(n)}),delete this._children[t]),ve.each(ve.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],ve.each(ve.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this};Pe.prototype.setParent=function(t,o){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ve.isUndefined(o))o=Ji;else{o+="";for(var e=o;!ve.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+o+" as parent of "+t+" would create a cycle");this.setNode(o)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=o,this._children[o][t]=!0,this};Pe.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]};Pe.prototype.parent=function(t){if(this._isCompound){var o=this._parent[t];if(o!==Ji)return o}};Pe.prototype.children=function(t){if(ve.isUndefined(t)&&(t=Ji),this._isCompound){var o=this._children[t];if(o)return ve.keys(o)}else{if(t===Ji)return this.nodes();if(this.hasNode(t))return[]}};Pe.prototype.predecessors=function(t){var o=this._preds[t];if(o)return ve.keys(o)};Pe.prototype.successors=function(t){var o=this._sucs[t];if(o)return ve.keys(o)};Pe.prototype.neighbors=function(t){var o=this.predecessors(t);if(o)return ve.union(o,this.successors(t))};Pe.prototype.isLeaf=function(t){var o;return this.isDirected()?o=this.successors(t):o=this.neighbors(t),o.length===0};Pe.prototype.filterNodes=function(t){var o=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});o.setGraph(this.graph());var e=this;ve.each(this._nodes,function(r,a){t(a)&&o.setNode(a,r)}),ve.each(this._edgeObjs,function(r){o.hasNode(r.v)&&o.hasNode(r.w)&&o.setEdge(r,e.edge(r))});var n={};function i(r){var a=e.parent(r);return a===void 0||o.hasNode(a)?(n[r]=a,a):a in n?n[a]:i(a)}return this._isCompound&&ve.each(o.nodes(),function(r){o.setParent(r,i(r))}),o};Pe.prototype.setDefaultEdgeLabel=function(t){return ve.isFunction(t)||(t=ve.constant(t)),this._defaultEdgeLabelFn=t,this};Pe.prototype.edgeCount=function(){return this._edgeCount};Pe.prototype.edges=function(){return ve.values(this._edgeObjs)};Pe.prototype.setPath=function(t,o){var e=this,n=arguments;return ve.reduce(t,function(i,r){return n.length>1?e.setEdge(i,r,o):e.setEdge(i,r),r}),this};Pe.prototype.setEdge=function(){var t,o,e,n,i=!1,r=arguments[0];typeof r=="object"&&r!==null&&"v"in r?(t=r.v,o=r.w,e=r.name,arguments.length===2&&(n=arguments[1],i=!0)):(t=r,o=arguments[1],e=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),t=""+t,o=""+o,ve.isUndefined(e)||(e=""+e);var a=Pa(this._isDirected,t,o,e);if(ve.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=n),this;if(!ve.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(o),this._edgeLabels[a]=i?n:this._defaultEdgeLabelFn(t,o,e);var s=_J(this._isDirected,t,o,e);return t=s.v,o=s.w,Object.freeze(s),this._edgeObjs[a]=s,ck(this._preds[o],t),ck(this._sucs[t],o),this._in[o][a]=s,this._out[t][a]=s,this._edgeCount++,this};Pe.prototype.edge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e);return this._edgeLabels[n]};Pe.prototype.hasEdge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e);return ve.has(this._edgeLabels,n)};Pe.prototype.removeEdge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e),i=this._edgeObjs[n];return i&&(t=i.v,o=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],dk(this._preds[o],t),dk(this._sucs[t],o),delete this._in[o][n],delete this._out[t][n],this._edgeCount--),this};Pe.prototype.inEdges=function(t,o){var e=this._in[t];if(e){var n=ve.values(e);return o?ve.filter(n,function(i){return i.v===o}):n}};Pe.prototype.outEdges=function(t,o){var e=this._out[t];if(e){var n=ve.values(e);return o?ve.filter(n,function(i){return i.w===o}):n}};Pe.prototype.nodeEdges=function(t,o){var e=this.inEdges(t,o);if(e)return e.concat(this.outEdges(t,o))};function ck(t,o){t[o]?t[o]++:t[o]=1}function dk(t,o){--t[o]||delete t[o]}function Pa(t,o,e,n){var i=""+o,r=""+e;if(!t&&i>r){var a=i;i=r,r=a}return i+lk+r+lk+(ve.isUndefined(n)?mJ:n)}function _J(t,o,e,n){var i=""+o,r=""+e;if(!t&&i>r){var a=i;i=r,r=a}var s={v:i,w:r};return n&&(s.name=n),s}function Pg(t,o){return Pa(t,o.v,o.w,o.name)}});var hk=v((Ive,pk)=>{"use strict";pk.exports="2.1.8"});var mk=v((Eve,fk)=>{"use strict";fk.exports={Graph:Kh(),version:hk()}});var gk=v((Mve,_k)=>{"use strict";var On=Xt(),gJ=Kh();_k.exports={write:bJ,read:CJ};function bJ(t){var o={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:vJ(t),edges:yJ(t)};return On.isUndefined(t.graph())||(o.value=On.clone(t.graph())),o}function vJ(t){return On.map(t.nodes(),function(o){var e=t.node(o),n=t.parent(o),i={v:o};return On.isUndefined(e)||(i.value=e),On.isUndefined(n)||(i.parent=n),i})}function yJ(t){return On.map(t.edges(),function(o){var e=t.edge(o),n={v:o.v,w:o.w};return On.isUndefined(o.name)||(n.name=o.name),On.isUndefined(e)||(n.value=e),n})}function CJ(t){var o=new gJ(t.options).setGraph(t.value);return On.each(t.nodes,function(e){o.setNode(e.v,e.value),e.parent&&o.setParent(e.v,e.parent)}),On.each(t.edges,function(e){o.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),o}});var vk=v((Dve,bk)=>{"use strict";var Yh=Xt();bk.exports=xJ;function xJ(t){var o={},e=[],n;function i(r){Yh.has(o,r)||(o[r]=!0,n.push(r),Yh.each(t.successors(r),i),Yh.each(t.predecessors(r),i))}return Yh.each(t.nodes(),function(r){n=[],i(r),n.length&&e.push(n)}),e}});var Rg=v((Pve,Ck)=>{"use strict";var yk=Xt();Ck.exports=ln;function ln(){this._arr=[],this._keyIndices={}}ln.prototype.size=function(){return this._arr.length};ln.prototype.keys=function(){return this._arr.map(function(t){return t.key})};ln.prototype.has=function(t){return yk.has(this._keyIndices,t)};ln.prototype.priority=function(t){var o=this._keyIndices[t];if(o!==void 0)return this._arr[o].priority};ln.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key};ln.prototype.add=function(t,o){var e=this._keyIndices;if(t=String(t),!yk.has(e,t)){var n=this._arr,i=n.length;return e[t]=i,n.push({key:t,priority:o}),this._decrease(i),!0}return!1};ln.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key};ln.prototype.decrease=function(t,o){var e=this._keyIndices[t];if(o>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+o);this._arr[e].priority=o,this._decrease(e)};ln.prototype._heapify=function(t){var o=this._arr,e=2*t,n=e+1,i=t;e<o.length&&(i=o[e].priority<o[i].priority?e:i,n<o.length&&(i=o[n].priority<o[i].priority?n:i),i!==t&&(this._swap(t,i),this._heapify(i)))};ln.prototype._decrease=function(t){for(var o=this._arr,e=o[t].priority,n;t!==0&&(n=t>>1,!(o[n].priority<e));)this._swap(t,n),t=n};ln.prototype._swap=function(t,o){var e=this._arr,n=this._keyIndices,i=e[t],r=e[o];e[t]=r,e[o]=i,n[r.key]=t,n[i.key]=o}});var Og=v((Rve,xk)=>{"use strict";var wJ=Xt(),TJ=Rg();xk.exports=kJ;var SJ=wJ.constant(1);function kJ(t,o,e,n){return IJ(t,String(o),e||SJ,n||function(i){return t.outEdges(i)})}function IJ(t,o,e,n){var i={},r=new TJ,a,s,c=function(u){var h=u.v!==a?u.v:u.w,g=i[h],C=e(u),k=s.distance+C;if(C<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+C);k<g.distance&&(g.distance=k,g.predecessor=a,r.decrease(h,k))};for(t.nodes().forEach(function(u){var h=u===o?0:Number.POSITIVE_INFINITY;i[u]={distance:h},r.add(u,h)});r.size()>0&&(a=r.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)n(a).forEach(c);return i}});var Tk=v((Ove,wk)=>{"use strict";var EJ=Og(),MJ=Xt();wk.exports=DJ;function DJ(t,o,e){return MJ.transform(t.nodes(),function(n,i){n[i]=EJ(t,i,o,e)},{})}});var Fg=v((Fve,kk)=>{"use strict";var Sk=Xt();kk.exports=PJ;function PJ(t){var o=0,e=[],n={},i=[];function r(a){var s=n[a]={onStack:!0,lowlink:o,index:o++};if(e.push(a),t.successors(a).forEach(function(h){Sk.has(n,h)?n[h].onStack&&(s.lowlink=Math.min(s.lowlink,n[h].index)):(r(h),s.lowlink=Math.min(s.lowlink,n[h].lowlink))}),s.lowlink===s.index){var c=[],u;do u=e.pop(),n[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return t.nodes().forEach(function(a){Sk.has(n,a)||r(a)}),i}});var Ek=v((Nve,Ik)=>{"use strict";var RJ=Xt(),OJ=Fg();Ik.exports=FJ;function FJ(t){return RJ.filter(OJ(t),function(o){return o.length>1||o.length===1&&t.hasEdge(o[0],o[0])})}});var Dk=v((Ave,Mk)=>{"use strict";var NJ=Xt();Mk.exports=LJ;var AJ=NJ.constant(1);function LJ(t,o,e){return BJ(t,o||AJ,e||function(n){return t.outEdges(n)})}function BJ(t,o,e){var n={},i=t.nodes();return i.forEach(function(r){n[r]={},n[r][r]={distance:0},i.forEach(function(a){r!==a&&(n[r][a]={distance:Number.POSITIVE_INFINITY})}),e(r).forEach(function(a){var s=a.v===r?a.w:a.v,c=o(a);n[r][s]={distance:c,predecessor:r}})}),i.forEach(function(r){var a=n[r];i.forEach(function(s){var c=n[s];i.forEach(function(u){var h=c[r],g=a[u],C=c[u],k=h.distance+g.distance;k<C.distance&&(C.distance=k,C.predecessor=g.predecessor)})})}),n}});var Ng=v((Lve,Rk)=>{"use strict";var Ra=Xt();Rk.exports=Pk;Pk.CycleException=Xh;function Pk(t){var o={},e={},n=[];function i(r){if(Ra.has(e,r))throw new Xh;Ra.has(o,r)||(e[r]=!0,o[r]=!0,Ra.each(t.predecessors(r),i),delete e[r],n.push(r))}if(Ra.each(t.sinks(),i),Ra.size(o)!==t.nodeCount())throw new Xh;return n}function Xh(){}Xh.prototype=new Error});var Nk=v((Bve,Fk)=>{"use strict";var Ok=Ng();Fk.exports=VJ;function VJ(t){try{Ok(t)}catch(o){if(o instanceof Ok.CycleException)return!1;throw o}return!0}});var Ag=v((Vve,Lk)=>{"use strict";var Zh=Xt();Lk.exports=zJ;function zJ(t,o,e){Zh.isArray(o)||(o=[o]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],r={};return Zh.each(o,function(a){if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);Ak(t,a,e==="post",r,n,i)}),i}function Ak(t,o,e,n,i,r){Zh.has(n,o)||(n[o]=!0,e||r.push(o),Zh.each(i(o),function(a){Ak(t,a,e,n,i,r)}),e&&r.push(o))}});var Vk=v((zve,Bk)=>{"use strict";var HJ=Ag();Bk.exports=qJ;function qJ(t,o){return HJ(t,o,"post")}});var Hk=v((Hve,zk)=>{"use strict";var GJ=Ag();zk.exports=jJ;function jJ(t,o){return GJ(t,o,"pre")}});var jk=v((qve,Gk)=>{"use strict";var qk=Xt(),UJ=Kh(),$J=Rg();Gk.exports=WJ;function WJ(t,o){var e=new UJ,n={},i=new $J,r;function a(c){var u=c.v===r?c.w:c.v,h=i.priority(u);if(h!==void 0){var g=o(c);g<h&&(n[u]=r,i.decrease(u,g))}}if(t.nodeCount()===0)return e;qk.each(t.nodes(),function(c){i.add(c,Number.POSITIVE_INFINITY),e.setNode(c)}),i.decrease(t.nodes()[0],0);for(var s=!1;i.size()>0;){if(r=i.removeMin(),qk.has(n,r))e.setEdge(r,n[r]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(r).forEach(a)}return e}});var $k=v((Gve,Uk)=>{"use strict";Uk.exports={components:vk(),dijkstra:Og(),dijkstraAll:Tk(),findCycles:Ek(),floydWarshall:Dk(),isAcyclic:Nk(),postorder:Vk(),preorder:Hk(),prim:jk(),tarjan:Fg(),topsort:Ng()}});var Yk=v((jve,Kk)=>{"use strict";var Wk=mk();Kk.exports={Graph:Wk.Graph,json:gk(),alg:$k(),version:Wk.version}});var cn=v((Uve,Xk)=>{"use strict";var Qh;if(typeof no=="function")try{Qh=Yk()}catch{}Qh||(Qh=window.graphlib);Xk.exports=Qh});var Qk=v((Wve,Zk)=>{"use strict";var KJ=eg(),YJ=1,XJ=4;function ZJ(t){return KJ(t,YJ|XJ)}Zk.exports=ZJ});var Oa=v((Kve,Jk)=>{"use strict";var QJ=Wi(),JJ=Pn(),eee=va(),tee=Yt();function nee(t,o,e){if(!tee(e))return!1;var n=typeof o;return(n=="number"?JJ(e)&&eee(o,e.length):n=="string"&&o in e)?QJ(e[o],t):!1}Jk.exports=nee});var nI=v((Yve,tI)=>{"use strict";var iee=Da(),oee=Wi(),ree=Oa(),aee=gi(),eI=Object.prototype,see=eI.hasOwnProperty,lee=iee(function(t,o){t=Object(t);var e=-1,n=o.length,i=n>2?o[2]:void 0;for(i&&ree(o[0],o[1],i)&&(n=1);++e<n;)for(var r=o[e],a=aee(r),s=-1,c=a.length;++s<c;){var u=a[s],h=t[u];(h===void 0||oee(h,eI[u])&&!see.call(t,u))&&(t[u]=r[u])}return t});tI.exports=lee});var oI=v((Xve,iI)=>{"use strict";var cee=Rn(),dee=Pn(),uee=Hn();function pee(t){return function(o,e,n){var i=Object(o);if(!dee(o)){var r=cee(e,3);o=uee(o),e=function(s){return r(i[s],s,i)}}var a=t(o,e,n);return a>-1?i[r?o[a]:a]:void 0}}iI.exports=pee});var aI=v((Zve,rI)=>{"use strict";var hee=/\s/;function fee(t){for(var o=t.length;o--&&hee.test(t.charAt(o)););return o}rI.exports=fee});var lI=v((Qve,sI)=>{"use strict";var mee=aI(),_ee=/^\s+/;function gee(t){return t&&t.slice(0,mee(t)+1).replace(_ee,"")}sI.exports=gee});var pI=v((Jve,uI)=>{"use strict";var bee=lI(),cI=Yt(),vee=Qi(),dI=NaN,yee=/^[-+]0x[0-9a-f]+$/i,Cee=/^0b[01]+$/i,xee=/^0o[0-7]+$/i,wee=parseInt;function Tee(t){if(typeof t=="number")return t;if(vee(t))return dI;if(cI(t)){var o=typeof t.valueOf=="function"?t.valueOf():t;t=cI(o)?o+"":o}if(typeof t!="string")return t===0?t:+t;t=bee(t);var e=Cee.test(t);return e||xee.test(t)?wee(t.slice(2),e?2:8):yee.test(t)?dI:+t}uI.exports=Tee});var Lg=v((eye,fI)=>{"use strict";var See=pI(),hI=1/0,kee=17976931348623157e292;function Iee(t){if(!t)return t===0?t:0;if(t=See(t),t===hI||t===-hI){var o=t<0?-1:1;return o*kee}return t===t?t:0}fI.exports=Iee});var _I=v((tye,mI)=>{"use strict";var Eee=Lg();function Mee(t){var o=Eee(t),e=o%1;return o===o?e?o-e:o:0}mI.exports=Mee});var bI=v((nye,gI)=>{"use strict";var Dee=Ig(),Pee=Rn(),Ree=_I(),Oee=Math.max;function Fee(t,o,e){var n=t==null?0:t.length;if(!n)return-1;var i=e==null?0:Ree(e);return i<0&&(i=Oee(n+i,0)),Dee(t,Pee(o,3),i)}gI.exports=Fee});var yI=v((iye,vI)=>{"use strict";var Nee=oI(),Aee=bI(),Lee=Nee(Aee);vI.exports=Lee});var Bg=v((oye,CI)=>{"use strict";var Bee=$h();function Vee(t){var o=t==null?0:t.length;return o?Bee(t,1):[]}CI.exports=Vee});var wI=v((rye,xI)=>{"use strict";var zee=zh(),Hee=tg(),qee=gi();function Gee(t,o){return t==null?t:zee(t,Hee(o),qee)}xI.exports=Gee});var SI=v((aye,TI)=>{"use strict";function jee(t){var o=t==null?0:t.length;return o?t[o-1]:void 0}TI.exports=jee});var II=v((sye,kI)=>{"use strict";var Uee=_a(),$ee=Hh(),Wee=Rn();function Kee(t,o){var e={};return o=Wee(o,3),$ee(t,function(n,i,r){Uee(e,i,o(n,i,r))}),e}kI.exports=Kee});var Jh=v((lye,EI)=>{"use strict";var Yee=Qi();function Xee(t,o,e){for(var n=-1,i=t.length;++n<i;){var r=t[n],a=o(r);if(a!=null&&(s===void 0?a===a&&!Yee(a):e(a,s)))var s=a,c=r}return c}EI.exports=Xee});var DI=v((cye,MI)=>{"use strict";function Zee(t,o){return t>o}MI.exports=Zee});var RI=v((dye,PI)=>{"use strict";var Qee=Jh(),Jee=DI(),ete=bi();function tte(t){return t&&t.length?Qee(t,ete,Jee):void 0}PI.exports=tte});var Vg=v((uye,OI)=>{"use strict";var nte=_a(),ite=Wi();function ote(t,o,e){(e!==void 0&&!ite(t[o],e)||e===void 0&&!(o in t))&&nte(t,o,e)}OI.exports=ote});var AI=v((pye,NI)=>{"use strict";var rte=mi(),ate=Sa(),ste=yn(),lte="[object Object]",cte=Function.prototype,dte=Object.prototype,FI=cte.toString,ute=dte.hasOwnProperty,pte=FI.call(Object);function hte(t){if(!ste(t)||rte(t)!=lte)return!1;var o=ate(t);if(o===null)return!0;var e=ute.call(o,"constructor")&&o.constructor;return typeof e=="function"&&e instanceof e&&FI.call(e)==pte}NI.exports=hte});var zg=v((hye,LI)=>{"use strict";function fte(t,o){if(!(o==="constructor"&&typeof t[o]=="function")&&o!="__proto__")return t[o]}LI.exports=fte});var VI=v((fye,BI)=>{"use strict";var mte=Ko(),_te=gi();function gte(t){return mte(t,_te(t))}BI.exports=gte});var UI=v((mye,jI)=>{"use strict";var zI=Vg(),bte=L_(),vte=Z_(),yte=B_(),Cte=J_(),HI=Yo(),qI=lt(),xte=Mg(),wte=Yi(),Tte=jo(),Ste=Yt(),kte=AI(),Ite=Qo(),GI=zg(),Ete=VI();function Mte(t,o,e,n,i,r,a){var s=GI(t,e),c=GI(o,e),u=a.get(c);if(u){zI(t,e,u);return}var h=r?r(s,c,e+"",t,o,a):void 0,g=h===void 0;if(g){var C=qI(c),k=!C&&wte(c),I=!C&&!k&&Ite(c);h=c,C||k||I?qI(s)?h=s:xte(s)?h=yte(s):k?(g=!1,h=bte(c,!0)):I?(g=!1,h=vte(c,!0)):h=[]:kte(c)||HI(c)?(h=s,HI(s)?h=Ete(s):(!Ste(s)||Tte(s))&&(h=Cte(c))):g=!1}g&&(a.set(c,h),i(h,c,n,r,a),a.delete(c)),zI(t,e,h)}jI.exports=Mte});var KI=v((_ye,WI)=>{"use strict";var Dte=ma(),Pte=Vg(),Rte=zh(),Ote=UI(),Fte=Yt(),Nte=gi(),Ate=zg();function $I(t,o,e,n,i){t!==o&&Rte(o,function(r,a){if(i||(i=new Dte),Fte(r))Ote(t,o,a,e,$I,n,i);else{var s=n?n(Ate(t,a),r,a+"",t,o,i):void 0;s===void 0&&(s=r),Pte(t,a,s)}},Nte)}WI.exports=$I});var XI=v((gye,YI)=>{"use strict";var Lte=Da(),Bte=Oa();function Vte(t){return Lte(function(o,e){var n=-1,i=e.length,r=i>1?e[i-1]:void 0,a=i>2?e[2]:void 0;for(r=t.length>3&&typeof r=="function"?(i--,r):void 0,a&&Bte(e[0],e[1],a)&&(r=i<3?void 0:r,i=1),o=Object(o);++n<i;){var s=e[n];s&&t(o,s,n,r)}return o})}YI.exports=Vte});var QI=v((bye,ZI)=>{"use strict";var zte=KI(),Hte=XI(),qte=Hte(function(t,o,e){zte(t,o,e)});ZI.exports=qte});var Hg=v((vye,JI)=>{"use strict";function Gte(t,o){return t<o}JI.exports=Gte});var tE=v((yye,eE)=>{"use strict";var jte=Jh(),Ute=Hg(),$te=bi();function Wte(t){return t&&t.length?jte(t,$te,Ute):void 0}eE.exports=Wte});var iE=v((Cye,nE)=>{"use strict";var Kte=Jh(),Yte=Rn(),Xte=Hg();function Zte(t,o){return t&&t.length?Kte(t,Yte(o,2),Xte):void 0}nE.exports=Zte});var rE=v((xye,oE)=>{"use strict";var Qte=sn(),Jte=function(){return Qte.Date.now()};oE.exports=Jte});var lE=v((wye,sE)=>{"use strict";var ene=ga(),tne=Ea(),nne=va(),aE=Yt(),ine=tr();function one(t,o,e,n){if(!aE(t))return t;o=tne(o,t);for(var i=-1,r=o.length,a=r-1,s=t;s!=null&&++i<r;){var c=ine(o[i]),u=e;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var h=s[c];u=n?n(h,c,s):void 0,u===void 0&&(u=aE(h)?h:nne(o[i+1])?[]:{})}ene(s,c,u),s=s[c]}return t}sE.exports=one});var dE=v((Tye,cE)=>{"use strict";var rne=Ma(),ane=lE(),sne=Ea();function lne(t,o,e){for(var n=-1,i=o.length,r={};++n<i;){var a=o[n],s=rne(t,a);e(s,a)&&ane(r,sne(a,t),s)}return r}cE.exports=lne});var pE=v((Sye,uE)=>{"use strict";var cne=dE(),dne=mg();function une(t,o){return cne(t,o,function(e,n){return dne(t,n)})}uE.exports=une});var fE=v((kye,hE)=>{"use strict";var pne=Bg(),hne=Sg(),fne=kg();function mne(t){return fne(hne(t,void 0,pne),t+"")}hE.exports=mne});var _E=v((Iye,mE)=>{"use strict";var _ne=pE(),gne=fE(),bne=gne(function(t,o){return t==null?{}:_ne(t,o)});mE.exports=bne});var bE=v((Eye,gE)=>{"use strict";var vne=Math.ceil,yne=Math.max;function Cne(t,o,e,n){for(var i=-1,r=yne(vne((o-t)/(e||1)),0),a=Array(r);r--;)a[n?r:++i]=t,t+=e;return a}gE.exports=Cne});var yE=v((Mye,vE)=>{"use strict";var xne=bE(),wne=Oa(),qg=Lg();function Tne(t){return function(o,e,n){return n&&typeof n!="number"&&wne(o,e,n)&&(e=n=void 0),o=qg(o),e===void 0?(e=o,o=0):e=qg(e),n=n===void 0?o<e?1:-1:qg(n),xne(o,e,n,t)}}vE.exports=Tne});var xE=v((Dye,CE)=>{"use strict";var Sne=yE(),kne=Sne();CE.exports=kne});var TE=v((Pye,wE)=>{"use strict";function Ine(t,o){var e=t.length;for(t.sort(o);e--;)t[e]=t[e].value;return t}wE.exports=Ine});var IE=v((Rye,kE)=>{"use strict";var SE=Qi();function Ene(t,o){if(t!==o){var e=t!==void 0,n=t===null,i=t===t,r=SE(t),a=o!==void 0,s=o===null,c=o===o,u=SE(o);if(!s&&!u&&!r&&t>o||r&&a&&c&&!s&&!u||n&&a&&c||!e&&c||!i)return 1;if(!n&&!r&&!u&&t<o||u&&e&&i&&!n&&!r||s&&e&&i||!a&&i||!c)return-1}return 0}kE.exports=Ene});var ME=v((Oye,EE)=>{"use strict";var Mne=IE();function Dne(t,o,e){for(var n=-1,i=t.criteria,r=o.criteria,a=i.length,s=e.length;++n<a;){var c=Mne(i[n],r[n]);if(c){if(n>=s)return c;var u=e[n];return c*(u=="desc"?-1:1)}}return t.index-o.index}EE.exports=Dne});var PE=v((Fye,DE)=>{"use strict";var Gg=Ia(),Pne=Ma(),Rne=Rn(),One=yg(),Fne=TE(),Nne=ya(),Ane=ME(),Lne=bi(),Bne=lt();function Vne(t,o,e){o.length?o=Gg(o,function(r){return Bne(r)?function(a){return Pne(a,r.length===1?r[0]:r)}:r}):o=[Lne];var n=-1;o=Gg(o,Nne(Rne));var i=One(t,function(r,a,s){var c=Gg(o,function(u){return u(r)});return{criteria:c,index:++n,value:r}});return Fne(i,function(r,a){return Ane(r,a,e)})}DE.exports=Vne});var FE=v((Nye,OE)=>{"use strict";var zne=$h(),Hne=PE(),qne=Da(),RE=Oa(),Gne=qne(function(t,o){if(t==null)return[];var e=o.length;return e>1&&RE(t,o[0],o[1])?o=[]:e>2&&RE(o[0],o[1],o[2])&&(o=[o[0]]),Hne(t,zne(o,1),[])});OE.exports=Gne});var AE=v((Aye,NE)=>{"use strict";var jne=hg(),Une=0;function $ne(t){var o=++Une;return jne(t)+o}NE.exports=$ne});var BE=v((Lye,LE)=>{"use strict";function Wne(t,o,e){for(var n=-1,i=t.length,r=o.length,a={};++n<i;){var s=n<r?o[n]:void 0;e(a,t[n],s)}return a}LE.exports=Wne});var zE=v((Bye,VE)=>{"use strict";var Kne=ga(),Yne=BE();function Xne(t,o){return Yne(t||[],o||[],Kne)}VE.exports=Xne});var et=v((Vye,HE)=>{"use strict";var ef;if(typeof no=="function")try{ef={cloneDeep:Qk(),constant:Vh(),defaults:nI(),each:ig(),filter:gg(),find:yI(),flatten:Bg(),forEach:ng(),forIn:wI(),has:bg(),isUndefined:vg(),last:SI(),map:Cg(),mapValues:II(),max:RI(),merge:QI(),min:tE(),minBy:iE(),now:rE(),pick:_E(),range:xE(),reduce:xg(),sortBy:FE(),uniqueId:AE(),values:Dg(),zipObject:zE()}}catch{}ef||(ef=window._);HE.exports=ef});var jE=v((Hye,GE)=>{"use strict";GE.exports=tf;function tf(){var t={};t._next=t._prev=t,this._sentinel=t}tf.prototype.dequeue=function(){var t=this._sentinel,o=t._prev;if(o!==t)return qE(o),o};tf.prototype.enqueue=function(t){var o=this._sentinel;t._prev&&t._next&&qE(t),t._next=o._next,o._next._prev=t,o._next=t,t._prev=o};tf.prototype.toString=function(){for(var t=[],o=this._sentinel,e=o._prev;e!==o;)t.push(JSON.stringify(e,Zne)),e=e._prev;return"["+t.join(", ")+"]"};function qE(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Zne(t,o){if(t!=="_next"&&t!=="_prev")return o}});var $E=v((qye,UE)=>{"use strict";var qn=et(),Qne=cn().Graph,Jne=jE();UE.exports=tie;var eie=qn.constant(1);function tie(t,o){if(t.nodeCount()<=1)return[];var e=iie(t,o||eie),n=nie(e.graph,e.buckets,e.zeroIdx);return qn.flatten(qn.map(n,function(i){return t.outEdges(i.v,i.w)}),!0)}function nie(t,o,e){for(var n=[],i=o[o.length-1],r=o[0],a;t.nodeCount();){for(;a=r.dequeue();)jg(t,o,e,a);for(;a=i.dequeue();)jg(t,o,e,a);if(t.nodeCount()){for(var s=o.length-2;s>0;--s)if(a=o[s].dequeue(),a){n=n.concat(jg(t,o,e,a,!0));break}}}return n}function jg(t,o,e,n,i){var r=i?[]:void 0;return qn.forEach(t.inEdges(n.v),function(a){var s=t.edge(a),c=t.node(a.v);i&&r.push({v:a.v,w:a.w}),c.out-=s,Ug(o,e,c)}),qn.forEach(t.outEdges(n.v),function(a){var s=t.edge(a),c=a.w,u=t.node(c);u.in-=s,Ug(o,e,u)}),t.removeNode(n.v),r}function iie(t,o){var e=new Qne,n=0,i=0;qn.forEach(t.nodes(),function(s){e.setNode(s,{v:s,in:0,out:0})}),qn.forEach(t.edges(),function(s){var c=e.edge(s.v,s.w)||0,u=o(s),h=c+u;e.setEdge(s.v,s.w,h),i=Math.max(i,e.node(s.v).out+=u),n=Math.max(n,e.node(s.w).in+=u)});var r=qn.range(i+n+3).map(function(){return new Jne}),a=n+1;return qn.forEach(e.nodes(),function(s){Ug(r,a,e.node(s))}),{graph:e,buckets:r,zeroIdx:a}}function Ug(t,o,e){e.out?e.in?t[e.out-e.in+o].enqueue(e):t[t.length-1].enqueue(e):t[0].enqueue(e)}});var KE=v((Gye,WE)=>{"use strict";var eo=et(),oie=$E();WE.exports={run:rie,undo:sie};function rie(t){var o=t.graph().acyclicer==="greedy"?oie(t,e(t)):aie(t);eo.forEach(o,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,eo.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function aie(t){var o=[],e={},n={};function i(r){eo.has(n,r)||(n[r]=!0,e[r]=!0,eo.forEach(t.outEdges(r),function(a){eo.has(e,a.w)?o.push(a):i(a.w)}),delete e[r])}return eo.forEach(t.nodes(),i),o}function sie(t){eo.forEach(t.edges(),function(o){var e=t.edge(o);if(e.reversed){t.removeEdge(o);var n=e.forwardName;delete e.reversed,delete e.forwardName,t.setEdge(o.w,o.v,e,n)}})}});var Nt=v((jye,QE)=>{"use strict";var Ae=et(),YE=cn().Graph;QE.exports={addDummyNode:XE,simplify:lie,asNonCompoundGraph:cie,successorWeights:die,predecessorWeights:uie,intersectRect:pie,buildLayerMatrix:hie,normalizeRanks:fie,removeEmptyRanks:mie,addBorderNode:_ie,maxRank:ZE,partition:gie,time:bie,notime:vie};function XE(t,o,e,n){var i;do i=Ae.uniqueId(n);while(t.hasNode(i));return e.dummy=o,t.setNode(i,e),i}function lie(t){var o=new YE().setGraph(t.graph());return Ae.forEach(t.nodes(),function(e){o.setNode(e,t.node(e))}),Ae.forEach(t.edges(),function(e){var n=o.edge(e.v,e.w)||{weight:0,minlen:1},i=t.edge(e);o.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),o}function cie(t){var o=new YE({multigraph:t.isMultigraph()}).setGraph(t.graph());return Ae.forEach(t.nodes(),function(e){t.children(e).length||o.setNode(e,t.node(e))}),Ae.forEach(t.edges(),function(e){o.setEdge(e,t.edge(e))}),o}function die(t){var o=Ae.map(t.nodes(),function(e){var n={};return Ae.forEach(t.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+t.edge(i).weight}),n});return Ae.zipObject(t.nodes(),o)}function uie(t){var o=Ae.map(t.nodes(),function(e){var n={};return Ae.forEach(t.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+t.edge(i).weight}),n});return Ae.zipObject(t.nodes(),o)}function pie(t,o){var e=t.x,n=t.y,i=o.x-e,r=o.y-n,a=t.width/2,s=t.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");var c,u;return Math.abs(r)*a>Math.abs(i)*s?(r<0&&(s=-s),c=s*i/r,u=s):(i<0&&(a=-a),c=a,u=a*r/i),{x:e+c,y:n+u}}function hie(t){var o=Ae.map(Ae.range(ZE(t)+1),function(){return[]});return Ae.forEach(t.nodes(),function(e){var n=t.node(e),i=n.rank;Ae.isUndefined(i)||(o[i][n.order]=e)}),o}function fie(t){var o=Ae.min(Ae.map(t.nodes(),function(e){return t.node(e).rank}));Ae.forEach(t.nodes(),function(e){var n=t.node(e);Ae.has(n,"rank")&&(n.rank-=o)})}function mie(t){var o=Ae.min(Ae.map(t.nodes(),function(r){return t.node(r).rank})),e=[];Ae.forEach(t.nodes(),function(r){var a=t.node(r).rank-o;e[a]||(e[a]=[]),e[a].push(r)});var n=0,i=t.graph().nodeRankFactor;Ae.forEach(e,function(r,a){Ae.isUndefined(r)&&a%i!==0?--n:n&&Ae.forEach(r,function(s){t.node(s).rank+=n})})}function _ie(t,o,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),XE(t,"border",i,o)}function ZE(t){return Ae.max(Ae.map(t.nodes(),function(o){var e=t.node(o).rank;if(!Ae.isUndefined(e))return e}))}function gie(t,o){var e={lhs:[],rhs:[]};return Ae.forEach(t,function(n){o(n)?e.lhs.push(n):e.rhs.push(n)}),e}function bie(t,o){var e=Ae.now();try{return o()}finally{console.log(t+" time: "+(Ae.now()-e)+"ms")}}function vie(t,o){return o()}});var tM=v((Uye,eM)=>{"use strict";var JE=et(),yie=Nt();eM.exports={run:Cie,undo:wie};function Cie(t){t.graph().dummyChains=[],JE.forEach(t.edges(),function(o){xie(t,o)})}function xie(t,o){var e=o.v,n=t.node(e).rank,i=o.w,r=t.node(i).rank,a=o.name,s=t.edge(o),c=s.labelRank;if(r!==n+1){t.removeEdge(o);var u,h,g;for(g=0,++n;n<r;++g,++n)s.points=[],h={width:0,height:0,edgeLabel:s,edgeObj:o,rank:n},u=yie.addDummyNode(t,"edge",h,"_d"),n===c&&(h.width=s.width,h.height=s.height,h.dummy="edge-label",h.labelpos=s.labelpos),t.setEdge(e,u,{weight:s.weight},a),g===0&&t.graph().dummyChains.push(u),e=u;t.setEdge(e,i,{weight:s.weight},a)}}function wie(t){JE.forEach(t.graph().dummyChains,function(o){var e=t.node(o),n=e.edgeLabel,i;for(t.setEdge(e.edgeObj,n);e.dummy;)i=t.successors(o)[0],t.removeNode(o),n.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(n.x=e.x,n.y=e.y,n.width=e.width,n.height=e.height),o=i,e=t.node(o)})}});var Fa=v(($ye,nM)=>{"use strict";var nf=et();nM.exports={longestPath:Tie,slack:Sie};function Tie(t){var o={};function e(n){var i=t.node(n);if(nf.has(o,n))return i.rank;o[n]=!0;var r=nf.min(nf.map(t.outEdges(n),function(a){return e(a.w)-t.edge(a).minlen}));return(r===Number.POSITIVE_INFINITY||r===void 0||r===null)&&(r=0),i.rank=r}nf.forEach(t.sources(),e)}function Sie(t,o){return t.node(o.w).rank-t.node(o.v).rank-t.edge(o).minlen}});var $g=v((Wye,iM)=>{"use strict";var of=et(),kie=cn().Graph,rf=Fa().slack;iM.exports=Iie;function Iie(t){var o=new kie({directed:!1}),e=t.nodes()[0],n=t.nodeCount();o.setNode(e,{});for(var i,r;Eie(o,t)<n;)i=Mie(o,t),r=o.hasNode(i.v)?rf(t,i):-rf(t,i),Die(o,t,r);return o}function Eie(t,o){function e(n){of.forEach(o.nodeEdges(n),function(i){var r=i.v,a=n===r?i.w:r;!t.hasNode(a)&&!rf(o,i)&&(t.setNode(a,{}),t.setEdge(n,a,{}),e(a))})}return of.forEach(t.nodes(),e),t.nodeCount()}function Mie(t,o){return of.minBy(o.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w))return rf(o,e)})}function Die(t,o,e){of.forEach(t.nodes(),function(n){o.node(n).rank+=e})}});var uM=v((Kye,dM)=>{"use strict";var Gn=et(),Pie=$g(),Rie=Fa().slack,Oie=Fa().longestPath,Fie=cn().alg.preorder,Nie=cn().alg.postorder,Aie=Nt().simplify;dM.exports=to;to.initLowLimValues=Kg;to.initCutValues=Wg;to.calcCutValue=rM;to.leaveEdge=sM;to.enterEdge=lM;to.exchangeEdges=cM;function to(t){t=Aie(t),Oie(t);var o=Pie(t);Kg(o),Wg(o,t);for(var e,n;e=sM(o);)n=lM(o,t,e),cM(o,t,e,n)}function Wg(t,o){var e=Nie(t,t.nodes());e=e.slice(0,e.length-1),Gn.forEach(e,function(n){Lie(t,o,n)})}function Lie(t,o,e){var n=t.node(e),i=n.parent;t.edge(e,i).cutvalue=rM(t,o,e)}function rM(t,o,e){var n=t.node(e),i=n.parent,r=!0,a=o.edge(e,i),s=0;return a||(r=!1,a=o.edge(i,e)),s=a.weight,Gn.forEach(o.nodeEdges(e),function(c){var u=c.v===e,h=u?c.w:c.v;if(h!==i){var g=u===r,C=o.edge(c).weight;if(s+=g?C:-C,Vie(t,e,h)){var k=t.edge(e,h).cutvalue;s+=g?-k:k}}}),s}function Kg(t,o){arguments.length<2&&(o=t.nodes()[0]),aM(t,{},1,o)}function aM(t,o,e,n,i){var r=e,a=t.node(n);return o[n]=!0,Gn.forEach(t.neighbors(n),function(s){Gn.has(o,s)||(e=aM(t,o,e,s,n))}),a.low=r,a.lim=e++,i?a.parent=i:delete a.parent,e}function sM(t){return Gn.find(t.edges(),function(o){return t.edge(o).cutvalue<0})}function lM(t,o,e){var n=e.v,i=e.w;o.hasEdge(n,i)||(n=e.w,i=e.v);var r=t.node(n),a=t.node(i),s=r,c=!1;r.lim>a.lim&&(s=a,c=!0);var u=Gn.filter(o.edges(),function(h){return c===oM(t,t.node(h.v),s)&&c!==oM(t,t.node(h.w),s)});return Gn.minBy(u,function(h){return Rie(o,h)})}function cM(t,o,e,n){var i=e.v,r=e.w;t.removeEdge(i,r),t.setEdge(n.v,n.w,{}),Kg(t),Wg(t,o),Bie(t,o)}function Bie(t,o){var e=Gn.find(t.nodes(),function(i){return!o.node(i).parent}),n=Fie(t,e);n=n.slice(1),Gn.forEach(n,function(i){var r=t.node(i).parent,a=o.edge(i,r),s=!1;a||(a=o.edge(r,i),s=!0),o.node(i).rank=o.node(r).rank+(s?a.minlen:-a.minlen)})}function Vie(t,o,e){return t.hasEdge(o,e)}function oM(t,o,e){return e.low<=o.lim&&o.lim<=e.lim}});var mM=v((Yye,fM)=>{"use strict";var zie=Fa(),hM=zie.longestPath,Hie=$g(),qie=uM();fM.exports=Gie;function Gie(t){switch(t.graph().ranker){case"network-simplex":pM(t);break;case"tight-tree":Uie(t);break;case"longest-path":jie(t);break;default:pM(t)}}var jie=hM;function Uie(t){hM(t),Hie(t)}function pM(t){qie(t)}});var gM=v((Xye,_M)=>{"use strict";var Yg=et();_M.exports=$ie;function $ie(t){var o=Kie(t);Yg.forEach(t.graph().dummyChains,function(e){for(var n=t.node(e),i=n.edgeObj,r=Wie(t,o,i.v,i.w),a=r.path,s=r.lca,c=0,u=a[c],h=!0;e!==i.w;){if(n=t.node(e),h){for(;(u=a[c])!==s&&t.node(u).maxRank<n.rank;)c++;u===s&&(h=!1)}if(!h){for(;c<a.length-1&&t.node(u=a[c+1]).minRank<=n.rank;)c++;u=a[c]}t.setParent(e,u),e=t.successors(e)[0]}})}function Wie(t,o,e,n){var i=[],r=[],a=Math.min(o[e].low,o[n].low),s=Math.max(o[e].lim,o[n].lim),c,u;c=e;do c=t.parent(c),i.push(c);while(c&&(o[c].low>a||s>o[c].lim));for(u=c,c=n;(c=t.parent(c))!==u;)r.push(c);return{path:i.concat(r.reverse()),lca:u}}function Kie(t){var o={},e=0;function n(i){var r=e;Yg.forEach(t.children(i),n),o[i]={low:r,lim:e++}}return Yg.forEach(t.children(),n),o}});var yM=v((Zye,vM)=>{"use strict";var jn=et(),Xg=Nt();vM.exports={run:Yie,cleanup:Qie};function Yie(t){var o=Xg.addDummyNode(t,"root",{},"_root"),e=Xie(t),n=jn.max(jn.values(e))-1,i=2*n+1;t.graph().nestingRoot=o,jn.forEach(t.edges(),function(a){t.edge(a).minlen*=i});var r=Zie(t)+1;jn.forEach(t.children(),function(a){bM(t,o,i,r,n,e,a)}),t.graph().nodeRankFactor=i}function bM(t,o,e,n,i,r,a){var s=t.children(a);if(!s.length){a!==o&&t.setEdge(o,a,{weight:0,minlen:e});return}var c=Xg.addBorderNode(t,"_bt"),u=Xg.addBorderNode(t,"_bb"),h=t.node(a);t.setParent(c,a),h.borderTop=c,t.setParent(u,a),h.borderBottom=u,jn.forEach(s,function(g){bM(t,o,e,n,i,r,g);var C=t.node(g),k=C.borderTop?C.borderTop:g,I=C.borderBottom?C.borderBottom:g,N=C.borderTop?n:2*n,q=k!==I?1:i-r[a]+1;t.setEdge(c,k,{weight:N,minlen:q,nestingEdge:!0}),t.setEdge(I,u,{weight:N,minlen:q,nestingEdge:!0})}),t.parent(a)||t.setEdge(o,c,{weight:0,minlen:i+r[a]})}function Xie(t){var o={};function e(n,i){var r=t.children(n);r&&r.length&&jn.forEach(r,function(a){e(a,i+1)}),o[n]=i}return jn.forEach(t.children(),function(n){e(n,1)}),o}function Zie(t){return jn.reduce(t.edges(),function(o,e){return o+t.edge(e).weight},0)}function Qie(t){var o=t.graph();t.removeNode(o.nestingRoot),delete o.nestingRoot,jn.forEach(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}});var wM=v((Qye,xM)=>{"use strict";var Zg=et(),Jie=Nt();xM.exports=eoe;function eoe(t){function o(e){var n=t.children(e),i=t.node(e);if(n.length&&Zg.forEach(n,o),Zg.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var r=i.minRank,a=i.maxRank+1;r<a;++r)CM(t,"borderLeft","_bl",e,i,r),CM(t,"borderRight","_br",e,i,r)}}Zg.forEach(t.children(),o)}function CM(t,o,e,n,i,r){var a={width:0,height:0,rank:r,borderType:o},s=i[o][r-1],c=Jie.addDummyNode(t,"border",a,e);i[o][r]=c,t.setParent(c,n),s&&t.setEdge(s,c,{weight:1})}});var IM=v((Jye,kM)=>{"use strict";var Fn=et();kM.exports={adjust:toe,undo:noe};function toe(t){var o=t.graph().rankdir.toLowerCase();(o==="lr"||o==="rl")&&SM(t)}function noe(t){var o=t.graph().rankdir.toLowerCase();(o==="bt"||o==="rl")&&ioe(t),(o==="lr"||o==="rl")&&(ooe(t),SM(t))}function SM(t){Fn.forEach(t.nodes(),function(o){TM(t.node(o))}),Fn.forEach(t.edges(),function(o){TM(t.edge(o))})}function TM(t){var o=t.width;t.width=t.height,t.height=o}function ioe(t){Fn.forEach(t.nodes(),function(o){Qg(t.node(o))}),Fn.forEach(t.edges(),function(o){var e=t.edge(o);Fn.forEach(e.points,Qg),Fn.has(e,"y")&&Qg(e)})}function Qg(t){t.y=-t.y}function ooe(t){Fn.forEach(t.nodes(),function(o){Jg(t.node(o))}),Fn.forEach(t.edges(),function(o){var e=t.edge(o);Fn.forEach(e.points,Jg),Fn.has(e,"x")&&Jg(e)})}function Jg(t){var o=t.x;t.x=t.y,t.y=o}});var MM=v((eCe,EM)=>{"use strict";var Un=et();EM.exports=roe;function roe(t){var o={},e=Un.filter(t.nodes(),function(s){return!t.children(s).length}),n=Un.max(Un.map(e,function(s){return t.node(s).rank})),i=Un.map(Un.range(n+1),function(){return[]});function r(s){if(!Un.has(o,s)){o[s]=!0;var c=t.node(s);i[c.rank].push(s),Un.forEach(t.successors(s),r)}}var a=Un.sortBy(e,function(s){return t.node(s).rank});return Un.forEach(a,r),i}});var PM=v((tCe,DM)=>{"use strict";var vi=et();DM.exports=aoe;function aoe(t,o){for(var e=0,n=1;n<o.length;++n)e+=soe(t,o[n-1],o[n]);return e}function soe(t,o,e){for(var n=vi.zipObject(e,vi.map(e,function(u,h){return h})),i=vi.flatten(vi.map(o,function(u){return vi.sortBy(vi.map(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")}),!0),r=1;r<e.length;)r<<=1;var a=2*r-1;r-=1;var s=vi.map(new Array(a),function(){return 0}),c=0;return vi.forEach(i.forEach(function(u){var h=u.pos+r;s[h]+=u.weight;for(var g=0;h>0;)h%2&&(g+=s[h+1]),h=h-1>>1,s[h]+=u.weight;c+=u.weight*g})),c}});var FM=v((nCe,OM)=>{"use strict";var RM=et();OM.exports=loe;function loe(t,o){return RM.map(o,function(e){var n=t.inEdges(e);if(n.length){var i=RM.reduce(n,function(r,a){var s=t.edge(a),c=t.node(a.v);return{sum:r.sum+s.weight*c.order,weight:r.weight+s.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}});var AM=v((iCe,NM)=>{"use strict";var Zt=et();NM.exports=coe;function coe(t,o){var e={};Zt.forEach(t,function(i,r){var a=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:r};Zt.isUndefined(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),Zt.forEach(o.edges(),function(i){var r=e[i.v],a=e[i.w];!Zt.isUndefined(r)&&!Zt.isUndefined(a)&&(a.indegree++,r.out.push(e[i.w]))});var n=Zt.filter(e,function(i){return!i.indegree});return doe(n)}function doe(t){var o=[];function e(r){return function(a){a.merged||(Zt.isUndefined(a.barycenter)||Zt.isUndefined(r.barycenter)||a.barycenter>=r.barycenter)&&uoe(r,a)}}function n(r){return function(a){a.in.push(r),--a.indegree===0&&t.push(a)}}for(;t.length;){var i=t.pop();o.push(i),Zt.forEach(i.in.reverse(),e(i)),Zt.forEach(i.out,n(i))}return Zt.map(Zt.filter(o,function(r){return!r.merged}),function(r){return Zt.pick(r,["vs","i","barycenter","weight"])})}function uoe(t,o){var e=0,n=0;t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),o.weight&&(e+=o.barycenter*o.weight,n+=o.weight),t.vs=o.vs.concat(t.vs),t.barycenter=e/n,t.weight=n,t.i=Math.min(o.i,t.i),o.merged=!0}});var VM=v((oCe,BM)=>{"use strict";var Na=et(),poe=Nt();BM.exports=hoe;function hoe(t,o){var e=poe.partition(t,function(h){return Na.has(h,"barycenter")}),n=e.lhs,i=Na.sortBy(e.rhs,function(h){return-h.i}),r=[],a=0,s=0,c=0;n.sort(foe(!!o)),c=LM(r,i,c),Na.forEach(n,function(h){c+=h.vs.length,r.push(h.vs),a+=h.barycenter*h.weight,s+=h.weight,c=LM(r,i,c)});var u={vs:Na.flatten(r,!0)};return s&&(u.barycenter=a/s,u.weight=s),u}function LM(t,o,e){for(var n;o.length&&(n=Na.last(o)).i<=e;)o.pop(),t.push(n.vs),e++;return e}function foe(t){return function(o,e){return o.barycenter<e.barycenter?-1:o.barycenter>e.barycenter?1:t?e.i-o.i:o.i-e.i}}});var qM=v((rCe,HM)=>{"use strict";var yi=et(),moe=FM(),_oe=AM(),goe=VM();HM.exports=zM;function zM(t,o,e,n){var i=t.children(o),r=t.node(o),a=r?r.borderLeft:void 0,s=r?r.borderRight:void 0,c={};a&&(i=yi.filter(i,function(I){return I!==a&&I!==s}));var u=moe(t,i);yi.forEach(u,function(I){if(t.children(I.v).length){var N=zM(t,I.v,e,n);c[I.v]=N,yi.has(N,"barycenter")&&voe(I,N)}});var h=_oe(u,e);boe(h,c);var g=goe(h,n);if(a&&(g.vs=yi.flatten([a,g.vs,s],!0),t.predecessors(a).length)){var C=t.node(t.predecessors(a)[0]),k=t.node(t.predecessors(s)[0]);yi.has(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+C.order+k.order)/(g.weight+2),g.weight+=2}return g}function boe(t,o){yi.forEach(t,function(e){e.vs=yi.flatten(e.vs.map(function(n){return o[n]?o[n].vs:n}),!0)})}function voe(t,o){yi.isUndefined(t.barycenter)?(t.barycenter=o.barycenter,t.weight=o.weight):(t.barycenter=(t.barycenter*t.weight+o.barycenter*o.weight)/(t.weight+o.weight),t.weight+=o.weight)}});var jM=v((aCe,GM)=>{"use strict";var Aa=et(),yoe=cn().Graph;GM.exports=Coe;function Coe(t,o,e){var n=xoe(t),i=new yoe({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(r){return t.node(r)});return Aa.forEach(t.nodes(),function(r){var a=t.node(r),s=t.parent(r);(a.rank===o||a.minRank<=o&&o<=a.maxRank)&&(i.setNode(r),i.setParent(r,s||n),Aa.forEach(t[e](r),function(c){var u=c.v===r?c.w:c.v,h=i.edge(u,r),g=Aa.isUndefined(h)?0:h.weight;i.setEdge(u,r,{weight:t.edge(c).weight+g})}),Aa.has(a,"minRank")&&i.setNode(r,{borderLeft:a.borderLeft[o],borderRight:a.borderRight[o]}))}),i}function xoe(t){for(var o;t.hasNode(o=Aa.uniqueId("_root")););return o}});var $M=v((sCe,UM)=>{"use strict";var woe=et();UM.exports=Toe;function Toe(t,o,e){var n={},i;woe.forEach(e,function(r){for(var a=t.parent(r),s,c;a;){if(s=t.parent(a),s?(c=n[s],n[s]=a):(c=i,i=a),c&&c!==a){o.setEdge(c,a);return}a=s}})}});var ZM=v((lCe,XM)=>{"use strict";var Ci=et(),Soe=MM(),koe=PM(),Ioe=qM(),Eoe=jM(),Moe=$M(),Doe=cn().Graph,WM=Nt();XM.exports=Poe;function Poe(t){var o=WM.maxRank(t),e=KM(t,Ci.range(1,o+1),"inEdges"),n=KM(t,Ci.range(o-1,-1,-1),"outEdges"),i=Soe(t);YM(t,i);for(var r=Number.POSITIVE_INFINITY,a,s=0,c=0;c<4;++s,++c){Roe(s%2?e:n,s%4>=2),i=WM.buildLayerMatrix(t);var u=koe(t,i);u<r&&(c=0,a=Ci.cloneDeep(i),r=u)}YM(t,a)}function KM(t,o,e){return Ci.map(o,function(n){return Eoe(t,n,e)})}function Roe(t,o){var e=new Doe;Ci.forEach(t,function(n){var i=n.graph().root,r=Ioe(n,i,e,o);Ci.forEach(r.vs,function(a,s){n.node(a).order=s}),Moe(n,e,r.vs)})}function YM(t,o){Ci.forEach(o,function(e){Ci.forEach(e,function(n,i){t.node(n).order=i})})}});var sD=v((cCe,aD)=>{"use strict";var ye=et(),Ooe=cn().Graph,Foe=Nt();aD.exports={positionX:Loe,findType1Conflicts:QM,findType2Conflicts:JM,addConflict:e0,hasConflict:eD,verticalAlignment:tD,horizontalCompaction:nD,alignCoordinates:oD,findSmallestWidthAlignment:iD,balance:rD};function QM(t,o){var e={};function n(i,r){var a=0,s=0,c=i.length,u=ye.last(r);return ye.forEach(r,function(h,g){var C=Noe(t,h),k=C?t.node(C).order:c;(C||h===u)&&(ye.forEach(r.slice(s,g+1),function(I){ye.forEach(t.predecessors(I),function(N){var q=t.node(N),Y=q.order;(Y<a||k<Y)&&!(q.dummy&&t.node(I).dummy)&&e0(e,N,I)})}),s=g+1,a=k)}),r}return ye.reduce(o,n),e}function JM(t,o){var e={};function n(r,a,s,c,u){var h;ye.forEach(ye.range(a,s),function(g){h=r[g],t.node(h).dummy&&ye.forEach(t.predecessors(h),function(C){var k=t.node(C);k.dummy&&(k.order<c||k.order>u)&&e0(e,C,h)})})}function i(r,a){var s=-1,c,u=0;return ye.forEach(a,function(h,g){if(t.node(h).dummy==="border"){var C=t.predecessors(h);C.length&&(c=t.node(C[0]).order,n(a,u,g,s,c),u=g,s=c)}n(a,u,a.length,c,r.length)}),a}return ye.reduce(o,i),e}function Noe(t,o){if(t.node(o).dummy)return ye.find(t.predecessors(o),function(e){return t.node(e).dummy})}function e0(t,o,e){if(o>e){var n=o;o=e,e=n}var i=t[o];i||(t[o]=i={}),i[e]=!0}function eD(t,o,e){if(o>e){var n=o;o=e,e=n}return ye.has(t[o],e)}function tD(t,o,e,n){var i={},r={},a={};return ye.forEach(o,function(s){ye.forEach(s,function(c,u){i[c]=c,r[c]=c,a[c]=u})}),ye.forEach(o,function(s){var c=-1;ye.forEach(s,function(u){var h=n(u);if(h.length){h=ye.sortBy(h,function(N){return a[N]});for(var g=(h.length-1)/2,C=Math.floor(g),k=Math.ceil(g);C<=k;++C){var I=h[C];r[u]===u&&c<a[I]&&!eD(e,u,I)&&(r[I]=u,r[u]=i[u]=i[I],c=a[I])}}})}),{root:i,align:r}}function nD(t,o,e,n,i){var r={},a=Aoe(t,o,e,i),s=i?"borderLeft":"borderRight";function c(g,C){for(var k=a.nodes(),I=k.pop(),N={};I;)N[I]?g(I):(N[I]=!0,k.push(I),k=k.concat(C(I))),I=k.pop()}function u(g){r[g]=a.inEdges(g).reduce(function(C,k){return Math.max(C,r[k.v]+a.edge(k))},0)}function h(g){var C=a.outEdges(g).reduce(function(I,N){return Math.min(I,r[N.w]-a.edge(N))},Number.POSITIVE_INFINITY),k=t.node(g);C!==Number.POSITIVE_INFINITY&&k.borderType!==s&&(r[g]=Math.max(r[g],C))}return c(u,a.predecessors.bind(a)),c(h,a.successors.bind(a)),ye.forEach(n,function(g){r[g]=r[e[g]]}),r}function Aoe(t,o,e,n){var i=new Ooe,r=t.graph(),a=Boe(r.nodesep,r.edgesep,n);return ye.forEach(o,function(s){var c;ye.forEach(s,function(u){var h=e[u];if(i.setNode(h),c){var g=e[c],C=i.edge(g,h);i.setEdge(g,h,Math.max(a(t,u,c),C||0))}c=u})}),i}function iD(t,o){return ye.minBy(ye.values(o),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return ye.forIn(e,function(r,a){var s=Voe(t,a)/2;n=Math.max(r+s,n),i=Math.min(r-s,i)}),n-i})}function oD(t,o){var e=ye.values(o),n=ye.min(e),i=ye.max(e);ye.forEach(["u","d"],function(r){ye.forEach(["l","r"],function(a){var s=r+a,c=t[s],u;if(c!==o){var h=ye.values(c);u=a==="l"?n-ye.min(h):i-ye.max(h),u&&(t[s]=ye.mapValues(c,function(g){return g+u}))}})})}function rD(t,o){return ye.mapValues(t.ul,function(e,n){if(o)return t[o.toLowerCase()][n];var i=ye.sortBy(ye.map(t,n));return(i[1]+i[2])/2})}function Loe(t){var o=Foe.buildLayerMatrix(t),e=ye.merge(QM(t,o),JM(t,o)),n={},i;ye.forEach(["u","d"],function(a){i=a==="u"?o:ye.values(o).reverse(),ye.forEach(["l","r"],function(s){s==="r"&&(i=ye.map(i,function(g){return ye.values(g).reverse()}));var c=(a==="u"?t.predecessors:t.successors).bind(t),u=tD(t,i,e,c),h=nD(t,i,u.root,u.align,s==="r");s==="r"&&(h=ye.mapValues(h,function(g){return-g})),n[a+s]=h})});var r=iD(t,n);return oD(n,r),rD(n,t.graph().align)}function Boe(t,o,e){return function(n,i,r){var a=n.node(i),s=n.node(r),c=0,u;if(c+=a.width/2,ye.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=e?u:-u),u=0,c+=(a.dummy?o:t)/2,c+=(s.dummy?o:t)/2,c+=s.width/2,ye.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(c+=e?u:-u),u=0,c}}function Voe(t,o){return t.node(o).width}});var dD=v((dCe,cD)=>{"use strict";var La=et(),lD=Nt(),zoe=sD().positionX;cD.exports=Hoe;function Hoe(t){t=lD.asNonCompoundGraph(t),qoe(t),La.forEach(zoe(t),function(o,e){t.node(e).x=o})}function qoe(t){var o=lD.buildLayerMatrix(t),e=t.graph().ranksep,n=0;La.forEach(o,function(i){var r=La.max(La.map(i,function(a){return t.node(a).height}));La.forEach(i,function(a){t.node(a).y=n+r/2}),n+=r+e})}});var _D=v((uCe,mD)=>{"use strict";var Me=et(),uD=KE(),pD=tM(),Goe=mM(),joe=Nt().normalizeRanks,Uoe=gM(),$oe=Nt().removeEmptyRanks,hD=yM(),Woe=wM(),fD=IM(),Koe=ZM(),Yoe=dD(),xi=Nt(),Xoe=cn().Graph;mD.exports=Zoe;function Zoe(t,o){var e=o&&o.debugTiming?xi.time:xi.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return lre(t)});e(" runLayout",function(){Qoe(n,e)}),e(" updateInputGraph",function(){Joe(t,n)})})}function Qoe(t,o){o(" makeSpaceForEdgeLabels",function(){cre(t)}),o(" removeSelfEdges",function(){bre(t)}),o(" acyclic",function(){uD.run(t)}),o(" nestingGraph.run",function(){hD.run(t)}),o(" rank",function(){Goe(xi.asNonCompoundGraph(t))}),o(" injectEdgeLabelProxies",function(){dre(t)}),o(" removeEmptyRanks",function(){$oe(t)}),o(" nestingGraph.cleanup",function(){hD.cleanup(t)}),o(" normalizeRanks",function(){joe(t)}),o(" assignRankMinMax",function(){ure(t)}),o(" removeEdgeLabelProxies",function(){pre(t)}),o(" normalize.run",function(){pD.run(t)}),o(" parentDummyChains",function(){Uoe(t)}),o(" addBorderSegments",function(){Woe(t)}),o(" order",function(){Koe(t)}),o(" insertSelfEdges",function(){vre(t)}),o(" adjustCoordinateSystem",function(){fD.adjust(t)}),o(" position",function(){Yoe(t)}),o(" positionSelfEdges",function(){yre(t)}),o(" removeBorderNodes",function(){gre(t)}),o(" normalize.undo",function(){pD.undo(t)}),o(" fixupEdgeLabelCoords",function(){mre(t)}),o(" undoCoordinateSystem",function(){fD.undo(t)}),o(" translateGraph",function(){hre(t)}),o(" assignNodeIntersects",function(){fre(t)}),o(" reversePoints",function(){_re(t)}),o(" acyclic.undo",function(){uD.undo(t)})}function Joe(t,o){Me.forEach(t.nodes(),function(e){var n=t.node(e),i=o.node(e);n&&(n.x=i.x,n.y=i.y,o.children(e).length&&(n.width=i.width,n.height=i.height))}),Me.forEach(t.edges(),function(e){var n=t.edge(e),i=o.edge(e);n.points=i.points,Me.has(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=o.graph().width,t.graph().height=o.graph().height}var ere=["nodesep","edgesep","ranksep","marginx","marginy"],tre={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nre=["acyclicer","ranker","rankdir","align"],ire=["width","height"],ore={width:0,height:0},rre=["minlen","weight","width","height","labeloffset"],are={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sre=["labelpos"];function lre(t){var o=new Xoe({multigraph:!0,compound:!0}),e=n0(t.graph());return o.setGraph(Me.merge({},tre,t0(e,ere),Me.pick(e,nre))),Me.forEach(t.nodes(),function(n){var i=n0(t.node(n));o.setNode(n,Me.defaults(t0(i,ire),ore)),o.setParent(n,t.parent(n))}),Me.forEach(t.edges(),function(n){var i=n0(t.edge(n));o.setEdge(n,Me.merge({},are,t0(i,rre),Me.pick(i,sre)))}),o}function cre(t){var o=t.graph();o.ranksep/=2,Me.forEach(t.edges(),function(e){var n=t.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(o.rankdir==="TB"||o.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function dre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);if(e.width&&e.height){var n=t.node(o.v),i=t.node(o.w),r={rank:(i.rank-n.rank)/2+n.rank,e:o};xi.addDummyNode(t,"edge-proxy",r,"_ep")}})}function ure(t){var o=0;Me.forEach(t.nodes(),function(e){var n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,o=Me.max(o,n.maxRank))}),t.graph().maxRank=o}function pre(t){Me.forEach(t.nodes(),function(o){var e=t.node(o);e.dummy==="edge-proxy"&&(t.edge(e.e).labelRank=e.rank,t.removeNode(o))})}function hre(t){var o=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,i=0,r=t.graph(),a=r.marginx||0,s=r.marginy||0;function c(u){var h=u.x,g=u.y,C=u.width,k=u.height;o=Math.min(o,h-C/2),e=Math.max(e,h+C/2),n=Math.min(n,g-k/2),i=Math.max(i,g+k/2)}Me.forEach(t.nodes(),function(u){c(t.node(u))}),Me.forEach(t.edges(),function(u){var h=t.edge(u);Me.has(h,"x")&&c(h)}),o-=a,n-=s,Me.forEach(t.nodes(),function(u){var h=t.node(u);h.x-=o,h.y-=n}),Me.forEach(t.edges(),function(u){var h=t.edge(u);Me.forEach(h.points,function(g){g.x-=o,g.y-=n}),Me.has(h,"x")&&(h.x-=o),Me.has(h,"y")&&(h.y-=n)}),r.width=e-o+a,r.height=i-n+s}function fre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o),n=t.node(o.v),i=t.node(o.w),r,a;e.points?(r=e.points[0],a=e.points[e.points.length-1]):(e.points=[],r=i,a=n),e.points.unshift(xi.intersectRect(n,r)),e.points.push(xi.intersectRect(i,a))})}function mre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);if(Me.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function _re(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);e.reversed&&e.points.reverse()})}function gre(t){Me.forEach(t.nodes(),function(o){if(t.children(o).length){var e=t.node(o),n=t.node(e.borderTop),i=t.node(e.borderBottom),r=t.node(Me.last(e.borderLeft)),a=t.node(Me.last(e.borderRight));e.width=Math.abs(a.x-r.x),e.height=Math.abs(i.y-n.y),e.x=r.x+e.width/2,e.y=n.y+e.height/2}}),Me.forEach(t.nodes(),function(o){t.node(o).dummy==="border"&&t.removeNode(o)})}function bre(t){Me.forEach(t.edges(),function(o){if(o.v===o.w){var e=t.node(o.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:o,label:t.edge(o)}),t.removeEdge(o)}})}function vre(t){var o=xi.buildLayerMatrix(t);Me.forEach(o,function(e){var n=0;Me.forEach(e,function(i,r){var a=t.node(i);a.order=r+n,Me.forEach(a.selfEdges,function(s){xi.addDummyNode(t,"selfedge",{width:s.label.width,height:s.label.height,rank:a.rank,order:r+ ++n,e:s.e,label:s.label},"_se")}),delete a.selfEdges})})}function yre(t){Me.forEach(t.nodes(),function(o){var e=t.node(o);if(e.dummy==="selfedge"){var n=t.node(e.e.v),i=n.x+n.width/2,r=n.y,a=e.x-i,s=n.height/2;t.setEdge(e.e,e.label),t.removeNode(o),e.label.points=[{x:i+2*a/3,y:r-s},{x:i+5*a/6,y:r-s},{x:i+a,y:r},{x:i+5*a/6,y:r+s},{x:i+2*a/3,y:r+s}],e.label.x=e.x,e.label.y=e.y}})}function t0(t,o){return Me.mapValues(Me.pick(t,o),Number)}function n0(t){var o={};return Me.forEach(t,function(e,n){o[n.toLowerCase()]=e}),o}});var bD=v((pCe,gD)=>{"use strict";var af=et(),Cre=Nt(),xre=cn().Graph;gD.exports={debugOrdering:wre};function wre(t){var o=Cre.buildLayerMatrix(t),e=new xre({compound:!0,multigraph:!0}).setGraph({});return af.forEach(t.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+t.node(n).rank)}),af.forEach(t.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),af.forEach(o,function(n,i){var r="layer"+i;e.setNode(r,{rank:"same"}),af.reduce(n,function(a,s){return e.setEdge(a,s,{style:"invis"}),s})}),e}});var yD=v((hCe,vD)=>{"use strict";vD.exports="0.8.5"});var xD=v((fCe,CD)=>{"use strict";CD.exports={graphlib:cn(),layout:_D(),debug:bD(),util:{time:Nt().time,notime:Nt().notime},version:yD()}});var Ob={rail:{label:"Files",collapse:"Collapse files panel",expand:"Expand files panel",resize:"Resize files panel",searchPlaceholder:"Search\u2026",searchAriaLabel:"Search nodes by name or tag"}};var ps=new be("MAP_ISOLATE_INTENT",{providedIn:"root",factory:()=>({isolate:()=>{}})});var Fb=`
1
+ import{a as Xn,b as Zn,d as sb,e as lb,f as cb,g as hb,h as fb,i as bo}from"./chunk-GEI6INVH.js";import{A as kb,B as Ib,C as Eb,D as Jn,E as Mb,G as Db,H as Pb,I as Nf,J as Af,K as Rb,a as is,b as po,c as Y0,d as X0,e as ho,f as Z0,g as vr,h as Rf,i as Q0,j as on,k as fo,l as cs,m as mb,n as ds,o as _b,p as gb,q as bb,r as vb,s as yb,t as Cb,u as us,w as xb,x as wb,y as Tb,z as Sb}from"./chunk-HWQTV6ZL.js";import{f as Ja,i as es}from"./chunk-UBQUCSQ4.js";import{a as Qn,b as db,c as go,g as ls,h as Vt}from"./chunk-4CXAL43H.js";import"./chunk-P2DAPRK7.js";import{a as q0,b as G0,c as j0,d as U0,e as eb,f as tb,g as os,h as as,i as ss,j as nb,k as ib,l as _o,n as ob,o as Ff,p as rb,q as ab,r as ub,s as pb}from"./chunk-JXRIGHET.js";import{A as uo,B as ns,C as Te,D as $0,E as W0,F as br,G as Ee,H as K0,I as Sn,J as Ve,K as ze,L as J0,M as mo,N as we,O as Of,P as rs,Q as _n,R as kn,a as pt,c as Df,d as B0,e as Pf,f as V0,g as lo,i as bt,j as Le,k as nn,l as St,o as Yn,p as H0,q as co,r as Lt,s as Bt,t as kt,u as It,v as Bn,w as Ie,x as Tn}from"./chunk-GBKHMJ4B.js";import{f as Wn,g as M0,h as so,i as fn,j as Kn,k as Rt,l as gt,p as $t}from"./chunk-LCOYSPKE.js";import{B as Mf,Ca as z0,D as R0,F as O0,H as F0,J as ts,O as _r,T as N0,V as A0,W as L0,a as mn,b as hr,ba as gr,k as fr,l as If,m as D0,n as P0,p as Mi,t as wn,u as ut,w as Ef,z as mr}from"./chunk-4SG4352Z.js";import{$ as xt,$a as S,$b as I0,Ab as _e,Bb as le,Cb as Ya,Db as Xa,Ea as ki,Eb as $,Ec as j,Fa as lr,Fb as ot,Fc as xe,Ga as Wa,Gb as A,Ha as l,Ib as d,J as Cn,Jb as pn,K as y,Kb as $e,L as mt,Lb as en,Ma as ao,Mb as xn,N as be,Na as x0,Nb as Q,O as oo,Ob as J,P as p,Pa as w0,Pb as Tf,Qa as un,Qb as hn,Ra as Ka,Rb as jt,Sb as yt,T as C0,Tb as Ne,U as Ln,Ub as ue,V as w,Vb as Pt,W as T,Wa as z,Wb as H,X as W,Xa as _t,Xb as b,Y as ja,Ya as je,Yb as x,Z as dt,Za as wt,Zb as Se,_ as Ua,_a as Z,_b as k0,ac as cr,ba as ne,bc as dr,ca as Jt,cc as ur,d as io,dc as Ut,ec as Tt,fc as Ce,g as P,ga as X,gc as ke,hc as At,ia as de,ic as Re,ja as ro,jb as O,jc as $n,ka as G,kb as T0,kc as Ii,la as Qe,lb as S0,lc as Sf,mb as M,mc as Za,n as y0,nb as D,nc as pr,ob as wf,oc as E0,pa as $a,pb as Ue,pc as We,qb as re,rb as ae,rc as tn,sb as m,sc as E,t as Ga,tb as f,tc as Ke,ub as _,uc as B,vb as F,vc as nt,wb as se,wc as Qa,xb as fe,xc as kf,yb as ie,yc as Ei,zb as me}from"./chunk-Q2A6FWC7.js";import{a as ge,b as Dt,c as no,e as v,g as a3}from"./chunk-WCABR6TI.js";var IC=v((Y_e,kC)=>{"use strict";function uz(){this.__data__=[],this.size=0}kC.exports=uz});var Wi=v((X_e,EC)=>{"use strict";function pz(t,o){return t===o||t!==t&&o!==o}EC.exports=pz});var da=v((Z_e,MC)=>{"use strict";var hz=Wi();function fz(t,o){for(var e=t.length;e--;)if(hz(t[e][0],o))return e;return-1}MC.exports=fz});var PC=v((Q_e,DC)=>{"use strict";var mz=da(),_z=Array.prototype,gz=_z.splice;function bz(t){var o=this.__data__,e=mz(o,t);if(e<0)return!1;var n=o.length-1;return e==n?o.pop():gz.call(o,e,1),--this.size,!0}DC.exports=bz});var OC=v((J_e,RC)=>{"use strict";var vz=da();function yz(t){var o=this.__data__,e=vz(o,t);return e<0?void 0:o[e][1]}RC.exports=yz});var NC=v((ege,FC)=>{"use strict";var Cz=da();function xz(t){return Cz(this.__data__,t)>-1}FC.exports=xz});var LC=v((tge,AC)=>{"use strict";var wz=da();function Tz(t,o){var e=this.__data__,n=wz(e,t);return n<0?(++this.size,e.push([t,o])):e[n][1]=o,this}AC.exports=Tz});var ua=v((nge,BC)=>{"use strict";var Sz=IC(),kz=PC(),Iz=OC(),Ez=NC(),Mz=LC();function Go(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}Go.prototype.clear=Sz;Go.prototype.delete=kz;Go.prototype.get=Iz;Go.prototype.has=Ez;Go.prototype.set=Mz;BC.exports=Go});var zC=v((ige,VC)=>{"use strict";var Dz=ua();function Pz(){this.__data__=new Dz,this.size=0}VC.exports=Pz});var qC=v((oge,HC)=>{"use strict";function Rz(t){var o=this.__data__,e=o.delete(t);return this.size=o.size,e}HC.exports=Rz});var jC=v((rge,GC)=>{"use strict";function Oz(t){return this.__data__.get(t)}GC.exports=Oz});var $C=v((age,UC)=>{"use strict";function Fz(t){return this.__data__.has(t)}UC.exports=Fz});var D_=v((sge,WC)=>{"use strict";var Nz=typeof global=="object"&&global&&global.Object===Object&&global;WC.exports=Nz});var sn=v((lge,KC)=>{"use strict";var Az=D_(),Lz=typeof self=="object"&&self&&self.Object===Object&&self,Bz=Az||Lz||Function("return this")();KC.exports=Bz});var Ki=v((cge,YC)=>{"use strict";var Vz=sn(),zz=Vz.Symbol;YC.exports=zz});var JC=v((dge,QC)=>{"use strict";var XC=Ki(),ZC=Object.prototype,Hz=ZC.hasOwnProperty,qz=ZC.toString,pa=XC?XC.toStringTag:void 0;function Gz(t){var o=Hz.call(t,pa),e=t[pa];try{t[pa]=void 0;var n=!0}catch{}var i=qz.call(t);return n&&(o?t[pa]=e:delete t[pa]),i}QC.exports=Gz});var t1=v((uge,e1)=>{"use strict";var jz=Object.prototype,Uz=jz.toString;function $z(t){return Uz.call(t)}e1.exports=$z});var mi=v((pge,o1)=>{"use strict";var n1=Ki(),Wz=JC(),Kz=t1(),Yz="[object Null]",Xz="[object Undefined]",i1=n1?n1.toStringTag:void 0;function Zz(t){return t==null?t===void 0?Xz:Yz:i1&&i1 in Object(t)?Wz(t):Kz(t)}o1.exports=Zz});var Yt=v((hge,r1)=>{"use strict";function Qz(t){var o=typeof t;return t!=null&&(o=="object"||o=="function")}r1.exports=Qz});var jo=v((fge,a1)=>{"use strict";var Jz=mi(),eH=Yt(),tH="[object AsyncFunction]",nH="[object Function]",iH="[object GeneratorFunction]",oH="[object Proxy]";function rH(t){if(!eH(t))return!1;var o=Jz(t);return o==nH||o==iH||o==tH||o==oH}a1.exports=rH});var l1=v((mge,s1)=>{"use strict";var aH=sn(),sH=aH["__core-js_shared__"];s1.exports=sH});var u1=v((_ge,d1)=>{"use strict";var P_=l1(),c1=(function(){var t=/[^.]+$/.exec(P_&&P_.keys&&P_.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function lH(t){return!!c1&&c1 in t}d1.exports=lH});var R_=v((gge,p1)=>{"use strict";var cH=Function.prototype,dH=cH.toString;function uH(t){if(t!=null){try{return dH.call(t)}catch{}try{return t+""}catch{}}return""}p1.exports=uH});var f1=v((bge,h1)=>{"use strict";var pH=jo(),hH=u1(),fH=Yt(),mH=R_(),_H=/[\\^$.*+?()[\]{}|]/g,gH=/^\[object .+?Constructor\]$/,bH=Function.prototype,vH=Object.prototype,yH=bH.toString,CH=vH.hasOwnProperty,xH=RegExp("^"+yH.call(CH).replace(_H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wH(t){if(!fH(t)||hH(t))return!1;var o=pH(t)?xH:gH;return o.test(mH(t))}h1.exports=wH});var _1=v((vge,m1)=>{"use strict";function TH(t,o){return t?.[o]}m1.exports=TH});var _i=v((yge,g1)=>{"use strict";var SH=f1(),kH=_1();function IH(t,o){var e=kH(t,o);return SH(e)?e:void 0}g1.exports=IH});var Mh=v((Cge,b1)=>{"use strict";var EH=_i(),MH=sn(),DH=EH(MH,"Map");b1.exports=DH});var ha=v((xge,v1)=>{"use strict";var PH=_i(),RH=PH(Object,"create");v1.exports=RH});var x1=v((wge,C1)=>{"use strict";var y1=ha();function OH(){this.__data__=y1?y1(null):{},this.size=0}C1.exports=OH});var T1=v((Tge,w1)=>{"use strict";function FH(t){var o=this.has(t)&&delete this.__data__[t];return this.size-=o?1:0,o}w1.exports=FH});var k1=v((Sge,S1)=>{"use strict";var NH=ha(),AH="__lodash_hash_undefined__",LH=Object.prototype,BH=LH.hasOwnProperty;function VH(t){var o=this.__data__;if(NH){var e=o[t];return e===AH?void 0:e}return BH.call(o,t)?o[t]:void 0}S1.exports=VH});var E1=v((kge,I1)=>{"use strict";var zH=ha(),HH=Object.prototype,qH=HH.hasOwnProperty;function GH(t){var o=this.__data__;return zH?o[t]!==void 0:qH.call(o,t)}I1.exports=GH});var D1=v((Ige,M1)=>{"use strict";var jH=ha(),UH="__lodash_hash_undefined__";function $H(t,o){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=jH&&o===void 0?UH:o,this}M1.exports=$H});var R1=v((Ege,P1)=>{"use strict";var WH=x1(),KH=T1(),YH=k1(),XH=E1(),ZH=D1();function Uo(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}Uo.prototype.clear=WH;Uo.prototype.delete=KH;Uo.prototype.get=YH;Uo.prototype.has=XH;Uo.prototype.set=ZH;P1.exports=Uo});var N1=v((Mge,F1)=>{"use strict";var O1=R1(),QH=ua(),JH=Mh();function eq(){this.size=0,this.__data__={hash:new O1,map:new(JH||QH),string:new O1}}F1.exports=eq});var L1=v((Dge,A1)=>{"use strict";function tq(t){var o=typeof t;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?t!=="__proto__":t===null}A1.exports=tq});var fa=v((Pge,B1)=>{"use strict";var nq=L1();function iq(t,o){var e=t.__data__;return nq(o)?e[typeof o=="string"?"string":"hash"]:e.map}B1.exports=iq});var z1=v((Rge,V1)=>{"use strict";var oq=fa();function rq(t){var o=oq(this,t).delete(t);return this.size-=o?1:0,o}V1.exports=rq});var q1=v((Oge,H1)=>{"use strict";var aq=fa();function sq(t){return aq(this,t).get(t)}H1.exports=sq});var j1=v((Fge,G1)=>{"use strict";var lq=fa();function cq(t){return lq(this,t).has(t)}G1.exports=cq});var $1=v((Nge,U1)=>{"use strict";var dq=fa();function uq(t,o){var e=dq(this,t),n=e.size;return e.set(t,o),this.size+=e.size==n?0:1,this}U1.exports=uq});var Dh=v((Age,W1)=>{"use strict";var pq=N1(),hq=z1(),fq=q1(),mq=j1(),_q=$1();function $o(t){var o=-1,e=t==null?0:t.length;for(this.clear();++o<e;){var n=t[o];this.set(n[0],n[1])}}$o.prototype.clear=pq;$o.prototype.delete=hq;$o.prototype.get=fq;$o.prototype.has=mq;$o.prototype.set=_q;W1.exports=$o});var Y1=v((Lge,K1)=>{"use strict";var gq=ua(),bq=Mh(),vq=Dh(),yq=200;function Cq(t,o){var e=this.__data__;if(e instanceof gq){var n=e.__data__;if(!bq||n.length<yq-1)return n.push([t,o]),this.size=++e.size,this;e=this.__data__=new vq(n)}return e.set(t,o),this.size=e.size,this}K1.exports=Cq});var ma=v((Bge,X1)=>{"use strict";var xq=ua(),wq=zC(),Tq=qC(),Sq=jC(),kq=$C(),Iq=Y1();function Wo(t){var o=this.__data__=new xq(t);this.size=o.size}Wo.prototype.clear=wq;Wo.prototype.delete=Tq;Wo.prototype.get=Sq;Wo.prototype.has=kq;Wo.prototype.set=Iq;X1.exports=Wo});var Ph=v((Vge,Z1)=>{"use strict";function Eq(t,o){for(var e=-1,n=t==null?0:t.length;++e<n&&o(t[e],e,t)!==!1;);return t}Z1.exports=Eq});var O_=v((zge,Q1)=>{"use strict";var Mq=_i(),Dq=(function(){try{var t=Mq(Object,"defineProperty");return t({},"",{}),t}catch{}})();Q1.exports=Dq});var _a=v((Hge,ex)=>{"use strict";var J1=O_();function Pq(t,o,e){o=="__proto__"&&J1?J1(t,o,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[o]=e}ex.exports=Pq});var ga=v((qge,tx)=>{"use strict";var Rq=_a(),Oq=Wi(),Fq=Object.prototype,Nq=Fq.hasOwnProperty;function Aq(t,o,e){var n=t[o];(!(Nq.call(t,o)&&Oq(n,e))||e===void 0&&!(o in t))&&Rq(t,o,e)}tx.exports=Aq});var Ko=v((Gge,nx)=>{"use strict";var Lq=ga(),Bq=_a();function Vq(t,o,e,n){var i=!e;e||(e={});for(var r=-1,a=o.length;++r<a;){var s=o[r],c=n?n(e[s],t[s],s,e,t):void 0;c===void 0&&(c=t[s]),i?Bq(e,s,c):Lq(e,s,c)}return e}nx.exports=Vq});var ox=v((jge,ix)=>{"use strict";function zq(t,o){for(var e=-1,n=Array(t);++e<t;)n[e]=o(e);return n}ix.exports=zq});var yn=v((Uge,rx)=>{"use strict";function Hq(t){return t!=null&&typeof t=="object"}rx.exports=Hq});var sx=v(($ge,ax)=>{"use strict";var qq=mi(),Gq=yn(),jq="[object Arguments]";function Uq(t){return Gq(t)&&qq(t)==jq}ax.exports=Uq});var Yo=v((Wge,dx)=>{"use strict";var lx=sx(),$q=yn(),cx=Object.prototype,Wq=cx.hasOwnProperty,Kq=cx.propertyIsEnumerable,Yq=lx((function(){return arguments})())?lx:function(t){return $q(t)&&Wq.call(t,"callee")&&!Kq.call(t,"callee")};dx.exports=Yq});var lt=v((Kge,ux)=>{"use strict";var Xq=Array.isArray;ux.exports=Xq});var hx=v((Yge,px)=>{"use strict";function Zq(){return!1}px.exports=Zq});var Yi=v((ba,Xo)=>{"use strict";var Qq=sn(),Jq=hx(),_x=typeof ba=="object"&&ba&&!ba.nodeType&&ba,fx=_x&&typeof Xo=="object"&&Xo&&!Xo.nodeType&&Xo,eG=fx&&fx.exports===_x,mx=eG?Qq.Buffer:void 0,tG=mx?mx.isBuffer:void 0,nG=tG||Jq;Xo.exports=nG});var va=v((Xge,gx)=>{"use strict";var iG=9007199254740991,oG=/^(?:0|[1-9]\d*)$/;function rG(t,o){var e=typeof t;return o=o??iG,!!o&&(e=="number"||e!="symbol"&&oG.test(t))&&t>-1&&t%1==0&&t<o}gx.exports=rG});var Rh=v((Zge,bx)=>{"use strict";var aG=9007199254740991;function sG(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=aG}bx.exports=sG});var yx=v((Qge,vx)=>{"use strict";var lG=mi(),cG=Rh(),dG=yn(),uG="[object Arguments]",pG="[object Array]",hG="[object Boolean]",fG="[object Date]",mG="[object Error]",_G="[object Function]",gG="[object Map]",bG="[object Number]",vG="[object Object]",yG="[object RegExp]",CG="[object Set]",xG="[object String]",wG="[object WeakMap]",TG="[object ArrayBuffer]",SG="[object DataView]",kG="[object Float32Array]",IG="[object Float64Array]",EG="[object Int8Array]",MG="[object Int16Array]",DG="[object Int32Array]",PG="[object Uint8Array]",RG="[object Uint8ClampedArray]",OG="[object Uint16Array]",FG="[object Uint32Array]",Je={};Je[kG]=Je[IG]=Je[EG]=Je[MG]=Je[DG]=Je[PG]=Je[RG]=Je[OG]=Je[FG]=!0;Je[uG]=Je[pG]=Je[TG]=Je[hG]=Je[SG]=Je[fG]=Je[mG]=Je[_G]=Je[gG]=Je[bG]=Je[vG]=Je[yG]=Je[CG]=Je[xG]=Je[wG]=!1;function NG(t){return dG(t)&&cG(t.length)&&!!Je[lG(t)]}vx.exports=NG});var ya=v((Jge,Cx)=>{"use strict";function AG(t){return function(o){return t(o)}}Cx.exports=AG});var Oh=v((Ca,Zo)=>{"use strict";var LG=D_(),xx=typeof Ca=="object"&&Ca&&!Ca.nodeType&&Ca,xa=xx&&typeof Zo=="object"&&Zo&&!Zo.nodeType&&Zo,BG=xa&&xa.exports===xx,F_=BG&&LG.process,VG=(function(){try{var t=xa&&xa.require&&xa.require("util").types;return t||F_&&F_.binding&&F_.binding("util")}catch{}})();Zo.exports=VG});var Qo=v((e0e,Sx)=>{"use strict";var zG=yx(),HG=ya(),wx=Oh(),Tx=wx&&wx.isTypedArray,qG=Tx?HG(Tx):zG;Sx.exports=qG});var N_=v((t0e,kx)=>{"use strict";var GG=ox(),jG=Yo(),UG=lt(),$G=Yi(),WG=va(),KG=Qo(),YG=Object.prototype,XG=YG.hasOwnProperty;function ZG(t,o){var e=UG(t),n=!e&&jG(t),i=!e&&!n&&$G(t),r=!e&&!n&&!i&&KG(t),a=e||n||i||r,s=a?GG(t.length,String):[],c=s.length;for(var u in t)(o||XG.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||r&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||WG(u,c)))&&s.push(u);return s}kx.exports=ZG});var wa=v((n0e,Ix)=>{"use strict";var QG=Object.prototype;function JG(t){var o=t&&t.constructor,e=typeof o=="function"&&o.prototype||QG;return t===e}Ix.exports=JG});var A_=v((i0e,Ex)=>{"use strict";function ej(t,o){return function(e){return t(o(e))}}Ex.exports=ej});var Dx=v((o0e,Mx)=>{"use strict";var tj=A_(),nj=tj(Object.keys,Object);Mx.exports=nj});var Fh=v((r0e,Px)=>{"use strict";var ij=wa(),oj=Dx(),rj=Object.prototype,aj=rj.hasOwnProperty;function sj(t){if(!ij(t))return oj(t);var o=[];for(var e in Object(t))aj.call(t,e)&&e!="constructor"&&o.push(e);return o}Px.exports=sj});var Pn=v((a0e,Rx)=>{"use strict";var lj=jo(),cj=Rh();function dj(t){return t!=null&&cj(t.length)&&!lj(t)}Rx.exports=dj});var Hn=v((s0e,Ox)=>{"use strict";var uj=N_(),pj=Fh(),hj=Pn();function fj(t){return hj(t)?uj(t):pj(t)}Ox.exports=fj});var Nx=v((l0e,Fx)=>{"use strict";var mj=Ko(),_j=Hn();function gj(t,o){return t&&mj(o,_j(o),t)}Fx.exports=gj});var Lx=v((c0e,Ax)=>{"use strict";function bj(t){var o=[];if(t!=null)for(var e in Object(t))o.push(e);return o}Ax.exports=bj});var Vx=v((d0e,Bx)=>{"use strict";var vj=Yt(),yj=wa(),Cj=Lx(),xj=Object.prototype,wj=xj.hasOwnProperty;function Tj(t){if(!vj(t))return Cj(t);var o=yj(t),e=[];for(var n in t)n=="constructor"&&(o||!wj.call(t,n))||e.push(n);return e}Bx.exports=Tj});var gi=v((u0e,zx)=>{"use strict";var Sj=N_(),kj=Vx(),Ij=Pn();function Ej(t){return Ij(t)?Sj(t,!0):kj(t)}zx.exports=Ej});var qx=v((p0e,Hx)=>{"use strict";var Mj=Ko(),Dj=gi();function Pj(t,o){return t&&Mj(o,Dj(o),t)}Hx.exports=Pj});var L_=v((Ta,Jo)=>{"use strict";var Rj=sn(),$x=typeof Ta=="object"&&Ta&&!Ta.nodeType&&Ta,Gx=$x&&typeof Jo=="object"&&Jo&&!Jo.nodeType&&Jo,Oj=Gx&&Gx.exports===$x,jx=Oj?Rj.Buffer:void 0,Ux=jx?jx.allocUnsafe:void 0;function Fj(t,o){if(o)return t.slice();var e=t.length,n=Ux?Ux(e):new t.constructor(e);return t.copy(n),n}Jo.exports=Fj});var B_=v((h0e,Wx)=>{"use strict";function Nj(t,o){var e=-1,n=t.length;for(o||(o=Array(n));++e<n;)o[e]=t[e];return o}Wx.exports=Nj});var V_=v((f0e,Kx)=>{"use strict";function Aj(t,o){for(var e=-1,n=t==null?0:t.length,i=0,r=[];++e<n;){var a=t[e];o(a,e,t)&&(r[i++]=a)}return r}Kx.exports=Aj});var z_=v((m0e,Yx)=>{"use strict";function Lj(){return[]}Yx.exports=Lj});var Nh=v((_0e,Zx)=>{"use strict";var Bj=V_(),Vj=z_(),zj=Object.prototype,Hj=zj.propertyIsEnumerable,Xx=Object.getOwnPropertySymbols,qj=Xx?function(t){return t==null?[]:(t=Object(t),Bj(Xx(t),function(o){return Hj.call(t,o)}))}:Vj;Zx.exports=qj});var Jx=v((g0e,Qx)=>{"use strict";var Gj=Ko(),jj=Nh();function Uj(t,o){return Gj(t,jj(t),o)}Qx.exports=Uj});var Ah=v((b0e,ew)=>{"use strict";function $j(t,o){for(var e=-1,n=o.length,i=t.length;++e<n;)t[i+e]=o[e];return t}ew.exports=$j});var Sa=v((v0e,tw)=>{"use strict";var Wj=A_(),Kj=Wj(Object.getPrototypeOf,Object);tw.exports=Kj});var H_=v((y0e,nw)=>{"use strict";var Yj=Ah(),Xj=Sa(),Zj=Nh(),Qj=z_(),Jj=Object.getOwnPropertySymbols,eU=Jj?function(t){for(var o=[];t;)Yj(o,Zj(t)),t=Xj(t);return o}:Qj;nw.exports=eU});var ow=v((C0e,iw)=>{"use strict";var tU=Ko(),nU=H_();function iU(t,o){return tU(t,nU(t),o)}iw.exports=iU});var q_=v((x0e,rw)=>{"use strict";var oU=Ah(),rU=lt();function aU(t,o,e){var n=o(t);return rU(t)?n:oU(n,e(t))}rw.exports=aU});var G_=v((w0e,aw)=>{"use strict";var sU=q_(),lU=Nh(),cU=Hn();function dU(t){return sU(t,cU,lU)}aw.exports=dU});var lw=v((T0e,sw)=>{"use strict";var uU=q_(),pU=H_(),hU=gi();function fU(t){return uU(t,hU,pU)}sw.exports=fU});var dw=v((S0e,cw)=>{"use strict";var mU=_i(),_U=sn(),gU=mU(_U,"DataView");cw.exports=gU});var pw=v((k0e,uw)=>{"use strict";var bU=_i(),vU=sn(),yU=bU(vU,"Promise");uw.exports=yU});var j_=v((I0e,hw)=>{"use strict";var CU=_i(),xU=sn(),wU=CU(xU,"Set");hw.exports=wU});var mw=v((E0e,fw)=>{"use strict";var TU=_i(),SU=sn(),kU=TU(SU,"WeakMap");fw.exports=kU});var Zi=v((M0e,xw)=>{"use strict";var U_=dw(),$_=Mh(),W_=pw(),K_=j_(),Y_=mw(),Cw=mi(),er=R_(),_w="[object Map]",IU="[object Object]",gw="[object Promise]",bw="[object Set]",vw="[object WeakMap]",yw="[object DataView]",EU=er(U_),MU=er($_),DU=er(W_),PU=er(K_),RU=er(Y_),Xi=Cw;(U_&&Xi(new U_(new ArrayBuffer(1)))!=yw||$_&&Xi(new $_)!=_w||W_&&Xi(W_.resolve())!=gw||K_&&Xi(new K_)!=bw||Y_&&Xi(new Y_)!=vw)&&(Xi=function(t){var o=Cw(t),e=o==IU?t.constructor:void 0,n=e?er(e):"";if(n)switch(n){case EU:return yw;case MU:return _w;case DU:return gw;case PU:return bw;case RU:return vw}return o});xw.exports=Xi});var Tw=v((D0e,ww)=>{"use strict";var OU=Object.prototype,FU=OU.hasOwnProperty;function NU(t){var o=t.length,e=new t.constructor(o);return o&&typeof t[0]=="string"&&FU.call(t,"index")&&(e.index=t.index,e.input=t.input),e}ww.exports=NU});var X_=v((P0e,Sw)=>{"use strict";var AU=sn(),LU=AU.Uint8Array;Sw.exports=LU});var Lh=v((R0e,Iw)=>{"use strict";var kw=X_();function BU(t){var o=new t.constructor(t.byteLength);return new kw(o).set(new kw(t)),o}Iw.exports=BU});var Mw=v((O0e,Ew)=>{"use strict";var VU=Lh();function zU(t,o){var e=o?VU(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}Ew.exports=zU});var Pw=v((F0e,Dw)=>{"use strict";var HU=/\w*$/;function qU(t){var o=new t.constructor(t.source,HU.exec(t));return o.lastIndex=t.lastIndex,o}Dw.exports=qU});var Aw=v((N0e,Nw)=>{"use strict";var Rw=Ki(),Ow=Rw?Rw.prototype:void 0,Fw=Ow?Ow.valueOf:void 0;function GU(t){return Fw?Object(Fw.call(t)):{}}Nw.exports=GU});var Z_=v((A0e,Lw)=>{"use strict";var jU=Lh();function UU(t,o){var e=o?jU(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}Lw.exports=UU});var Vw=v((L0e,Bw)=>{"use strict";var $U=Lh(),WU=Mw(),KU=Pw(),YU=Aw(),XU=Z_(),ZU="[object Boolean]",QU="[object Date]",JU="[object Map]",e$="[object Number]",t$="[object RegExp]",n$="[object Set]",i$="[object String]",o$="[object Symbol]",r$="[object ArrayBuffer]",a$="[object DataView]",s$="[object Float32Array]",l$="[object Float64Array]",c$="[object Int8Array]",d$="[object Int16Array]",u$="[object Int32Array]",p$="[object Uint8Array]",h$="[object Uint8ClampedArray]",f$="[object Uint16Array]",m$="[object Uint32Array]";function _$(t,o,e){var n=t.constructor;switch(o){case r$:return $U(t);case ZU:case QU:return new n(+t);case a$:return WU(t,e);case s$:case l$:case c$:case d$:case u$:case p$:case h$:case f$:case m$:return XU(t,e);case JU:return new n;case e$:case i$:return new n(t);case t$:return KU(t);case n$:return new n;case o$:return YU(t)}}Bw.exports=_$});var Q_=v((B0e,Hw)=>{"use strict";var g$=Yt(),zw=Object.create,b$=(function(){function t(){}return function(o){if(!g$(o))return{};if(zw)return zw(o);t.prototype=o;var e=new t;return t.prototype=void 0,e}})();Hw.exports=b$});var J_=v((V0e,qw)=>{"use strict";var v$=Q_(),y$=Sa(),C$=wa();function x$(t){return typeof t.constructor=="function"&&!C$(t)?v$(y$(t)):{}}qw.exports=x$});var jw=v((z0e,Gw)=>{"use strict";var w$=Zi(),T$=yn(),S$="[object Map]";function k$(t){return T$(t)&&w$(t)==S$}Gw.exports=k$});var Kw=v((H0e,Ww)=>{"use strict";var I$=jw(),E$=ya(),Uw=Oh(),$w=Uw&&Uw.isMap,M$=$w?E$($w):I$;Ww.exports=M$});var Xw=v((q0e,Yw)=>{"use strict";var D$=Zi(),P$=yn(),R$="[object Set]";function O$(t){return P$(t)&&D$(t)==R$}Yw.exports=O$});var eT=v((G0e,Jw)=>{"use strict";var F$=Xw(),N$=ya(),Zw=Oh(),Qw=Zw&&Zw.isSet,A$=Qw?N$(Qw):F$;Jw.exports=A$});var eg=v((j0e,oT)=>{"use strict";var L$=ma(),B$=Ph(),V$=ga(),z$=Nx(),H$=qx(),q$=L_(),G$=B_(),j$=Jx(),U$=ow(),$$=G_(),W$=lw(),K$=Zi(),Y$=Tw(),X$=Vw(),Z$=J_(),Q$=lt(),J$=Yi(),eW=Kw(),tW=Yt(),nW=eT(),iW=Hn(),oW=gi(),rW=1,aW=2,sW=4,tT="[object Arguments]",lW="[object Array]",cW="[object Boolean]",dW="[object Date]",uW="[object Error]",nT="[object Function]",pW="[object GeneratorFunction]",hW="[object Map]",fW="[object Number]",iT="[object Object]",mW="[object RegExp]",_W="[object Set]",gW="[object String]",bW="[object Symbol]",vW="[object WeakMap]",yW="[object ArrayBuffer]",CW="[object DataView]",xW="[object Float32Array]",wW="[object Float64Array]",TW="[object Int8Array]",SW="[object Int16Array]",kW="[object Int32Array]",IW="[object Uint8Array]",EW="[object Uint8ClampedArray]",MW="[object Uint16Array]",DW="[object Uint32Array]",Ze={};Ze[tT]=Ze[lW]=Ze[yW]=Ze[CW]=Ze[cW]=Ze[dW]=Ze[xW]=Ze[wW]=Ze[TW]=Ze[SW]=Ze[kW]=Ze[hW]=Ze[fW]=Ze[iT]=Ze[mW]=Ze[_W]=Ze[gW]=Ze[bW]=Ze[IW]=Ze[EW]=Ze[MW]=Ze[DW]=!0;Ze[uW]=Ze[nT]=Ze[vW]=!1;function Bh(t,o,e,n,i,r){var a,s=o&rW,c=o&aW,u=o&sW;if(e&&(a=i?e(t,n,i,r):e(t)),a!==void 0)return a;if(!tW(t))return t;var h=Q$(t);if(h){if(a=Y$(t),!s)return G$(t,a)}else{var g=K$(t),C=g==nT||g==pW;if(J$(t))return q$(t,s);if(g==iT||g==tT||C&&!i){if(a=c||C?{}:Z$(t),!s)return c?U$(t,H$(a,t)):j$(t,z$(a,t))}else{if(!Ze[g])return i?t:{};a=X$(t,g,s)}}r||(r=new L$);var k=r.get(t);if(k)return k;r.set(t,a),nW(t)?t.forEach(function(q){a.add(Bh(q,o,e,q,t,r))}):eW(t)&&t.forEach(function(q,Y){a.set(Y,Bh(q,o,e,Y,t,r))});var I=u?c?W$:$$:c?oW:iW,N=h?void 0:I(t);return B$(N||t,function(q,Y){N&&(Y=q,q=t[Y]),V$(a,Y,Bh(q,o,e,Y,t,r))}),a}oT.exports=Bh});var aT=v((U0e,rT)=>{"use strict";var PW=eg(),RW=4;function OW(t){return PW(t,RW)}rT.exports=OW});var Vh=v(($0e,sT)=>{"use strict";function FW(t){return function(){return t}}sT.exports=FW});var cT=v((W0e,lT)=>{"use strict";function NW(t){return function(o,e,n){for(var i=-1,r=Object(o),a=n(o),s=a.length;s--;){var c=a[t?s:++i];if(e(r[c],c,r)===!1)break}return o}}lT.exports=NW});var zh=v((K0e,dT)=>{"use strict";var AW=cT(),LW=AW();dT.exports=LW});var Hh=v((Y0e,uT)=>{"use strict";var BW=zh(),VW=Hn();function zW(t,o){return t&&BW(t,o,VW)}uT.exports=zW});var hT=v((X0e,pT)=>{"use strict";var HW=Pn();function qW(t,o){return function(e,n){if(e==null)return e;if(!HW(e))return t(e,n);for(var i=e.length,r=o?i:-1,a=Object(e);(o?r--:++r<i)&&n(a[r],r,a)!==!1;);return e}}pT.exports=qW});var ka=v((Z0e,fT)=>{"use strict";var GW=Hh(),jW=hT(),UW=jW(GW);fT.exports=UW});var bi=v((Q0e,mT)=>{"use strict";function $W(t){return t}mT.exports=$W});var tg=v((J0e,_T)=>{"use strict";var WW=bi();function KW(t){return typeof t=="function"?t:WW}_T.exports=KW});var ng=v((ebe,gT)=>{"use strict";var YW=Ph(),XW=ka(),ZW=tg(),QW=lt();function JW(t,o){var e=QW(t)?YW:XW;return e(t,ZW(o))}gT.exports=JW});var ig=v((tbe,bT)=>{"use strict";bT.exports=ng()});var yT=v((nbe,vT)=>{"use strict";var eK=ka();function tK(t,o){var e=[];return eK(t,function(n,i,r){o(n,i,r)&&e.push(n)}),e}vT.exports=tK});var xT=v((ibe,CT)=>{"use strict";var nK="__lodash_hash_undefined__";function iK(t){return this.__data__.set(t,nK),this}CT.exports=iK});var TT=v((obe,wT)=>{"use strict";function oK(t){return this.__data__.has(t)}wT.exports=oK});var og=v((rbe,ST)=>{"use strict";var rK=Dh(),aK=xT(),sK=TT();function qh(t){var o=-1,e=t==null?0:t.length;for(this.__data__=new rK;++o<e;)this.add(t[o])}qh.prototype.add=qh.prototype.push=aK;qh.prototype.has=sK;ST.exports=qh});var IT=v((abe,kT)=>{"use strict";function lK(t,o){for(var e=-1,n=t==null?0:t.length;++e<n;)if(o(t[e],e,t))return!0;return!1}kT.exports=lK});var rg=v((sbe,ET)=>{"use strict";function cK(t,o){return t.has(o)}ET.exports=cK});var ag=v((lbe,MT)=>{"use strict";var dK=og(),uK=IT(),pK=rg(),hK=1,fK=2;function mK(t,o,e,n,i,r){var a=e&hK,s=t.length,c=o.length;if(s!=c&&!(a&&c>s))return!1;var u=r.get(t),h=r.get(o);if(u&&h)return u==o&&h==t;var g=-1,C=!0,k=e&fK?new dK:void 0;for(r.set(t,o),r.set(o,t);++g<s;){var I=t[g],N=o[g];if(n)var q=a?n(N,I,g,o,t,r):n(I,N,g,t,o,r);if(q!==void 0){if(q)continue;C=!1;break}if(k){if(!uK(o,function(Y,ee){if(!pK(k,ee)&&(I===Y||i(I,Y,e,n,r)))return k.push(ee)})){C=!1;break}}else if(!(I===N||i(I,N,e,n,r))){C=!1;break}}return r.delete(t),r.delete(o),C}MT.exports=mK});var PT=v((cbe,DT)=>{"use strict";function _K(t){var o=-1,e=Array(t.size);return t.forEach(function(n,i){e[++o]=[i,n]}),e}DT.exports=_K});var Gh=v((dbe,RT)=>{"use strict";function gK(t){var o=-1,e=Array(t.size);return t.forEach(function(n){e[++o]=n}),e}RT.exports=gK});var LT=v((ube,AT)=>{"use strict";var OT=Ki(),FT=X_(),bK=Wi(),vK=ag(),yK=PT(),CK=Gh(),xK=1,wK=2,TK="[object Boolean]",SK="[object Date]",kK="[object Error]",IK="[object Map]",EK="[object Number]",MK="[object RegExp]",DK="[object Set]",PK="[object String]",RK="[object Symbol]",OK="[object ArrayBuffer]",FK="[object DataView]",NT=OT?OT.prototype:void 0,sg=NT?NT.valueOf:void 0;function NK(t,o,e,n,i,r,a){switch(e){case FK:if(t.byteLength!=o.byteLength||t.byteOffset!=o.byteOffset)return!1;t=t.buffer,o=o.buffer;case OK:return!(t.byteLength!=o.byteLength||!r(new FT(t),new FT(o)));case TK:case SK:case EK:return bK(+t,+o);case kK:return t.name==o.name&&t.message==o.message;case MK:case PK:return t==o+"";case IK:var s=yK;case DK:var c=n&xK;if(s||(s=CK),t.size!=o.size&&!c)return!1;var u=a.get(t);if(u)return u==o;n|=wK,a.set(t,o);var h=vK(s(t),s(o),n,i,r,a);return a.delete(t),h;case RK:if(sg)return sg.call(t)==sg.call(o)}return!1}AT.exports=NK});var zT=v((pbe,VT)=>{"use strict";var BT=G_(),AK=1,LK=Object.prototype,BK=LK.hasOwnProperty;function VK(t,o,e,n,i,r){var a=e&AK,s=BT(t),c=s.length,u=BT(o),h=u.length;if(c!=h&&!a)return!1;for(var g=c;g--;){var C=s[g];if(!(a?C in o:BK.call(o,C)))return!1}var k=r.get(t),I=r.get(o);if(k&&I)return k==o&&I==t;var N=!0;r.set(t,o),r.set(o,t);for(var q=a;++g<c;){C=s[g];var Y=t[C],ee=o[C];if(n)var ce=a?n(ee,Y,C,o,t,r):n(Y,ee,C,t,o,r);if(!(ce===void 0?Y===ee||i(Y,ee,e,n,r):ce)){N=!1;break}q||(q=C=="constructor")}if(N&&!q){var Oe=t.constructor,De=o.constructor;Oe!=De&&"constructor"in t&&"constructor"in o&&!(typeof Oe=="function"&&Oe instanceof Oe&&typeof De=="function"&&De instanceof De)&&(N=!1)}return r.delete(t),r.delete(o),N}VT.exports=VK});var KT=v((hbe,WT)=>{"use strict";var lg=ma(),zK=ag(),HK=LT(),qK=zT(),HT=Zi(),qT=lt(),GT=Yi(),GK=Qo(),jK=1,jT="[object Arguments]",UT="[object Array]",jh="[object Object]",UK=Object.prototype,$T=UK.hasOwnProperty;function $K(t,o,e,n,i,r){var a=qT(t),s=qT(o),c=a?UT:HT(t),u=s?UT:HT(o);c=c==jT?jh:c,u=u==jT?jh:u;var h=c==jh,g=u==jh,C=c==u;if(C&&GT(t)){if(!GT(o))return!1;a=!0,h=!1}if(C&&!h)return r||(r=new lg),a||GK(t)?zK(t,o,e,n,i,r):HK(t,o,c,e,n,i,r);if(!(e&jK)){var k=h&&$T.call(t,"__wrapped__"),I=g&&$T.call(o,"__wrapped__");if(k||I){var N=k?t.value():t,q=I?o.value():o;return r||(r=new lg),i(N,q,e,n,r)}}return C?(r||(r=new lg),qK(t,o,e,n,i,r)):!1}WT.exports=$K});var cg=v((fbe,ZT)=>{"use strict";var WK=KT(),YT=yn();function XT(t,o,e,n,i){return t===o?!0:t==null||o==null||!YT(t)&&!YT(o)?t!==t&&o!==o:WK(t,o,e,n,XT,i)}ZT.exports=XT});var JT=v((mbe,QT)=>{"use strict";var KK=ma(),YK=cg(),XK=1,ZK=2;function QK(t,o,e,n){var i=e.length,r=i,a=!n;if(t==null)return!r;for(t=Object(t);i--;){var s=e[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<r;){s=e[i];var c=s[0],u=t[c],h=s[1];if(a&&s[2]){if(u===void 0&&!(c in t))return!1}else{var g=new KK;if(n)var C=n(u,h,c,t,o,g);if(!(C===void 0?YK(h,u,XK|ZK,n,g):C))return!1}}return!0}QT.exports=QK});var dg=v((_be,e2)=>{"use strict";var JK=Yt();function eY(t){return t===t&&!JK(t)}e2.exports=eY});var n2=v((gbe,t2)=>{"use strict";var tY=dg(),nY=Hn();function iY(t){for(var o=nY(t),e=o.length;e--;){var n=o[e],i=t[n];o[e]=[n,i,tY(i)]}return o}t2.exports=iY});var ug=v((bbe,i2)=>{"use strict";function oY(t,o){return function(e){return e==null?!1:e[t]===o&&(o!==void 0||t in Object(e))}}i2.exports=oY});var r2=v((vbe,o2)=>{"use strict";var rY=JT(),aY=n2(),sY=ug();function lY(t){var o=aY(t);return o.length==1&&o[0][2]?sY(o[0][0],o[0][1]):function(e){return e===t||rY(e,t,o)}}o2.exports=lY});var Qi=v((ybe,a2)=>{"use strict";var cY=mi(),dY=yn(),uY="[object Symbol]";function pY(t){return typeof t=="symbol"||dY(t)&&cY(t)==uY}a2.exports=pY});var Uh=v((Cbe,s2)=>{"use strict";var hY=lt(),fY=Qi(),mY=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_Y=/^\w*$/;function gY(t,o){if(hY(t))return!1;var e=typeof t;return e=="number"||e=="symbol"||e=="boolean"||t==null||fY(t)?!0:_Y.test(t)||!mY.test(t)||o!=null&&t in Object(o)}s2.exports=gY});var d2=v((xbe,c2)=>{"use strict";var l2=Dh(),bY="Expected a function";function pg(t,o){if(typeof t!="function"||o!=null&&typeof o!="function")throw new TypeError(bY);var e=function(){var n=arguments,i=o?o.apply(this,n):n[0],r=e.cache;if(r.has(i))return r.get(i);var a=t.apply(this,n);return e.cache=r.set(i,a)||r,a};return e.cache=new(pg.Cache||l2),e}pg.Cache=l2;c2.exports=pg});var p2=v((wbe,u2)=>{"use strict";var vY=d2(),yY=500;function CY(t){var o=vY(t,function(n){return e.size===yY&&e.clear(),n}),e=o.cache;return o}u2.exports=CY});var f2=v((Tbe,h2)=>{"use strict";var xY=p2(),wY=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,TY=/\\(\\)?/g,SY=xY(function(t){var o=[];return t.charCodeAt(0)===46&&o.push(""),t.replace(wY,function(e,n,i,r){o.push(i?r.replace(TY,"$1"):n||e)}),o});h2.exports=SY});var Ia=v((Sbe,m2)=>{"use strict";function kY(t,o){for(var e=-1,n=t==null?0:t.length,i=Array(n);++e<n;)i[e]=o(t[e],e,t);return i}m2.exports=kY});var C2=v((kbe,y2)=>{"use strict";var _2=Ki(),IY=Ia(),EY=lt(),MY=Qi(),DY=1/0,g2=_2?_2.prototype:void 0,b2=g2?g2.toString:void 0;function v2(t){if(typeof t=="string")return t;if(EY(t))return IY(t,v2)+"";if(MY(t))return b2?b2.call(t):"";var o=t+"";return o=="0"&&1/t==-DY?"-0":o}y2.exports=v2});var hg=v((Ibe,x2)=>{"use strict";var PY=C2();function RY(t){return t==null?"":PY(t)}x2.exports=RY});var Ea=v((Ebe,w2)=>{"use strict";var OY=lt(),FY=Uh(),NY=f2(),AY=hg();function LY(t,o){return OY(t)?t:FY(t,o)?[t]:NY(AY(t))}w2.exports=LY});var tr=v((Mbe,T2)=>{"use strict";var BY=Qi(),VY=1/0;function zY(t){if(typeof t=="string"||BY(t))return t;var o=t+"";return o=="0"&&1/t==-VY?"-0":o}T2.exports=zY});var Ma=v((Dbe,S2)=>{"use strict";var HY=Ea(),qY=tr();function GY(t,o){o=HY(o,t);for(var e=0,n=o.length;t!=null&&e<n;)t=t[qY(o[e++])];return e&&e==n?t:void 0}S2.exports=GY});var I2=v((Pbe,k2)=>{"use strict";var jY=Ma();function UY(t,o,e){var n=t==null?void 0:jY(t,o);return n===void 0?e:n}k2.exports=UY});var M2=v((Rbe,E2)=>{"use strict";function $Y(t,o){return t!=null&&o in Object(t)}E2.exports=$Y});var fg=v((Obe,D2)=>{"use strict";var WY=Ea(),KY=Yo(),YY=lt(),XY=va(),ZY=Rh(),QY=tr();function JY(t,o,e){o=WY(o,t);for(var n=-1,i=o.length,r=!1;++n<i;){var a=QY(o[n]);if(!(r=t!=null&&e(t,a)))break;t=t[a]}return r||++n!=i?r:(i=t==null?0:t.length,!!i&&ZY(i)&&XY(a,i)&&(YY(t)||KY(t)))}D2.exports=JY});var mg=v((Fbe,P2)=>{"use strict";var eX=M2(),tX=fg();function nX(t,o){return t!=null&&tX(t,o,eX)}P2.exports=nX});var O2=v((Nbe,R2)=>{"use strict";var iX=cg(),oX=I2(),rX=mg(),aX=Uh(),sX=dg(),lX=ug(),cX=tr(),dX=1,uX=2;function pX(t,o){return aX(t)&&sX(o)?lX(cX(t),o):function(e){var n=oX(e,t);return n===void 0&&n===o?rX(e,t):iX(o,n,dX|uX)}}R2.exports=pX});var _g=v((Abe,F2)=>{"use strict";function hX(t){return function(o){return o?.[t]}}F2.exports=hX});var A2=v((Lbe,N2)=>{"use strict";var fX=Ma();function mX(t){return function(o){return fX(o,t)}}N2.exports=mX});var B2=v((Bbe,L2)=>{"use strict";var _X=_g(),gX=A2(),bX=Uh(),vX=tr();function yX(t){return bX(t)?_X(vX(t)):gX(t)}L2.exports=yX});var Rn=v((Vbe,V2)=>{"use strict";var CX=r2(),xX=O2(),wX=bi(),TX=lt(),SX=B2();function kX(t){return typeof t=="function"?t:t==null?wX:typeof t=="object"?TX(t)?xX(t[0],t[1]):CX(t):SX(t)}V2.exports=kX});var gg=v((zbe,z2)=>{"use strict";var IX=V_(),EX=yT(),MX=Rn(),DX=lt();function PX(t,o){var e=DX(t)?IX:EX;return e(t,MX(o,3))}z2.exports=PX});var q2=v((Hbe,H2)=>{"use strict";var RX=Object.prototype,OX=RX.hasOwnProperty;function FX(t,o){return t!=null&&OX.call(t,o)}H2.exports=FX});var bg=v((qbe,G2)=>{"use strict";var NX=q2(),AX=fg();function LX(t,o){return t!=null&&AX(t,o,NX)}G2.exports=LX});var U2=v((Gbe,j2)=>{"use strict";var BX=Fh(),VX=Zi(),zX=Yo(),HX=lt(),qX=Pn(),GX=Yi(),jX=wa(),UX=Qo(),$X="[object Map]",WX="[object Set]",KX=Object.prototype,YX=KX.hasOwnProperty;function XX(t){if(t==null)return!0;if(qX(t)&&(HX(t)||typeof t=="string"||typeof t.splice=="function"||GX(t)||UX(t)||zX(t)))return!t.length;var o=VX(t);if(o==$X||o==WX)return!t.size;if(jX(t))return!BX(t).length;for(var e in t)if(YX.call(t,e))return!1;return!0}j2.exports=XX});var vg=v((jbe,$2)=>{"use strict";function ZX(t){return t===void 0}$2.exports=ZX});var yg=v((Ube,W2)=>{"use strict";var QX=ka(),JX=Pn();function eZ(t,o){var e=-1,n=JX(t)?Array(t.length):[];return QX(t,function(i,r,a){n[++e]=o(i,r,a)}),n}W2.exports=eZ});var Cg=v(($be,K2)=>{"use strict";var tZ=Ia(),nZ=Rn(),iZ=yg(),oZ=lt();function rZ(t,o){var e=oZ(t)?tZ:iZ;return e(t,nZ(o,3))}K2.exports=rZ});var X2=v((Wbe,Y2)=>{"use strict";function aZ(t,o,e,n){var i=-1,r=t==null?0:t.length;for(n&&r&&(e=t[++i]);++i<r;)e=o(e,t[i],i,t);return e}Y2.exports=aZ});var Q2=v((Kbe,Z2)=>{"use strict";function sZ(t,o,e,n,i){return i(t,function(r,a,s){e=n?(n=!1,r):o(e,r,a,s)}),e}Z2.exports=sZ});var xg=v((Ybe,J2)=>{"use strict";var lZ=X2(),cZ=ka(),dZ=Rn(),uZ=Q2(),pZ=lt();function hZ(t,o,e){var n=pZ(t)?lZ:uZ,i=arguments.length<3;return n(t,dZ(o,4),e,i,cZ)}J2.exports=hZ});var tS=v((Xbe,eS)=>{"use strict";var fZ=mi(),mZ=lt(),_Z=yn(),gZ="[object String]";function bZ(t){return typeof t=="string"||!mZ(t)&&_Z(t)&&fZ(t)==gZ}eS.exports=bZ});var iS=v((Zbe,nS)=>{"use strict";var vZ=_g(),yZ=vZ("length");nS.exports=yZ});var rS=v((Qbe,oS)=>{"use strict";var CZ="\\ud800-\\udfff",xZ="\\u0300-\\u036f",wZ="\\ufe20-\\ufe2f",TZ="\\u20d0-\\u20ff",SZ=xZ+wZ+TZ,kZ="\\ufe0e\\ufe0f",IZ="\\u200d",EZ=RegExp("["+IZ+CZ+SZ+kZ+"]");function MZ(t){return EZ.test(t)}oS.exports=MZ});var fS=v((Jbe,hS)=>{"use strict";var sS="\\ud800-\\udfff",DZ="\\u0300-\\u036f",PZ="\\ufe20-\\ufe2f",RZ="\\u20d0-\\u20ff",OZ=DZ+PZ+RZ,FZ="\\ufe0e\\ufe0f",NZ="["+sS+"]",wg="["+OZ+"]",Tg="\\ud83c[\\udffb-\\udfff]",AZ="(?:"+wg+"|"+Tg+")",lS="[^"+sS+"]",cS="(?:\\ud83c[\\udde6-\\uddff]){2}",dS="[\\ud800-\\udbff][\\udc00-\\udfff]",LZ="\\u200d",uS=AZ+"?",pS="["+FZ+"]?",BZ="(?:"+LZ+"(?:"+[lS,cS,dS].join("|")+")"+pS+uS+")*",VZ=pS+uS+BZ,zZ="(?:"+[lS+wg+"?",wg,cS,dS,NZ].join("|")+")",aS=RegExp(Tg+"(?="+Tg+")|"+zZ+VZ,"g");function HZ(t){for(var o=aS.lastIndex=0;aS.test(t);)++o;return o}hS.exports=HZ});var _S=v((eve,mS)=>{"use strict";var qZ=iS(),GZ=rS(),jZ=fS();function UZ(t){return GZ(t)?jZ(t):qZ(t)}mS.exports=UZ});var bS=v((tve,gS)=>{"use strict";var $Z=Fh(),WZ=Zi(),KZ=Pn(),YZ=tS(),XZ=_S(),ZZ="[object Map]",QZ="[object Set]";function JZ(t){if(t==null)return 0;if(KZ(t))return YZ(t)?XZ(t):t.length;var o=WZ(t);return o==ZZ||o==QZ?t.size:$Z(t).length}gS.exports=JZ});var yS=v((nve,vS)=>{"use strict";var eQ=Ph(),tQ=Q_(),nQ=Hh(),iQ=Rn(),oQ=Sa(),rQ=lt(),aQ=Yi(),sQ=jo(),lQ=Yt(),cQ=Qo();function dQ(t,o,e){var n=rQ(t),i=n||aQ(t)||cQ(t);if(o=iQ(o,4),e==null){var r=t&&t.constructor;i?e=n?new r:[]:lQ(t)?e=sQ(r)?tQ(oQ(t)):{}:e={}}return(i?eQ:nQ)(t,function(a,s,c){return o(e,a,s,c)}),e}vS.exports=dQ});var TS=v((ive,wS)=>{"use strict";var CS=Ki(),uQ=Yo(),pQ=lt(),xS=CS?CS.isConcatSpreadable:void 0;function hQ(t){return pQ(t)||uQ(t)||!!(xS&&t&&t[xS])}wS.exports=hQ});var $h=v((ove,kS)=>{"use strict";var fQ=Ah(),mQ=TS();function SS(t,o,e,n,i){var r=-1,a=t.length;for(e||(e=mQ),i||(i=[]);++r<a;){var s=t[r];o>0&&e(s)?o>1?SS(s,o-1,e,n,i):fQ(i,s):n||(i[i.length]=s)}return i}kS.exports=SS});var ES=v((rve,IS)=>{"use strict";function _Q(t,o,e){switch(e.length){case 0:return t.call(o);case 1:return t.call(o,e[0]);case 2:return t.call(o,e[0],e[1]);case 3:return t.call(o,e[0],e[1],e[2])}return t.apply(o,e)}IS.exports=_Q});var Sg=v((ave,DS)=>{"use strict";var gQ=ES(),MS=Math.max;function bQ(t,o,e){return o=MS(o===void 0?t.length-1:o,0),function(){for(var n=arguments,i=-1,r=MS(n.length-o,0),a=Array(r);++i<r;)a[i]=n[o+i];i=-1;for(var s=Array(o+1);++i<o;)s[i]=n[i];return s[o]=e(a),gQ(t,this,s)}}DS.exports=bQ});var OS=v((sve,RS)=>{"use strict";var vQ=Vh(),PS=O_(),yQ=bi(),CQ=PS?function(t,o){return PS(t,"toString",{configurable:!0,enumerable:!1,value:vQ(o),writable:!0})}:yQ;RS.exports=CQ});var NS=v((lve,FS)=>{"use strict";var xQ=800,wQ=16,TQ=Date.now;function SQ(t){var o=0,e=0;return function(){var n=TQ(),i=wQ-(n-e);if(e=n,i>0){if(++o>=xQ)return arguments[0]}else o=0;return t.apply(void 0,arguments)}}FS.exports=SQ});var kg=v((cve,AS)=>{"use strict";var kQ=OS(),IQ=NS(),EQ=IQ(kQ);AS.exports=EQ});var Da=v((dve,LS)=>{"use strict";var MQ=bi(),DQ=Sg(),PQ=kg();function RQ(t,o){return PQ(DQ(t,o,MQ),t+"")}LS.exports=RQ});var Ig=v((uve,BS)=>{"use strict";function OQ(t,o,e,n){for(var i=t.length,r=e+(n?1:-1);n?r--:++r<i;)if(o(t[r],r,t))return r;return-1}BS.exports=OQ});var zS=v((pve,VS)=>{"use strict";function FQ(t){return t!==t}VS.exports=FQ});var qS=v((hve,HS)=>{"use strict";function NQ(t,o,e){for(var n=e-1,i=t.length;++n<i;)if(t[n]===o)return n;return-1}HS.exports=NQ});var jS=v((fve,GS)=>{"use strict";var AQ=Ig(),LQ=zS(),BQ=qS();function VQ(t,o,e){return o===o?BQ(t,o,e):AQ(t,LQ,e)}GS.exports=VQ});var $S=v((mve,US)=>{"use strict";var zQ=jS();function HQ(t,o){var e=t==null?0:t.length;return!!e&&zQ(t,o,0)>-1}US.exports=HQ});var KS=v((_ve,WS)=>{"use strict";function qQ(t,o,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(o,t[n]))return!0;return!1}WS.exports=qQ});var XS=v((gve,YS)=>{"use strict";function GQ(){}YS.exports=GQ});var QS=v((bve,ZS)=>{"use strict";var Eg=j_(),jQ=XS(),UQ=Gh(),$Q=1/0,WQ=Eg&&1/UQ(new Eg([,-0]))[1]==$Q?function(t){return new Eg(t)}:jQ;ZS.exports=WQ});var ek=v((vve,JS)=>{"use strict";var KQ=og(),YQ=$S(),XQ=KS(),ZQ=rg(),QQ=QS(),JQ=Gh(),eJ=200;function tJ(t,o,e){var n=-1,i=YQ,r=t.length,a=!0,s=[],c=s;if(e)a=!1,i=XQ;else if(r>=eJ){var u=o?null:QQ(t);if(u)return JQ(u);a=!1,i=ZQ,c=new KQ}else c=o?[]:s;e:for(;++n<r;){var h=t[n],g=o?o(h):h;if(h=e||h!==0?h:0,a&&g===g){for(var C=c.length;C--;)if(c[C]===g)continue e;o&&c.push(g),s.push(h)}else i(c,g,e)||(c!==s&&c.push(g),s.push(h))}return s}JS.exports=tJ});var Mg=v((yve,tk)=>{"use strict";var nJ=Pn(),iJ=yn();function oJ(t){return iJ(t)&&nJ(t)}tk.exports=oJ});var ik=v((Cve,nk)=>{"use strict";var rJ=$h(),aJ=Da(),sJ=ek(),lJ=Mg(),cJ=aJ(function(t){return sJ(rJ(t,1,lJ,!0))});nk.exports=cJ});var rk=v((xve,ok)=>{"use strict";var dJ=Ia();function uJ(t,o){return dJ(o,function(e){return t[e]})}ok.exports=uJ});var Dg=v((wve,ak)=>{"use strict";var pJ=rk(),hJ=Hn();function fJ(t){return t==null?[]:pJ(t,hJ(t))}ak.exports=fJ});var Xt=v((Tve,sk)=>{"use strict";var Wh;if(typeof no=="function")try{Wh={clone:aT(),constant:Vh(),each:ig(),filter:gg(),has:bg(),isArray:lt(),isEmpty:U2(),isFunction:jo(),isUndefined:vg(),keys:Hn(),map:Cg(),reduce:xg(),size:bS(),transform:yS(),union:ik(),values:Dg()}}catch{}Wh||(Wh=window._);sk.exports=Wh});var Kh=v((kve,uk)=>{"use strict";var ve=Xt();uk.exports=Pe;var mJ="\0",Ji="\0",lk="";function Pe(t){this._isDirected=ve.has(t,"directed")?t.directed:!0,this._isMultigraph=ve.has(t,"multigraph")?t.multigraph:!1,this._isCompound=ve.has(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=ve.constant(void 0),this._defaultEdgeLabelFn=ve.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Ji]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}Pe.prototype._nodeCount=0;Pe.prototype._edgeCount=0;Pe.prototype.isDirected=function(){return this._isDirected};Pe.prototype.isMultigraph=function(){return this._isMultigraph};Pe.prototype.isCompound=function(){return this._isCompound};Pe.prototype.setGraph=function(t){return this._label=t,this};Pe.prototype.graph=function(){return this._label};Pe.prototype.setDefaultNodeLabel=function(t){return ve.isFunction(t)||(t=ve.constant(t)),this._defaultNodeLabelFn=t,this};Pe.prototype.nodeCount=function(){return this._nodeCount};Pe.prototype.nodes=function(){return ve.keys(this._nodes)};Pe.prototype.sources=function(){var t=this;return ve.filter(this.nodes(),function(o){return ve.isEmpty(t._in[o])})};Pe.prototype.sinks=function(){var t=this;return ve.filter(this.nodes(),function(o){return ve.isEmpty(t._out[o])})};Pe.prototype.setNodes=function(t,o){var e=arguments,n=this;return ve.each(t,function(i){e.length>1?n.setNode(i,o):n.setNode(i)}),this};Pe.prototype.setNode=function(t,o){return ve.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=o),this):(this._nodes[t]=arguments.length>1?o:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Ji,this._children[t]={},this._children[Ji][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)};Pe.prototype.node=function(t){return this._nodes[t]};Pe.prototype.hasNode=function(t){return ve.has(this._nodes,t)};Pe.prototype.removeNode=function(t){var o=this;if(ve.has(this._nodes,t)){var e=function(n){o.removeEdge(o._edgeObjs[n])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ve.each(this.children(t),function(n){o.setParent(n)}),delete this._children[t]),ve.each(ve.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],ve.each(ve.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this};Pe.prototype.setParent=function(t,o){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ve.isUndefined(o))o=Ji;else{o+="";for(var e=o;!ve.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+o+" as parent of "+t+" would create a cycle");this.setNode(o)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=o,this._children[o][t]=!0,this};Pe.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]};Pe.prototype.parent=function(t){if(this._isCompound){var o=this._parent[t];if(o!==Ji)return o}};Pe.prototype.children=function(t){if(ve.isUndefined(t)&&(t=Ji),this._isCompound){var o=this._children[t];if(o)return ve.keys(o)}else{if(t===Ji)return this.nodes();if(this.hasNode(t))return[]}};Pe.prototype.predecessors=function(t){var o=this._preds[t];if(o)return ve.keys(o)};Pe.prototype.successors=function(t){var o=this._sucs[t];if(o)return ve.keys(o)};Pe.prototype.neighbors=function(t){var o=this.predecessors(t);if(o)return ve.union(o,this.successors(t))};Pe.prototype.isLeaf=function(t){var o;return this.isDirected()?o=this.successors(t):o=this.neighbors(t),o.length===0};Pe.prototype.filterNodes=function(t){var o=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});o.setGraph(this.graph());var e=this;ve.each(this._nodes,function(r,a){t(a)&&o.setNode(a,r)}),ve.each(this._edgeObjs,function(r){o.hasNode(r.v)&&o.hasNode(r.w)&&o.setEdge(r,e.edge(r))});var n={};function i(r){var a=e.parent(r);return a===void 0||o.hasNode(a)?(n[r]=a,a):a in n?n[a]:i(a)}return this._isCompound&&ve.each(o.nodes(),function(r){o.setParent(r,i(r))}),o};Pe.prototype.setDefaultEdgeLabel=function(t){return ve.isFunction(t)||(t=ve.constant(t)),this._defaultEdgeLabelFn=t,this};Pe.prototype.edgeCount=function(){return this._edgeCount};Pe.prototype.edges=function(){return ve.values(this._edgeObjs)};Pe.prototype.setPath=function(t,o){var e=this,n=arguments;return ve.reduce(t,function(i,r){return n.length>1?e.setEdge(i,r,o):e.setEdge(i,r),r}),this};Pe.prototype.setEdge=function(){var t,o,e,n,i=!1,r=arguments[0];typeof r=="object"&&r!==null&&"v"in r?(t=r.v,o=r.w,e=r.name,arguments.length===2&&(n=arguments[1],i=!0)):(t=r,o=arguments[1],e=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),t=""+t,o=""+o,ve.isUndefined(e)||(e=""+e);var a=Pa(this._isDirected,t,o,e);if(ve.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=n),this;if(!ve.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(o),this._edgeLabels[a]=i?n:this._defaultEdgeLabelFn(t,o,e);var s=_J(this._isDirected,t,o,e);return t=s.v,o=s.w,Object.freeze(s),this._edgeObjs[a]=s,ck(this._preds[o],t),ck(this._sucs[t],o),this._in[o][a]=s,this._out[t][a]=s,this._edgeCount++,this};Pe.prototype.edge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e);return this._edgeLabels[n]};Pe.prototype.hasEdge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e);return ve.has(this._edgeLabels,n)};Pe.prototype.removeEdge=function(t,o,e){var n=arguments.length===1?Pg(this._isDirected,arguments[0]):Pa(this._isDirected,t,o,e),i=this._edgeObjs[n];return i&&(t=i.v,o=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],dk(this._preds[o],t),dk(this._sucs[t],o),delete this._in[o][n],delete this._out[t][n],this._edgeCount--),this};Pe.prototype.inEdges=function(t,o){var e=this._in[t];if(e){var n=ve.values(e);return o?ve.filter(n,function(i){return i.v===o}):n}};Pe.prototype.outEdges=function(t,o){var e=this._out[t];if(e){var n=ve.values(e);return o?ve.filter(n,function(i){return i.w===o}):n}};Pe.prototype.nodeEdges=function(t,o){var e=this.inEdges(t,o);if(e)return e.concat(this.outEdges(t,o))};function ck(t,o){t[o]?t[o]++:t[o]=1}function dk(t,o){--t[o]||delete t[o]}function Pa(t,o,e,n){var i=""+o,r=""+e;if(!t&&i>r){var a=i;i=r,r=a}return i+lk+r+lk+(ve.isUndefined(n)?mJ:n)}function _J(t,o,e,n){var i=""+o,r=""+e;if(!t&&i>r){var a=i;i=r,r=a}var s={v:i,w:r};return n&&(s.name=n),s}function Pg(t,o){return Pa(t,o.v,o.w,o.name)}});var hk=v((Ive,pk)=>{"use strict";pk.exports="2.1.8"});var mk=v((Eve,fk)=>{"use strict";fk.exports={Graph:Kh(),version:hk()}});var gk=v((Mve,_k)=>{"use strict";var On=Xt(),gJ=Kh();_k.exports={write:bJ,read:CJ};function bJ(t){var o={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:vJ(t),edges:yJ(t)};return On.isUndefined(t.graph())||(o.value=On.clone(t.graph())),o}function vJ(t){return On.map(t.nodes(),function(o){var e=t.node(o),n=t.parent(o),i={v:o};return On.isUndefined(e)||(i.value=e),On.isUndefined(n)||(i.parent=n),i})}function yJ(t){return On.map(t.edges(),function(o){var e=t.edge(o),n={v:o.v,w:o.w};return On.isUndefined(o.name)||(n.name=o.name),On.isUndefined(e)||(n.value=e),n})}function CJ(t){var o=new gJ(t.options).setGraph(t.value);return On.each(t.nodes,function(e){o.setNode(e.v,e.value),e.parent&&o.setParent(e.v,e.parent)}),On.each(t.edges,function(e){o.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),o}});var vk=v((Dve,bk)=>{"use strict";var Yh=Xt();bk.exports=xJ;function xJ(t){var o={},e=[],n;function i(r){Yh.has(o,r)||(o[r]=!0,n.push(r),Yh.each(t.successors(r),i),Yh.each(t.predecessors(r),i))}return Yh.each(t.nodes(),function(r){n=[],i(r),n.length&&e.push(n)}),e}});var Rg=v((Pve,Ck)=>{"use strict";var yk=Xt();Ck.exports=ln;function ln(){this._arr=[],this._keyIndices={}}ln.prototype.size=function(){return this._arr.length};ln.prototype.keys=function(){return this._arr.map(function(t){return t.key})};ln.prototype.has=function(t){return yk.has(this._keyIndices,t)};ln.prototype.priority=function(t){var o=this._keyIndices[t];if(o!==void 0)return this._arr[o].priority};ln.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key};ln.prototype.add=function(t,o){var e=this._keyIndices;if(t=String(t),!yk.has(e,t)){var n=this._arr,i=n.length;return e[t]=i,n.push({key:t,priority:o}),this._decrease(i),!0}return!1};ln.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key};ln.prototype.decrease=function(t,o){var e=this._keyIndices[t];if(o>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+o);this._arr[e].priority=o,this._decrease(e)};ln.prototype._heapify=function(t){var o=this._arr,e=2*t,n=e+1,i=t;e<o.length&&(i=o[e].priority<o[i].priority?e:i,n<o.length&&(i=o[n].priority<o[i].priority?n:i),i!==t&&(this._swap(t,i),this._heapify(i)))};ln.prototype._decrease=function(t){for(var o=this._arr,e=o[t].priority,n;t!==0&&(n=t>>1,!(o[n].priority<e));)this._swap(t,n),t=n};ln.prototype._swap=function(t,o){var e=this._arr,n=this._keyIndices,i=e[t],r=e[o];e[t]=r,e[o]=i,n[r.key]=t,n[i.key]=o}});var Og=v((Rve,xk)=>{"use strict";var wJ=Xt(),TJ=Rg();xk.exports=kJ;var SJ=wJ.constant(1);function kJ(t,o,e,n){return IJ(t,String(o),e||SJ,n||function(i){return t.outEdges(i)})}function IJ(t,o,e,n){var i={},r=new TJ,a,s,c=function(u){var h=u.v!==a?u.v:u.w,g=i[h],C=e(u),k=s.distance+C;if(C<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+C);k<g.distance&&(g.distance=k,g.predecessor=a,r.decrease(h,k))};for(t.nodes().forEach(function(u){var h=u===o?0:Number.POSITIVE_INFINITY;i[u]={distance:h},r.add(u,h)});r.size()>0&&(a=r.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)n(a).forEach(c);return i}});var Tk=v((Ove,wk)=>{"use strict";var EJ=Og(),MJ=Xt();wk.exports=DJ;function DJ(t,o,e){return MJ.transform(t.nodes(),function(n,i){n[i]=EJ(t,i,o,e)},{})}});var Fg=v((Fve,kk)=>{"use strict";var Sk=Xt();kk.exports=PJ;function PJ(t){var o=0,e=[],n={},i=[];function r(a){var s=n[a]={onStack:!0,lowlink:o,index:o++};if(e.push(a),t.successors(a).forEach(function(h){Sk.has(n,h)?n[h].onStack&&(s.lowlink=Math.min(s.lowlink,n[h].index)):(r(h),s.lowlink=Math.min(s.lowlink,n[h].lowlink))}),s.lowlink===s.index){var c=[],u;do u=e.pop(),n[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return t.nodes().forEach(function(a){Sk.has(n,a)||r(a)}),i}});var Ek=v((Nve,Ik)=>{"use strict";var RJ=Xt(),OJ=Fg();Ik.exports=FJ;function FJ(t){return RJ.filter(OJ(t),function(o){return o.length>1||o.length===1&&t.hasEdge(o[0],o[0])})}});var Dk=v((Ave,Mk)=>{"use strict";var NJ=Xt();Mk.exports=LJ;var AJ=NJ.constant(1);function LJ(t,o,e){return BJ(t,o||AJ,e||function(n){return t.outEdges(n)})}function BJ(t,o,e){var n={},i=t.nodes();return i.forEach(function(r){n[r]={},n[r][r]={distance:0},i.forEach(function(a){r!==a&&(n[r][a]={distance:Number.POSITIVE_INFINITY})}),e(r).forEach(function(a){var s=a.v===r?a.w:a.v,c=o(a);n[r][s]={distance:c,predecessor:r}})}),i.forEach(function(r){var a=n[r];i.forEach(function(s){var c=n[s];i.forEach(function(u){var h=c[r],g=a[u],C=c[u],k=h.distance+g.distance;k<C.distance&&(C.distance=k,C.predecessor=g.predecessor)})})}),n}});var Ng=v((Lve,Rk)=>{"use strict";var Ra=Xt();Rk.exports=Pk;Pk.CycleException=Xh;function Pk(t){var o={},e={},n=[];function i(r){if(Ra.has(e,r))throw new Xh;Ra.has(o,r)||(e[r]=!0,o[r]=!0,Ra.each(t.predecessors(r),i),delete e[r],n.push(r))}if(Ra.each(t.sinks(),i),Ra.size(o)!==t.nodeCount())throw new Xh;return n}function Xh(){}Xh.prototype=new Error});var Nk=v((Bve,Fk)=>{"use strict";var Ok=Ng();Fk.exports=VJ;function VJ(t){try{Ok(t)}catch(o){if(o instanceof Ok.CycleException)return!1;throw o}return!0}});var Ag=v((Vve,Lk)=>{"use strict";var Zh=Xt();Lk.exports=zJ;function zJ(t,o,e){Zh.isArray(o)||(o=[o]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],r={};return Zh.each(o,function(a){if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);Ak(t,a,e==="post",r,n,i)}),i}function Ak(t,o,e,n,i,r){Zh.has(n,o)||(n[o]=!0,e||r.push(o),Zh.each(i(o),function(a){Ak(t,a,e,n,i,r)}),e&&r.push(o))}});var Vk=v((zve,Bk)=>{"use strict";var HJ=Ag();Bk.exports=qJ;function qJ(t,o){return HJ(t,o,"post")}});var Hk=v((Hve,zk)=>{"use strict";var GJ=Ag();zk.exports=jJ;function jJ(t,o){return GJ(t,o,"pre")}});var jk=v((qve,Gk)=>{"use strict";var qk=Xt(),UJ=Kh(),$J=Rg();Gk.exports=WJ;function WJ(t,o){var e=new UJ,n={},i=new $J,r;function a(c){var u=c.v===r?c.w:c.v,h=i.priority(u);if(h!==void 0){var g=o(c);g<h&&(n[u]=r,i.decrease(u,g))}}if(t.nodeCount()===0)return e;qk.each(t.nodes(),function(c){i.add(c,Number.POSITIVE_INFINITY),e.setNode(c)}),i.decrease(t.nodes()[0],0);for(var s=!1;i.size()>0;){if(r=i.removeMin(),qk.has(n,r))e.setEdge(r,n[r]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(r).forEach(a)}return e}});var $k=v((Gve,Uk)=>{"use strict";Uk.exports={components:vk(),dijkstra:Og(),dijkstraAll:Tk(),findCycles:Ek(),floydWarshall:Dk(),isAcyclic:Nk(),postorder:Vk(),preorder:Hk(),prim:jk(),tarjan:Fg(),topsort:Ng()}});var Yk=v((jve,Kk)=>{"use strict";var Wk=mk();Kk.exports={Graph:Wk.Graph,json:gk(),alg:$k(),version:Wk.version}});var cn=v((Uve,Xk)=>{"use strict";var Qh;if(typeof no=="function")try{Qh=Yk()}catch{}Qh||(Qh=window.graphlib);Xk.exports=Qh});var Qk=v((Wve,Zk)=>{"use strict";var KJ=eg(),YJ=1,XJ=4;function ZJ(t){return KJ(t,YJ|XJ)}Zk.exports=ZJ});var Oa=v((Kve,Jk)=>{"use strict";var QJ=Wi(),JJ=Pn(),eee=va(),tee=Yt();function nee(t,o,e){if(!tee(e))return!1;var n=typeof o;return(n=="number"?JJ(e)&&eee(o,e.length):n=="string"&&o in e)?QJ(e[o],t):!1}Jk.exports=nee});var nI=v((Yve,tI)=>{"use strict";var iee=Da(),oee=Wi(),ree=Oa(),aee=gi(),eI=Object.prototype,see=eI.hasOwnProperty,lee=iee(function(t,o){t=Object(t);var e=-1,n=o.length,i=n>2?o[2]:void 0;for(i&&ree(o[0],o[1],i)&&(n=1);++e<n;)for(var r=o[e],a=aee(r),s=-1,c=a.length;++s<c;){var u=a[s],h=t[u];(h===void 0||oee(h,eI[u])&&!see.call(t,u))&&(t[u]=r[u])}return t});tI.exports=lee});var oI=v((Xve,iI)=>{"use strict";var cee=Rn(),dee=Pn(),uee=Hn();function pee(t){return function(o,e,n){var i=Object(o);if(!dee(o)){var r=cee(e,3);o=uee(o),e=function(s){return r(i[s],s,i)}}var a=t(o,e,n);return a>-1?i[r?o[a]:a]:void 0}}iI.exports=pee});var aI=v((Zve,rI)=>{"use strict";var hee=/\s/;function fee(t){for(var o=t.length;o--&&hee.test(t.charAt(o)););return o}rI.exports=fee});var lI=v((Qve,sI)=>{"use strict";var mee=aI(),_ee=/^\s+/;function gee(t){return t&&t.slice(0,mee(t)+1).replace(_ee,"")}sI.exports=gee});var pI=v((Jve,uI)=>{"use strict";var bee=lI(),cI=Yt(),vee=Qi(),dI=NaN,yee=/^[-+]0x[0-9a-f]+$/i,Cee=/^0b[01]+$/i,xee=/^0o[0-7]+$/i,wee=parseInt;function Tee(t){if(typeof t=="number")return t;if(vee(t))return dI;if(cI(t)){var o=typeof t.valueOf=="function"?t.valueOf():t;t=cI(o)?o+"":o}if(typeof t!="string")return t===0?t:+t;t=bee(t);var e=Cee.test(t);return e||xee.test(t)?wee(t.slice(2),e?2:8):yee.test(t)?dI:+t}uI.exports=Tee});var Lg=v((eye,fI)=>{"use strict";var See=pI(),hI=1/0,kee=17976931348623157e292;function Iee(t){if(!t)return t===0?t:0;if(t=See(t),t===hI||t===-hI){var o=t<0?-1:1;return o*kee}return t===t?t:0}fI.exports=Iee});var _I=v((tye,mI)=>{"use strict";var Eee=Lg();function Mee(t){var o=Eee(t),e=o%1;return o===o?e?o-e:o:0}mI.exports=Mee});var bI=v((nye,gI)=>{"use strict";var Dee=Ig(),Pee=Rn(),Ree=_I(),Oee=Math.max;function Fee(t,o,e){var n=t==null?0:t.length;if(!n)return-1;var i=e==null?0:Ree(e);return i<0&&(i=Oee(n+i,0)),Dee(t,Pee(o,3),i)}gI.exports=Fee});var yI=v((iye,vI)=>{"use strict";var Nee=oI(),Aee=bI(),Lee=Nee(Aee);vI.exports=Lee});var Bg=v((oye,CI)=>{"use strict";var Bee=$h();function Vee(t){var o=t==null?0:t.length;return o?Bee(t,1):[]}CI.exports=Vee});var wI=v((rye,xI)=>{"use strict";var zee=zh(),Hee=tg(),qee=gi();function Gee(t,o){return t==null?t:zee(t,Hee(o),qee)}xI.exports=Gee});var SI=v((aye,TI)=>{"use strict";function jee(t){var o=t==null?0:t.length;return o?t[o-1]:void 0}TI.exports=jee});var II=v((sye,kI)=>{"use strict";var Uee=_a(),$ee=Hh(),Wee=Rn();function Kee(t,o){var e={};return o=Wee(o,3),$ee(t,function(n,i,r){Uee(e,i,o(n,i,r))}),e}kI.exports=Kee});var Jh=v((lye,EI)=>{"use strict";var Yee=Qi();function Xee(t,o,e){for(var n=-1,i=t.length;++n<i;){var r=t[n],a=o(r);if(a!=null&&(s===void 0?a===a&&!Yee(a):e(a,s)))var s=a,c=r}return c}EI.exports=Xee});var DI=v((cye,MI)=>{"use strict";function Zee(t,o){return t>o}MI.exports=Zee});var RI=v((dye,PI)=>{"use strict";var Qee=Jh(),Jee=DI(),ete=bi();function tte(t){return t&&t.length?Qee(t,ete,Jee):void 0}PI.exports=tte});var Vg=v((uye,OI)=>{"use strict";var nte=_a(),ite=Wi();function ote(t,o,e){(e!==void 0&&!ite(t[o],e)||e===void 0&&!(o in t))&&nte(t,o,e)}OI.exports=ote});var AI=v((pye,NI)=>{"use strict";var rte=mi(),ate=Sa(),ste=yn(),lte="[object Object]",cte=Function.prototype,dte=Object.prototype,FI=cte.toString,ute=dte.hasOwnProperty,pte=FI.call(Object);function hte(t){if(!ste(t)||rte(t)!=lte)return!1;var o=ate(t);if(o===null)return!0;var e=ute.call(o,"constructor")&&o.constructor;return typeof e=="function"&&e instanceof e&&FI.call(e)==pte}NI.exports=hte});var zg=v((hye,LI)=>{"use strict";function fte(t,o){if(!(o==="constructor"&&typeof t[o]=="function")&&o!="__proto__")return t[o]}LI.exports=fte});var VI=v((fye,BI)=>{"use strict";var mte=Ko(),_te=gi();function gte(t){return mte(t,_te(t))}BI.exports=gte});var UI=v((mye,jI)=>{"use strict";var zI=Vg(),bte=L_(),vte=Z_(),yte=B_(),Cte=J_(),HI=Yo(),qI=lt(),xte=Mg(),wte=Yi(),Tte=jo(),Ste=Yt(),kte=AI(),Ite=Qo(),GI=zg(),Ete=VI();function Mte(t,o,e,n,i,r,a){var s=GI(t,e),c=GI(o,e),u=a.get(c);if(u){zI(t,e,u);return}var h=r?r(s,c,e+"",t,o,a):void 0,g=h===void 0;if(g){var C=qI(c),k=!C&&wte(c),I=!C&&!k&&Ite(c);h=c,C||k||I?qI(s)?h=s:xte(s)?h=yte(s):k?(g=!1,h=bte(c,!0)):I?(g=!1,h=vte(c,!0)):h=[]:kte(c)||HI(c)?(h=s,HI(s)?h=Ete(s):(!Ste(s)||Tte(s))&&(h=Cte(c))):g=!1}g&&(a.set(c,h),i(h,c,n,r,a),a.delete(c)),zI(t,e,h)}jI.exports=Mte});var KI=v((_ye,WI)=>{"use strict";var Dte=ma(),Pte=Vg(),Rte=zh(),Ote=UI(),Fte=Yt(),Nte=gi(),Ate=zg();function $I(t,o,e,n,i){t!==o&&Rte(o,function(r,a){if(i||(i=new Dte),Fte(r))Ote(t,o,a,e,$I,n,i);else{var s=n?n(Ate(t,a),r,a+"",t,o,i):void 0;s===void 0&&(s=r),Pte(t,a,s)}},Nte)}WI.exports=$I});var XI=v((gye,YI)=>{"use strict";var Lte=Da(),Bte=Oa();function Vte(t){return Lte(function(o,e){var n=-1,i=e.length,r=i>1?e[i-1]:void 0,a=i>2?e[2]:void 0;for(r=t.length>3&&typeof r=="function"?(i--,r):void 0,a&&Bte(e[0],e[1],a)&&(r=i<3?void 0:r,i=1),o=Object(o);++n<i;){var s=e[n];s&&t(o,s,n,r)}return o})}YI.exports=Vte});var QI=v((bye,ZI)=>{"use strict";var zte=KI(),Hte=XI(),qte=Hte(function(t,o,e){zte(t,o,e)});ZI.exports=qte});var Hg=v((vye,JI)=>{"use strict";function Gte(t,o){return t<o}JI.exports=Gte});var tE=v((yye,eE)=>{"use strict";var jte=Jh(),Ute=Hg(),$te=bi();function Wte(t){return t&&t.length?jte(t,$te,Ute):void 0}eE.exports=Wte});var iE=v((Cye,nE)=>{"use strict";var Kte=Jh(),Yte=Rn(),Xte=Hg();function Zte(t,o){return t&&t.length?Kte(t,Yte(o,2),Xte):void 0}nE.exports=Zte});var rE=v((xye,oE)=>{"use strict";var Qte=sn(),Jte=function(){return Qte.Date.now()};oE.exports=Jte});var lE=v((wye,sE)=>{"use strict";var ene=ga(),tne=Ea(),nne=va(),aE=Yt(),ine=tr();function one(t,o,e,n){if(!aE(t))return t;o=tne(o,t);for(var i=-1,r=o.length,a=r-1,s=t;s!=null&&++i<r;){var c=ine(o[i]),u=e;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var h=s[c];u=n?n(h,c,s):void 0,u===void 0&&(u=aE(h)?h:nne(o[i+1])?[]:{})}ene(s,c,u),s=s[c]}return t}sE.exports=one});var dE=v((Tye,cE)=>{"use strict";var rne=Ma(),ane=lE(),sne=Ea();function lne(t,o,e){for(var n=-1,i=o.length,r={};++n<i;){var a=o[n],s=rne(t,a);e(s,a)&&ane(r,sne(a,t),s)}return r}cE.exports=lne});var pE=v((Sye,uE)=>{"use strict";var cne=dE(),dne=mg();function une(t,o){return cne(t,o,function(e,n){return dne(t,n)})}uE.exports=une});var fE=v((kye,hE)=>{"use strict";var pne=Bg(),hne=Sg(),fne=kg();function mne(t){return fne(hne(t,void 0,pne),t+"")}hE.exports=mne});var _E=v((Iye,mE)=>{"use strict";var _ne=pE(),gne=fE(),bne=gne(function(t,o){return t==null?{}:_ne(t,o)});mE.exports=bne});var bE=v((Eye,gE)=>{"use strict";var vne=Math.ceil,yne=Math.max;function Cne(t,o,e,n){for(var i=-1,r=yne(vne((o-t)/(e||1)),0),a=Array(r);r--;)a[n?r:++i]=t,t+=e;return a}gE.exports=Cne});var yE=v((Mye,vE)=>{"use strict";var xne=bE(),wne=Oa(),qg=Lg();function Tne(t){return function(o,e,n){return n&&typeof n!="number"&&wne(o,e,n)&&(e=n=void 0),o=qg(o),e===void 0?(e=o,o=0):e=qg(e),n=n===void 0?o<e?1:-1:qg(n),xne(o,e,n,t)}}vE.exports=Tne});var xE=v((Dye,CE)=>{"use strict";var Sne=yE(),kne=Sne();CE.exports=kne});var TE=v((Pye,wE)=>{"use strict";function Ine(t,o){var e=t.length;for(t.sort(o);e--;)t[e]=t[e].value;return t}wE.exports=Ine});var IE=v((Rye,kE)=>{"use strict";var SE=Qi();function Ene(t,o){if(t!==o){var e=t!==void 0,n=t===null,i=t===t,r=SE(t),a=o!==void 0,s=o===null,c=o===o,u=SE(o);if(!s&&!u&&!r&&t>o||r&&a&&c&&!s&&!u||n&&a&&c||!e&&c||!i)return 1;if(!n&&!r&&!u&&t<o||u&&e&&i&&!n&&!r||s&&e&&i||!a&&i||!c)return-1}return 0}kE.exports=Ene});var ME=v((Oye,EE)=>{"use strict";var Mne=IE();function Dne(t,o,e){for(var n=-1,i=t.criteria,r=o.criteria,a=i.length,s=e.length;++n<a;){var c=Mne(i[n],r[n]);if(c){if(n>=s)return c;var u=e[n];return c*(u=="desc"?-1:1)}}return t.index-o.index}EE.exports=Dne});var PE=v((Fye,DE)=>{"use strict";var Gg=Ia(),Pne=Ma(),Rne=Rn(),One=yg(),Fne=TE(),Nne=ya(),Ane=ME(),Lne=bi(),Bne=lt();function Vne(t,o,e){o.length?o=Gg(o,function(r){return Bne(r)?function(a){return Pne(a,r.length===1?r[0]:r)}:r}):o=[Lne];var n=-1;o=Gg(o,Nne(Rne));var i=One(t,function(r,a,s){var c=Gg(o,function(u){return u(r)});return{criteria:c,index:++n,value:r}});return Fne(i,function(r,a){return Ane(r,a,e)})}DE.exports=Vne});var FE=v((Nye,OE)=>{"use strict";var zne=$h(),Hne=PE(),qne=Da(),RE=Oa(),Gne=qne(function(t,o){if(t==null)return[];var e=o.length;return e>1&&RE(t,o[0],o[1])?o=[]:e>2&&RE(o[0],o[1],o[2])&&(o=[o[0]]),Hne(t,zne(o,1),[])});OE.exports=Gne});var AE=v((Aye,NE)=>{"use strict";var jne=hg(),Une=0;function $ne(t){var o=++Une;return jne(t)+o}NE.exports=$ne});var BE=v((Lye,LE)=>{"use strict";function Wne(t,o,e){for(var n=-1,i=t.length,r=o.length,a={};++n<i;){var s=n<r?o[n]:void 0;e(a,t[n],s)}return a}LE.exports=Wne});var zE=v((Bye,VE)=>{"use strict";var Kne=ga(),Yne=BE();function Xne(t,o){return Yne(t||[],o||[],Kne)}VE.exports=Xne});var et=v((Vye,HE)=>{"use strict";var ef;if(typeof no=="function")try{ef={cloneDeep:Qk(),constant:Vh(),defaults:nI(),each:ig(),filter:gg(),find:yI(),flatten:Bg(),forEach:ng(),forIn:wI(),has:bg(),isUndefined:vg(),last:SI(),map:Cg(),mapValues:II(),max:RI(),merge:QI(),min:tE(),minBy:iE(),now:rE(),pick:_E(),range:xE(),reduce:xg(),sortBy:FE(),uniqueId:AE(),values:Dg(),zipObject:zE()}}catch{}ef||(ef=window._);HE.exports=ef});var jE=v((Hye,GE)=>{"use strict";GE.exports=tf;function tf(){var t={};t._next=t._prev=t,this._sentinel=t}tf.prototype.dequeue=function(){var t=this._sentinel,o=t._prev;if(o!==t)return qE(o),o};tf.prototype.enqueue=function(t){var o=this._sentinel;t._prev&&t._next&&qE(t),t._next=o._next,o._next._prev=t,o._next=t,t._prev=o};tf.prototype.toString=function(){for(var t=[],o=this._sentinel,e=o._prev;e!==o;)t.push(JSON.stringify(e,Zne)),e=e._prev;return"["+t.join(", ")+"]"};function qE(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Zne(t,o){if(t!=="_next"&&t!=="_prev")return o}});var $E=v((qye,UE)=>{"use strict";var qn=et(),Qne=cn().Graph,Jne=jE();UE.exports=tie;var eie=qn.constant(1);function tie(t,o){if(t.nodeCount()<=1)return[];var e=iie(t,o||eie),n=nie(e.graph,e.buckets,e.zeroIdx);return qn.flatten(qn.map(n,function(i){return t.outEdges(i.v,i.w)}),!0)}function nie(t,o,e){for(var n=[],i=o[o.length-1],r=o[0],a;t.nodeCount();){for(;a=r.dequeue();)jg(t,o,e,a);for(;a=i.dequeue();)jg(t,o,e,a);if(t.nodeCount()){for(var s=o.length-2;s>0;--s)if(a=o[s].dequeue(),a){n=n.concat(jg(t,o,e,a,!0));break}}}return n}function jg(t,o,e,n,i){var r=i?[]:void 0;return qn.forEach(t.inEdges(n.v),function(a){var s=t.edge(a),c=t.node(a.v);i&&r.push({v:a.v,w:a.w}),c.out-=s,Ug(o,e,c)}),qn.forEach(t.outEdges(n.v),function(a){var s=t.edge(a),c=a.w,u=t.node(c);u.in-=s,Ug(o,e,u)}),t.removeNode(n.v),r}function iie(t,o){var e=new Qne,n=0,i=0;qn.forEach(t.nodes(),function(s){e.setNode(s,{v:s,in:0,out:0})}),qn.forEach(t.edges(),function(s){var c=e.edge(s.v,s.w)||0,u=o(s),h=c+u;e.setEdge(s.v,s.w,h),i=Math.max(i,e.node(s.v).out+=u),n=Math.max(n,e.node(s.w).in+=u)});var r=qn.range(i+n+3).map(function(){return new Jne}),a=n+1;return qn.forEach(e.nodes(),function(s){Ug(r,a,e.node(s))}),{graph:e,buckets:r,zeroIdx:a}}function Ug(t,o,e){e.out?e.in?t[e.out-e.in+o].enqueue(e):t[t.length-1].enqueue(e):t[0].enqueue(e)}});var KE=v((Gye,WE)=>{"use strict";var eo=et(),oie=$E();WE.exports={run:rie,undo:sie};function rie(t){var o=t.graph().acyclicer==="greedy"?oie(t,e(t)):aie(t);eo.forEach(o,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,eo.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function aie(t){var o=[],e={},n={};function i(r){eo.has(n,r)||(n[r]=!0,e[r]=!0,eo.forEach(t.outEdges(r),function(a){eo.has(e,a.w)?o.push(a):i(a.w)}),delete e[r])}return eo.forEach(t.nodes(),i),o}function sie(t){eo.forEach(t.edges(),function(o){var e=t.edge(o);if(e.reversed){t.removeEdge(o);var n=e.forwardName;delete e.reversed,delete e.forwardName,t.setEdge(o.w,o.v,e,n)}})}});var Nt=v((jye,QE)=>{"use strict";var Ae=et(),YE=cn().Graph;QE.exports={addDummyNode:XE,simplify:lie,asNonCompoundGraph:cie,successorWeights:die,predecessorWeights:uie,intersectRect:pie,buildLayerMatrix:hie,normalizeRanks:fie,removeEmptyRanks:mie,addBorderNode:_ie,maxRank:ZE,partition:gie,time:bie,notime:vie};function XE(t,o,e,n){var i;do i=Ae.uniqueId(n);while(t.hasNode(i));return e.dummy=o,t.setNode(i,e),i}function lie(t){var o=new YE().setGraph(t.graph());return Ae.forEach(t.nodes(),function(e){o.setNode(e,t.node(e))}),Ae.forEach(t.edges(),function(e){var n=o.edge(e.v,e.w)||{weight:0,minlen:1},i=t.edge(e);o.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),o}function cie(t){var o=new YE({multigraph:t.isMultigraph()}).setGraph(t.graph());return Ae.forEach(t.nodes(),function(e){t.children(e).length||o.setNode(e,t.node(e))}),Ae.forEach(t.edges(),function(e){o.setEdge(e,t.edge(e))}),o}function die(t){var o=Ae.map(t.nodes(),function(e){var n={};return Ae.forEach(t.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+t.edge(i).weight}),n});return Ae.zipObject(t.nodes(),o)}function uie(t){var o=Ae.map(t.nodes(),function(e){var n={};return Ae.forEach(t.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+t.edge(i).weight}),n});return Ae.zipObject(t.nodes(),o)}function pie(t,o){var e=t.x,n=t.y,i=o.x-e,r=o.y-n,a=t.width/2,s=t.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");var c,u;return Math.abs(r)*a>Math.abs(i)*s?(r<0&&(s=-s),c=s*i/r,u=s):(i<0&&(a=-a),c=a,u=a*r/i),{x:e+c,y:n+u}}function hie(t){var o=Ae.map(Ae.range(ZE(t)+1),function(){return[]});return Ae.forEach(t.nodes(),function(e){var n=t.node(e),i=n.rank;Ae.isUndefined(i)||(o[i][n.order]=e)}),o}function fie(t){var o=Ae.min(Ae.map(t.nodes(),function(e){return t.node(e).rank}));Ae.forEach(t.nodes(),function(e){var n=t.node(e);Ae.has(n,"rank")&&(n.rank-=o)})}function mie(t){var o=Ae.min(Ae.map(t.nodes(),function(r){return t.node(r).rank})),e=[];Ae.forEach(t.nodes(),function(r){var a=t.node(r).rank-o;e[a]||(e[a]=[]),e[a].push(r)});var n=0,i=t.graph().nodeRankFactor;Ae.forEach(e,function(r,a){Ae.isUndefined(r)&&a%i!==0?--n:n&&Ae.forEach(r,function(s){t.node(s).rank+=n})})}function _ie(t,o,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),XE(t,"border",i,o)}function ZE(t){return Ae.max(Ae.map(t.nodes(),function(o){var e=t.node(o).rank;if(!Ae.isUndefined(e))return e}))}function gie(t,o){var e={lhs:[],rhs:[]};return Ae.forEach(t,function(n){o(n)?e.lhs.push(n):e.rhs.push(n)}),e}function bie(t,o){var e=Ae.now();try{return o()}finally{console.log(t+" time: "+(Ae.now()-e)+"ms")}}function vie(t,o){return o()}});var tM=v((Uye,eM)=>{"use strict";var JE=et(),yie=Nt();eM.exports={run:Cie,undo:wie};function Cie(t){t.graph().dummyChains=[],JE.forEach(t.edges(),function(o){xie(t,o)})}function xie(t,o){var e=o.v,n=t.node(e).rank,i=o.w,r=t.node(i).rank,a=o.name,s=t.edge(o),c=s.labelRank;if(r!==n+1){t.removeEdge(o);var u,h,g;for(g=0,++n;n<r;++g,++n)s.points=[],h={width:0,height:0,edgeLabel:s,edgeObj:o,rank:n},u=yie.addDummyNode(t,"edge",h,"_d"),n===c&&(h.width=s.width,h.height=s.height,h.dummy="edge-label",h.labelpos=s.labelpos),t.setEdge(e,u,{weight:s.weight},a),g===0&&t.graph().dummyChains.push(u),e=u;t.setEdge(e,i,{weight:s.weight},a)}}function wie(t){JE.forEach(t.graph().dummyChains,function(o){var e=t.node(o),n=e.edgeLabel,i;for(t.setEdge(e.edgeObj,n);e.dummy;)i=t.successors(o)[0],t.removeNode(o),n.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(n.x=e.x,n.y=e.y,n.width=e.width,n.height=e.height),o=i,e=t.node(o)})}});var Fa=v(($ye,nM)=>{"use strict";var nf=et();nM.exports={longestPath:Tie,slack:Sie};function Tie(t){var o={};function e(n){var i=t.node(n);if(nf.has(o,n))return i.rank;o[n]=!0;var r=nf.min(nf.map(t.outEdges(n),function(a){return e(a.w)-t.edge(a).minlen}));return(r===Number.POSITIVE_INFINITY||r===void 0||r===null)&&(r=0),i.rank=r}nf.forEach(t.sources(),e)}function Sie(t,o){return t.node(o.w).rank-t.node(o.v).rank-t.edge(o).minlen}});var $g=v((Wye,iM)=>{"use strict";var of=et(),kie=cn().Graph,rf=Fa().slack;iM.exports=Iie;function Iie(t){var o=new kie({directed:!1}),e=t.nodes()[0],n=t.nodeCount();o.setNode(e,{});for(var i,r;Eie(o,t)<n;)i=Mie(o,t),r=o.hasNode(i.v)?rf(t,i):-rf(t,i),Die(o,t,r);return o}function Eie(t,o){function e(n){of.forEach(o.nodeEdges(n),function(i){var r=i.v,a=n===r?i.w:r;!t.hasNode(a)&&!rf(o,i)&&(t.setNode(a,{}),t.setEdge(n,a,{}),e(a))})}return of.forEach(t.nodes(),e),t.nodeCount()}function Mie(t,o){return of.minBy(o.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w))return rf(o,e)})}function Die(t,o,e){of.forEach(t.nodes(),function(n){o.node(n).rank+=e})}});var uM=v((Kye,dM)=>{"use strict";var Gn=et(),Pie=$g(),Rie=Fa().slack,Oie=Fa().longestPath,Fie=cn().alg.preorder,Nie=cn().alg.postorder,Aie=Nt().simplify;dM.exports=to;to.initLowLimValues=Kg;to.initCutValues=Wg;to.calcCutValue=rM;to.leaveEdge=sM;to.enterEdge=lM;to.exchangeEdges=cM;function to(t){t=Aie(t),Oie(t);var o=Pie(t);Kg(o),Wg(o,t);for(var e,n;e=sM(o);)n=lM(o,t,e),cM(o,t,e,n)}function Wg(t,o){var e=Nie(t,t.nodes());e=e.slice(0,e.length-1),Gn.forEach(e,function(n){Lie(t,o,n)})}function Lie(t,o,e){var n=t.node(e),i=n.parent;t.edge(e,i).cutvalue=rM(t,o,e)}function rM(t,o,e){var n=t.node(e),i=n.parent,r=!0,a=o.edge(e,i),s=0;return a||(r=!1,a=o.edge(i,e)),s=a.weight,Gn.forEach(o.nodeEdges(e),function(c){var u=c.v===e,h=u?c.w:c.v;if(h!==i){var g=u===r,C=o.edge(c).weight;if(s+=g?C:-C,Vie(t,e,h)){var k=t.edge(e,h).cutvalue;s+=g?-k:k}}}),s}function Kg(t,o){arguments.length<2&&(o=t.nodes()[0]),aM(t,{},1,o)}function aM(t,o,e,n,i){var r=e,a=t.node(n);return o[n]=!0,Gn.forEach(t.neighbors(n),function(s){Gn.has(o,s)||(e=aM(t,o,e,s,n))}),a.low=r,a.lim=e++,i?a.parent=i:delete a.parent,e}function sM(t){return Gn.find(t.edges(),function(o){return t.edge(o).cutvalue<0})}function lM(t,o,e){var n=e.v,i=e.w;o.hasEdge(n,i)||(n=e.w,i=e.v);var r=t.node(n),a=t.node(i),s=r,c=!1;r.lim>a.lim&&(s=a,c=!0);var u=Gn.filter(o.edges(),function(h){return c===oM(t,t.node(h.v),s)&&c!==oM(t,t.node(h.w),s)});return Gn.minBy(u,function(h){return Rie(o,h)})}function cM(t,o,e,n){var i=e.v,r=e.w;t.removeEdge(i,r),t.setEdge(n.v,n.w,{}),Kg(t),Wg(t,o),Bie(t,o)}function Bie(t,o){var e=Gn.find(t.nodes(),function(i){return!o.node(i).parent}),n=Fie(t,e);n=n.slice(1),Gn.forEach(n,function(i){var r=t.node(i).parent,a=o.edge(i,r),s=!1;a||(a=o.edge(r,i),s=!0),o.node(i).rank=o.node(r).rank+(s?a.minlen:-a.minlen)})}function Vie(t,o,e){return t.hasEdge(o,e)}function oM(t,o,e){return e.low<=o.lim&&o.lim<=e.lim}});var mM=v((Yye,fM)=>{"use strict";var zie=Fa(),hM=zie.longestPath,Hie=$g(),qie=uM();fM.exports=Gie;function Gie(t){switch(t.graph().ranker){case"network-simplex":pM(t);break;case"tight-tree":Uie(t);break;case"longest-path":jie(t);break;default:pM(t)}}var jie=hM;function Uie(t){hM(t),Hie(t)}function pM(t){qie(t)}});var gM=v((Xye,_M)=>{"use strict";var Yg=et();_M.exports=$ie;function $ie(t){var o=Kie(t);Yg.forEach(t.graph().dummyChains,function(e){for(var n=t.node(e),i=n.edgeObj,r=Wie(t,o,i.v,i.w),a=r.path,s=r.lca,c=0,u=a[c],h=!0;e!==i.w;){if(n=t.node(e),h){for(;(u=a[c])!==s&&t.node(u).maxRank<n.rank;)c++;u===s&&(h=!1)}if(!h){for(;c<a.length-1&&t.node(u=a[c+1]).minRank<=n.rank;)c++;u=a[c]}t.setParent(e,u),e=t.successors(e)[0]}})}function Wie(t,o,e,n){var i=[],r=[],a=Math.min(o[e].low,o[n].low),s=Math.max(o[e].lim,o[n].lim),c,u;c=e;do c=t.parent(c),i.push(c);while(c&&(o[c].low>a||s>o[c].lim));for(u=c,c=n;(c=t.parent(c))!==u;)r.push(c);return{path:i.concat(r.reverse()),lca:u}}function Kie(t){var o={},e=0;function n(i){var r=e;Yg.forEach(t.children(i),n),o[i]={low:r,lim:e++}}return Yg.forEach(t.children(),n),o}});var yM=v((Zye,vM)=>{"use strict";var jn=et(),Xg=Nt();vM.exports={run:Yie,cleanup:Qie};function Yie(t){var o=Xg.addDummyNode(t,"root",{},"_root"),e=Xie(t),n=jn.max(jn.values(e))-1,i=2*n+1;t.graph().nestingRoot=o,jn.forEach(t.edges(),function(a){t.edge(a).minlen*=i});var r=Zie(t)+1;jn.forEach(t.children(),function(a){bM(t,o,i,r,n,e,a)}),t.graph().nodeRankFactor=i}function bM(t,o,e,n,i,r,a){var s=t.children(a);if(!s.length){a!==o&&t.setEdge(o,a,{weight:0,minlen:e});return}var c=Xg.addBorderNode(t,"_bt"),u=Xg.addBorderNode(t,"_bb"),h=t.node(a);t.setParent(c,a),h.borderTop=c,t.setParent(u,a),h.borderBottom=u,jn.forEach(s,function(g){bM(t,o,e,n,i,r,g);var C=t.node(g),k=C.borderTop?C.borderTop:g,I=C.borderBottom?C.borderBottom:g,N=C.borderTop?n:2*n,q=k!==I?1:i-r[a]+1;t.setEdge(c,k,{weight:N,minlen:q,nestingEdge:!0}),t.setEdge(I,u,{weight:N,minlen:q,nestingEdge:!0})}),t.parent(a)||t.setEdge(o,c,{weight:0,minlen:i+r[a]})}function Xie(t){var o={};function e(n,i){var r=t.children(n);r&&r.length&&jn.forEach(r,function(a){e(a,i+1)}),o[n]=i}return jn.forEach(t.children(),function(n){e(n,1)}),o}function Zie(t){return jn.reduce(t.edges(),function(o,e){return o+t.edge(e).weight},0)}function Qie(t){var o=t.graph();t.removeNode(o.nestingRoot),delete o.nestingRoot,jn.forEach(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}});var wM=v((Qye,xM)=>{"use strict";var Zg=et(),Jie=Nt();xM.exports=eoe;function eoe(t){function o(e){var n=t.children(e),i=t.node(e);if(n.length&&Zg.forEach(n,o),Zg.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var r=i.minRank,a=i.maxRank+1;r<a;++r)CM(t,"borderLeft","_bl",e,i,r),CM(t,"borderRight","_br",e,i,r)}}Zg.forEach(t.children(),o)}function CM(t,o,e,n,i,r){var a={width:0,height:0,rank:r,borderType:o},s=i[o][r-1],c=Jie.addDummyNode(t,"border",a,e);i[o][r]=c,t.setParent(c,n),s&&t.setEdge(s,c,{weight:1})}});var IM=v((Jye,kM)=>{"use strict";var Fn=et();kM.exports={adjust:toe,undo:noe};function toe(t){var o=t.graph().rankdir.toLowerCase();(o==="lr"||o==="rl")&&SM(t)}function noe(t){var o=t.graph().rankdir.toLowerCase();(o==="bt"||o==="rl")&&ioe(t),(o==="lr"||o==="rl")&&(ooe(t),SM(t))}function SM(t){Fn.forEach(t.nodes(),function(o){TM(t.node(o))}),Fn.forEach(t.edges(),function(o){TM(t.edge(o))})}function TM(t){var o=t.width;t.width=t.height,t.height=o}function ioe(t){Fn.forEach(t.nodes(),function(o){Qg(t.node(o))}),Fn.forEach(t.edges(),function(o){var e=t.edge(o);Fn.forEach(e.points,Qg),Fn.has(e,"y")&&Qg(e)})}function Qg(t){t.y=-t.y}function ooe(t){Fn.forEach(t.nodes(),function(o){Jg(t.node(o))}),Fn.forEach(t.edges(),function(o){var e=t.edge(o);Fn.forEach(e.points,Jg),Fn.has(e,"x")&&Jg(e)})}function Jg(t){var o=t.x;t.x=t.y,t.y=o}});var MM=v((eCe,EM)=>{"use strict";var Un=et();EM.exports=roe;function roe(t){var o={},e=Un.filter(t.nodes(),function(s){return!t.children(s).length}),n=Un.max(Un.map(e,function(s){return t.node(s).rank})),i=Un.map(Un.range(n+1),function(){return[]});function r(s){if(!Un.has(o,s)){o[s]=!0;var c=t.node(s);i[c.rank].push(s),Un.forEach(t.successors(s),r)}}var a=Un.sortBy(e,function(s){return t.node(s).rank});return Un.forEach(a,r),i}});var PM=v((tCe,DM)=>{"use strict";var vi=et();DM.exports=aoe;function aoe(t,o){for(var e=0,n=1;n<o.length;++n)e+=soe(t,o[n-1],o[n]);return e}function soe(t,o,e){for(var n=vi.zipObject(e,vi.map(e,function(u,h){return h})),i=vi.flatten(vi.map(o,function(u){return vi.sortBy(vi.map(t.outEdges(u),function(h){return{pos:n[h.w],weight:t.edge(h).weight}}),"pos")}),!0),r=1;r<e.length;)r<<=1;var a=2*r-1;r-=1;var s=vi.map(new Array(a),function(){return 0}),c=0;return vi.forEach(i.forEach(function(u){var h=u.pos+r;s[h]+=u.weight;for(var g=0;h>0;)h%2&&(g+=s[h+1]),h=h-1>>1,s[h]+=u.weight;c+=u.weight*g})),c}});var FM=v((nCe,OM)=>{"use strict";var RM=et();OM.exports=loe;function loe(t,o){return RM.map(o,function(e){var n=t.inEdges(e);if(n.length){var i=RM.reduce(n,function(r,a){var s=t.edge(a),c=t.node(a.v);return{sum:r.sum+s.weight*c.order,weight:r.weight+s.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}});var AM=v((iCe,NM)=>{"use strict";var Zt=et();NM.exports=coe;function coe(t,o){var e={};Zt.forEach(t,function(i,r){var a=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:r};Zt.isUndefined(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),Zt.forEach(o.edges(),function(i){var r=e[i.v],a=e[i.w];!Zt.isUndefined(r)&&!Zt.isUndefined(a)&&(a.indegree++,r.out.push(e[i.w]))});var n=Zt.filter(e,function(i){return!i.indegree});return doe(n)}function doe(t){var o=[];function e(r){return function(a){a.merged||(Zt.isUndefined(a.barycenter)||Zt.isUndefined(r.barycenter)||a.barycenter>=r.barycenter)&&uoe(r,a)}}function n(r){return function(a){a.in.push(r),--a.indegree===0&&t.push(a)}}for(;t.length;){var i=t.pop();o.push(i),Zt.forEach(i.in.reverse(),e(i)),Zt.forEach(i.out,n(i))}return Zt.map(Zt.filter(o,function(r){return!r.merged}),function(r){return Zt.pick(r,["vs","i","barycenter","weight"])})}function uoe(t,o){var e=0,n=0;t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),o.weight&&(e+=o.barycenter*o.weight,n+=o.weight),t.vs=o.vs.concat(t.vs),t.barycenter=e/n,t.weight=n,t.i=Math.min(o.i,t.i),o.merged=!0}});var VM=v((oCe,BM)=>{"use strict";var Na=et(),poe=Nt();BM.exports=hoe;function hoe(t,o){var e=poe.partition(t,function(h){return Na.has(h,"barycenter")}),n=e.lhs,i=Na.sortBy(e.rhs,function(h){return-h.i}),r=[],a=0,s=0,c=0;n.sort(foe(!!o)),c=LM(r,i,c),Na.forEach(n,function(h){c+=h.vs.length,r.push(h.vs),a+=h.barycenter*h.weight,s+=h.weight,c=LM(r,i,c)});var u={vs:Na.flatten(r,!0)};return s&&(u.barycenter=a/s,u.weight=s),u}function LM(t,o,e){for(var n;o.length&&(n=Na.last(o)).i<=e;)o.pop(),t.push(n.vs),e++;return e}function foe(t){return function(o,e){return o.barycenter<e.barycenter?-1:o.barycenter>e.barycenter?1:t?e.i-o.i:o.i-e.i}}});var qM=v((rCe,HM)=>{"use strict";var yi=et(),moe=FM(),_oe=AM(),goe=VM();HM.exports=zM;function zM(t,o,e,n){var i=t.children(o),r=t.node(o),a=r?r.borderLeft:void 0,s=r?r.borderRight:void 0,c={};a&&(i=yi.filter(i,function(I){return I!==a&&I!==s}));var u=moe(t,i);yi.forEach(u,function(I){if(t.children(I.v).length){var N=zM(t,I.v,e,n);c[I.v]=N,yi.has(N,"barycenter")&&voe(I,N)}});var h=_oe(u,e);boe(h,c);var g=goe(h,n);if(a&&(g.vs=yi.flatten([a,g.vs,s],!0),t.predecessors(a).length)){var C=t.node(t.predecessors(a)[0]),k=t.node(t.predecessors(s)[0]);yi.has(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+C.order+k.order)/(g.weight+2),g.weight+=2}return g}function boe(t,o){yi.forEach(t,function(e){e.vs=yi.flatten(e.vs.map(function(n){return o[n]?o[n].vs:n}),!0)})}function voe(t,o){yi.isUndefined(t.barycenter)?(t.barycenter=o.barycenter,t.weight=o.weight):(t.barycenter=(t.barycenter*t.weight+o.barycenter*o.weight)/(t.weight+o.weight),t.weight+=o.weight)}});var jM=v((aCe,GM)=>{"use strict";var Aa=et(),yoe=cn().Graph;GM.exports=Coe;function Coe(t,o,e){var n=xoe(t),i=new yoe({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(r){return t.node(r)});return Aa.forEach(t.nodes(),function(r){var a=t.node(r),s=t.parent(r);(a.rank===o||a.minRank<=o&&o<=a.maxRank)&&(i.setNode(r),i.setParent(r,s||n),Aa.forEach(t[e](r),function(c){var u=c.v===r?c.w:c.v,h=i.edge(u,r),g=Aa.isUndefined(h)?0:h.weight;i.setEdge(u,r,{weight:t.edge(c).weight+g})}),Aa.has(a,"minRank")&&i.setNode(r,{borderLeft:a.borderLeft[o],borderRight:a.borderRight[o]}))}),i}function xoe(t){for(var o;t.hasNode(o=Aa.uniqueId("_root")););return o}});var $M=v((sCe,UM)=>{"use strict";var woe=et();UM.exports=Toe;function Toe(t,o,e){var n={},i;woe.forEach(e,function(r){for(var a=t.parent(r),s,c;a;){if(s=t.parent(a),s?(c=n[s],n[s]=a):(c=i,i=a),c&&c!==a){o.setEdge(c,a);return}a=s}})}});var ZM=v((lCe,XM)=>{"use strict";var Ci=et(),Soe=MM(),koe=PM(),Ioe=qM(),Eoe=jM(),Moe=$M(),Doe=cn().Graph,WM=Nt();XM.exports=Poe;function Poe(t){var o=WM.maxRank(t),e=KM(t,Ci.range(1,o+1),"inEdges"),n=KM(t,Ci.range(o-1,-1,-1),"outEdges"),i=Soe(t);YM(t,i);for(var r=Number.POSITIVE_INFINITY,a,s=0,c=0;c<4;++s,++c){Roe(s%2?e:n,s%4>=2),i=WM.buildLayerMatrix(t);var u=koe(t,i);u<r&&(c=0,a=Ci.cloneDeep(i),r=u)}YM(t,a)}function KM(t,o,e){return Ci.map(o,function(n){return Eoe(t,n,e)})}function Roe(t,o){var e=new Doe;Ci.forEach(t,function(n){var i=n.graph().root,r=Ioe(n,i,e,o);Ci.forEach(r.vs,function(a,s){n.node(a).order=s}),Moe(n,e,r.vs)})}function YM(t,o){Ci.forEach(o,function(e){Ci.forEach(e,function(n,i){t.node(n).order=i})})}});var sD=v((cCe,aD)=>{"use strict";var ye=et(),Ooe=cn().Graph,Foe=Nt();aD.exports={positionX:Loe,findType1Conflicts:QM,findType2Conflicts:JM,addConflict:e0,hasConflict:eD,verticalAlignment:tD,horizontalCompaction:nD,alignCoordinates:oD,findSmallestWidthAlignment:iD,balance:rD};function QM(t,o){var e={};function n(i,r){var a=0,s=0,c=i.length,u=ye.last(r);return ye.forEach(r,function(h,g){var C=Noe(t,h),k=C?t.node(C).order:c;(C||h===u)&&(ye.forEach(r.slice(s,g+1),function(I){ye.forEach(t.predecessors(I),function(N){var q=t.node(N),Y=q.order;(Y<a||k<Y)&&!(q.dummy&&t.node(I).dummy)&&e0(e,N,I)})}),s=g+1,a=k)}),r}return ye.reduce(o,n),e}function JM(t,o){var e={};function n(r,a,s,c,u){var h;ye.forEach(ye.range(a,s),function(g){h=r[g],t.node(h).dummy&&ye.forEach(t.predecessors(h),function(C){var k=t.node(C);k.dummy&&(k.order<c||k.order>u)&&e0(e,C,h)})})}function i(r,a){var s=-1,c,u=0;return ye.forEach(a,function(h,g){if(t.node(h).dummy==="border"){var C=t.predecessors(h);C.length&&(c=t.node(C[0]).order,n(a,u,g,s,c),u=g,s=c)}n(a,u,a.length,c,r.length)}),a}return ye.reduce(o,i),e}function Noe(t,o){if(t.node(o).dummy)return ye.find(t.predecessors(o),function(e){return t.node(e).dummy})}function e0(t,o,e){if(o>e){var n=o;o=e,e=n}var i=t[o];i||(t[o]=i={}),i[e]=!0}function eD(t,o,e){if(o>e){var n=o;o=e,e=n}return ye.has(t[o],e)}function tD(t,o,e,n){var i={},r={},a={};return ye.forEach(o,function(s){ye.forEach(s,function(c,u){i[c]=c,r[c]=c,a[c]=u})}),ye.forEach(o,function(s){var c=-1;ye.forEach(s,function(u){var h=n(u);if(h.length){h=ye.sortBy(h,function(N){return a[N]});for(var g=(h.length-1)/2,C=Math.floor(g),k=Math.ceil(g);C<=k;++C){var I=h[C];r[u]===u&&c<a[I]&&!eD(e,u,I)&&(r[I]=u,r[u]=i[u]=i[I],c=a[I])}}})}),{root:i,align:r}}function nD(t,o,e,n,i){var r={},a=Aoe(t,o,e,i),s=i?"borderLeft":"borderRight";function c(g,C){for(var k=a.nodes(),I=k.pop(),N={};I;)N[I]?g(I):(N[I]=!0,k.push(I),k=k.concat(C(I))),I=k.pop()}function u(g){r[g]=a.inEdges(g).reduce(function(C,k){return Math.max(C,r[k.v]+a.edge(k))},0)}function h(g){var C=a.outEdges(g).reduce(function(I,N){return Math.min(I,r[N.w]-a.edge(N))},Number.POSITIVE_INFINITY),k=t.node(g);C!==Number.POSITIVE_INFINITY&&k.borderType!==s&&(r[g]=Math.max(r[g],C))}return c(u,a.predecessors.bind(a)),c(h,a.successors.bind(a)),ye.forEach(n,function(g){r[g]=r[e[g]]}),r}function Aoe(t,o,e,n){var i=new Ooe,r=t.graph(),a=Boe(r.nodesep,r.edgesep,n);return ye.forEach(o,function(s){var c;ye.forEach(s,function(u){var h=e[u];if(i.setNode(h),c){var g=e[c],C=i.edge(g,h);i.setEdge(g,h,Math.max(a(t,u,c),C||0))}c=u})}),i}function iD(t,o){return ye.minBy(ye.values(o),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return ye.forIn(e,function(r,a){var s=Voe(t,a)/2;n=Math.max(r+s,n),i=Math.min(r-s,i)}),n-i})}function oD(t,o){var e=ye.values(o),n=ye.min(e),i=ye.max(e);ye.forEach(["u","d"],function(r){ye.forEach(["l","r"],function(a){var s=r+a,c=t[s],u;if(c!==o){var h=ye.values(c);u=a==="l"?n-ye.min(h):i-ye.max(h),u&&(t[s]=ye.mapValues(c,function(g){return g+u}))}})})}function rD(t,o){return ye.mapValues(t.ul,function(e,n){if(o)return t[o.toLowerCase()][n];var i=ye.sortBy(ye.map(t,n));return(i[1]+i[2])/2})}function Loe(t){var o=Foe.buildLayerMatrix(t),e=ye.merge(QM(t,o),JM(t,o)),n={},i;ye.forEach(["u","d"],function(a){i=a==="u"?o:ye.values(o).reverse(),ye.forEach(["l","r"],function(s){s==="r"&&(i=ye.map(i,function(g){return ye.values(g).reverse()}));var c=(a==="u"?t.predecessors:t.successors).bind(t),u=tD(t,i,e,c),h=nD(t,i,u.root,u.align,s==="r");s==="r"&&(h=ye.mapValues(h,function(g){return-g})),n[a+s]=h})});var r=iD(t,n);return oD(n,r),rD(n,t.graph().align)}function Boe(t,o,e){return function(n,i,r){var a=n.node(i),s=n.node(r),c=0,u;if(c+=a.width/2,ye.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=e?u:-u),u=0,c+=(a.dummy?o:t)/2,c+=(s.dummy?o:t)/2,c+=s.width/2,ye.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(c+=e?u:-u),u=0,c}}function Voe(t,o){return t.node(o).width}});var dD=v((dCe,cD)=>{"use strict";var La=et(),lD=Nt(),zoe=sD().positionX;cD.exports=Hoe;function Hoe(t){t=lD.asNonCompoundGraph(t),qoe(t),La.forEach(zoe(t),function(o,e){t.node(e).x=o})}function qoe(t){var o=lD.buildLayerMatrix(t),e=t.graph().ranksep,n=0;La.forEach(o,function(i){var r=La.max(La.map(i,function(a){return t.node(a).height}));La.forEach(i,function(a){t.node(a).y=n+r/2}),n+=r+e})}});var _D=v((uCe,mD)=>{"use strict";var Me=et(),uD=KE(),pD=tM(),Goe=mM(),joe=Nt().normalizeRanks,Uoe=gM(),$oe=Nt().removeEmptyRanks,hD=yM(),Woe=wM(),fD=IM(),Koe=ZM(),Yoe=dD(),xi=Nt(),Xoe=cn().Graph;mD.exports=Zoe;function Zoe(t,o){var e=o&&o.debugTiming?xi.time:xi.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return lre(t)});e(" runLayout",function(){Qoe(n,e)}),e(" updateInputGraph",function(){Joe(t,n)})})}function Qoe(t,o){o(" makeSpaceForEdgeLabels",function(){cre(t)}),o(" removeSelfEdges",function(){bre(t)}),o(" acyclic",function(){uD.run(t)}),o(" nestingGraph.run",function(){hD.run(t)}),o(" rank",function(){Goe(xi.asNonCompoundGraph(t))}),o(" injectEdgeLabelProxies",function(){dre(t)}),o(" removeEmptyRanks",function(){$oe(t)}),o(" nestingGraph.cleanup",function(){hD.cleanup(t)}),o(" normalizeRanks",function(){joe(t)}),o(" assignRankMinMax",function(){ure(t)}),o(" removeEdgeLabelProxies",function(){pre(t)}),o(" normalize.run",function(){pD.run(t)}),o(" parentDummyChains",function(){Uoe(t)}),o(" addBorderSegments",function(){Woe(t)}),o(" order",function(){Koe(t)}),o(" insertSelfEdges",function(){vre(t)}),o(" adjustCoordinateSystem",function(){fD.adjust(t)}),o(" position",function(){Yoe(t)}),o(" positionSelfEdges",function(){yre(t)}),o(" removeBorderNodes",function(){gre(t)}),o(" normalize.undo",function(){pD.undo(t)}),o(" fixupEdgeLabelCoords",function(){mre(t)}),o(" undoCoordinateSystem",function(){fD.undo(t)}),o(" translateGraph",function(){hre(t)}),o(" assignNodeIntersects",function(){fre(t)}),o(" reversePoints",function(){_re(t)}),o(" acyclic.undo",function(){uD.undo(t)})}function Joe(t,o){Me.forEach(t.nodes(),function(e){var n=t.node(e),i=o.node(e);n&&(n.x=i.x,n.y=i.y,o.children(e).length&&(n.width=i.width,n.height=i.height))}),Me.forEach(t.edges(),function(e){var n=t.edge(e),i=o.edge(e);n.points=i.points,Me.has(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=o.graph().width,t.graph().height=o.graph().height}var ere=["nodesep","edgesep","ranksep","marginx","marginy"],tre={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nre=["acyclicer","ranker","rankdir","align"],ire=["width","height"],ore={width:0,height:0},rre=["minlen","weight","width","height","labeloffset"],are={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sre=["labelpos"];function lre(t){var o=new Xoe({multigraph:!0,compound:!0}),e=n0(t.graph());return o.setGraph(Me.merge({},tre,t0(e,ere),Me.pick(e,nre))),Me.forEach(t.nodes(),function(n){var i=n0(t.node(n));o.setNode(n,Me.defaults(t0(i,ire),ore)),o.setParent(n,t.parent(n))}),Me.forEach(t.edges(),function(n){var i=n0(t.edge(n));o.setEdge(n,Me.merge({},are,t0(i,rre),Me.pick(i,sre)))}),o}function cre(t){var o=t.graph();o.ranksep/=2,Me.forEach(t.edges(),function(e){var n=t.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(o.rankdir==="TB"||o.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function dre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);if(e.width&&e.height){var n=t.node(o.v),i=t.node(o.w),r={rank:(i.rank-n.rank)/2+n.rank,e:o};xi.addDummyNode(t,"edge-proxy",r,"_ep")}})}function ure(t){var o=0;Me.forEach(t.nodes(),function(e){var n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,o=Me.max(o,n.maxRank))}),t.graph().maxRank=o}function pre(t){Me.forEach(t.nodes(),function(o){var e=t.node(o);e.dummy==="edge-proxy"&&(t.edge(e.e).labelRank=e.rank,t.removeNode(o))})}function hre(t){var o=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,i=0,r=t.graph(),a=r.marginx||0,s=r.marginy||0;function c(u){var h=u.x,g=u.y,C=u.width,k=u.height;o=Math.min(o,h-C/2),e=Math.max(e,h+C/2),n=Math.min(n,g-k/2),i=Math.max(i,g+k/2)}Me.forEach(t.nodes(),function(u){c(t.node(u))}),Me.forEach(t.edges(),function(u){var h=t.edge(u);Me.has(h,"x")&&c(h)}),o-=a,n-=s,Me.forEach(t.nodes(),function(u){var h=t.node(u);h.x-=o,h.y-=n}),Me.forEach(t.edges(),function(u){var h=t.edge(u);Me.forEach(h.points,function(g){g.x-=o,g.y-=n}),Me.has(h,"x")&&(h.x-=o),Me.has(h,"y")&&(h.y-=n)}),r.width=e-o+a,r.height=i-n+s}function fre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o),n=t.node(o.v),i=t.node(o.w),r,a;e.points?(r=e.points[0],a=e.points[e.points.length-1]):(e.points=[],r=i,a=n),e.points.unshift(xi.intersectRect(n,r)),e.points.push(xi.intersectRect(i,a))})}function mre(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);if(Me.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function _re(t){Me.forEach(t.edges(),function(o){var e=t.edge(o);e.reversed&&e.points.reverse()})}function gre(t){Me.forEach(t.nodes(),function(o){if(t.children(o).length){var e=t.node(o),n=t.node(e.borderTop),i=t.node(e.borderBottom),r=t.node(Me.last(e.borderLeft)),a=t.node(Me.last(e.borderRight));e.width=Math.abs(a.x-r.x),e.height=Math.abs(i.y-n.y),e.x=r.x+e.width/2,e.y=n.y+e.height/2}}),Me.forEach(t.nodes(),function(o){t.node(o).dummy==="border"&&t.removeNode(o)})}function bre(t){Me.forEach(t.edges(),function(o){if(o.v===o.w){var e=t.node(o.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:o,label:t.edge(o)}),t.removeEdge(o)}})}function vre(t){var o=xi.buildLayerMatrix(t);Me.forEach(o,function(e){var n=0;Me.forEach(e,function(i,r){var a=t.node(i);a.order=r+n,Me.forEach(a.selfEdges,function(s){xi.addDummyNode(t,"selfedge",{width:s.label.width,height:s.label.height,rank:a.rank,order:r+ ++n,e:s.e,label:s.label},"_se")}),delete a.selfEdges})})}function yre(t){Me.forEach(t.nodes(),function(o){var e=t.node(o);if(e.dummy==="selfedge"){var n=t.node(e.e.v),i=n.x+n.width/2,r=n.y,a=e.x-i,s=n.height/2;t.setEdge(e.e,e.label),t.removeNode(o),e.label.points=[{x:i+2*a/3,y:r-s},{x:i+5*a/6,y:r-s},{x:i+a,y:r},{x:i+5*a/6,y:r+s},{x:i+2*a/3,y:r+s}],e.label.x=e.x,e.label.y=e.y}})}function t0(t,o){return Me.mapValues(Me.pick(t,o),Number)}function n0(t){var o={};return Me.forEach(t,function(e,n){o[n.toLowerCase()]=e}),o}});var bD=v((pCe,gD)=>{"use strict";var af=et(),Cre=Nt(),xre=cn().Graph;gD.exports={debugOrdering:wre};function wre(t){var o=Cre.buildLayerMatrix(t),e=new xre({compound:!0,multigraph:!0}).setGraph({});return af.forEach(t.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+t.node(n).rank)}),af.forEach(t.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),af.forEach(o,function(n,i){var r="layer"+i;e.setNode(r,{rank:"same"}),af.reduce(n,function(a,s){return e.setEdge(a,s,{style:"invis"}),s})}),e}});var yD=v((hCe,vD)=>{"use strict";vD.exports="0.8.5"});var xD=v((fCe,CD)=>{"use strict";CD.exports={graphlib:cn(),layout:_D(),debug:bD(),util:{time:Nt().time,notime:Nt().notime},version:yD()}});var Ob={rail:{label:"Files",collapse:"Collapse files panel",expand:"Expand files panel",resize:"Resize files panel",searchPlaceholder:"Search\u2026",searchAriaLabel:"Search nodes by name or tag"}};var ps=new be("MAP_ISOLATE_INTENT",{providedIn:"root",factory:()=>({isolate:()=>{}})});var Fb=`
2
2
  .p-datatable {
3
3
  position: relative;
4
4
  display: block;
@@ -2135,7 +2135,7 @@ function getSidePoint(rect, side) {
2135
2135
  return null;
2136
2136
  }
2137
2137
  }
2138
- `.trim();function Uy(t){return!!$y(t)}function $y(t){let o=t,e=o?.Blob,n=o?.Worker,i=o?.URL;return!e||!n||typeof i?.createObjectURL!="function"||typeof i.revokeObjectURL!="function"?null:{blobCtor:e,workerCtor:n,urlApi:i}}function r7(t){let o=new t.blobCtor([o7],{type:"text/javascript"});return t.urlApi.createObjectURL(o)}function Wy(t,o){if(!t)return;let e=o??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var Ui=(()=>{class t{worker=null;workerUrl=null;nextRequestId=0;isDisabled=!1;pending=new Map;resetRuntime(e){this.pending.forEach(n=>n.reject(e)),this.pending.clear(),this.worker?.terminate(),this.worker=null,Wy(this.workerUrl),this.workerUrl=null}dispose(){this.resetRuntime(new Error("Connection worker was destroyed."))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),lu=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(o,e){this.connection=o,this.line=e}},a7=(()=>{let t=class $s{_mediator=p(V);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new Mo(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let i=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),a=this._renderCache.get(e);return a?.signature===r&&a.pathElement===i?!1:(this._renderCache.set(e,{signature:r,pathElement:i}),!0)}_createConnectionRenderSignature(e,n){let{sourceSide:i,targetSide:r}=e.getResolvedSides();return[e.fBehavior,e.fType,e.fRadius,e.fOffset,e.fReassignableStart(),this._serializeContents([...e.fContents()||[]]),i,r,this._serializePoint(n.point1),this._serializePoint(n.point2),this._serializeWaypoints(e.fWaypoints()?.waypoints()||[])].join("|")}_serializePoint(e){return`${e.x}:${e.y}`}_serializeWaypoints(e){return e.map(this._serializePoint).join(";")}_serializeContents(e){return e.map(n=>[n.position(),n.offset(),n.align()].join(":")).join(";")}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=y({token:$s,factory:$s.\u0275fac})};return t=P([R(lu)],t),t})(),cu=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(o,e){this.source=o,this.target=e}},s7=(()=>{let t=class Ws{_state=p(Th);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=y({token:Ws,factory:Ws.\u0275fac})};return t=P([R(cu)],t),t})(),di=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(o,e=!0){this.element=o,this.cache=e}},l7={enabled:!1},Mn=new be("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>ge({},l7)});var du=class{id;nodeId;kind;element;static fToken=Symbol("RegisterFCacheConnectorRequest");constructor(o,e,n,i){this.id=o,this.nodeId=e,this.kind=n,this.element=i}},Dn=(()=>{class t{nodeEntries=new Map;nodeIdByElement=new WeakMap;connectorEntries=new Map;connectorKeysByNodeId=new Map;connectorKeyByElement=new WeakMap;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Nm=class{key;id;kind;nodeId;element;rect;constructor(o,e,n,i,r,a){this.key=o,this.id=e,this.kind=n,this.nodeId=i,this.element=r,this.rect=a}},kr=class{static build(o,e){return`${o}:${e}`}},Am=class{id;element;reference;rect;constructor(o,e,n,i){this.id=o,this.element=e,this.reference=n,this.rect=i}},Do=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(o,e="manual"){this.nodeId=o,this.reason=e}},c7=(()=>{let t=class Ks{_store=p(Dn);_options=p(Mn);handle({nodeId:e,reason:n}){if(!this._options.enabled)return;let i=this._store.nodeEntries.get(e);if(!i)return;i.rect=void 0;let r=this._store.connectorKeysByNodeId.get(e);if(r?.size)for(let a of r){let s=this._store.connectorEntries.get(a);s&&(s.rect=void 0)}}static \u0275fac=function(n){return new(n||Ks)};static \u0275prov=y({token:Ks,factory:Ks.\u0275fac})};return t=P([R(Do)],t),t})(),uu=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(o,e,n){this.id=o,this.element=e,this.reference=n}},d7=(()=>{let t=class Ys{_store=p(Dn);_options=p(Mn);handle({id:e,element:n,reference:i}){if(!this._options.enabled)return;let r=new Am(e,n,i);this._store.nodeEntries.set(e,r),this._store.nodeIdByElement.set(n,e),this._store.connectorKeysByNodeId.set(e,this._store.connectorKeysByNodeId.get(e)??new Set)}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=y({token:Ys,factory:Ys.\u0275fac})};return t=P([R(uu)],t),t})(),pu=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(o){this.id=o}},u7=(()=>{let t=class Xs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({id:e}){if(!this._options.enabled)return;let n=this._store.nodeEntries.get(e);if(!n)return;this._store.nodeEntries.delete(e),this._store.nodeIdByElement.delete(n.element);let i=Array.from(this._store.connectorKeysByNodeId.get(e)??[]);for(let r of i){let a=this._store.connectorEntries.get(r);a&&this._mediator.execute(new Ir(a.id,a.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=y({token:Xs,factory:Xs.\u0275fac})};return t=P([R(pu)],t),t})(),p7=(()=>{let t=class Zs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({id:e,nodeId:n,kind:i,element:r}){if(!this._options.enabled)return;let a=kr.build(e,i),s=this._store.connectorEntries.get(a);s&&(this._detachConnectorFromNode(s.key,s.nodeId),this._store.connectorKeyByElement.delete(s.element));let c=new Nm(a,e,i,n,r);this._store.connectorEntries.set(a,c),this._store.connectorKeyByElement.set(r,a);let u=this._store.connectorKeysByNodeId.get(n)??new Set;u.add(a),this._store.connectorKeysByNodeId.set(n,u),this._mediator.execute(new Do(n,"connector-registered"))}_detachConnectorFromNode(e,n){let i=this._store.connectorKeysByNodeId.get(n);i&&(i.delete(e),i.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=y({token:Zs,factory:Zs.\u0275fac})};return t=P([R(du)],t),t})(),Ir=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(o,e){this.connectorId=o,this.kind=e}},h7=(()=>{let t=class Qs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let i=kr.build(e,n),r=this._store.connectorEntries.get(i);r&&(this._store.connectorEntries.delete(i),this._store.connectorKeyByElement.delete(r.element),this._detachConnectorFromNode(i,r.nodeId),this._store.nodeEntries.has(r.nodeId)&&this._mediator.execute(new Do(r.nodeId,"connector-unregistered")))}_detachConnectorFromNode(e,n){let i=this._store.connectorKeysByNodeId.get(n);i&&(i.delete(e),i.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Qs)};static \u0275prov=y({token:Qs,factory:Qs.\u0275fac})};return t=P([R(Ir)],t),t})(),Po=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(o){this.element=o}},f7=(()=>{let t=class Js{_store=p(Dn);_options=p(Mn);handle({element:e}){if(!this._options.enabled)return;let n=this._store.nodeIdByElement.get(e);if(n){let r=this._store.nodeEntries.get(n)?.rect;if(r)return r}let i=this._store.connectorKeyByElement.get(e);if(i)return this._store.connectorEntries.get(i)?.rect??void 0}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=y({token:Js,factory:Js.\u0275fac})};return t=P([R(Po)],t),t})(),Bi=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(o,e,n){this.connectorId=o,this.kind=e,this.rect=n}},m7=(()=>{let t=class el{_store=p(Dn);_options=p(Mn);handle({connectorId:e,kind:n,rect:i}){if(!this._options.enabled)return;let r=kr.build(e,n),a=this._store.connectorEntries.get(r);a&&(a.rect=rt.fromRoundedRect(i))}static \u0275fac=function(n){return new(n||el)};static \u0275prov=y({token:el,factory:el.\u0275fac})};return t=P([R(Bi)],t),t})(),Vi=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(o,e){this.nodeId=o,this.rect=e}},_7=(()=>{let t=class tl{_store=p(Dn);_options=p(Mn);handle({nodeId:e,rect:n}){if(!this._options.enabled)return;let i=this._store.nodeEntries.get(e);if(!i)return;let r=i.rect;i.rect=te.initialize(n.x,n.y,n.width,n.height),r&&this._updateConnectorRectsByNodeRect(e,r,i.rect)}_updateConnectorRectsByNodeRect(e,n,i){let r=this._store.connectorKeysByNodeId.get(e);if(!r?.size)return;let a=i.x-n.x,s=i.y-n.y,c=n.width!==0,u=n.height!==0,h=c?i.width/n.width:1,g=u?i.height/n.height:1;for(let C of r){let k=this._store.connectorEntries.get(C);if(!k?.rect)continue;let I=k.rect,N=I.gravityCenter,q=c?i.x+(N.x-n.x)*h:N.x+a,Y=u?i.y+(N.y-n.y)*g:N.y+s;k.rect=new rt(q-I.width/2,Y-I.height/2,I.width,I.height,I.radius1,I.radius2,I.radius3,I.radius4)}}static \u0275fac=function(n){return new(n||tl)};static \u0275prov=y({token:tl,factory:tl.\u0275fac})};return t=P([R(Vi)],t),t})(),Er=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(o,e){this.element=o,this.rect=e}},g7=(()=>{let t=class nl{_store=p(Dn);_options=p(Mn);handle({element:e,rect:n}){if(!this._options.enabled)return;let i=this._store.nodeIdByElement.get(e);if(i){let s=this._store.nodeEntries.get(i);s&&(s.rect=n);return}let r=this._store.connectorKeyByElement.get(e);if(!r)return;let a=this._store.connectorEntries.get(r);a&&(a.rect=n)}static \u0275fac=function(n){return new(n||nl)};static \u0275prov=y({token:nl,factory:nl.\u0275fac})};return t=P([R(Er)],t),t})(),b7=[Dn,d7,u7,c7,p7,h7,f7,_7,m7,g7];function qo(t,o,e){return o?pe.fromPoint(t).elementTransform(o).sub(e.scaledPosition).sub(e.position).div(e.scale):pe.fromPoint(t)}function Ky(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Ro(t){return t?`${t}`:void 0}var v7=(()=>{let t=class il{_store=p(L);_mediator=p(V);_browser=p(at);get _transform(){return this._store.transform}handle({element:e,cache:n}){let i=this._mediator.execute(new Po(e));if(i&&n)return i;let r=this._getElementRoundedRect(e),a=this._normalizePosition(r),s=this._unscaleSize(r),c=this._getUnscaledRect(a,s,r),u=this._getOffsetSize(e,s),h=rt.fromCenter(c,u.width,u.height);return this._mediator.execute(new Er(e,h)),h}_getElementRoundedRect(e){return this._getRoundedRect(te.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,i){let[r,a,s,c]=this._normalizeCircularBorderRadii(e.width,e.height,[this._getSystemRadius(i.borderTopLeftRadius,n,i.fontSize),this._getSystemRadius(i.borderTopRightRadius,n,i.fontSize),this._getSystemRadius(i.borderBottomRightRadius,n,i.fontSize),this._getSystemRadius(i.borderBottomLeftRadius,n,i.fontSize)]);return new rt(e.x,e.y,e.width,e.height,r,a,s,c)}_getComputedStyle(e){return this._browser.window.getComputedStyle(e)}_toPixels(e,n,i){return this._browser.toPixels(e,n.clientWidth,n.clientHeight,i)||0}_getSystemRadius(e,n,i){return this._toPixels(e,n,i)*this._transform.scale}_normalizeCircularBorderRadii(e,n,i){let[r,a,s,c]=i.map(h=>Math.max(0,h)),u=Math.min(1,this._getRadiusScaleFactor(e,r+a),this._getRadiusScaleFactor(n,a+s),this._getRadiusScaleFactor(e,s+c),this._getRadiusScaleFactor(n,c+r));return[r*u,a*u,s*u,c*u]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return qo(e,this._store.flowHost,this._transform)}_unscaleSize(e){return Ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n,i){return new rt(e.x,e.y,n.width,n.height,this._unscaleRadius(i.radius1),this._unscaleRadius(i.radius2),this._unscaleRadius(i.radius3),this._unscaleRadius(i.radius4))}_unscaleRadius(e){return e/this._transform.scale}_getOffsetSize(e,n){return Ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||il)};static \u0275prov=y({token:il,factory:il.\u0275fac})};return t=P([R(di)],t),t})(),hu=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(o,e){this.connector=o,this.cache=e}},y7=(()=>{let t=class ol{_mediator=p(V);handle({connector:e,cache:n}){let i=this._buildCacheKey(e),r=n.get(i)??this._calculateRect(e);return n.set(i,r),r}_buildCacheKey(e){return`${e.kind}::${e.fId()}`}_calculateRect(e){return this._mediator.execute(new di(e.hostElement))}static \u0275fac=function(n){return new(n||ol)};static \u0275prov=y({token:ol,factory:ol.\u0275fac})};return t=P([R(hu)],t),t})(),fu=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(o){this.connection=o}},C7=(()=>{let t=class rl{_store=p(L);handle({connection:e}){let n=this._store.outputs.get(e.fOutputId()),i=this._store.inputs.get(e.fInputId());return!n||!i?null:{source:n,target:i}}static \u0275fac=function(n){return new(n||rl)};static \u0275prov=y({token:rl,factory:rl.\u0275fac})};return t=P([R(fu)],t),t})(),Mr=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(o,e){this.connection=o,this.cache=e}},x7=(()=>{let t=class al{_mediator=p(V);handle({connection:e,cache:n}){let i=this._resolveConnectionEndpoints(e);return i?Dt(ge({},i),{sourceRect:this._resolveEndpointRect(i.source,n),targetRect:this._resolveEndpointRect(i.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new fu(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new hu(e,n))}static \u0275fac=function(n){return new(n||al)};static \u0275prov=y({token:al,factory:al.\u0275fac})};return t=P([R(Mr)],t),t})(),it=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(o){this.element=o}},w7=(()=>{let t=class sl{_store=p(L);_mediator=p(V);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new Po(e));if(n)return n;let i=te.fromElement(e),r=this._normalizePosition(i),a=this._unscaleSize(i),s=this._getUnscaledRect(r,a),c=this._getOffsetSize(e,a),u=this._fromCenter(s,c.width,c.height);return this._mediator.execute(new Er(e,u)),u}_fromCenter(e,n,i){return te.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-i/2,n,i)}_normalizePosition(e){return qo(e,this._store.flowHost,this._transform)}_unscaleSize(e){return Ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n){return new rt(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return Ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||sl)};static \u0275prov=y({token:sl,factory:sl.\u0275fac})};return t=P([R(it)],t),t})(),zn=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(o){this.connector=o}},T7=(()=>{let t=class ll{_store=p(L);_mediator=p(V);handle({connector:e}){if(!e)return;let n=this._store.nodes.get(e.fNodeId);if(!n||!n._rotate)return;let i=this._mediator.execute(new it(n.hostElement));return{rotationDeg:n._rotate,pivot:i.gravityCenter}}static \u0275fac=function(n){return new(n||ll)};static \u0275prov=y({token:ll,factory:ll.\u0275fac})};return t=P([R(zn)],t),t})(),mu=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(o,e){this.connection=o,this.geometry=e}},S7=(()=>{let t=class cl{_mediator=p(V);_connectionBehaviour=p(Ho);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new vn(n.sourceRect,n.targetRect,e,n.source.fConnectableSide,n.target.fConnectableSide,this._resolveRotationContext(n.source),this._resolveRotationContext(n.target)))}_resolveRotationContext(e){return this._mediator.execute(new zn(e))}static \u0275fac=function(n){return new(n||cl)};static \u0275prov=y({token:cl,factory:cl.\u0275fac})};return t=P([R(mu)],t),t})(),Dr=class{connection;source;target;line;static fToken=Symbol("RenderConnectionWithLineRequest");constructor(o,e,n,i){this.connection=o,this.source=e,this.target=n,this.line=i}},k7=(()=>{let t=class dl{_mediator=p(V);handle({connection:e,source:n,target:i,line:r}){this._mediator.execute(new cu(n,i)),this._mediator.execute(new lu(e,r))}static \u0275fac=function(n){return new(n||dl)};static \u0275prov=y({token:dl,factory:dl.\u0275fac})};return t=P([R(Dr)],t),t})(),Pr=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(o,e){this.connection=o,this.geometry=e}},I7=(()=>{let t=class ul{_mediator=p(V);handle({connection:e,geometry:n}){let i=this._mediator.execute(new mu(e,n));this._mediator.execute(new Dr(e,n.source,n.target,i))}static \u0275fac=function(n){return new(n||ul)};static \u0275prov=y({token:ul,factory:ul.\u0275fac})};return t=P([R(Pr)],t),t})(),_u=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(o,e){this.connection=o,this.cache=e}},E7=(()=>{let t=class pl{_mediator=p(V);handle({connection:e,cache:n}){let i=this._mediator.execute(new Mr(e,n));i&&this._mediator.execute(new Pr(e,i))}static \u0275fac=function(n){return new(n||pl)};static \u0275prov=y({token:pl,factory:pl.\u0275fac})};return t=P([R(_u)],t),t})(),zi=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(o){this.session=o}},M7=(()=>{let t=class hl{_store=p(L);_state=p(Th);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||hl)};static \u0275prov=y({token:hl,factory:hl.\u0275fac})};return t=P([R(zi)],t),t})(),Rr=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(o){this.session=o}},D7=(()=>{let t=class fl{_mediator=p(V);_store=p(L);handle({session:e}){this._mediator.execute(new zi(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||fl)};static \u0275prov=y({token:fl,factory:fl.\u0275fac})};return t=P([R(Rr)],t),t})(),gu=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(o,e){this.batchItem=o,this.result=e}},P7=(()=>{let t=class ml{_mediator=p(V);handle({batchItem:e,result:n}){if(e){if(!this._isSupportedWorkerResult(n)){this._fallbackToMainThread(e);return}try{e.connection._applyResolvedSidesToConnection(n.sourceSide,n.targetSide),this._mediator.execute(new Dr(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new Pr(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||ml)};static \u0275prov=y({token:ml,factory:ml.\u0275fac})};return t=P([R(gu)],t),t})(),ai=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(o,e,n,i,r,a){this.connections=o,this.cache=e,this.startIndex=n,this.session=i,this.batchItems=r,this.workerResults=a}},R7=500,O7=6,F7=(()=>{let t=class _l{_mediator=p(V);_browser=p(at);handle({connections:e,cache:n,startIndex:i,session:r,batchItems:a,workerResults:s}){if(!this._isCurrent(r))return;let c=this._now(),u=i,h=0;for(;u<e.length&&h<R7&&this._isWithinSliceBudget(c);){let g=e[u];if(a?this._mediator.execute(new gu(a[u]??null,s?.[u])):this._mediator.execute(new _u(g,n)),u++,h++,!this._isCurrent(r))return}if(u>=e.length){this._mediator.execute(new Rr(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new ai(e,n,u,r,a,s)))}_isCurrent(e){return this._mediator.execute(new zi(e))}_requestAnimationFrame(e){let n=this._browser.document.defaultView;if(!n){e();return}n.requestAnimationFrame(e)}_now(){let e=this._browser.document.defaultView?.performance;return e?e.now():Date.now()}_isWithinSliceBudget(e){return this._browser.isBrowser()?this._now()-e<O7:!0}static \u0275fac=function(n){return new(n||_l)};static \u0275prov=y({token:_l,factory:_l.\u0275fac})};return t=P([R(ai)],t),t})(),bu=class{static fToken=Symbol("StartConnectionRedrawRequest")},N7=(()=>{let t=class gl{_store=p(L);_state=p(Th);handle(e){return this._state.resetConnectedConnectors(),{renderTicket:this._state.beginRender(),connectionsRevision:this._store.connectionsRevision,nodesRevision:this._store.nodesRevision}}static \u0275fac=function(n){return new(n||gl)};static \u0275prov=y({token:gl,factory:gl.\u0275fac})};return t=P([R(bu)],t),t})(),Or=class{static fToken=Symbol("RedrawConnectionsRequest")},vu=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(o){this.connectionCount=o}},Fr=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},A7=(()=>{let t=class bl{_browser=p(at);_state=p(Ui);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return Uy(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||bl)};static \u0275prov=y({token:bl,factory:bl.\u0275fac})};return t=P([R(Fr)],t),t})(),L7=(()=>{let t=class vl{_mediator=p(V);handle({connectionCount:e}){return e>0&&this._mediator.execute(new Fr)}static \u0275fac=function(n){return new(n||vl)};static \u0275prov=y({token:vl,factory:vl.\u0275fac})};return t=P([R(vu)],t),t})(),yu=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(o,e,n){this.connection=o,this.geometry=e,this.originalIndex=n}},B7=(()=>{let t=class yl{_store=p(L);handle({connection:e,geometry:n,originalIndex:i}){let{source:r,target:a,sourceRect:s,targetRect:c}=n;return{originalIndex:i,behavior:e.fBehavior,outputSide:e.fOutputSide(),inputSide:e.fInputSide(),sourceConnectableSide:r.fConnectableSide,targetConnectableSide:a.fConnectableSide,sourceRotation:this._store.nodes.get(r.fNodeId)?._rotate||0,targetRotation:this._store.nodes.get(a.fNodeId)?._rotate||0,sourceRect:{x:s.x,y:s.y,width:s.width,height:s.height,radius1:s.radius1,radius2:s.radius2,radius3:s.radius3,radius4:s.radius4},targetRect:{x:c.x,y:c.y,width:c.width,height:c.height,radius1:c.radius1,radius2:c.radius2,radius3:c.radius3,radius4:c.radius4}}}static \u0275fac=function(n){return new(n||yl)};static \u0275prov=y({token:yl,factory:yl.\u0275fac})};return t=P([R(yu)],t),t})(),Cu=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(o,e){this.connections=o,this.cache=e}},V7=(()=>{let t=class Cl{_mediator=p(V);handle({connections:e,cache:n}){let i=new Array(e.length),r=[];for(let a=0;a<e.length;a++){let s=this._buildBatchItem(e[a],n,a);i[a]=s,s&&r.push(s.payload)}return{items:i,payload:r}}_buildBatchItem(e,n,i){let r=this._mediator.execute(new Mr(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new yu(e,r,i))}:null}static \u0275fac=function(n){return new(n||Cl)};static \u0275prov=y({token:Cl,factory:Cl.\u0275fac})};return t=P([R(Cu)],t),t})(),xu=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(o){this.error=o}},Nr=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(o){this.error=o}},z7=(()=>{let t=class xl{_state=p(Ui);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||xl)};static \u0275prov=y({token:xl,factory:xl.\u0275fac})};return t=P([R(Nr)],t),t})(),H7=(()=>{let t=class wl{_state=p(Ui);_mediator=p(V);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new Nr(e))}static \u0275fac=function(n){return new(n||wl)};static \u0275prov=y({token:wl,factory:wl.\u0275fac})};return t=P([R(xu)],t),t})(),wu=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(o){this.message=o}},q7=(()=>{let t=class Tl{_state=p(Ui);handle({message:e}){if(!e||typeof e.requestId!="number")return;let n=this._state.pending.get(e.requestId);if(n){if(this._state.pending.delete(e.requestId),e.error){n.reject(new Error(e.error));return}n.resolve(e.results??[])}}static \u0275fac=function(n){return new(n||Tl)};static \u0275prov=y({token:Tl,factory:Tl.\u0275fac})};return t=P([R(wu)],t),t})(),Tu=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},G7=(()=>{let t=class Sl{_browser=p(at);_state=p(Ui);_mediator=p(V);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!Uy(n))return null;let i=$y(n);if(!i)return null;let r=r7(i);try{let a=new i.workerCtor(r,{name:"f-flow-connection-worker"});return a.onmessage=s=>{this._mediator.execute(new wu(s.data))},a.onerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker runtime error."))},a.onmessageerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker message deserialization error."))},this._state.workerUrl=r,this._state.worker=a,a}catch(a){return Wy(r,i.urlApi),this._disableWorker(a instanceof Error?a:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new xu(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new Nr(e))}static \u0275fac=function(n){return new(n||Sl)};static \u0275prov=y({token:Sl,factory:Sl.\u0275fac})};return t=P([R(Tu)],t),t})(),Su=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(o){this.payload=o}},j7=(()=>{let t=class kl{_state=p(Ui);_mediator=p(V);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new Fr))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new Tu);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let i=++this._state.nextRequestId;return new Promise((r,a)=>{this._state.pending.set(i,{resolve:r,reject:a});try{n.postMessage({requestId:i,items:e})}catch(s){this._state.pending.delete(i),a(s instanceof Error?s:new Error("Unknown error while posting message to connection worker."))}})}_interruptPendingRequests(){if(!this._state.pending.size)return;let e=new Error("Connection worker request was superseded by a newer redraw.");this._state.pending.forEach(n=>n.reject(e)),this._state.pending.clear()}static \u0275fac=function(n){return new(n||kl)};static \u0275prov=y({token:kl,factory:kl.\u0275fac})};return t=P([R(Su)],t),t})(),ku=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(o){this.batch=o}},U7=(()=>{let t=class Il{_mediator=p(V);handle({batch:e}){return e.payload.length?this._mediator.execute(new Su(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Il)};static \u0275prov=y({token:Il,factory:Il.\u0275fac})};return t=P([R(ku)],t),t})(),Iu=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(o,e,n){this.connections=o,this.cache=e,this.session=n}},$7=(()=>{let t=class El{_mediator=p(V);handle({connections:e,cache:n,session:i}){let r=this._mediator.execute(new Cu(e,n));if(!r.payload.length){this._mediator.execute(new ai(e,n,0,i,r.items));return}this._mediator.execute(new ku(r)).then(a=>{this._mediator.execute(new zi(i))&&this._mediator.execute(new ai(e,n,0,i,r.items,this._alignWorkerResults(a,e.length)))}).catch(()=>{this._mediator.execute(new zi(i))&&this._mediator.execute(new ai(e,n,0,i,r.items))})}_alignWorkerResults(e,n){let i=new Array(n);for(let r of e){let a=r.originalIndex;a<0||a>=n||(i[a]=r)}return i}static \u0275fac=function(n){return new(n||El)};static \u0275prov=y({token:El,factory:El.\u0275fac})};return t=P([R(Iu)],t),t})(),W7=(()=>{let t=class Ml{_mediator=p(V);_store=p(L);handle(e){let n=this._mediator.execute(new bu);this._createMarkersForCreate(),this._createMarkersForSnap();let i=[...this._store.connections.getAll()],r=new Map;if(!i.length){this._mediator.execute(new Rr(n));return}this._shouldUseConnectionWorker(i.length)?this._redrawUsingWorker(i,r,n):this._redrawWithoutWorker(i,r,n)}_createMarkersForCreate(){let e=this._store.connections.getForCreate();e&&this._mediator.execute(new Mo(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new Mo(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new vu(e))}_redrawUsingWorker(e,n,i){this._mediator.execute(new Iu(e,n,i))}_redrawWithoutWorker(e,n,i){this._mediator.execute(new ai(e,n,0,i))}static \u0275fac=function(n){return new(n||Ml)};static \u0275prov=y({token:Ml,factory:Ml.\u0275fac})};return t=P([R(Or)],t),t})(),Lm=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},K7=(()=>{let t=class Dl{_store=p(L);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||Dl)};static \u0275prov=y({token:Dl,factory:Dl.\u0275fac})};return t=P([R(Lm)],t),t})(),Eu=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(o){this.connection=o}},Y7=(()=>{let t=class Pl{_store=p(L);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Pl)};static \u0275prov=y({token:Pl,factory:Pl.\u0275fac})};return t=P([R(Eu)],t),t})(),Mu=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(o){this.instance=o}},X7=(()=>{let t=class Rl{_store=p(L);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Rl)};static \u0275prov=y({token:Rl,factory:Rl.\u0275fac})};return t=P([R(Mu)],t),t})(),Bm=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(o,e){this.waypointIndex=o,this.connectionId=e}},Du=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},Z7=(()=>{let t=class Ol{_store=p(L);_dragSession=p(he);handle(e){this._store.flowHost.classList.remove(ht.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Ol)};static \u0275prov=y({token:Ol,factory:Ol.\u0275fac})};return t=P([R(Du)],t),t})(),Pu=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},Q7=(()=>{let t=class Fl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(ht.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new Ar),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Lu(e.kind,e.data?ge({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||Fl)};static \u0275prov=y({token:Fl,factory:Fl.\u0275fac})};return t=P([R(Pu)],t),t})(),Ar=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},Hi=class{_event;_target;get originalEvent(){return this._event}get targetElement(){return this._target||this.originalEvent.target}get touchEvent(){return this._event}get touches(){return this.touchEvent.touches}constructor(o,e){this._event=o,this._target=e}setTarget(o){this._target=o}preventDefault(){this.originalEvent.preventDefault()}get isEventInLockedContext(){return this.targetElement.closest("[fLockedContext]")!==null}},Ru=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){return this.originalEvent.button===0}isMouseRightButton(){return this.originalEvent.buttons===2}getPosition(){return{x:this.originalEvent.clientX,y:this.originalEvent.clientY}}},Vm=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){let o=this.originalEvent;return o.pointerType==="mouse"&&o.button===0||o.pointerType==="touch"}isMouseRightButton(){let o=this.originalEvent;return o.pointerType==="mouse"&&o.button===2||o.pointerType==="touch"}getPosition(){let o=this.originalEvent;return{x:o.clientX,y:o.clientY}}getPointerType(){return this.originalEvent.pointerType}getPointerId(){return this.originalEvent.pointerId}},zm=class extends Hi{constructor(o){super(o)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let o=this.originalEvent.touches;return{x:o[0].clientX,y:o[0].clientY}}},Hm=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let o=this.originalEvent.targetTouches[0];return{x:o.clientX,y:o.clientY}}},He=(()=>{class t{static _isSupported;static _isPassiveEventListenerSupported(){if(t._isSupported==null&&typeof window<"u")try{window.addEventListener("test",t.emptyListener,{passive:!0}),t._isSupported=!0}catch{t._isSupported=!1}return t._isSupported}static _passiveEventListener(e){return t._isPassiveEventListenerSupported()?e:!!e.capture}static activeListener(){return t._passiveEventListener({passive:!1})}static passiveListener(){return t._passiveEventListener({passive:!0})}static activeCaptureListener(){return t._passiveEventListener({passive:!1,capture:!0})}static emptyListener(){return()=>{}}}return t})(),J7=800,qm=class{_document=p(Ua);_ngZone=p(Jt,{optional:!0});_mouseListeners=He.emptyListener();_touchListeners=He.emptyListener();_startListeners=He.emptyListener();isSyntheticEvent(o){return!!this._lastTouchEventTime&&this._lastTouchEventTime+J7>Date.now()}_lastTouchEventTime=0;isDragStarted=!1;_dragStartThreshold=3;_dragStartDelay=0;_dragStartTime=0;_dragStartPosition={x:0,y:0};_moveHandler=this._checkDragSequenceToStart;_pointerDownElement=null;_onMouseDown=o=>{let e=this.isSyntheticEvent(o),n=tB(o),i=new Ru(o);if(e||n||this.disabled||this.isDragStarted)return;this._pointerDownElement=i.targetElement,this.onPointerDown(i)&&(this._dragStartTime=Date.now(),this._dragStartPosition=i.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,He.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,He.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,He.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,He.activeCaptureListener())})};_onTouchDown=o=>{let e=nB(o),n=new zm(o);if(e||this.disabled||this.isDragStarted)return;this._pointerDownElement=n.targetElement,this.onPointerDown(n)&&(this._dragStartTime=Date.now(),this._dragStartPosition=n.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,He.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,He.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,He.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,He.activeCaptureListener())})};_onSelectStart=o=>{this.onSelect(o)};_onMouseMove=o=>{this._moveHandler(new Ru(o))};_onTouchMove=o=>{this._moveHandler(new Hm(o))};_checkDragSequenceToStart(o){let e=o.getPosition();if(!this.isDragStarted&&this._pointerDownElement){o.setTarget(this._pointerDownElement);let n=Math.abs(e.x-this._dragStartPosition.x),i=Math.abs(e.y-this._dragStartPosition.y);if(n+i>=this._dragStartThreshold){if(!(Date.now()>=this._dragStartTime+this._dragStartDelay)){this._endDragSequence();return}o.preventDefault(),this.prepareDragSequence(o),this.isDragStarted=!0,this._moveHandler=this.onPointerMove,eB(o.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=o=>{this.isDragStarted&&this.onPointerUp(new Vm(o)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=He.emptyListener(),this._touchListeners(),this._touchListeners=He.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,He.activeListener()),this._listen("touchstart",this._onTouchDown,He.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,He.activeListener()),this._unlisten("touchstart",this._onTouchDown,He.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=He.emptyListener(),this._touchListeners(),this._touchListeners=He.emptyListener(),this._mouseListeners(),this._mouseListeners=He.emptyListener()}_listen(o,e,n){this._document.addEventListener(o,e,n)}_unlisten(o,e,n){this._document.removeEventListener(o,e,n)}_preventDuringDrag=o=>{this.isDragStarted&&o.preventDefault()}};function eB(t){return t.type[0]==="t"}function tB(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function nB(t){let o=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0];return!!o&&o.identifier===-1&&(o.radiusX==null||o.radiusX===1)&&(o.radiusY==null||o.radiusY===1)}var Gm=class extends Hi{_position;_isMouseLeftButton;_isMouseRightButton;constructor(o){super(o.originalEvent,o.targetElement),this._position=o.getPosition(),this._isMouseLeftButton=o.isMouseLeftButton(),this._isMouseRightButton=o.isMouseRightButton()}isMouseLeftButton(){return this._isMouseLeftButton}isMouseRightButton(){return this._isMouseRightButton}getPosition(){return ge({},this._position)}};function iB(t){return new Gm(t)}var he=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new pe(0,0);draggableItems=[];autoPanFrameId=null;lastPointerEvent=null;lastPointerPosition=null;isAutoPanCanvasMoved=!1;reset(){for(let e of this.draggableItems)try{e.destroy?.()}catch{console.error(`Error while destroying drag handler of type ${e.type}`)}this.draggableItems=[],this.onPointerDownScale=1,this.onPointerDownPosition=new pe(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=iB(e),this.lastPointerPosition=this.lastPointerEvent.getPosition()}isEmpty(){return!this.draggableItems.length}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jm=class{nodeIds;groupIds;connectionIds;get fNodeIds(){return this.nodeIds}get fGroupIds(){return this.groupIds}get fConnectionIds(){return this.connectionIds}constructor(o,e,n){this.nodeIds=o,this.groupIds=e,this.connectionIds=n}},oB=(()=>{let t=class Nl{_mediator=p(V);_store=p(L);_dragSession=p(he);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new si))}_getSelection(){return this._mediator.execute(new ra)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new jm(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||Nl)};static \u0275prov=y({token:Nl,factory:Nl.\u0275fac})};return t=P([R(Ar)],t),t})(),Um=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(o){this.nodeOrGroup=o}},rB=(()=>{let t=class Al{_store=p(L);_mediator=p(V);handle({nodeOrGroup:e}){let n=te.initialize(-1/0,-1/0,1/0,1/0),i=this._getNode(e.fParentId());return i&&(n=this._getParentRect(i)),n}_getNode(e){return this._store.nodes.get(e)}_getParentRect(e){let n=this._getNodeRect(e),i=this._getNodePadding(e,n);return te.initialize(n.x+i[0],n.y+i[1],n.width-i[0]-i[2],n.height-i[1]-i[3])}_getNodeRect(e){return this._mediator.execute(new it(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new Gi(e,n))}static \u0275fac=function(n){return new(n||Al)};static \u0275prov=y({token:Al,factory:Al.\u0275fac})};return t=P([R(Um)],t),t})(),$m=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(o,e){this.fParentNodes=o,this.fDraggedNodes=e}},aB=(()=>{let t=class Ll{handle(e){return this._isParentNodeInArray(this._getParentNodeIds(e.fParentNodes),e.fDraggedNodes)}_getParentNodeIds(e){return e.map(n=>n.fId())}_isParentNodeInArray(e,n){return n.some(i=>e.includes(i.fId()))}static \u0275fac=function(n){return new(n||Ll)};static \u0275prov=y({token:Ll,factory:Ll.\u0275fac})};return t=P([R($m)],t),t})(),Wm=class{fNodeId;fConnectionIds;constructor(o,e){this.fNodeId=o,this.fConnectionIds=e}},Ou=class extends Wm{nodeId;connectionIds;constructor(o,e){super(o,e),this.nodeId=o,this.connectionIds=e}},Fu=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(o){this.nodeOrGroup=o}},sB=(()=>{let t=class Bl{_mediator=p(V);_store=p(L);handle({nodeOrGroup:e}){let n=this._collectConnectableConnectorIds(e,"source"),i=this._collectConnectableConnectorIds(e,"target");if(!n.size||!i.size)return;let r=this._collectAttachedConnectionIds(n,i),a=this._collectConnectionsUnderNode(e),s=[];for(let c of a){let u=c.fId();r.has(u)||s.push(u)}s.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Ou(e.fId(),s)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Ou(e.fId(),s)))}_collectConnectableConnectorIds(e,n){let i=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let a of i)a.canBeConnected&&e.isContains(a.hostElement)&&r.add(a.fId());return r}_collectAttachedConnectionIds(e,n){let i=new Set;for(let r of this._store.connections.getAll())(e.has(r.fOutputId())||n.has(r.fInputId()))&&i.add(r.fId());return i}_collectConnectionsUnderNode(e){let n=this._mediator.execute(new di(e.hostElement,!1)),i=[];for(let r of this._store.connections.getAll())this._hasIntersection(r,n)&&i.push(r);return i}_hasIntersection(e,n){return Co.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||Bl)};static \u0275prov=y({token:Bl,factory:Bl.\u0275fac})};return t=P([R(Fu)],t),t})(),lB=[Q7,Z7,oB,rB,aB,sB],cB=new Set(["create-connection","reassign-connection","drag-node"]),dB=new Set(["selection-area"]),uB=new Set(["assign-to-container"]);function Yy(t){let o=null;for(let e of t){if(uB.has(e))continue;let n=cB.has(e)?"rebase":dB.has(e)?"direct":null;if(!n)return null;if(!o){o=n;continue}if(o!==n)return null}return o}function Xy(t,o,e,n,i){return U.initialize(dy(t.x,o.left,o.right,e,n,i),dy(t.y,o.top,o.bottom,e,n,i))}function dy(t,o,e,n,i,r){let a=Math.max(0,n),s=Math.max(0,i);if(!a||!s)return 0;if(t<=o+a){let c=py((o+a-t)/a,0,1);return uy(c,s,r)}if(t>=e-a){let c=py((t-(e-a))/a,0,1);return-uy(c,s,r)}return 0}function pB(t,o,e){let n=e||1;return pe.fromPoint(t).add(pe.fromPoint(o).div(n))}function uy(t,o,e){return e?o*t:o}function py(t,o,e){return Math.max(o,Math.min(e,t))}var Nu=class{static fToken=Symbol("RunAutoPanFrameRequest")},ui=class{static fToken=Symbol("StopAutoPanRequest")},hB=(()=>{let t=class Vl{_store=p(L);_dragContext=p(he);handle(e){this._dragContext.autoPanFrameId!==null&&(cancelAnimationFrame(this._dragContext.autoPanFrameId),this._dragContext.autoPanFrameId=null),this._dragContext.isAutoPanCanvasMoved&&(this._store.fCanvas?.emitCanvasChangeEvent(),this._dragContext.isAutoPanCanvasMoved=!1)}static \u0275fac=function(n){return new(n||Vl)};static \u0275prov=y({token:Vl,factory:Vl.\u0275fac})};return t=P([R(ui)],t),t})(),Lr=class{static fToken=Symbol("SyncAutoPanRequest")},fB=(()=>{let t=class zl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new ui);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Nu)}))}_canAutoPan(){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!this._getAutoPanMode()&&this._edgeThreshold()>0&&this._speed()>0}_hasAutoPanDelta(){let e=this._getAutoPanDelta();return!!e.x||!!e.y}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?U.initialize():Xy(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return Yy(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(Xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||zl)};static \u0275prov=y({token:zl,factory:zl.\u0275fac})};return t=P([R(Lr)],t),t})(),mB=(()=>{let t=class Hl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new ui);return}let i=this._getAutoPanDelta();if(!i.x&&!i.y){this._mediator.execute(new ui);return}this._applyCanvasDelta(i,n),this._replayLastPointerMove(),this._mediator.execute(new Lr)}_applyCanvasDelta(e,n){let i=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=pB(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||i.scale||1)),i.position=pe.fromPoint(i.position).add(e),this._store.fCanvas?.redraw(),this._dragContext.isAutoPanCanvasMoved=!0}_replayLastPointerMove(){let e=this._dragContext.lastPointerEvent;if(!e)return;let n=this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition);this._dragContext.draggableItems.forEach(i=>{i.onPointerMove(ge({},n),e)})}_getPointerPositionInCanvas(e){return pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost)}_canAutoPan(e){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!e&&this._edgeThreshold()>0&&this._speed()>0}_getAutoPanMode(){return Yy(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?U.initialize():Xy(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(Xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||Hl)};static \u0275prov=y({token:Hl,factory:Hl.\u0275fac})};return t=P([R(Nu)],t),t})(),_B=[fB,mB,hB],Au=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(o){this.event=o}},Lu=class{kind;data;fEventType;get fData(){return this.data}constructor(o,e,n){this.kind=o,this.data=e,this.fEventType=n??o}},Ft=class{data(){}_features=[];getEvent(){return new Lu(this.kind,this.data(),this.type)}attachFeature(o){this._features.push(o)}featuresPrepare(o){for(let e of this._features)e.onPrepare?.(o)}featuresMove(o,e){for(let n of this._features)n.onMove?.(o,e)}featuresFinalize(o,e){for(let n of this._features)n.onFinalize?.(o,e)}featuresEnd(o){for(let e of this._features)e.onEnd?.(o)}},Bu=class{_isConnected=!1;get isConnected(){return this._isConnected}toConnector=[];isSelfConnectable=!0;fConnectableSide=K.AUTO;userFConnectableSide=K.AUTO;isContains(o){return this.hostElement.contains(o)}setConnected(o){this._isConnected=!0,this.toConnector.push(o)}resetConnected(){this._isConnected=!1,this.toConnector=[]}},gB=new be("F_NODE_INPUT"),bB=(()=>{class t extends Bu{kind="input";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})(),In=(function(t){return t.LEFT="left",t.LEFT_TOP="left-top",t.TOP="top",t.RIGHT_TOP="right-top",t.RIGHT="right",t.RIGHT_BOTTOM="right-bottom",t.BOTTOM="bottom",t.LEFT_BOTTOM="left-bottom",t})(In||{});function vB(t){return xr(t,".f-rotate-handle")}var Zy=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),Sh=new be("F_NODE"),yB=qy(class{hostElement;constructor(t){this.hostElement=t}}),Vu=class extends yB{_injector=p(dt);renderer=p(w0);browser=p(at);stateChanges=new rn;_position=U.initialize();_rotate=0;_size;connectors=[];positionChanges(){de(()=>{let o=this.position();tn(()=>{U.isEqual(this._position,o)||(this._position=o,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){de(()=>{let o=this.size();tn(()=>{this._isSizeEqual(o)||(this._size=o,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){de(()=>{let o=this.rotate();tn(()=>{this._rotate!==o&&(this._rotate=o,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){de(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),tn(()=>this.refresh())},{injector:this._injector})}_isSizeEqual(o){return this._size?.width===o?.width&&this._size?.height===o?.height}isContains(o){return this.hostElement.contains(o)}redraw(){this._size&&(this.setStyle("width",""+this._size.width+"px"),this.setStyle("height",""+this._size.height+"px")),this.setStyle("transform",`translate(${this._position.x}px,${this._position.y}px) rotate(${this._rotate}deg)`)}resetSize(){this.removeStyle("width"),this.removeStyle("height")}updatePosition(o){this._position=o}updateRotate(o){this._rotate=o}updateSize(o){this._size=o}setClass(o){this.hostElement.classList.add(o)}removeClass(o){this.hostElement.classList.remove(o)}addConnector(o){this.connectors.push(o),this.refresh()}removeConnector(o){let e=this.connectors.indexOf(o);e!==-1&&this.connectors.splice(e,1),this.refresh()}},CB=0,xB=3,Km=(()=>{class t extends Vu{_debounceTimer=null;_destroyRef=p(xt);_mediator=p(V);fId=B(`f-group-${CB++}`,{alias:"fGroupId"});fParentId=B(null,{alias:"fGroupParentId"});position=Ei(U.initialize(),{alias:"fGroupPosition"});size=B(void 0,{alias:"fGroupSize"});sizeChange=Ke({alias:"fGroupSizeChange"});rotate=Ei(0,{alias:"fGroupRotate"});fConnectOnNode=B(!0,{transform:j});fMinimapClass=B([]);fDraggingDisabled=B(!1,{alias:"fGroupDraggingDisabled",transform:j});fSelectionDisabled=B(!1,{alias:"fGroupSelectionDisabled",transform:j});fIncludePadding=B(!0,{transform:j});fAutoExpandOnChildHit=B(!1,{transform:j});fAutoSizeToFitChildren=B(!1,{transform:j});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qr(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new si),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),xB))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fo(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new ea(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new ta(this))}static \u0275fac=function(n){return new(n||t)(un(Qe))};static \u0275dir=je({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-group-id",i.fId()),ue("f-group-dragging-disabled",i.fDraggingDisabled())("f-group-selection-disabled",i.fSelectionDisabled()))},inputs:{fId:[1,"fGroupId","fId"],fParentId:[1,"fGroupParentId","fParentId"],position:[1,"fGroupPosition","position"],size:[1,"fGroupSize","size"],rotate:[1,"fGroupRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fGroupDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fGroupSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fGroupPositionChange",sizeChange:"fGroupSizeChange",rotate:"fGroupRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:Sh,useExisting:t}]),Z]})}return t})(),hy=0,wB=3,kh=(()=>{class t extends Vu{_debounceTimer=null;_destroyRef=p(xt);_mediator=p(V);fId=B(`f-node-${hy++}`,{alias:"fNodeId",transform:e=>Ro(e)||`f-node-${hy++}`});fParentId=B(null,{alias:"fNodeParentId"});position=Ei(U.initialize(),{alias:"fNodePosition"});size=B(void 0,{alias:"fNodeSize"});sizeChange=Ke({alias:"fNodeSizeChange"});rotate=Ei(0,{alias:"fNodeRotate"});fConnectOnNode=B(!0,{transform:j});fMinimapClass=B([]);fDraggingDisabled=B(!1,{alias:"fNodeDraggingDisabled",transform:j});fSelectionDisabled=B(!1,{alias:"fNodeSelectionDisabled",transform:j});fIncludePadding=B(!0,{transform:j});fAutoExpandOnChildHit=B(!1,{transform:j});fAutoSizeToFitChildren=B(!1,{transform:j});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qr(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new si),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),wB))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fo(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new ea(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new ta(this))}static \u0275fac=function(n){return new(n||t)(un(Qe))};static \u0275dir=je({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-node-id",i.fId()),ue("f-node-dragging-disabled",i.fDraggingDisabled())("f-node-selection-disabled",i.fSelectionDisabled()))},inputs:{fId:[1,"fNodeId","fId"],fParentId:[1,"fNodeParentId","fParentId"],position:[1,"fNodePosition","position"],size:[1,"fNodeSize","size"],rotate:[1,"fNodeRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fNodeDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fNodeSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fNodePositionChange",sizeChange:"fNodeSizeChange",rotate:"fNodeRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:Sh,useExisting:t}]),Z]})}return t})();function TB(t){return!!t.closest("[fNode]")}var fy=0,Qy=(()=>{class t extends bB{hostElement=p(Qe).nativeElement;_mediator=p(V);_node=p(Sh);fId=B(`f-node-input-${fy++}`,{alias:"fInputId",transform:e=>Ro(e)||`f-node-input-${fy++}`});category=B(void 0,{alias:"fInputCategory",transform:Ro});multiple=B(!0,{alias:"fInputMultiple",transform:j});disabled=B(!1,{alias:"fInputDisabled",transform:j});userFConnectableSide=K.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yr(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new na(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-input-id",i.fId()),ue("f-node-input-multiple",i.multiple)("f-node-input-disabled",i.disabled()))},inputs:{fId:[1,"fInputId","fId"],category:[1,"fInputCategory","category"],multiple:[1,"fInputMultiple","multiple"],disabled:[1,"fInputDisabled","disabled"],userFConnectableSide:[2,"fInputConnectableSide","userFConnectableSide",e=>xo(e,"fInputConnectableSide",K)]},exportAs:["fNodeInput"],standalone:!1,features:[ke([{provide:gB,useExisting:t}]),Z,ro]})}return t})(),SB=(()=>{class t extends Bu{get hasConnectionLimits(){return!!this.canBeConnectedInputs&&this.canBeConnectedInputs.length>0}canConnectTo(e){return[e.fId(),e.category()].some(i=>i&&this.canBeConnectedInputs?.includes(i))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})();function Jy(t){return!!t.closest("[fNodeOutlet]")}var kB=new be("F_NODE_OUTPUT"),IB=(()=>{class t extends SB{kind="output";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})();function eC(t){return!!t.closest("[fNodeOutput]")}var my=0,tC=(()=>{class t extends IB{hostElement=p(Qe).nativeElement;_mediator=p(V);_node=p(Sh);fId=B(`f-node-output-${my++}`,{alias:"fOutputId",transform:e=>Ro(e)||`f-node-output-${my++}`});multiple=B(!1,{alias:"fOutputMultiple",transform:j});disabled=B(!1,{alias:"fOutputDisabled",transform:j});userFConnectableSide=K.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yr(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new na(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,i){n&2&&(O("data-f-output-id",i.fId()),ue("f-node-output-multiple",i.multiple)("f-node-output-disabled",i.disabled())("f-node-output-self-connectable",i.isSelfConnectable))},inputs:{fId:[1,"fOutputId","fId"],multiple:[1,"fOutputMultiple","multiple"],disabled:[1,"fOutputDisabled","disabled"],userFConnectableSide:[2,"fOutputConnectableSide","userFConnectableSide",e=>xo(e,"fOutputConnectableSide",K)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[ke([{provide:kB,useExisting:t}]),Z,ro]})}return t})();var zu=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(o){this.event=o}},Br=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(o){this.outlet=o}},EB=(()=>{let t=class ql{_store=p(L);handle({outlet:e}){let n=this._findOwnerNode(e);if(!n)throw new Error("The fOutlet must belong to an fNode");let i=this._findFirstConnectableOutputInNode(n);if(!i)throw new Error("Outlet requires at least one connectable output in the same node.");return i}_findOwnerNode(e){let n=e.hostElement;return this._store.nodes.getAll().find(i=>i.isContains(n))}_findFirstConnectableOutputInNode(e){return this._store.outputs.getAll().find(n=>e.isContains(n.hostElement)&&n.canBeConnected)}static \u0275fac=function(n){return new(n||ql)};static \u0275prov=y({token:ql,factory:ql.\u0275fac})};return t=P([R(Br)],t),t})(),Ym=class{sourceId;targetId;dropPosition;fOutputId;fInputId;fDropPosition;constructor(o,e,n){this.sourceId=o,this.targetId=e,this.dropPosition=n,this.fOutputId=o,this.fInputId=e,this.fDropPosition=n}},Hu=(()=>{class t extends Ft{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=p(hi);_mediator=p(V);_connectionBehaviour=p(Ho);_store=p(L);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new rt;initialize(e,n){this._sourceRef=this._mediator.execute(new Kt(e)),this._pointerDown=rt.fromRect(te.initialize(n.x,n.y))}prepareDragSequence(){this._collectAndMarkTargets(),this._initSnapConnection(),this._initCreateConnection(),this._connection.show(),this.onPointerMove(U.initialize()),this._result.setData({toConnectorRect:this._pointerDown,canBeConnectedInputs:this._targets,fOutputId:this._sourceRef.connector.fId()})}_collectAndMarkTargets(){this._targets=this._mediator.execute(new Zr(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new Lo(this._targets.map(e=>e.connector)))}_initSnapConnection(){this._snapConnection&&(this._snapConnection.fOutputId.set(this._sourceRef.connector.fId()),this._snapConnection.initialize())}_initCreateConnection(){this._connection.fOutputId.set(this._sourceRef.connector.fId()),this._connection.initialize()}onPointerMove(e){let n=this._pointerDown.addPoint(e),i=this._findClosestTarget(n),r=i?.connector.fConnectableSide||K.TOP;this._drawCreateConnection(n,r);let a=this._snapConnection;if(!a)return;let s=i&&i.distance<a.fSnapThreshold?i:void 0;this._drawSnapConnection(s)}_findClosestTarget(e){return this._mediator.execute(new qi(e,this._targets))}_drawCreateConnection(e,n){let i=this._connectionBehaviour.handle(new vn(this._sourceRef.rect,e,this._connection,this._sourceRef.connector.fConnectableSide,n,this._resolveRotationContext(this._sourceRef.connector)));this._connection.setLine(i),this._connection.redraw()}_drawSnapConnection(e){let n=this._snapConnection;if(!n)return;if(!e){n.hide();return}let i=this._connectionBehaviour.handle(new vn(this._sourceRef.rect,e.rect,n,this._sourceRef.connector.fConnectableSide,e.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(e.connector)));n.show(),n.setLine(i),n.redraw()}onPointerUp(){this._connection.redraw(),this._connection.hide(),this._snapConnection?.hide(),this._mediator.execute(new Bo(this._targets.map(e=>e.connector)))}_resolveRotationContext(e){return this._mediator.execute(new zn(e))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),MB=(()=>{let t=class Gl{_result=p(hi);_mediator=p(V);_store=p(L);_dragContext=p(he);get _dragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isValid()&&(this._emitEvent(e.event),this._dragHandler.onPointerUp())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Hu)}_getTargetOutput(e){if(!e)throw new Error(`Output with fOutputId ${this._result.getData().fOutputId} not found. Make sure there is no f-connection to a non-existent fOutput.`);return Jy(e.hostElement)?this._mediator.execute(new Br(e)):e}_getOutput(){return this._store.outputs.get(this._result.getData().fOutputId)}_getOutlet(){return this._store.outlets.get(this._result.getData().fOutputId)}_emitEvent(e){this._store.fDraggable?.fCreateConnection.emit(new Ym(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new Xr(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||Gl)};static \u0275prov=y({token:Gl,factory:Gl.\u0275fac})};return t=P([R(zu)],t),t})(),Vr=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(o,e){this.eventPosition=o,this.source=e}},DB=(()=>{let t=class jl{_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle({source:e,eventPosition:n}){this._dragContext.onPointerDownScale=this._transform.scale;let i=this._toFlowSpace(n);this._dragContext.onPointerDownPosition=i;let r=this._toCanvasSpace(i),a=this._dragInjector.get(Hu);a.initialize(e,r),this._dragContext.draggableItems=[a]}_toFlowSpace(e){return pe.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return pe.fromPoint(e).mult(this._transform.scale).sub(this._transform.position).sub(this._transform.scaledPosition).div(this._transform.scale)}static \u0275fac=function(n){return new(n||jl)};static \u0275prov=y({token:jl,factory:jl.\u0275fac})};return t=P([R(Vr)],t),t})(),qu=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(o,e){this.event=o,this.node=e}},PB=(()=>{let t=class Ul{_mediator=p(V);_store=p(L);handle({event:e,node:n}){let i=this._findOutlet(n);if(!i||(i.setOutputs(this._getOutputs(n)),!i.canBeConnected))return;let r=i.isConnectionFromOutlet?i:this._resolveOutput(i);!r||!r.canBeConnected||this._startDrag(e.getPosition(),r)}_findOutlet(e){return this._store.outlets.getAll().find(n=>e.isContains(n.hostElement))}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement))}_resolveOutput(e){return this._mediator.execute(new Br(e))}_startDrag(e,n){this._mediator.execute(new Vr(e,n))}static \u0275fac=function(n){return new(n||Ul)};static \u0275prov=y({token:Ul,factory:Ul.\u0275fac})};return t=P([R(qu)],t),t})(),Gu=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(o,e){this.event=o,this.node=e}},RB=(()=>{let t=class $l{_mediator=p(V);_store=p(L);handle({event:e,node:n}){if(!eC(e.targetElement)||this._hasOutlet(n))return;let i=this._findOutput(e.targetElement);!i||!i.canBeConnected||this._startDrag(e.getPosition(),i)}_hasOutlet(e){return this._store.outlets.getAll().some(n=>e.isContains(n.hostElement))}_findOutput(e){return this._store.outputs.getAll().find(n=>n.hostElement.contains(e))}_startDrag(e,n){this._mediator.execute(new Vr(e,n))}static \u0275fac=function(n){return new(n||$l)};static \u0275prov=y({token:$l,factory:$l.\u0275fac})};return t=P([R(Gu)],t),t})(),ju=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},OB=(()=>{let t=class Wl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let i=Jy(e.targetElement),r=!i&&eC(e.targetElement);if(!i&&!r)return;let a=this._findOwnerNode(e.targetElement);a&&(i?this._mediator.execute(new qu(e,a)):this._mediator.execute(new Gu(e,a)))}_findOwnerNode(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_isValidConditions(){return this._dragContext.isEmpty()&&!!this._store.connections.getForCreate()}_isValidTrigger(e,n){return an(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Wl)};static \u0275prov=y({token:Wl,factory:Wl.\u0275fac})};return t=P([R(ju)],t),t})(),Uu=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(o){this.event=o}},Xm=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(o,e,n,i,r,a,s){this.connectionId=o,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=i,this.previousTargetId=r,this.nextTargetId=a,this.dropPosition=s,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=i,this.oldTargetId=r,this.newTargetId=a,this.dropPoint=s}},FB=(()=>{let t=class Kl{_dragResult=p(hi);_mediator=p(V);_store=p(L);_dragContext=p(he);get _dragDirective(){return this._store.fDraggable}handle({event:e}){let n=this._findReassignHandler();n&&(this._emitIfChanged(e),n.onPointerUp())}_findReassignHandler(){return this._dragContext.draggableItems.find(n=>n.getEvent().fEventType==="reassign-connection")}_emitIfChanged(e){let n=this._dragResult.getData(),i=this._findConnectableConnector(e,n.candidates);i&&!this._isReassignedToDifferentConnector(n,i)||this._dragDirective.fReassignConnection.emit(this._buildEvent(n,e,i))}_findConnectableConnector(e,n){return this._mediator.execute(new Xr(e.getPosition(),n))}_isReassignedToDifferentConnector(e,n){let i=e.connection;return e.draggedEnd==="target"?i.fInputId()!==n.fId():i.fOutputId()!==n.fId()}_buildEvent(e,n,i){let r=e.connection;return new Xm(r.fId(),e.draggedEnd,r.fOutputId(),e.draggedEnd==="source"?i?.fId():void 0,r.fInputId(),e.draggedEnd==="target"?i?.fId():void 0,n.getPosition())}static \u0275fac=function(n){return new(n||Kl)};static \u0275prov=y({token:Kl,factory:Kl.\u0275fac})};return t=P([R(Uu)],t),t})(),$u=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}};function NB(t,o){return nC(t,o)||AB(t,o)}function nC(t,o){return t.fDragHandleEnd()?.point&&iC(o,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function AB(t,o){return!!t.fDragHandleStart()?.point&&iC(o,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function iC(t,o){return(t.x-o.x)**2+(t.y-o.y)**2<=8**2}function oC(t,o){return t&&t.distance<o.fSnapThreshold?t:void 0}function Wu(t){return rt.fromRect(te.initialize(t.x,t.y))}var Zm=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(o,e,n,i,r){this._mediator=o,this._behaviour=e,this._connection=n,this._sourceRef=i,this._targetRef=r,this._anchorRect=Wu(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Xp(this._target,this._targetRef.rect.gravityCenter)),this._candidates.some(o=>o.connector.fId()===this._source.fId())||this._candidates.push(this._sourceRef),this._mediator.execute(new Lo(this._candidates.map(o=>o.connector)))}setSnapConnection(o){this._snap=o,o&&(o.fInputId.set(this._connection.fInputId()),o.initialize())}onPointerMove(o){let e=this._anchorRect.addPoint(o),n=this._findClosest(e.gravityCenter),i=n?.connector.fConnectableSide??this._source.fConnectableSide;this._draw(e,i);let r=this._snap;r&&this._drawSnap(oC(n,r))}_findClosest(o){return this._mediator.execute(new qi(o,this._candidates))}_draw(o,e){let n=this._behaviour.handle(new vn(o,this._targetRef.rect,this._connection,e,this._targetRef.connector.fConnectableSide,void 0,this._resolveRotationContext(this._targetRef.connector)));this._connection.setLine(n),this._connection.redraw()}_drawSnap(o){let e=this._snap;if(!e)return;if(!o){e.hide();return}let n=this._behaviour.handle(new vn(o.rect,this._targetRef.rect,e,o.connector.fConnectableSide,this._target.fConnectableSide,this._resolveRotationContext(o.connector),this._resolveRotationContext(this._targetRef.connector)));e.show(),e.setLine(n),e.redraw()}onPointerUp(){this._draw(this._anchorRect,this._sourceRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Bo(this._candidates.map(o=>o.connector)))}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Qm=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(o,e,n,i,r){this._mediator=o,this._behaviour=e,this._connection=n,this._sourceRef=i,this._targetRef=r,this._anchorRect=Wu(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Zr(this._source,this._sourceRef.rect.gravityCenter));let o=this._connection.fInputId();o&&!this._candidates.some(e=>e.connector.fId()===o)&&this._candidates.push(this._targetRef),this._mediator.execute(new Lo(this._candidates.map(e=>e.connector)))}setSnapConnection(o){this._snap=o,o&&(o.fOutputId.set(this._connection.fOutputId()),o.initialize())}onPointerMove(o){let e=this._anchorRect.addPoint(o),n=this._findClosest(e.gravityCenter),i=n?.connector.fConnectableSide??this._target.fConnectableSide;this._draw(e,i);let r=this._snap;r&&this._drawSnap(oC(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Bo(this._candidates.map(o=>o.connector)))}_findClosest(o){return this._mediator.execute(new qi(o,this._candidates))}_draw(o,e){let n=this._behaviour.handle(new vn(this._sourceRef.rect,o,this._connection,this._source.fConnectableSide,e,this._resolveRotationContext(this._sourceRef.connector),void 0));this._connection.setLine(n),this._connection.redraw()}_drawSnap(o){let e=this._snap;if(!e)return;if(!o){e.hide();return}let n=this._behaviour.handle(new vn(this._sourceRef.rect,o.rect,e,this._source.fConnectableSide,o.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(o.connector)));e.show(),e.setLine(n),e.redraw()}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Jm=(()=>{class t extends Ft{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=p(hi);_mediator=p(V);_connectionBehaviour=p(Ho);_store=p(L);get _snapConnection(){return this._store.connections.getForSnap()}_connection;_draggedEnd;_sourceRef;_targetRef;_reassignHandler;initialize(e,n){this._connection=e,this._draggedEnd=n?"target":"source",this._sourceRef=this._mediator.execute(new Kt(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new Kt(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new Zm(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new Qm(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}prepareDragSequence(){this._reassignHandler.collectAndMarkCandidates(),this._reassignHandler.setSnapConnection(this._snapConnection),this._result.setData({draggedEnd:this._draggedEnd,sourceAnchorRect:Wu(this._connection.line.point1),targetAnchorRect:Wu(this._connection.line.point2),candidates:this._reassignHandler.candidates(),connection:this._connection})}onPointerMove(e){this._reassignHandler.onPointerMove(e)}onPointerUp(){this._reassignHandler.onPointerUp()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),LB=(()=>{let t=class Yl{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _transform(){return this._store.transform}get _connections(){return this._store.connections.getAll()}handle(e){if(!this._dragContext.isEmpty()||!this._isValidTrigger(e))return;let n=qo(e.event.getPosition(),this._store.flowHost,this._transform),i=this._findConnectionAt(n);i&&(this._capturePointerDown(e),this._startDrag(i,n),queueMicrotask(()=>this._bringToFront(i)))}_findConnectionAt(e){return this._connections.find(n=>NB(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let i=this._dragInjector.get(Jm);i.initialize(e,nC(e,n)),this._dragContext.draggableItems=[i]}_isValidTrigger(e){return an(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new ji(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Yl)};static \u0275prov=y({token:Yl,factory:Yl.\u0275fac})};return t=P([R($u)],t),t})(),Ku=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(o){this.event=o}},Yu=class{connectionId;waypoints;constructor(o,e){this.connectionId=o,this.waypoints=e}},Xu=(()=>{class t extends Ft{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=p(L);_point;_pick;get _waypointsComponent(){return this._pick?.connection.fWaypoints()}get _connection(){return this._pick?.connection}setPick(e){this._pick=e}prepareDragSequence(){this._pick?.candidate?(this._point=ge({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=ge({},this._pick.waypoint),this._waypointsComponent.select(this._pick.waypoint)),this._redrawConnection()}onPointerMove(e){this._waypointsComponent.move(U.sum(this._point,e)),this._redrawConnection()}onPointerUp(){this._waypointsComponent.update(),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._eventFromPick())}_redrawConnection(){this._connection.setLine(this._connection.line),this._connection.redraw()}_eventFromPick(){return new Yu(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),BB=(()=>{let t=class Xl{_dragContext=p(he);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof Xu)}static \u0275fac=function(n){return new(n||Xl)};static \u0275prov=y({token:Xl,factory:Xl.\u0275fac})};return t=P([R(Ku)],t),t})(),Zu=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},VB=(()=>{let t=class Zl{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _flowHost(){return this._store.flowHost}get _connections(){return this._store.connections.getAll()}handle(e){let n=qo(e.event.getPosition(),this._flowHost,this._transform),i=this._pickControlPoint(n);if(!i||!this._isValidTrigger(e))return;let r=this._dragInjector.get(Xu);r.setPick(i),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._flowHost).div(this._transform.scale),this._dragContext.draggableItems=[r],queueMicrotask(()=>this._updateConnectionLayer(i.connection))}_pickControlPoint(e){if(this._dragContext.isEmpty())return p6(this._connections,e)}_isValidTrigger(e){return an(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new ji(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Zl)};static \u0275prov=y({token:Zl,factory:Zl.\u0275fac})};return t=P([R(Zu)],t),t})(),zB=[MB,DB,PB,EB,RB,OB,FB,LB,VB,BB],Qu=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(o){this.event=o}},HB=1,zr=(()=>{class t extends Ft{type="move-node-to-parent";kind="assign-to-container";_store=p(L);_dragSession=p(he);get _transform(){return this._store.transform}_candidateGroups=[];_debounceTimer=null;_activeTarget=null;get activeTarget(){return this._activeTarget}initialize(e){this._candidateGroups=e}prepareDragSequence(){for(let{node:e}of this._candidateGroups)e.hostElement.classList.add(ht.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),HB)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(ht.GROUPING.DROP_ACTIVE);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}_updateActiveTarget(e){let n=this._getPointerInFlow(e),i=this._findTargetUnderPointer(n);i?this._setActiveTarget(i):this._clearActiveTarget()}_getPointerInFlow(e){let n=pe.fromPoint(this._dragSession.onPointerDownPosition).add(e),i=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(i)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>te.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(ht.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(ht.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ju=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(o){this.nodesAndGroups=o}},e_=class{rootHandlers;participants;constructor(o,e){this.rootHandlers=o,this.participants=e}},t_=class{fNodeIds;constructor(o){this.fNodeIds=o}},I_="move-node",E_="drag-node";function qB(t){return t.getEvent().kind===E_||t.getEvent().fEventType===I_}var pi=(()=>{class t extends Ft{type=I_;kind=E_;data(){return new t_(this.items.map(e=>e.nodeOrGroup.fId()))}_magneticLines=null;_magneticRects=null;items;roots;initialize(e,n){this.items=e,this.roots=n}setMagneticLines(e){this._magneticLines=e}setMagneticRects(e){this._magneticRects=e}calculateMagneticLinesGuides(e){return this.calculateMagneticSnaps(e).lines}calculateMagneticSnaps(e){this._previewRoots(e);let n=this._rootsUnionRect();return{lines:this._magneticLines?._computeGuides(n),rects:this._magneticRects?._computeRects(n)}}prepareDragSequence(){for(let e of this.roots)e.prepareDragSequence()}onPointerMove(e){this._previewRoots(e);let n=this._rootsUnionRect();this._magneticLines?.scheduleRender(n),this._magneticRects?.scheduleRender(n)}onPointerUp(){for(let e of this.roots)e.onPointerUp();this._magneticLines?.clearGuides(),this._magneticRects?.clearGuides(),requestAnimationFrame(()=>this._refreshDraggedNodes())}_previewRoots(e){for(let n of this.roots)n.onPointerMove(e)}_rootsUnionRect(){let e=null;for(let n of this.roots){let i=n.getLastRect();e=e?te.union([e,i]):i}return e??te.initialize()}_refreshDraggedNodes(){for(let{nodeOrGroup:e}of this.roots)e.refresh()}destroy(){for(let e of this.roots??[])e.destroy?.()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ep=class{_limits;_quantizeStep;constructor(o,e=.5){this._limits=o,this._quantizeStep=e}applyInto(o,e){let{min:n,max:i}=this._limits,r=this._clamp(o.x,n.x,i.x),a=this._clamp(o.y,n.y,i.y),s=o.x-r,c=o.y-a,u=this._quantizeSigned(s,this._quantizeStep),h=this._quantizeSigned(c,this._quantizeStep);e.value.x=r,e.value.y=a,e.edges.left=u<0,e.edges.right=u>0,e.edges.top=h<0,e.edges.bottom=h>0,e.overflow.x=Math.abs(u),e.overflow.y=Math.abs(h)}_quantizeSigned(o,e){if(e<=0||o===0)return 0;let n=o/e;return(o>0?Math.ceil(n):Math.floor(n))*e}_clamp(o,e,n){return Math.min(Math.max(o,e),n)}},n_=class{_pointerDown;_vCellSize;_hCellSize;_snapWhileDragging;constructor(o,e){this._pointerDown=e,this._vCellSize=o.vCellSize(),this._hCellSize=o.hCellSize(),this._snapWhileDragging=o.fCellSizeWhileDragging()}snap(o,e){let n=e||this._snapWhileDragging;return this._strategies[+n](o)}_strategies={0:this._noSnap.bind(this),1:this._snapWithCellSize.bind(this)};_snapWithCellSize(o){return{x:this._snapToGrid(this._pointerDown.x+o.x,this._hCellSize)-this._pointerDown.x,y:this._snapToGrid(this._pointerDown.y+o.y,this._vCellSize)-this._pointerDown.y}}_noSnap(o){return o}_snapToGrid(o,e){return Math.round(o/e)*e}};function _y(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var i_=class{_snapper;_hardClamp;_hardResult=_y();_softClamps=[];_softResults=[];constructor(o,e,n){let i=o.get(L).fDraggable;this._snapper=new n_(i,e),this._hardClamp=new ep(n.hard,.5);for(let r of n.soft)this._softClamps.push(new ep(r.limits,.5)),this._softResults.push(_y())}apply(o,e=!1){let n=this._snapper.snap(o,e);this._hardClamp.applyInto(n,this._hardResult);let i={x:this._hardResult.value.x,y:this._hardResult.value.y};for(let r=0;r<this._softClamps.length;r++)this._softClamps[r].applyInto(i,this._softResults[r]);return{hardDelta:i,soft:this._softResults}}finalize(o){return this.apply(o,!0)}};function gy(t,o,e){let{x:n,y:i,width:r,height:a}=t;return e.right&&o.x>0&&(r+=o.x),e.left&&o.x>0&&(n-=o.x,r+=o.x),e.bottom&&o.y>0&&(a+=o.y),e.top&&o.y>0&&(i-=o.y,a+=o.y),te.initialize(n,i,r,a)}var o_=class extends Ft{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=I_;kind=E_;_startPosition=U.initialize();_startRect=te.initialize();_applyConstraints=o=>o;_lastSoftResults=[];_deltaConstraints;_constraints;_lastPosition=U.initialize();_softParentConnectionHandlers=[];_mediator;constructor(o,e,n=[],i=[],r=[]){super(),this._injector=o,this.nodeOrGroup=e,this.children=n,this.sourceConnectionHandlers=i,this.targetConnectionHandlers=r,this._mediator=o.get(V),this._startRect=this._mediator.execute(new it(e.hostElement)),this._startPosition=ge({},e._position)}setConstraints(o){this._constraints=o,this._deltaConstraints=new i_(this._injector,this._startPosition,o),this._applyConstraints=e=>{let n=this._deltaConstraints.apply(e);return this._applySoftExpansions(n.soft),n.hardDelta}}setSoftParentConnectionHandlers(o){this._softParentConnectionHandlers=o}finalizeConstraints(){this._applyConstraints=o=>{let e=this._deltaConstraints.finalize(o);return this._applySoftExpansions(e.soft),e.hardDelta}}getLastRect(){return te.initialize(this._lastPosition.x,this._lastPosition.y,this._startRect.width,this._startRect.height)}prepareDragSequence(){for(let o of this.children)o.prepareDragSequence();this.nodeOrGroup.hostElement.classList.add(ht.DRAG_AND_DROP.DRAGGING)}onPointerMove(o){let e=this._applyConstraints(o);for(let n of this.children)n.onPointerMove(e);this._redraw(this._startPlus(e));for(let n of this.sourceConnectionHandlers)n.setSourceDelta(e);for(let n of this.targetConnectionHandlers)n.setTargetDelta(e)}onPointerUp(){for(let o of this.children)o.onPointerUp();this.nodeOrGroup.position.set(this.nodeOrGroup._position),this.nodeOrGroup.hostElement.classList.remove(ht.DRAG_AND_DROP.DRAGGING),this._emitExpandedEvent()}_startPlus(o){return U.sum(this._startPosition,o)}_redraw(o){this._lastPosition=o,this.nodeOrGroup.updatePosition(o),this._mediator.execute(new Vi(this.nodeOrGroup.fId(),te.initialize(o.x,o.y,this._startRect.width,this._startRect.height))),this.nodeOrGroup.redraw()}_applySoftExpansions(o){this._lastSoftResults=o;for(let e=0;e<o.length;e++){let n=o[e],i=this._constraints.soft[e],r=gy(i.boundingRect,n.overflow,n.edges);this._commitParentRect(i.nodeOrGroup,r)&&this._updateParentConnectionHandlers(e)}}_commitParentRect(o,e){let n=o._position.x!==e.x||o._position.y!==e.y||o._size?.width!==e.width||o._size?.height!==e.height;return o.updateSize({width:e.width,height:e.height}),o.updatePosition({x:e.x,y:e.y}),this._mediator.execute(new Vi(o.fId(),e)),o.redraw(),n}_updateParentConnectionHandlers(o){let e=this._softParentConnectionHandlers[o];if(!e)return;let n=new Map;for(let i of e.source){let r=this._readConnectorRect(i.connector,n);i.handler.setSourceDelta(this._buildDelta(i.baselineRect,r))}for(let i of e.target){let r=this._readConnectorRect(i.connector,n);i.handler.setTargetDelta(this._buildDelta(i.baselineRect,r))}}_readConnectorRect(o,e){let n=`${o.kind}::${o.fId()}`,i=e.get(n);if(i)return i;let r=this._mediator.execute(new Kt(o)).rect;return e.set(n,r),r}_buildDelta(o,e){return U.initialize(e.x-o.x,e.y-o.y)}_emitExpandedEvent(){for(let o=0;o<this._lastSoftResults.length;o++){let e=this._lastSoftResults[o];if(!e.overflow.x&&!e.overflow.y)continue;let n=this._constraints.soft[o],i=gy(n.boundingRect,e.overflow,e.edges);n.nodeOrGroup.sizeChange.emit(i)}}destroy(){for(let o of this.children)o.destroy?.();this.children=[],this.sourceConnectionHandlers=[],this.targetConnectionHandlers=[],this._lastSoftResults=[],this._applyConstraints=o=>o,this._softParentConnectionHandlers=[]}},GB=(()=>{let t=class Ql{_injector=p(dt);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),i=this._linkParentsAndCollectRoots(e,n);return new e_(i,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let i of e)n.set(i.fId(),new o_(this._injector,i));return n}_linkParentsAndCollectRoots(e,n){let i=[];for(let r of e){let a=n.get(r.fId());if(!a)continue;let s=r.fParentId(),c=s?n.get(s):void 0;c?c.children.push(a):i.push(a)}return i}static \u0275fac=function(n){return new(n||Ql)};static \u0275prov=y({token:Ql,factory:Ql.\u0275fac})};return t=P([R(Ju)],t),t})(),tp=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(o){this.nodeOrGroup=o}},Hr=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(o,e){this.nodeOrGroup=o,this.childrenPaddings=e}},r_=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(o,e,n,i){this.nodeOrGroup=o,this.boundingRect=e,this.innerRect=n,this.paddings=i}},jB=(()=>{let t=class Jl{_mediator=p(V);handle({nodeOrGroup:e,childrenPaddings:n}){let i=this._readBoundingRect(e),r=this._readOwnPaddings(e,i),a=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],s=te.initialize(i.x+a[0],i.y+a[1],i.width-a[0]-a[2],i.height-a[1]-a[3]);return new r_(e,i,s,a)}_readBoundingRect(e){return this._mediator.execute(new it(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new Gi(e,n))}static \u0275fac=function(n){return new(n||Jl)};static \u0275prov=y({token:Jl,factory:Jl.\u0275fac})};return t=P([R(Hr)],t),t})(),UB=(()=>{let t=class ec{_mediator=p(V);handle({nodeOrGroup:e}){let n=this._readCurrentRect(e),i=this._readParentsChain(e);return this._buildConstraints(i,n)}_readCurrentRect(e){return this._mediator.execute(new it(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Ao(e))??[]}_buildConstraints(e,n){let i=[],r=Ky(),a=[0,0,0,0];for(let s of e){let c=this._readParentBounds(s,a);a=c.paddings;let u=this._calculateDifference(c.innerRect,n);if(this._isAutoExpand(s))i.push(this._makeSoftLimit(s,c.boundingRect,u));else{r=u;break}}return{soft:i,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new Hr(e,n))}_calculateDifference(e,n){return{min:this._calculateMinimumDifference(e,n),max:this._calculateMaximumDifference(e,n)}}_calculateMinimumDifference(e,n){return U.initialize(e.x-n.x,e.y-n.y)}_calculateMaximumDifference(e,n){return U.initialize(e.x+e.width-(n.x+n.width),e.y+e.height-(n.y+n.height))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeSoftLimit(e,n,i){return{nodeOrGroup:e,boundingRect:n,initialSize:e._size,limits:i}}static \u0275fac=function(n){return new(n||ec)};static \u0275prov=y({token:ec,factory:ec.\u0275fac})};return t=P([R(tp)],t),t})(),np=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(o,e){this.rootHandlers=o,this.participants=e}},ip=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.constraints=e,this.handlerPool=n}},qr=class{_mediator=p(V);_store=p(L);_behaviour=p(Ho);_source;_target;_sourceRef;_targetRef;_sourceDelta=U.initialize();_targetDelta=U.initialize();connection;initialize(o){this.connection=o,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target)}setSourceDelta(o){this._sourceDelta=o,this._mediator.execute(new Bi(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,o)))}setTargetDelta(o){this._targetDelta=o,this._mediator.execute(new Bi(this._target.fId(),this._target.kind,this._withDelta(this._targetRef.rect,o)))}redraw(){let o=this._buildLine();this.connection.setLine(o),this.connection.redraw()}_buildLine(){let o=rt.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=rt.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new vn(o,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(o){return this._mediator.execute(new Kt(o))}_withDelta(o,e){return rt.fromRoundedRect(o).addPoint(e)}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Gr=(()=>{class t extends qr{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jr=(()=>{class t extends qr{_sourceUpdated=!1;_targetUpdated=!1;setSourceDelta(e){super.setSourceDelta(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetDelta(e){super.setTargetDelta(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,this.redraw())}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ur=(()=>{class t extends qr{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),$B=(()=>{let t=class tc{_store=p(L);_mediator=p(V);_dragInjector=p(Ct);handle({dragHandler:e,constraints:n,handlerPool:i}){let r=n.soft.map(a=>this._buildParentConnectionHandlers(a.nodeOrGroup,i));e.setSoftParentConnectionHandlers(r)}_buildParentConnectionHandlers(e,n){let i=this._store.outputs.getAll().filter(h=>h.fNodeId===e.fId()),r=this._store.inputs.getAll().filter(h=>h.fNodeId===e.fId());if(!i.length&&!r.length)return{source:[],target:[]};let a=new Set(i.map(h=>h.fId())),s=new Set(r.map(h=>h.fId())),c=new Map,u={source:[],target:[]};for(let h of this._store.connections.getAll()){let g=a.has(h.fOutputId()),C=s.has(h.fInputId());if(!g&&!C)continue;let k=this._getExistingConnectionHandler(n,h);if(k||(k=this._createConnectionHandler(h,g,C),n.push(k)),g){let I=this._store.outputs.require(h.fOutputId());u.source.push({handler:k,connector:I,baselineRect:this._readConnectorRect(I,c)})}if(C){let I=this._store.inputs.require(h.fInputId());u.target.push({handler:k,connector:I,baselineRect:this._readConnectorRect(I,c)})}}return u}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n,i){let r;return n&&i?r=this._dragInjector.createInstance(jr):n?r=this._dragInjector.createInstance(Gr):r=this._dragInjector.createInstance(Ur),r.initialize(e),r}_readConnectorRect(e,n){let i=`${e.kind}::${e.fId()}`,r=n.get(i);if(r)return r;let a=this._mediator.execute(new Kt(e)).rect;return n.set(i,a),a}static \u0275fac=function(n){return new(n||tc)};static \u0275prov=y({token:tc,factory:tc.\u0275fac})};return t=P([R(ip)],t),t})(),WB=(()=>{let t=class nc{_dragInjector=p(Ct);_mediator=p(V);handle({rootHandlers:e,participants:n}){let i=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,i);let r=this._dragInjector.createInstance(pi);return r.initialize(n,e),r}_applyConstraintsToRoots(e,n){for(let i of e){let r=this._calculateConstraints(i.nodeOrGroup);i.setConstraints(r),this._attachSoftParentConnectionHandlers(i,r,n)}}_collectConnectionHandlers(e){let n=new Map;for(let i of e){for(let r of i.sourceConnectionHandlers)n.set(r.connection.fId(),r);for(let r of i.targetConnectionHandlers)n.set(r.connection.fId(),r)}return Array.from(n.values())}_attachSoftParentConnectionHandlers(e,n,i){this._mediator.execute(new ip(e,n,i))}_calculateConstraints(e){return this._mediator.execute(new tp(e))}static \u0275fac=function(n){return new(n||nc)};static \u0275prov=y({token:nc,factory:nc.\u0275fac})};return t=P([R(np)],t),t})(),op=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.sourceIds=e,this.handlerPool=n}},KB=(()=>{let t=class ic{_store=p(L);_dragInjector=p(Ct);get _connections(){return this._store.connections.getAll()}handle(e){this._getInputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getInputConnections(e){let n=new Set(this._getNodeInputIds(e));return this._connections.filter(i=>n.has(i.fInputId()))}_getNodeInputIds(e){return this._store.inputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let i=this._getExistingConnectionHandler(n.handlerPool,e);i||(i=this._createConnectionHandler(n.sourceIds,e),n.handlerPool.push(i)),n.dragHandler.targetConnectionHandlers.push(i)}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n){let i;return e.includes(n.fOutputId())?i=this._dragInjector.createInstance(jr):i=this._dragInjector.createInstance(Ur),i.initialize(n),i}static \u0275fac=function(n){return new(n||ic)};static \u0275prov=y({token:ic,factory:ic.\u0275fac})};return t=P([R(op)],t),t})(),rp=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.targetIds=e,this.handlerPool=n}},YB=(()=>{let t=class oc{_store=p(L);_dragInjector=p(Ct);get _connections(){return this._store.connections.getAll()}handle(e){this._getOutputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getOutputConnections(e){let n=new Set(this._getNodeOutputIds(e));return this._connections.filter(i=>n.has(i.fOutputId()))}_getNodeOutputIds(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let i=this._getExistingConnectionHandler(n.handlerPool,e);i||(i=this._createConnectionHandler(n.targetIds,e),n.handlerPool.push(i)),n.dragHandler.sourceConnectionHandlers.push(i)}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n){let i;return e.includes(n.fInputId())?i=this._dragInjector.createInstance(jr):i=this._dragInjector.createInstance(Gr),i.initialize(n),i}static \u0275fac=function(n){return new(n||oc)};static \u0275prov=y({token:oc,factory:oc.\u0275fac})};return t=P([R(rp)],t),t})(),ap=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(o){this.nodeOrGroup=o}},XB=(()=>{let t=class rc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({nodeOrGroup:e}){let n=this._collectSelected(e),i=this._withDeepChildren(n),r=this._mediator.execute(new Ju(i)),a=this._collectSourceConnectorIds(i),s=this._collectTargetConnectorIds(i);return this._attachConnectionHandlers(r.participants,a,s),this._mediator.execute(new np(r.rootHandlers,r.participants))}_collectSelected(e){let n=[];for(let i of this._dragSession.selectedItems){let r=this._findNodeByHost(i.hostElement);r&&n.push(r)}return e&&!n.includes(e)&&n.push(e),n}_findNodeByHost(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_withDeepChildren(e){let n=[];for(let i of e){n.push(i);let r=this._mediator.execute(new zo(i.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return om(e,n=>this._store.outputs.getAll().filter(i=>i.fNodeId===n.fId()).map(i=>i.fId()))}_collectTargetConnectorIds(e){return om(e,n=>this._store.inputs.getAll().filter(i=>i.fNodeId===n.fId()).map(i=>i.fId()))}_attachConnectionHandlers(e,n,i){let r=[];for(let a of e)this._mediator.execute(new rp(a,i,r)),this._mediator.execute(new op(a,n,r))}static \u0275fac=function(n){return new(n||rc)};static \u0275prov=y({token:rc,factory:rc.\u0275fac})};return t=P([R(ap)],t),t})(),ZB=[GB,UB,WB,KB,YB,$B,jB,XB];function QB(t,o,e=10){let n=o.x,i=o.y,r=n+o.width,a=i+o.height,s=o.gravityCenter.x,c=o.gravityCenter.y,u,h,g=1/0,C,k,I=1/0,N=(Y,ee)=>{let ce=ee<0?-ee:ee;ce<=e&&ce<g&&(g=ce,u=Y,h=ee)},q=(Y,ee)=>{let ce=ee<0?-ee:ee;ce<=e&&ce<I&&(I=ce,C=Y,k=ee)};for(let Y=0;Y<t.length;Y++){let ee=t[Y],ce=ee.x,Oe=ee.y,De=ce+ee.width,Ge=Oe+ee.height,Ht=ee.gravityCenter.x,ct=ee.gravityCenter.y;N(ce,n-ce),N(De,n-De),N(Ht,s-Ht),N(ce,r-ce),N(De,r-De),q(Oe,i-Oe),q(Ge,i-Ge),q(ct,c-ct),q(Oe,a-Oe),q(Ge,a-Ge)}return{x:{guide:u,delta:h},y:{guide:C,delta:k}}}var by=["left","top","width","height"],sp=class{_element;constructor(o,e,n="f-line"){this._element=o.document.createElement("div"),this._element.classList.add(n),this._element.style.position="absolute",this._element.style.display="none",e.appendChild(this._element)}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}render(o){for(let e of by){let n=o[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let o of by)this._element.style.removeProperty(o)}destroy(){this._element.remove()}},a_=class{_horizontal;_vertical;constructor(o,e){this._horizontal=new sp(o,e),this._vertical=new sp(o,e),this._horizontal.hide(),this._vertical.hide()}drawVerticalLine(o,e,n){this._vertical.show(),this._vertical.render({left:o*n.scale+n.position.x+n.scaledPosition.x,top:0,width:1,height:e.height})}drawHorizontalLine(o,e,n){this._horizontal.show(),this._horizontal.render({left:0,top:o*n.scale+n.position.y+n.scaledPosition.y,width:e.width,height:1})}hideVertical(){this._vertical.hide()}hideHorizontal(){this._horizontal.hide()}hideAll(){this._vertical.hide(),this._horizontal.hide()}destroy(){this._vertical.destroy(),this._horizontal.destroy()}},lp=class{static fToken=Symbol("MagneticLinesPreparationRequest")},JB=(()=>{let t=class ac{_mediator=p(V);_store=p(L);_browser=p(at);_injector=p(dt);_dragSession=p(he);_renderer;handle(e){let n=this._store.instances.get(Xe.MAGNETIC_LINES);if(!n)return;let i=this._dragSession.draggableItems.find(r=>r instanceof pi);i&&i.setMagneticLines(new s_(this._injector,this._renderer??this._createRenderer(n),this._flowHostSize(),this._notDraggedRects(this._draggedNodes(i.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_flowHostSize(){return this._store.flowHost.getBoundingClientRect()}_createRenderer({hostElement:e}){return this._renderer=new a_(this._browser,e),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new it(r.hostElement)))}static \u0275fac=function(n){return new(n||ac)};static \u0275prov=y({token:ac,factory:ac.\u0275fac})};return t=P([R(lp)],t),t})(),s_=class{_renderer;_size;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;constructor(o,e,n,i){this._renderer=e,this._size=n,this._rects=i;let r=o.get(L);this._alignThreshold=r.instances.require(Xe.MAGNETIC_LINES).threshold(),this._canvasTransform=r.transform}scheduleRender(o){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderGuides(this._computeGuides(o)),15)}_renderGuides(o){this._renderVertical(o),this._renderHorizontal(o)}_renderVertical(o){o.x.guide!==void 0?this._renderer.drawVerticalLine(o.x.guide,this._size,this._canvasTransform):this._renderer.hideVertical()}_renderHorizontal(o){o.y.guide!==void 0?this._renderer.drawHorizontalLine(o.y.guide,this._size,this._canvasTransform):this._renderer.hideHorizontal()}_computeGuides(o){return QB(this._rects,o,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},vy=["top","center","bottom"],yy=["left","center","right"];function e9(t,o,e=10,n=10){let i=o.x,r=o.y,a=i+o.width,s=r+o.height,c=o.gravityCenter.x,u=o.gravityCenter.y,h=t9(t,o,i,r,a,s,c,u,e,n),g=n9(t,o,i,r,a,s,c,u,e,n);return h&&(!g||h.absDelta<=g.absDelta)?{axis:"x",delta:h.delta,gap:h.gap,rects:h.rects,alignMode:h.alignMode,crossDelta:h.crossDelta}:g?{axis:"y",delta:g.delta,gap:g.gap,rects:g.rects,alignMode:g.alignMode,crossDelta:g.crossDelta}:{rects:[]}}function t9(t,o,e,n,i,r,a,s,c,u){let h=1/0,g,C=0,k,I=[],N=0,q=[],Y=[],ee=[];for(let ce=0;ce<vy.length;ce++){let Oe=ce===0?n:ce===1?s:r;q.length=0,Y.length=0,ee.length=0;let De=1/0,Ge=-1/0,Ht=0,ct=1/0,vt=1/0;for(let qe=0;qe<t.length;qe++){let Fe=t[qe],rr=ce===0?Fe.y:ce===1?Fe.gravityCenter.y:Fe.y+Fe.height,xf=Oe-rr,An=So(xf);if(An>c)continue;q.push(qe),Y.push(Fe.x),ee.push(Fe.x+Fe.width);let ar=Fe.y,sr=Fe.y+Fe.height;ar<De&&(De=ar),sr>Ge&&(Ge=sr),(An<ct||An===ct&&qe<vt)&&(ct=An,Ht=rr,vt=qe)}let tt=q.length;if(tt<2)continue;rC(q,Y,ee);let st=0;for(;st<tt&&Y[st]<=a;)st++;let Ti=st>0&&st<tt,Mt,qt;Ti?(Mt=st-1,qt=st):st<=0?(Mt=0,qt=1):(Mt=tt-2,qt=tt-1);let Gt=Y[qt]-ee[Mt];if(Gt<0)continue;let ft;if(Ti){ft=ee[Mt]+Gt;let qe=ft+o.width,Fe=Y[qt]-qe;if(So(Fe-Gt)>u)continue}else st<=0?ft=Y[0]-Gt-o.width:ft=ee[tt-1]+Gt;let or=e-ft,Si=So(or);if(Si>u||Si>=h)continue;let dn=i9(q,Y,ee,De,Ge);if(Ti){let qe=ft,Fe=ft+o.width;dn.push({left:ee[Mt],top:De,width:qe-ee[Mt],height:Ge-De}),dn.push({left:Fe,top:De,width:Y[qt]-Fe,height:Ge-De})}else if(st<=0){let qe=ft+o.width;dn.push({left:qe,top:De,width:Y[0]-qe,height:Ge-De})}else dn.push({left:ee[tt-1],top:De,width:ft-ee[tt-1],height:Ge-De});let Cf=Oe-Ht;h=Si,g=or,C=Gt,k=vy[ce],I=dn,N=Cf}if(!(g===void 0||k===void 0))return{delta:g,absDelta:h,gap:C,rects:I,alignMode:k,crossDelta:N}}function n9(t,o,e,n,i,r,a,s,c,u){let h=1/0,g,C=0,k,I=[],N=0,q=[],Y=[],ee=[];for(let ce=0;ce<yy.length;ce++){let Oe=ce===0?e:ce===1?a:i;q.length=0,Y.length=0,ee.length=0;let De=1/0,Ge=-1/0,Ht=0,ct=1/0,vt=1/0;for(let qe=0;qe<t.length;qe++){let Fe=t[qe],rr=ce===0?Fe.x:ce===1?Fe.gravityCenter.x:Fe.x+Fe.width,xf=Oe-rr,An=So(xf);if(An>c)continue;q.push(qe),Y.push(Fe.y),ee.push(Fe.y+Fe.height);let ar=Fe.x,sr=Fe.x+Fe.width;ar<De&&(De=ar),sr>Ge&&(Ge=sr),(An<ct||An===ct&&qe<vt)&&(ct=An,Ht=rr,vt=qe)}let tt=q.length;if(tt<2)continue;rC(q,Y,ee);let st=0;for(;st<tt&&Y[st]<=s;)st++;let Ti=st>0&&st<tt,Mt,qt;Ti?(Mt=st-1,qt=st):st<=0?(Mt=0,qt=1):(Mt=tt-2,qt=tt-1);let Gt=Y[qt]-ee[Mt];if(Gt<0)continue;let ft;if(Ti){ft=ee[Mt]+Gt;let qe=ft+o.height,Fe=Y[qt]-qe;if(So(Fe-Gt)>u)continue}else st<=0?ft=Y[0]-Gt-o.height:ft=ee[tt-1]+Gt;let or=n-ft,Si=So(or);if(Si>u||Si>=h)continue;let dn=o9(q,Y,ee,De,Ge);if(Ti){let qe=ft,Fe=ft+o.height;dn.push({left:De,top:ee[Mt],width:Ge-De,height:qe-ee[Mt]}),dn.push({left:De,top:Fe,width:Ge-De,height:Y[qt]-Fe})}else if(st<=0){let qe=ft+o.height;dn.push({left:De,top:qe,width:Ge-De,height:Y[0]-qe})}else dn.push({left:De,top:ee[tt-1],width:Ge-De,height:ft-ee[tt-1]});let Cf=Oe-Ht;h=Si,g=or,C=Gt,k=yy[ce],I=dn,N=Cf}if(!(g===void 0||k===void 0))return{delta:g,absDelta:h,gap:C,rects:I,alignMode:k,crossDelta:N}}function i9(t,o,e,n,i){let r=[],a=i-n;for(let s=0;s<t.length-1;s++){let c=o[s+1]-e[s];c<0||r.push({left:e[s],top:n,width:c,height:a})}return r}function o9(t,o,e,n,i){let r=[],a=i-n;for(let s=0;s<t.length-1;s++){let c=o[s+1]-e[s];c<0||r.push({left:n,top:e[s],width:a,height:c})}return r}function rC(t,o,e){for(let n=1;n<o.length;n++){let i=o[n],r=e[n],a=t[n],s=n-1;for(;s>=0;){let c=o[s],u=t[s];if(c<i||c===i&&u<a)break;o[s+1]=c,e[s+1]=e[s],t[s+1]=u,s--}o[s+1]=i,e[s+1]=r,t[s+1]=a}}function So(t){return t<0?-t:t}var l_=class{_element;_isVisible=!1;_left=Number.NaN;_top=Number.NaN;_width=Number.NaN;_height=Number.NaN;constructor(o,e,n="f-rect"){this._element=o.document.createElement("div"),this._element.classList.add(n);let i=this._element.style;i.position="absolute",i.display="none",i.boxSizing="border-box",i.pointerEvents="none",e.appendChild(this._element)}show(){this._isVisible||(this._isVisible=!0,this._element.style.display="block")}hide(){this._isVisible&&(this._isVisible=!1,this._element.style.display="none")}render(o,e,n,i){let r=this._element.style;o!==this._left&&(this._left=o,r.left=o+"px"),e!==this._top&&(this._top=e,r.top=e+"px"),n!==this._width&&(this._width=n,r.width=n+"px"),i!==this._height&&(this._height=i,r.height=i+"px")}clearRect(){this._left=Number.NaN,this._top=Number.NaN,this._width=Number.NaN,this._height=Number.NaN;let o=this._element.style;o.removeProperty("left"),o.removeProperty("top"),o.removeProperty("width"),o.removeProperty("height")}destroy(){this._element.remove()}},c_=class{_browser;_hostElement;_className;_pool=[];_activeCount=0;constructor(o,e,n="f-rect"){this._browser=o,this._hostElement=e,this._className=n}draw(o,e){let n=e.scale,i=e.position.x+e.scaledPosition.x,r=e.position.y+e.scaledPosition.y;for(let a=0;a<o.length;a++){let s=this._getOrCreate(a),c=o[a];s.show(),s.render(c.left*n+i,c.top*n+r,c.width*n,c.height*n)}for(let a=o.length;a<this._activeCount;a++)this._pool[a].hide();this._activeCount=o.length}hideAll(){for(let o=0;o<this._activeCount;o++)this._pool[o].hide();this._activeCount=0}destroy(){for(let o of this._pool)o.destroy();this._pool.length=0,this._activeCount=0}_getOrCreate(o){if(o<this._pool.length)return this._pool[o];let e=new l_(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},cp=class{static fToken=Symbol("MagneticRectsPreparationRequest")},r9=(()=>{let t=class sc{_mediator=p(V);_store=p(L);_browser=p(at);_injector=p(dt);_dragSession=p(he);_renderer;handle(e){let n=this._store.instances.get(Xe.MAGNETIC_RECTS);if(!n)return;let i=this._dragSession.draggableItems.find(r=>r instanceof pi);i&&i.setMagneticRects(new d_(this._injector,this._getRenderer(n),this._notDraggedRects(this._draggedNodes(i.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_getRenderer(e){return this._renderer||(this._renderer=new c_(this._browser,e.hostElement)),this._renderer?.destroy(),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new it(r.hostElement)))}static \u0275fac=function(n){return new(n||sc)};static \u0275prov=y({token:sc,factory:sc.\u0275fac})};return t=P([R(cp)],t),t})(),d_=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(o,e,n){this._renderer=e,this._rects=n;let i=o.get(L),r=i.instances.require(Xe.MAGNETIC_RECTS);this._alignThreshold=r.alignThreshold(),this._spacingThreshold=r.spacingThreshold(),this._canvasTransform=i.transform}scheduleRender(o){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderRects(this._computeRects(o)),15)}_renderRects(o){if(o.axis!==void 0&&o.delta!==void 0&&o.rects.length>0){this._renderer.draw(o.rects,this._canvasTransform);return}this._renderer.hideAll()}_computeRects(o){return e9(this._rects,o,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},dp=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(o){this.event=o}},u_=class{nodes;fNodes;constructor(o){this.nodes=o,this.fNodes=o}},a9=(()=>{let t=class lc{_mediator=p(V);_store=p(L);_dragSession=p(he);_dragHandler;handle({event:e}){if(this._dragHandler=this._getDragHandler(),!this._dragHandler)return;let n=this._buildDragDelta(e.getPosition()),i=this._dragHandler.calculateMagneticSnaps(n),r=this._applySnapToDelta(n,i.lines,i.rects);this._finalizeMove(this._dragHandler,r),this._emitNodeIntersectIfNeeded(this._dragHandler)}_getDragHandler(){return this._dragSession.draggableItems.find(qB)}_buildDragDelta(e){return pe.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,i){let r=e.x,a=e.y;return n&&(r=this._hasLineSnapValue(n.x)?e.x-(n.x.delta||0):r,a=this._hasLineSnapValue(n.y)?e.y-(n.y.delta||0):a),this._hasRectSnapValue(i)&&(i.axis==="x"?(r=e.x-i.delta,a=e.y-(i.crossDelta??0)):(a=e.y-i.delta,r=e.x-(i.crossDelta??0))),{x:r,y:a}}_hasLineSnapValue(e){return e.guide!==void 0&&e.guide!==null}_hasRectSnapValue(e){return!!e&&e.axis!==void 0&&e.delta!==void 0}_finalizeMove(e,n){for(let i of e.roots)i.finalizeConstraints();e.onPointerMove(n),e.onPointerUp?.(),this._store.fDraggable?.fMoveNodes.emit(this._buildMoveNodesEvent(e))}_buildMoveNodesEvent(e){let n=e.getEvent(),a=((n.data??n.fData)?.fNodeIds??[]).map(s=>({id:s,position:this._store.nodes.get(s)?._position}));return new u_(a)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new Fu(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||lc)};static \u0275prov=y({token:lc,factory:lc.\u0275fac})};return t=P([R(dp)],t),t})(),up=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(o,e){this.event=o,this.trigger=e}},s9=(()=>{let t=class cc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({event:e,trigger:n}){if(!this._canStartDrag(e,n))return;let i=this._findDraggableNode(e.targetElement);i&&(this._storePointerDownContext(e),this._dragSession.draggableItems=[this._buildDragNodeHandler(i)],this._mediator.execute(new lp),this._mediator.execute(new cp))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&an(e.originalEvent,n)}_isDragHandle(e){return xr(e,".f-drag-handle")}_findDraggableNode(e){let n=this._store.nodes.getAll();for(let i of n)if(!i.fDraggingDisabled()&&i.isContains(e))return i}_storePointerDownContext(e){this._dragSession.onPointerDownScale=this._store.transform.scale,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new Vo(e))}),this._mediator.execute(new ap(e))}static \u0275fac=function(n){return new(n||cc)};static \u0275prov=y({token:cc,factory:cc.\u0275fac})};return t=P([R(up)],t),t})(),l9=[...ZB,JB,r9,a9,s9],p_=class{targetGroupId;nodeIds;dropPosition;fTargetNode;fNodes;fDropPosition;constructor(o,e,n){this.targetGroupId=o,this.nodeIds=e,this.dropPosition=n,this.fTargetNode=o,this.fNodes=e,this.fDropPosition=n}},c9=(()=>{let t=class dc{_dragSession=p(he);_store=p(L);handle({event:e}){let n=this._findDropHandler();if(!n)return;let i=n.activeTarget?.node;i&&this._emitDropToGroupEvent(i.fId(),e),n.onPointerUp?.()}_findDropHandler(){return this._dragSession.draggableItems.find(e=>e instanceof zr)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new p_(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(a=>a.nodeOrGroup),i=new Set(n.map(a=>a.fId())),r=[];for(let a of n){let s=a.fParentId();(!s||!i.has(s))&&r.push(a.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof pi);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||dc)};static \u0275prov=y({token:dc,factory:dc.\u0275fac})};return t=P([R(Qu)],t),t})(),pp=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(o){this.event=o}},hp=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(o){this.candidates=o}},d9=(()=>{let t=class uc{handle({candidates:e}){let n=e.map((i,r)=>({candidate:i,index:r}));return n.sort((i,r)=>{let a=this._compareDomOrder(i.candidate.node.hostElement,r.candidate.node.hostElement);return a!==0?-a:i.index-r.index}),n.map(i=>i.candidate)}_compareDomOrder(e,n){if(e===n)return 0;let i=e.compareDocumentPosition(n);if((i&Node.DOCUMENT_POSITION_FOLLOWING)!==0)return-1;if((i&Node.DOCUMENT_POSITION_PRECEDING)!==0)return 1;if(i&Node.DOCUMENT_POSITION_DISCONNECTED){let r=e.getBoundingClientRect?.()??{top:0,left:0},a=n.getBoundingClientRect?.()??{top:0,left:0};return r.top!==a.top?r.top<a.top?-1:1:r.left!==a.left?r.left<a.left?-1:1:0}return 0}static \u0275fac=function(n){return new(n||uc)};static \u0275prov=y({token:uc,factory:uc.\u0275fac})};return t=P([R(hp)],t),t})(),h_=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(o,e,n){this._onPointerDown=e,this._limit=n;let i=o.get(L);this._vCellSize=i.fDraggable.vCellSize(),this._hCellSize=i.fDraggable.hCellSize(),this._adjustCellSize=i.fDraggable.fCellSizeWhileDragging()}limit(o){let{min:e,max:n}=this._limit,{x:i,y:r}=this._cellSizeStrategies[+this._adjustCellSize](o);return{x:this._clamp(i,e.x,n.x),y:this._clamp(r,e.y,n.y)}}_cellSizeStrategies={0:this._skipCellSize.bind(this),1:this._applyCellSize.bind(this)};_applyCellSize(o){return{x:this._snapToGrid(this._onPointerDown.x+o.x,this._hCellSize)-this._onPointerDown.x,y:this._snapToGrid(this._onPointerDown.y+o.y,this._vCellSize)-this._onPointerDown.y}}_skipCellSize(o){return o}_clamp(o,e,n){return Math.min(Math.max(o,e),n)}_snapToGrid(o,e){return Math.round(o/e)*e}},fp=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(o){this.externalItem=o}},u9=(()=>{let t=class pc{_browser=p(at);_containerRef=p(Ka);handle({externalItem:e}){let{hostElement:n,placeholder:i}=e,r=i(),a=r?this._fromTemplate(r):this._fromHost(n);return a.classList.add("f-external-item-placeholder"),a.style.pointerEvents="none",a}_fromTemplate(e){return sm(this._createViewRef(e),this._browser.document)}_fromHost(e){return rm(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||pc)};static \u0275prov=y({token:pc,factory:pc.\u0275fac})};return t=P([R(fp)],t),t})(),mp=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(o){this.externalItem=o}},p9=(()=>{let t=class hc{_browser=p(at);_containerRef=p(Ka);handle({externalItem:e}){let{hostElement:n,preview:i}=e,r=i(),a=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(a),Jv(a),a.classList.add("f-external-item-preview"),a}_fromTemplate(e){return sm(this._createViewRef(e),this._browser.document)}_fromHost(e){return rm(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){am(e.style,{"pointer-events":"none",margin:"showPopover"in e?"0 auto 0 0":"0",position:"fixed",top:"0",left:"0","z-index":"1000"},new Set(["position"]))}static \u0275fac=function(n){return new(n||hc)};static \u0275prov=y({token:hc,factory:hc.\u0275fac})};return t=P([R(mp)],t),t})(),_p=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(o){this.event=o}},f_=class{externalItemRect;data;targetContainerId;dropPosition;rect;fTargetNode;fDropPosition;constructor(o,e,n,i){this.externalItemRect=o,this.data=e,this.targetContainerId=n,this.dropPosition=i,this.rect=o,this.fTargetNode=n,this.fDropPosition=i}},h9="external-item",f9="drag-external-item";function m9(t){return t.getEvent().kind===f9||t.getEvent().fEventType===h9}var _9=(()=>{let t=class fc{_result=p(hi);_mediator=p(V);_store=p(L);_dragSession=p(he);_browser=p(at);get _createNodeEmitter(){return this._store.fDraggable?.fCreateNode}handle(e){let n=this._findExternalItemHandler();if(!n)return;let i=this._getDestinationNodeOrGroupId();this._emitEvent(this._getElementsFromPoint(e.event.getPosition()),i,e.event.getPosition()),n.onPointerUp(),this._dragSession.draggableItems=[]}_findExternalItemHandler(){return this._dragSession.draggableItems.find(e=>m9(e))}_getDestinationNodeOrGroupId(){let e=this._getDropToGroupHandler(),n=e.activeTarget?.node.fId();return e.onPointerUp?.(),n}_getDropToGroupHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof zr);if(!e)throw new Error("NodeDragToParentDragHandler not found");return e}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y).filter(n=>!n.closest(".f-external-item")&&!n.closest(".f-external-item-preview"))}_emitEvent(e,n,i){this._isPointerInCanvasRect(e)&&this._createNodeEmitter?.emit(new f_(this._getPreviewRect(),this._result.getData().externalItem.data(),n,n?i:void 0))}_isPointerInCanvasRect(e){return e.length?this._store.flowHost.contains(e[0]):!1}_getPreviewRect(){return this._mediator.execute(new it(this._result.getData().preview))}static \u0275fac=function(n){return new(n||fc)};static \u0275prov=y({token:fc,factory:fc.\u0275fac})};return t=P([R(_p)],t),t})(),m_=class{data;constructor(o){this.data=o}},gp=class extends Ft{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new m_(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=te.initialize();_pointerDownRect=te.initialize();_absoluteOffsetFromFlow=U.initialize();_grabOffsetFromPointer=U.initialize();_originalParent;_originalNextSibling;_originalDisplay;_applyConstraints=o=>o;constructor(o,e,n){super(),this._externalItem=e,this._pointerDownClientPosition=n,this._store=o.get(L),this._result=o.get(hi),this._mediator=o.get(V),this._browser=o.get(at),this._originalDisplay=this._host.style.display,this._initConstraints(o)}get _host(){return this._externalItem.hostElement}get _overlayRoot(){return this._browser.document.fullscreenElement??this._browser.document.body}get _transform(){return this._store.transform}_initConstraints(o){this._startRect=this._getStartRect();let e=new h_(o,this._startRect,Ky());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new it(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=pe.fromPoint(this._pointerDownRect).sub(this._toAbsolutePoint(this._startRect)),this._grabOffsetFromPointer=this._clientToAbsolute(this._pointerDownClientPosition).sub(this._pointerDownRect),this._rememberOriginalPlacement(),this._previewEl=this._createPreview(),this._placeholderEl=this._createPlaceholder(),this._placePreviewIntoOverlay(),this._swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(),this._result.setData({preview:this._previewEl,externalItem:this._externalItem})}_rememberOriginalPlacement(){let o=this._host.parentNode;if(!o){this._originalParent=void 0,this._originalNextSibling=null;return}this._originalParent=o,this._originalNextSibling=this._host.nextSibling}_createPreview(){let o=this._mediator.execute(new mp(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(o,this._pointerDownRect),o.style.transform=Cy(this._pointerDownRect),o}_createPlaceholder(){return this._mediator.execute(new fp(this._externalItem))}_placePreviewIntoOverlay(){this._overlayRoot.appendChild(this._previewEl)}_swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(){let o=this._originalParent,e=this._placeholderEl;if(!o||!e)return;let n=o.replaceChild(e,this._host);this._overlayRoot.appendChild(n),this._host.style.display="none"}onPointerMove(o,e){if(!this._previewEl)return;let n=this._resolveDeltaFromPointer(o,e),i=this._applyConstraints(n),r=pe.fromPoint(this._startRect).add(i),a=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=Cy(a)}onPointerUp(){this._previewEl&&this._previewEl.parentNode&&this._previewEl.parentNode.removeChild(this._previewEl),this._restoreOriginalInParent(),this._host.style.display=this._originalDisplay||"block",this._previewEl=void 0,this._placeholderEl=void 0,this._originalParent=void 0,this._originalNextSibling=null}_restoreOriginalInParent(){let o=this._originalParent,e=this._placeholderEl;if(!(!o||!e)){if(e.parentNode===o){o.replaceChild(this._host,e);return}this._originalNextSibling&&this._originalNextSibling.parentNode===o?o.insertBefore(this._host,this._originalNextSibling):o.appendChild(this._host)}}_matchSize(o,e){o.style.width=`${e.width}px`,o.style.height=`${e.height}px`}_readAbsoluteRect(o){let e=o.getBoundingClientRect(),n=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,i=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return te.initialize(e.left+i,e.top+n,e.width,e.height)}_toAbsolutePoint(o){let e=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition);return pe.fromPoint(o).mult(this._transform.scale).add(e).add(this._getFlowHostAbsolutePosition())}_resolveDeltaFromPointer(o,e){let n=e?.getPosition();if(!n)return o;let i=this._clientToAbsolute(n).sub(this._grabOffsetFromPointer),r=this._toFlowPoint(i);return pe.fromPoint(r).sub(this._startRect)}_toFlowPoint(o){let e=this._getFlowHostAbsolutePosition(),n=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition);return pe.fromPoint(o).sub(e).sub(n).div(this._transform.scale)}_getFlowHostAbsolutePosition(){let o=this._store.flowHost.getBoundingClientRect(),e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return U.initialize(o.left+n,o.top+e)}_clientToAbsolute(o){let e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return pe.fromPoint(o).add(U.initialize(n,e))}};function Cy({x:t,y:o}){return`translate3d(${Math.round(t)}px, ${Math.round(o)}px, 0)`}var bp=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}};function g9(t){return!!t.closest?.("[fExternalItem]")}function b9(t){return t.closest("[fExternalItem]")}var v9=(()=>{class t{_byHost=new Map;_items=X([]);items=E(()=>this._items());getByElement(e){let n=b9(e);return n?this._byHost.get(n):void 0}getByHost(e){return this._byHost.get(e)}register(e){let n=e.hostElement,i=this._byHost.get(n);i!==e&&(i&&i!==e&&this._byHost.delete(n),this._byHost.set(n,e),this._sync())}remove(e){let n=e.hostElement;this._byHost.get(n)===e&&(this._byHost.delete(n),this._sync())}_sync(){this._items.set([...this._byHost.values()])}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var y9=(()=>{let t=class mc{_apiService=p(v9);_dragSession=p(he);_store=p(L);_injector=p(dt);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!an(e.originalEvent,n))return;let i=this._resolveExternalItem(e.targetElement);if(!i||i.disabled())return;let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new gp(this._injector,i,e.getPosition())]}_resolveExternalItem(e){return this._apiService.getByElement(e)}static \u0275fac=function(n){return new(n||mc)};static \u0275prov=y({token:mc,factory:mc.\u0275fac})};return t=P([R(bp)],t),t})(),vp=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(o){this.event=o}},C9=(()=>{let t=class _c{handle(e){this._isTargetItemExternal(e.event)&&e.event.preventDefault()}_isTargetItemExternal(e){let n=this._isExternalItem(e.target),i=this._isExternalItem(e.target.parentNode);return n||i}_isExternalItem(e){let n=!1;try{n=g9(e)}catch{}return n}static \u0275fac=function(n){return new(n||_c)};static \u0275prov=y({token:_c,factory:_c.\u0275fac})};return t=P([R(vp)],t),t})(),x9=[u9,p9,_9,y9,C9],w9=(()=>{let t=class gc{_mediator=p(V);_dragContext=p(he);_store=p(L);_dragInjector=p(Ct);get _allNodes(){return this._store.nodes.getAll()}handle({event:e}){if(!this._canPrepare())return;let n=this._allNodes.find(a=>a.isContains(e.targetElement));if(!n&&!this._hasExternalDrag())throw new Error("Drag target node not found");let i=this._sortedTargetsForDrop();if(n){let a=n.fParentId(),s=this._mediator.execute(new Yp(a));s.length&&(i=i.filter(c=>s.includes(c.node.fId())))}let r=this._dragInjector.get(zr);r.initialize(i),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof pi)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof gp)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(s=>s instanceof Km),i=this._withParents(e),a=this._eligibleTargets(i,n).map(s=>{let c=this._mediator.execute(new it(s.hostElement));return{node:s,rect:c}});return this._mediator.execute(new hp(a))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof pi);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,i)=>{n.push(i);let r=this._mediator.execute(new Ao(i));return n.push(...r),n},[])}_eligibleTargets(e,n){let i=this._allNodes.filter(r=>!e.includes(r));return n?i.filter(r=>r instanceof Km):i}static \u0275fac=function(n){return new(n||gc)};static \u0275prov=y({token:gc,factory:gc.\u0275fac})};return t=P([R(pp)],t),t})(),T9=[d9,w9,c9],yp=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(o){this.event=o}},S9=.5,Cp=(()=>{class t extends Ft{type="pinch-to-zoom";kind="pinch-to-zoom";_store=p(L);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(Xe.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=xy(this._touches);e!=null&&(this._startDistance=e,this._startScale=this._canvas.transform.scale)}onPointerMove(e,n){if(n.touches.length!==2||this._startDistance==null||this._startScale==null)return;let i=xy(n.touches),r=k9(n.touches);if(i==null||r==null){this._reset();return}if(Math.abs(i-this._startDistance)<S9)return;n.preventDefault();let a=i/this._startDistance,s=this._clamp(this._startScale*a);this._canvas.setScale(s,this._castPositionToFlow(r)),this._canvas.redraw()}_clamp(e){return Math.max(this._zoomComponent.minimum,Math.min(e,this._zoomComponent.maximum))}_castPositionToFlow(e){return pe.fromPoint(e).elementTransform(this._flowHost)}_reset(){this._startScale=null,this._startDistance=null}onPointerUp(){this._reset(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function k9(t){if(t.length!==2)return null;let o=t[0],e=t[1];return U.initialize((o.clientX+e.clientX)/2,(o.clientY+e.clientY)/2)}function xy(t){if(t.length!==2)return null;let o=t[0],e=t[1];return Math.hypot(e.clientX-o.clientX,e.clientY-o.clientY)}var I9=(()=>{let t=class bc{_dragSession=p(he);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof Cp)}static \u0275fac=function(n){return new(n||bc)};static \u0275prov=y({token:bc,factory:bc.\u0275fac})};return t=P([R(yp)],t),t})(),xp=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(o){this.event=o}},E9=(()=>{let t=class vc{_dragInjector=p(Ct);_store=p(L);_dragSession=p(he);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new pe,this._dragSession.draggableItems=[this._getHandler(e)])}_canStart(e){return this._dragSession.isEmpty()&&e.touches?.length===2&&!e.isEventInLockedContext&&this._hasZoomComponent()}_hasZoomComponent(){return this._store.instances.has(Xe.ZOOM)}_getHandler(e){let n=this._dragInjector.get(Cp);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||vc)};static \u0275prov=y({token:vc,factory:vc.\u0275fac})};return t=P([R(xp)],t),t})(),M9=[E9,I9],wp=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(o){this.event=o}},D9=(()=>{let t=class yc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>e.getEvent().kind==="selection-area")}static \u0275fac=function(n){return new(n||yc)};static \u0275prov=y({token:yc,factory:yc.\u0275fac})};return t=P([R(wp)],t),t})(),__=(()=>{class t extends Ft{type="selection-area";kind="selection-area";_store=p(L);_dragSession=p(he);_mediator=p(V);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return pe.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(Xe.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new lh),this._show(),this._draw(te.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=pe.fromPoint(e).add(this._dragSession.onPointerDownPosition),i=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),a=Math.abs(e.y),s=te.initialize(i.x,i.y,r,a);this._draw(s),this._selectedByMove=[],this._canBeSelected.forEach(c=>{c.element.unmarkAsSelected();let u=te.addPoint(te.mult(c.fRect,this._transform.scale),this._canvasPosition);te.intersectionWithRect(u,s)&&(c.element.markAsSelected(),this._selectedByMove.push(c.element))}),this._mediator.execute(new si)}_getMinimumPoint(e,n){return U.initialize(Math.min(e.x,n.x),Math.min(e.y,n.y))}onPointerUp(){this._hide(),this._dragSession.selectedItems.push(...this._selectedByMove),this._selectedByMove.length>0&&(this._dragSession.isSelectedChanged=!0)}_draw(e){let n=this._instance.hostElement.style;n.left=e.x+"px",n.top=e.y+"px",n.width=e.width+"px",n.height=e.height+"px"}_show(){this._instance.hostElement.style.display="block"}_hide(){this._instance.hostElement.style.display="none"}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Tp=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(o){this.event=o}},P9=(()=>{let t=class Cc{_store=p(L);_dragSession=p(he);_dragInjector=p(Ct);get _instance(){return this._store.instances.get(Xe.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(__)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&an(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||Cc)};static \u0275prov=y({token:Cc,factory:Cc.\u0275fac})};return t=P([R(Tp)],t),t})(),R9=[P9,D9],Sp=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(o,e){this.rect=o,this.childrenBounds=e}},O9=(()=>{let t=class xc{handle({rect:e,childrenBounds:n}){n&&this._apply(e,n)}_apply(e,n){this._restrictLeft(e,n),this._restrictTop(e,n),this._restrictRight(e,n),this._restrictBottom(e,n),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_restrictLeft(e,n){let i=e.x-n.x;i>0&&(e.x-=i,e.width+=i)}_restrictTop(e,n){let i=e.y-n.y;i>0&&(e.y-=i,e.height+=i)}_restrictRight(e,n){let i=n.x+n.width;e.x+e.width<=i&&(e.width=i-e.x)}_restrictBottom(e,n){let i=n.y+n.height;e.y+e.height<=i&&(e.height=i-e.y)}static \u0275fac=function(n){return new(n||xc)};static \u0275prov=y({token:xc,factory:xc.\u0275fac})};return t=P([R(Sp)],t),t})(),kp=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(o,e){this.rect=o,this.limits=e}},F9=(()=>{let t=class wc{_mediator=p(V);handle({rect:e,limits:n}){this._applyResizeConstraints(e,n)}_applyResizeConstraints(e,n){if(!n)return;let i=this._clampedCopyForCalculation(e,n);this._applySoftParentExpansions(i,n.softLimits),n.hardLimit&&this._clampRectToInner(e,n.hardLimit.innerRect)}_clampedCopyForCalculation(e,n){let i=ge({},e);return n.hardLimit&&this._clampRectToInner(i,n.hardLimit.innerRect),i}_clampRectToInner(e,n){if(e.x<n.x){let a=n.x-e.x;e.x+=a,e.width-=a}if(e.y<n.y){let a=n.y-e.y;e.y+=a,e.height-=a}let i=n.x+n.width;e.x+e.width>i&&(e.width=i-e.x);let r=n.y+n.height;e.y+e.height>r&&(e.height=r-e.y),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_applySoftParentExpansions(e,n){if(n?.length)for(let i of n)this._expandParentFromOriginalIfOverflow(e,i)}_expandParentFromOriginalIfOverflow(e,n){let i=n.innerRect,r=n.boundingRect,a=this._computeOverflow(i,e);if(!this._hasOverflow(a)){this._applyParentRect(n,r);return}let s=this._buildExpandedParentRect(r,a);this._applyParentRect(n,s)}_hasOverflow(e){return!!(e.left||e.top||e.right||e.bottom)}_computeOverflow(e,n){let i=Math.max(0,e.x-n.x),r=Math.max(0,e.y-n.y),a=Math.max(0,n.x+n.width-(e.x+e.width)),s=Math.max(0,n.y+n.height-(e.y+e.height));return{left:i,top:r,right:a,bottom:s}}_buildExpandedParentRect(e,n){let i=ge({},e);return n.left&&(i.x=e.x-n.left,i.width=e.width+n.left),n.top&&(i.y=e.y-n.top,i.height=e.height+n.top),n.right&&(i.width=(i.width??e.width)+n.right),n.bottom&&(i.height=(i.height??e.height)+n.bottom),i}_applyParentRect(e,n){e.nodeOrGroup.updatePosition(n),e.nodeOrGroup.updateSize(n),this._mediator.execute(new Vi(e.nodeOrGroup.fId(),n)),e.nodeOrGroup.redraw()}static \u0275fac=function(n){return new(n||wc)};static \u0275prov=y({token:wc,factory:wc.\u0275fac})};return t=P([R(kp)],t),t})(),Ip=class{originalRect;difference;handleType;minimumSize;static fToken=Symbol("CalculateChangedRectFromDifferenceRequest");constructor(o,e,n,i){this.originalRect=o,this.difference=e,this.handleType=n,this.minimumSize=i}},wy={[In.LEFT]:{x:-1,y:0},[In.LEFT_TOP]:{x:-1,y:-1},[In.TOP]:{x:0,y:-1},[In.RIGHT_TOP]:{x:1,y:-1},[In.RIGHT]:{x:1,y:0},[In.RIGHT_BOTTOM]:{x:1,y:1},[In.BOTTOM]:{x:0,y:1},[In.LEFT_BOTTOM]:{x:-1,y:1}},N9=(()=>{let t=class Tc{handle({originalRect:e,difference:n,handleType:i,minimumSize:r}){let a=this._changeSizeInRect(e,n,wy[i],r);return this._changePosition(e,n,wy[i],a)}_changeSizeInRect(e,n,i,r){let a=e.width+i.x*n.x,s=e.height+i.y*n.y,c=0,u=0;return a<0&&(c=a,a=Math.abs(a)),a<r.width&&(i.x===-1&&(c+=a-r.width),a=r.width),s<0&&(u=s,s=Math.abs(s)),s<r.height&&(i.y===-1&&(u+=s-r.height),s=r.height),te.initialize(c,u,a,s)}_changePosition(e,n,i,r){let a=e.x+(i.x===-1?n.x:0)+r.x,s=e.y+(i.y===-1?n.y:0)+r.y;return te.initialize(a,s,r.width,r.height)}static \u0275fac=function(n){return new(n||Tc)};static \u0275prov=y({token:Tc,factory:Tc.\u0275fac})};return t=P([R(Ip)],t),t})(),Ep=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(o,e){this.nodeOrGroup=o,this.paddings=e}},A9=(()=>{let t=class Sc{_mediator=p(V);_store=p(L);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let i=te.union(this._calculateDirectChildren(e.fId()).map(r=>this._normalizeRect(r)));return i?this._concatRectWithParentPadding(i,n):null}_calculateDirectChildren(e){return this._allNodesAndGroups.filter(n=>n.fParentId()===e)}_normalizeRect(e){return this._mediator.execute(new it(e.hostElement))}_concatRectWithParentPadding(e,n){return te.initialize(e.x-n[0],e.y-n[1],e.width+n[0]+n[2],e.height+n[1]+n[3])}static \u0275fac=function(n){return new(n||Sc)};static \u0275prov=y({token:Sc,factory:Sc.\u0275fac})};return t=P([R(Ep)],t),t})(),$r=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(o,e){this.nodeOrGroup=o,this.rect=e}},L9=(()=>{let t=class kc{_mediator=p(V);handle({nodeOrGroup:e,rect:n}){let i=this._getParentsChain(e),r=this._calculateNodePaddings(e,n);return{limits:this._buildSoftHardLimits(i),childrenBounds:this._getNormalizedChildrenBounds(e,r),minimumSize:Ot.initialize(r[0]+r[2],r[1]+r[3])}}_calculateNodePaddings(e,n){return this._mediator.execute(new Gi(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new Ep(e,n))}_getParentsChain(e){return this._mediator.execute(new Ao(e))??[]}_buildSoftHardLimits(e){let n=[],i,r=[0,0,0,0];for(let a of e){let s=this._getParentInfo(a,r);if(r=s.paddings,this._isAutoExpand(a))n.push(this._makeLimit(a,s));else{i=this._makeLimit(a,s);break}}return{softLimits:n,hardLimit:i}}_getParentInfo(e,n){return this._mediator.execute(new Hr(e,n))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeLimit(e,{boundingRect:n,innerRect:i}){return{nodeOrGroup:e,boundingRect:n,innerRect:i}}static \u0275fac=function(n){return new(n||kc)};static \u0275prov=y({token:kc,factory:kc.\u0275fac})};return t=P([R($r)],t),t})(),Mp=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(o){this.event=o}},aC="node-resize",sC="resize-node";function B9(t){return t.getEvent().kind===sC||t.getEvent().fEventType===aC}var V9=(()=>{let t=class Ic{_dragSession=p(he);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>B9(e))}static \u0275fac=function(n){return new(n||Ic)};static \u0275prov=y({token:Ic,factory:Ic.\u0275fac})};return t=P([R(Mp)],t),t})(),g_=class{fNodeId;constructor(o){this.fNodeId=o}},b_=(()=>{class t extends Ft{type=aC;kind=sC;data(){return new g_(this._nodeOrGroup.fId())}_mediator=p(V);_baselineRect;_constraints;_lastRect=null;_nodeOrGroup;_handleType;_nodeConnections={source:[],target:[]};_softParentConnections=[];initialize(e,n){this._nodeOrGroup=e,this._handleType=n}setNodeConnectionHandlers(e){this._nodeConnections=e}setSoftParentConnectionHandlers(e){this._softParentConnections=e}prepareDragSequence(){this._baselineRect=this._readBaselineRect(),this._constraints=this._buildConstraints(this._baselineRect),this._lastRect=this._baselineRect}onPointerMove(e){let n=this._calcNextRect(e);this._applyConstraints(n),this._commitRect(n),this._applyConnectionHandlers(this._nodeConnections);for(let i of this._softParentConnections)this._applyConnectionHandlers(i);this._lastRect=n}onPointerUp(){let e=this._lastRect??this._fallbackRectFromModel();this._nodeOrGroup.sizeChange.emit(e),requestAnimationFrame(()=>this._nodeOrGroup.refresh())}_readBaselineRect(){return this._mediator.execute(new it(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new $r(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new Ip(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Sp(e,this._constraints.childrenBounds)),this._mediator.execute(new kp(e,this._constraints.limits))}_commitRect(e){this._nodeOrGroup.updatePosition({x:e.x,y:e.y}),this._nodeOrGroup.updateSize({width:e.width,height:e.height}),this._mediator.execute(new Vi(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return te.initialize(this._nodeOrGroup._position.x,this._nodeOrGroup._position.y,this._nodeOrGroup._size?.width,this._nodeOrGroup._size?.height)}_applyConnectionHandlers(e){if(!e.source.length&&!e.target.length)return;let n=new Map;for(let i of e.source){let r=this._readConnectorRect(i.connector,n);i.handler.setSourceRect(r)}for(let i of e.target){let r=this._readConnectorRect(i.connector,n);i.handler.setTargetRect(r)}}_readConnectorRect(e,n){let i=`${e.kind}::${e.fId()}`,r=n.get(i);if(r)return r;let a=this._mediator.execute(new di(e.hostElement,!1));return n.set(i,a),a}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Wr=class{_mediator=p(V);_store=p(L);_behaviour=p(Ho);_source;_target;_sourceRef;_targetRef;_sourceRect;_targetRect;connection;initialize(o){this.connection=o,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target),this._sourceRect=rt.fromRoundedRect(this._sourceRef.rect),this._targetRect=rt.fromRoundedRect(this._targetRef.rect)}setSourceRect(o){this._sourceRect=rt.fromRoundedRect(o),this._mediator.execute(new Bi(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(o){this._targetRect=rt.fromRoundedRect(o),this._mediator.execute(new Bi(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let o=this._buildLine();this.connection.setLine(o),this.connection.redraw()}_buildLine(){let o=rt.fromRoundedRect(this._sourceRect),e=rt.fromRoundedRect(this._targetRect);return this._behaviour.handle(new vn(o,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(o){return{connector:o,rect:this._mediator.execute(new di(o.hostElement,!1))}}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},z9=(()=>{class t extends Wr{_sourceUpdated=!1;_targetUpdated=!1;setSourceRect(e){super.setSourceRect(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetRect(e){super.setTargetRect(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,super.redraw())}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),H9=(()=>{class t extends Wr{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),q9=(()=>{class t extends Wr{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Dp=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},Pp=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(o,e){this.handler=o,this.nodeOrGroup=e}},G9=(()=>{let t=class Ec{_store=p(L);_mediator=p(V);_dragInjector=p(Ct);handle({handler:e,nodeOrGroup:n}){let i=this._readSoftParents(n),r=[n,...i],a=this._collectSourceConnectorIds(r),s=this._collectTargetConnectorIds(r),c=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,a,s,c)),e.setSoftParentConnectionHandlers(i.map(u=>this._buildConnectionHandlersForNode(u,a,s,c)))}_readSoftParents(e){let n=this._mediator.execute(new it(e.hostElement));return this._mediator.execute(new $r(e,n)).limits.softLimits.map(r=>r.nodeOrGroup)}_collectSourceConnectorIds(e){let n=new Set(e.map(i=>i.fId()));return new Set(this._store.outputs.getAll().filter(i=>n.has(i.fNodeId)).map(i=>i.fId()))}_collectTargetConnectorIds(e){let n=new Set(e.map(i=>i.fId()));return new Set(this._store.inputs.getAll().filter(i=>n.has(i.fNodeId)).map(i=>i.fId()))}_buildConnectionHandlersForNode(e,n,i,r){let a=this._store.outputs.getAll().filter(g=>g.fNodeId===e.fId()),s=this._store.inputs.getAll().filter(g=>g.fNodeId===e.fId());if(!a.length&&!s.length)return{source:[],target:[]};let c=new Set(a.map(g=>g.fId())),u=new Set(s.map(g=>g.fId())),h={source:[],target:[]};for(let g of this._store.connections.getAll()){let C=c.has(g.fOutputId()),k=u.has(g.fInputId());if(!C&&!k)continue;let I=r.get(g.fId())??this._createConnectionHandler(g,n,i);if(r.set(g.fId(),I),C){let N=this._store.outputs.require(g.fOutputId());h.source.push({handler:I,connector:N})}if(k){let N=this._store.inputs.require(g.fInputId());h.target.push({handler:I,connector:N})}}return h}_createConnectionHandler(e,n,i){let r=n.has(e.fOutputId()),a=i.has(e.fInputId()),s=r&&a?this._dragInjector.createInstance(z9):r?this._dragInjector.createInstance(H9):this._dragInjector.createInstance(q9);return s.initialize(e),s}static \u0275fac=function(n){return new(n||Ec)};static \u0275prov=y({token:Ec,factory:Ec.\u0275fac})};return t=P([R(Pp)],t),t})(),j9=(()=>{let t=class Mc{_mediator=p(V);_store=p(L);_dragSession=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!an(e.originalEvent,n))return;let i=this._findResizableNode(e.targetElement);if(!i)return;this._selectBeforeResize(i);let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let a=this._dragInjector.createInstance(b_);a.initialize(i,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new Pp(a,i)),this._dragSession.draggableItems=[a]}_isResizeHandle(e){return xr(e,".f-resize-handle")}_findResizableNode(e){let n=this._store.nodes.getAll().find(i=>i.isContains(e));if(n)return n.fDraggingDisabled()?void 0:n}_selectBeforeResize(e){queueMicrotask(()=>{this._mediator.execute(new Vo(e))})}_readResizeHandleType(e){let n=ey(e,"fResizeHandleType",".f-resize-handle");return In[n]}static \u0275fac=function(n){return new(n||Mc)};static \u0275prov=y({token:Mc,factory:Mc.\u0275fac})};return t=P([R(Dp)],t),t})(),U9=[O9,F9,N9,A9,L9,G9,V9,j9],Rp=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(o){this.event=o}},lC="node-rotate",cC="rotate-node";function $9(t){return t.getEvent().kind===cC||t.getEvent().fEventType===lC}var W9=(()=>{let t=class Dc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>$9(e))}static \u0275fac=function(n){return new(n||Dc)};static \u0275prov=y({token:Dc,factory:Dc.\u0275fac})};return t=P([R(Rp)],t),t})(),Op=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},v_=class{fNodeId;constructor(o){this.fNodeId=o}};function K9(t,o,e){let{x:n,y:i}=Y9(t,o,e),r=n-t.x,a=i-t.y;return{x:r,y:a}}function Y9(t,o,e){let n=t.x-e.x,i=t.y-e.y,r=o*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=n*a-i*s,u=n*s+i*a,h=c+e.x,g=u+e.y;return{x:h,y:g}}var y_=(()=>{class t extends Ft{type=lC;kind=cC;data(){return new v_(this._nodeOrGroup.fId())}_store=p(L);_mediator=p(V);_dragSession=p(he);_nodeOrGroup;_sourceConnections;_targetConnections;_startRotation=0;_nodeRect;_nodeCenter;_pointerDownInFlow;_rotationOffsetDeg=0;get _transform(){return this._store.transform}initialize(e,n,i){this._nodeOrGroup=e,this._sourceConnections=n,this._targetConnections=i,this._startRotation=this._nodeOrGroup._rotate}prepareDragSequence(){this._nodeRect=this._readNodeRect(),this._nodeCenter=this._nodeRect.gravityCenter,this._pointerDownInFlow=this._calculatePointerDownInFlow();let e=this._angleDeg(this._pointerDownInFlow);this._rotationOffsetDeg=e-this._startRotation}onPointerMove(e){let n=U.sum(this._pointerDownInFlow,e),r=this._angleDeg(n)-this._rotationOffsetDeg;this._applyRotation(r);let a=r-this._startRotation;for(let s of this._sourceConnections)s.connection.setSourceDelta(this._deltaAfterRotation(s.connector,a));for(let s of this._targetConnections)s.connection.setTargetDelta(this._deltaAfterRotation(s.connector,a))}onPointerUp(){this._nodeOrGroup.rotate.set(this._nodeOrGroup._rotate),this._nodeOrGroup.refresh()}_readNodeRect(){return this._mediator.execute(new it(this._nodeOrGroup.hostElement))}_calculatePointerDownInFlow(){return U.sub(this._dragSession.onPointerDownPosition,U.sum(this._transform.position,this._transform.scaledPosition))}_angleDeg(e){return Math.atan2(e.y-this._nodeCenter.y,e.x-this._nodeCenter.x)*(180/Math.PI)}_applyRotation(e){this._nodeOrGroup.updateRotate(e),this._nodeOrGroup.redraw()}_deltaAfterRotation(e,n){return K9(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),X9=(()=>{let t=class Pc{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle(e){if(!this._isPreparationAllowed(e))return;let n=this._findRotatableNode(e.event.targetElement);if(!n)return;this._selectBeforeRotate(n);let i=this._transform.scale;this._dragContext.onPointerDownScale=i,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(i);let r=this._dragInjector.createInstance(y_);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&vB(e.targetElement)&&an(e.originalEvent,n)}_findRotatableNode(e){for(let n of this._store.nodes.getAll())if(!n.fDraggingDisabled()&&n.isContains(e))return n}_selectBeforeRotate(e){queueMicrotask(()=>{this._mediator.execute(new Vo(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new Vp(e)).map(n=>{let i=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new Kt(i)),a=this._dragInjector.get(Ur);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new Kp(e)).map(n=>{let i=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new Kt(i)),a=this._dragInjector.get(Gr);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||Pc)};static \u0275prov=y({token:Pc,factory:Pc.\u0275fac})};return t=P([R(Op)],t),t})(),Z9=[W9,X9],Kr=class{flowRect;canvasPosition;eventPoint;minimap;static fToken=Symbol("CalculateFlowPointFromMinimapPointRequest");constructor(o,e,n,i){this.flowRect=o,this.canvasPosition=e,this.eventPoint=n,this.minimap=i}},Q9=(()=>{let t=class Rc{_store=p(L);get _canvasScale(){return this._store.transform.scale||1}handle(e){return U.sub(e.canvasPosition,U.sub(this._getPositionInViewBox(e.eventPoint,e.minimap),this._getNormalizedFlowCenter(e.flowRect)))}_getNormalizedFlowCenter(e){return pe.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let i=this.normalizeEventPoint(e,n);return U.sum(i,te.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return pe.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||Rc)};static \u0275prov=y({token:Rc,factory:Rc.\u0275fac})};return t=P([R(Kr)],t),t})(),Fp=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(o){this.event=o}},J9=(()=>{let t=class Oc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(eV)}static \u0275fac=function(n){return new(n||Oc)};static \u0275prov=y({token:Oc,factory:Oc.\u0275fac})};return t=P([R(Fp)],t),t})(),dC="minimap",uC="minimap";function eV(t){return t.getEvent().kind===uC||t.getEvent().fEventType===dC}var C_=(()=>{class t extends Ft{type=dC;kind=uC;_store=p(L);_mediator=p(V);_lastDelta=null;_flowRect;_startCanvasPosition;_eventPoint;_minimap;initialize(e,n,i,r){this._flowRect=e,this._startCanvasPosition=n,this._eventPoint=i,this._minimap=r}prepareDragSequence(){this._store.fCanvas?.hostElement.classList.add("f-scaled-animate")}onPointerMove(e){this._lastDelta&&this._isSamePoint(e,this._lastDelta)||(this._lastDelta=e,this._store.fCanvas?.setPosition(this._getNewPosition(pe.fromPoint(this._eventPoint).add(e))),this._store.fCanvas?.redraw())}_isSamePoint(e,n){return e.x===n.x&&e.y===n.y}_getNewPosition(e){return this._mediator.execute(new Kr(this._flowRect,this._startCanvasPosition,e,this._minimap))}onPointerUp(){this._store.fCanvas?.hostElement.classList.remove("f-scaled-animate"),this._store.fCanvas?.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Np=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(o){this.event=o}},tV=(()=>{let t=class Fc{_store=p(L);_mediator=p(V);_dragSession=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _flowHost(){return this._store.flowHost}handle({event:e}){if(!this._isValid(e))return;let n=this._store.instances.require(Xe.MINIMAP).state,i=e.getPosition(),r=pe.fromPoint(this._store.transform.position),a=te.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(a,i,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=pe.fromPoint(i).elementTransform(this._flowHost);let s=this._dragInjector.createInstance(C_);s.initialize(a,r,i,n),this._dragSession.draggableItems=[s]}_isValid(e){return!(!this._dragSession.isEmpty()||!this._flowHost.contains(e.targetElement)||!e.targetElement.closest(".f-minimap")||!this._store.instances.get(Xe.MINIMAP))}_calculateCanvasPosition(e,n,i){return this._mediator.execute(new Kr(e,pe.fromPoint(this._canvas.transform.position),n,i))}static \u0275fac=function(n){return new(n||Fc)};static \u0275prov=y({token:Fc,factory:Fc.\u0275fac})};return t=P([R(Np)],t),t})(),nV=[Q9,J9,tV];function iV(t){return!!t&&typeof t.destroy=="function"}var Ct=(()=>{class t{_injector=p(dt);_dragInjector=null;_created=[];create(){this._dragInjector=dt.create({providers:[{provide:Ap,useClass:Ap},{provide:Xu,useClass:Xu},{provide:Hu,useClass:Hu},{provide:Jm,useClass:Jm},{provide:zr,useClass:zr},{provide:Gr,useClass:Gr},{provide:Ur,useClass:Ur},{provide:jr,useClass:jr},{provide:pi,useClass:pi},{provide:Cp,useClass:Cp},{provide:__,useClass:__},{provide:b_,useClass:b_},{provide:y_,useClass:y_},{provide:C_,useClass:C_}],parent:this._injector}),this._created=[]}get(e){if(!this._dragInjector)throw new Error("DragHandlerInjector has not been created. Call create() before using get().");return this._dragInjector.get(e)}createInstance(e){if(!this._dragInjector)throw new Error("DragHandlerInjector is not created");let n=C0(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)iV(e)&&e.destroy();this._created=[],this._dragInjector?.destroy?.(),this._dragInjector=null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),hi=(()=>{class t{_data;setData(e){this._data=ge(ge({},this._data),e)}getData(){return this._data}clear(){this._data=void 0}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ty="f-canvas-dragging",Sy="canvas-dragging",Ap=(()=>{class t extends Ft{type="canvas-move";kind="drag-canvas";_store=p(L);_onPointerDownPosition=U.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(Ty,Sy)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(pe.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(Ty,Sy)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),oV=(()=>{let t=class Nc{_dragContext=p(he);handle(e){this._isValid()&&this._dragContext.draggableItems.forEach(n=>n.onPointerUp?.())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Ap)}static \u0275fac=function(n){return new(n||Nc)};static \u0275prov=y({token:Nc,factory:Nc.\u0275fac})};return t=P([R(Au)],t),t})(),Lp=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},rV=(()=>{let t=class Ac{_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost),this._dragContext.draggableItems=[this._dragInjector.get(Ap)])}_isValid(e){return this._dragContext.isEmpty()&&(this._isBackgroundElement(e.targetElement)||this._isDragOnHost(e.targetElement))}_isBackgroundElement(e){return this._store.instances.get(Xe.BACKGROUND)?.hostElement.contains(e)}_isDragOnHost(e){return this._store.flowHost.contains(e)&&!this._getNode(e)}_getNode(e){let n=this._store.nodes.getAll().find(i=>i.isContains(e));return n&&n.fDraggingDisabled()&&(n=void 0),n}_isValidTrigger(e,n){return an(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Ac)};static \u0275prov=y({token:Ac,factory:Ac.\u0275fac})};return t=P([R(Lp)],t),t})(),aV=[oV,rV],Bp=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(o,e){this.event=o,this.trigger=e}},sV=(()=>{let t=class Lc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let i=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(i),an(e.originalEvent,n)?this._applyToggleSelect(i):this._applySingleSelect(i)}_isSelectionAllowed(e){return this._store.flowHost.contains(e.targetElement)&&this._dragSession.isEmpty()}_resolveSelectable(e){return this._findNodeOrGroupAt(e)??this._findConnectionAt(e)}_findNodeOrGroupAt(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_findConnectionAt(e){return this._store.connections.getAll().find(n=>n.isContains(e))}_deferRaiseLayerFor(e){e&&queueMicrotask(()=>{this._mediator.execute(new ji(e,e.hostElement.parentElement))})}_applySingleSelect(e){if(!e||e.fSelectionDisabled()){this._clearSelection();return}e.isSelected()||(this._clearSelection(),this._select(e))}_applyToggleSelect(e){!e||e.fSelectionDisabled()||(e.isSelected()?this._deselect(e):this._select(e))}_clearSelection(){if(this._dragSession.selectedItems.length){for(let e of this._dragSession.selectedItems)e.unmarkAsSelected();this._dragSession.markSelectionAsChanged(),this._dragSession.selectedItems=[]}}_select(e){this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.markSelectionAsChanged()}_deselect(e){let n=this._dragSession.selectedItems.indexOf(e);n>=0&&this._dragSession.selectedItems.splice(n,1),e.unmarkAsSelected(),this._dragSession.markSelectionAsChanged()}static \u0275fac=function(n){return new(n||Lc)};static \u0275prov=y({token:Lc,factory:Lc.\u0275fac})};return t=P([R(Bp)],t),t})(),lV=[sV];var x_=class extends qm{hostElement=p(Qe).nativeElement};function cV(t){return xr(t,".f-drag-blocker")}var pC=(()=>{class t extends x_{_result=p(hi);_mediator=p(V);_platform=p(im);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===ii.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=gn;fCreateConnectionTrigger=gn;fConnectionWaypointsTrigger=B(gn);fMoveControlPointTrigger=gn;fNodeResizeTrigger=gn;fNodeRotateTrigger=gn;fNodeMoveTrigger=gn;fCanvasMoveTrigger=gn;fExternalItemTrigger=gn;fSelectionChange=new ne;fNodeIntersectedWithConnections=new ne;fNodeConnectionsIntersection=Ke();fEmitOnNodeIntersect=!1;fCreateNode=new ne;fMoveNodes=new ne;fReassignConnection=new ne;fCreateConnection=new ne;fConnectionWaypointsChanged=Ke();fDropToGroup=new ne;vCellSize=B(1,{transform:e=>xe(e,1)});hCellSize=B(1,{transform:e=>xe(e,1)});fCellSizeWhileDragging=B(!1,{transform:e=>j(e)});fDragStarted=new ne;fDragEnded=new ne;_dragHandlerInjector=p(Ct);ngOnInit(){this._mediator.execute(new qp(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(cV(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new jp),this._mediator.execute(new Tp(e)),this._mediator.execute(new Np(e)),this._mediator.execute(new xp(e)),this._mediator.execute(new Bp(e,this.fMultiSelectTrigger)),this._mediator.execute(new $u(e,this.fReassignConnectionTrigger)),this._mediator.execute(new ju(e,this.fCreateConnectionTrigger)),this._mediator.execute(new Zu(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new Dp(e,this.fNodeResizeTrigger)),this._mediator.execute(new Op(e,this.fNodeRotateTrigger)),this._mediator.execute(new up(e,this.fNodeMoveTrigger)),this._mediator.execute(new bp(e,this.fExternalItemTrigger)),this._mediator.execute(new pp(e)),this._mediator.execute(new Lp(e,this.fCanvasMoveTrigger)),this._mediator.execute(new Up)}onSelect(e){this._mediator.execute(new vp(e))}onPointerMove(e){this._mediator.execute(new Gp(e))}onPointerUp(e){this._mediator.execute(new Fp(e)),this._mediator.execute(new wp(e)),this._mediator.execute(new Uu(e)),this._mediator.execute(new zu(e)),this._mediator.execute(new Mp(e)),this._mediator.execute(new Rp(e)),this._mediator.execute(new dp(e)),this._mediator.execute(new _p(e)),this._mediator.execute(new Qu(e)),this._mediator.execute(new Au(e)),this._mediator.execute(new yp(e)),this._mediator.execute(new Ku(e)),this._mediator.execute(new Du)}finalizeDragSequence(){this._mediator.execute(new ui),this._mediator.execute(new Ar),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new ui),this._mediator.execute(new $p),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",j],fMultiSelectTrigger:"fMultiSelectTrigger",fReassignConnectionTrigger:"fReassignConnectionTrigger",fCreateConnectionTrigger:"fCreateConnectionTrigger",fConnectionWaypointsTrigger:[1,"fConnectionWaypointsTrigger"],fMoveControlPointTrigger:"fMoveControlPointTrigger",fNodeResizeTrigger:"fNodeResizeTrigger",fNodeRotateTrigger:"fNodeRotateTrigger",fNodeMoveTrigger:"fNodeMoveTrigger",fCanvasMoveTrigger:"fCanvasMoveTrigger",fExternalItemTrigger:"fExternalItemTrigger",fEmitOnNodeIntersect:[2,"fEmitOnNodeIntersect","fEmitOnNodeIntersect",j],vCellSize:[1,"vCellSize"],hCellSize:[1,"hCellSize"],fCellSizeWhileDragging:[1,"fCellSizeWhileDragging"]},outputs:{fSelectionChange:"fSelectionChange",fNodeIntersectedWithConnections:"fNodeIntersectedWithConnections",fNodeConnectionsIntersection:"fNodeConnectionsIntersection",fCreateNode:"fCreateNode",fMoveNodes:"fMoveNodes",fReassignConnection:"fReassignConnection",fCreateConnection:"fCreateConnection",fConnectionWaypointsChanged:"fConnectionWaypointsChanged",fDropToGroup:"fDropToGroup",fDragStarted:"fDragStarted",fDragEnded:"fDragEnded"},exportAs:["fDraggable"],standalone:!1,features:[ke([hi,Ct]),Z]})}return t})(),dV=[...aV,...zB,...lB,...lV,...x9,..._B,...nV,...l9,...T9,...U9,...Z9,...R9,...M9],uV=(()=>{let t=class Bc{_store=p(L);handle({waypointIndex:e,connectionId:n}){let i=this._store.connections.require(n),r=i.fWaypoints()?.waypoints().slice();if(!r)throw new Error("Connection waypoints not found");r.splice(e,1),i.fWaypoints()?.waypoints.set(r),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._changeEvent(i))}_changeEvent(e){return new Yu(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||Bc)};static \u0275prov=y({token:Bc,factory:Bc.\u0275fac})};return t=P([R(Bm)],t),t})(),w_=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},pV=(()=>{let t=class Vc{_store=p(L);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||Vc)};static \u0275prov=y({token:Vc,factory:Vc.\u0275fac})};return t=P([R(w_)],t),t})(),hV=[Th,Ui,a6,s6,l6,c6,t7,P7,a7,S7,V7,B7,D7,H7,G7,q7,M7,A7,s7,W7,E7,I7,k7,y7,T7,C7,x7,z7,F7,j7,U7,L7,N7,$7,K7,Y7,X7,pV,uV],Yr=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(o){this.instance=o}},fV=(()=>{let t=class zc{_store=p(L);_mediator=p(V);handle({instance:e}){switch(e.kind){case"input":this._addInput(e);break;case"output":this._addOutput(e);break;case"outlet":this._addOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_addInput(e){this._store.inputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutput(e){this._store.outputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutlet(e){this._store.outlets.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_geometryRegister(e){this._mediator.execute(new du(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||zc)};static \u0275prov=y({token:zc,factory:zc.\u0275fac})};return t=P([R(Yr)],t),t})(),qi=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(o,e){this.position=o,this.connectorRefs=e}},mV=(()=>{let t=class Hc{handle({position:e,connectorRefs:n}){let i,r=1/0;for(let a of n){let s=this._distanceToRect(e,a.rect);s<r&&(r=s,i=a)}return i?Dt(ge({},i),{distance:r}):void 0}_distanceToRect(e,{x:n,y:i,width:r,height:a}){let s=this._clamp(e.x,n,n+r),c=this._clamp(e.y,i,i+a),u=e.x-s,h=e.y-c;return Math.sqrt(u*u+h*h)}_clamp(e,n,i){return Math.max(n,Math.min(i,e))}static \u0275fac=function(n){return new(n||Hc)};static \u0275prov=y({token:Hc,factory:Hc.\u0275fac})};return t=P([R(qi)],t),t})(),Xr=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(o,e){this.pointerPosition=o,this.connectableConnectors=e}},_V=(()=>{let t=class qc{_mediator=p(V);_store=p(L);_browser=p(at);get _transform(){return this._store.transform}get _flowHost(){return this._store.flowHost}get _fNodes(){return this._store.nodes.getAll()}get _snapConnection(){return this._store.connections.getForSnap()}handle(e){let n=this._findConnectorAtPosition(e);return n.length>0?n[0]:void 0}_findConnectorAtPosition(e){let n=[];n.push(...this._filterConnectorsThatLocatedAtPosition(e));let i=this._isSnapConnectionEnabledAndHasClosestConnector(e);i&&n.unshift(i.connector);let r=this._getFirstConnectableConnectorOfNodeAtPosition(e);return r&&n.push(r),n}_filterConnectorsThatLocatedAtPosition(e){return e.connectableConnectors.filter(n=>te.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return qo(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new qi(this._calculatePointerInFlow(e.pointerPosition),e.connectableConnectors));return this._isValidClosestInput(n)?n:void 0}_isValidClosestInput(e){return!!e&&e.distance<this._snapConnection.fSnapThreshold}_getFirstConnectableConnectorOfNodeAtPosition(e){return this._getElementsFromPoint(e.pointerPosition).map(n=>this._findConnectableNode(n)).filter(n=>!!n).map(n=>this._findFirstConnectableConnectorOfNode(e.connectableConnectors,n)).find(n=>!!n)}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y)}_findConnectableNode(e){return this._fNodes.find(n=>n.isContains(e)&&n.fConnectOnNode())}_findFirstConnectableConnectorOfNode(e,n){return e.find(i=>i.connector.fNodeId===n.fId())?.connector}static \u0275fac=function(n){return new(n||qc)};static \u0275prov=y({token:qc,factory:qc.\u0275fac})};return t=P([R(Xr)],t),t})(),Zr=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(o,e){this.source=o,this.pointer=e}},Kt=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(o){this.connector=o}},gV=(()=>{let t=class Gc{_mediator=p(V);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new di(e.hostElement))}static \u0275fac=function(n){return new(n||Gc)};static \u0275prov=y({token:Gc,factory:Gc.\u0275fac})};return t=P([R(Kt)],t),t})(),Qr=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(o){this.nodeOrGroup=o}},bV=(()=>{let t=class jc{_store=p(L);_mediator=p(V);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new uu(e.fId(),e.hostElement,e)),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||jc)};static \u0275prov=y({token:jc,factory:jc.\u0275fac})};return t=P([R(Qr)],t),t})(),Vp=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(o){this.nodeOrGroup=o}},vV=(()=>{let t=class Uc{_store=p(L);handle({nodeOrGroup:e}){let n=this._collectInputIds(e);return this._collectConnections(n)}_collectInputIds(e){let n=new Set,i=this._store.inputs.getAll();for(let r of i)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],i=this._store.connections.getAll();for(let r of i)e.has(r.fInputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||Uc)};static \u0275prov=y({token:Uc,factory:Uc.\u0275fac})};return t=P([R(Vp)],t),t})(),Oo=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(o,e){this.connector=o,this.pointerPosition=e}},ky=2,Et=(function(t){return t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=4]="TOP",t[t.BOTTOM=8]="BOTTOM",t[t.ALL=15]="ALL",t})(Et||{});function yV(t,o,e,n,i){let r=CV(i),a=e-t,s=n-o,c=xV(a,s);return wV(c,r)?c:TV(a,s,r,c)}function CV(t){if(!t||t.length===0)return Et.ALL;let o=Et.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case K.LEFT:o|=Et.LEFT;break;case K.RIGHT:o|=Et.RIGHT;break;case K.TOP:o|=Et.TOP;break;case K.BOTTOM:o|=Et.BOTTOM;break}return o||Et.ALL}function xV(t,o){let e=t<0?-t:t,n=o<0?-o:o;return e-n>ky?t<0?K.LEFT:K.RIGHT:(n-e>ky,o<0?K.TOP:K.BOTTOM)}function wV(t,o){switch(t){case K.LEFT:return(o&Et.LEFT)!==0;case K.RIGHT:return(o&Et.RIGHT)!==0;case K.TOP:return(o&Et.TOP)!==0;case K.BOTTOM:return(o&Et.BOTTOM)!==0;default:return!0}}function TV(t,o,e,n){let i=n,r=-1/0;if(e&Et.RIGHT){let a=t;a>r&&(r=a,i=K.RIGHT)}if(e&Et.LEFT){let a=-t;a>r&&(r=a,i=K.LEFT)}if(e&Et.BOTTOM){let a=o;a>r&&(r=a,i=K.BOTTOM)}if(e&Et.TOP){let a=-o;a>r&&(r=a,i=K.TOP)}return i}function zp(t){return t===K.CALCULATE||t===K.CALCULATE_HORIZONTAL||t===K.CALCULATE_VERTICAL}var SV={[K.CALCULATE]:[K.TOP,K.BOTTOM,K.LEFT,K.RIGHT],[K.CALCULATE_HORIZONTAL]:[K.LEFT,K.RIGHT],[K.CALCULATE_VERTICAL]:[K.TOP,K.BOTTOM]},kV=(()=>{let t=class $c{_mediator=p(V);handle({connector:e,pointerPosition:n}){let i=e.userFConnectableSide,r=this._getConnectorRect(e.hostElement).gravityCenter,a=this._accumulateConnectedCenters(e.hostElement,e.toConnector,n),s=a.sumX/a.count,c=a.sumY/a.count;return yV(r.x,r.y,s,c,SV[i])}_accumulateConnectedCenters(e,n,i){let r=i?.x||0,a=i?.y||0,s=i?1:0;if(n&&n.length)for(let c=0;c<n.length;c++){let u=n[c].hostElement;if(u===e)continue;let h=this._getConnectorRect(u).gravityCenter;r+=h.x,a+=h.y,s++}return{sumX:r,sumY:a,count:s}}_getConnectorRect(e){return this._mediator.execute(new it(e))}static \u0275fac=function(n){return new(n||$c)};static \u0275prov=y({token:$c,factory:$c.\u0275fac})};return t=P([R(Oo)],t),t})(),Hp=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(o){this.connector=o}},qp=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(o){this.fComponent=o}},IV=(()=>{let t=class Wc{_store=p(L);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||Wc)};static \u0275prov=y({token:Wc,factory:Wc.\u0275fac})};return t=P([R(qp)],t),t})(),Gp=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(o){this.event=o}},EV=(()=>{let t=class Kc{_mediator=p(V);_store=p(L);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=p(he);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new Lr)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(i=>{i.onPointerMove(ge({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return pe.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||Kc)};static \u0275prov=y({token:Kc,factory:Kc.\u0275fac})};return t=P([R(Gp)],t),t})(),jp=class{static fToken=Symbol("InitializeDragSequenceRequest")},MV=(()=>{let t=class Yc{_dragContext=p(he);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||Yc)};static \u0275prov=y({token:Yc,factory:Yc.\u0275fac})};return t=P([R(jp)],t),t})(),fi=class{static fToken=Symbol("IsDragStartedRequest")},DV=(()=>{let t=class Xc{_store=p(L);handle(e){return!!this._store.fDraggable?.isDragStarted}static \u0275fac=function(n){return new(n||Xc)};static \u0275prov=y({token:Xc,factory:Xc.\u0275fac})};return t=P([R(fi)],t),t})(),Up=class{static fToken=Symbol("PrepareDragSequenceRequest")},PV=(()=>{let t=class Zc{_mediator=p(V);_dragContext=p(he);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new Pu)}_callPrepareDragSequence(){this._dragContext.draggableItems.forEach(e=>e.prepareDragSequence?.())}static \u0275fac=function(n){return new(n||Zc)};static \u0275prov=y({token:Zc,factory:Zc.\u0275fac})};return t=P([R(Up)],t),t})(),$p=class{static fToken=Symbol("RemoveDndFromStoreRequest")},RV=(()=>{let t=class Qc{_store=p(L);handle(e){this._store.fDraggable=void 0}static \u0275fac=function(n){return new(n||Qc)};static \u0275prov=y({token:Qc,factory:Qc.\u0275fac})};return t=P([R($p)],t),t})(),OV=[IV,EV,MV,PV,DV,RV],FV=new be("CONNECTABLE_SIDE_EPSILON"),NV=(()=>{let t=class Jc{_mediator=p(V);_lastSide=new WeakMap;_epsilon=Math.max(0,p(FV,{optional:!0})??2);handle({connector:e}){if(this._isDragging()){let i=this._lastSide.get(e);if(i!==void 0)return i;let r=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,r),r}let n=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,n),n}_getSideByDelta(e,n,i){let r=te.fromElement(e),a=n.getBoundingClientRect(),s=r.gravityCenter.x,c=r.gravityCenter.y,u=s-a.left,h=a.right-s,g=c-a.top,C=a.bottom-c,k=0,I=u,N=[u,h,g,C];for(let ee=1;ee<4;ee++){let ce=N[ee];ce<I&&(I=ce,k=ee)}let q=k===0?K.LEFT:k===1?K.RIGHT:k===2?K.TOP:K.BOTTOM,Y=this._lastSide.get(i);if(Y!==void 0&&Y!==q){let ee=Y===K.LEFT?0:Y===K.RIGHT?1:Y===K.TOP?2:3;(ee===0?u:ee===1?h:ee===2?g:C)-I<=this._epsilon&&(q=Y)}return q}_isDragging(){return this._mediator.execute(new fi)}static \u0275fac=function(n){return new(n||Jc)};static \u0275prov=y({token:Jc,factory:Jc.\u0275fac})};return t=P([R(Hp)],t),t})(),Fo=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(o){this.nodeOrGroup=o}},AV=(()=>{let t=class ed{_mediator=p(V);handle({nodeOrGroup:e}){let n=e.connectors,i=n.length;for(let a=0;a<i;a++){let s=n[a];s.fConnectableSide=this._resolveSideForConnectorFast(s)}let r=new Set;for(let a=0;a<i;a++){let c=n[a].toConnector;if(c&&c.length)for(let u=0,h=c.length;u<h;u++){let g=c[u],C=g.userFConnectableSide;zp(C)&&r.add(g)}}r.size>0&&r.forEach(a=>{a.fConnectableSide=this._calculateByConnectedPositions(a)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===K.AUTO?this._mediator.execute(new Hp(e)):zp(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new Oo(e))}static \u0275fac=function(n){return new(n||ed)};static \u0275prov=y({token:ed,factory:ed.\u0275fac})};return t=P([R(Fo)],t),t})(),No=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},LV=(()=>{let t=class td{_store=p(L);handle(e){return te.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>te.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||td)};static \u0275prov=y({token:td,factory:td.\u0275fac})};return t=P([R(No)],t),t})(),Wp=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(o){this.fNodes=o}},BV=(()=>{let t=class nd{_store=p(L);_mediator=p(V);handle(e){return te.union(this._getNodesRects(e.fNodes||this._store.nodes.getAll()))}_getNodesRects(e){return e.map(n=>this._getNodeRect(n))}_getNodeRect(e){let n=this._mediator.execute(new Po(e.hostElement));if(n)return this._getElementRect(e,n);let i=this._mediator.execute(new it(e.hostElement));return this._getElementRect(e,i)}_getElementRect(e,n){return te.initialize(e._position.x,e._position.y,n.width,n.height)}static \u0275fac=function(n){return new(n||nd)};static \u0275prov=y({token:nd,factory:nd.\u0275fac})};return t=P([R(Wp)],t),t})(),Kp=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(o){this.nodeOrGroup=o}},VV=(()=>{let t=class id{_store=p(L);handle({nodeOrGroup:e}){let n=this._collectOutputIds(e);return this._collectConnections(n)}_collectOutputIds(e){let n=new Set,i=this._store.outputs.getAll();for(let r of i)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],i=this._store.connections.getAll();for(let r of i)e.has(r.fOutputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||id)};static \u0275prov=y({token:id,factory:id.\u0275fac})};return t=P([R(Kp)],t),t})(),Jr=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(o){this.nodeOrGroup=o}},Gi=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(o,e){this.fNode=o,this.rect=e}},zV=(()=>{let t=class od{_browser=p(at);handle(e){return e.fNode.fIncludePadding()?this._getPaddingData(e.fNode,e.rect):[0,0,0,0]}_getPaddingData(e,n){let i=this._browser.window.getComputedStyle(e.hostElement);return[this._browser.toPixels(i.paddingLeft,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingTop,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingRight,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingBottom,n.width,n.height,i.fontSize)]}static \u0275fac=function(n){return new(n||od)};static \u0275prov=y({token:od,factory:od.\u0275fac})};return t=P([R(Gi)],t),t})(),HV=(()=>{let t=class rd{_mediator=p(V);_store=p(L);get _nodes(){return this._store.nodes.getAll()}handle({nodeOrGroup:e}){if(e.fAutoSizeToFitChildren()){let r=this._calculateDirectChildren(e);if(r.length){let a=this._boundingRect(e),s=this._calculateChildrenBounding(r,this._paddings(e,a));e.updatePosition(s),e.updateSize(s),e.redraw()}}let n=e.fParentId();if(!n)return;let i=this._nodes.find(r=>r.fId()===n);i&&this._mediator.execute(new Jr(i))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return te.union(e.map(n=>this._boundingRect(n)))||te.initialize()}_boundingRect(e){return this._mediator.execute(new it(e.hostElement))}_paddings(e,n){return this._mediator.execute(new Gi(e,n))}_calculateChildrenBounding(e,[n,i,r,a]){let s=this._unionRect(e);return s=te.initialize(s.x-n,s.y-i,s.width+n+r,s.height+i+a),s}static \u0275fac=function(n){return new(n||rd)};static \u0275prov=y({token:rd,factory:rd.\u0275fac})};return t=P([R(Jr)],t),t})(),Yp=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(o){this.id=o}},qV=(()=>{let t=class ad{_store=p(L);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle(e){if(!e.id)return[];let n=new Set,i=[];return this._collectDescendants(e.id,i,n),i}_collectDescendants(e,n,i){if(i.has(e))throw new Error(`Circular reference detected in the node hierarchy. Node id: ${e}`);i.add(e);let r=this._allNodesAndGroups.filter(a=>a.fParentId()===e).map(a=>a.fId());n.push(...r);for(let a of r)this._collectDescendants(a,n,i)}static \u0275fac=function(n){return new(n||ad)};static \u0275prov=y({token:ad,factory:ad.\u0275fac})};return t=P([R(Yp)],t),t})(),Ao=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(o){this.nodeOrGroup=o}},GV=(()=>{let t=class sd{_store=p(L);handle({nodeOrGroup:e}){return this._getParentNodes(e,new Set,[])}_getParentNodes(e,n,i){if(n.has(e.fId()))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e.fId());n.add(e.fId());let r=this._store.nodes.get(e.fParentId());return r?(i.push(r),this._getParentNodes(r,n,i)):i}static \u0275fac=function(n){return new(n||sd)};static \u0275prov=y({token:sd,factory:sd.\u0275fac})};return t=P([R(Ao)],t),t})(),ea=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(o,e){this.nodeOrGroup=o,this.destroyRef=e}},jV=(()=>{let t=class ld{_mediator=p(V);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:i,stateChanges:r}=e;new En(new gm(i),r).listen(n,()=>{this._mediator.execute(new Ai),this._isDragging()||(this._mediator.execute(new Do(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new Fo(e)),this._mediator.execute(new Jr(e)))})}_isDragging(){return this._mediator.execute(new fi)}static \u0275fac=function(n){return new(n||ld)};static \u0275prov=y({token:ld,factory:ld.\u0275fac})};return t=P([R(ea)],t),t})(),ta=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(o){this.instance=o}},UV=(()=>{let t=class cd{_store=p(L);_mediator=p(V);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new pu(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||cd)};static \u0275prov=y({token:cd,factory:cd.\u0275fac})};return t=P([R(ta)],t),t})(),$V=[bV,kV,NV,vV,AV,LV,BV,VV,HV,qV,zV,GV,jV,UV],WV=(()=>{let t=class dd{_mediator=p(V);_store=p(L);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let i=this._getConnectableTargets(e),r=[];for(let a of i)r.push(this._mediator.execute(new Kt(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableTargets(e){if(e.hasConnectionLimits)return this._targets.filter(i=>e.canConnectTo(i));let n=this._targets.filter(i=>i.canBeConnected);return e.isSelfConnectable||(n=n.filter(i=>i.fNodeId!==e.fNodeId)),n}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:i}of e)zp(i.userFConnectableSide)&&(i.fConnectableSide=this._calculateByConnectedPositions(i,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Oo(e,n))}static \u0275fac=function(n){return new(n||dd)};static \u0275prov=y({token:dd,factory:dd.\u0275fac})};return t=P([R(Zr)],t),t})(),Xp=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(o,e){this.target=o,this.pointer=e}},KV=(()=>{let t=class ud{_mediator=p(V);_store=p(L);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let i=this._getConnectableSources(e),r=[];for(let a of i)r.push(this._mediator.execute(new Kt(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableSources(e){return this._sources.filter(n=>{let i=n.canBeConnected;return i&&n.hasConnectionLimits&&(i=n.canConnectTo(e)),i})}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:i}of e)zp(i.userFConnectableSide)&&(i.fConnectableSide=this._calculateByConnectedPositions(i,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Oo(e,n))}static \u0275fac=function(n){return new(n||ud)};static \u0275prov=y({token:ud,factory:ud.\u0275fac})};return t=P([R(Xp)],t),t})(),Lo=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(o){this.connectors=o}},ht={DRAG_AND_DROP:{DRAGGING:"f-dragging",CONNECTIONS_DRAGGING:"f-connections-dragging"},GROUPING:{OVER_BOUNDARY:"f-grouping-over-boundary",DROP_ACTIVE:"f-grouping-drop-active"},CONNECTOR:{OUTPUT_CONNECTED:"f-node-output-connected",OUTPUT_NOT_CONNECTABLE:"f-node-output-not-connectable",INPUT_CONNECTED:"f-node-input-connected",INPUT_NOT_CONNECTABLE:"f-node-input-not-connectable",CONNECTABLE:"f-connector-connectable"}},YV=(()=>{let t=class pd{_store=p(L);handle({connectors:e}){this._store.flowHost.classList.add(ht.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(ht.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||pd)};static \u0275prov=y({token:pd,factory:pd.\u0275fac})};return t=P([R(Lo)],t),t})(),na=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(o){this.instance=o}},XV=(()=>{let t=class hd{_store=p(L);_mediator=p(V);handle({instance:e}){switch(e.kind){case"input":this._removeInput(e);break;case"output":this._removeOutput(e);break;case"outlet":this._removeOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_removeInput(e){this._store.inputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutput(e){this._store.outputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutlet(e){this._store.outlets.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_geometryUnregister(e){this._mediator.execute(new Ir(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||hd)};static \u0275prov=y({token:hd,factory:hd.\u0275fac})};return t=P([R(na)],t),t})(),Bo=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(o){this.connectors=o}},ZV=(()=>{let t=class fd{_store=p(L);handle({connectors:e}){this._store.flowHost.classList.remove(ht.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(ht.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||fd)};static \u0275prov=y({token:fd,factory:fd.\u0275fac})};return t=P([R(Bo)],t),t})(),QV=[fV,XV,mV,_V,KV,WV,gV,YV,ZV],Zp=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(o){this.instance=o}},$i=(function(t){return t.TOP_BOTTOM="TOP_BOTTOM",t.BOTTOM_TOP="BOTTOM_TOP",t.LEFT_RIGHT="LEFT_RIGHT",t.RIGHT_LEFT="RIGHT_LEFT",t})($i||{}),oi=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(oi||{});function JV(t){let o=[...t.nodes.map(Iy),...t.groups.map(Iy)],e=new Set(t.nodes.map(s=>s.id)),n=new Set(t.groups.map(s=>s.id)),i=new Map,r=new Map;for(let s of[...t.nodes,...t.groups]){for(let c of s.fOutputs)i.set(c.id,s.id);for(let c of s.fInputs)r.set(c.id,s.id)}let a=t.connections.reduce((s,c)=>{let u=i.get(c.fOutputId),h=r.get(c.fInputId);return!u||!h||s.push({source:u,target:h}),s},[]);return{nodes:o,connections:a,nodeIds:e,groupIds:n}}function Iy(t){return{id:t.id,size:t.measuredSize?ge({},t.measuredSize):t.size?ge({},t.size):void 0}}var e8=1,Ih=(()=>{class t{_destroyRef=p(xt);_flows=new Map;_engine;constructor(){this._destroyRef.onDestroy(()=>{Array.from(this._flows.keys()).forEach(e=>this.unregisterFlow(e)),this._engine=void 0})}attachEngine(e){this._engine=e}registerFlow(e,n){let i=e.fId();this.unregisterFlow(i);let r={flow:e,store:n,nodeSignature:this._buildNodeSignature(n),connectionSignature:this._buildConnectionSignature(n),timeoutId:null,raf1:null,raf2:null,unsubs:[],runId:0,isApplying:!1};r.unsubs.push(n.nodesChanges$.listen(()=>this._handleNodesChanges(i)),n.connectionsChanges$.listen(()=>this._handleConnectionsChanges(i))),this._flows.set(i,r),this._engine?.getMode()===oi.AUTO&&this._scheduleRelayout(i)}unregisterFlow(e){let n=this._flows.get(e);n&&(n.unsubs.forEach(i=>i()),this._clearScheduledWork(n),this._flows.delete(e))}handleModeChanged(e){if(e===oi.AUTO)for(let n of this._flows.keys())this._scheduleRelayout(n)}async relayout(e){if(this._engine){if(e){let n=this._flows.get(e);n&&await this._relayoutRegisteredFlow(e,n);return}for(let[n,i]of this._flows.entries())await this._relayoutRegisteredFlow(n,i)}}_handleNodesChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let i=this._buildNodeSignature(n.store);i!==n.nodeSignature&&(n.nodeSignature=i,this._scheduleRelayout(e))}_handleConnectionsChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let i=this._buildConnectionSignature(n.store);i!==n.connectionSignature&&(n.connectionSignature=i,this._scheduleRelayout(e))}_scheduleRelayout(e){let n=this._flows.get(e);!n||!this._engine||this._engine.getMode()!==oi.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},e8))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==oi.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let i=JV(n.flow.getState({measuredSize:!0})),r=++n.runId,a=await this._engine.calculate(i.nodes,i.connections,{flowId:e,mode:this._engine.getMode()}),s=this._flows.get(e);if(!(!s||s.runId!==r||!this._applyPositions(s.store,a.nodes).length)){s.isApplying=!0;try{s.flow.redraw(),this._emitWriteback(e,a.nodes,i.nodeIds,i.groupIds)}finally{queueMicrotask(()=>{let u=this._flows.get(e);u&&(u.isApplying=!1)})}}}_emitWriteback(e,n,i,r){let a=this._engine?.getWriteback();a&&a({flowId:e,nodes:n.filter(s=>i.has(s.id)),groups:n.filter(s=>r.has(s.id))})}_applyPositions(e,n){return n.filter(i=>{let r=e.nodes.get(i.id);return!r||U.isEqual(r._position,i.position)?!1:(r.position.set(ge({},i.position)),!0)})}_buildNodeSignature(e){return e.nodes.getAll().map(n=>n.fId()).sort().join("|")}_buildConnectionSignature(e){return e.connections.getAll().map(n=>`${n.fId()}:${n.fOutputId()}:${n.fInputId()}`).sort().join("|")}_runAfterNextPaint(e,n){if(this._cancelAnimationFrames(e),typeof requestAnimationFrame!="function"){n();return}e.raf1=requestAnimationFrame(()=>{e.raf1=null,e.raf2=requestAnimationFrame(()=>{e.raf2=null,n()})})}_clearScheduledWork(e){e.timeoutId!==null&&(clearTimeout(e.timeoutId),e.timeoutId=null),this._cancelAnimationFrames(e)}_cancelAnimationFrames(e){e.raf1!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf1),e.raf1=null),e.raf2!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf2),e.raf2=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),hC=new be("F_LAYOUT_OPTIONS");function fC(t,o){return t.reduce((e,n)=>{let i=o.get(n.id);return i&&e.push({id:n.id,position:i}),e},[])}var t8=new be("F_LAYOUT"),Qp=class{_controller=p(Ih);_config=p(hC,{optional:!0})??{};_interactiveOptions;_mode;_writeback;_defaultOptions;interactiveOptions;constructor(o){this._mode=this._config.mode??oi.MANUAL,this._writeback=this._config.writeback??null,this._defaultOptions=this.mergeOptions(o,this._config.options),this._interactiveOptions=X(this.mergeOptions(this._defaultOptions,{})),this.interactiveOptions=E(()=>this.mergeOptions(this._interactiveOptions(),{})),this._controller.attachEngine(this)}setMode(o){this._mode=o,this._controller.handleModeChanged(o)}getMode(){return this._mode}setWriteback(o){this._writeback=o}getWriteback(){return this._writeback}setInteractiveOptions(o){this._interactiveOptions.set(this.mergeOptions(this._interactiveOptions(),o))}relayout(o){return this._controller.relayout(o)}getProviderConfig(){return ge({},this._config)}resolveLayoutOptions(o){let e=ge({},o??{});return delete e.flowId,delete e.mode,this.mergeOptions(this._interactiveOptions(),e)}};function mC(t,o){return[Ih,t,{provide:t8,useExisting:t},{provide:hC,useValue:o??{}}]}var n8=(()=>{let t=class md{_store=p(L);_layoutController=p(Ih,{optional:!0});handle({instance:e}){this._store.fFlow=e,this._layoutController?.registerFlow(e,this._store)}static \u0275fac=function(n){return new(n||md)};static \u0275prov=y({token:md,factory:md.\u0275fac})};return t=P([R(Zp)],t),t})(),Jp=class{static fToken=Symbol("GetFlowRequest")},i8=(()=>{let t=class _d{_store=p(L);handle(e){let n=this._store.fFlow;if(!n)throw new Error("Flow not found in store");return n}static \u0275fac=function(n){return new(n||_d)};static \u0275prov=y({token:_d,factory:_d.\u0275fac})};return t=P([R(Jp)],t),t})(),eh=class{static fToken=Symbol("CalculateConnectionsStateRequest")},o8=(()=>{let t=class gd{_store=p(L);handle(e){return this._store.connections.getAll().map(this._mapToConnectionState)}_mapToConnectionState(e){return{id:e.fId(),fOutputId:e.fOutputId(),fInputId:e.fInputId(),fType:e.fType,fBehavior:e.fBehavior,isSelected:e.isSelected(),waypoints:e.fWaypoints()?.waypoints()||[],fInputSide:e.fInputSide(),fOutputSide:e.fOutputSide()}}static \u0275fac=function(n){return new(n||gd)};static \u0275prov=y({token:gd,factory:gd.\u0275fac})};return t=P([R(eh)],t),t})(),ia=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(o,e=!1){this.component=o,this.measuredSize=e}},r8=(()=>{let t=class bd{_store=p(L);_mediator=p(V);handle({component:e,measuredSize:n}){return this._store.nodes.getAll().filter(i=>i instanceof e).map(i=>{let r=n?this._mediator.execute(new it(i.hostElement)):null;return{id:i.fId(),parentId:i.fParentId()??void 0,position:ge({},i._position),size:i._size?ge({},i._size):void 0,measuredSize:r?{width:r.width,height:r.height}:void 0,rotate:i._rotate,fOutputs:this._getOutputs(i.hostElement),fInputs:this._getInputs(i.hostElement),isSelected:i.isSelected()}})}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}_getInputs(e){return this._store.inputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}static \u0275fac=function(n){return new(n||bd)};static \u0275prov=y({token:bd,factory:bd.\u0275fac})};return t=P([R(ia)],t),t})(),th=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(o=!1){this.measuredSize=o}},a8=(()=>{let t=class vd{_mediator=p(V);_store=p(L);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _canvasPosition(){return U.sum(this._transform.position,this._transform.scaledPosition)}handle({measuredSize:e}){return{position:this._canvasPosition,scale:this._canvas.transform.scale,nodes:this._mediator.execute(new ia(kh,e)),groups:this._mediator.execute(new ia(Km,e)),connections:this._mediator.execute(new eh)}}static \u0275fac=function(n){return new(n||vd)};static \u0275prov=y({token:vd,factory:vd.\u0275fac})};return t=P([R(th)],t),t})(),s8=[a8,r8,o8],nh=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(o){this.instance=o}},l8=(()=>{let t=class yd{_store=p(L);_layoutController=p(Ih,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||yd)};static \u0275prov=y({token:yd,factory:yd.\u0275fac})};return t=P([R(nh)],t),t})(),Eh=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ih=class{static fToken=Symbol("NotifyNodesRenderedRequest")},M_=new be("F_FLOW"),T_=class{},c8=(()=>{let t=class Cd{_state=p(Eh);_fFlow=p(M_);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||Cd)};static \u0275prov=y({token:Cd,factory:Cd.\u0275fac})};return t=P([R(ih)],t),t})(),oh=class{static fToken=Symbol("NotifyFullRenderedRequest")},d8=(()=>{let t=class xd{_state=p(Eh);_fFlow=p(M_);handle(e){this._state.isFullRendered||(this._state.isFullRendered=!0,this._fFlow.fFullRendered.emit(this._fFlow.fId()),this._fFlow.fLoaded.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||xd)};static \u0275prov=y({token:xd,factory:xd.\u0275fac})};return t=P([R(oh)],t),t})(),oa=class{targetConnectionsRevision;targetNodesRevision;callback;destroyRef;static fToken=Symbol("WaitForConnectionsRenderedRequest");constructor(o,e,n,i){this.targetConnectionsRevision=o,this.targetNodesRevision=e,this.callback=n,this.destroyRef=i}},u8=(()=>{let t=class wd{_store=p(L);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:i,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){i();return}let a=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(a(),i())});r.onDestroy(a)}static \u0275fac=function(n){return new(n||wd)};static \u0275prov=y({token:wd,factory:wd.\u0275fac})};return t=P([R(oa)],t),t})(),rh=class{static fToken=Symbol("ResetRenderLifecycleRequest")},p8=(()=>{let t=class Td{_state=p(Eh);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||Td)};static \u0275prov=y({token:Td,factory:Td.\u0275fac})};return t=P([R(rh)],t),t})(),ah=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(o){this.destroyRef=o}},_C=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),h8=(()=>{let t=class Sd{_state=p(_C);_store=p(L);_mediator=p(V);handle(e){if(this._state.pendingRedraw=!0,this._state.isWaitingForViewportAnimation)return;this._state.isWaitingForViewportAnimation=!0;let n=this._store.viewportAnimationChanges$.listen(()=>{if(this._store.isViewportAnimating)return;let i=this._state.pendingRedraw;n(),this._state.isWaitingForViewportAnimation=!1,this._state.pendingRedraw=!1,i&&this._mediator.execute(new Or)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||Sd)};static \u0275prov=y({token:Sd,factory:Sd.\u0275fac})};return t=P([R(ah)],t),t})(),f8=[n8,i8,...s8,l8,Eh,c8,d8,u8,p8,_C,h8],sh=class{static fToken=Symbol("ClearSelectionRequest")},m8=(()=>{let t=class kd{_dragContext=p(he);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||kd)};static \u0275prov=y({token:kd,factory:kd.\u0275fac})};return t=P([R(sh)],t),t})(),lh=class{static fToken=Symbol("CalculateSelectableItemsRequest")},_8=(()=>{let t=class Id{_mediator=p(V);_store=p(L);_dragContext=p(he);get _nodes(){return this._store.nodes.getAll()}get _connections(){return this._store.connections.getAll()}handle(){return[...this._nodeRects(),...this._connectionRects()].filter(e=>!this._dragContext.selectedItems.includes(e.element))}_nodeRects(){return this._nodes.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new it(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new it(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Id)};static \u0275prov=y({token:Id,factory:Id.\u0275fac})};return t=P([R(lh)],t),t})(),ra=class{static fToken=Symbol("GetCurrentSelectionRequest")},g8=(()=>{let t=class Ed{_dragContext=p(he);handle(){return{fNodeIds:this._getSelectedNodes(),fGroupIds:this._getSelectedGroups(),fConnectionIds:this._getSelectedConnections()}}_getSelectedNodes(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-node")).map(e=>e.hostElement.dataset.fNodeId)}_getSelectedGroups(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.dataset.fGroupId)}_getSelectedConnections(){return this._dragContext.selectedItems.filter(e=>!e.hostElement.classList.contains("f-node")&&!e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.id)}static \u0275fac=function(n){return new(n||Ed)};static \u0275prov=y({token:Ed,factory:Ed.\u0275fac})};return t=P([R(ra)],t),t})(),ch=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(o,e,n=!0){this.nodes=o,this.connections=e,this.isSelectedChanged=n}},b8=(()=>{let t=class Md{_dragContext=p(he);_store=p(L);handle(e){this._dragContext.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragContext.selectedItems=[],e.nodes.forEach(n=>{let i=this._store.nodes.get(n);i&&(i.markAsSelected(),this._dragContext.selectedItems.push(i))}),e.connections.forEach(n=>{let i=this._store.connections.get(n);i&&(i.markAsSelected(),this._dragContext.selectedItems.push(i))}),this._dragContext.isSelectedChanged=e.isSelectedChanged}static \u0275fac=function(n){return new(n||Md)};static \u0275prov=y({token:Md,factory:Md.\u0275fac})};return t=P([R(ch)],t),t})(),dh=class{static fToken=Symbol("SelectAllRequest")},v8=(()=>{let t=class Dd{_dragSession=p(he);_store=p(L);handle(e){this._dragSession.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragSession.selectedItems=[],this._store.nodes.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._store.connections.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._dragSession.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Dd)};static \u0275prov=y({token:Dd,factory:Dd.\u0275fac})};return t=P([R(dh)],t),t})(),Vo=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(o){this.nodeOrGroup=o}},uh=class{fItemsContainer;allElements;elementsThatShouldBeInFront;targetIndex;static fToken=Symbol("MoveFrontElementsBeforeTargetElementRequest");constructor(o,e,n,i){this.fItemsContainer=o,this.allElements=e,this.elementsThatShouldBeInFront=n,this.targetIndex=i}},y8=(()=>{let t=class Pd{handle(e){let n=[];for(let i=e.targetIndex+1;i<e.allElements.length;i++){let r=e.allElements[i];e.elementsThatShouldBeInFront.includes(r)||n.push(r)}n.forEach(i=>{e.fItemsContainer.removeChild(i),e.fItemsContainer.insertBefore(i,e.allElements[e.targetIndex])})}static \u0275fac=function(n){return new(n||Pd)};static \u0275prov=y({token:Pd,factory:Pd.\u0275fac})};return t=P([R(uh)],t),t})(),ji=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(o,e){this.item=o,this.itemContainer=e}},zo=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(o){this.nodeOrGroupId=o}},C8=(()=>{let t=class Rd{_store=p(L);handle({nodeOrGroupId:e}){return this._getChildrenNodes(e)}_getChildrenNodes(e,n=new Set){if(n.has(e))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e);n.add(e);let i=this._store.nodes.getAll().filter(r=>r.fParentId()===e);return i.reduce((r,a)=>r.concat(this._getChildrenNodes(a.fId(),n)),i)}static \u0275fac=function(n){return new(n||Rd)};static \u0275prov=y({token:Rd,factory:Rd.\u0275fac})};return t=P([R(zo)],t),t})(),x8=(()=>{let t=class Od{_store=p(L);_mediator=p(V);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _connectionsContainer(){return this._canvas.fConnectionsContainer().nativeElement}handle(e){switch(e.itemContainer){case this._groupsContainer:this._handleGroup(e);break;case this._nodesContainer:this._handleNode(e);break;case this._connectionsContainer:this._handleConnection(e);break;default:throw new Error("Unknown container")}}_handleGroup(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),i=this._getChildrenGroups(n);this._updateLayers(this._groupsContainer,e.item.hostElement,i);let r=this._getChildrenNodes(n);r.length&&this._updateLayers(this._nodesContainer,r[0],r)}_handleNode(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),i=this._getChildrenNodes(n);this._updateLayers(e.itemContainer,e.item.hostElement,i)}_handleConnection(e){this._updateLayers(e.itemContainer,e.item.hostElement,[])}_updateLayers(e,n,i){let r=Array.from(e.children),a=r.findIndex(s=>s===n);this._isAnythingNeedToBeMoved(r,a,i)&&this._mediator.execute(new uh(e,r,i,a))}_isAnythingNeedToBeMoved(e,n,i){for(let r=n+1;r<e.length;r++)if(!i.includes(e[r]))return!0;return!1}_getChildrenGroups(e){let n=Array.from(this._groupsContainer.children);return e.filter(i=>this._groupsContainer.contains(i)).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodes(e){let n=Array.from(this._nodesContainer.children);return e.filter(i=>this._nodesContainer.contains(i)).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodesAndGroups(e){return this._mediator.execute(new zo(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Od)};static \u0275prov=y({token:Od,factory:Od.\u0275fac})};return t=P([R(ji)],t),t})(),w8=(()=>{let t=class Fd{_dragSession=p(he);_mediator=p(V);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new ji(e,e.hostElement.parentElement))}_selectNodeIfNotSelected(e){e.fSelectionDisabled()||this._dragSession.selectedItems.includes(e)||(this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.isSelectedChanged=!0)}static \u0275fac=function(n){return new(n||Fd)};static \u0275prov=y({token:Fd,factory:Fd.\u0275fac})};return t=P([R(Vo)],t),t})(),T8=[m8,_8,g8,b8,v8,w8],ph=class{static fToken=Symbol("ResetZoomRequest")},S8=(()=>{let t=class Nd{_store=p(L);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||Nd)};static \u0275prov=y({token:Nd,factory:Nd.\u0275fac})};return t=P([R(ph)],t),t})(),hh=class{position;step;direction;animate;static fToken=Symbol("SetZoomRequest");constructor(o,e,n,i=!1){this.position=o,this.step=e,this.direction=n,this.animate=i}},k8=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),I8=new Set(["drag-canvas","selection-area"]),E8=(()=>{let t=class Ad{_mediator=p(V);_store=p(L);_dragContext=p(he,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(Xe.ZOOM)}get _isDragStarted(){return this._mediator.execute(new fi)}handle(e){if(!this._zoomComponent)return;let n=this._canvas.transform.scale,i=this._clamp(n+e.step*e.direction);if(i===n)return;let r=this._castPositionToFlow(e.position);if(this._isDragStarted){let a=this._getDragZoomMode();if(a==="blocked")return;a==="rebase"&&this._rebaseDragContext(r,i)}this._canvas.setScale(i,r),e.animate?this._canvas.redrawWithAnimation():this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}_clamp(e){return Math.max(this._zoomComponent?.minimum||1,Math.min(e,this._zoomComponent?.maximum||1))}_castPositionToFlow(e){return pe.fromPoint(e).elementTransform(this._flowHost)}_getDragZoomMode(){if(this._dragContext?.isEmpty())return"blocked";let e=!1;for(let n of this._dragContext?.draggableItems??[]){let i=n.getEvent().kind;if(k8.has(i)){e=!0;continue}if(!I8.has(i))return"blocked"}return e?"rebase":"direct"}_rebaseDragContext(e,n){if(!this._dragContext)return;let i=this._dragContext.onPointerDownScale;if(!i||i===n){this._dragContext.onPointerDownScale=n;return}let r=1/n-1/i;this._dragContext.onPointerDownPosition=pe.fromPoint(this._dragContext.onPointerDownPosition).add(pe.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||Ad)};static \u0275prov=y({token:Ad,factory:Ad.\u0275fac})};return t=P([R(hh)],t),t})(),M8=[S8,E8],fh=class{static fToken=Symbol("MinimapDrawNodesRequest")},D8=(()=>{let t=class Ld{_browser=p(at);_store=p(L);handle(e){let n=this._store.fFlow,i=this._store.fCanvas;return!n||!i?[]:this._store.nodes.getAll().map(a=>this._renderNode(a,n,i))}_renderNode(e,n,i){let r=ko("rect",this._browser);em(this._nodeRect(e,n,i),r);let a=e instanceof kh;return r.classList.add("f-component",a?"f-minimap-node":"f-minimap-group"),r.classList.add(...this._minimapClasses(e)),e.isSelected()&&r.classList.add("f-selected"),r}_nodeRect(e,n,i){let r=te.elementTransform(te.fromElement(e.hostElement),n.hostElement);return te.div(r,i.transform.scale)}_minimapClasses(e){let n=e.fMinimapClass();return Array.isArray(n)?n:[n]}static \u0275fac=function(n){return new(n||Ld)};static \u0275prov=y({token:Ld,factory:Ld.\u0275fac})};return t=P([R(fh)],t),t})(),mh=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(o,e){this.svg=o,this.minSize=e}},P8=(()=>{let t=class Bd{_mediator=p(V);_store=p(L);handle({svg:e,minSize:n}){let i=this._store.fFlow,r=this._store.fCanvas;if(!i||!r)return{scale:1,viewBox:te.initialize(0,0,0,0)};let a=this._contentRectInMinimapSpace(i,r,n),s=this._minimapRectInFlowSpace(e,i),c=this._viewportScale(a,s),u=this._viewportViewBox(a,s,c);return{scale:c,viewBox:u}}_contentRectInMinimapSpace(e,n,i){let r=this._nodesBoundingBox(),a=te.elementTransform(r,e.hostElement),s=te.div(a,n.transform.scale);return Kv(s,i)}_nodesBoundingBox(){return this._mediator.execute(new No)??te.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return te.elementTransform(te.fromElement(e),n.hostElement)}_viewportScale(e,n){let i=n.width||1,r=n.height||1;return Math.max(e.width/i,e.height/r)}_viewportViewBox(e,n,i){let r=this._viewportSize(n,i),a=e.x-(r.width-e.width)/2,s=e.y-(r.height-e.height)/2;return te.initialize(a,s,r.width,r.height)}_viewportSize(e,n){return Ot.initialize(e.width*n||0,e.height*n||0)}static \u0275fac=function(n){return new(n||Bd)};static \u0275prov=y({token:Bd,factory:Bd.\u0275fac})};return t=P([R(mh)],t),t})(),_h=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},R8=(()=>{let t=class Vd{_store=p(L);handle(e){let n=this._store.fFlow,i=this._store.fCanvas;if(!n||!i)return te.initialize();let r=te.div(te.fromElement(n.hostElement),i.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||Vd)};static \u0275prov=y({token:Vd,factory:Vd.\u0275fac})};return t=P([R(_h)],t),t})(),gh=class{element;scale;viewBox;constructor(o,e=1,n=te.initialize(0,0,0,0)){this.element=o,this.scale=e,this.viewBox=n}},O8=[D8,P8,R8],bh=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(o){this.position=o}},F8=(()=>{let t=class zd{_store=p(L);handle({position:e}){return qo(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||zd)};static \u0275prov=y({token:zd,factory:zd.\u0275fac})};return t=P([R(bh)],t),t})(),vh=class{static fToken=Symbol("SortNodeLayersRequest")},N8=(()=>{let t=class Hd{_store=p(L);_mediator=p(V);_browser=p(at);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _fNodeElements(){return Array.from(this._nodesContainer.children)}handle(e){this._getGroups().forEach(n=>{this._moveChildrenNodes(this._getSortedChildrenNodes(n))})}_getGroups(){return this._store.nodes.getAll().filter(e=>this._groupsContainer.contains(e.hostElement))}_getSortedChildrenNodes(e){let n=this._fNodeElements;return this._getChildrenNodes(e.fId()).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodes(e){return this._mediator.execute(new zo(e)).filter(n=>this._nodesContainer.contains(n.hostElement)).map(n=>n.hostElement)}_moveChildrenNodes(e){let n=this._browser.document.createDocumentFragment();e.forEach(i=>{n.appendChild(i)}),this._nodesContainer.appendChild(n)}static \u0275fac=function(n){return new(n||Hd)};static \u0275prov=y({token:Hd,factory:Hd.\u0275fac})};return t=P([R(vh)],t),t})(),aa=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(o){this.itemsContainer=o}},A8=(()=>{let t=class qd{_store=p(L);_browser=p(at);handle({itemsContainer:e}){let n=Array.from(e.children);if(n.length<2)return;let i=this._buildPositions(n),r=this._store.nodes.getAll().filter(c=>e.contains(c.hostElement));if(r.length<2||!r.some(c=>!!c.fParentId()))return;let a=this._buildChildrenByParentId(r),s=new Map;for(let c of r){let u=this._getSortedChildrenBeforeParent(e,i,c,a,s);u.length&&this._moveBeforeNextSibling(e,u,c.hostElement.nextElementSibling)}}_buildPositions(e){let n=new Map;for(let i=0;i<e.length;i++)n.set(e[i],i);return n}_getSortedChildrenBeforeParent(e,n,i,r,a){let s=n.get(i.hostElement);if(s===void 0)return[];let c=this._getDeepChildren(i.fId(),r,a);if(!c.length)return[];let u=[];for(let h of c){let g=h.hostElement;if(!e.contains(g))continue;let C=n.get(g);C===void 0||C>=s||u.push(g)}return u.sort((h,g)=>(n.get(h)??0)-(n.get(g)??0)),u}_buildChildrenByParentId(e){let n=new Map;for(let i of e){let r=i.fParentId();if(!r)continue;let a=n.get(r)??[];a.push(i),n.set(r,a)}return n}_getDeepChildren(e,n,i){let r=i.get(e);if(r)return r;let a=[],s=[...n.get(e)??[]],c=new Set([e]);for(;s.length;){let u=s.pop();if(!u)continue;let h=u.fId();if(c.has(h))continue;c.add(h),a.push(u);let g=n.get(h);g?.length&&s.push(...g)}return i.set(e,a),a}_moveBeforeNextSibling(e,n,i){let r=this._browser.document.createDocumentFragment();for(let a of n)r.appendChild(a);e.insertBefore(r,i)}static \u0275fac=function(n){return new(n||qd)};static \u0275prov=y({token:qd,factory:qd.\u0275fac})};return t=P([R(aa)],t),t})(),yh=class{static fToken=Symbol("SortItemLayersRequest")},L8=(()=>{let t=class Gd{_store=p(L);_mediator=p(V);get _canvas(){return this._store.fCanvas}handle(e){if(!this._canvas)return;let n=this._store.nodes.getAll();n.length<2||!n.some(i=>!!i.fParentId())||(this._mediator.execute(new aa(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new vh),this._mediator.execute(new aa(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||Gd)};static \u0275prov=y({token:Gd,factory:Gd.\u0275fac})};return t=P([R(yh)],t),t})();function ko(t,o){return o.document.createElementNS("http://www.w3.org/2000/svg",t)}function an(t,o){return o(t)}function gn(t){return!0}function B8(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var V8=[...r6,...hV,...KL,...QV,...OV,...f8,...$V,...T8,...M8,...O8,...b7,C8,v7,w7,F8,L8,A8,N8,x8,y8],z8=0,gC=(()=>{class t{_destroyRef=p(xt);_elementReference=p(Qe);_fBrowser=p(at);_stateChanges=new rn;get hostElement(){return this._elementReference.nativeElement}id=B(`f-pattern-${z8++}`);vColor=B("rgba(0,0,0,0.1)");hColor=B("rgba(0,0,0,0.1)");vSize=B(20,{transform:xe});hSize=B(20,{transform:xe});_transform=ni.default();_position=U.initialize();_size=Ot.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=ko("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=ko("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=ko("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new En(this._stateChanges).pipe(Ch()).listen(this._destroyRef,()=>this._redraw())}ngOnChanges(e){(e.vSize||e.hSize||e.vColor||e.hColor)&&this._refresh()}_redraw(){this._calculatePattern(),this._redrawPattern(),this._redrawLine(this._vLine,this.vColor(),this._size.width,0,this._size.width,this._size.height),this._redrawLine(this._hLine,this.hColor(),0,this._size.height,this._size.width,this._size.height)}_calculatePattern(){this._position.x=this._transform.position.x+this._transform.scaledPosition.x,this._position.y=this._transform.position.y+this._transform.scaledPosition.y,this._size=Ot.initialize(this.hSize()*this._transform.scale,this.vSize()*this._transform.scale)}_redrawPattern(){this._pattern.setAttribute("x",`${this._position.x}`),this._pattern.setAttribute("y",`${this._position.y}`),this._pattern.setAttribute("width",`${this._size.width}`),this._pattern.setAttribute("height",`${this._size.height}`)}_redrawLine(e,n,i,r,a,s){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${i}`),e.setAttribute("x2",`${a}`),e.setAttribute("y1",`${r}`),e.setAttribute("y2",`${s}`)}setTransform(e){this._transform=e,this._refresh()}_refresh(){this._stateChanges.notify()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=z({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,i){n&2&&O("id",i.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[ke([{provide:pm,useExisting:t}]),ro],decls:0,vars:0,template:function(n,i){},encapsulation:2,changeDetection:0})}return t})();var H8=new be("F_BACKGROUND"),q8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),bC=(()=>{class t extends q8{_mediator=p(V);fBackgroundPattern=Qa(pm);ngOnInit(){this._mediator.execute(new li(Xe.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new jd(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new ci(Xe.BACKGROUND))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-background"]],contentQueries:function(n,i,r){n&1&&Tf(r,i.fBackgroundPattern,pm,5),n&2&&jt()},hostAttrs:[1,"f-component","f-background"],features:[ke([{provide:H8,useExisting:t}]),Z],ngContentSelectors:CL,decls:2,vars:0,template:function(n,i){n&1&&(pn(),W(),se(0,"svg"),$e(1),fe())},styles:["[_nghost-%COMP%]{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})}return t})();var S_=class{position;scale;constructor(o,e){this.position=o,this.scale=e}},G8=new be("F_CANVAS"),j8=(()=>{class t{transform=ni.default();_fCanvasChange=new rn;destroyRef=p(xt);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new En(this._fCanvasChange).pipe(Ud(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new S_(U.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),sa=(()=>{class t extends j8{_mediator=p(V);_componentsStore=p(L);_elementReference=p(Qe);_injector=p(dt);_flowId;fCanvasChange=Ke();position=B(U.initialize(),{transform:U.castToPoint});scale=B(1,{transform:xe});debounceTime=B(0,{transform:xe});debounce=E(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=nt.required("fGroupsContainer");fNodesContainer=nt.required("fNodesContainer");fConnectionsContainer=nt.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new Jp).fId(),this._mediator.execute(new Wd(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){de(()=>{this._mediator.execute(new Xd(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){de(()=>{this._mediator.execute(new Zd(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new Sr(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=ni.toString(this.transform),this._mediator.execute(new si)}redrawWithAnimation(){this._mediator.execute(new Sr(this.transform)),this.hostElement.style.transition=`transform ${B8()?80:150}ms ease-in-out`,this.hostElement.style.transform=ni.toString(this.transform),Ey(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new Kd(e,n))})}fitToScreen(e=U.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new Yd(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new eu(e))})}getScale(){return this.transform.scale||1}setScale(e,n=U.initialize()){this._mediator.execute(new tu(e,n))}resetScale(){this._mediator.execute(new Jd)}ngOnDestroy(){this._mediator.execute(new Qd)}_afterRedraw(e){this._mediator.execute(new oa(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>ao(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-canvas"]],viewQuery:function(n,i){n&1&&hn(i.fGroupsContainer,xL,5)(i.fNodesContainer,wL,5)(i.fConnectionsContainer,TL,5),n&2&&jt(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[ke([{provide:G8,useExisting:t}]),Z],ngContentSelectors:kL,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,i){n&1&&(pn(SL),Ya(0),se(1,"div",null,0),$e(3),fe(),se(4,"div",3,1),$e(6,1),$e(7,2),$e(8,3),fe(),se(9,"div",null,2),$e(11,4),fe(),Xa())},styles:["[_nghost-%COMP%]{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}.f-canvas-dragging[_nghost-%COMP%], .canvas-dragging[_nghost-%COMP%]{transform:translateZ(0)}.f-connections-container[_ngcontent-%COMP%]{position:absolute;z-index:2}"],changeDetection:0})}return t})();var U8=0,vC=(()=>{class t extends e7{fId=B(`f-connection-${U8++}`,{alias:"fConnectionId"});fOutputId=B("",{transform:e=>Ro(e)||""});fInputId=B("",{transform:e=>Ro(e)||""});fRadius=8;fOffset=12;fBehavior=ri.FIXED;fType=wo.STRAIGHT;fSelectionDisabled=B(!1,{transform:j});fReassignableStart=B(!1,{transform:j});fDraggingDisabled=B(!1,{alias:"fReassignDisabled",transform:j});fInputSide=B(Ye.DEFAULT,{transform:e=>xo(e,"fInputSide",Ye)});fOutputSide=B(Ye.DEFAULT,{transform:e=>xo(e,"fOutputSide",Ye)});get boundingElement(){return this.fPath().hostElement}_mediator=p(V);ngOnInit(){this._mediator.execute(new iu(this))}ngOnChanges(){this._mediator.execute(new Ai)}ngOnDestroy(){this._mediator.execute(new Eu(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,i){n&2&&(O("id",i.fId()),ue("f-connection-selection-disabled",i.fSelectionDisabled())("f-connection-reassign-disabled",i.fDraggingDisabled()))},inputs:{fId:[1,"fConnectionId","fId"],fOutputId:[1,"fOutputId"],fInputId:[1,"fInputId"],fRadius:[2,"fRadius","fRadius",xe],fOffset:[2,"fOffset","fOffset",xe],fBehavior:[2,"fBehavior","fBehavior",e=>xo(e,"fBehavior",ri)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:xh,useExisting:t}]),Z,ro],ngContentSelectors:EL,decls:15,vars:6,consts:[["defs",""],["xmlns","http://www.w3.org/2000/svg"],[1,"f-connection-group"],["fConnectionGradientRenderer","",3,"fConnectionGradientRendererFor"],["fConnectionSelection",""],["f-connection-path","",3,"useGradient"],["f-connection-drag-handle-start","","r","8"],["f-connection-drag-handle-end","","r","8"]],template:function(n,i){if(n&1&&(pn(IL),W(),f(0,"svg",1),F(1,"defs",null,0),$e(3),f(4,"g",2),M(5,ML,1,1,":svg:linearGradient",3),F(6,"path",4),f(7,"g"),F(8,"path",5),M(9,DL,1,0,":svg:circle",6),F(10,"circle",7),_()()(),$e(11,1),$e(12,2),$e(13,3),M(14,PL,1,0)),n&2){let r;l(5),D((r=i.fGradient())?5:-1,r),l(),O("d",i.path),l(2),m("useGradient",!!i.fGradient()),O("d",i.path),l(),D(i.fReassignableStart()?9:-1),l(5),D(i.fContents().length?14:-1)}},dependencies:[Em,X6,Z6,j6,Y6],styles:["[_nghost-%COMP%]{pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{display:block;vertical-align:middle;overflow:visible!important;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%] .f-connection-group[_ngcontent-%COMP%]{pointer-events:all}[_nghost-%COMP%] .f-connection-content[_ngcontent-%COMP%]{pointer-events:all}"],changeDetection:0})}return t})();var $8=new be("F_MAGNETIC_LINES"),W8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})();var yC=(()=>{class t extends W8{threshold=B(10,{transform:xe,alias:"fAlignThreshold"});_mediator=p(V);ngOnInit(){this._mediator.execute(new li(Xe.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new ci(Xe.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:$8,useExisting:t}]),Z],decls:0,vars:0,template:function(n,i){},styles:[RL]})}return t})();var cm=(()=>{class t{fMinSize=B(1e3);_mediator=p(V);hostElement=p(Qe).nativeElement;model=new gh(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new mh(this.hostElement,this.fMinSize()));this.model=new gh(this.hostElement,e,n),Yv(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),dm=(()=>{class t{_mediator=p(V);_elementRef=p(Qe);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new fh).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),um=(()=>{class t{_mediator=p(V);hostElement=p(Qe).nativeElement;redraw(){em(this._mediator.execute(new _h),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),K8=new be("F_MINIMAP_BASE"),Y8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),CC=(()=>{class t extends Y8{_destroyRef=p(xt);_mediator=p(V);_browser=p(at);_store=p(L);_canvas=nt.required(dm);_flow=nt.required(cm);_minimapView=nt.required(um);fMinSize=B(1e3);fNodeRenderLimit=B(1500,{transform:xe});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new li(Xe.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new $d).pipe(Ch(),AL()).listen(this._destroyRef,()=>{this._redraw()})}_redraw(){if(this._browser.isBrowser()){if(this._isOverNodeRenderLimit()){this._canvas().clear();return}this._flow().redraw(),this._minimapView().redraw(),this._canvas().redraw()}}_isOverNodeRenderLimit(){let e=this.fNodeRenderLimit();return e>0&&this._store.nodes.size()>e}ngOnDestroy(){this._mediator.execute(new ci(Xe.MINIMAP))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-minimap"]],viewQuery:function(n,i){n&1&&hn(i._canvas,dm,5)(i._flow,cm,5)(i._minimapView,um,5),n&2&&jt(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[ke([{provide:K8,useExisting:t}]),Z],decls:3,vars:1,consts:[["fMinimapFlow","","width","100%","height","100%","fLockedContext","",3,"fMinSize"],["fMinimapCanvas",""],["fMinimapView","","x","0","y","0","width","100%","height","100%","stroke","none"]],template:function(n,i){n&1&&(W(),f(0,"svg",0),F(1,"g",1)(2,"rect",2),_()),n&2&&m("fMinSize",i.fMinSize())},dependencies:[cm,dm,um],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var X8=(()=>{class t{hostElement=p(Qe).nativeElement;initialize(){this.hostElement.style.display="none"}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),xC=(()=>{class t extends X8{_mediator=p(V);fTrigger=e=>e.shiftKey;ngOnInit(){this._mediator.execute(new li(Xe.SELECTION_AREA,this)),super.initialize()}ngOnDestroy(){this._mediator.execute(new ci(Xe.SELECTION_AREA))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-selection-area"]],hostAttrs:[1,"f-selection-area","f-component"],inputs:{fTrigger:"fTrigger"},features:[Z],decls:0,vars:0,template:function(n,i){},styles:["[_nghost-%COMP%]{position:absolute}"]})}return t})();var Z8=0,Q8=120,la=(()=>{class t extends T_{_destroyRef=p(xt);_mediator=p(V);_browser=p(at);_componentsStore=p(L);_cache=p(Mn);_injector=p(dt);fId=B(`f-flow-${Z8++}`,{alias:"fFlowId"});fCache=B(!1,{transform:j});hostElement=p(Qe).nativeElement;fNodesRendered=Ke();fFullRendered=Ke();fLoaded=Ke();ngOnInit(){this._mediator.execute(new Zp(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){de(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new En(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(Ch(),Ud(Q8),NL()).listen(this._destroyRef,()=>{this._mediator.execute(new fi)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new yh),this._mediator.execute(new ih),this._mediator.execute(new oa(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new oh),this._destroyRef)),this._mediator.execute(new Ai))})}_listenConnectionsChanges(){this._mediator.execute(new To).listen(this._destroyRef,()=>{if(!this._mediator.execute(new fi)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new ah(this._destroyRef));return}this._mediator.execute(new Or)}})}redraw(){this._mediator.execute(new Ai)}reset(){this._mediator.execute(new rh)}getNodesBoundingBox(){return this._mediator.execute(new Wp)}getSelection(){return this._mediator.execute(new ra)}getPositionInFlow(e){return this._mediator.execute(new bh(e))}getState(e){return this._mediator.execute(new th(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new To).pipe(ty()).listen(this._destroyRef,()=>{this._mediator.execute(new dh)})}select(e,n,i=!0){this._mediator.execute(new To).pipe(ty()).listen(this._destroyRef,()=>{this._mediator.execute(new ch(e,n,i))})}clearSelection(){this._mediator.execute(new sh)}ngOnDestroy(){this._mediator.execute(new nh(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,i){n&2&&O("id",i.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[ke([V,...jL,zy,Ho,...V8,he,...dV,{provide:M_,useExisting:t}]),Z],ngContentSelectors:FL,decls:7,vars:0,template:function(n,i){n&1&&(pn(OL),Ya(0),$e(1),$e(2,1),$e(3,2),$e(4,3),$e(5,4),$e(6,5),Xa())},styles:["[_nghost-%COMP%]{display:block;position:relative;width:100%;height:100%;overflow:hidden;pointer-events:all;-webkit-user-select:none;user-select:none;touch-action:none} .f-connection-content{position:absolute;left:0;top:0;inline-size:max-content;pointer-events:all;transform-origin:50% 50%} .f-node, .f-group{position:absolute!important;transform-origin:center;-webkit-user-select:none;user-select:none;pointer-events:all;left:0!important;top:0!important;box-sizing:border-box} .f-group{z-index:1} .f-connection-content{z-index:3} .f-node{z-index:4}.hidden[_ngcontent-%COMP%]{opacity:0}"],changeDetection:0})}return t})();var wC=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=p(Ka);_tpl=p(x0);_zone=p(Jt);_componentsStore=p(L,{optional:!0});_views=[];_rafId=null;_isProgressiveRenderActive=!1;ngOnChanges(e){e.fVirtualForOf&&(this._reset(),this._renderProgressively())}ngOnDestroy(){this._reset()}_reset(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._finishProgressiveRender(),this._vc.clear(),this._views.length=0}_renderProgressively(){let n=0;this._startProgressiveRender(),this._zone.runOutsideAngular(()=>{let i=()=>{let r=performance.now();for(;n<this.fVirtualForOf.length&&performance.now()-r<10;){let a=this.fVirtualForOf[n],s=this._vc.createEmbeddedView(this._tpl,{$implicit:a,index:n});this._views.push(s),n++}if(n<this.fVirtualForOf.length){this._rafId=requestAnimationFrame(i);return}this._rafId=null,this._finishProgressiveRender()};this._rafId=requestAnimationFrame(i)})}_startProgressiveRender(){this._isProgressiveRenderActive||(this._isProgressiveRenderActive=!0,this._componentsStore?.beginProgressiveRender())}_finishProgressiveRender(){this._isProgressiveRenderActive&&(this._isProgressiveRenderActive=!1,this._componentsStore?.endProgressiveRender())}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[ro]})}return t})();var bn=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(bn||{}),J8=new be("F_ZOOM"),k_=class{},ez=.1,tz=1,nz=.5,iz=60,oz=.5;function rz(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function az(t,o,e){return sz(t)?cz(o,e):lz(o,e)}function sz(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function lz(t,o){let e=Math.abs(t)/100,n=TC(e,ez,tz);return o*n}function cz(t,o){if(Math.abs(t)<nz)return 0;let e=Math.abs(t)/iz,n=TC(e,0,oz);return o*n}function TC(t,o,e){return Math.max(o,Math.min(e,t))}var ca=(()=>{class t extends k_{_mediator=p(V);_injector=p(dt);_store=p(L);_triggersListener=He.emptyListener();isEnabled=B(!1,{alias:"fZoom",transform:j});fWheelTrigger=gn;fDblClickTrigger=gn;minimum=.1;maximum=4;step=.1;dblClickStep=.5;get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}ngOnInit(){this._mediator.execute(new li(Xe.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){de(()=>{this.isEnabled(),tn(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,He.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,He.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!an(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let i=rz(e);if(i===0)return;let r=this._normalizeWheelStep(e,i);r!==0&&this.setZoom(U.initialize(e.clientX,e.clientY),r,this._calculateDirection(i),!1)};_normalizeWheelStep(e,n){return az(e,n,this.step)}_calculateDirection(e){return e>0?bn.ZOOM_OUT:bn.ZOOM_IN}_onDoubleClick=e=>{if(!an(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;TB(n)||n?.closest("[fLockedContext]")||this.setZoom(U.initialize(e.clientX,e.clientY),this.dblClickStep,bn.ZOOM_IN,!0)};_getToCenterPosition(e,n){return U.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(bn.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(bn.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,te.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,i,r){this._mediator.execute(new hh(e,n,i,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new ph)}_disposeListeners(){this._triggersListener(),this._triggersListener=He.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new ci(Xe.ZOOM))}_listen(e,n,i){this._flowHost.addEventListener(e,n,i)}_unlisten(e,n,i){this._flowHost.removeEventListener(e,n,i)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["f-canvas","fZoom",""]],hostAttrs:[1,"f-zoom","f-component"],inputs:{isEnabled:[1,"fZoom","isEnabled"],fWheelTrigger:"fWheelTrigger",fDblClickTrigger:"fDblClickTrigger",minimum:[2,"fZoomMinimum","minimum",xe],maximum:[2,"fZoomMaximum","maximum",xe],step:[2,"fZoomStep","step",xe],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",xe]},features:[ke([{provide:J8,useExisting:t}]),Z]})}return t})();var SC=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=_t({type:t});static \u0275inj=mt({imports:[gt]})}return t})();var sf=a3(xD(),1);var Ba=(function(t){return t.NETWORK_SIMPLEX="network-simplex",t.TIGHT_TREE="tight-tree",t.LONGEST_PATH="longest-path",t})(Ba||{}),Tre={direction:$i.TOP_BOTTOM,nodeGap:48,layerGap:64,algorithm:Ba.NETWORK_SIMPLEX,defaultNodeSize:Ot.initialize(120,72)},i0=(()=>{class t extends Qp{constructor(){super(Tre)}mergeOptions(e,n={}){return Dt(ge(ge({},e),n),{defaultNodeSize:n.defaultNodeSize?Ot.initialize(n.defaultNodeSize.width,n.defaultNodeSize.height):Ot.initialize(e.defaultNodeSize.width,e.defaultNodeSize.height)})}async calculate(e,n,i){let r=this.resolveLayoutOptions(i),a=this._buildGraph(e,n,r),s=new Map;return sf.layout(a),a.nodes().forEach(c=>{let u=a.node(c),h=e.find(C=>C.id===c);if(!u||!h)return;let g=h.size??r.defaultNodeSize;s.set(c,U.initialize(u.x-g.width/2,u.y-g.height/2))}),{nodes:fC(e,s)}}_buildGraph(e,n,i){let r=new sf.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:this._mapDirection(i.direction),nodesep:i.nodeGap,ranksep:i.layerGap,ranker:this._mapAlgorithm(i.algorithm)}),e.forEach(a=>{let s=a.size??i.defaultNodeSize;r.setNode(a.id,{width:s.width,height:s.height})}),n.forEach(a=>{!r.hasNode(a.source)||!r.hasNode(a.target)||r.setEdge(a.source,a.target,{})}),r}_mapAlgorithm(e){switch(e){case Ba.TIGHT_TREE:return"tight-tree";case Ba.LONGEST_PATH:return"longest-path";case Ba.NETWORK_SIMPLEX:default:return"network-simplex"}}_mapDirection(e){switch(e){case $i.BOTTOM_TOP:return"BT";case $i.LEFT_RIGHT:return"LR";case $i.RIGHT_LEFT:return"RL";case $i.TOP_BOTTOM:default:return"TB"}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var wi={loading:"Loading collection",errorTitle:"Failed to load",emptyTitle:"No nodes match the current filters.",resetFilters:"Reset filters",curationEmptyTitle:"Nothing from your map selection is visible right now.",showAllOnMap:"Show all on map",a11y:{toolbar:"Map controls",panel:"Selected node details"},toolbar:{zoomIn:"Zoom in",zoomOut:"Zoom out",fitToScreen:"Fit to screen",resetLayoutLabel:"Re-arrange layout",resetLayoutTooltip:"Re-arrange the visible nodes",showAllLabel:"Show all",showAllTooltip:"Clear the map selection and show every node again",showAllAria:"Show all nodes on the map",layoutAlgorithmLabel:"Layout algorithm",layoutAlgorithmTooltip:"Layout algorithm (balanced, stretched or organic)",layoutDirectionLabel:"Layout direction",layoutDirectionTooltip:"Layout direction (TB, BT, LR, RL)",layoutDirectionUnavailableTooltip:"Direction does not apply to the Organic layout. Switch to Balanced or Stretched to set it.",layoutSpacingLabel:"Layout spacing",layoutSpacingTooltip:"Layout spacing (compact, normal, spacious)",layoutSpacingUnavailableTooltip:"Spacing does not apply to the Organic layout. Switch to Balanced or Stretched to set it.",connectionTypeLabel:"Edge style",connectionTypeTooltip:"Edge style (orthogonal, straight, bezier or adaptive curve)"},layout:{algorithm:{options:{"network-simplex":{label:"Balanced"},"longest-path":{label:"Stretched"},force:{label:"Organic"}}},direction:{options:{TOP_BOTTOM:{label:"Top to bottom"},BOTTOM_TOP:{label:"Bottom to top"},LEFT_RIGHT:{label:"Left to right"},RIGHT_LEFT:{label:"Right to left"}}},spacing:{options:{compact:{label:"Compact"},normal:{label:"Normal"},spacious:{label:"Spacious"}}},connection:{options:{segment:{label:"Orthogonal"},straight:{label:"Straight"},bezier:{label:"Bezier"},"adaptive-curve":{label:"Adaptive curve"}}}},panel:{resizeLabel:"Resize panel"},resetLayoutConfirm:{header:"Re-arrange layout?",message:"This replaces every saved node position with a fresh automatic layout.",messageVisible:"This re-arranges the visible nodes and replaces their saved positions.",accept:"Re-arrange",reject:"Cancel"}};var lf={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0}};var Sre="adaptive-curve",a0=["segment","straight","bezier","adaptive-curve"],wD="sm.graph.connection-type",TD="sm.graph.layout-algorithm",SD="sm.graph.layout-direction",cf=(()=>{class t{_connectionType=X(o0(wD,kre,Sre));_layoutAlgorithm=X(o0(TD,yb,gb));_layoutDirection=X(o0(SD,Cb,bb));_layoutSpacing=X(vb);connectionType=this._connectionType.asReadonly();layoutAlgorithm=this._layoutAlgorithm.asReadonly();layoutDirection=this._layoutDirection.asReadonly();layoutSpacing=this._layoutSpacing.asReadonly();setConnectionType(e){this._connectionType()!==e&&(this._connectionType.set(e),r0(wD,e))}setLayoutAlgorithm(e){this._layoutAlgorithm()!==e&&(this._layoutAlgorithm.set(e),r0(TD,e))}setLayoutDirection(e){this._layoutDirection()!==e&&(this._layoutDirection.set(e),r0(SD,e))}static toFoblexEnum(e){return e}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function o0(t,o,e){let n=null;try{n=localStorage.getItem(t)}catch{return e}return n&&o(n)?n:e}function r0(t,o){try{localStorage.setItem(t,o)}catch{}}function kre(t){return typeof t=="string"&&a0.includes(t)}function kD(t,o){let e=new Set([o]);for(let n of t.get(o)??[])e.add(n);return e}var Ire={TOP_BOTTOM:{output:Ye.BOTTOM,input:Ye.TOP},BOTTOM_TOP:{output:Ye.TOP,input:Ye.BOTTOM},LEFT_RIGHT:{output:Ye.RIGHT,input:Ye.LEFT},RIGHT_LEFT:{output:Ye.LEFT,input:Ye.RIGHT}};function ID(t,o){return ds(t)?Ire[o]:{input:Ye.CALCULATE,output:Ye.CALCULATE}}var ED=`
2138
+ `.trim();function Uy(t){return!!$y(t)}function $y(t){let o=t,e=o?.Blob,n=o?.Worker,i=o?.URL;return!e||!n||typeof i?.createObjectURL!="function"||typeof i.revokeObjectURL!="function"?null:{blobCtor:e,workerCtor:n,urlApi:i}}function r7(t){let o=new t.blobCtor([o7],{type:"text/javascript"});return t.urlApi.createObjectURL(o)}function Wy(t,o){if(!t)return;let e=o??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var Ui=(()=>{class t{worker=null;workerUrl=null;nextRequestId=0;isDisabled=!1;pending=new Map;resetRuntime(e){this.pending.forEach(n=>n.reject(e)),this.pending.clear(),this.worker?.terminate(),this.worker=null,Wy(this.workerUrl),this.workerUrl=null}dispose(){this.resetRuntime(new Error("Connection worker was destroyed."))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),lu=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(o,e){this.connection=o,this.line=e}},a7=(()=>{let t=class $s{_mediator=p(V);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new Mo(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let i=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),a=this._renderCache.get(e);return a?.signature===r&&a.pathElement===i?!1:(this._renderCache.set(e,{signature:r,pathElement:i}),!0)}_createConnectionRenderSignature(e,n){let{sourceSide:i,targetSide:r}=e.getResolvedSides();return[e.fBehavior,e.fType,e.fRadius,e.fOffset,e.fReassignableStart(),this._serializeContents([...e.fContents()||[]]),i,r,this._serializePoint(n.point1),this._serializePoint(n.point2),this._serializeWaypoints(e.fWaypoints()?.waypoints()||[])].join("|")}_serializePoint(e){return`${e.x}:${e.y}`}_serializeWaypoints(e){return e.map(this._serializePoint).join(";")}_serializeContents(e){return e.map(n=>[n.position(),n.offset(),n.align()].join(":")).join(";")}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=y({token:$s,factory:$s.\u0275fac})};return t=P([R(lu)],t),t})(),cu=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(o,e){this.source=o,this.target=e}},s7=(()=>{let t=class Ws{_state=p(Th);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=y({token:Ws,factory:Ws.\u0275fac})};return t=P([R(cu)],t),t})(),di=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(o,e=!0){this.element=o,this.cache=e}},l7={enabled:!1},Mn=new be("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>ge({},l7)});var du=class{id;nodeId;kind;element;static fToken=Symbol("RegisterFCacheConnectorRequest");constructor(o,e,n,i){this.id=o,this.nodeId=e,this.kind=n,this.element=i}},Dn=(()=>{class t{nodeEntries=new Map;nodeIdByElement=new WeakMap;connectorEntries=new Map;connectorKeysByNodeId=new Map;connectorKeyByElement=new WeakMap;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Nm=class{key;id;kind;nodeId;element;rect;constructor(o,e,n,i,r,a){this.key=o,this.id=e,this.kind=n,this.nodeId=i,this.element=r,this.rect=a}},kr=class{static build(o,e){return`${o}:${e}`}},Am=class{id;element;reference;rect;constructor(o,e,n,i){this.id=o,this.element=e,this.reference=n,this.rect=i}},Do=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(o,e="manual"){this.nodeId=o,this.reason=e}},c7=(()=>{let t=class Ks{_store=p(Dn);_options=p(Mn);handle({nodeId:e,reason:n}){if(!this._options.enabled)return;let i=this._store.nodeEntries.get(e);if(!i)return;i.rect=void 0;let r=this._store.connectorKeysByNodeId.get(e);if(r?.size)for(let a of r){let s=this._store.connectorEntries.get(a);s&&(s.rect=void 0)}}static \u0275fac=function(n){return new(n||Ks)};static \u0275prov=y({token:Ks,factory:Ks.\u0275fac})};return t=P([R(Do)],t),t})(),uu=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(o,e,n){this.id=o,this.element=e,this.reference=n}},d7=(()=>{let t=class Ys{_store=p(Dn);_options=p(Mn);handle({id:e,element:n,reference:i}){if(!this._options.enabled)return;let r=new Am(e,n,i);this._store.nodeEntries.set(e,r),this._store.nodeIdByElement.set(n,e),this._store.connectorKeysByNodeId.set(e,this._store.connectorKeysByNodeId.get(e)??new Set)}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=y({token:Ys,factory:Ys.\u0275fac})};return t=P([R(uu)],t),t})(),pu=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(o){this.id=o}},u7=(()=>{let t=class Xs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({id:e}){if(!this._options.enabled)return;let n=this._store.nodeEntries.get(e);if(!n)return;this._store.nodeEntries.delete(e),this._store.nodeIdByElement.delete(n.element);let i=Array.from(this._store.connectorKeysByNodeId.get(e)??[]);for(let r of i){let a=this._store.connectorEntries.get(r);a&&this._mediator.execute(new Ir(a.id,a.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=y({token:Xs,factory:Xs.\u0275fac})};return t=P([R(pu)],t),t})(),p7=(()=>{let t=class Zs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({id:e,nodeId:n,kind:i,element:r}){if(!this._options.enabled)return;let a=kr.build(e,i),s=this._store.connectorEntries.get(a);s&&(this._detachConnectorFromNode(s.key,s.nodeId),this._store.connectorKeyByElement.delete(s.element));let c=new Nm(a,e,i,n,r);this._store.connectorEntries.set(a,c),this._store.connectorKeyByElement.set(r,a);let u=this._store.connectorKeysByNodeId.get(n)??new Set;u.add(a),this._store.connectorKeysByNodeId.set(n,u),this._mediator.execute(new Do(n,"connector-registered"))}_detachConnectorFromNode(e,n){let i=this._store.connectorKeysByNodeId.get(n);i&&(i.delete(e),i.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=y({token:Zs,factory:Zs.\u0275fac})};return t=P([R(du)],t),t})(),Ir=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(o,e){this.connectorId=o,this.kind=e}},h7=(()=>{let t=class Qs{_store=p(Dn);_mediator=p(V);_options=p(Mn);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let i=kr.build(e,n),r=this._store.connectorEntries.get(i);r&&(this._store.connectorEntries.delete(i),this._store.connectorKeyByElement.delete(r.element),this._detachConnectorFromNode(i,r.nodeId),this._store.nodeEntries.has(r.nodeId)&&this._mediator.execute(new Do(r.nodeId,"connector-unregistered")))}_detachConnectorFromNode(e,n){let i=this._store.connectorKeysByNodeId.get(n);i&&(i.delete(e),i.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Qs)};static \u0275prov=y({token:Qs,factory:Qs.\u0275fac})};return t=P([R(Ir)],t),t})(),Po=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(o){this.element=o}},f7=(()=>{let t=class Js{_store=p(Dn);_options=p(Mn);handle({element:e}){if(!this._options.enabled)return;let n=this._store.nodeIdByElement.get(e);if(n){let r=this._store.nodeEntries.get(n)?.rect;if(r)return r}let i=this._store.connectorKeyByElement.get(e);if(i)return this._store.connectorEntries.get(i)?.rect??void 0}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=y({token:Js,factory:Js.\u0275fac})};return t=P([R(Po)],t),t})(),Bi=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(o,e,n){this.connectorId=o,this.kind=e,this.rect=n}},m7=(()=>{let t=class el{_store=p(Dn);_options=p(Mn);handle({connectorId:e,kind:n,rect:i}){if(!this._options.enabled)return;let r=kr.build(e,n),a=this._store.connectorEntries.get(r);a&&(a.rect=rt.fromRoundedRect(i))}static \u0275fac=function(n){return new(n||el)};static \u0275prov=y({token:el,factory:el.\u0275fac})};return t=P([R(Bi)],t),t})(),Vi=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(o,e){this.nodeId=o,this.rect=e}},_7=(()=>{let t=class tl{_store=p(Dn);_options=p(Mn);handle({nodeId:e,rect:n}){if(!this._options.enabled)return;let i=this._store.nodeEntries.get(e);if(!i)return;let r=i.rect;i.rect=te.initialize(n.x,n.y,n.width,n.height),r&&this._updateConnectorRectsByNodeRect(e,r,i.rect)}_updateConnectorRectsByNodeRect(e,n,i){let r=this._store.connectorKeysByNodeId.get(e);if(!r?.size)return;let a=i.x-n.x,s=i.y-n.y,c=n.width!==0,u=n.height!==0,h=c?i.width/n.width:1,g=u?i.height/n.height:1;for(let C of r){let k=this._store.connectorEntries.get(C);if(!k?.rect)continue;let I=k.rect,N=I.gravityCenter,q=c?i.x+(N.x-n.x)*h:N.x+a,Y=u?i.y+(N.y-n.y)*g:N.y+s;k.rect=new rt(q-I.width/2,Y-I.height/2,I.width,I.height,I.radius1,I.radius2,I.radius3,I.radius4)}}static \u0275fac=function(n){return new(n||tl)};static \u0275prov=y({token:tl,factory:tl.\u0275fac})};return t=P([R(Vi)],t),t})(),Er=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(o,e){this.element=o,this.rect=e}},g7=(()=>{let t=class nl{_store=p(Dn);_options=p(Mn);handle({element:e,rect:n}){if(!this._options.enabled)return;let i=this._store.nodeIdByElement.get(e);if(i){let s=this._store.nodeEntries.get(i);s&&(s.rect=n);return}let r=this._store.connectorKeyByElement.get(e);if(!r)return;let a=this._store.connectorEntries.get(r);a&&(a.rect=n)}static \u0275fac=function(n){return new(n||nl)};static \u0275prov=y({token:nl,factory:nl.\u0275fac})};return t=P([R(Er)],t),t})(),b7=[Dn,d7,u7,c7,p7,h7,f7,_7,m7,g7];function qo(t,o,e){return o?pe.fromPoint(t).elementTransform(o).sub(e.scaledPosition).sub(e.position).div(e.scale):pe.fromPoint(t)}function Ky(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Ro(t){return t?`${t}`:void 0}var v7=(()=>{let t=class il{_store=p(L);_mediator=p(V);_browser=p(at);get _transform(){return this._store.transform}handle({element:e,cache:n}){let i=this._mediator.execute(new Po(e));if(i&&n)return i;let r=this._getElementRoundedRect(e),a=this._normalizePosition(r),s=this._unscaleSize(r),c=this._getUnscaledRect(a,s,r),u=this._getOffsetSize(e,s),h=rt.fromCenter(c,u.width,u.height);return this._mediator.execute(new Er(e,h)),h}_getElementRoundedRect(e){return this._getRoundedRect(te.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,i){let[r,a,s,c]=this._normalizeCircularBorderRadii(e.width,e.height,[this._getSystemRadius(i.borderTopLeftRadius,n,i.fontSize),this._getSystemRadius(i.borderTopRightRadius,n,i.fontSize),this._getSystemRadius(i.borderBottomRightRadius,n,i.fontSize),this._getSystemRadius(i.borderBottomLeftRadius,n,i.fontSize)]);return new rt(e.x,e.y,e.width,e.height,r,a,s,c)}_getComputedStyle(e){return this._browser.window.getComputedStyle(e)}_toPixels(e,n,i){return this._browser.toPixels(e,n.clientWidth,n.clientHeight,i)||0}_getSystemRadius(e,n,i){return this._toPixels(e,n,i)*this._transform.scale}_normalizeCircularBorderRadii(e,n,i){let[r,a,s,c]=i.map(h=>Math.max(0,h)),u=Math.min(1,this._getRadiusScaleFactor(e,r+a),this._getRadiusScaleFactor(n,a+s),this._getRadiusScaleFactor(e,s+c),this._getRadiusScaleFactor(n,c+r));return[r*u,a*u,s*u,c*u]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return qo(e,this._store.flowHost,this._transform)}_unscaleSize(e){return Ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n,i){return new rt(e.x,e.y,n.width,n.height,this._unscaleRadius(i.radius1),this._unscaleRadius(i.radius2),this._unscaleRadius(i.radius3),this._unscaleRadius(i.radius4))}_unscaleRadius(e){return e/this._transform.scale}_getOffsetSize(e,n){return Ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||il)};static \u0275prov=y({token:il,factory:il.\u0275fac})};return t=P([R(di)],t),t})(),hu=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(o,e){this.connector=o,this.cache=e}},y7=(()=>{let t=class ol{_mediator=p(V);handle({connector:e,cache:n}){let i=this._buildCacheKey(e),r=n.get(i)??this._calculateRect(e);return n.set(i,r),r}_buildCacheKey(e){return`${e.kind}::${e.fId()}`}_calculateRect(e){return this._mediator.execute(new di(e.hostElement))}static \u0275fac=function(n){return new(n||ol)};static \u0275prov=y({token:ol,factory:ol.\u0275fac})};return t=P([R(hu)],t),t})(),fu=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(o){this.connection=o}},C7=(()=>{let t=class rl{_store=p(L);handle({connection:e}){let n=this._store.outputs.get(e.fOutputId()),i=this._store.inputs.get(e.fInputId());return!n||!i?null:{source:n,target:i}}static \u0275fac=function(n){return new(n||rl)};static \u0275prov=y({token:rl,factory:rl.\u0275fac})};return t=P([R(fu)],t),t})(),Mr=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(o,e){this.connection=o,this.cache=e}},x7=(()=>{let t=class al{_mediator=p(V);handle({connection:e,cache:n}){let i=this._resolveConnectionEndpoints(e);return i?Dt(ge({},i),{sourceRect:this._resolveEndpointRect(i.source,n),targetRect:this._resolveEndpointRect(i.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new fu(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new hu(e,n))}static \u0275fac=function(n){return new(n||al)};static \u0275prov=y({token:al,factory:al.\u0275fac})};return t=P([R(Mr)],t),t})(),it=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(o){this.element=o}},w7=(()=>{let t=class sl{_store=p(L);_mediator=p(V);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new Po(e));if(n)return n;let i=te.fromElement(e),r=this._normalizePosition(i),a=this._unscaleSize(i),s=this._getUnscaledRect(r,a),c=this._getOffsetSize(e,a),u=this._fromCenter(s,c.width,c.height);return this._mediator.execute(new Er(e,u)),u}_fromCenter(e,n,i){return te.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-i/2,n,i)}_normalizePosition(e){return qo(e,this._store.flowHost,this._transform)}_unscaleSize(e){return Ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n){return new rt(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return Ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||sl)};static \u0275prov=y({token:sl,factory:sl.\u0275fac})};return t=P([R(it)],t),t})(),zn=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(o){this.connector=o}},T7=(()=>{let t=class ll{_store=p(L);_mediator=p(V);handle({connector:e}){if(!e)return;let n=this._store.nodes.get(e.fNodeId);if(!n||!n._rotate)return;let i=this._mediator.execute(new it(n.hostElement));return{rotationDeg:n._rotate,pivot:i.gravityCenter}}static \u0275fac=function(n){return new(n||ll)};static \u0275prov=y({token:ll,factory:ll.\u0275fac})};return t=P([R(zn)],t),t})(),mu=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(o,e){this.connection=o,this.geometry=e}},S7=(()=>{let t=class cl{_mediator=p(V);_connectionBehaviour=p(Ho);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new vn(n.sourceRect,n.targetRect,e,n.source.fConnectableSide,n.target.fConnectableSide,this._resolveRotationContext(n.source),this._resolveRotationContext(n.target)))}_resolveRotationContext(e){return this._mediator.execute(new zn(e))}static \u0275fac=function(n){return new(n||cl)};static \u0275prov=y({token:cl,factory:cl.\u0275fac})};return t=P([R(mu)],t),t})(),Dr=class{connection;source;target;line;static fToken=Symbol("RenderConnectionWithLineRequest");constructor(o,e,n,i){this.connection=o,this.source=e,this.target=n,this.line=i}},k7=(()=>{let t=class dl{_mediator=p(V);handle({connection:e,source:n,target:i,line:r}){this._mediator.execute(new cu(n,i)),this._mediator.execute(new lu(e,r))}static \u0275fac=function(n){return new(n||dl)};static \u0275prov=y({token:dl,factory:dl.\u0275fac})};return t=P([R(Dr)],t),t})(),Pr=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(o,e){this.connection=o,this.geometry=e}},I7=(()=>{let t=class ul{_mediator=p(V);handle({connection:e,geometry:n}){let i=this._mediator.execute(new mu(e,n));this._mediator.execute(new Dr(e,n.source,n.target,i))}static \u0275fac=function(n){return new(n||ul)};static \u0275prov=y({token:ul,factory:ul.\u0275fac})};return t=P([R(Pr)],t),t})(),_u=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(o,e){this.connection=o,this.cache=e}},E7=(()=>{let t=class pl{_mediator=p(V);handle({connection:e,cache:n}){let i=this._mediator.execute(new Mr(e,n));i&&this._mediator.execute(new Pr(e,i))}static \u0275fac=function(n){return new(n||pl)};static \u0275prov=y({token:pl,factory:pl.\u0275fac})};return t=P([R(_u)],t),t})(),zi=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(o){this.session=o}},M7=(()=>{let t=class hl{_store=p(L);_state=p(Th);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||hl)};static \u0275prov=y({token:hl,factory:hl.\u0275fac})};return t=P([R(zi)],t),t})(),Rr=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(o){this.session=o}},D7=(()=>{let t=class fl{_mediator=p(V);_store=p(L);handle({session:e}){this._mediator.execute(new zi(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||fl)};static \u0275prov=y({token:fl,factory:fl.\u0275fac})};return t=P([R(Rr)],t),t})(),gu=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(o,e){this.batchItem=o,this.result=e}},P7=(()=>{let t=class ml{_mediator=p(V);handle({batchItem:e,result:n}){if(e){if(!this._isSupportedWorkerResult(n)){this._fallbackToMainThread(e);return}try{e.connection._applyResolvedSidesToConnection(n.sourceSide,n.targetSide),this._mediator.execute(new Dr(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new Pr(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||ml)};static \u0275prov=y({token:ml,factory:ml.\u0275fac})};return t=P([R(gu)],t),t})(),ai=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(o,e,n,i,r,a){this.connections=o,this.cache=e,this.startIndex=n,this.session=i,this.batchItems=r,this.workerResults=a}},R7=500,O7=6,F7=(()=>{let t=class _l{_mediator=p(V);_browser=p(at);handle({connections:e,cache:n,startIndex:i,session:r,batchItems:a,workerResults:s}){if(!this._isCurrent(r))return;let c=this._now(),u=i,h=0;for(;u<e.length&&h<R7&&this._isWithinSliceBudget(c);){let g=e[u];if(a?this._mediator.execute(new gu(a[u]??null,s?.[u])):this._mediator.execute(new _u(g,n)),u++,h++,!this._isCurrent(r))return}if(u>=e.length){this._mediator.execute(new Rr(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new ai(e,n,u,r,a,s)))}_isCurrent(e){return this._mediator.execute(new zi(e))}_requestAnimationFrame(e){let n=this._browser.document.defaultView;if(!n){e();return}n.requestAnimationFrame(e)}_now(){let e=this._browser.document.defaultView?.performance;return e?e.now():Date.now()}_isWithinSliceBudget(e){return this._browser.isBrowser()?this._now()-e<O7:!0}static \u0275fac=function(n){return new(n||_l)};static \u0275prov=y({token:_l,factory:_l.\u0275fac})};return t=P([R(ai)],t),t})(),bu=class{static fToken=Symbol("StartConnectionRedrawRequest")},N7=(()=>{let t=class gl{_store=p(L);_state=p(Th);handle(e){return this._state.resetConnectedConnectors(),{renderTicket:this._state.beginRender(),connectionsRevision:this._store.connectionsRevision,nodesRevision:this._store.nodesRevision}}static \u0275fac=function(n){return new(n||gl)};static \u0275prov=y({token:gl,factory:gl.\u0275fac})};return t=P([R(bu)],t),t})(),Or=class{static fToken=Symbol("RedrawConnectionsRequest")},vu=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(o){this.connectionCount=o}},Fr=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},A7=(()=>{let t=class bl{_browser=p(at);_state=p(Ui);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return Uy(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||bl)};static \u0275prov=y({token:bl,factory:bl.\u0275fac})};return t=P([R(Fr)],t),t})(),L7=(()=>{let t=class vl{_mediator=p(V);handle({connectionCount:e}){return e>0&&this._mediator.execute(new Fr)}static \u0275fac=function(n){return new(n||vl)};static \u0275prov=y({token:vl,factory:vl.\u0275fac})};return t=P([R(vu)],t),t})(),yu=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(o,e,n){this.connection=o,this.geometry=e,this.originalIndex=n}},B7=(()=>{let t=class yl{_store=p(L);handle({connection:e,geometry:n,originalIndex:i}){let{source:r,target:a,sourceRect:s,targetRect:c}=n;return{originalIndex:i,behavior:e.fBehavior,outputSide:e.fOutputSide(),inputSide:e.fInputSide(),sourceConnectableSide:r.fConnectableSide,targetConnectableSide:a.fConnectableSide,sourceRotation:this._store.nodes.get(r.fNodeId)?._rotate||0,targetRotation:this._store.nodes.get(a.fNodeId)?._rotate||0,sourceRect:{x:s.x,y:s.y,width:s.width,height:s.height,radius1:s.radius1,radius2:s.radius2,radius3:s.radius3,radius4:s.radius4},targetRect:{x:c.x,y:c.y,width:c.width,height:c.height,radius1:c.radius1,radius2:c.radius2,radius3:c.radius3,radius4:c.radius4}}}static \u0275fac=function(n){return new(n||yl)};static \u0275prov=y({token:yl,factory:yl.\u0275fac})};return t=P([R(yu)],t),t})(),Cu=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(o,e){this.connections=o,this.cache=e}},V7=(()=>{let t=class Cl{_mediator=p(V);handle({connections:e,cache:n}){let i=new Array(e.length),r=[];for(let a=0;a<e.length;a++){let s=this._buildBatchItem(e[a],n,a);i[a]=s,s&&r.push(s.payload)}return{items:i,payload:r}}_buildBatchItem(e,n,i){let r=this._mediator.execute(new Mr(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new yu(e,r,i))}:null}static \u0275fac=function(n){return new(n||Cl)};static \u0275prov=y({token:Cl,factory:Cl.\u0275fac})};return t=P([R(Cu)],t),t})(),xu=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(o){this.error=o}},Nr=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(o){this.error=o}},z7=(()=>{let t=class xl{_state=p(Ui);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||xl)};static \u0275prov=y({token:xl,factory:xl.\u0275fac})};return t=P([R(Nr)],t),t})(),H7=(()=>{let t=class wl{_state=p(Ui);_mediator=p(V);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new Nr(e))}static \u0275fac=function(n){return new(n||wl)};static \u0275prov=y({token:wl,factory:wl.\u0275fac})};return t=P([R(xu)],t),t})(),wu=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(o){this.message=o}},q7=(()=>{let t=class Tl{_state=p(Ui);handle({message:e}){if(!e||typeof e.requestId!="number")return;let n=this._state.pending.get(e.requestId);if(n){if(this._state.pending.delete(e.requestId),e.error){n.reject(new Error(e.error));return}n.resolve(e.results??[])}}static \u0275fac=function(n){return new(n||Tl)};static \u0275prov=y({token:Tl,factory:Tl.\u0275fac})};return t=P([R(wu)],t),t})(),Tu=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},G7=(()=>{let t=class Sl{_browser=p(at);_state=p(Ui);_mediator=p(V);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!Uy(n))return null;let i=$y(n);if(!i)return null;let r=r7(i);try{let a=new i.workerCtor(r,{name:"f-flow-connection-worker"});return a.onmessage=s=>{this._mediator.execute(new wu(s.data))},a.onerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker runtime error."))},a.onmessageerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker message deserialization error."))},this._state.workerUrl=r,this._state.worker=a,a}catch(a){return Wy(r,i.urlApi),this._disableWorker(a instanceof Error?a:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new xu(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new Nr(e))}static \u0275fac=function(n){return new(n||Sl)};static \u0275prov=y({token:Sl,factory:Sl.\u0275fac})};return t=P([R(Tu)],t),t})(),Su=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(o){this.payload=o}},j7=(()=>{let t=class kl{_state=p(Ui);_mediator=p(V);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new Fr))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new Tu);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let i=++this._state.nextRequestId;return new Promise((r,a)=>{this._state.pending.set(i,{resolve:r,reject:a});try{n.postMessage({requestId:i,items:e})}catch(s){this._state.pending.delete(i),a(s instanceof Error?s:new Error("Unknown error while posting message to connection worker."))}})}_interruptPendingRequests(){if(!this._state.pending.size)return;let e=new Error("Connection worker request was superseded by a newer redraw.");this._state.pending.forEach(n=>n.reject(e)),this._state.pending.clear()}static \u0275fac=function(n){return new(n||kl)};static \u0275prov=y({token:kl,factory:kl.\u0275fac})};return t=P([R(Su)],t),t})(),ku=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(o){this.batch=o}},U7=(()=>{let t=class Il{_mediator=p(V);handle({batch:e}){return e.payload.length?this._mediator.execute(new Su(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Il)};static \u0275prov=y({token:Il,factory:Il.\u0275fac})};return t=P([R(ku)],t),t})(),Iu=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(o,e,n){this.connections=o,this.cache=e,this.session=n}},$7=(()=>{let t=class El{_mediator=p(V);handle({connections:e,cache:n,session:i}){let r=this._mediator.execute(new Cu(e,n));if(!r.payload.length){this._mediator.execute(new ai(e,n,0,i,r.items));return}this._mediator.execute(new ku(r)).then(a=>{this._mediator.execute(new zi(i))&&this._mediator.execute(new ai(e,n,0,i,r.items,this._alignWorkerResults(a,e.length)))}).catch(()=>{this._mediator.execute(new zi(i))&&this._mediator.execute(new ai(e,n,0,i,r.items))})}_alignWorkerResults(e,n){let i=new Array(n);for(let r of e){let a=r.originalIndex;a<0||a>=n||(i[a]=r)}return i}static \u0275fac=function(n){return new(n||El)};static \u0275prov=y({token:El,factory:El.\u0275fac})};return t=P([R(Iu)],t),t})(),W7=(()=>{let t=class Ml{_mediator=p(V);_store=p(L);handle(e){let n=this._mediator.execute(new bu);this._createMarkersForCreate(),this._createMarkersForSnap();let i=[...this._store.connections.getAll()],r=new Map;if(!i.length){this._mediator.execute(new Rr(n));return}this._shouldUseConnectionWorker(i.length)?this._redrawUsingWorker(i,r,n):this._redrawWithoutWorker(i,r,n)}_createMarkersForCreate(){let e=this._store.connections.getForCreate();e&&this._mediator.execute(new Mo(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new Mo(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new vu(e))}_redrawUsingWorker(e,n,i){this._mediator.execute(new Iu(e,n,i))}_redrawWithoutWorker(e,n,i){this._mediator.execute(new ai(e,n,0,i))}static \u0275fac=function(n){return new(n||Ml)};static \u0275prov=y({token:Ml,factory:Ml.\u0275fac})};return t=P([R(Or)],t),t})(),Lm=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},K7=(()=>{let t=class Dl{_store=p(L);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||Dl)};static \u0275prov=y({token:Dl,factory:Dl.\u0275fac})};return t=P([R(Lm)],t),t})(),Eu=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(o){this.connection=o}},Y7=(()=>{let t=class Pl{_store=p(L);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Pl)};static \u0275prov=y({token:Pl,factory:Pl.\u0275fac})};return t=P([R(Eu)],t),t})(),Mu=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(o){this.instance=o}},X7=(()=>{let t=class Rl{_store=p(L);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Rl)};static \u0275prov=y({token:Rl,factory:Rl.\u0275fac})};return t=P([R(Mu)],t),t})(),Bm=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(o,e){this.waypointIndex=o,this.connectionId=e}},Du=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},Z7=(()=>{let t=class Ol{_store=p(L);_dragSession=p(he);handle(e){this._store.flowHost.classList.remove(ht.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Ol)};static \u0275prov=y({token:Ol,factory:Ol.\u0275fac})};return t=P([R(Du)],t),t})(),Pu=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},Q7=(()=>{let t=class Fl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(ht.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new Ar),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Lu(e.kind,e.data?ge({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||Fl)};static \u0275prov=y({token:Fl,factory:Fl.\u0275fac})};return t=P([R(Pu)],t),t})(),Ar=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},Hi=class{_event;_target;get originalEvent(){return this._event}get targetElement(){return this._target||this.originalEvent.target}get touchEvent(){return this._event}get touches(){return this.touchEvent.touches}constructor(o,e){this._event=o,this._target=e}setTarget(o){this._target=o}preventDefault(){this.originalEvent.preventDefault()}get isEventInLockedContext(){return this.targetElement.closest("[fLockedContext]")!==null}},Ru=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){return this.originalEvent.button===0}isMouseRightButton(){return this.originalEvent.buttons===2}getPosition(){return{x:this.originalEvent.clientX,y:this.originalEvent.clientY}}},Vm=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){let o=this.originalEvent;return o.pointerType==="mouse"&&o.button===0||o.pointerType==="touch"}isMouseRightButton(){let o=this.originalEvent;return o.pointerType==="mouse"&&o.button===2||o.pointerType==="touch"}getPosition(){let o=this.originalEvent;return{x:o.clientX,y:o.clientY}}getPointerType(){return this.originalEvent.pointerType}getPointerId(){return this.originalEvent.pointerId}},zm=class extends Hi{constructor(o){super(o)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let o=this.originalEvent.touches;return{x:o[0].clientX,y:o[0].clientY}}},Hm=class extends Hi{constructor(o,e){super(o,e)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let o=this.originalEvent.targetTouches[0];return{x:o.clientX,y:o.clientY}}},He=(()=>{class t{static _isSupported;static _isPassiveEventListenerSupported(){if(t._isSupported==null&&typeof window<"u")try{window.addEventListener("test",t.emptyListener,{passive:!0}),t._isSupported=!0}catch{t._isSupported=!1}return t._isSupported}static _passiveEventListener(e){return t._isPassiveEventListenerSupported()?e:!!e.capture}static activeListener(){return t._passiveEventListener({passive:!1})}static passiveListener(){return t._passiveEventListener({passive:!0})}static activeCaptureListener(){return t._passiveEventListener({passive:!1,capture:!0})}static emptyListener(){return()=>{}}}return t})(),J7=800,qm=class{_document=p(Ua);_ngZone=p(Jt,{optional:!0});_mouseListeners=He.emptyListener();_touchListeners=He.emptyListener();_startListeners=He.emptyListener();isSyntheticEvent(o){return!!this._lastTouchEventTime&&this._lastTouchEventTime+J7>Date.now()}_lastTouchEventTime=0;isDragStarted=!1;_dragStartThreshold=3;_dragStartDelay=0;_dragStartTime=0;_dragStartPosition={x:0,y:0};_moveHandler=this._checkDragSequenceToStart;_pointerDownElement=null;_onMouseDown=o=>{let e=this.isSyntheticEvent(o),n=tB(o),i=new Ru(o);if(e||n||this.disabled||this.isDragStarted)return;this._pointerDownElement=i.targetElement,this.onPointerDown(i)&&(this._dragStartTime=Date.now(),this._dragStartPosition=i.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,He.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,He.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,He.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,He.activeCaptureListener())})};_onTouchDown=o=>{let e=nB(o),n=new zm(o);if(e||this.disabled||this.isDragStarted)return;this._pointerDownElement=n.targetElement,this.onPointerDown(n)&&(this._dragStartTime=Date.now(),this._dragStartPosition=n.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,He.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,He.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,He.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,He.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,He.activeCaptureListener())})};_onSelectStart=o=>{this.onSelect(o)};_onMouseMove=o=>{this._moveHandler(new Ru(o))};_onTouchMove=o=>{this._moveHandler(new Hm(o))};_checkDragSequenceToStart(o){let e=o.getPosition();if(!this.isDragStarted&&this._pointerDownElement){o.setTarget(this._pointerDownElement);let n=Math.abs(e.x-this._dragStartPosition.x),i=Math.abs(e.y-this._dragStartPosition.y);if(n+i>=this._dragStartThreshold){if(!(Date.now()>=this._dragStartTime+this._dragStartDelay)){this._endDragSequence();return}o.preventDefault(),this.prepareDragSequence(o),this.isDragStarted=!0,this._moveHandler=this.onPointerMove,eB(o.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=o=>{this.isDragStarted&&this.onPointerUp(new Vm(o)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=He.emptyListener(),this._touchListeners(),this._touchListeners=He.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,He.activeListener()),this._listen("touchstart",this._onTouchDown,He.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,He.activeListener()),this._unlisten("touchstart",this._onTouchDown,He.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=He.emptyListener(),this._touchListeners(),this._touchListeners=He.emptyListener(),this._mouseListeners(),this._mouseListeners=He.emptyListener()}_listen(o,e,n){this._document.addEventListener(o,e,n)}_unlisten(o,e,n){this._document.removeEventListener(o,e,n)}_preventDuringDrag=o=>{this.isDragStarted&&o.preventDefault()}};function eB(t){return t.type[0]==="t"}function tB(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function nB(t){let o=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0];return!!o&&o.identifier===-1&&(o.radiusX==null||o.radiusX===1)&&(o.radiusY==null||o.radiusY===1)}var Gm=class extends Hi{_position;_isMouseLeftButton;_isMouseRightButton;constructor(o){super(o.originalEvent,o.targetElement),this._position=o.getPosition(),this._isMouseLeftButton=o.isMouseLeftButton(),this._isMouseRightButton=o.isMouseRightButton()}isMouseLeftButton(){return this._isMouseLeftButton}isMouseRightButton(){return this._isMouseRightButton}getPosition(){return ge({},this._position)}};function iB(t){return new Gm(t)}var he=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new pe(0,0);draggableItems=[];autoPanFrameId=null;lastPointerEvent=null;lastPointerPosition=null;isAutoPanCanvasMoved=!1;reset(){for(let e of this.draggableItems)try{e.destroy?.()}catch{console.error(`Error while destroying drag handler of type ${e.type}`)}this.draggableItems=[],this.onPointerDownScale=1,this.onPointerDownPosition=new pe(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=iB(e),this.lastPointerPosition=this.lastPointerEvent.getPosition()}isEmpty(){return!this.draggableItems.length}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jm=class{nodeIds;groupIds;connectionIds;get fNodeIds(){return this.nodeIds}get fGroupIds(){return this.groupIds}get fConnectionIds(){return this.connectionIds}constructor(o,e,n){this.nodeIds=o,this.groupIds=e,this.connectionIds=n}},oB=(()=>{let t=class Nl{_mediator=p(V);_store=p(L);_dragSession=p(he);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new si))}_getSelection(){return this._mediator.execute(new ra)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new jm(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||Nl)};static \u0275prov=y({token:Nl,factory:Nl.\u0275fac})};return t=P([R(Ar)],t),t})(),Um=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(o){this.nodeOrGroup=o}},rB=(()=>{let t=class Al{_store=p(L);_mediator=p(V);handle({nodeOrGroup:e}){let n=te.initialize(-1/0,-1/0,1/0,1/0),i=this._getNode(e.fParentId());return i&&(n=this._getParentRect(i)),n}_getNode(e){return this._store.nodes.get(e)}_getParentRect(e){let n=this._getNodeRect(e),i=this._getNodePadding(e,n);return te.initialize(n.x+i[0],n.y+i[1],n.width-i[0]-i[2],n.height-i[1]-i[3])}_getNodeRect(e){return this._mediator.execute(new it(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new Gi(e,n))}static \u0275fac=function(n){return new(n||Al)};static \u0275prov=y({token:Al,factory:Al.\u0275fac})};return t=P([R(Um)],t),t})(),$m=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(o,e){this.fParentNodes=o,this.fDraggedNodes=e}},aB=(()=>{let t=class Ll{handle(e){return this._isParentNodeInArray(this._getParentNodeIds(e.fParentNodes),e.fDraggedNodes)}_getParentNodeIds(e){return e.map(n=>n.fId())}_isParentNodeInArray(e,n){return n.some(i=>e.includes(i.fId()))}static \u0275fac=function(n){return new(n||Ll)};static \u0275prov=y({token:Ll,factory:Ll.\u0275fac})};return t=P([R($m)],t),t})(),Wm=class{fNodeId;fConnectionIds;constructor(o,e){this.fNodeId=o,this.fConnectionIds=e}},Ou=class extends Wm{nodeId;connectionIds;constructor(o,e){super(o,e),this.nodeId=o,this.connectionIds=e}},Fu=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(o){this.nodeOrGroup=o}},sB=(()=>{let t=class Bl{_mediator=p(V);_store=p(L);handle({nodeOrGroup:e}){let n=this._collectConnectableConnectorIds(e,"source"),i=this._collectConnectableConnectorIds(e,"target");if(!n.size||!i.size)return;let r=this._collectAttachedConnectionIds(n,i),a=this._collectConnectionsUnderNode(e),s=[];for(let c of a){let u=c.fId();r.has(u)||s.push(u)}s.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Ou(e.fId(),s)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Ou(e.fId(),s)))}_collectConnectableConnectorIds(e,n){let i=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let a of i)a.canBeConnected&&e.isContains(a.hostElement)&&r.add(a.fId());return r}_collectAttachedConnectionIds(e,n){let i=new Set;for(let r of this._store.connections.getAll())(e.has(r.fOutputId())||n.has(r.fInputId()))&&i.add(r.fId());return i}_collectConnectionsUnderNode(e){let n=this._mediator.execute(new di(e.hostElement,!1)),i=[];for(let r of this._store.connections.getAll())this._hasIntersection(r,n)&&i.push(r);return i}_hasIntersection(e,n){return Co.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||Bl)};static \u0275prov=y({token:Bl,factory:Bl.\u0275fac})};return t=P([R(Fu)],t),t})(),lB=[Q7,Z7,oB,rB,aB,sB],cB=new Set(["create-connection","reassign-connection","drag-node"]),dB=new Set(["selection-area"]),uB=new Set(["assign-to-container"]);function Yy(t){let o=null;for(let e of t){if(uB.has(e))continue;let n=cB.has(e)?"rebase":dB.has(e)?"direct":null;if(!n)return null;if(!o){o=n;continue}if(o!==n)return null}return o}function Xy(t,o,e,n,i){return U.initialize(dy(t.x,o.left,o.right,e,n,i),dy(t.y,o.top,o.bottom,e,n,i))}function dy(t,o,e,n,i,r){let a=Math.max(0,n),s=Math.max(0,i);if(!a||!s)return 0;if(t<=o+a){let c=py((o+a-t)/a,0,1);return uy(c,s,r)}if(t>=e-a){let c=py((t-(e-a))/a,0,1);return-uy(c,s,r)}return 0}function pB(t,o,e){let n=e||1;return pe.fromPoint(t).add(pe.fromPoint(o).div(n))}function uy(t,o,e){return e?o*t:o}function py(t,o,e){return Math.max(o,Math.min(e,t))}var Nu=class{static fToken=Symbol("RunAutoPanFrameRequest")},ui=class{static fToken=Symbol("StopAutoPanRequest")},hB=(()=>{let t=class Vl{_store=p(L);_dragContext=p(he);handle(e){this._dragContext.autoPanFrameId!==null&&(cancelAnimationFrame(this._dragContext.autoPanFrameId),this._dragContext.autoPanFrameId=null),this._dragContext.isAutoPanCanvasMoved&&(this._store.fCanvas?.emitCanvasChangeEvent(),this._dragContext.isAutoPanCanvasMoved=!1)}static \u0275fac=function(n){return new(n||Vl)};static \u0275prov=y({token:Vl,factory:Vl.\u0275fac})};return t=P([R(ui)],t),t})(),Lr=class{static fToken=Symbol("SyncAutoPanRequest")},fB=(()=>{let t=class zl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new ui);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Nu)}))}_canAutoPan(){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!this._getAutoPanMode()&&this._edgeThreshold()>0&&this._speed()>0}_hasAutoPanDelta(){let e=this._getAutoPanDelta();return!!e.x||!!e.y}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?U.initialize():Xy(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return Yy(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(Xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||zl)};static \u0275prov=y({token:zl,factory:zl.\u0275fac})};return t=P([R(Lr)],t),t})(),mB=(()=>{let t=class Hl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new ui);return}let i=this._getAutoPanDelta();if(!i.x&&!i.y){this._mediator.execute(new ui);return}this._applyCanvasDelta(i,n),this._replayLastPointerMove(),this._mediator.execute(new Lr)}_applyCanvasDelta(e,n){let i=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=pB(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||i.scale||1)),i.position=pe.fromPoint(i.position).add(e),this._store.fCanvas?.redraw(),this._dragContext.isAutoPanCanvasMoved=!0}_replayLastPointerMove(){let e=this._dragContext.lastPointerEvent;if(!e)return;let n=this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition);this._dragContext.draggableItems.forEach(i=>{i.onPointerMove(ge({},n),e)})}_getPointerPositionInCanvas(e){return pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost)}_canAutoPan(e){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!e&&this._edgeThreshold()>0&&this._speed()>0}_getAutoPanMode(){return Yy(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?U.initialize():Xy(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(Xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||Hl)};static \u0275prov=y({token:Hl,factory:Hl.\u0275fac})};return t=P([R(Nu)],t),t})(),_B=[fB,mB,hB],Au=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(o){this.event=o}},Lu=class{kind;data;fEventType;get fData(){return this.data}constructor(o,e,n){this.kind=o,this.data=e,this.fEventType=n??o}},Ft=class{data(){}_features=[];getEvent(){return new Lu(this.kind,this.data(),this.type)}attachFeature(o){this._features.push(o)}featuresPrepare(o){for(let e of this._features)e.onPrepare?.(o)}featuresMove(o,e){for(let n of this._features)n.onMove?.(o,e)}featuresFinalize(o,e){for(let n of this._features)n.onFinalize?.(o,e)}featuresEnd(o){for(let e of this._features)e.onEnd?.(o)}},Bu=class{_isConnected=!1;get isConnected(){return this._isConnected}toConnector=[];isSelfConnectable=!0;fConnectableSide=K.AUTO;userFConnectableSide=K.AUTO;isContains(o){return this.hostElement.contains(o)}setConnected(o){this._isConnected=!0,this.toConnector.push(o)}resetConnected(){this._isConnected=!1,this.toConnector=[]}},gB=new be("F_NODE_INPUT"),bB=(()=>{class t extends Bu{kind="input";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})(),In=(function(t){return t.LEFT="left",t.LEFT_TOP="left-top",t.TOP="top",t.RIGHT_TOP="right-top",t.RIGHT="right",t.RIGHT_BOTTOM="right-bottom",t.BOTTOM="bottom",t.LEFT_BOTTOM="left-bottom",t})(In||{});function vB(t){return xr(t,".f-rotate-handle")}var Zy=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),Sh=new be("F_NODE"),yB=qy(class{hostElement;constructor(t){this.hostElement=t}}),Vu=class extends yB{_injector=p(dt);renderer=p(w0);browser=p(at);stateChanges=new rn;_position=U.initialize();_rotate=0;_size;connectors=[];positionChanges(){de(()=>{let o=this.position();tn(()=>{U.isEqual(this._position,o)||(this._position=o,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){de(()=>{let o=this.size();tn(()=>{this._isSizeEqual(o)||(this._size=o,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){de(()=>{let o=this.rotate();tn(()=>{this._rotate!==o&&(this._rotate=o,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){de(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),tn(()=>this.refresh())},{injector:this._injector})}_isSizeEqual(o){return this._size?.width===o?.width&&this._size?.height===o?.height}isContains(o){return this.hostElement.contains(o)}redraw(){this._size&&(this.setStyle("width",""+this._size.width+"px"),this.setStyle("height",""+this._size.height+"px")),this.setStyle("transform",`translate(${this._position.x}px,${this._position.y}px) rotate(${this._rotate}deg)`)}resetSize(){this.removeStyle("width"),this.removeStyle("height")}updatePosition(o){this._position=o}updateRotate(o){this._rotate=o}updateSize(o){this._size=o}setClass(o){this.hostElement.classList.add(o)}removeClass(o){this.hostElement.classList.remove(o)}addConnector(o){this.connectors.push(o),this.refresh()}removeConnector(o){let e=this.connectors.indexOf(o);e!==-1&&this.connectors.splice(e,1),this.refresh()}},CB=0,xB=3,Km=(()=>{class t extends Vu{_debounceTimer=null;_destroyRef=p(xt);_mediator=p(V);fId=B(`f-group-${CB++}`,{alias:"fGroupId"});fParentId=B(null,{alias:"fGroupParentId"});position=Ei(U.initialize(),{alias:"fGroupPosition"});size=B(void 0,{alias:"fGroupSize"});sizeChange=Ke({alias:"fGroupSizeChange"});rotate=Ei(0,{alias:"fGroupRotate"});fConnectOnNode=B(!0,{transform:j});fMinimapClass=B([]);fDraggingDisabled=B(!1,{alias:"fGroupDraggingDisabled",transform:j});fSelectionDisabled=B(!1,{alias:"fGroupSelectionDisabled",transform:j});fIncludePadding=B(!0,{transform:j});fAutoExpandOnChildHit=B(!1,{transform:j});fAutoSizeToFitChildren=B(!1,{transform:j});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qr(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new si),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),xB))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fo(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new ea(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new ta(this))}static \u0275fac=function(n){return new(n||t)(un(Qe))};static \u0275dir=je({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-group-id",i.fId()),ue("f-group-dragging-disabled",i.fDraggingDisabled())("f-group-selection-disabled",i.fSelectionDisabled()))},inputs:{fId:[1,"fGroupId","fId"],fParentId:[1,"fGroupParentId","fParentId"],position:[1,"fGroupPosition","position"],size:[1,"fGroupSize","size"],rotate:[1,"fGroupRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fGroupDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fGroupSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fGroupPositionChange",sizeChange:"fGroupSizeChange",rotate:"fGroupRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:Sh,useExisting:t}]),Z]})}return t})(),hy=0,wB=3,kh=(()=>{class t extends Vu{_debounceTimer=null;_destroyRef=p(xt);_mediator=p(V);fId=B(`f-node-${hy++}`,{alias:"fNodeId",transform:e=>Ro(e)||`f-node-${hy++}`});fParentId=B(null,{alias:"fNodeParentId"});position=Ei(U.initialize(),{alias:"fNodePosition"});size=B(void 0,{alias:"fNodeSize"});sizeChange=Ke({alias:"fNodeSizeChange"});rotate=Ei(0,{alias:"fNodeRotate"});fConnectOnNode=B(!0,{transform:j});fMinimapClass=B([]);fDraggingDisabled=B(!1,{alias:"fNodeDraggingDisabled",transform:j});fSelectionDisabled=B(!1,{alias:"fNodeSelectionDisabled",transform:j});fIncludePadding=B(!0,{transform:j});fAutoExpandOnChildHit=B(!1,{transform:j});fAutoSizeToFitChildren=B(!1,{transform:j});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qr(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new si),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),wB))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fo(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new ea(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new ta(this))}static \u0275fac=function(n){return new(n||t)(un(Qe))};static \u0275dir=je({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-node-id",i.fId()),ue("f-node-dragging-disabled",i.fDraggingDisabled())("f-node-selection-disabled",i.fSelectionDisabled()))},inputs:{fId:[1,"fNodeId","fId"],fParentId:[1,"fNodeParentId","fParentId"],position:[1,"fNodePosition","position"],size:[1,"fNodeSize","size"],rotate:[1,"fNodeRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fNodeDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fNodeSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fNodePositionChange",sizeChange:"fNodeSizeChange",rotate:"fNodeRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:Sh,useExisting:t}]),Z]})}return t})();function TB(t){return!!t.closest("[fNode]")}var fy=0,Qy=(()=>{class t extends bB{hostElement=p(Qe).nativeElement;_mediator=p(V);_node=p(Sh);fId=B(`f-node-input-${fy++}`,{alias:"fInputId",transform:e=>Ro(e)||`f-node-input-${fy++}`});category=B(void 0,{alias:"fInputCategory",transform:Ro});multiple=B(!0,{alias:"fInputMultiple",transform:j});disabled=B(!1,{alias:"fInputDisabled",transform:j});userFConnectableSide=K.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yr(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(ht.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new na(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,i){n&2&&(O("data-f-input-id",i.fId()),ue("f-node-input-multiple",i.multiple)("f-node-input-disabled",i.disabled()))},inputs:{fId:[1,"fInputId","fId"],category:[1,"fInputCategory","category"],multiple:[1,"fInputMultiple","multiple"],disabled:[1,"fInputDisabled","disabled"],userFConnectableSide:[2,"fInputConnectableSide","userFConnectableSide",e=>xo(e,"fInputConnectableSide",K)]},exportAs:["fNodeInput"],standalone:!1,features:[ke([{provide:gB,useExisting:t}]),Z,ro]})}return t})(),SB=(()=>{class t extends Bu{get hasConnectionLimits(){return!!this.canBeConnectedInputs&&this.canBeConnectedInputs.length>0}canConnectTo(e){return[e.fId(),e.category()].some(i=>i&&this.canBeConnectedInputs?.includes(i))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})();function Jy(t){return!!t.closest("[fNodeOutlet]")}var kB=new be("F_NODE_OUTPUT"),IB=(()=>{class t extends SB{kind="output";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,standalone:!1,features:[Z]})}return t})();function eC(t){return!!t.closest("[fNodeOutput]")}var my=0,tC=(()=>{class t extends IB{hostElement=p(Qe).nativeElement;_mediator=p(V);_node=p(Sh);fId=B(`f-node-output-${my++}`,{alias:"fOutputId",transform:e=>Ro(e)||`f-node-output-${my++}`});multiple=B(!1,{alias:"fOutputMultiple",transform:j});disabled=B(!1,{alias:"fOutputDisabled",transform:j});userFConnectableSide=K.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yr(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(ht.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new na(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,i){n&2&&(O("data-f-output-id",i.fId()),ue("f-node-output-multiple",i.multiple)("f-node-output-disabled",i.disabled())("f-node-output-self-connectable",i.isSelfConnectable))},inputs:{fId:[1,"fOutputId","fId"],multiple:[1,"fOutputMultiple","multiple"],disabled:[1,"fOutputDisabled","disabled"],userFConnectableSide:[2,"fOutputConnectableSide","userFConnectableSide",e=>xo(e,"fOutputConnectableSide",K)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[ke([{provide:kB,useExisting:t}]),Z,ro]})}return t})();var zu=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(o){this.event=o}},Br=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(o){this.outlet=o}},EB=(()=>{let t=class ql{_store=p(L);handle({outlet:e}){let n=this._findOwnerNode(e);if(!n)throw new Error("The fOutlet must belong to an fNode");let i=this._findFirstConnectableOutputInNode(n);if(!i)throw new Error("Outlet requires at least one connectable output in the same node.");return i}_findOwnerNode(e){let n=e.hostElement;return this._store.nodes.getAll().find(i=>i.isContains(n))}_findFirstConnectableOutputInNode(e){return this._store.outputs.getAll().find(n=>e.isContains(n.hostElement)&&n.canBeConnected)}static \u0275fac=function(n){return new(n||ql)};static \u0275prov=y({token:ql,factory:ql.\u0275fac})};return t=P([R(Br)],t),t})(),Ym=class{sourceId;targetId;dropPosition;fOutputId;fInputId;fDropPosition;constructor(o,e,n){this.sourceId=o,this.targetId=e,this.dropPosition=n,this.fOutputId=o,this.fInputId=e,this.fDropPosition=n}},Hu=(()=>{class t extends Ft{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=p(hi);_mediator=p(V);_connectionBehaviour=p(Ho);_store=p(L);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new rt;initialize(e,n){this._sourceRef=this._mediator.execute(new Kt(e)),this._pointerDown=rt.fromRect(te.initialize(n.x,n.y))}prepareDragSequence(){this._collectAndMarkTargets(),this._initSnapConnection(),this._initCreateConnection(),this._connection.show(),this.onPointerMove(U.initialize()),this._result.setData({toConnectorRect:this._pointerDown,canBeConnectedInputs:this._targets,fOutputId:this._sourceRef.connector.fId()})}_collectAndMarkTargets(){this._targets=this._mediator.execute(new Zr(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new Lo(this._targets.map(e=>e.connector)))}_initSnapConnection(){this._snapConnection&&(this._snapConnection.fOutputId.set(this._sourceRef.connector.fId()),this._snapConnection.initialize())}_initCreateConnection(){this._connection.fOutputId.set(this._sourceRef.connector.fId()),this._connection.initialize()}onPointerMove(e){let n=this._pointerDown.addPoint(e),i=this._findClosestTarget(n),r=i?.connector.fConnectableSide||K.TOP;this._drawCreateConnection(n,r);let a=this._snapConnection;if(!a)return;let s=i&&i.distance<a.fSnapThreshold?i:void 0;this._drawSnapConnection(s)}_findClosestTarget(e){return this._mediator.execute(new qi(e,this._targets))}_drawCreateConnection(e,n){let i=this._connectionBehaviour.handle(new vn(this._sourceRef.rect,e,this._connection,this._sourceRef.connector.fConnectableSide,n,this._resolveRotationContext(this._sourceRef.connector)));this._connection.setLine(i),this._connection.redraw()}_drawSnapConnection(e){let n=this._snapConnection;if(!n)return;if(!e){n.hide();return}let i=this._connectionBehaviour.handle(new vn(this._sourceRef.rect,e.rect,n,this._sourceRef.connector.fConnectableSide,e.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(e.connector)));n.show(),n.setLine(i),n.redraw()}onPointerUp(){this._connection.redraw(),this._connection.hide(),this._snapConnection?.hide(),this._mediator.execute(new Bo(this._targets.map(e=>e.connector)))}_resolveRotationContext(e){return this._mediator.execute(new zn(e))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),MB=(()=>{let t=class Gl{_result=p(hi);_mediator=p(V);_store=p(L);_dragContext=p(he);get _dragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isValid()&&(this._emitEvent(e.event),this._dragHandler.onPointerUp())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Hu)}_getTargetOutput(e){if(!e)throw new Error(`Output with fOutputId ${this._result.getData().fOutputId} not found. Make sure there is no f-connection to a non-existent fOutput.`);return Jy(e.hostElement)?this._mediator.execute(new Br(e)):e}_getOutput(){return this._store.outputs.get(this._result.getData().fOutputId)}_getOutlet(){return this._store.outlets.get(this._result.getData().fOutputId)}_emitEvent(e){this._store.fDraggable?.fCreateConnection.emit(new Ym(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new Xr(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||Gl)};static \u0275prov=y({token:Gl,factory:Gl.\u0275fac})};return t=P([R(zu)],t),t})(),Vr=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(o,e){this.eventPosition=o,this.source=e}},DB=(()=>{let t=class jl{_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle({source:e,eventPosition:n}){this._dragContext.onPointerDownScale=this._transform.scale;let i=this._toFlowSpace(n);this._dragContext.onPointerDownPosition=i;let r=this._toCanvasSpace(i),a=this._dragInjector.get(Hu);a.initialize(e,r),this._dragContext.draggableItems=[a]}_toFlowSpace(e){return pe.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return pe.fromPoint(e).mult(this._transform.scale).sub(this._transform.position).sub(this._transform.scaledPosition).div(this._transform.scale)}static \u0275fac=function(n){return new(n||jl)};static \u0275prov=y({token:jl,factory:jl.\u0275fac})};return t=P([R(Vr)],t),t})(),qu=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(o,e){this.event=o,this.node=e}},PB=(()=>{let t=class Ul{_mediator=p(V);_store=p(L);handle({event:e,node:n}){let i=this._findOutlet(n);if(!i||(i.setOutputs(this._getOutputs(n)),!i.canBeConnected))return;let r=i.isConnectionFromOutlet?i:this._resolveOutput(i);!r||!r.canBeConnected||this._startDrag(e.getPosition(),r)}_findOutlet(e){return this._store.outlets.getAll().find(n=>e.isContains(n.hostElement))}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement))}_resolveOutput(e){return this._mediator.execute(new Br(e))}_startDrag(e,n){this._mediator.execute(new Vr(e,n))}static \u0275fac=function(n){return new(n||Ul)};static \u0275prov=y({token:Ul,factory:Ul.\u0275fac})};return t=P([R(qu)],t),t})(),Gu=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(o,e){this.event=o,this.node=e}},RB=(()=>{let t=class $l{_mediator=p(V);_store=p(L);handle({event:e,node:n}){if(!eC(e.targetElement)||this._hasOutlet(n))return;let i=this._findOutput(e.targetElement);!i||!i.canBeConnected||this._startDrag(e.getPosition(),i)}_hasOutlet(e){return this._store.outlets.getAll().some(n=>e.isContains(n.hostElement))}_findOutput(e){return this._store.outputs.getAll().find(n=>n.hostElement.contains(e))}_startDrag(e,n){this._mediator.execute(new Vr(e,n))}static \u0275fac=function(n){return new(n||$l)};static \u0275prov=y({token:$l,factory:$l.\u0275fac})};return t=P([R(Gu)],t),t})(),ju=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},OB=(()=>{let t=class Wl{_mediator=p(V);_store=p(L);_dragContext=p(he);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let i=Jy(e.targetElement),r=!i&&eC(e.targetElement);if(!i&&!r)return;let a=this._findOwnerNode(e.targetElement);a&&(i?this._mediator.execute(new qu(e,a)):this._mediator.execute(new Gu(e,a)))}_findOwnerNode(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_isValidConditions(){return this._dragContext.isEmpty()&&!!this._store.connections.getForCreate()}_isValidTrigger(e,n){return an(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Wl)};static \u0275prov=y({token:Wl,factory:Wl.\u0275fac})};return t=P([R(ju)],t),t})(),Uu=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(o){this.event=o}},Xm=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(o,e,n,i,r,a,s){this.connectionId=o,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=i,this.previousTargetId=r,this.nextTargetId=a,this.dropPosition=s,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=i,this.oldTargetId=r,this.newTargetId=a,this.dropPoint=s}},FB=(()=>{let t=class Kl{_dragResult=p(hi);_mediator=p(V);_store=p(L);_dragContext=p(he);get _dragDirective(){return this._store.fDraggable}handle({event:e}){let n=this._findReassignHandler();n&&(this._emitIfChanged(e),n.onPointerUp())}_findReassignHandler(){return this._dragContext.draggableItems.find(n=>n.getEvent().fEventType==="reassign-connection")}_emitIfChanged(e){let n=this._dragResult.getData(),i=this._findConnectableConnector(e,n.candidates);i&&!this._isReassignedToDifferentConnector(n,i)||this._dragDirective.fReassignConnection.emit(this._buildEvent(n,e,i))}_findConnectableConnector(e,n){return this._mediator.execute(new Xr(e.getPosition(),n))}_isReassignedToDifferentConnector(e,n){let i=e.connection;return e.draggedEnd==="target"?i.fInputId()!==n.fId():i.fOutputId()!==n.fId()}_buildEvent(e,n,i){let r=e.connection;return new Xm(r.fId(),e.draggedEnd,r.fOutputId(),e.draggedEnd==="source"?i?.fId():void 0,r.fInputId(),e.draggedEnd==="target"?i?.fId():void 0,n.getPosition())}static \u0275fac=function(n){return new(n||Kl)};static \u0275prov=y({token:Kl,factory:Kl.\u0275fac})};return t=P([R(Uu)],t),t})(),$u=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}};function NB(t,o){return nC(t,o)||AB(t,o)}function nC(t,o){return t.fDragHandleEnd()?.point&&iC(o,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function AB(t,o){return!!t.fDragHandleStart()?.point&&iC(o,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function iC(t,o){return(t.x-o.x)**2+(t.y-o.y)**2<=8**2}function oC(t,o){return t&&t.distance<o.fSnapThreshold?t:void 0}function Wu(t){return rt.fromRect(te.initialize(t.x,t.y))}var Zm=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(o,e,n,i,r){this._mediator=o,this._behaviour=e,this._connection=n,this._sourceRef=i,this._targetRef=r,this._anchorRect=Wu(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Xp(this._target,this._targetRef.rect.gravityCenter)),this._candidates.some(o=>o.connector.fId()===this._source.fId())||this._candidates.push(this._sourceRef),this._mediator.execute(new Lo(this._candidates.map(o=>o.connector)))}setSnapConnection(o){this._snap=o,o&&(o.fInputId.set(this._connection.fInputId()),o.initialize())}onPointerMove(o){let e=this._anchorRect.addPoint(o),n=this._findClosest(e.gravityCenter),i=n?.connector.fConnectableSide??this._source.fConnectableSide;this._draw(e,i);let r=this._snap;r&&this._drawSnap(oC(n,r))}_findClosest(o){return this._mediator.execute(new qi(o,this._candidates))}_draw(o,e){let n=this._behaviour.handle(new vn(o,this._targetRef.rect,this._connection,e,this._targetRef.connector.fConnectableSide,void 0,this._resolveRotationContext(this._targetRef.connector)));this._connection.setLine(n),this._connection.redraw()}_drawSnap(o){let e=this._snap;if(!e)return;if(!o){e.hide();return}let n=this._behaviour.handle(new vn(o.rect,this._targetRef.rect,e,o.connector.fConnectableSide,this._target.fConnectableSide,this._resolveRotationContext(o.connector),this._resolveRotationContext(this._targetRef.connector)));e.show(),e.setLine(n),e.redraw()}onPointerUp(){this._draw(this._anchorRect,this._sourceRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Bo(this._candidates.map(o=>o.connector)))}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Qm=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(o,e,n,i,r){this._mediator=o,this._behaviour=e,this._connection=n,this._sourceRef=i,this._targetRef=r,this._anchorRect=Wu(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Zr(this._source,this._sourceRef.rect.gravityCenter));let o=this._connection.fInputId();o&&!this._candidates.some(e=>e.connector.fId()===o)&&this._candidates.push(this._targetRef),this._mediator.execute(new Lo(this._candidates.map(e=>e.connector)))}setSnapConnection(o){this._snap=o,o&&(o.fOutputId.set(this._connection.fOutputId()),o.initialize())}onPointerMove(o){let e=this._anchorRect.addPoint(o),n=this._findClosest(e.gravityCenter),i=n?.connector.fConnectableSide??this._target.fConnectableSide;this._draw(e,i);let r=this._snap;r&&this._drawSnap(oC(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Bo(this._candidates.map(o=>o.connector)))}_findClosest(o){return this._mediator.execute(new qi(o,this._candidates))}_draw(o,e){let n=this._behaviour.handle(new vn(this._sourceRef.rect,o,this._connection,this._source.fConnectableSide,e,this._resolveRotationContext(this._sourceRef.connector),void 0));this._connection.setLine(n),this._connection.redraw()}_drawSnap(o){let e=this._snap;if(!e)return;if(!o){e.hide();return}let n=this._behaviour.handle(new vn(this._sourceRef.rect,o.rect,e,this._source.fConnectableSide,o.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(o.connector)));e.show(),e.setLine(n),e.redraw()}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Jm=(()=>{class t extends Ft{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=p(hi);_mediator=p(V);_connectionBehaviour=p(Ho);_store=p(L);get _snapConnection(){return this._store.connections.getForSnap()}_connection;_draggedEnd;_sourceRef;_targetRef;_reassignHandler;initialize(e,n){this._connection=e,this._draggedEnd=n?"target":"source",this._sourceRef=this._mediator.execute(new Kt(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new Kt(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new Zm(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new Qm(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}prepareDragSequence(){this._reassignHandler.collectAndMarkCandidates(),this._reassignHandler.setSnapConnection(this._snapConnection),this._result.setData({draggedEnd:this._draggedEnd,sourceAnchorRect:Wu(this._connection.line.point1),targetAnchorRect:Wu(this._connection.line.point2),candidates:this._reassignHandler.candidates(),connection:this._connection})}onPointerMove(e){this._reassignHandler.onPointerMove(e)}onPointerUp(){this._reassignHandler.onPointerUp()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),LB=(()=>{let t=class Yl{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _transform(){return this._store.transform}get _connections(){return this._store.connections.getAll()}handle(e){if(!this._dragContext.isEmpty()||!this._isValidTrigger(e))return;let n=qo(e.event.getPosition(),this._store.flowHost,this._transform),i=this._findConnectionAt(n);i&&(this._capturePointerDown(e),this._startDrag(i,n),queueMicrotask(()=>this._bringToFront(i)))}_findConnectionAt(e){return this._connections.find(n=>NB(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let i=this._dragInjector.get(Jm);i.initialize(e,nC(e,n)),this._dragContext.draggableItems=[i]}_isValidTrigger(e){return an(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new ji(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Yl)};static \u0275prov=y({token:Yl,factory:Yl.\u0275fac})};return t=P([R($u)],t),t})(),Ku=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(o){this.event=o}},Yu=class{connectionId;waypoints;constructor(o,e){this.connectionId=o,this.waypoints=e}},Xu=(()=>{class t extends Ft{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=p(L);_point;_pick;get _waypointsComponent(){return this._pick?.connection.fWaypoints()}get _connection(){return this._pick?.connection}setPick(e){this._pick=e}prepareDragSequence(){this._pick?.candidate?(this._point=ge({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=ge({},this._pick.waypoint),this._waypointsComponent.select(this._pick.waypoint)),this._redrawConnection()}onPointerMove(e){this._waypointsComponent.move(U.sum(this._point,e)),this._redrawConnection()}onPointerUp(){this._waypointsComponent.update(),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._eventFromPick())}_redrawConnection(){this._connection.setLine(this._connection.line),this._connection.redraw()}_eventFromPick(){return new Yu(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),BB=(()=>{let t=class Xl{_dragContext=p(he);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof Xu)}static \u0275fac=function(n){return new(n||Xl)};static \u0275prov=y({token:Xl,factory:Xl.\u0275fac})};return t=P([R(Ku)],t),t})(),Zu=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},VB=(()=>{let t=class Zl{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _flowHost(){return this._store.flowHost}get _connections(){return this._store.connections.getAll()}handle(e){let n=qo(e.event.getPosition(),this._flowHost,this._transform),i=this._pickControlPoint(n);if(!i||!this._isValidTrigger(e))return;let r=this._dragInjector.get(Xu);r.setPick(i),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._flowHost).div(this._transform.scale),this._dragContext.draggableItems=[r],queueMicrotask(()=>this._updateConnectionLayer(i.connection))}_pickControlPoint(e){if(this._dragContext.isEmpty())return p6(this._connections,e)}_isValidTrigger(e){return an(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new ji(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Zl)};static \u0275prov=y({token:Zl,factory:Zl.\u0275fac})};return t=P([R(Zu)],t),t})(),zB=[MB,DB,PB,EB,RB,OB,FB,LB,VB,BB],Qu=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(o){this.event=o}},HB=1,zr=(()=>{class t extends Ft{type="move-node-to-parent";kind="assign-to-container";_store=p(L);_dragSession=p(he);get _transform(){return this._store.transform}_candidateGroups=[];_debounceTimer=null;_activeTarget=null;get activeTarget(){return this._activeTarget}initialize(e){this._candidateGroups=e}prepareDragSequence(){for(let{node:e}of this._candidateGroups)e.hostElement.classList.add(ht.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),HB)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(ht.GROUPING.DROP_ACTIVE);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}_updateActiveTarget(e){let n=this._getPointerInFlow(e),i=this._findTargetUnderPointer(n);i?this._setActiveTarget(i):this._clearActiveTarget()}_getPointerInFlow(e){let n=pe.fromPoint(this._dragSession.onPointerDownPosition).add(e),i=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(i)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>te.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(ht.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(ht.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ju=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(o){this.nodesAndGroups=o}},e_=class{rootHandlers;participants;constructor(o,e){this.rootHandlers=o,this.participants=e}},t_=class{fNodeIds;constructor(o){this.fNodeIds=o}},I_="move-node",E_="drag-node";function qB(t){return t.getEvent().kind===E_||t.getEvent().fEventType===I_}var pi=(()=>{class t extends Ft{type=I_;kind=E_;data(){return new t_(this.items.map(e=>e.nodeOrGroup.fId()))}_magneticLines=null;_magneticRects=null;items;roots;initialize(e,n){this.items=e,this.roots=n}setMagneticLines(e){this._magneticLines=e}setMagneticRects(e){this._magneticRects=e}calculateMagneticLinesGuides(e){return this.calculateMagneticSnaps(e).lines}calculateMagneticSnaps(e){this._previewRoots(e);let n=this._rootsUnionRect();return{lines:this._magneticLines?._computeGuides(n),rects:this._magneticRects?._computeRects(n)}}prepareDragSequence(){for(let e of this.roots)e.prepareDragSequence()}onPointerMove(e){this._previewRoots(e);let n=this._rootsUnionRect();this._magneticLines?.scheduleRender(n),this._magneticRects?.scheduleRender(n)}onPointerUp(){for(let e of this.roots)e.onPointerUp();this._magneticLines?.clearGuides(),this._magneticRects?.clearGuides(),requestAnimationFrame(()=>this._refreshDraggedNodes())}_previewRoots(e){for(let n of this.roots)n.onPointerMove(e)}_rootsUnionRect(){let e=null;for(let n of this.roots){let i=n.getLastRect();e=e?te.union([e,i]):i}return e??te.initialize()}_refreshDraggedNodes(){for(let{nodeOrGroup:e}of this.roots)e.refresh()}destroy(){for(let e of this.roots??[])e.destroy?.()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ep=class{_limits;_quantizeStep;constructor(o,e=.5){this._limits=o,this._quantizeStep=e}applyInto(o,e){let{min:n,max:i}=this._limits,r=this._clamp(o.x,n.x,i.x),a=this._clamp(o.y,n.y,i.y),s=o.x-r,c=o.y-a,u=this._quantizeSigned(s,this._quantizeStep),h=this._quantizeSigned(c,this._quantizeStep);e.value.x=r,e.value.y=a,e.edges.left=u<0,e.edges.right=u>0,e.edges.top=h<0,e.edges.bottom=h>0,e.overflow.x=Math.abs(u),e.overflow.y=Math.abs(h)}_quantizeSigned(o,e){if(e<=0||o===0)return 0;let n=o/e;return(o>0?Math.ceil(n):Math.floor(n))*e}_clamp(o,e,n){return Math.min(Math.max(o,e),n)}},n_=class{_pointerDown;_vCellSize;_hCellSize;_snapWhileDragging;constructor(o,e){this._pointerDown=e,this._vCellSize=o.vCellSize(),this._hCellSize=o.hCellSize(),this._snapWhileDragging=o.fCellSizeWhileDragging()}snap(o,e){let n=e||this._snapWhileDragging;return this._strategies[+n](o)}_strategies={0:this._noSnap.bind(this),1:this._snapWithCellSize.bind(this)};_snapWithCellSize(o){return{x:this._snapToGrid(this._pointerDown.x+o.x,this._hCellSize)-this._pointerDown.x,y:this._snapToGrid(this._pointerDown.y+o.y,this._vCellSize)-this._pointerDown.y}}_noSnap(o){return o}_snapToGrid(o,e){return Math.round(o/e)*e}};function _y(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var i_=class{_snapper;_hardClamp;_hardResult=_y();_softClamps=[];_softResults=[];constructor(o,e,n){let i=o.get(L).fDraggable;this._snapper=new n_(i,e),this._hardClamp=new ep(n.hard,.5);for(let r of n.soft)this._softClamps.push(new ep(r.limits,.5)),this._softResults.push(_y())}apply(o,e=!1){let n=this._snapper.snap(o,e);this._hardClamp.applyInto(n,this._hardResult);let i={x:this._hardResult.value.x,y:this._hardResult.value.y};for(let r=0;r<this._softClamps.length;r++)this._softClamps[r].applyInto(i,this._softResults[r]);return{hardDelta:i,soft:this._softResults}}finalize(o){return this.apply(o,!0)}};function gy(t,o,e){let{x:n,y:i,width:r,height:a}=t;return e.right&&o.x>0&&(r+=o.x),e.left&&o.x>0&&(n-=o.x,r+=o.x),e.bottom&&o.y>0&&(a+=o.y),e.top&&o.y>0&&(i-=o.y,a+=o.y),te.initialize(n,i,r,a)}var o_=class extends Ft{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=I_;kind=E_;_startPosition=U.initialize();_startRect=te.initialize();_applyConstraints=o=>o;_lastSoftResults=[];_deltaConstraints;_constraints;_lastPosition=U.initialize();_softParentConnectionHandlers=[];_mediator;constructor(o,e,n=[],i=[],r=[]){super(),this._injector=o,this.nodeOrGroup=e,this.children=n,this.sourceConnectionHandlers=i,this.targetConnectionHandlers=r,this._mediator=o.get(V),this._startRect=this._mediator.execute(new it(e.hostElement)),this._startPosition=ge({},e._position)}setConstraints(o){this._constraints=o,this._deltaConstraints=new i_(this._injector,this._startPosition,o),this._applyConstraints=e=>{let n=this._deltaConstraints.apply(e);return this._applySoftExpansions(n.soft),n.hardDelta}}setSoftParentConnectionHandlers(o){this._softParentConnectionHandlers=o}finalizeConstraints(){this._applyConstraints=o=>{let e=this._deltaConstraints.finalize(o);return this._applySoftExpansions(e.soft),e.hardDelta}}getLastRect(){return te.initialize(this._lastPosition.x,this._lastPosition.y,this._startRect.width,this._startRect.height)}prepareDragSequence(){for(let o of this.children)o.prepareDragSequence();this.nodeOrGroup.hostElement.classList.add(ht.DRAG_AND_DROP.DRAGGING)}onPointerMove(o){let e=this._applyConstraints(o);for(let n of this.children)n.onPointerMove(e);this._redraw(this._startPlus(e));for(let n of this.sourceConnectionHandlers)n.setSourceDelta(e);for(let n of this.targetConnectionHandlers)n.setTargetDelta(e)}onPointerUp(){for(let o of this.children)o.onPointerUp();this.nodeOrGroup.position.set(this.nodeOrGroup._position),this.nodeOrGroup.hostElement.classList.remove(ht.DRAG_AND_DROP.DRAGGING),this._emitExpandedEvent()}_startPlus(o){return U.sum(this._startPosition,o)}_redraw(o){this._lastPosition=o,this.nodeOrGroup.updatePosition(o),this._mediator.execute(new Vi(this.nodeOrGroup.fId(),te.initialize(o.x,o.y,this._startRect.width,this._startRect.height))),this.nodeOrGroup.redraw()}_applySoftExpansions(o){this._lastSoftResults=o;for(let e=0;e<o.length;e++){let n=o[e],i=this._constraints.soft[e],r=gy(i.boundingRect,n.overflow,n.edges);this._commitParentRect(i.nodeOrGroup,r)&&this._updateParentConnectionHandlers(e)}}_commitParentRect(o,e){let n=o._position.x!==e.x||o._position.y!==e.y||o._size?.width!==e.width||o._size?.height!==e.height;return o.updateSize({width:e.width,height:e.height}),o.updatePosition({x:e.x,y:e.y}),this._mediator.execute(new Vi(o.fId(),e)),o.redraw(),n}_updateParentConnectionHandlers(o){let e=this._softParentConnectionHandlers[o];if(!e)return;let n=new Map;for(let i of e.source){let r=this._readConnectorRect(i.connector,n);i.handler.setSourceDelta(this._buildDelta(i.baselineRect,r))}for(let i of e.target){let r=this._readConnectorRect(i.connector,n);i.handler.setTargetDelta(this._buildDelta(i.baselineRect,r))}}_readConnectorRect(o,e){let n=`${o.kind}::${o.fId()}`,i=e.get(n);if(i)return i;let r=this._mediator.execute(new Kt(o)).rect;return e.set(n,r),r}_buildDelta(o,e){return U.initialize(e.x-o.x,e.y-o.y)}_emitExpandedEvent(){for(let o=0;o<this._lastSoftResults.length;o++){let e=this._lastSoftResults[o];if(!e.overflow.x&&!e.overflow.y)continue;let n=this._constraints.soft[o],i=gy(n.boundingRect,e.overflow,e.edges);n.nodeOrGroup.sizeChange.emit(i)}}destroy(){for(let o of this.children)o.destroy?.();this.children=[],this.sourceConnectionHandlers=[],this.targetConnectionHandlers=[],this._lastSoftResults=[],this._applyConstraints=o=>o,this._softParentConnectionHandlers=[]}},GB=(()=>{let t=class Ql{_injector=p(dt);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),i=this._linkParentsAndCollectRoots(e,n);return new e_(i,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let i of e)n.set(i.fId(),new o_(this._injector,i));return n}_linkParentsAndCollectRoots(e,n){let i=[];for(let r of e){let a=n.get(r.fId());if(!a)continue;let s=r.fParentId(),c=s?n.get(s):void 0;c?c.children.push(a):i.push(a)}return i}static \u0275fac=function(n){return new(n||Ql)};static \u0275prov=y({token:Ql,factory:Ql.\u0275fac})};return t=P([R(Ju)],t),t})(),tp=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(o){this.nodeOrGroup=o}},Hr=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(o,e){this.nodeOrGroup=o,this.childrenPaddings=e}},r_=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(o,e,n,i){this.nodeOrGroup=o,this.boundingRect=e,this.innerRect=n,this.paddings=i}},jB=(()=>{let t=class Jl{_mediator=p(V);handle({nodeOrGroup:e,childrenPaddings:n}){let i=this._readBoundingRect(e),r=this._readOwnPaddings(e,i),a=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],s=te.initialize(i.x+a[0],i.y+a[1],i.width-a[0]-a[2],i.height-a[1]-a[3]);return new r_(e,i,s,a)}_readBoundingRect(e){return this._mediator.execute(new it(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new Gi(e,n))}static \u0275fac=function(n){return new(n||Jl)};static \u0275prov=y({token:Jl,factory:Jl.\u0275fac})};return t=P([R(Hr)],t),t})(),UB=(()=>{let t=class ec{_mediator=p(V);handle({nodeOrGroup:e}){let n=this._readCurrentRect(e),i=this._readParentsChain(e);return this._buildConstraints(i,n)}_readCurrentRect(e){return this._mediator.execute(new it(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Ao(e))??[]}_buildConstraints(e,n){let i=[],r=Ky(),a=[0,0,0,0];for(let s of e){let c=this._readParentBounds(s,a);a=c.paddings;let u=this._calculateDifference(c.innerRect,n);if(this._isAutoExpand(s))i.push(this._makeSoftLimit(s,c.boundingRect,u));else{r=u;break}}return{soft:i,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new Hr(e,n))}_calculateDifference(e,n){return{min:this._calculateMinimumDifference(e,n),max:this._calculateMaximumDifference(e,n)}}_calculateMinimumDifference(e,n){return U.initialize(e.x-n.x,e.y-n.y)}_calculateMaximumDifference(e,n){return U.initialize(e.x+e.width-(n.x+n.width),e.y+e.height-(n.y+n.height))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeSoftLimit(e,n,i){return{nodeOrGroup:e,boundingRect:n,initialSize:e._size,limits:i}}static \u0275fac=function(n){return new(n||ec)};static \u0275prov=y({token:ec,factory:ec.\u0275fac})};return t=P([R(tp)],t),t})(),np=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(o,e){this.rootHandlers=o,this.participants=e}},ip=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.constraints=e,this.handlerPool=n}},qr=class{_mediator=p(V);_store=p(L);_behaviour=p(Ho);_source;_target;_sourceRef;_targetRef;_sourceDelta=U.initialize();_targetDelta=U.initialize();connection;initialize(o){this.connection=o,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target)}setSourceDelta(o){this._sourceDelta=o,this._mediator.execute(new Bi(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,o)))}setTargetDelta(o){this._targetDelta=o,this._mediator.execute(new Bi(this._target.fId(),this._target.kind,this._withDelta(this._targetRef.rect,o)))}redraw(){let o=this._buildLine();this.connection.setLine(o),this.connection.redraw()}_buildLine(){let o=rt.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=rt.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new vn(o,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(o){return this._mediator.execute(new Kt(o))}_withDelta(o,e){return rt.fromRoundedRect(o).addPoint(e)}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},Gr=(()=>{class t extends qr{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jr=(()=>{class t extends qr{_sourceUpdated=!1;_targetUpdated=!1;setSourceDelta(e){super.setSourceDelta(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetDelta(e){super.setTargetDelta(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,this.redraw())}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ur=(()=>{class t extends qr{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),$B=(()=>{let t=class tc{_store=p(L);_mediator=p(V);_dragInjector=p(Ct);handle({dragHandler:e,constraints:n,handlerPool:i}){let r=n.soft.map(a=>this._buildParentConnectionHandlers(a.nodeOrGroup,i));e.setSoftParentConnectionHandlers(r)}_buildParentConnectionHandlers(e,n){let i=this._store.outputs.getAll().filter(h=>h.fNodeId===e.fId()),r=this._store.inputs.getAll().filter(h=>h.fNodeId===e.fId());if(!i.length&&!r.length)return{source:[],target:[]};let a=new Set(i.map(h=>h.fId())),s=new Set(r.map(h=>h.fId())),c=new Map,u={source:[],target:[]};for(let h of this._store.connections.getAll()){let g=a.has(h.fOutputId()),C=s.has(h.fInputId());if(!g&&!C)continue;let k=this._getExistingConnectionHandler(n,h);if(k||(k=this._createConnectionHandler(h,g,C),n.push(k)),g){let I=this._store.outputs.require(h.fOutputId());u.source.push({handler:k,connector:I,baselineRect:this._readConnectorRect(I,c)})}if(C){let I=this._store.inputs.require(h.fInputId());u.target.push({handler:k,connector:I,baselineRect:this._readConnectorRect(I,c)})}}return u}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n,i){let r;return n&&i?r=this._dragInjector.createInstance(jr):n?r=this._dragInjector.createInstance(Gr):r=this._dragInjector.createInstance(Ur),r.initialize(e),r}_readConnectorRect(e,n){let i=`${e.kind}::${e.fId()}`,r=n.get(i);if(r)return r;let a=this._mediator.execute(new Kt(e)).rect;return n.set(i,a),a}static \u0275fac=function(n){return new(n||tc)};static \u0275prov=y({token:tc,factory:tc.\u0275fac})};return t=P([R(ip)],t),t})(),WB=(()=>{let t=class nc{_dragInjector=p(Ct);_mediator=p(V);handle({rootHandlers:e,participants:n}){let i=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,i);let r=this._dragInjector.createInstance(pi);return r.initialize(n,e),r}_applyConstraintsToRoots(e,n){for(let i of e){let r=this._calculateConstraints(i.nodeOrGroup);i.setConstraints(r),this._attachSoftParentConnectionHandlers(i,r,n)}}_collectConnectionHandlers(e){let n=new Map;for(let i of e){for(let r of i.sourceConnectionHandlers)n.set(r.connection.fId(),r);for(let r of i.targetConnectionHandlers)n.set(r.connection.fId(),r)}return Array.from(n.values())}_attachSoftParentConnectionHandlers(e,n,i){this._mediator.execute(new ip(e,n,i))}_calculateConstraints(e){return this._mediator.execute(new tp(e))}static \u0275fac=function(n){return new(n||nc)};static \u0275prov=y({token:nc,factory:nc.\u0275fac})};return t=P([R(np)],t),t})(),op=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.sourceIds=e,this.handlerPool=n}},KB=(()=>{let t=class ic{_store=p(L);_dragInjector=p(Ct);get _connections(){return this._store.connections.getAll()}handle(e){this._getInputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getInputConnections(e){let n=new Set(this._getNodeInputIds(e));return this._connections.filter(i=>n.has(i.fInputId()))}_getNodeInputIds(e){return this._store.inputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let i=this._getExistingConnectionHandler(n.handlerPool,e);i||(i=this._createConnectionHandler(n.sourceIds,e),n.handlerPool.push(i)),n.dragHandler.targetConnectionHandlers.push(i)}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n){let i;return e.includes(n.fOutputId())?i=this._dragInjector.createInstance(jr):i=this._dragInjector.createInstance(Ur),i.initialize(n),i}static \u0275fac=function(n){return new(n||ic)};static \u0275prov=y({token:ic,factory:ic.\u0275fac})};return t=P([R(op)],t),t})(),rp=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(o,e,n){this.dragHandler=o,this.targetIds=e,this.handlerPool=n}},YB=(()=>{let t=class oc{_store=p(L);_dragInjector=p(Ct);get _connections(){return this._store.connections.getAll()}handle(e){this._getOutputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getOutputConnections(e){let n=new Set(this._getNodeOutputIds(e));return this._connections.filter(i=>n.has(i.fOutputId()))}_getNodeOutputIds(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let i=this._getExistingConnectionHandler(n.handlerPool,e);i||(i=this._createConnectionHandler(n.targetIds,e),n.handlerPool.push(i)),n.dragHandler.sourceConnectionHandlers.push(i)}_getExistingConnectionHandler(e,n){return e.find(i=>i.connection.fId()===n.fId())}_createConnectionHandler(e,n){let i;return e.includes(n.fInputId())?i=this._dragInjector.createInstance(jr):i=this._dragInjector.createInstance(Gr),i.initialize(n),i}static \u0275fac=function(n){return new(n||oc)};static \u0275prov=y({token:oc,factory:oc.\u0275fac})};return t=P([R(rp)],t),t})(),ap=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(o){this.nodeOrGroup=o}},XB=(()=>{let t=class rc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({nodeOrGroup:e}){let n=this._collectSelected(e),i=this._withDeepChildren(n),r=this._mediator.execute(new Ju(i)),a=this._collectSourceConnectorIds(i),s=this._collectTargetConnectorIds(i);return this._attachConnectionHandlers(r.participants,a,s),this._mediator.execute(new np(r.rootHandlers,r.participants))}_collectSelected(e){let n=[];for(let i of this._dragSession.selectedItems){let r=this._findNodeByHost(i.hostElement);r&&n.push(r)}return e&&!n.includes(e)&&n.push(e),n}_findNodeByHost(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_withDeepChildren(e){let n=[];for(let i of e){n.push(i);let r=this._mediator.execute(new zo(i.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return om(e,n=>this._store.outputs.getAll().filter(i=>i.fNodeId===n.fId()).map(i=>i.fId()))}_collectTargetConnectorIds(e){return om(e,n=>this._store.inputs.getAll().filter(i=>i.fNodeId===n.fId()).map(i=>i.fId()))}_attachConnectionHandlers(e,n,i){let r=[];for(let a of e)this._mediator.execute(new rp(a,i,r)),this._mediator.execute(new op(a,n,r))}static \u0275fac=function(n){return new(n||rc)};static \u0275prov=y({token:rc,factory:rc.\u0275fac})};return t=P([R(ap)],t),t})(),ZB=[GB,UB,WB,KB,YB,$B,jB,XB];function QB(t,o,e=10){let n=o.x,i=o.y,r=n+o.width,a=i+o.height,s=o.gravityCenter.x,c=o.gravityCenter.y,u,h,g=1/0,C,k,I=1/0,N=(Y,ee)=>{let ce=ee<0?-ee:ee;ce<=e&&ce<g&&(g=ce,u=Y,h=ee)},q=(Y,ee)=>{let ce=ee<0?-ee:ee;ce<=e&&ce<I&&(I=ce,C=Y,k=ee)};for(let Y=0;Y<t.length;Y++){let ee=t[Y],ce=ee.x,Oe=ee.y,De=ce+ee.width,Ge=Oe+ee.height,Ht=ee.gravityCenter.x,ct=ee.gravityCenter.y;N(ce,n-ce),N(De,n-De),N(Ht,s-Ht),N(ce,r-ce),N(De,r-De),q(Oe,i-Oe),q(Ge,i-Ge),q(ct,c-ct),q(Oe,a-Oe),q(Ge,a-Ge)}return{x:{guide:u,delta:h},y:{guide:C,delta:k}}}var by=["left","top","width","height"],sp=class{_element;constructor(o,e,n="f-line"){this._element=o.document.createElement("div"),this._element.classList.add(n),this._element.style.position="absolute",this._element.style.display="none",e.appendChild(this._element)}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}render(o){for(let e of by){let n=o[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let o of by)this._element.style.removeProperty(o)}destroy(){this._element.remove()}},a_=class{_horizontal;_vertical;constructor(o,e){this._horizontal=new sp(o,e),this._vertical=new sp(o,e),this._horizontal.hide(),this._vertical.hide()}drawVerticalLine(o,e,n){this._vertical.show(),this._vertical.render({left:o*n.scale+n.position.x+n.scaledPosition.x,top:0,width:1,height:e.height})}drawHorizontalLine(o,e,n){this._horizontal.show(),this._horizontal.render({left:0,top:o*n.scale+n.position.y+n.scaledPosition.y,width:e.width,height:1})}hideVertical(){this._vertical.hide()}hideHorizontal(){this._horizontal.hide()}hideAll(){this._vertical.hide(),this._horizontal.hide()}destroy(){this._vertical.destroy(),this._horizontal.destroy()}},lp=class{static fToken=Symbol("MagneticLinesPreparationRequest")},JB=(()=>{let t=class ac{_mediator=p(V);_store=p(L);_browser=p(at);_injector=p(dt);_dragSession=p(he);_renderer;handle(e){let n=this._store.instances.get(Xe.MAGNETIC_LINES);if(!n)return;let i=this._dragSession.draggableItems.find(r=>r instanceof pi);i&&i.setMagneticLines(new s_(this._injector,this._renderer??this._createRenderer(n),this._flowHostSize(),this._notDraggedRects(this._draggedNodes(i.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_flowHostSize(){return this._store.flowHost.getBoundingClientRect()}_createRenderer({hostElement:e}){return this._renderer=new a_(this._browser,e),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new it(r.hostElement)))}static \u0275fac=function(n){return new(n||ac)};static \u0275prov=y({token:ac,factory:ac.\u0275fac})};return t=P([R(lp)],t),t})(),s_=class{_renderer;_size;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;constructor(o,e,n,i){this._renderer=e,this._size=n,this._rects=i;let r=o.get(L);this._alignThreshold=r.instances.require(Xe.MAGNETIC_LINES).threshold(),this._canvasTransform=r.transform}scheduleRender(o){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderGuides(this._computeGuides(o)),15)}_renderGuides(o){this._renderVertical(o),this._renderHorizontal(o)}_renderVertical(o){o.x.guide!==void 0?this._renderer.drawVerticalLine(o.x.guide,this._size,this._canvasTransform):this._renderer.hideVertical()}_renderHorizontal(o){o.y.guide!==void 0?this._renderer.drawHorizontalLine(o.y.guide,this._size,this._canvasTransform):this._renderer.hideHorizontal()}_computeGuides(o){return QB(this._rects,o,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},vy=["top","center","bottom"],yy=["left","center","right"];function e9(t,o,e=10,n=10){let i=o.x,r=o.y,a=i+o.width,s=r+o.height,c=o.gravityCenter.x,u=o.gravityCenter.y,h=t9(t,o,i,r,a,s,c,u,e,n),g=n9(t,o,i,r,a,s,c,u,e,n);return h&&(!g||h.absDelta<=g.absDelta)?{axis:"x",delta:h.delta,gap:h.gap,rects:h.rects,alignMode:h.alignMode,crossDelta:h.crossDelta}:g?{axis:"y",delta:g.delta,gap:g.gap,rects:g.rects,alignMode:g.alignMode,crossDelta:g.crossDelta}:{rects:[]}}function t9(t,o,e,n,i,r,a,s,c,u){let h=1/0,g,C=0,k,I=[],N=0,q=[],Y=[],ee=[];for(let ce=0;ce<vy.length;ce++){let Oe=ce===0?n:ce===1?s:r;q.length=0,Y.length=0,ee.length=0;let De=1/0,Ge=-1/0,Ht=0,ct=1/0,vt=1/0;for(let qe=0;qe<t.length;qe++){let Fe=t[qe],rr=ce===0?Fe.y:ce===1?Fe.gravityCenter.y:Fe.y+Fe.height,xf=Oe-rr,An=So(xf);if(An>c)continue;q.push(qe),Y.push(Fe.x),ee.push(Fe.x+Fe.width);let ar=Fe.y,sr=Fe.y+Fe.height;ar<De&&(De=ar),sr>Ge&&(Ge=sr),(An<ct||An===ct&&qe<vt)&&(ct=An,Ht=rr,vt=qe)}let tt=q.length;if(tt<2)continue;rC(q,Y,ee);let st=0;for(;st<tt&&Y[st]<=a;)st++;let Ti=st>0&&st<tt,Mt,qt;Ti?(Mt=st-1,qt=st):st<=0?(Mt=0,qt=1):(Mt=tt-2,qt=tt-1);let Gt=Y[qt]-ee[Mt];if(Gt<0)continue;let ft;if(Ti){ft=ee[Mt]+Gt;let qe=ft+o.width,Fe=Y[qt]-qe;if(So(Fe-Gt)>u)continue}else st<=0?ft=Y[0]-Gt-o.width:ft=ee[tt-1]+Gt;let or=e-ft,Si=So(or);if(Si>u||Si>=h)continue;let dn=i9(q,Y,ee,De,Ge);if(Ti){let qe=ft,Fe=ft+o.width;dn.push({left:ee[Mt],top:De,width:qe-ee[Mt],height:Ge-De}),dn.push({left:Fe,top:De,width:Y[qt]-Fe,height:Ge-De})}else if(st<=0){let qe=ft+o.width;dn.push({left:qe,top:De,width:Y[0]-qe,height:Ge-De})}else dn.push({left:ee[tt-1],top:De,width:ft-ee[tt-1],height:Ge-De});let Cf=Oe-Ht;h=Si,g=or,C=Gt,k=vy[ce],I=dn,N=Cf}if(!(g===void 0||k===void 0))return{delta:g,absDelta:h,gap:C,rects:I,alignMode:k,crossDelta:N}}function n9(t,o,e,n,i,r,a,s,c,u){let h=1/0,g,C=0,k,I=[],N=0,q=[],Y=[],ee=[];for(let ce=0;ce<yy.length;ce++){let Oe=ce===0?e:ce===1?a:i;q.length=0,Y.length=0,ee.length=0;let De=1/0,Ge=-1/0,Ht=0,ct=1/0,vt=1/0;for(let qe=0;qe<t.length;qe++){let Fe=t[qe],rr=ce===0?Fe.x:ce===1?Fe.gravityCenter.x:Fe.x+Fe.width,xf=Oe-rr,An=So(xf);if(An>c)continue;q.push(qe),Y.push(Fe.y),ee.push(Fe.y+Fe.height);let ar=Fe.x,sr=Fe.x+Fe.width;ar<De&&(De=ar),sr>Ge&&(Ge=sr),(An<ct||An===ct&&qe<vt)&&(ct=An,Ht=rr,vt=qe)}let tt=q.length;if(tt<2)continue;rC(q,Y,ee);let st=0;for(;st<tt&&Y[st]<=s;)st++;let Ti=st>0&&st<tt,Mt,qt;Ti?(Mt=st-1,qt=st):st<=0?(Mt=0,qt=1):(Mt=tt-2,qt=tt-1);let Gt=Y[qt]-ee[Mt];if(Gt<0)continue;let ft;if(Ti){ft=ee[Mt]+Gt;let qe=ft+o.height,Fe=Y[qt]-qe;if(So(Fe-Gt)>u)continue}else st<=0?ft=Y[0]-Gt-o.height:ft=ee[tt-1]+Gt;let or=n-ft,Si=So(or);if(Si>u||Si>=h)continue;let dn=o9(q,Y,ee,De,Ge);if(Ti){let qe=ft,Fe=ft+o.height;dn.push({left:De,top:ee[Mt],width:Ge-De,height:qe-ee[Mt]}),dn.push({left:De,top:Fe,width:Ge-De,height:Y[qt]-Fe})}else if(st<=0){let qe=ft+o.height;dn.push({left:De,top:qe,width:Ge-De,height:Y[0]-qe})}else dn.push({left:De,top:ee[tt-1],width:Ge-De,height:ft-ee[tt-1]});let Cf=Oe-Ht;h=Si,g=or,C=Gt,k=yy[ce],I=dn,N=Cf}if(!(g===void 0||k===void 0))return{delta:g,absDelta:h,gap:C,rects:I,alignMode:k,crossDelta:N}}function i9(t,o,e,n,i){let r=[],a=i-n;for(let s=0;s<t.length-1;s++){let c=o[s+1]-e[s];c<0||r.push({left:e[s],top:n,width:c,height:a})}return r}function o9(t,o,e,n,i){let r=[],a=i-n;for(let s=0;s<t.length-1;s++){let c=o[s+1]-e[s];c<0||r.push({left:n,top:e[s],width:a,height:c})}return r}function rC(t,o,e){for(let n=1;n<o.length;n++){let i=o[n],r=e[n],a=t[n],s=n-1;for(;s>=0;){let c=o[s],u=t[s];if(c<i||c===i&&u<a)break;o[s+1]=c,e[s+1]=e[s],t[s+1]=u,s--}o[s+1]=i,e[s+1]=r,t[s+1]=a}}function So(t){return t<0?-t:t}var l_=class{_element;_isVisible=!1;_left=Number.NaN;_top=Number.NaN;_width=Number.NaN;_height=Number.NaN;constructor(o,e,n="f-rect"){this._element=o.document.createElement("div"),this._element.classList.add(n);let i=this._element.style;i.position="absolute",i.display="none",i.boxSizing="border-box",i.pointerEvents="none",e.appendChild(this._element)}show(){this._isVisible||(this._isVisible=!0,this._element.style.display="block")}hide(){this._isVisible&&(this._isVisible=!1,this._element.style.display="none")}render(o,e,n,i){let r=this._element.style;o!==this._left&&(this._left=o,r.left=o+"px"),e!==this._top&&(this._top=e,r.top=e+"px"),n!==this._width&&(this._width=n,r.width=n+"px"),i!==this._height&&(this._height=i,r.height=i+"px")}clearRect(){this._left=Number.NaN,this._top=Number.NaN,this._width=Number.NaN,this._height=Number.NaN;let o=this._element.style;o.removeProperty("left"),o.removeProperty("top"),o.removeProperty("width"),o.removeProperty("height")}destroy(){this._element.remove()}},c_=class{_browser;_hostElement;_className;_pool=[];_activeCount=0;constructor(o,e,n="f-rect"){this._browser=o,this._hostElement=e,this._className=n}draw(o,e){let n=e.scale,i=e.position.x+e.scaledPosition.x,r=e.position.y+e.scaledPosition.y;for(let a=0;a<o.length;a++){let s=this._getOrCreate(a),c=o[a];s.show(),s.render(c.left*n+i,c.top*n+r,c.width*n,c.height*n)}for(let a=o.length;a<this._activeCount;a++)this._pool[a].hide();this._activeCount=o.length}hideAll(){for(let o=0;o<this._activeCount;o++)this._pool[o].hide();this._activeCount=0}destroy(){for(let o of this._pool)o.destroy();this._pool.length=0,this._activeCount=0}_getOrCreate(o){if(o<this._pool.length)return this._pool[o];let e=new l_(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},cp=class{static fToken=Symbol("MagneticRectsPreparationRequest")},r9=(()=>{let t=class sc{_mediator=p(V);_store=p(L);_browser=p(at);_injector=p(dt);_dragSession=p(he);_renderer;handle(e){let n=this._store.instances.get(Xe.MAGNETIC_RECTS);if(!n)return;let i=this._dragSession.draggableItems.find(r=>r instanceof pi);i&&i.setMagneticRects(new d_(this._injector,this._getRenderer(n),this._notDraggedRects(this._draggedNodes(i.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_getRenderer(e){return this._renderer||(this._renderer=new c_(this._browser,e.hostElement)),this._renderer?.destroy(),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new it(r.hostElement)))}static \u0275fac=function(n){return new(n||sc)};static \u0275prov=y({token:sc,factory:sc.\u0275fac})};return t=P([R(cp)],t),t})(),d_=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(o,e,n){this._renderer=e,this._rects=n;let i=o.get(L),r=i.instances.require(Xe.MAGNETIC_RECTS);this._alignThreshold=r.alignThreshold(),this._spacingThreshold=r.spacingThreshold(),this._canvasTransform=i.transform}scheduleRender(o){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderRects(this._computeRects(o)),15)}_renderRects(o){if(o.axis!==void 0&&o.delta!==void 0&&o.rects.length>0){this._renderer.draw(o.rects,this._canvasTransform);return}this._renderer.hideAll()}_computeRects(o){return e9(this._rects,o,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},dp=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(o){this.event=o}},u_=class{nodes;fNodes;constructor(o){this.nodes=o,this.fNodes=o}},a9=(()=>{let t=class lc{_mediator=p(V);_store=p(L);_dragSession=p(he);_dragHandler;handle({event:e}){if(this._dragHandler=this._getDragHandler(),!this._dragHandler)return;let n=this._buildDragDelta(e.getPosition()),i=this._dragHandler.calculateMagneticSnaps(n),r=this._applySnapToDelta(n,i.lines,i.rects);this._finalizeMove(this._dragHandler,r),this._emitNodeIntersectIfNeeded(this._dragHandler)}_getDragHandler(){return this._dragSession.draggableItems.find(qB)}_buildDragDelta(e){return pe.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,i){let r=e.x,a=e.y;return n&&(r=this._hasLineSnapValue(n.x)?e.x-(n.x.delta||0):r,a=this._hasLineSnapValue(n.y)?e.y-(n.y.delta||0):a),this._hasRectSnapValue(i)&&(i.axis==="x"?(r=e.x-i.delta,a=e.y-(i.crossDelta??0)):(a=e.y-i.delta,r=e.x-(i.crossDelta??0))),{x:r,y:a}}_hasLineSnapValue(e){return e.guide!==void 0&&e.guide!==null}_hasRectSnapValue(e){return!!e&&e.axis!==void 0&&e.delta!==void 0}_finalizeMove(e,n){for(let i of e.roots)i.finalizeConstraints();e.onPointerMove(n),e.onPointerUp?.(),this._store.fDraggable?.fMoveNodes.emit(this._buildMoveNodesEvent(e))}_buildMoveNodesEvent(e){let n=e.getEvent(),a=((n.data??n.fData)?.fNodeIds??[]).map(s=>({id:s,position:this._store.nodes.get(s)?._position}));return new u_(a)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new Fu(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||lc)};static \u0275prov=y({token:lc,factory:lc.\u0275fac})};return t=P([R(dp)],t),t})(),up=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(o,e){this.event=o,this.trigger=e}},s9=(()=>{let t=class cc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({event:e,trigger:n}){if(!this._canStartDrag(e,n))return;let i=this._findDraggableNode(e.targetElement);i&&(this._storePointerDownContext(e),this._dragSession.draggableItems=[this._buildDragNodeHandler(i)],this._mediator.execute(new lp),this._mediator.execute(new cp))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&an(e.originalEvent,n)}_isDragHandle(e){return xr(e,".f-drag-handle")}_findDraggableNode(e){let n=this._store.nodes.getAll();for(let i of n)if(!i.fDraggingDisabled()&&i.isContains(e))return i}_storePointerDownContext(e){this._dragSession.onPointerDownScale=this._store.transform.scale,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new Vo(e))}),this._mediator.execute(new ap(e))}static \u0275fac=function(n){return new(n||cc)};static \u0275prov=y({token:cc,factory:cc.\u0275fac})};return t=P([R(up)],t),t})(),l9=[...ZB,JB,r9,a9,s9],p_=class{targetGroupId;nodeIds;dropPosition;fTargetNode;fNodes;fDropPosition;constructor(o,e,n){this.targetGroupId=o,this.nodeIds=e,this.dropPosition=n,this.fTargetNode=o,this.fNodes=e,this.fDropPosition=n}},c9=(()=>{let t=class dc{_dragSession=p(he);_store=p(L);handle({event:e}){let n=this._findDropHandler();if(!n)return;let i=n.activeTarget?.node;i&&this._emitDropToGroupEvent(i.fId(),e),n.onPointerUp?.()}_findDropHandler(){return this._dragSession.draggableItems.find(e=>e instanceof zr)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new p_(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(a=>a.nodeOrGroup),i=new Set(n.map(a=>a.fId())),r=[];for(let a of n){let s=a.fParentId();(!s||!i.has(s))&&r.push(a.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof pi);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||dc)};static \u0275prov=y({token:dc,factory:dc.\u0275fac})};return t=P([R(Qu)],t),t})(),pp=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(o){this.event=o}},hp=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(o){this.candidates=o}},d9=(()=>{let t=class uc{handle({candidates:e}){let n=e.map((i,r)=>({candidate:i,index:r}));return n.sort((i,r)=>{let a=this._compareDomOrder(i.candidate.node.hostElement,r.candidate.node.hostElement);return a!==0?-a:i.index-r.index}),n.map(i=>i.candidate)}_compareDomOrder(e,n){if(e===n)return 0;let i=e.compareDocumentPosition(n);if((i&Node.DOCUMENT_POSITION_FOLLOWING)!==0)return-1;if((i&Node.DOCUMENT_POSITION_PRECEDING)!==0)return 1;if(i&Node.DOCUMENT_POSITION_DISCONNECTED){let r=e.getBoundingClientRect?.()??{top:0,left:0},a=n.getBoundingClientRect?.()??{top:0,left:0};return r.top!==a.top?r.top<a.top?-1:1:r.left!==a.left?r.left<a.left?-1:1:0}return 0}static \u0275fac=function(n){return new(n||uc)};static \u0275prov=y({token:uc,factory:uc.\u0275fac})};return t=P([R(hp)],t),t})(),h_=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(o,e,n){this._onPointerDown=e,this._limit=n;let i=o.get(L);this._vCellSize=i.fDraggable.vCellSize(),this._hCellSize=i.fDraggable.hCellSize(),this._adjustCellSize=i.fDraggable.fCellSizeWhileDragging()}limit(o){let{min:e,max:n}=this._limit,{x:i,y:r}=this._cellSizeStrategies[+this._adjustCellSize](o);return{x:this._clamp(i,e.x,n.x),y:this._clamp(r,e.y,n.y)}}_cellSizeStrategies={0:this._skipCellSize.bind(this),1:this._applyCellSize.bind(this)};_applyCellSize(o){return{x:this._snapToGrid(this._onPointerDown.x+o.x,this._hCellSize)-this._onPointerDown.x,y:this._snapToGrid(this._onPointerDown.y+o.y,this._vCellSize)-this._onPointerDown.y}}_skipCellSize(o){return o}_clamp(o,e,n){return Math.min(Math.max(o,e),n)}_snapToGrid(o,e){return Math.round(o/e)*e}},fp=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(o){this.externalItem=o}},u9=(()=>{let t=class pc{_browser=p(at);_containerRef=p(Ka);handle({externalItem:e}){let{hostElement:n,placeholder:i}=e,r=i(),a=r?this._fromTemplate(r):this._fromHost(n);return a.classList.add("f-external-item-placeholder"),a.style.pointerEvents="none",a}_fromTemplate(e){return sm(this._createViewRef(e),this._browser.document)}_fromHost(e){return rm(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||pc)};static \u0275prov=y({token:pc,factory:pc.\u0275fac})};return t=P([R(fp)],t),t})(),mp=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(o){this.externalItem=o}},p9=(()=>{let t=class hc{_browser=p(at);_containerRef=p(Ka);handle({externalItem:e}){let{hostElement:n,preview:i}=e,r=i(),a=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(a),Jv(a),a.classList.add("f-external-item-preview"),a}_fromTemplate(e){return sm(this._createViewRef(e),this._browser.document)}_fromHost(e){return rm(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){am(e.style,{"pointer-events":"none",margin:"showPopover"in e?"0 auto 0 0":"0",position:"fixed",top:"0",left:"0","z-index":"1000"},new Set(["position"]))}static \u0275fac=function(n){return new(n||hc)};static \u0275prov=y({token:hc,factory:hc.\u0275fac})};return t=P([R(mp)],t),t})(),_p=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(o){this.event=o}},f_=class{externalItemRect;data;targetContainerId;dropPosition;rect;fTargetNode;fDropPosition;constructor(o,e,n,i){this.externalItemRect=o,this.data=e,this.targetContainerId=n,this.dropPosition=i,this.rect=o,this.fTargetNode=n,this.fDropPosition=i}},h9="external-item",f9="drag-external-item";function m9(t){return t.getEvent().kind===f9||t.getEvent().fEventType===h9}var _9=(()=>{let t=class fc{_result=p(hi);_mediator=p(V);_store=p(L);_dragSession=p(he);_browser=p(at);get _createNodeEmitter(){return this._store.fDraggable?.fCreateNode}handle(e){let n=this._findExternalItemHandler();if(!n)return;let i=this._getDestinationNodeOrGroupId();this._emitEvent(this._getElementsFromPoint(e.event.getPosition()),i,e.event.getPosition()),n.onPointerUp(),this._dragSession.draggableItems=[]}_findExternalItemHandler(){return this._dragSession.draggableItems.find(e=>m9(e))}_getDestinationNodeOrGroupId(){let e=this._getDropToGroupHandler(),n=e.activeTarget?.node.fId();return e.onPointerUp?.(),n}_getDropToGroupHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof zr);if(!e)throw new Error("NodeDragToParentDragHandler not found");return e}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y).filter(n=>!n.closest(".f-external-item")&&!n.closest(".f-external-item-preview"))}_emitEvent(e,n,i){this._isPointerInCanvasRect(e)&&this._createNodeEmitter?.emit(new f_(this._getPreviewRect(),this._result.getData().externalItem.data(),n,n?i:void 0))}_isPointerInCanvasRect(e){return e.length?this._store.flowHost.contains(e[0]):!1}_getPreviewRect(){return this._mediator.execute(new it(this._result.getData().preview))}static \u0275fac=function(n){return new(n||fc)};static \u0275prov=y({token:fc,factory:fc.\u0275fac})};return t=P([R(_p)],t),t})(),m_=class{data;constructor(o){this.data=o}},gp=class extends Ft{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new m_(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=te.initialize();_pointerDownRect=te.initialize();_absoluteOffsetFromFlow=U.initialize();_grabOffsetFromPointer=U.initialize();_originalParent;_originalNextSibling;_originalDisplay;_applyConstraints=o=>o;constructor(o,e,n){super(),this._externalItem=e,this._pointerDownClientPosition=n,this._store=o.get(L),this._result=o.get(hi),this._mediator=o.get(V),this._browser=o.get(at),this._originalDisplay=this._host.style.display,this._initConstraints(o)}get _host(){return this._externalItem.hostElement}get _overlayRoot(){return this._browser.document.fullscreenElement??this._browser.document.body}get _transform(){return this._store.transform}_initConstraints(o){this._startRect=this._getStartRect();let e=new h_(o,this._startRect,Ky());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new it(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=pe.fromPoint(this._pointerDownRect).sub(this._toAbsolutePoint(this._startRect)),this._grabOffsetFromPointer=this._clientToAbsolute(this._pointerDownClientPosition).sub(this._pointerDownRect),this._rememberOriginalPlacement(),this._previewEl=this._createPreview(),this._placeholderEl=this._createPlaceholder(),this._placePreviewIntoOverlay(),this._swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(),this._result.setData({preview:this._previewEl,externalItem:this._externalItem})}_rememberOriginalPlacement(){let o=this._host.parentNode;if(!o){this._originalParent=void 0,this._originalNextSibling=null;return}this._originalParent=o,this._originalNextSibling=this._host.nextSibling}_createPreview(){let o=this._mediator.execute(new mp(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(o,this._pointerDownRect),o.style.transform=Cy(this._pointerDownRect),o}_createPlaceholder(){return this._mediator.execute(new fp(this._externalItem))}_placePreviewIntoOverlay(){this._overlayRoot.appendChild(this._previewEl)}_swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(){let o=this._originalParent,e=this._placeholderEl;if(!o||!e)return;let n=o.replaceChild(e,this._host);this._overlayRoot.appendChild(n),this._host.style.display="none"}onPointerMove(o,e){if(!this._previewEl)return;let n=this._resolveDeltaFromPointer(o,e),i=this._applyConstraints(n),r=pe.fromPoint(this._startRect).add(i),a=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=Cy(a)}onPointerUp(){this._previewEl&&this._previewEl.parentNode&&this._previewEl.parentNode.removeChild(this._previewEl),this._restoreOriginalInParent(),this._host.style.display=this._originalDisplay||"block",this._previewEl=void 0,this._placeholderEl=void 0,this._originalParent=void 0,this._originalNextSibling=null}_restoreOriginalInParent(){let o=this._originalParent,e=this._placeholderEl;if(!(!o||!e)){if(e.parentNode===o){o.replaceChild(this._host,e);return}this._originalNextSibling&&this._originalNextSibling.parentNode===o?o.insertBefore(this._host,this._originalNextSibling):o.appendChild(this._host)}}_matchSize(o,e){o.style.width=`${e.width}px`,o.style.height=`${e.height}px`}_readAbsoluteRect(o){let e=o.getBoundingClientRect(),n=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,i=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return te.initialize(e.left+i,e.top+n,e.width,e.height)}_toAbsolutePoint(o){let e=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition);return pe.fromPoint(o).mult(this._transform.scale).add(e).add(this._getFlowHostAbsolutePosition())}_resolveDeltaFromPointer(o,e){let n=e?.getPosition();if(!n)return o;let i=this._clientToAbsolute(n).sub(this._grabOffsetFromPointer),r=this._toFlowPoint(i);return pe.fromPoint(r).sub(this._startRect)}_toFlowPoint(o){let e=this._getFlowHostAbsolutePosition(),n=pe.fromPoint(this._transform.position).add(this._transform.scaledPosition);return pe.fromPoint(o).sub(e).sub(n).div(this._transform.scale)}_getFlowHostAbsolutePosition(){let o=this._store.flowHost.getBoundingClientRect(),e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return U.initialize(o.left+n,o.top+e)}_clientToAbsolute(o){let e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return pe.fromPoint(o).add(U.initialize(n,e))}};function Cy({x:t,y:o}){return`translate3d(${Math.round(t)}px, ${Math.round(o)}px, 0)`}var bp=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}};function g9(t){return!!t.closest?.("[fExternalItem]")}function b9(t){return t.closest("[fExternalItem]")}var v9=(()=>{class t{_byHost=new Map;_items=X([]);items=E(()=>this._items());getByElement(e){let n=b9(e);return n?this._byHost.get(n):void 0}getByHost(e){return this._byHost.get(e)}register(e){let n=e.hostElement,i=this._byHost.get(n);i!==e&&(i&&i!==e&&this._byHost.delete(n),this._byHost.set(n,e),this._sync())}remove(e){let n=e.hostElement;this._byHost.get(n)===e&&(this._byHost.delete(n),this._sync())}_sync(){this._items.set([...this._byHost.values()])}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var y9=(()=>{let t=class mc{_apiService=p(v9);_dragSession=p(he);_store=p(L);_injector=p(dt);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!an(e.originalEvent,n))return;let i=this._resolveExternalItem(e.targetElement);if(!i||i.disabled())return;let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new gp(this._injector,i,e.getPosition())]}_resolveExternalItem(e){return this._apiService.getByElement(e)}static \u0275fac=function(n){return new(n||mc)};static \u0275prov=y({token:mc,factory:mc.\u0275fac})};return t=P([R(bp)],t),t})(),vp=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(o){this.event=o}},C9=(()=>{let t=class _c{handle(e){this._isTargetItemExternal(e.event)&&e.event.preventDefault()}_isTargetItemExternal(e){let n=this._isExternalItem(e.target),i=this._isExternalItem(e.target.parentNode);return n||i}_isExternalItem(e){let n=!1;try{n=g9(e)}catch{}return n}static \u0275fac=function(n){return new(n||_c)};static \u0275prov=y({token:_c,factory:_c.\u0275fac})};return t=P([R(vp)],t),t})(),x9=[u9,p9,_9,y9,C9],w9=(()=>{let t=class gc{_mediator=p(V);_dragContext=p(he);_store=p(L);_dragInjector=p(Ct);get _allNodes(){return this._store.nodes.getAll()}handle({event:e}){if(!this._canPrepare())return;let n=this._allNodes.find(a=>a.isContains(e.targetElement));if(!n&&!this._hasExternalDrag())throw new Error("Drag target node not found");let i=this._sortedTargetsForDrop();if(n){let a=n.fParentId(),s=this._mediator.execute(new Yp(a));s.length&&(i=i.filter(c=>s.includes(c.node.fId())))}let r=this._dragInjector.get(zr);r.initialize(i),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof pi)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof gp)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(s=>s instanceof Km),i=this._withParents(e),a=this._eligibleTargets(i,n).map(s=>{let c=this._mediator.execute(new it(s.hostElement));return{node:s,rect:c}});return this._mediator.execute(new hp(a))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof pi);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,i)=>{n.push(i);let r=this._mediator.execute(new Ao(i));return n.push(...r),n},[])}_eligibleTargets(e,n){let i=this._allNodes.filter(r=>!e.includes(r));return n?i.filter(r=>r instanceof Km):i}static \u0275fac=function(n){return new(n||gc)};static \u0275prov=y({token:gc,factory:gc.\u0275fac})};return t=P([R(pp)],t),t})(),T9=[d9,w9,c9],yp=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(o){this.event=o}},S9=.5,Cp=(()=>{class t extends Ft{type="pinch-to-zoom";kind="pinch-to-zoom";_store=p(L);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(Xe.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=xy(this._touches);e!=null&&(this._startDistance=e,this._startScale=this._canvas.transform.scale)}onPointerMove(e,n){if(n.touches.length!==2||this._startDistance==null||this._startScale==null)return;let i=xy(n.touches),r=k9(n.touches);if(i==null||r==null){this._reset();return}if(Math.abs(i-this._startDistance)<S9)return;n.preventDefault();let a=i/this._startDistance,s=this._clamp(this._startScale*a);this._canvas.setScale(s,this._castPositionToFlow(r)),this._canvas.redraw()}_clamp(e){return Math.max(this._zoomComponent.minimum,Math.min(e,this._zoomComponent.maximum))}_castPositionToFlow(e){return pe.fromPoint(e).elementTransform(this._flowHost)}_reset(){this._startScale=null,this._startDistance=null}onPointerUp(){this._reset(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function k9(t){if(t.length!==2)return null;let o=t[0],e=t[1];return U.initialize((o.clientX+e.clientX)/2,(o.clientY+e.clientY)/2)}function xy(t){if(t.length!==2)return null;let o=t[0],e=t[1];return Math.hypot(e.clientX-o.clientX,e.clientY-o.clientY)}var I9=(()=>{let t=class bc{_dragSession=p(he);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof Cp)}static \u0275fac=function(n){return new(n||bc)};static \u0275prov=y({token:bc,factory:bc.\u0275fac})};return t=P([R(yp)],t),t})(),xp=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(o){this.event=o}},E9=(()=>{let t=class vc{_dragInjector=p(Ct);_store=p(L);_dragSession=p(he);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new pe,this._dragSession.draggableItems=[this._getHandler(e)])}_canStart(e){return this._dragSession.isEmpty()&&e.touches?.length===2&&!e.isEventInLockedContext&&this._hasZoomComponent()}_hasZoomComponent(){return this._store.instances.has(Xe.ZOOM)}_getHandler(e){let n=this._dragInjector.get(Cp);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||vc)};static \u0275prov=y({token:vc,factory:vc.\u0275fac})};return t=P([R(xp)],t),t})(),M9=[E9,I9],wp=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(o){this.event=o}},D9=(()=>{let t=class yc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>e.getEvent().kind==="selection-area")}static \u0275fac=function(n){return new(n||yc)};static \u0275prov=y({token:yc,factory:yc.\u0275fac})};return t=P([R(wp)],t),t})(),__=(()=>{class t extends Ft{type="selection-area";kind="selection-area";_store=p(L);_dragSession=p(he);_mediator=p(V);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return pe.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(Xe.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new lh),this._show(),this._draw(te.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=pe.fromPoint(e).add(this._dragSession.onPointerDownPosition),i=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),a=Math.abs(e.y),s=te.initialize(i.x,i.y,r,a);this._draw(s),this._selectedByMove=[],this._canBeSelected.forEach(c=>{c.element.unmarkAsSelected();let u=te.addPoint(te.mult(c.fRect,this._transform.scale),this._canvasPosition);te.intersectionWithRect(u,s)&&(c.element.markAsSelected(),this._selectedByMove.push(c.element))}),this._mediator.execute(new si)}_getMinimumPoint(e,n){return U.initialize(Math.min(e.x,n.x),Math.min(e.y,n.y))}onPointerUp(){this._hide(),this._dragSession.selectedItems.push(...this._selectedByMove),this._selectedByMove.length>0&&(this._dragSession.isSelectedChanged=!0)}_draw(e){let n=this._instance.hostElement.style;n.left=e.x+"px",n.top=e.y+"px",n.width=e.width+"px",n.height=e.height+"px"}_show(){this._instance.hostElement.style.display="block"}_hide(){this._instance.hostElement.style.display="none"}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Tp=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(o){this.event=o}},P9=(()=>{let t=class Cc{_store=p(L);_dragSession=p(he);_dragInjector=p(Ct);get _instance(){return this._store.instances.get(Xe.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(__)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&an(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||Cc)};static \u0275prov=y({token:Cc,factory:Cc.\u0275fac})};return t=P([R(Tp)],t),t})(),R9=[P9,D9],Sp=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(o,e){this.rect=o,this.childrenBounds=e}},O9=(()=>{let t=class xc{handle({rect:e,childrenBounds:n}){n&&this._apply(e,n)}_apply(e,n){this._restrictLeft(e,n),this._restrictTop(e,n),this._restrictRight(e,n),this._restrictBottom(e,n),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_restrictLeft(e,n){let i=e.x-n.x;i>0&&(e.x-=i,e.width+=i)}_restrictTop(e,n){let i=e.y-n.y;i>0&&(e.y-=i,e.height+=i)}_restrictRight(e,n){let i=n.x+n.width;e.x+e.width<=i&&(e.width=i-e.x)}_restrictBottom(e,n){let i=n.y+n.height;e.y+e.height<=i&&(e.height=i-e.y)}static \u0275fac=function(n){return new(n||xc)};static \u0275prov=y({token:xc,factory:xc.\u0275fac})};return t=P([R(Sp)],t),t})(),kp=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(o,e){this.rect=o,this.limits=e}},F9=(()=>{let t=class wc{_mediator=p(V);handle({rect:e,limits:n}){this._applyResizeConstraints(e,n)}_applyResizeConstraints(e,n){if(!n)return;let i=this._clampedCopyForCalculation(e,n);this._applySoftParentExpansions(i,n.softLimits),n.hardLimit&&this._clampRectToInner(e,n.hardLimit.innerRect)}_clampedCopyForCalculation(e,n){let i=ge({},e);return n.hardLimit&&this._clampRectToInner(i,n.hardLimit.innerRect),i}_clampRectToInner(e,n){if(e.x<n.x){let a=n.x-e.x;e.x+=a,e.width-=a}if(e.y<n.y){let a=n.y-e.y;e.y+=a,e.height-=a}let i=n.x+n.width;e.x+e.width>i&&(e.width=i-e.x);let r=n.y+n.height;e.y+e.height>r&&(e.height=r-e.y),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_applySoftParentExpansions(e,n){if(n?.length)for(let i of n)this._expandParentFromOriginalIfOverflow(e,i)}_expandParentFromOriginalIfOverflow(e,n){let i=n.innerRect,r=n.boundingRect,a=this._computeOverflow(i,e);if(!this._hasOverflow(a)){this._applyParentRect(n,r);return}let s=this._buildExpandedParentRect(r,a);this._applyParentRect(n,s)}_hasOverflow(e){return!!(e.left||e.top||e.right||e.bottom)}_computeOverflow(e,n){let i=Math.max(0,e.x-n.x),r=Math.max(0,e.y-n.y),a=Math.max(0,n.x+n.width-(e.x+e.width)),s=Math.max(0,n.y+n.height-(e.y+e.height));return{left:i,top:r,right:a,bottom:s}}_buildExpandedParentRect(e,n){let i=ge({},e);return n.left&&(i.x=e.x-n.left,i.width=e.width+n.left),n.top&&(i.y=e.y-n.top,i.height=e.height+n.top),n.right&&(i.width=(i.width??e.width)+n.right),n.bottom&&(i.height=(i.height??e.height)+n.bottom),i}_applyParentRect(e,n){e.nodeOrGroup.updatePosition(n),e.nodeOrGroup.updateSize(n),this._mediator.execute(new Vi(e.nodeOrGroup.fId(),n)),e.nodeOrGroup.redraw()}static \u0275fac=function(n){return new(n||wc)};static \u0275prov=y({token:wc,factory:wc.\u0275fac})};return t=P([R(kp)],t),t})(),Ip=class{originalRect;difference;handleType;minimumSize;static fToken=Symbol("CalculateChangedRectFromDifferenceRequest");constructor(o,e,n,i){this.originalRect=o,this.difference=e,this.handleType=n,this.minimumSize=i}},wy={[In.LEFT]:{x:-1,y:0},[In.LEFT_TOP]:{x:-1,y:-1},[In.TOP]:{x:0,y:-1},[In.RIGHT_TOP]:{x:1,y:-1},[In.RIGHT]:{x:1,y:0},[In.RIGHT_BOTTOM]:{x:1,y:1},[In.BOTTOM]:{x:0,y:1},[In.LEFT_BOTTOM]:{x:-1,y:1}},N9=(()=>{let t=class Tc{handle({originalRect:e,difference:n,handleType:i,minimumSize:r}){let a=this._changeSizeInRect(e,n,wy[i],r);return this._changePosition(e,n,wy[i],a)}_changeSizeInRect(e,n,i,r){let a=e.width+i.x*n.x,s=e.height+i.y*n.y,c=0,u=0;return a<0&&(c=a,a=Math.abs(a)),a<r.width&&(i.x===-1&&(c+=a-r.width),a=r.width),s<0&&(u=s,s=Math.abs(s)),s<r.height&&(i.y===-1&&(u+=s-r.height),s=r.height),te.initialize(c,u,a,s)}_changePosition(e,n,i,r){let a=e.x+(i.x===-1?n.x:0)+r.x,s=e.y+(i.y===-1?n.y:0)+r.y;return te.initialize(a,s,r.width,r.height)}static \u0275fac=function(n){return new(n||Tc)};static \u0275prov=y({token:Tc,factory:Tc.\u0275fac})};return t=P([R(Ip)],t),t})(),Ep=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(o,e){this.nodeOrGroup=o,this.paddings=e}},A9=(()=>{let t=class Sc{_mediator=p(V);_store=p(L);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let i=te.union(this._calculateDirectChildren(e.fId()).map(r=>this._normalizeRect(r)));return i?this._concatRectWithParentPadding(i,n):null}_calculateDirectChildren(e){return this._allNodesAndGroups.filter(n=>n.fParentId()===e)}_normalizeRect(e){return this._mediator.execute(new it(e.hostElement))}_concatRectWithParentPadding(e,n){return te.initialize(e.x-n[0],e.y-n[1],e.width+n[0]+n[2],e.height+n[1]+n[3])}static \u0275fac=function(n){return new(n||Sc)};static \u0275prov=y({token:Sc,factory:Sc.\u0275fac})};return t=P([R(Ep)],t),t})(),$r=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(o,e){this.nodeOrGroup=o,this.rect=e}},L9=(()=>{let t=class kc{_mediator=p(V);handle({nodeOrGroup:e,rect:n}){let i=this._getParentsChain(e),r=this._calculateNodePaddings(e,n);return{limits:this._buildSoftHardLimits(i),childrenBounds:this._getNormalizedChildrenBounds(e,r),minimumSize:Ot.initialize(r[0]+r[2],r[1]+r[3])}}_calculateNodePaddings(e,n){return this._mediator.execute(new Gi(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new Ep(e,n))}_getParentsChain(e){return this._mediator.execute(new Ao(e))??[]}_buildSoftHardLimits(e){let n=[],i,r=[0,0,0,0];for(let a of e){let s=this._getParentInfo(a,r);if(r=s.paddings,this._isAutoExpand(a))n.push(this._makeLimit(a,s));else{i=this._makeLimit(a,s);break}}return{softLimits:n,hardLimit:i}}_getParentInfo(e,n){return this._mediator.execute(new Hr(e,n))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeLimit(e,{boundingRect:n,innerRect:i}){return{nodeOrGroup:e,boundingRect:n,innerRect:i}}static \u0275fac=function(n){return new(n||kc)};static \u0275prov=y({token:kc,factory:kc.\u0275fac})};return t=P([R($r)],t),t})(),Mp=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(o){this.event=o}},aC="node-resize",sC="resize-node";function B9(t){return t.getEvent().kind===sC||t.getEvent().fEventType===aC}var V9=(()=>{let t=class Ic{_dragSession=p(he);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>B9(e))}static \u0275fac=function(n){return new(n||Ic)};static \u0275prov=y({token:Ic,factory:Ic.\u0275fac})};return t=P([R(Mp)],t),t})(),g_=class{fNodeId;constructor(o){this.fNodeId=o}},b_=(()=>{class t extends Ft{type=aC;kind=sC;data(){return new g_(this._nodeOrGroup.fId())}_mediator=p(V);_baselineRect;_constraints;_lastRect=null;_nodeOrGroup;_handleType;_nodeConnections={source:[],target:[]};_softParentConnections=[];initialize(e,n){this._nodeOrGroup=e,this._handleType=n}setNodeConnectionHandlers(e){this._nodeConnections=e}setSoftParentConnectionHandlers(e){this._softParentConnections=e}prepareDragSequence(){this._baselineRect=this._readBaselineRect(),this._constraints=this._buildConstraints(this._baselineRect),this._lastRect=this._baselineRect}onPointerMove(e){let n=this._calcNextRect(e);this._applyConstraints(n),this._commitRect(n),this._applyConnectionHandlers(this._nodeConnections);for(let i of this._softParentConnections)this._applyConnectionHandlers(i);this._lastRect=n}onPointerUp(){let e=this._lastRect??this._fallbackRectFromModel();this._nodeOrGroup.sizeChange.emit(e),requestAnimationFrame(()=>this._nodeOrGroup.refresh())}_readBaselineRect(){return this._mediator.execute(new it(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new $r(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new Ip(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Sp(e,this._constraints.childrenBounds)),this._mediator.execute(new kp(e,this._constraints.limits))}_commitRect(e){this._nodeOrGroup.updatePosition({x:e.x,y:e.y}),this._nodeOrGroup.updateSize({width:e.width,height:e.height}),this._mediator.execute(new Vi(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return te.initialize(this._nodeOrGroup._position.x,this._nodeOrGroup._position.y,this._nodeOrGroup._size?.width,this._nodeOrGroup._size?.height)}_applyConnectionHandlers(e){if(!e.source.length&&!e.target.length)return;let n=new Map;for(let i of e.source){let r=this._readConnectorRect(i.connector,n);i.handler.setSourceRect(r)}for(let i of e.target){let r=this._readConnectorRect(i.connector,n);i.handler.setTargetRect(r)}}_readConnectorRect(e,n){let i=`${e.kind}::${e.fId()}`,r=n.get(i);if(r)return r;let a=this._mediator.execute(new di(e.hostElement,!1));return n.set(i,a),a}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Wr=class{_mediator=p(V);_store=p(L);_behaviour=p(Ho);_source;_target;_sourceRef;_targetRef;_sourceRect;_targetRect;connection;initialize(o){this.connection=o,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target),this._sourceRect=rt.fromRoundedRect(this._sourceRef.rect),this._targetRect=rt.fromRoundedRect(this._targetRef.rect)}setSourceRect(o){this._sourceRect=rt.fromRoundedRect(o),this._mediator.execute(new Bi(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(o){this._targetRect=rt.fromRoundedRect(o),this._mediator.execute(new Bi(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let o=this._buildLine();this.connection.setLine(o),this.connection.redraw()}_buildLine(){let o=rt.fromRoundedRect(this._sourceRect),e=rt.fromRoundedRect(this._targetRect);return this._behaviour.handle(new vn(o,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(o){return{connector:o,rect:this._mediator.execute(new di(o.hostElement,!1))}}_resolveRotationContext(o){return this._mediator.execute(new zn(o))}},z9=(()=>{class t extends Wr{_sourceUpdated=!1;_targetUpdated=!1;setSourceRect(e){super.setSourceRect(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetRect(e){super.setTargetRect(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,super.redraw())}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),H9=(()=>{class t extends Wr{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),q9=(()=>{class t extends Wr{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Dp=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},Pp=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(o,e){this.handler=o,this.nodeOrGroup=e}},G9=(()=>{let t=class Ec{_store=p(L);_mediator=p(V);_dragInjector=p(Ct);handle({handler:e,nodeOrGroup:n}){let i=this._readSoftParents(n),r=[n,...i],a=this._collectSourceConnectorIds(r),s=this._collectTargetConnectorIds(r),c=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,a,s,c)),e.setSoftParentConnectionHandlers(i.map(u=>this._buildConnectionHandlersForNode(u,a,s,c)))}_readSoftParents(e){let n=this._mediator.execute(new it(e.hostElement));return this._mediator.execute(new $r(e,n)).limits.softLimits.map(r=>r.nodeOrGroup)}_collectSourceConnectorIds(e){let n=new Set(e.map(i=>i.fId()));return new Set(this._store.outputs.getAll().filter(i=>n.has(i.fNodeId)).map(i=>i.fId()))}_collectTargetConnectorIds(e){let n=new Set(e.map(i=>i.fId()));return new Set(this._store.inputs.getAll().filter(i=>n.has(i.fNodeId)).map(i=>i.fId()))}_buildConnectionHandlersForNode(e,n,i,r){let a=this._store.outputs.getAll().filter(g=>g.fNodeId===e.fId()),s=this._store.inputs.getAll().filter(g=>g.fNodeId===e.fId());if(!a.length&&!s.length)return{source:[],target:[]};let c=new Set(a.map(g=>g.fId())),u=new Set(s.map(g=>g.fId())),h={source:[],target:[]};for(let g of this._store.connections.getAll()){let C=c.has(g.fOutputId()),k=u.has(g.fInputId());if(!C&&!k)continue;let I=r.get(g.fId())??this._createConnectionHandler(g,n,i);if(r.set(g.fId(),I),C){let N=this._store.outputs.require(g.fOutputId());h.source.push({handler:I,connector:N})}if(k){let N=this._store.inputs.require(g.fInputId());h.target.push({handler:I,connector:N})}}return h}_createConnectionHandler(e,n,i){let r=n.has(e.fOutputId()),a=i.has(e.fInputId()),s=r&&a?this._dragInjector.createInstance(z9):r?this._dragInjector.createInstance(H9):this._dragInjector.createInstance(q9);return s.initialize(e),s}static \u0275fac=function(n){return new(n||Ec)};static \u0275prov=y({token:Ec,factory:Ec.\u0275fac})};return t=P([R(Pp)],t),t})(),j9=(()=>{let t=class Mc{_mediator=p(V);_store=p(L);_dragSession=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!an(e.originalEvent,n))return;let i=this._findResizableNode(e.targetElement);if(!i)return;this._selectBeforeResize(i);let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let a=this._dragInjector.createInstance(b_);a.initialize(i,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new Pp(a,i)),this._dragSession.draggableItems=[a]}_isResizeHandle(e){return xr(e,".f-resize-handle")}_findResizableNode(e){let n=this._store.nodes.getAll().find(i=>i.isContains(e));if(n)return n.fDraggingDisabled()?void 0:n}_selectBeforeResize(e){queueMicrotask(()=>{this._mediator.execute(new Vo(e))})}_readResizeHandleType(e){let n=ey(e,"fResizeHandleType",".f-resize-handle");return In[n]}static \u0275fac=function(n){return new(n||Mc)};static \u0275prov=y({token:Mc,factory:Mc.\u0275fac})};return t=P([R(Dp)],t),t})(),U9=[O9,F9,N9,A9,L9,G9,V9,j9],Rp=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(o){this.event=o}},lC="node-rotate",cC="rotate-node";function $9(t){return t.getEvent().kind===cC||t.getEvent().fEventType===lC}var W9=(()=>{let t=class Dc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>$9(e))}static \u0275fac=function(n){return new(n||Dc)};static \u0275prov=y({token:Dc,factory:Dc.\u0275fac})};return t=P([R(Rp)],t),t})(),Op=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},v_=class{fNodeId;constructor(o){this.fNodeId=o}};function K9(t,o,e){let{x:n,y:i}=Y9(t,o,e),r=n-t.x,a=i-t.y;return{x:r,y:a}}function Y9(t,o,e){let n=t.x-e.x,i=t.y-e.y,r=o*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=n*a-i*s,u=n*s+i*a,h=c+e.x,g=u+e.y;return{x:h,y:g}}var y_=(()=>{class t extends Ft{type=lC;kind=cC;data(){return new v_(this._nodeOrGroup.fId())}_store=p(L);_mediator=p(V);_dragSession=p(he);_nodeOrGroup;_sourceConnections;_targetConnections;_startRotation=0;_nodeRect;_nodeCenter;_pointerDownInFlow;_rotationOffsetDeg=0;get _transform(){return this._store.transform}initialize(e,n,i){this._nodeOrGroup=e,this._sourceConnections=n,this._targetConnections=i,this._startRotation=this._nodeOrGroup._rotate}prepareDragSequence(){this._nodeRect=this._readNodeRect(),this._nodeCenter=this._nodeRect.gravityCenter,this._pointerDownInFlow=this._calculatePointerDownInFlow();let e=this._angleDeg(this._pointerDownInFlow);this._rotationOffsetDeg=e-this._startRotation}onPointerMove(e){let n=U.sum(this._pointerDownInFlow,e),r=this._angleDeg(n)-this._rotationOffsetDeg;this._applyRotation(r);let a=r-this._startRotation;for(let s of this._sourceConnections)s.connection.setSourceDelta(this._deltaAfterRotation(s.connector,a));for(let s of this._targetConnections)s.connection.setTargetDelta(this._deltaAfterRotation(s.connector,a))}onPointerUp(){this._nodeOrGroup.rotate.set(this._nodeOrGroup._rotate),this._nodeOrGroup.refresh()}_readNodeRect(){return this._mediator.execute(new it(this._nodeOrGroup.hostElement))}_calculatePointerDownInFlow(){return U.sub(this._dragSession.onPointerDownPosition,U.sum(this._transform.position,this._transform.scaledPosition))}_angleDeg(e){return Math.atan2(e.y-this._nodeCenter.y,e.x-this._nodeCenter.x)*(180/Math.PI)}_applyRotation(e){this._nodeOrGroup.updateRotate(e),this._nodeOrGroup.redraw()}_deltaAfterRotation(e,n){return K9(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),X9=(()=>{let t=class Pc{_mediator=p(V);_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);get _transform(){return this._store.transform}handle(e){if(!this._isPreparationAllowed(e))return;let n=this._findRotatableNode(e.event.targetElement);if(!n)return;this._selectBeforeRotate(n);let i=this._transform.scale;this._dragContext.onPointerDownScale=i,this._dragContext.onPointerDownPosition=pe.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(i);let r=this._dragInjector.createInstance(y_);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&vB(e.targetElement)&&an(e.originalEvent,n)}_findRotatableNode(e){for(let n of this._store.nodes.getAll())if(!n.fDraggingDisabled()&&n.isContains(e))return n}_selectBeforeRotate(e){queueMicrotask(()=>{this._mediator.execute(new Vo(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new Vp(e)).map(n=>{let i=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new Kt(i)),a=this._dragInjector.get(Ur);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new Kp(e)).map(n=>{let i=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new Kt(i)),a=this._dragInjector.get(Gr);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||Pc)};static \u0275prov=y({token:Pc,factory:Pc.\u0275fac})};return t=P([R(Op)],t),t})(),Z9=[W9,X9],Kr=class{flowRect;canvasPosition;eventPoint;minimap;static fToken=Symbol("CalculateFlowPointFromMinimapPointRequest");constructor(o,e,n,i){this.flowRect=o,this.canvasPosition=e,this.eventPoint=n,this.minimap=i}},Q9=(()=>{let t=class Rc{_store=p(L);get _canvasScale(){return this._store.transform.scale||1}handle(e){return U.sub(e.canvasPosition,U.sub(this._getPositionInViewBox(e.eventPoint,e.minimap),this._getNormalizedFlowCenter(e.flowRect)))}_getNormalizedFlowCenter(e){return pe.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let i=this.normalizeEventPoint(e,n);return U.sum(i,te.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return pe.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||Rc)};static \u0275prov=y({token:Rc,factory:Rc.\u0275fac})};return t=P([R(Kr)],t),t})(),Fp=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(o){this.event=o}},J9=(()=>{let t=class Oc{_dragSession=p(he);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(eV)}static \u0275fac=function(n){return new(n||Oc)};static \u0275prov=y({token:Oc,factory:Oc.\u0275fac})};return t=P([R(Fp)],t),t})(),dC="minimap",uC="minimap";function eV(t){return t.getEvent().kind===uC||t.getEvent().fEventType===dC}var C_=(()=>{class t extends Ft{type=dC;kind=uC;_store=p(L);_mediator=p(V);_lastDelta=null;_flowRect;_startCanvasPosition;_eventPoint;_minimap;initialize(e,n,i,r){this._flowRect=e,this._startCanvasPosition=n,this._eventPoint=i,this._minimap=r}prepareDragSequence(){this._store.fCanvas?.hostElement.classList.add("f-scaled-animate")}onPointerMove(e){this._lastDelta&&this._isSamePoint(e,this._lastDelta)||(this._lastDelta=e,this._store.fCanvas?.setPosition(this._getNewPosition(pe.fromPoint(this._eventPoint).add(e))),this._store.fCanvas?.redraw())}_isSamePoint(e,n){return e.x===n.x&&e.y===n.y}_getNewPosition(e){return this._mediator.execute(new Kr(this._flowRect,this._startCanvasPosition,e,this._minimap))}onPointerUp(){this._store.fCanvas?.hostElement.classList.remove("f-scaled-animate"),this._store.fCanvas?.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Np=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(o){this.event=o}},tV=(()=>{let t=class Fc{_store=p(L);_mediator=p(V);_dragSession=p(he);_dragInjector=p(Ct);get _canvas(){return this._store.fCanvas}get _flowHost(){return this._store.flowHost}handle({event:e}){if(!this._isValid(e))return;let n=this._store.instances.require(Xe.MINIMAP).state,i=e.getPosition(),r=pe.fromPoint(this._store.transform.position),a=te.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(a,i,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=pe.fromPoint(i).elementTransform(this._flowHost);let s=this._dragInjector.createInstance(C_);s.initialize(a,r,i,n),this._dragSession.draggableItems=[s]}_isValid(e){return!(!this._dragSession.isEmpty()||!this._flowHost.contains(e.targetElement)||!e.targetElement.closest(".f-minimap")||!this._store.instances.get(Xe.MINIMAP))}_calculateCanvasPosition(e,n,i){return this._mediator.execute(new Kr(e,pe.fromPoint(this._canvas.transform.position),n,i))}static \u0275fac=function(n){return new(n||Fc)};static \u0275prov=y({token:Fc,factory:Fc.\u0275fac})};return t=P([R(Np)],t),t})(),nV=[Q9,J9,tV];function iV(t){return!!t&&typeof t.destroy=="function"}var Ct=(()=>{class t{_injector=p(dt);_dragInjector=null;_created=[];create(){this._dragInjector=dt.create({providers:[{provide:Ap,useClass:Ap},{provide:Xu,useClass:Xu},{provide:Hu,useClass:Hu},{provide:Jm,useClass:Jm},{provide:zr,useClass:zr},{provide:Gr,useClass:Gr},{provide:Ur,useClass:Ur},{provide:jr,useClass:jr},{provide:pi,useClass:pi},{provide:Cp,useClass:Cp},{provide:__,useClass:__},{provide:b_,useClass:b_},{provide:y_,useClass:y_},{provide:C_,useClass:C_}],parent:this._injector}),this._created=[]}get(e){if(!this._dragInjector)throw new Error("DragHandlerInjector has not been created. Call create() before using get().");return this._dragInjector.get(e)}createInstance(e){if(!this._dragInjector)throw new Error("DragHandlerInjector is not created");let n=C0(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)iV(e)&&e.destroy();this._created=[],this._dragInjector?.destroy?.(),this._dragInjector=null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),hi=(()=>{class t{_data;setData(e){this._data=ge(ge({},this._data),e)}getData(){return this._data}clear(){this._data=void 0}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ty="f-canvas-dragging",Sy="canvas-dragging",Ap=(()=>{class t extends Ft{type="canvas-move";kind="drag-canvas";_store=p(L);_onPointerDownPosition=U.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(Ty,Sy)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(pe.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(Ty,Sy)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),oV=(()=>{let t=class Nc{_dragContext=p(he);handle(e){this._isValid()&&this._dragContext.draggableItems.forEach(n=>n.onPointerUp?.())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Ap)}static \u0275fac=function(n){return new(n||Nc)};static \u0275prov=y({token:Nc,factory:Nc.\u0275fac})};return t=P([R(Au)],t),t})(),Lp=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(o,e){this.event=o,this.fTrigger=e}},rV=(()=>{let t=class Ac{_store=p(L);_dragContext=p(he);_dragInjector=p(Ct);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=pe.fromPoint(e.getPosition()).elementTransform(this._store.flowHost),this._dragContext.draggableItems=[this._dragInjector.get(Ap)])}_isValid(e){return this._dragContext.isEmpty()&&(this._isBackgroundElement(e.targetElement)||this._isDragOnHost(e.targetElement))}_isBackgroundElement(e){return this._store.instances.get(Xe.BACKGROUND)?.hostElement.contains(e)}_isDragOnHost(e){return this._store.flowHost.contains(e)&&!this._getNode(e)}_getNode(e){let n=this._store.nodes.getAll().find(i=>i.isContains(e));return n&&n.fDraggingDisabled()&&(n=void 0),n}_isValidTrigger(e,n){return an(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Ac)};static \u0275prov=y({token:Ac,factory:Ac.\u0275fac})};return t=P([R(Lp)],t),t})(),aV=[oV,rV],Bp=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(o,e){this.event=o,this.trigger=e}},sV=(()=>{let t=class Lc{_mediator=p(V);_store=p(L);_dragSession=p(he);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let i=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(i),an(e.originalEvent,n)?this._applyToggleSelect(i):this._applySingleSelect(i)}_isSelectionAllowed(e){return this._store.flowHost.contains(e.targetElement)&&this._dragSession.isEmpty()}_resolveSelectable(e){return this._findNodeOrGroupAt(e)??this._findConnectionAt(e)}_findNodeOrGroupAt(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_findConnectionAt(e){return this._store.connections.getAll().find(n=>n.isContains(e))}_deferRaiseLayerFor(e){e&&queueMicrotask(()=>{this._mediator.execute(new ji(e,e.hostElement.parentElement))})}_applySingleSelect(e){if(!e||e.fSelectionDisabled()){this._clearSelection();return}e.isSelected()||(this._clearSelection(),this._select(e))}_applyToggleSelect(e){!e||e.fSelectionDisabled()||(e.isSelected()?this._deselect(e):this._select(e))}_clearSelection(){if(this._dragSession.selectedItems.length){for(let e of this._dragSession.selectedItems)e.unmarkAsSelected();this._dragSession.markSelectionAsChanged(),this._dragSession.selectedItems=[]}}_select(e){this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.markSelectionAsChanged()}_deselect(e){let n=this._dragSession.selectedItems.indexOf(e);n>=0&&this._dragSession.selectedItems.splice(n,1),e.unmarkAsSelected(),this._dragSession.markSelectionAsChanged()}static \u0275fac=function(n){return new(n||Lc)};static \u0275prov=y({token:Lc,factory:Lc.\u0275fac})};return t=P([R(Bp)],t),t})(),lV=[sV];var x_=class extends qm{hostElement=p(Qe).nativeElement};function cV(t){return xr(t,".f-drag-blocker")}var pC=(()=>{class t extends x_{_result=p(hi);_mediator=p(V);_platform=p(im);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===ii.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=gn;fCreateConnectionTrigger=gn;fConnectionWaypointsTrigger=B(gn);fMoveControlPointTrigger=gn;fNodeResizeTrigger=gn;fNodeRotateTrigger=gn;fNodeMoveTrigger=gn;fCanvasMoveTrigger=gn;fExternalItemTrigger=gn;fSelectionChange=new ne;fNodeIntersectedWithConnections=new ne;fNodeConnectionsIntersection=Ke();fEmitOnNodeIntersect=!1;fCreateNode=new ne;fMoveNodes=new ne;fReassignConnection=new ne;fCreateConnection=new ne;fConnectionWaypointsChanged=Ke();fDropToGroup=new ne;vCellSize=B(1,{transform:e=>xe(e,1)});hCellSize=B(1,{transform:e=>xe(e,1)});fCellSizeWhileDragging=B(!1,{transform:e=>j(e)});fDragStarted=new ne;fDragEnded=new ne;_dragHandlerInjector=p(Ct);ngOnInit(){this._mediator.execute(new qp(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(cV(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new jp),this._mediator.execute(new Tp(e)),this._mediator.execute(new Np(e)),this._mediator.execute(new xp(e)),this._mediator.execute(new Bp(e,this.fMultiSelectTrigger)),this._mediator.execute(new $u(e,this.fReassignConnectionTrigger)),this._mediator.execute(new ju(e,this.fCreateConnectionTrigger)),this._mediator.execute(new Zu(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new Dp(e,this.fNodeResizeTrigger)),this._mediator.execute(new Op(e,this.fNodeRotateTrigger)),this._mediator.execute(new up(e,this.fNodeMoveTrigger)),this._mediator.execute(new bp(e,this.fExternalItemTrigger)),this._mediator.execute(new pp(e)),this._mediator.execute(new Lp(e,this.fCanvasMoveTrigger)),this._mediator.execute(new Up)}onSelect(e){this._mediator.execute(new vp(e))}onPointerMove(e){this._mediator.execute(new Gp(e))}onPointerUp(e){this._mediator.execute(new Fp(e)),this._mediator.execute(new wp(e)),this._mediator.execute(new Uu(e)),this._mediator.execute(new zu(e)),this._mediator.execute(new Mp(e)),this._mediator.execute(new Rp(e)),this._mediator.execute(new dp(e)),this._mediator.execute(new _p(e)),this._mediator.execute(new Qu(e)),this._mediator.execute(new Au(e)),this._mediator.execute(new yp(e)),this._mediator.execute(new Ku(e)),this._mediator.execute(new Du)}finalizeDragSequence(){this._mediator.execute(new ui),this._mediator.execute(new Ar),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new ui),this._mediator.execute(new $p),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",j],fMultiSelectTrigger:"fMultiSelectTrigger",fReassignConnectionTrigger:"fReassignConnectionTrigger",fCreateConnectionTrigger:"fCreateConnectionTrigger",fConnectionWaypointsTrigger:[1,"fConnectionWaypointsTrigger"],fMoveControlPointTrigger:"fMoveControlPointTrigger",fNodeResizeTrigger:"fNodeResizeTrigger",fNodeRotateTrigger:"fNodeRotateTrigger",fNodeMoveTrigger:"fNodeMoveTrigger",fCanvasMoveTrigger:"fCanvasMoveTrigger",fExternalItemTrigger:"fExternalItemTrigger",fEmitOnNodeIntersect:[2,"fEmitOnNodeIntersect","fEmitOnNodeIntersect",j],vCellSize:[1,"vCellSize"],hCellSize:[1,"hCellSize"],fCellSizeWhileDragging:[1,"fCellSizeWhileDragging"]},outputs:{fSelectionChange:"fSelectionChange",fNodeIntersectedWithConnections:"fNodeIntersectedWithConnections",fNodeConnectionsIntersection:"fNodeConnectionsIntersection",fCreateNode:"fCreateNode",fMoveNodes:"fMoveNodes",fReassignConnection:"fReassignConnection",fCreateConnection:"fCreateConnection",fConnectionWaypointsChanged:"fConnectionWaypointsChanged",fDropToGroup:"fDropToGroup",fDragStarted:"fDragStarted",fDragEnded:"fDragEnded"},exportAs:["fDraggable"],standalone:!1,features:[ke([hi,Ct]),Z]})}return t})(),dV=[...aV,...zB,...lB,...lV,...x9,..._B,...nV,...l9,...T9,...U9,...Z9,...R9,...M9],uV=(()=>{let t=class Bc{_store=p(L);handle({waypointIndex:e,connectionId:n}){let i=this._store.connections.require(n),r=i.fWaypoints()?.waypoints().slice();if(!r)throw new Error("Connection waypoints not found");r.splice(e,1),i.fWaypoints()?.waypoints.set(r),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._changeEvent(i))}_changeEvent(e){return new Yu(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||Bc)};static \u0275prov=y({token:Bc,factory:Bc.\u0275fac})};return t=P([R(Bm)],t),t})(),w_=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},pV=(()=>{let t=class Vc{_store=p(L);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||Vc)};static \u0275prov=y({token:Vc,factory:Vc.\u0275fac})};return t=P([R(w_)],t),t})(),hV=[Th,Ui,a6,s6,l6,c6,t7,P7,a7,S7,V7,B7,D7,H7,G7,q7,M7,A7,s7,W7,E7,I7,k7,y7,T7,C7,x7,z7,F7,j7,U7,L7,N7,$7,K7,Y7,X7,pV,uV],Yr=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(o){this.instance=o}},fV=(()=>{let t=class zc{_store=p(L);_mediator=p(V);handle({instance:e}){switch(e.kind){case"input":this._addInput(e);break;case"output":this._addOutput(e);break;case"outlet":this._addOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_addInput(e){this._store.inputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutput(e){this._store.outputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutlet(e){this._store.outlets.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_geometryRegister(e){this._mediator.execute(new du(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||zc)};static \u0275prov=y({token:zc,factory:zc.\u0275fac})};return t=P([R(Yr)],t),t})(),qi=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(o,e){this.position=o,this.connectorRefs=e}},mV=(()=>{let t=class Hc{handle({position:e,connectorRefs:n}){let i,r=1/0;for(let a of n){let s=this._distanceToRect(e,a.rect);s<r&&(r=s,i=a)}return i?Dt(ge({},i),{distance:r}):void 0}_distanceToRect(e,{x:n,y:i,width:r,height:a}){let s=this._clamp(e.x,n,n+r),c=this._clamp(e.y,i,i+a),u=e.x-s,h=e.y-c;return Math.sqrt(u*u+h*h)}_clamp(e,n,i){return Math.max(n,Math.min(i,e))}static \u0275fac=function(n){return new(n||Hc)};static \u0275prov=y({token:Hc,factory:Hc.\u0275fac})};return t=P([R(qi)],t),t})(),Xr=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(o,e){this.pointerPosition=o,this.connectableConnectors=e}},_V=(()=>{let t=class qc{_mediator=p(V);_store=p(L);_browser=p(at);get _transform(){return this._store.transform}get _flowHost(){return this._store.flowHost}get _fNodes(){return this._store.nodes.getAll()}get _snapConnection(){return this._store.connections.getForSnap()}handle(e){let n=this._findConnectorAtPosition(e);return n.length>0?n[0]:void 0}_findConnectorAtPosition(e){let n=[];n.push(...this._filterConnectorsThatLocatedAtPosition(e));let i=this._isSnapConnectionEnabledAndHasClosestConnector(e);i&&n.unshift(i.connector);let r=this._getFirstConnectableConnectorOfNodeAtPosition(e);return r&&n.push(r),n}_filterConnectorsThatLocatedAtPosition(e){return e.connectableConnectors.filter(n=>te.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return qo(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new qi(this._calculatePointerInFlow(e.pointerPosition),e.connectableConnectors));return this._isValidClosestInput(n)?n:void 0}_isValidClosestInput(e){return!!e&&e.distance<this._snapConnection.fSnapThreshold}_getFirstConnectableConnectorOfNodeAtPosition(e){return this._getElementsFromPoint(e.pointerPosition).map(n=>this._findConnectableNode(n)).filter(n=>!!n).map(n=>this._findFirstConnectableConnectorOfNode(e.connectableConnectors,n)).find(n=>!!n)}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y)}_findConnectableNode(e){return this._fNodes.find(n=>n.isContains(e)&&n.fConnectOnNode())}_findFirstConnectableConnectorOfNode(e,n){return e.find(i=>i.connector.fNodeId===n.fId())?.connector}static \u0275fac=function(n){return new(n||qc)};static \u0275prov=y({token:qc,factory:qc.\u0275fac})};return t=P([R(Xr)],t),t})(),Zr=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(o,e){this.source=o,this.pointer=e}},Kt=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(o){this.connector=o}},gV=(()=>{let t=class Gc{_mediator=p(V);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new di(e.hostElement))}static \u0275fac=function(n){return new(n||Gc)};static \u0275prov=y({token:Gc,factory:Gc.\u0275fac})};return t=P([R(Kt)],t),t})(),Qr=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(o){this.nodeOrGroup=o}},bV=(()=>{let t=class jc{_store=p(L);_mediator=p(V);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new uu(e.fId(),e.hostElement,e)),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||jc)};static \u0275prov=y({token:jc,factory:jc.\u0275fac})};return t=P([R(Qr)],t),t})(),Vp=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(o){this.nodeOrGroup=o}},vV=(()=>{let t=class Uc{_store=p(L);handle({nodeOrGroup:e}){let n=this._collectInputIds(e);return this._collectConnections(n)}_collectInputIds(e){let n=new Set,i=this._store.inputs.getAll();for(let r of i)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],i=this._store.connections.getAll();for(let r of i)e.has(r.fInputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||Uc)};static \u0275prov=y({token:Uc,factory:Uc.\u0275fac})};return t=P([R(Vp)],t),t})(),Oo=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(o,e){this.connector=o,this.pointerPosition=e}},ky=2,Et=(function(t){return t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=4]="TOP",t[t.BOTTOM=8]="BOTTOM",t[t.ALL=15]="ALL",t})(Et||{});function yV(t,o,e,n,i){let r=CV(i),a=e-t,s=n-o,c=xV(a,s);return wV(c,r)?c:TV(a,s,r,c)}function CV(t){if(!t||t.length===0)return Et.ALL;let o=Et.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case K.LEFT:o|=Et.LEFT;break;case K.RIGHT:o|=Et.RIGHT;break;case K.TOP:o|=Et.TOP;break;case K.BOTTOM:o|=Et.BOTTOM;break}return o||Et.ALL}function xV(t,o){let e=t<0?-t:t,n=o<0?-o:o;return e-n>ky?t<0?K.LEFT:K.RIGHT:(n-e>ky,o<0?K.TOP:K.BOTTOM)}function wV(t,o){switch(t){case K.LEFT:return(o&Et.LEFT)!==0;case K.RIGHT:return(o&Et.RIGHT)!==0;case K.TOP:return(o&Et.TOP)!==0;case K.BOTTOM:return(o&Et.BOTTOM)!==0;default:return!0}}function TV(t,o,e,n){let i=n,r=-1/0;if(e&Et.RIGHT){let a=t;a>r&&(r=a,i=K.RIGHT)}if(e&Et.LEFT){let a=-t;a>r&&(r=a,i=K.LEFT)}if(e&Et.BOTTOM){let a=o;a>r&&(r=a,i=K.BOTTOM)}if(e&Et.TOP){let a=-o;a>r&&(r=a,i=K.TOP)}return i}function zp(t){return t===K.CALCULATE||t===K.CALCULATE_HORIZONTAL||t===K.CALCULATE_VERTICAL}var SV={[K.CALCULATE]:[K.TOP,K.BOTTOM,K.LEFT,K.RIGHT],[K.CALCULATE_HORIZONTAL]:[K.LEFT,K.RIGHT],[K.CALCULATE_VERTICAL]:[K.TOP,K.BOTTOM]},kV=(()=>{let t=class $c{_mediator=p(V);handle({connector:e,pointerPosition:n}){let i=e.userFConnectableSide,r=this._getConnectorRect(e.hostElement).gravityCenter,a=this._accumulateConnectedCenters(e.hostElement,e.toConnector,n),s=a.sumX/a.count,c=a.sumY/a.count;return yV(r.x,r.y,s,c,SV[i])}_accumulateConnectedCenters(e,n,i){let r=i?.x||0,a=i?.y||0,s=i?1:0;if(n&&n.length)for(let c=0;c<n.length;c++){let u=n[c].hostElement;if(u===e)continue;let h=this._getConnectorRect(u).gravityCenter;r+=h.x,a+=h.y,s++}return{sumX:r,sumY:a,count:s}}_getConnectorRect(e){return this._mediator.execute(new it(e))}static \u0275fac=function(n){return new(n||$c)};static \u0275prov=y({token:$c,factory:$c.\u0275fac})};return t=P([R(Oo)],t),t})(),Hp=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(o){this.connector=o}},qp=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(o){this.fComponent=o}},IV=(()=>{let t=class Wc{_store=p(L);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||Wc)};static \u0275prov=y({token:Wc,factory:Wc.\u0275fac})};return t=P([R(qp)],t),t})(),Gp=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(o){this.event=o}},EV=(()=>{let t=class Kc{_mediator=p(V);_store=p(L);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=p(he);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new Lr)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(i=>{i.onPointerMove(ge({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return pe.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||Kc)};static \u0275prov=y({token:Kc,factory:Kc.\u0275fac})};return t=P([R(Gp)],t),t})(),jp=class{static fToken=Symbol("InitializeDragSequenceRequest")},MV=(()=>{let t=class Yc{_dragContext=p(he);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||Yc)};static \u0275prov=y({token:Yc,factory:Yc.\u0275fac})};return t=P([R(jp)],t),t})(),fi=class{static fToken=Symbol("IsDragStartedRequest")},DV=(()=>{let t=class Xc{_store=p(L);handle(e){return!!this._store.fDraggable?.isDragStarted}static \u0275fac=function(n){return new(n||Xc)};static \u0275prov=y({token:Xc,factory:Xc.\u0275fac})};return t=P([R(fi)],t),t})(),Up=class{static fToken=Symbol("PrepareDragSequenceRequest")},PV=(()=>{let t=class Zc{_mediator=p(V);_dragContext=p(he);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new Pu)}_callPrepareDragSequence(){this._dragContext.draggableItems.forEach(e=>e.prepareDragSequence?.())}static \u0275fac=function(n){return new(n||Zc)};static \u0275prov=y({token:Zc,factory:Zc.\u0275fac})};return t=P([R(Up)],t),t})(),$p=class{static fToken=Symbol("RemoveDndFromStoreRequest")},RV=(()=>{let t=class Qc{_store=p(L);handle(e){this._store.fDraggable=void 0}static \u0275fac=function(n){return new(n||Qc)};static \u0275prov=y({token:Qc,factory:Qc.\u0275fac})};return t=P([R($p)],t),t})(),OV=[IV,EV,MV,PV,DV,RV],FV=new be("CONNECTABLE_SIDE_EPSILON"),NV=(()=>{let t=class Jc{_mediator=p(V);_lastSide=new WeakMap;_epsilon=Math.max(0,p(FV,{optional:!0})??2);handle({connector:e}){if(this._isDragging()){let i=this._lastSide.get(e);if(i!==void 0)return i;let r=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,r),r}let n=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,n),n}_getSideByDelta(e,n,i){let r=te.fromElement(e),a=n.getBoundingClientRect(),s=r.gravityCenter.x,c=r.gravityCenter.y,u=s-a.left,h=a.right-s,g=c-a.top,C=a.bottom-c,k=0,I=u,N=[u,h,g,C];for(let ee=1;ee<4;ee++){let ce=N[ee];ce<I&&(I=ce,k=ee)}let q=k===0?K.LEFT:k===1?K.RIGHT:k===2?K.TOP:K.BOTTOM,Y=this._lastSide.get(i);if(Y!==void 0&&Y!==q){let ee=Y===K.LEFT?0:Y===K.RIGHT?1:Y===K.TOP?2:3;(ee===0?u:ee===1?h:ee===2?g:C)-I<=this._epsilon&&(q=Y)}return q}_isDragging(){return this._mediator.execute(new fi)}static \u0275fac=function(n){return new(n||Jc)};static \u0275prov=y({token:Jc,factory:Jc.\u0275fac})};return t=P([R(Hp)],t),t})(),Fo=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(o){this.nodeOrGroup=o}},AV=(()=>{let t=class ed{_mediator=p(V);handle({nodeOrGroup:e}){let n=e.connectors,i=n.length;for(let a=0;a<i;a++){let s=n[a];s.fConnectableSide=this._resolveSideForConnectorFast(s)}let r=new Set;for(let a=0;a<i;a++){let c=n[a].toConnector;if(c&&c.length)for(let u=0,h=c.length;u<h;u++){let g=c[u],C=g.userFConnectableSide;zp(C)&&r.add(g)}}r.size>0&&r.forEach(a=>{a.fConnectableSide=this._calculateByConnectedPositions(a)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===K.AUTO?this._mediator.execute(new Hp(e)):zp(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new Oo(e))}static \u0275fac=function(n){return new(n||ed)};static \u0275prov=y({token:ed,factory:ed.\u0275fac})};return t=P([R(Fo)],t),t})(),No=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},LV=(()=>{let t=class td{_store=p(L);handle(e){return te.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>te.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||td)};static \u0275prov=y({token:td,factory:td.\u0275fac})};return t=P([R(No)],t),t})(),Wp=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(o){this.fNodes=o}},BV=(()=>{let t=class nd{_store=p(L);_mediator=p(V);handle(e){return te.union(this._getNodesRects(e.fNodes||this._store.nodes.getAll()))}_getNodesRects(e){return e.map(n=>this._getNodeRect(n))}_getNodeRect(e){let n=this._mediator.execute(new Po(e.hostElement));if(n)return this._getElementRect(e,n);let i=this._mediator.execute(new it(e.hostElement));return this._getElementRect(e,i)}_getElementRect(e,n){return te.initialize(e._position.x,e._position.y,n.width,n.height)}static \u0275fac=function(n){return new(n||nd)};static \u0275prov=y({token:nd,factory:nd.\u0275fac})};return t=P([R(Wp)],t),t})(),Kp=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(o){this.nodeOrGroup=o}},VV=(()=>{let t=class id{_store=p(L);handle({nodeOrGroup:e}){let n=this._collectOutputIds(e);return this._collectConnections(n)}_collectOutputIds(e){let n=new Set,i=this._store.outputs.getAll();for(let r of i)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],i=this._store.connections.getAll();for(let r of i)e.has(r.fOutputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||id)};static \u0275prov=y({token:id,factory:id.\u0275fac})};return t=P([R(Kp)],t),t})(),Jr=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(o){this.nodeOrGroup=o}},Gi=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(o,e){this.fNode=o,this.rect=e}},zV=(()=>{let t=class od{_browser=p(at);handle(e){return e.fNode.fIncludePadding()?this._getPaddingData(e.fNode,e.rect):[0,0,0,0]}_getPaddingData(e,n){let i=this._browser.window.getComputedStyle(e.hostElement);return[this._browser.toPixels(i.paddingLeft,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingTop,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingRight,n.width,n.height,i.fontSize),this._browser.toPixels(i.paddingBottom,n.width,n.height,i.fontSize)]}static \u0275fac=function(n){return new(n||od)};static \u0275prov=y({token:od,factory:od.\u0275fac})};return t=P([R(Gi)],t),t})(),HV=(()=>{let t=class rd{_mediator=p(V);_store=p(L);get _nodes(){return this._store.nodes.getAll()}handle({nodeOrGroup:e}){if(e.fAutoSizeToFitChildren()){let r=this._calculateDirectChildren(e);if(r.length){let a=this._boundingRect(e),s=this._calculateChildrenBounding(r,this._paddings(e,a));e.updatePosition(s),e.updateSize(s),e.redraw()}}let n=e.fParentId();if(!n)return;let i=this._nodes.find(r=>r.fId()===n);i&&this._mediator.execute(new Jr(i))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return te.union(e.map(n=>this._boundingRect(n)))||te.initialize()}_boundingRect(e){return this._mediator.execute(new it(e.hostElement))}_paddings(e,n){return this._mediator.execute(new Gi(e,n))}_calculateChildrenBounding(e,[n,i,r,a]){let s=this._unionRect(e);return s=te.initialize(s.x-n,s.y-i,s.width+n+r,s.height+i+a),s}static \u0275fac=function(n){return new(n||rd)};static \u0275prov=y({token:rd,factory:rd.\u0275fac})};return t=P([R(Jr)],t),t})(),Yp=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(o){this.id=o}},qV=(()=>{let t=class ad{_store=p(L);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle(e){if(!e.id)return[];let n=new Set,i=[];return this._collectDescendants(e.id,i,n),i}_collectDescendants(e,n,i){if(i.has(e))throw new Error(`Circular reference detected in the node hierarchy. Node id: ${e}`);i.add(e);let r=this._allNodesAndGroups.filter(a=>a.fParentId()===e).map(a=>a.fId());n.push(...r);for(let a of r)this._collectDescendants(a,n,i)}static \u0275fac=function(n){return new(n||ad)};static \u0275prov=y({token:ad,factory:ad.\u0275fac})};return t=P([R(Yp)],t),t})(),Ao=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(o){this.nodeOrGroup=o}},GV=(()=>{let t=class sd{_store=p(L);handle({nodeOrGroup:e}){return this._getParentNodes(e,new Set,[])}_getParentNodes(e,n,i){if(n.has(e.fId()))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e.fId());n.add(e.fId());let r=this._store.nodes.get(e.fParentId());return r?(i.push(r),this._getParentNodes(r,n,i)):i}static \u0275fac=function(n){return new(n||sd)};static \u0275prov=y({token:sd,factory:sd.\u0275fac})};return t=P([R(Ao)],t),t})(),ea=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(o,e){this.nodeOrGroup=o,this.destroyRef=e}},jV=(()=>{let t=class ld{_mediator=p(V);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:i,stateChanges:r}=e;new En(new gm(i),r).listen(n,()=>{this._mediator.execute(new Ai),this._isDragging()||(this._mediator.execute(new Do(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new Fo(e)),this._mediator.execute(new Jr(e)))})}_isDragging(){return this._mediator.execute(new fi)}static \u0275fac=function(n){return new(n||ld)};static \u0275prov=y({token:ld,factory:ld.\u0275fac})};return t=P([R(ea)],t),t})(),ta=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(o){this.instance=o}},UV=(()=>{let t=class cd{_store=p(L);_mediator=p(V);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new pu(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||cd)};static \u0275prov=y({token:cd,factory:cd.\u0275fac})};return t=P([R(ta)],t),t})(),$V=[bV,kV,NV,vV,AV,LV,BV,VV,HV,qV,zV,GV,jV,UV],WV=(()=>{let t=class dd{_mediator=p(V);_store=p(L);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let i=this._getConnectableTargets(e),r=[];for(let a of i)r.push(this._mediator.execute(new Kt(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableTargets(e){if(e.hasConnectionLimits)return this._targets.filter(i=>e.canConnectTo(i));let n=this._targets.filter(i=>i.canBeConnected);return e.isSelfConnectable||(n=n.filter(i=>i.fNodeId!==e.fNodeId)),n}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:i}of e)zp(i.userFConnectableSide)&&(i.fConnectableSide=this._calculateByConnectedPositions(i,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Oo(e,n))}static \u0275fac=function(n){return new(n||dd)};static \u0275prov=y({token:dd,factory:dd.\u0275fac})};return t=P([R(Zr)],t),t})(),Xp=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(o,e){this.target=o,this.pointer=e}},KV=(()=>{let t=class ud{_mediator=p(V);_store=p(L);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let i=this._getConnectableSources(e),r=[];for(let a of i)r.push(this._mediator.execute(new Kt(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableSources(e){return this._sources.filter(n=>{let i=n.canBeConnected;return i&&n.hasConnectionLimits&&(i=n.canConnectTo(e)),i})}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:i}of e)zp(i.userFConnectableSide)&&(i.fConnectableSide=this._calculateByConnectedPositions(i,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Oo(e,n))}static \u0275fac=function(n){return new(n||ud)};static \u0275prov=y({token:ud,factory:ud.\u0275fac})};return t=P([R(Xp)],t),t})(),Lo=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(o){this.connectors=o}},ht={DRAG_AND_DROP:{DRAGGING:"f-dragging",CONNECTIONS_DRAGGING:"f-connections-dragging"},GROUPING:{OVER_BOUNDARY:"f-grouping-over-boundary",DROP_ACTIVE:"f-grouping-drop-active"},CONNECTOR:{OUTPUT_CONNECTED:"f-node-output-connected",OUTPUT_NOT_CONNECTABLE:"f-node-output-not-connectable",INPUT_CONNECTED:"f-node-input-connected",INPUT_NOT_CONNECTABLE:"f-node-input-not-connectable",CONNECTABLE:"f-connector-connectable"}},YV=(()=>{let t=class pd{_store=p(L);handle({connectors:e}){this._store.flowHost.classList.add(ht.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(ht.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||pd)};static \u0275prov=y({token:pd,factory:pd.\u0275fac})};return t=P([R(Lo)],t),t})(),na=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(o){this.instance=o}},XV=(()=>{let t=class hd{_store=p(L);_mediator=p(V);handle({instance:e}){switch(e.kind){case"input":this._removeInput(e);break;case"output":this._removeOutput(e);break;case"outlet":this._removeOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_removeInput(e){this._store.inputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutput(e){this._store.outputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutlet(e){this._store.outlets.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_geometryUnregister(e){this._mediator.execute(new Ir(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||hd)};static \u0275prov=y({token:hd,factory:hd.\u0275fac})};return t=P([R(na)],t),t})(),Bo=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(o){this.connectors=o}},ZV=(()=>{let t=class fd{_store=p(L);handle({connectors:e}){this._store.flowHost.classList.remove(ht.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(ht.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||fd)};static \u0275prov=y({token:fd,factory:fd.\u0275fac})};return t=P([R(Bo)],t),t})(),QV=[fV,XV,mV,_V,KV,WV,gV,YV,ZV],Zp=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(o){this.instance=o}},$i=(function(t){return t.TOP_BOTTOM="TOP_BOTTOM",t.BOTTOM_TOP="BOTTOM_TOP",t.LEFT_RIGHT="LEFT_RIGHT",t.RIGHT_LEFT="RIGHT_LEFT",t})($i||{}),oi=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(oi||{});function JV(t){let o=[...t.nodes.map(Iy),...t.groups.map(Iy)],e=new Set(t.nodes.map(s=>s.id)),n=new Set(t.groups.map(s=>s.id)),i=new Map,r=new Map;for(let s of[...t.nodes,...t.groups]){for(let c of s.fOutputs)i.set(c.id,s.id);for(let c of s.fInputs)r.set(c.id,s.id)}let a=t.connections.reduce((s,c)=>{let u=i.get(c.fOutputId),h=r.get(c.fInputId);return!u||!h||s.push({source:u,target:h}),s},[]);return{nodes:o,connections:a,nodeIds:e,groupIds:n}}function Iy(t){return{id:t.id,size:t.measuredSize?ge({},t.measuredSize):t.size?ge({},t.size):void 0}}var e8=1,Ih=(()=>{class t{_destroyRef=p(xt);_flows=new Map;_engine;constructor(){this._destroyRef.onDestroy(()=>{Array.from(this._flows.keys()).forEach(e=>this.unregisterFlow(e)),this._engine=void 0})}attachEngine(e){this._engine=e}registerFlow(e,n){let i=e.fId();this.unregisterFlow(i);let r={flow:e,store:n,nodeSignature:this._buildNodeSignature(n),connectionSignature:this._buildConnectionSignature(n),timeoutId:null,raf1:null,raf2:null,unsubs:[],runId:0,isApplying:!1};r.unsubs.push(n.nodesChanges$.listen(()=>this._handleNodesChanges(i)),n.connectionsChanges$.listen(()=>this._handleConnectionsChanges(i))),this._flows.set(i,r),this._engine?.getMode()===oi.AUTO&&this._scheduleRelayout(i)}unregisterFlow(e){let n=this._flows.get(e);n&&(n.unsubs.forEach(i=>i()),this._clearScheduledWork(n),this._flows.delete(e))}handleModeChanged(e){if(e===oi.AUTO)for(let n of this._flows.keys())this._scheduleRelayout(n)}async relayout(e){if(this._engine){if(e){let n=this._flows.get(e);n&&await this._relayoutRegisteredFlow(e,n);return}for(let[n,i]of this._flows.entries())await this._relayoutRegisteredFlow(n,i)}}_handleNodesChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let i=this._buildNodeSignature(n.store);i!==n.nodeSignature&&(n.nodeSignature=i,this._scheduleRelayout(e))}_handleConnectionsChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let i=this._buildConnectionSignature(n.store);i!==n.connectionSignature&&(n.connectionSignature=i,this._scheduleRelayout(e))}_scheduleRelayout(e){let n=this._flows.get(e);!n||!this._engine||this._engine.getMode()!==oi.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},e8))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==oi.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let i=JV(n.flow.getState({measuredSize:!0})),r=++n.runId,a=await this._engine.calculate(i.nodes,i.connections,{flowId:e,mode:this._engine.getMode()}),s=this._flows.get(e);if(!(!s||s.runId!==r||!this._applyPositions(s.store,a.nodes).length)){s.isApplying=!0;try{s.flow.redraw(),this._emitWriteback(e,a.nodes,i.nodeIds,i.groupIds)}finally{queueMicrotask(()=>{let u=this._flows.get(e);u&&(u.isApplying=!1)})}}}_emitWriteback(e,n,i,r){let a=this._engine?.getWriteback();a&&a({flowId:e,nodes:n.filter(s=>i.has(s.id)),groups:n.filter(s=>r.has(s.id))})}_applyPositions(e,n){return n.filter(i=>{let r=e.nodes.get(i.id);return!r||U.isEqual(r._position,i.position)?!1:(r.position.set(ge({},i.position)),!0)})}_buildNodeSignature(e){return e.nodes.getAll().map(n=>n.fId()).sort().join("|")}_buildConnectionSignature(e){return e.connections.getAll().map(n=>`${n.fId()}:${n.fOutputId()}:${n.fInputId()}`).sort().join("|")}_runAfterNextPaint(e,n){if(this._cancelAnimationFrames(e),typeof requestAnimationFrame!="function"){n();return}e.raf1=requestAnimationFrame(()=>{e.raf1=null,e.raf2=requestAnimationFrame(()=>{e.raf2=null,n()})})}_clearScheduledWork(e){e.timeoutId!==null&&(clearTimeout(e.timeoutId),e.timeoutId=null),this._cancelAnimationFrames(e)}_cancelAnimationFrames(e){e.raf1!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf1),e.raf1=null),e.raf2!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf2),e.raf2=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),hC=new be("F_LAYOUT_OPTIONS");function fC(t,o){return t.reduce((e,n)=>{let i=o.get(n.id);return i&&e.push({id:n.id,position:i}),e},[])}var t8=new be("F_LAYOUT"),Qp=class{_controller=p(Ih);_config=p(hC,{optional:!0})??{};_interactiveOptions;_mode;_writeback;_defaultOptions;interactiveOptions;constructor(o){this._mode=this._config.mode??oi.MANUAL,this._writeback=this._config.writeback??null,this._defaultOptions=this.mergeOptions(o,this._config.options),this._interactiveOptions=X(this.mergeOptions(this._defaultOptions,{})),this.interactiveOptions=E(()=>this.mergeOptions(this._interactiveOptions(),{})),this._controller.attachEngine(this)}setMode(o){this._mode=o,this._controller.handleModeChanged(o)}getMode(){return this._mode}setWriteback(o){this._writeback=o}getWriteback(){return this._writeback}setInteractiveOptions(o){this._interactiveOptions.set(this.mergeOptions(this._interactiveOptions(),o))}relayout(o){return this._controller.relayout(o)}getProviderConfig(){return ge({},this._config)}resolveLayoutOptions(o){let e=ge({},o??{});return delete e.flowId,delete e.mode,this.mergeOptions(this._interactiveOptions(),e)}};function mC(t,o){return[Ih,t,{provide:t8,useExisting:t},{provide:hC,useValue:o??{}}]}var n8=(()=>{let t=class md{_store=p(L);_layoutController=p(Ih,{optional:!0});handle({instance:e}){this._store.fFlow=e,this._layoutController?.registerFlow(e,this._store)}static \u0275fac=function(n){return new(n||md)};static \u0275prov=y({token:md,factory:md.\u0275fac})};return t=P([R(Zp)],t),t})(),Jp=class{static fToken=Symbol("GetFlowRequest")},i8=(()=>{let t=class _d{_store=p(L);handle(e){let n=this._store.fFlow;if(!n)throw new Error("Flow not found in store");return n}static \u0275fac=function(n){return new(n||_d)};static \u0275prov=y({token:_d,factory:_d.\u0275fac})};return t=P([R(Jp)],t),t})(),eh=class{static fToken=Symbol("CalculateConnectionsStateRequest")},o8=(()=>{let t=class gd{_store=p(L);handle(e){return this._store.connections.getAll().map(this._mapToConnectionState)}_mapToConnectionState(e){return{id:e.fId(),fOutputId:e.fOutputId(),fInputId:e.fInputId(),fType:e.fType,fBehavior:e.fBehavior,isSelected:e.isSelected(),waypoints:e.fWaypoints()?.waypoints()||[],fInputSide:e.fInputSide(),fOutputSide:e.fOutputSide()}}static \u0275fac=function(n){return new(n||gd)};static \u0275prov=y({token:gd,factory:gd.\u0275fac})};return t=P([R(eh)],t),t})(),ia=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(o,e=!1){this.component=o,this.measuredSize=e}},r8=(()=>{let t=class bd{_store=p(L);_mediator=p(V);handle({component:e,measuredSize:n}){return this._store.nodes.getAll().filter(i=>i instanceof e).map(i=>{let r=n?this._mediator.execute(new it(i.hostElement)):null;return{id:i.fId(),parentId:i.fParentId()??void 0,position:ge({},i._position),size:i._size?ge({},i._size):void 0,measuredSize:r?{width:r.width,height:r.height}:void 0,rotate:i._rotate,fOutputs:this._getOutputs(i.hostElement),fInputs:this._getInputs(i.hostElement),isSelected:i.isSelected()}})}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}_getInputs(e){return this._store.inputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}static \u0275fac=function(n){return new(n||bd)};static \u0275prov=y({token:bd,factory:bd.\u0275fac})};return t=P([R(ia)],t),t})(),th=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(o=!1){this.measuredSize=o}},a8=(()=>{let t=class vd{_mediator=p(V);_store=p(L);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _canvasPosition(){return U.sum(this._transform.position,this._transform.scaledPosition)}handle({measuredSize:e}){return{position:this._canvasPosition,scale:this._canvas.transform.scale,nodes:this._mediator.execute(new ia(kh,e)),groups:this._mediator.execute(new ia(Km,e)),connections:this._mediator.execute(new eh)}}static \u0275fac=function(n){return new(n||vd)};static \u0275prov=y({token:vd,factory:vd.\u0275fac})};return t=P([R(th)],t),t})(),s8=[a8,r8,o8],nh=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(o){this.instance=o}},l8=(()=>{let t=class yd{_store=p(L);_layoutController=p(Ih,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||yd)};static \u0275prov=y({token:yd,factory:yd.\u0275fac})};return t=P([R(nh)],t),t})(),Eh=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ih=class{static fToken=Symbol("NotifyNodesRenderedRequest")},M_=new be("F_FLOW"),T_=class{},c8=(()=>{let t=class Cd{_state=p(Eh);_fFlow=p(M_);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||Cd)};static \u0275prov=y({token:Cd,factory:Cd.\u0275fac})};return t=P([R(ih)],t),t})(),oh=class{static fToken=Symbol("NotifyFullRenderedRequest")},d8=(()=>{let t=class xd{_state=p(Eh);_fFlow=p(M_);handle(e){this._state.isFullRendered||(this._state.isFullRendered=!0,this._fFlow.fFullRendered.emit(this._fFlow.fId()),this._fFlow.fLoaded.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||xd)};static \u0275prov=y({token:xd,factory:xd.\u0275fac})};return t=P([R(oh)],t),t})(),oa=class{targetConnectionsRevision;targetNodesRevision;callback;destroyRef;static fToken=Symbol("WaitForConnectionsRenderedRequest");constructor(o,e,n,i){this.targetConnectionsRevision=o,this.targetNodesRevision=e,this.callback=n,this.destroyRef=i}},u8=(()=>{let t=class wd{_store=p(L);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:i,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){i();return}let a=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(a(),i())});r.onDestroy(a)}static \u0275fac=function(n){return new(n||wd)};static \u0275prov=y({token:wd,factory:wd.\u0275fac})};return t=P([R(oa)],t),t})(),rh=class{static fToken=Symbol("ResetRenderLifecycleRequest")},p8=(()=>{let t=class Td{_state=p(Eh);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||Td)};static \u0275prov=y({token:Td,factory:Td.\u0275fac})};return t=P([R(rh)],t),t})(),ah=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(o){this.destroyRef=o}},_C=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),h8=(()=>{let t=class Sd{_state=p(_C);_store=p(L);_mediator=p(V);handle(e){if(this._state.pendingRedraw=!0,this._state.isWaitingForViewportAnimation)return;this._state.isWaitingForViewportAnimation=!0;let n=this._store.viewportAnimationChanges$.listen(()=>{if(this._store.isViewportAnimating)return;let i=this._state.pendingRedraw;n(),this._state.isWaitingForViewportAnimation=!1,this._state.pendingRedraw=!1,i&&this._mediator.execute(new Or)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||Sd)};static \u0275prov=y({token:Sd,factory:Sd.\u0275fac})};return t=P([R(ah)],t),t})(),f8=[n8,i8,...s8,l8,Eh,c8,d8,u8,p8,_C,h8],sh=class{static fToken=Symbol("ClearSelectionRequest")},m8=(()=>{let t=class kd{_dragContext=p(he);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||kd)};static \u0275prov=y({token:kd,factory:kd.\u0275fac})};return t=P([R(sh)],t),t})(),lh=class{static fToken=Symbol("CalculateSelectableItemsRequest")},_8=(()=>{let t=class Id{_mediator=p(V);_store=p(L);_dragContext=p(he);get _nodes(){return this._store.nodes.getAll()}get _connections(){return this._store.connections.getAll()}handle(){return[...this._nodeRects(),...this._connectionRects()].filter(e=>!this._dragContext.selectedItems.includes(e.element))}_nodeRects(){return this._nodes.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new it(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new it(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Id)};static \u0275prov=y({token:Id,factory:Id.\u0275fac})};return t=P([R(lh)],t),t})(),ra=class{static fToken=Symbol("GetCurrentSelectionRequest")},g8=(()=>{let t=class Ed{_dragContext=p(he);handle(){return{fNodeIds:this._getSelectedNodes(),fGroupIds:this._getSelectedGroups(),fConnectionIds:this._getSelectedConnections()}}_getSelectedNodes(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-node")).map(e=>e.hostElement.dataset.fNodeId)}_getSelectedGroups(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.dataset.fGroupId)}_getSelectedConnections(){return this._dragContext.selectedItems.filter(e=>!e.hostElement.classList.contains("f-node")&&!e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.id)}static \u0275fac=function(n){return new(n||Ed)};static \u0275prov=y({token:Ed,factory:Ed.\u0275fac})};return t=P([R(ra)],t),t})(),ch=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(o,e,n=!0){this.nodes=o,this.connections=e,this.isSelectedChanged=n}},b8=(()=>{let t=class Md{_dragContext=p(he);_store=p(L);handle(e){this._dragContext.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragContext.selectedItems=[],e.nodes.forEach(n=>{let i=this._store.nodes.get(n);i&&(i.markAsSelected(),this._dragContext.selectedItems.push(i))}),e.connections.forEach(n=>{let i=this._store.connections.get(n);i&&(i.markAsSelected(),this._dragContext.selectedItems.push(i))}),this._dragContext.isSelectedChanged=e.isSelectedChanged}static \u0275fac=function(n){return new(n||Md)};static \u0275prov=y({token:Md,factory:Md.\u0275fac})};return t=P([R(ch)],t),t})(),dh=class{static fToken=Symbol("SelectAllRequest")},v8=(()=>{let t=class Dd{_dragSession=p(he);_store=p(L);handle(e){this._dragSession.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragSession.selectedItems=[],this._store.nodes.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._store.connections.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._dragSession.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Dd)};static \u0275prov=y({token:Dd,factory:Dd.\u0275fac})};return t=P([R(dh)],t),t})(),Vo=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(o){this.nodeOrGroup=o}},uh=class{fItemsContainer;allElements;elementsThatShouldBeInFront;targetIndex;static fToken=Symbol("MoveFrontElementsBeforeTargetElementRequest");constructor(o,e,n,i){this.fItemsContainer=o,this.allElements=e,this.elementsThatShouldBeInFront=n,this.targetIndex=i}},y8=(()=>{let t=class Pd{handle(e){let n=[];for(let i=e.targetIndex+1;i<e.allElements.length;i++){let r=e.allElements[i];e.elementsThatShouldBeInFront.includes(r)||n.push(r)}n.forEach(i=>{e.fItemsContainer.removeChild(i),e.fItemsContainer.insertBefore(i,e.allElements[e.targetIndex])})}static \u0275fac=function(n){return new(n||Pd)};static \u0275prov=y({token:Pd,factory:Pd.\u0275fac})};return t=P([R(uh)],t),t})(),ji=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(o,e){this.item=o,this.itemContainer=e}},zo=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(o){this.nodeOrGroupId=o}},C8=(()=>{let t=class Rd{_store=p(L);handle({nodeOrGroupId:e}){return this._getChildrenNodes(e)}_getChildrenNodes(e,n=new Set){if(n.has(e))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e);n.add(e);let i=this._store.nodes.getAll().filter(r=>r.fParentId()===e);return i.reduce((r,a)=>r.concat(this._getChildrenNodes(a.fId(),n)),i)}static \u0275fac=function(n){return new(n||Rd)};static \u0275prov=y({token:Rd,factory:Rd.\u0275fac})};return t=P([R(zo)],t),t})(),x8=(()=>{let t=class Od{_store=p(L);_mediator=p(V);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _connectionsContainer(){return this._canvas.fConnectionsContainer().nativeElement}handle(e){switch(e.itemContainer){case this._groupsContainer:this._handleGroup(e);break;case this._nodesContainer:this._handleNode(e);break;case this._connectionsContainer:this._handleConnection(e);break;default:throw new Error("Unknown container")}}_handleGroup(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),i=this._getChildrenGroups(n);this._updateLayers(this._groupsContainer,e.item.hostElement,i);let r=this._getChildrenNodes(n);r.length&&this._updateLayers(this._nodesContainer,r[0],r)}_handleNode(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),i=this._getChildrenNodes(n);this._updateLayers(e.itemContainer,e.item.hostElement,i)}_handleConnection(e){this._updateLayers(e.itemContainer,e.item.hostElement,[])}_updateLayers(e,n,i){let r=Array.from(e.children),a=r.findIndex(s=>s===n);this._isAnythingNeedToBeMoved(r,a,i)&&this._mediator.execute(new uh(e,r,i,a))}_isAnythingNeedToBeMoved(e,n,i){for(let r=n+1;r<e.length;r++)if(!i.includes(e[r]))return!0;return!1}_getChildrenGroups(e){let n=Array.from(this._groupsContainer.children);return e.filter(i=>this._groupsContainer.contains(i)).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodes(e){let n=Array.from(this._nodesContainer.children);return e.filter(i=>this._nodesContainer.contains(i)).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodesAndGroups(e){return this._mediator.execute(new zo(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Od)};static \u0275prov=y({token:Od,factory:Od.\u0275fac})};return t=P([R(ji)],t),t})(),w8=(()=>{let t=class Fd{_dragSession=p(he);_mediator=p(V);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new ji(e,e.hostElement.parentElement))}_selectNodeIfNotSelected(e){e.fSelectionDisabled()||this._dragSession.selectedItems.includes(e)||(this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.isSelectedChanged=!0)}static \u0275fac=function(n){return new(n||Fd)};static \u0275prov=y({token:Fd,factory:Fd.\u0275fac})};return t=P([R(Vo)],t),t})(),T8=[m8,_8,g8,b8,v8,w8],ph=class{static fToken=Symbol("ResetZoomRequest")},S8=(()=>{let t=class Nd{_store=p(L);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||Nd)};static \u0275prov=y({token:Nd,factory:Nd.\u0275fac})};return t=P([R(ph)],t),t})(),hh=class{position;step;direction;animate;static fToken=Symbol("SetZoomRequest");constructor(o,e,n,i=!1){this.position=o,this.step=e,this.direction=n,this.animate=i}},k8=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),I8=new Set(["drag-canvas","selection-area"]),E8=(()=>{let t=class Ad{_mediator=p(V);_store=p(L);_dragContext=p(he,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(Xe.ZOOM)}get _isDragStarted(){return this._mediator.execute(new fi)}handle(e){if(!this._zoomComponent)return;let n=this._canvas.transform.scale,i=this._clamp(n+e.step*e.direction);if(i===n)return;let r=this._castPositionToFlow(e.position);if(this._isDragStarted){let a=this._getDragZoomMode();if(a==="blocked")return;a==="rebase"&&this._rebaseDragContext(r,i)}this._canvas.setScale(i,r),e.animate?this._canvas.redrawWithAnimation():this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}_clamp(e){return Math.max(this._zoomComponent?.minimum||1,Math.min(e,this._zoomComponent?.maximum||1))}_castPositionToFlow(e){return pe.fromPoint(e).elementTransform(this._flowHost)}_getDragZoomMode(){if(this._dragContext?.isEmpty())return"blocked";let e=!1;for(let n of this._dragContext?.draggableItems??[]){let i=n.getEvent().kind;if(k8.has(i)){e=!0;continue}if(!I8.has(i))return"blocked"}return e?"rebase":"direct"}_rebaseDragContext(e,n){if(!this._dragContext)return;let i=this._dragContext.onPointerDownScale;if(!i||i===n){this._dragContext.onPointerDownScale=n;return}let r=1/n-1/i;this._dragContext.onPointerDownPosition=pe.fromPoint(this._dragContext.onPointerDownPosition).add(pe.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||Ad)};static \u0275prov=y({token:Ad,factory:Ad.\u0275fac})};return t=P([R(hh)],t),t})(),M8=[S8,E8],fh=class{static fToken=Symbol("MinimapDrawNodesRequest")},D8=(()=>{let t=class Ld{_browser=p(at);_store=p(L);handle(e){let n=this._store.fFlow,i=this._store.fCanvas;return!n||!i?[]:this._store.nodes.getAll().map(a=>this._renderNode(a,n,i))}_renderNode(e,n,i){let r=ko("rect",this._browser);em(this._nodeRect(e,n,i),r);let a=e instanceof kh;return r.classList.add("f-component",a?"f-minimap-node":"f-minimap-group"),r.classList.add(...this._minimapClasses(e)),e.isSelected()&&r.classList.add("f-selected"),r}_nodeRect(e,n,i){let r=te.elementTransform(te.fromElement(e.hostElement),n.hostElement);return te.div(r,i.transform.scale)}_minimapClasses(e){let n=e.fMinimapClass();return Array.isArray(n)?n:[n]}static \u0275fac=function(n){return new(n||Ld)};static \u0275prov=y({token:Ld,factory:Ld.\u0275fac})};return t=P([R(fh)],t),t})(),mh=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(o,e){this.svg=o,this.minSize=e}},P8=(()=>{let t=class Bd{_mediator=p(V);_store=p(L);handle({svg:e,minSize:n}){let i=this._store.fFlow,r=this._store.fCanvas;if(!i||!r)return{scale:1,viewBox:te.initialize(0,0,0,0)};let a=this._contentRectInMinimapSpace(i,r,n),s=this._minimapRectInFlowSpace(e,i),c=this._viewportScale(a,s),u=this._viewportViewBox(a,s,c);return{scale:c,viewBox:u}}_contentRectInMinimapSpace(e,n,i){let r=this._nodesBoundingBox(),a=te.elementTransform(r,e.hostElement),s=te.div(a,n.transform.scale);return Kv(s,i)}_nodesBoundingBox(){return this._mediator.execute(new No)??te.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return te.elementTransform(te.fromElement(e),n.hostElement)}_viewportScale(e,n){let i=n.width||1,r=n.height||1;return Math.max(e.width/i,e.height/r)}_viewportViewBox(e,n,i){let r=this._viewportSize(n,i),a=e.x-(r.width-e.width)/2,s=e.y-(r.height-e.height)/2;return te.initialize(a,s,r.width,r.height)}_viewportSize(e,n){return Ot.initialize(e.width*n||0,e.height*n||0)}static \u0275fac=function(n){return new(n||Bd)};static \u0275prov=y({token:Bd,factory:Bd.\u0275fac})};return t=P([R(mh)],t),t})(),_h=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},R8=(()=>{let t=class Vd{_store=p(L);handle(e){let n=this._store.fFlow,i=this._store.fCanvas;if(!n||!i)return te.initialize();let r=te.div(te.fromElement(n.hostElement),i.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||Vd)};static \u0275prov=y({token:Vd,factory:Vd.\u0275fac})};return t=P([R(_h)],t),t})(),gh=class{element;scale;viewBox;constructor(o,e=1,n=te.initialize(0,0,0,0)){this.element=o,this.scale=e,this.viewBox=n}},O8=[D8,P8,R8],bh=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(o){this.position=o}},F8=(()=>{let t=class zd{_store=p(L);handle({position:e}){return qo(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||zd)};static \u0275prov=y({token:zd,factory:zd.\u0275fac})};return t=P([R(bh)],t),t})(),vh=class{static fToken=Symbol("SortNodeLayersRequest")},N8=(()=>{let t=class Hd{_store=p(L);_mediator=p(V);_browser=p(at);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _fNodeElements(){return Array.from(this._nodesContainer.children)}handle(e){this._getGroups().forEach(n=>{this._moveChildrenNodes(this._getSortedChildrenNodes(n))})}_getGroups(){return this._store.nodes.getAll().filter(e=>this._groupsContainer.contains(e.hostElement))}_getSortedChildrenNodes(e){let n=this._fNodeElements;return this._getChildrenNodes(e.fId()).sort((i,r)=>n.indexOf(i)-n.indexOf(r))}_getChildrenNodes(e){return this._mediator.execute(new zo(e)).filter(n=>this._nodesContainer.contains(n.hostElement)).map(n=>n.hostElement)}_moveChildrenNodes(e){let n=this._browser.document.createDocumentFragment();e.forEach(i=>{n.appendChild(i)}),this._nodesContainer.appendChild(n)}static \u0275fac=function(n){return new(n||Hd)};static \u0275prov=y({token:Hd,factory:Hd.\u0275fac})};return t=P([R(vh)],t),t})(),aa=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(o){this.itemsContainer=o}},A8=(()=>{let t=class qd{_store=p(L);_browser=p(at);handle({itemsContainer:e}){let n=Array.from(e.children);if(n.length<2)return;let i=this._buildPositions(n),r=this._store.nodes.getAll().filter(c=>e.contains(c.hostElement));if(r.length<2||!r.some(c=>!!c.fParentId()))return;let a=this._buildChildrenByParentId(r),s=new Map;for(let c of r){let u=this._getSortedChildrenBeforeParent(e,i,c,a,s);u.length&&this._moveBeforeNextSibling(e,u,c.hostElement.nextElementSibling)}}_buildPositions(e){let n=new Map;for(let i=0;i<e.length;i++)n.set(e[i],i);return n}_getSortedChildrenBeforeParent(e,n,i,r,a){let s=n.get(i.hostElement);if(s===void 0)return[];let c=this._getDeepChildren(i.fId(),r,a);if(!c.length)return[];let u=[];for(let h of c){let g=h.hostElement;if(!e.contains(g))continue;let C=n.get(g);C===void 0||C>=s||u.push(g)}return u.sort((h,g)=>(n.get(h)??0)-(n.get(g)??0)),u}_buildChildrenByParentId(e){let n=new Map;for(let i of e){let r=i.fParentId();if(!r)continue;let a=n.get(r)??[];a.push(i),n.set(r,a)}return n}_getDeepChildren(e,n,i){let r=i.get(e);if(r)return r;let a=[],s=[...n.get(e)??[]],c=new Set([e]);for(;s.length;){let u=s.pop();if(!u)continue;let h=u.fId();if(c.has(h))continue;c.add(h),a.push(u);let g=n.get(h);g?.length&&s.push(...g)}return i.set(e,a),a}_moveBeforeNextSibling(e,n,i){let r=this._browser.document.createDocumentFragment();for(let a of n)r.appendChild(a);e.insertBefore(r,i)}static \u0275fac=function(n){return new(n||qd)};static \u0275prov=y({token:qd,factory:qd.\u0275fac})};return t=P([R(aa)],t),t})(),yh=class{static fToken=Symbol("SortItemLayersRequest")},L8=(()=>{let t=class Gd{_store=p(L);_mediator=p(V);get _canvas(){return this._store.fCanvas}handle(e){if(!this._canvas)return;let n=this._store.nodes.getAll();n.length<2||!n.some(i=>!!i.fParentId())||(this._mediator.execute(new aa(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new vh),this._mediator.execute(new aa(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||Gd)};static \u0275prov=y({token:Gd,factory:Gd.\u0275fac})};return t=P([R(yh)],t),t})();function ko(t,o){return o.document.createElementNS("http://www.w3.org/2000/svg",t)}function an(t,o){return o(t)}function gn(t){return!0}function B8(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var V8=[...r6,...hV,...KL,...QV,...OV,...f8,...$V,...T8,...M8,...O8,...b7,C8,v7,w7,F8,L8,A8,N8,x8,y8],z8=0,gC=(()=>{class t{_destroyRef=p(xt);_elementReference=p(Qe);_fBrowser=p(at);_stateChanges=new rn;get hostElement(){return this._elementReference.nativeElement}id=B(`f-pattern-${z8++}`);vColor=B("rgba(0,0,0,0.1)");hColor=B("rgba(0,0,0,0.1)");vSize=B(20,{transform:xe});hSize=B(20,{transform:xe});_transform=ni.default();_position=U.initialize();_size=Ot.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=ko("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=ko("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=ko("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new En(this._stateChanges).pipe(Ch()).listen(this._destroyRef,()=>this._redraw())}ngOnChanges(e){(e.vSize||e.hSize||e.vColor||e.hColor)&&this._refresh()}_redraw(){this._calculatePattern(),this._redrawPattern(),this._redrawLine(this._vLine,this.vColor(),this._size.width,0,this._size.width,this._size.height),this._redrawLine(this._hLine,this.hColor(),0,this._size.height,this._size.width,this._size.height)}_calculatePattern(){this._position.x=this._transform.position.x+this._transform.scaledPosition.x,this._position.y=this._transform.position.y+this._transform.scaledPosition.y,this._size=Ot.initialize(this.hSize()*this._transform.scale,this.vSize()*this._transform.scale)}_redrawPattern(){this._pattern.setAttribute("x",`${this._position.x}`),this._pattern.setAttribute("y",`${this._position.y}`),this._pattern.setAttribute("width",`${this._size.width}`),this._pattern.setAttribute("height",`${this._size.height}`)}_redrawLine(e,n,i,r,a,s){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${i}`),e.setAttribute("x2",`${a}`),e.setAttribute("y1",`${r}`),e.setAttribute("y2",`${s}`)}setTransform(e){this._transform=e,this._refresh()}_refresh(){this._stateChanges.notify()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=z({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,i){n&2&&O("id",i.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[ke([{provide:pm,useExisting:t}]),ro],decls:0,vars:0,template:function(n,i){},encapsulation:2,changeDetection:0})}return t})();var H8=new be("F_BACKGROUND"),q8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),bC=(()=>{class t extends q8{_mediator=p(V);fBackgroundPattern=Qa(pm);ngOnInit(){this._mediator.execute(new li(Xe.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new jd(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new ci(Xe.BACKGROUND))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-background"]],contentQueries:function(n,i,r){n&1&&Tf(r,i.fBackgroundPattern,pm,5),n&2&&jt()},hostAttrs:[1,"f-component","f-background"],features:[ke([{provide:H8,useExisting:t}]),Z],ngContentSelectors:CL,decls:2,vars:0,template:function(n,i){n&1&&(pn(),W(),se(0,"svg"),$e(1),fe())},styles:["[_nghost-%COMP%]{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})}return t})();var S_=class{position;scale;constructor(o,e){this.position=o,this.scale=e}},G8=new be("F_CANVAS"),j8=(()=>{class t{transform=ni.default();_fCanvasChange=new rn;destroyRef=p(xt);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new En(this._fCanvasChange).pipe(Ud(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new S_(U.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),sa=(()=>{class t extends j8{_mediator=p(V);_componentsStore=p(L);_elementReference=p(Qe);_injector=p(dt);_flowId;fCanvasChange=Ke();position=B(U.initialize(),{transform:U.castToPoint});scale=B(1,{transform:xe});debounceTime=B(0,{transform:xe});debounce=E(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=nt.required("fGroupsContainer");fNodesContainer=nt.required("fNodesContainer");fConnectionsContainer=nt.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new Jp).fId(),this._mediator.execute(new Wd(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){de(()=>{this._mediator.execute(new Xd(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){de(()=>{this._mediator.execute(new Zd(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new Sr(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=ni.toString(this.transform),this._mediator.execute(new si)}redrawWithAnimation(){this._mediator.execute(new Sr(this.transform)),this.hostElement.style.transition=`transform ${B8()?80:150}ms ease-in-out`,this.hostElement.style.transform=ni.toString(this.transform),Ey(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new Kd(e,n))})}fitToScreen(e=U.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new Yd(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new eu(e))})}getScale(){return this.transform.scale||1}setScale(e,n=U.initialize()){this._mediator.execute(new tu(e,n))}resetScale(){this._mediator.execute(new Jd)}ngOnDestroy(){this._mediator.execute(new Qd)}_afterRedraw(e){this._mediator.execute(new oa(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>ao(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-canvas"]],viewQuery:function(n,i){n&1&&hn(i.fGroupsContainer,xL,5)(i.fNodesContainer,wL,5)(i.fConnectionsContainer,TL,5),n&2&&jt(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[ke([{provide:G8,useExisting:t}]),Z],ngContentSelectors:kL,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,i){n&1&&(pn(SL),Ya(0),se(1,"div",null,0),$e(3),fe(),se(4,"div",3,1),$e(6,1),$e(7,2),$e(8,3),fe(),se(9,"div",null,2),$e(11,4),fe(),Xa())},styles:["[_nghost-%COMP%]{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}.f-canvas-dragging[_nghost-%COMP%], .canvas-dragging[_nghost-%COMP%]{transform:translateZ(0)}.f-connections-container[_ngcontent-%COMP%]{position:absolute;z-index:2}"],changeDetection:0})}return t})();var U8=0,vC=(()=>{class t extends e7{fId=B(`f-connection-${U8++}`,{alias:"fConnectionId"});fOutputId=B("",{transform:e=>Ro(e)||""});fInputId=B("",{transform:e=>Ro(e)||""});fRadius=8;fOffset=12;fBehavior=ri.FIXED;fType=wo.STRAIGHT;fSelectionDisabled=B(!1,{transform:j});fReassignableStart=B(!1,{transform:j});fDraggingDisabled=B(!1,{alias:"fReassignDisabled",transform:j});fInputSide=B(Ye.DEFAULT,{transform:e=>xo(e,"fInputSide",Ye)});fOutputSide=B(Ye.DEFAULT,{transform:e=>xo(e,"fOutputSide",Ye)});get boundingElement(){return this.fPath().hostElement}_mediator=p(V);ngOnInit(){this._mediator.execute(new iu(this))}ngOnChanges(){this._mediator.execute(new Ai)}ngOnDestroy(){this._mediator.execute(new Eu(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,i){n&2&&(O("id",i.fId()),ue("f-connection-selection-disabled",i.fSelectionDisabled())("f-connection-reassign-disabled",i.fDraggingDisabled()))},inputs:{fId:[1,"fConnectionId","fId"],fOutputId:[1,"fOutputId"],fInputId:[1,"fInputId"],fRadius:[2,"fRadius","fRadius",xe],fOffset:[2,"fOffset","fOffset",xe],fBehavior:[2,"fBehavior","fBehavior",e=>xo(e,"fBehavior",ri)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:xh,useExisting:t}]),Z,ro],ngContentSelectors:EL,decls:15,vars:6,consts:[["defs",""],["xmlns","http://www.w3.org/2000/svg"],[1,"f-connection-group"],["fConnectionGradientRenderer","",3,"fConnectionGradientRendererFor"],["fConnectionSelection",""],["f-connection-path","",3,"useGradient"],["f-connection-drag-handle-start","","r","8"],["f-connection-drag-handle-end","","r","8"]],template:function(n,i){if(n&1&&(pn(IL),W(),f(0,"svg",1),F(1,"defs",null,0),$e(3),f(4,"g",2),M(5,ML,1,1,":svg:linearGradient",3),F(6,"path",4),f(7,"g"),F(8,"path",5),M(9,DL,1,0,":svg:circle",6),F(10,"circle",7),_()()(),$e(11,1),$e(12,2),$e(13,3),M(14,PL,1,0)),n&2){let r;l(5),D((r=i.fGradient())?5:-1,r),l(),O("d",i.path),l(2),m("useGradient",!!i.fGradient()),O("d",i.path),l(),D(i.fReassignableStart()?9:-1),l(5),D(i.fContents().length?14:-1)}},dependencies:[Em,X6,Z6,j6,Y6],styles:["[_nghost-%COMP%]{pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{display:block;vertical-align:middle;overflow:visible!important;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%] .f-connection-group[_ngcontent-%COMP%]{pointer-events:all}[_nghost-%COMP%] .f-connection-content[_ngcontent-%COMP%]{pointer-events:all}"],changeDetection:0})}return t})();var $8=new be("F_MAGNETIC_LINES"),W8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})();var yC=(()=>{class t extends W8{threshold=B(10,{transform:xe,alias:"fAlignThreshold"});_mediator=p(V);ngOnInit(){this._mediator.execute(new li(Xe.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new ci(Xe.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[ke([{provide:$8,useExisting:t}]),Z],decls:0,vars:0,template:function(n,i){},styles:[RL]})}return t})();var cm=(()=>{class t{fMinSize=B(1e3);_mediator=p(V);hostElement=p(Qe).nativeElement;model=new gh(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new mh(this.hostElement,this.fMinSize()));this.model=new gh(this.hostElement,e,n),Yv(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),dm=(()=>{class t{_mediator=p(V);_elementRef=p(Qe);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new fh).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),um=(()=>{class t{_mediator=p(V);hostElement=p(Qe).nativeElement;redraw(){em(this._mediator.execute(new _h),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),K8=new be("F_MINIMAP_BASE"),Y8=(()=>{class t{hostElement=p(Qe).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),CC=(()=>{class t extends Y8{_destroyRef=p(xt);_mediator=p(V);_browser=p(at);_store=p(L);_canvas=nt.required(dm);_flow=nt.required(cm);_minimapView=nt.required(um);fMinSize=B(1e3);fNodeRenderLimit=B(1500,{transform:xe});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new li(Xe.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new $d).pipe(Ch(),AL()).listen(this._destroyRef,()=>{this._redraw()})}_redraw(){if(this._browser.isBrowser()){if(this._isOverNodeRenderLimit()){this._canvas().clear();return}this._flow().redraw(),this._minimapView().redraw(),this._canvas().redraw()}}_isOverNodeRenderLimit(){let e=this.fNodeRenderLimit();return e>0&&this._store.nodes.size()>e}ngOnDestroy(){this._mediator.execute(new ci(Xe.MINIMAP))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-minimap"]],viewQuery:function(n,i){n&1&&hn(i._canvas,dm,5)(i._flow,cm,5)(i._minimapView,um,5),n&2&&jt(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[ke([{provide:K8,useExisting:t}]),Z],decls:3,vars:1,consts:[["fMinimapFlow","","width","100%","height","100%","fLockedContext","",3,"fMinSize"],["fMinimapCanvas",""],["fMinimapView","","x","0","y","0","width","100%","height","100%","stroke","none"]],template:function(n,i){n&1&&(W(),f(0,"svg",0),F(1,"g",1)(2,"rect",2),_()),n&2&&m("fMinSize",i.fMinSize())},dependencies:[cm,dm,um],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var X8=(()=>{class t{hostElement=p(Qe).nativeElement;initialize(){this.hostElement.style.display="none"}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,standalone:!1})}return t})(),xC=(()=>{class t extends X8{_mediator=p(V);fTrigger=e=>e.shiftKey;ngOnInit(){this._mediator.execute(new li(Xe.SELECTION_AREA,this)),super.initialize()}ngOnDestroy(){this._mediator.execute(new ci(Xe.SELECTION_AREA))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-selection-area"]],hostAttrs:[1,"f-selection-area","f-component"],inputs:{fTrigger:"fTrigger"},features:[Z],decls:0,vars:0,template:function(n,i){},styles:["[_nghost-%COMP%]{position:absolute}"]})}return t})();var Z8=0,Q8=120,la=(()=>{class t extends T_{_destroyRef=p(xt);_mediator=p(V);_browser=p(at);_componentsStore=p(L);_cache=p(Mn);_injector=p(dt);fId=B(`f-flow-${Z8++}`,{alias:"fFlowId"});fCache=B(!1,{transform:j});hostElement=p(Qe).nativeElement;fNodesRendered=Ke();fFullRendered=Ke();fLoaded=Ke();ngOnInit(){this._mediator.execute(new Zp(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){de(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new En(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(Ch(),Ud(Q8),NL()).listen(this._destroyRef,()=>{this._mediator.execute(new fi)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new yh),this._mediator.execute(new ih),this._mediator.execute(new oa(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new oh),this._destroyRef)),this._mediator.execute(new Ai))})}_listenConnectionsChanges(){this._mediator.execute(new To).listen(this._destroyRef,()=>{if(!this._mediator.execute(new fi)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new ah(this._destroyRef));return}this._mediator.execute(new Or)}})}redraw(){this._mediator.execute(new Ai)}reset(){this._mediator.execute(new rh)}getNodesBoundingBox(){return this._mediator.execute(new Wp)}getSelection(){return this._mediator.execute(new ra)}getPositionInFlow(e){return this._mediator.execute(new bh(e))}getState(e){return this._mediator.execute(new th(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new To).pipe(ty()).listen(this._destroyRef,()=>{this._mediator.execute(new dh)})}select(e,n,i=!0){this._mediator.execute(new To).pipe(ty()).listen(this._destroyRef,()=>{this._mediator.execute(new ch(e,n,i))})}clearSelection(){this._mediator.execute(new sh)}ngOnDestroy(){this._mediator.execute(new nh(this))}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275cmp=z({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,i){n&2&&O("id",i.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[ke([V,...jL,zy,Ho,...V8,he,...dV,{provide:M_,useExisting:t}]),Z],ngContentSelectors:FL,decls:7,vars:0,template:function(n,i){n&1&&(pn(OL),Ya(0),$e(1),$e(2,1),$e(3,2),$e(4,3),$e(5,4),$e(6,5),Xa())},styles:["[_nghost-%COMP%]{display:block;position:relative;width:100%;height:100%;overflow:hidden;pointer-events:all;-webkit-user-select:none;user-select:none;touch-action:none} .f-connection-content{position:absolute;left:0;top:0;inline-size:max-content;pointer-events:all;transform-origin:50% 50%} .f-node, .f-group{position:absolute!important;transform-origin:center;-webkit-user-select:none;user-select:none;pointer-events:all;left:0!important;top:0!important;box-sizing:border-box} .f-group{z-index:1} .f-connection-content{z-index:3} .f-node{z-index:4}.hidden[_ngcontent-%COMP%]{opacity:0}"],changeDetection:0})}return t})();var wC=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=p(Ka);_tpl=p(x0);_zone=p(Jt);_componentsStore=p(L,{optional:!0});_views=[];_rafId=null;_isProgressiveRenderActive=!1;ngOnChanges(e){e.fVirtualForOf&&(this._reset(),this._renderProgressively())}ngOnDestroy(){this._reset()}_reset(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._finishProgressiveRender(),this._vc.clear(),this._views.length=0}_renderProgressively(){let n=0;this._startProgressiveRender(),this._zone.runOutsideAngular(()=>{let i=()=>{let r=performance.now();for(;n<this.fVirtualForOf.length&&performance.now()-r<10;){let a=this.fVirtualForOf[n],s=this._vc.createEmbeddedView(this._tpl,{$implicit:a,index:n});this._views.push(s),n++}if(n<this.fVirtualForOf.length){this._rafId=requestAnimationFrame(i);return}this._rafId=null,this._finishProgressiveRender()};this._rafId=requestAnimationFrame(i)})}_startProgressiveRender(){this._isProgressiveRenderActive||(this._isProgressiveRenderActive=!0,this._componentsStore?.beginProgressiveRender())}_finishProgressiveRender(){this._isProgressiveRenderActive&&(this._isProgressiveRenderActive=!1,this._componentsStore?.endProgressiveRender())}static \u0275fac=function(n){return new(n||t)};static \u0275dir=je({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[ro]})}return t})();var bn=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(bn||{}),J8=new be("F_ZOOM"),k_=class{},ez=.1,tz=1,nz=.5,iz=60,oz=.5;function rz(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function az(t,o,e){return sz(t)?cz(o,e):lz(o,e)}function sz(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function lz(t,o){let e=Math.abs(t)/100,n=TC(e,ez,tz);return o*n}function cz(t,o){if(Math.abs(t)<nz)return 0;let e=Math.abs(t)/iz,n=TC(e,0,oz);return o*n}function TC(t,o,e){return Math.max(o,Math.min(e,t))}var ca=(()=>{class t extends k_{_mediator=p(V);_injector=p(dt);_store=p(L);_triggersListener=He.emptyListener();isEnabled=B(!1,{alias:"fZoom",transform:j});fWheelTrigger=gn;fDblClickTrigger=gn;minimum=.1;maximum=4;step=.1;dblClickStep=.5;get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}ngOnInit(){this._mediator.execute(new li(Xe.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){de(()=>{this.isEnabled(),tn(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,He.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,He.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!an(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let i=rz(e);if(i===0)return;let r=this._normalizeWheelStep(e,i);r!==0&&this.setZoom(U.initialize(e.clientX,e.clientY),r,this._calculateDirection(i),!1)};_normalizeWheelStep(e,n){return az(e,n,this.step)}_calculateDirection(e){return e>0?bn.ZOOM_OUT:bn.ZOOM_IN}_onDoubleClick=e=>{if(!an(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;TB(n)||n?.closest("[fLockedContext]")||this.setZoom(U.initialize(e.clientX,e.clientY),this.dblClickStep,bn.ZOOM_IN,!0)};_getToCenterPosition(e,n){return U.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(bn.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(bn.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,te.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,i,r){this._mediator.execute(new hh(e,n,i,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new ph)}_disposeListeners(){this._triggersListener(),this._triggersListener=He.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new ci(Xe.ZOOM))}_listen(e,n,i){this._flowHost.addEventListener(e,n,i)}_unlisten(e,n,i){this._flowHost.removeEventListener(e,n,i)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=G(t)))(i||t)}})();static \u0275dir=je({type:t,selectors:[["f-canvas","fZoom",""]],hostAttrs:[1,"f-zoom","f-component"],inputs:{isEnabled:[1,"fZoom","isEnabled"],fWheelTrigger:"fWheelTrigger",fDblClickTrigger:"fDblClickTrigger",minimum:[2,"fZoomMinimum","minimum",xe],maximum:[2,"fZoomMaximum","maximum",xe],step:[2,"fZoomStep","step",xe],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",xe]},features:[ke([{provide:J8,useExisting:t}]),Z]})}return t})();var SC=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=_t({type:t});static \u0275inj=mt({imports:[gt]})}return t})();var sf=a3(xD(),1);var Ba=(function(t){return t.NETWORK_SIMPLEX="network-simplex",t.TIGHT_TREE="tight-tree",t.LONGEST_PATH="longest-path",t})(Ba||{}),Tre={direction:$i.TOP_BOTTOM,nodeGap:48,layerGap:64,algorithm:Ba.NETWORK_SIMPLEX,defaultNodeSize:Ot.initialize(120,72)},i0=(()=>{class t extends Qp{constructor(){super(Tre)}mergeOptions(e,n={}){return Dt(ge(ge({},e),n),{defaultNodeSize:n.defaultNodeSize?Ot.initialize(n.defaultNodeSize.width,n.defaultNodeSize.height):Ot.initialize(e.defaultNodeSize.width,e.defaultNodeSize.height)})}async calculate(e,n,i){let r=this.resolveLayoutOptions(i),a=this._buildGraph(e,n,r),s=new Map;return sf.layout(a),a.nodes().forEach(c=>{let u=a.node(c),h=e.find(C=>C.id===c);if(!u||!h)return;let g=h.size??r.defaultNodeSize;s.set(c,U.initialize(u.x-g.width/2,u.y-g.height/2))}),{nodes:fC(e,s)}}_buildGraph(e,n,i){let r=new sf.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:this._mapDirection(i.direction),nodesep:i.nodeGap,ranksep:i.layerGap,ranker:this._mapAlgorithm(i.algorithm)}),e.forEach(a=>{let s=a.size??i.defaultNodeSize;r.setNode(a.id,{width:s.width,height:s.height})}),n.forEach(a=>{!r.hasNode(a.source)||!r.hasNode(a.target)||r.setEdge(a.source,a.target,{})}),r}_mapAlgorithm(e){switch(e){case Ba.TIGHT_TREE:return"tight-tree";case Ba.LONGEST_PATH:return"longest-path";case Ba.NETWORK_SIMPLEX:default:return"network-simplex"}}_mapDirection(e){switch(e){case $i.BOTTOM_TOP:return"BT";case $i.LEFT_RIGHT:return"LR";case $i.RIGHT_LEFT:return"RL";case $i.TOP_BOTTOM:default:return"TB"}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var wi={loading:"Loading collection",errorTitle:"Failed to load",emptyTitle:"No nodes match the current filters.",resetFilters:"Reset filters",curationEmptyTitle:"Nothing from your map selection is visible right now.",showAllOnMap:"Show all on map",a11y:{toolbar:"Map controls",panel:"Selected node details"},toolbar:{zoomIn:"Zoom in",zoomOut:"Zoom out",fitToScreen:"Fit to screen",resetLayoutLabel:"Re-arrange layout",resetLayoutTooltip:"Re-arrange the visible nodes",showAllLabel:"Show all",showAllTooltip:"Clear the map selection and show every node again",showAllAria:"Show all nodes on the map",layoutAlgorithmLabel:"Layout algorithm",layoutAlgorithmTooltip:"Layout algorithm",layoutDirectionLabel:"Layout direction",layoutDirectionTooltip:"Layout direction",layoutDirectionUnavailableTooltip:"Direction does not apply to the Organic layout. Switch to Balanced or Stretched to set it.",layoutSpacingLabel:"Layout spacing",layoutSpacingTooltip:"Layout spacing",layoutSpacingUnavailableTooltip:"Spacing does not apply to the Organic layout. Switch to Balanced or Stretched to set it.",connectionTypeLabel:"Connector style",connectionTypeTooltip:"Connector style"},layout:{algorithm:{options:{"network-simplex":{label:"Balanced"},"longest-path":{label:"Stretched"},force:{label:"Organic"}}},direction:{options:{TOP_BOTTOM:{label:"Top to bottom"},BOTTOM_TOP:{label:"Bottom to top"},LEFT_RIGHT:{label:"Left to right"},RIGHT_LEFT:{label:"Right to left"}}},spacing:{options:{compact:{label:"Compact"},normal:{label:"Normal"},spacious:{label:"Spacious"}}},connection:{options:{segment:{label:"Orthogonal"},straight:{label:"Straight"},bezier:{label:"Bezier"},"adaptive-curve":{label:"Adaptive curve"}}}},panel:{resizeLabel:"Resize panel"},resetLayoutConfirm:{header:"Re-arrange layout?",message:"This replaces every saved node position with a fresh automatic layout.",messageVisible:"This re-arranges the visible nodes and replaces their saved positions.",accept:"Re-arrange",reject:"Cancel"}};var lf={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0}};var Sre="adaptive-curve",a0=["segment","straight","bezier","adaptive-curve"],wD="sm.graph.connection-type",TD="sm.graph.layout-algorithm",SD="sm.graph.layout-direction",cf=(()=>{class t{_connectionType=X(o0(wD,kre,Sre));_layoutAlgorithm=X(o0(TD,yb,gb));_layoutDirection=X(o0(SD,Cb,bb));_layoutSpacing=X(vb);connectionType=this._connectionType.asReadonly();layoutAlgorithm=this._layoutAlgorithm.asReadonly();layoutDirection=this._layoutDirection.asReadonly();layoutSpacing=this._layoutSpacing.asReadonly();setConnectionType(e){this._connectionType()!==e&&(this._connectionType.set(e),r0(wD,e))}setLayoutAlgorithm(e){this._layoutAlgorithm()!==e&&(this._layoutAlgorithm.set(e),r0(TD,e))}setLayoutDirection(e){this._layoutDirection()!==e&&(this._layoutDirection.set(e),r0(SD,e))}static toFoblexEnum(e){return e}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function o0(t,o,e){let n=null;try{n=localStorage.getItem(t)}catch{return e}return n&&o(n)?n:e}function r0(t,o){try{localStorage.setItem(t,o)}catch{}}function kre(t){return typeof t=="string"&&a0.includes(t)}function kD(t,o){let e=new Set([o]);for(let n of t.get(o)??[])e.add(n);return e}var Ire={TOP_BOTTOM:{output:Ye.BOTTOM,input:Ye.TOP},BOTTOM_TOP:{output:Ye.TOP,input:Ye.BOTTOM},LEFT_RIGHT:{output:Ye.RIGHT,input:Ye.LEFT},RIGHT_LEFT:{output:Ye.LEFT,input:Ye.RIGHT}};function ID(t,o){return ds(t)?Ire[o]:{input:Ye.CALCULATE,output:Ye.CALCULATE}}var ED=`
2139
2139
  .p-popover {
2140
2140
  margin-block-start: dt('popover.gutter');
2141
2141
  background: dt('popover.background');