@skill-map/cli 0.48.0 → 0.49.0

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.
@@ -1,315 +0,0 @@
1
- import{c as sa,d as ca,e as ma}from"./chunk-QNFHGPFR.js";import{a as Pg,b as pa,c as Mg,d as kg,e as Dg,f as Og,g as Ng,h as Rg,i as Ag,j as Fg,k as Lg,n as gn,o as Bg,q as Ug,r as Wg,s as $g,t as Kg,u as Yg}from"./chunk-OBYZDEVO.js";import"./chunk-VW2A6WZ3.js";import{a as ha,b as $n,c as qg,d as _a,e as ga,f as va,g as Gg,h as Hg,i as Vg,j as jg}from"./chunk-Q747VBQL.js";import{c as vg,d as yg,f as mn,g as _n}from"./chunk-2GTH7ZLV.js";import{a as bg,b as la,c as ua,d as wg,e as Sg,f as Tg,g as fa,h as Ig,i as Dp,j as Co,l as Eg,m as un,n as Ei,p as zg}from"./chunk-AWNZZYAU.js";import{D as cn,E as dn,H as aa,I as De,J as Oe,K as da,L as Cg,M as ln,N as kp,Q as xg,R as Lt,V as fn,W as pn,X as hn,c as Ti,g as pg,h as hg,i as mg,j as Ii,k as sn,m as na,p as ia,q as oa,u as gg,w as Ft,x as ra}from"./chunk-AVGEDQNI.js";import{B as Mp,Ca as _g,H as lg,J as ug,V as fg,b as sg,k as cg,p as ta,u as dg}from"./chunk-4SG4352Z.js";import{f as rg,i as ea,j as ag}from"./chunk-Y6VK27P4.js";import{g as ig,h as og,i as Jr,j as Si,k as an}from"./chunk-L56QU7EF.js";import{$ as Vr,$a as Ee,$b as qe,Ab as bi,Ac as Qr,Bb as jn,Bc as Pp,Cb as Un,Cc as Wn,Db as wi,Eb as Kr,Fb as Yr,Ga as go,Gb as se,Ha as vo,Hb as Tp,Ib as H,Ic as me,Ja as Ur,Jc as $e,Ka as d,Kb as _,L as y,Lb as Kt,M as vi,Mb as ke,Nb as Xr,O as ue,P as yi,Pa as yo,Pb as _t,Q as u,Qa as eg,Qb as gt,Rb as Ip,Sa as tg,Sb as Tt,Ta as wp,Tb as ct,U as J_,Ua as Wr,Ub as Yt,V as Ot,Vb as dt,W as B,Wb as de,X as q,Xb as Zr,Y as Je,Yb as Re,Z as Hr,Za as K,Zb as v,_ as Ye,_a as xi,_b as C,aa as it,ab as $r,ac as Ep,bb as he,bc as ng,ca as st,cb as be,da as Vn,fc as lt,g as b,gc as Xe,ha as z,hc as oe,ic as ge,ja as J,jc as Nt,ka as Ci,kc as vt,la as ee,lb as G,n as Z_,na as Ne,ob as T,pb as I,qb as Sp,ra as jr,rb as Ce,rc as Rt,sb as Y,tb as X,tc as At,u as Q_,ub as M,uc as S,vb as p,wb as h,xb as R,xc as Ve,yb as W,yc as O,zb as $,zc as Ae}from"./chunk-HAWX5WNM.js";import{a as ce,b as Hn,c as gi,e as g,g as ik}from"./chunk-WCABR6TI.js";var Mv=g((Ree,Pv)=>{"use strict";function pF(){this.__data__=[],this.size=0}Pv.exports=pF});var ci=g((Aee,kv)=>{"use strict";function hF(t,i){return t===i||t!==t&&i!==i}kv.exports=hF});var lr=g((Fee,Dv)=>{"use strict";var mF=ci();function _F(t,i){for(var e=t.length;e--;)if(mF(t[e][0],i))return e;return-1}Dv.exports=_F});var Nv=g((Lee,Ov)=>{"use strict";var gF=lr(),vF=Array.prototype,yF=vF.splice;function CF(t){var i=this.__data__,e=gF(i,t);if(e<0)return!1;var n=i.length-1;return e==n?i.pop():yF.call(i,e,1),--this.size,!0}Ov.exports=CF});var Av=g((zee,Rv)=>{"use strict";var xF=lr();function bF(t){var i=this.__data__,e=xF(i,t);return e<0?void 0:i[e][1]}Rv.exports=bF});var Lv=g((Bee,Fv)=>{"use strict";var wF=lr();function SF(t){return wF(this.__data__,t)>-1}Fv.exports=SF});var Bv=g((qee,zv)=>{"use strict";var TF=lr();function IF(t,i){var e=this.__data__,n=TF(e,t);return n<0?(++this.size,e.push([t,i])):e[n][1]=i,this}zv.exports=IF});var ur=g((Gee,qv)=>{"use strict";var EF=Mv(),PF=Nv(),MF=Av(),kF=Lv(),DF=Bv();function Xi(t){var i=-1,e=t==null?0:t.length;for(this.clear();++i<e;){var n=t[i];this.set(n[0],n[1])}}Xi.prototype.clear=EF;Xi.prototype.delete=PF;Xi.prototype.get=MF;Xi.prototype.has=kF;Xi.prototype.set=DF;qv.exports=Xi});var Hv=g((Hee,Gv)=>{"use strict";var OF=ur();function NF(){this.__data__=new OF,this.size=0}Gv.exports=NF});var jv=g((Vee,Vv)=>{"use strict";function RF(t){var i=this.__data__,e=i.delete(t);return this.size=i.size,e}Vv.exports=RF});var Wv=g((jee,Uv)=>{"use strict";function AF(t){return this.__data__.get(t)}Uv.exports=AF});var Kv=g((Uee,$v)=>{"use strict";function FF(t){return this.__data__.has(t)}$v.exports=FF});var dm=g((Wee,Yv)=>{"use strict";var LF=typeof global=="object"&&global&&global.Object===Object&&global;Yv.exports=LF});var xt=g(($ee,Xv)=>{"use strict";var zF=dm(),BF=typeof self=="object"&&self&&self.Object===Object&&self,qF=zF||BF||Function("return this")();Xv.exports=qF});var di=g((Kee,Zv)=>{"use strict";var GF=xt(),HF=GF.Symbol;Zv.exports=HF});var ty=g((Yee,ey)=>{"use strict";var Qv=di(),Jv=Object.prototype,VF=Jv.hasOwnProperty,jF=Jv.toString,fr=Qv?Qv.toStringTag:void 0;function UF(t){var i=VF.call(t,fr),e=t[fr];try{t[fr]=void 0;var n=!0}catch{}var o=jF.call(t);return n&&(i?t[fr]=e:delete t[fr]),o}ey.exports=UF});var iy=g((Xee,ny)=>{"use strict";var WF=Object.prototype,$F=WF.toString;function KF(t){return $F.call(t)}ny.exports=KF});var Dn=g((Zee,ay)=>{"use strict";var oy=di(),YF=ty(),XF=iy(),ZF="[object Null]",QF="[object Undefined]",ry=oy?oy.toStringTag:void 0;function JF(t){return t==null?t===void 0?QF:ZF:ry&&ry in Object(t)?YF(t):XF(t)}ay.exports=JF});var ft=g((Qee,sy)=>{"use strict";function eL(t){var i=typeof t;return t!=null&&(i=="object"||i=="function")}sy.exports=eL});var Zi=g((Jee,cy)=>{"use strict";var tL=Dn(),nL=ft(),iL="[object AsyncFunction]",oL="[object Function]",rL="[object GeneratorFunction]",aL="[object Proxy]";function sL(t){if(!nL(t))return!1;var i=tL(t);return i==oL||i==rL||i==iL||i==aL}cy.exports=sL});var ly=g((ete,dy)=>{"use strict";var cL=xt(),dL=cL["__core-js_shared__"];dy.exports=dL});var py=g((tte,fy)=>{"use strict";var lm=ly(),uy=(function(){var t=/[^.]+$/.exec(lm&&lm.keys&&lm.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function lL(t){return!!uy&&uy in t}fy.exports=lL});var um=g((nte,hy)=>{"use strict";var uL=Function.prototype,fL=uL.toString;function pL(t){if(t!=null){try{return fL.call(t)}catch{}try{return t+""}catch{}}return""}hy.exports=pL});var _y=g((ite,my)=>{"use strict";var hL=Zi(),mL=py(),_L=ft(),gL=um(),vL=/[\\^$.*+?()[\]{}|]/g,yL=/^\[object .+?Constructor\]$/,CL=Function.prototype,xL=Object.prototype,bL=CL.toString,wL=xL.hasOwnProperty,SL=RegExp("^"+bL.call(wL).replace(vL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TL(t){if(!_L(t)||mL(t))return!1;var i=hL(t)?SL:yL;return i.test(gL(t))}my.exports=TL});var vy=g((ote,gy)=>{"use strict";function IL(t,i){return t?.[i]}gy.exports=IL});var On=g((rte,yy)=>{"use strict";var EL=_y(),PL=vy();function ML(t,i){var e=PL(t,i);return EL(e)?e:void 0}yy.exports=ML});var kf=g((ate,Cy)=>{"use strict";var kL=On(),DL=xt(),OL=kL(DL,"Map");Cy.exports=OL});var pr=g((ste,xy)=>{"use strict";var NL=On(),RL=NL(Object,"create");xy.exports=RL});var Sy=g((cte,wy)=>{"use strict";var by=pr();function AL(){this.__data__=by?by(null):{},this.size=0}wy.exports=AL});var Iy=g((dte,Ty)=>{"use strict";function FL(t){var i=this.has(t)&&delete this.__data__[t];return this.size-=i?1:0,i}Ty.exports=FL});var Py=g((lte,Ey)=>{"use strict";var LL=pr(),zL="__lodash_hash_undefined__",BL=Object.prototype,qL=BL.hasOwnProperty;function GL(t){var i=this.__data__;if(LL){var e=i[t];return e===zL?void 0:e}return qL.call(i,t)?i[t]:void 0}Ey.exports=GL});var ky=g((ute,My)=>{"use strict";var HL=pr(),VL=Object.prototype,jL=VL.hasOwnProperty;function UL(t){var i=this.__data__;return HL?i[t]!==void 0:jL.call(i,t)}My.exports=UL});var Oy=g((fte,Dy)=>{"use strict";var WL=pr(),$L="__lodash_hash_undefined__";function KL(t,i){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=WL&&i===void 0?$L:i,this}Dy.exports=KL});var Ry=g((pte,Ny)=>{"use strict";var YL=Sy(),XL=Iy(),ZL=Py(),QL=ky(),JL=Oy();function Qi(t){var i=-1,e=t==null?0:t.length;for(this.clear();++i<e;){var n=t[i];this.set(n[0],n[1])}}Qi.prototype.clear=YL;Qi.prototype.delete=XL;Qi.prototype.get=ZL;Qi.prototype.has=QL;Qi.prototype.set=JL;Ny.exports=Qi});var Ly=g((hte,Fy)=>{"use strict";var Ay=Ry(),e3=ur(),t3=kf();function n3(){this.size=0,this.__data__={hash:new Ay,map:new(t3||e3),string:new Ay}}Fy.exports=n3});var By=g((mte,zy)=>{"use strict";function i3(t){var i=typeof t;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?t!=="__proto__":t===null}zy.exports=i3});var hr=g((_te,qy)=>{"use strict";var o3=By();function r3(t,i){var e=t.__data__;return o3(i)?e[typeof i=="string"?"string":"hash"]:e.map}qy.exports=r3});var Hy=g((gte,Gy)=>{"use strict";var a3=hr();function s3(t){var i=a3(this,t).delete(t);return this.size-=i?1:0,i}Gy.exports=s3});var jy=g((vte,Vy)=>{"use strict";var c3=hr();function d3(t){return c3(this,t).get(t)}Vy.exports=d3});var Wy=g((yte,Uy)=>{"use strict";var l3=hr();function u3(t){return l3(this,t).has(t)}Uy.exports=u3});var Ky=g((Cte,$y)=>{"use strict";var f3=hr();function p3(t,i){var e=f3(this,t),n=e.size;return e.set(t,i),this.size+=e.size==n?0:1,this}$y.exports=p3});var Df=g((xte,Yy)=>{"use strict";var h3=Ly(),m3=Hy(),_3=jy(),g3=Wy(),v3=Ky();function Ji(t){var i=-1,e=t==null?0:t.length;for(this.clear();++i<e;){var n=t[i];this.set(n[0],n[1])}}Ji.prototype.clear=h3;Ji.prototype.delete=m3;Ji.prototype.get=_3;Ji.prototype.has=g3;Ji.prototype.set=v3;Yy.exports=Ji});var Zy=g((bte,Xy)=>{"use strict";var y3=ur(),C3=kf(),x3=Df(),b3=200;function w3(t,i){var e=this.__data__;if(e instanceof y3){var n=e.__data__;if(!C3||n.length<b3-1)return n.push([t,i]),this.size=++e.size,this;e=this.__data__=new x3(n)}return e.set(t,i),this.size=e.size,this}Xy.exports=w3});var mr=g((wte,Qy)=>{"use strict";var S3=ur(),T3=Hv(),I3=jv(),E3=Wv(),P3=Kv(),M3=Zy();function eo(t){var i=this.__data__=new S3(t);this.size=i.size}eo.prototype.clear=T3;eo.prototype.delete=I3;eo.prototype.get=E3;eo.prototype.has=P3;eo.prototype.set=M3;Qy.exports=eo});var Of=g((Ste,Jy)=>{"use strict";function k3(t,i){for(var e=-1,n=t==null?0:t.length;++e<n&&i(t[e],e,t)!==!1;);return t}Jy.exports=k3});var fm=g((Tte,eC)=>{"use strict";var D3=On(),O3=(function(){try{var t=D3(Object,"defineProperty");return t({},"",{}),t}catch{}})();eC.exports=O3});var _r=g((Ite,nC)=>{"use strict";var tC=fm();function N3(t,i,e){i=="__proto__"&&tC?tC(t,i,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[i]=e}nC.exports=N3});var gr=g((Ete,iC)=>{"use strict";var R3=_r(),A3=ci(),F3=Object.prototype,L3=F3.hasOwnProperty;function z3(t,i,e){var n=t[i];(!(L3.call(t,i)&&A3(n,e))||e===void 0&&!(i in t))&&R3(t,i,e)}iC.exports=z3});var to=g((Pte,oC)=>{"use strict";var B3=gr(),q3=_r();function G3(t,i,e,n){var o=!e;e||(e={});for(var r=-1,a=i.length;++r<a;){var s=i[r],c=n?n(e[s],t[s],s,e,t):void 0;c===void 0&&(c=t[s]),o?q3(e,s,c):B3(e,s,c)}return e}oC.exports=G3});var aC=g((Mte,rC)=>{"use strict";function H3(t,i){for(var e=-1,n=Array(t);++e<t;)n[e]=i(e);return n}rC.exports=H3});var Mt=g((kte,sC)=>{"use strict";function V3(t){return t!=null&&typeof t=="object"}sC.exports=V3});var dC=g((Dte,cC)=>{"use strict";var j3=Dn(),U3=Mt(),W3="[object Arguments]";function $3(t){return U3(t)&&j3(t)==W3}cC.exports=$3});var no=g((Ote,fC)=>{"use strict";var lC=dC(),K3=Mt(),uC=Object.prototype,Y3=uC.hasOwnProperty,X3=uC.propertyIsEnumerable,Z3=lC((function(){return arguments})())?lC:function(t){return K3(t)&&Y3.call(t,"callee")&&!X3.call(t,"callee")};fC.exports=Z3});var Ge=g((Nte,pC)=>{"use strict";var Q3=Array.isArray;pC.exports=Q3});var mC=g((Rte,hC)=>{"use strict";function J3(){return!1}hC.exports=J3});var li=g((vr,io)=>{"use strict";var ez=xt(),tz=mC(),vC=typeof vr=="object"&&vr&&!vr.nodeType&&vr,_C=vC&&typeof io=="object"&&io&&!io.nodeType&&io,nz=_C&&_C.exports===vC,gC=nz?ez.Buffer:void 0,iz=gC?gC.isBuffer:void 0,oz=iz||tz;io.exports=oz});var yr=g((Ate,yC)=>{"use strict";var rz=9007199254740991,az=/^(?:0|[1-9]\d*)$/;function sz(t,i){var e=typeof t;return i=i??rz,!!i&&(e=="number"||e!="symbol"&&az.test(t))&&t>-1&&t%1==0&&t<i}yC.exports=sz});var Nf=g((Fte,CC)=>{"use strict";var cz=9007199254740991;function dz(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=cz}CC.exports=dz});var bC=g((Lte,xC)=>{"use strict";var lz=Dn(),uz=Nf(),fz=Mt(),pz="[object Arguments]",hz="[object Array]",mz="[object Boolean]",_z="[object Date]",gz="[object Error]",vz="[object Function]",yz="[object Map]",Cz="[object Number]",xz="[object Object]",bz="[object RegExp]",wz="[object Set]",Sz="[object String]",Tz="[object WeakMap]",Iz="[object ArrayBuffer]",Ez="[object DataView]",Pz="[object Float32Array]",Mz="[object Float64Array]",kz="[object Int8Array]",Dz="[object Int16Array]",Oz="[object Int32Array]",Nz="[object Uint8Array]",Rz="[object Uint8ClampedArray]",Az="[object Uint16Array]",Fz="[object Uint32Array]",Pe={};Pe[Pz]=Pe[Mz]=Pe[kz]=Pe[Dz]=Pe[Oz]=Pe[Nz]=Pe[Rz]=Pe[Az]=Pe[Fz]=!0;Pe[pz]=Pe[hz]=Pe[Iz]=Pe[mz]=Pe[Ez]=Pe[_z]=Pe[gz]=Pe[vz]=Pe[yz]=Pe[Cz]=Pe[xz]=Pe[bz]=Pe[wz]=Pe[Sz]=Pe[Tz]=!1;function Lz(t){return fz(t)&&uz(t.length)&&!!Pe[lz(t)]}xC.exports=Lz});var Cr=g((zte,wC)=>{"use strict";function zz(t){return function(i){return t(i)}}wC.exports=zz});var Rf=g((xr,oo)=>{"use strict";var Bz=dm(),SC=typeof xr=="object"&&xr&&!xr.nodeType&&xr,br=SC&&typeof oo=="object"&&oo&&!oo.nodeType&&oo,qz=br&&br.exports===SC,pm=qz&&Bz.process,Gz=(function(){try{var t=br&&br.require&&br.require("util").types;return t||pm&&pm.binding&&pm.binding("util")}catch{}})();oo.exports=Gz});var ro=g((Bte,EC)=>{"use strict";var Hz=bC(),Vz=Cr(),TC=Rf(),IC=TC&&TC.isTypedArray,jz=IC?Vz(IC):Hz;EC.exports=jz});var hm=g((qte,PC)=>{"use strict";var Uz=aC(),Wz=no(),$z=Ge(),Kz=li(),Yz=yr(),Xz=ro(),Zz=Object.prototype,Qz=Zz.hasOwnProperty;function Jz(t,i){var e=$z(t),n=!e&&Wz(t),o=!e&&!n&&Kz(t),r=!e&&!n&&!o&&Xz(t),a=e||n||o||r,s=a?Uz(t.length,String):[],c=s.length;for(var l in t)(i||Qz.call(t,l))&&!(a&&(l=="length"||o&&(l=="offset"||l=="parent")||r&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Yz(l,c)))&&s.push(l);return s}PC.exports=Jz});var wr=g((Gte,MC)=>{"use strict";var eB=Object.prototype;function tB(t){var i=t&&t.constructor,e=typeof i=="function"&&i.prototype||eB;return t===e}MC.exports=tB});var mm=g((Hte,kC)=>{"use strict";function nB(t,i){return function(e){return t(i(e))}}kC.exports=nB});var OC=g((Vte,DC)=>{"use strict";var iB=mm(),oB=iB(Object.keys,Object);DC.exports=oB});var Af=g((jte,NC)=>{"use strict";var rB=wr(),aB=OC(),sB=Object.prototype,cB=sB.hasOwnProperty;function dB(t){if(!rB(t))return aB(t);var i=[];for(var e in Object(t))cB.call(t,e)&&e!="constructor"&&i.push(e);return i}NC.exports=dB});var Ht=g((Ute,RC)=>{"use strict";var lB=Zi(),uB=Nf();function fB(t){return t!=null&&uB(t.length)&&!lB(t)}RC.exports=fB});var Qt=g((Wte,AC)=>{"use strict";var pB=hm(),hB=Af(),mB=Ht();function _B(t){return mB(t)?pB(t):hB(t)}AC.exports=_B});var LC=g(($te,FC)=>{"use strict";var gB=to(),vB=Qt();function yB(t,i){return t&&gB(i,vB(i),t)}FC.exports=yB});var BC=g((Kte,zC)=>{"use strict";function CB(t){var i=[];if(t!=null)for(var e in Object(t))i.push(e);return i}zC.exports=CB});var GC=g((Yte,qC)=>{"use strict";var xB=ft(),bB=wr(),wB=BC(),SB=Object.prototype,TB=SB.hasOwnProperty;function IB(t){if(!xB(t))return wB(t);var i=bB(t),e=[];for(var n in t)n=="constructor"&&(i||!TB.call(t,n))||e.push(n);return e}qC.exports=IB});var Nn=g((Xte,HC)=>{"use strict";var EB=hm(),PB=GC(),MB=Ht();function kB(t){return MB(t)?EB(t,!0):PB(t)}HC.exports=kB});var jC=g((Zte,VC)=>{"use strict";var DB=to(),OB=Nn();function NB(t,i){return t&&DB(i,OB(i),t)}VC.exports=NB});var _m=g((Sr,ao)=>{"use strict";var RB=xt(),KC=typeof Sr=="object"&&Sr&&!Sr.nodeType&&Sr,UC=KC&&typeof ao=="object"&&ao&&!ao.nodeType&&ao,AB=UC&&UC.exports===KC,WC=AB?RB.Buffer:void 0,$C=WC?WC.allocUnsafe:void 0;function FB(t,i){if(i)return t.slice();var e=t.length,n=$C?$C(e):new t.constructor(e);return t.copy(n),n}ao.exports=FB});var gm=g((Qte,YC)=>{"use strict";function LB(t,i){var e=-1,n=t.length;for(i||(i=Array(n));++e<n;)i[e]=t[e];return i}YC.exports=LB});var vm=g((Jte,XC)=>{"use strict";function zB(t,i){for(var e=-1,n=t==null?0:t.length,o=0,r=[];++e<n;){var a=t[e];i(a,e,t)&&(r[o++]=a)}return r}XC.exports=zB});var ym=g((ene,ZC)=>{"use strict";function BB(){return[]}ZC.exports=BB});var Ff=g((tne,JC)=>{"use strict";var qB=vm(),GB=ym(),HB=Object.prototype,VB=HB.propertyIsEnumerable,QC=Object.getOwnPropertySymbols,jB=QC?function(t){return t==null?[]:(t=Object(t),qB(QC(t),function(i){return VB.call(t,i)}))}:GB;JC.exports=jB});var tx=g((nne,ex)=>{"use strict";var UB=to(),WB=Ff();function $B(t,i){return UB(t,WB(t),i)}ex.exports=$B});var Lf=g((ine,nx)=>{"use strict";function KB(t,i){for(var e=-1,n=i.length,o=t.length;++e<n;)t[o+e]=i[e];return t}nx.exports=KB});var Tr=g((one,ix)=>{"use strict";var YB=mm(),XB=YB(Object.getPrototypeOf,Object);ix.exports=XB});var Cm=g((rne,ox)=>{"use strict";var ZB=Lf(),QB=Tr(),JB=Ff(),eq=ym(),tq=Object.getOwnPropertySymbols,nq=tq?function(t){for(var i=[];t;)ZB(i,JB(t)),t=QB(t);return i}:eq;ox.exports=nq});var ax=g((ane,rx)=>{"use strict";var iq=to(),oq=Cm();function rq(t,i){return iq(t,oq(t),i)}rx.exports=rq});var xm=g((sne,sx)=>{"use strict";var aq=Lf(),sq=Ge();function cq(t,i,e){var n=i(t);return sq(t)?n:aq(n,e(t))}sx.exports=cq});var bm=g((cne,cx)=>{"use strict";var dq=xm(),lq=Ff(),uq=Qt();function fq(t){return dq(t,uq,lq)}cx.exports=fq});var lx=g((dne,dx)=>{"use strict";var pq=xm(),hq=Cm(),mq=Nn();function _q(t){return pq(t,mq,hq)}dx.exports=_q});var fx=g((lne,ux)=>{"use strict";var gq=On(),vq=xt(),yq=gq(vq,"DataView");ux.exports=yq});var hx=g((une,px)=>{"use strict";var Cq=On(),xq=xt(),bq=Cq(xq,"Promise");px.exports=bq});var wm=g((fne,mx)=>{"use strict";var wq=On(),Sq=xt(),Tq=wq(Sq,"Set");mx.exports=Tq});var gx=g((pne,_x)=>{"use strict";var Iq=On(),Eq=xt(),Pq=Iq(Eq,"WeakMap");_x.exports=Pq});var fi=g((hne,Sx)=>{"use strict";var Sm=fx(),Tm=kf(),Im=hx(),Em=wm(),Pm=gx(),wx=Dn(),so=um(),vx="[object Map]",Mq="[object Object]",yx="[object Promise]",Cx="[object Set]",xx="[object WeakMap]",bx="[object DataView]",kq=so(Sm),Dq=so(Tm),Oq=so(Im),Nq=so(Em),Rq=so(Pm),ui=wx;(Sm&&ui(new Sm(new ArrayBuffer(1)))!=bx||Tm&&ui(new Tm)!=vx||Im&&ui(Im.resolve())!=yx||Em&&ui(new Em)!=Cx||Pm&&ui(new Pm)!=xx)&&(ui=function(t){var i=wx(t),e=i==Mq?t.constructor:void 0,n=e?so(e):"";if(n)switch(n){case kq:return bx;case Dq:return vx;case Oq:return yx;case Nq:return Cx;case Rq:return xx}return i});Sx.exports=ui});var Ix=g((mne,Tx)=>{"use strict";var Aq=Object.prototype,Fq=Aq.hasOwnProperty;function Lq(t){var i=t.length,e=new t.constructor(i);return i&&typeof t[0]=="string"&&Fq.call(t,"index")&&(e.index=t.index,e.input=t.input),e}Tx.exports=Lq});var Mm=g((_ne,Ex)=>{"use strict";var zq=xt(),Bq=zq.Uint8Array;Ex.exports=Bq});var zf=g((gne,Mx)=>{"use strict";var Px=Mm();function qq(t){var i=new t.constructor(t.byteLength);return new Px(i).set(new Px(t)),i}Mx.exports=qq});var Dx=g((vne,kx)=>{"use strict";var Gq=zf();function Hq(t,i){var e=i?Gq(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}kx.exports=Hq});var Nx=g((yne,Ox)=>{"use strict";var Vq=/\w*$/;function jq(t){var i=new t.constructor(t.source,Vq.exec(t));return i.lastIndex=t.lastIndex,i}Ox.exports=jq});var zx=g((Cne,Lx)=>{"use strict";var Rx=di(),Ax=Rx?Rx.prototype:void 0,Fx=Ax?Ax.valueOf:void 0;function Uq(t){return Fx?Object(Fx.call(t)):{}}Lx.exports=Uq});var km=g((xne,Bx)=>{"use strict";var Wq=zf();function $q(t,i){var e=i?Wq(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}Bx.exports=$q});var Gx=g((bne,qx)=>{"use strict";var Kq=zf(),Yq=Dx(),Xq=Nx(),Zq=zx(),Qq=km(),Jq="[object Boolean]",eG="[object Date]",tG="[object Map]",nG="[object Number]",iG="[object RegExp]",oG="[object Set]",rG="[object String]",aG="[object Symbol]",sG="[object ArrayBuffer]",cG="[object DataView]",dG="[object Float32Array]",lG="[object Float64Array]",uG="[object Int8Array]",fG="[object Int16Array]",pG="[object Int32Array]",hG="[object Uint8Array]",mG="[object Uint8ClampedArray]",_G="[object Uint16Array]",gG="[object Uint32Array]";function vG(t,i,e){var n=t.constructor;switch(i){case sG:return Kq(t);case Jq:case eG:return new n(+t);case cG:return Yq(t,e);case dG:case lG:case uG:case fG:case pG:case hG:case mG:case _G:case gG:return Qq(t,e);case tG:return new n;case nG:case rG:return new n(t);case iG:return Xq(t);case oG:return new n;case aG:return Zq(t)}}qx.exports=vG});var Dm=g((wne,Vx)=>{"use strict";var yG=ft(),Hx=Object.create,CG=(function(){function t(){}return function(i){if(!yG(i))return{};if(Hx)return Hx(i);t.prototype=i;var e=new t;return t.prototype=void 0,e}})();Vx.exports=CG});var Om=g((Sne,jx)=>{"use strict";var xG=Dm(),bG=Tr(),wG=wr();function SG(t){return typeof t.constructor=="function"&&!wG(t)?xG(bG(t)):{}}jx.exports=SG});var Wx=g((Tne,Ux)=>{"use strict";var TG=fi(),IG=Mt(),EG="[object Map]";function PG(t){return IG(t)&&TG(t)==EG}Ux.exports=PG});var Xx=g((Ine,Yx)=>{"use strict";var MG=Wx(),kG=Cr(),$x=Rf(),Kx=$x&&$x.isMap,DG=Kx?kG(Kx):MG;Yx.exports=DG});var Qx=g((Ene,Zx)=>{"use strict";var OG=fi(),NG=Mt(),RG="[object Set]";function AG(t){return NG(t)&&OG(t)==RG}Zx.exports=AG});var nb=g((Pne,tb)=>{"use strict";var FG=Qx(),LG=Cr(),Jx=Rf(),eb=Jx&&Jx.isSet,zG=eb?LG(eb):FG;tb.exports=zG});var Nm=g((Mne,ab)=>{"use strict";var BG=mr(),qG=Of(),GG=gr(),HG=LC(),VG=jC(),jG=_m(),UG=gm(),WG=tx(),$G=ax(),KG=bm(),YG=lx(),XG=fi(),ZG=Ix(),QG=Gx(),JG=Om(),eH=Ge(),tH=li(),nH=Xx(),iH=ft(),oH=nb(),rH=Qt(),aH=Nn(),sH=1,cH=2,dH=4,ib="[object Arguments]",lH="[object Array]",uH="[object Boolean]",fH="[object Date]",pH="[object Error]",ob="[object Function]",hH="[object GeneratorFunction]",mH="[object Map]",_H="[object Number]",rb="[object Object]",gH="[object RegExp]",vH="[object Set]",yH="[object String]",CH="[object Symbol]",xH="[object WeakMap]",bH="[object ArrayBuffer]",wH="[object DataView]",SH="[object Float32Array]",TH="[object Float64Array]",IH="[object Int8Array]",EH="[object Int16Array]",PH="[object Int32Array]",MH="[object Uint8Array]",kH="[object Uint8ClampedArray]",DH="[object Uint16Array]",OH="[object Uint32Array]",Ie={};Ie[ib]=Ie[lH]=Ie[bH]=Ie[wH]=Ie[uH]=Ie[fH]=Ie[SH]=Ie[TH]=Ie[IH]=Ie[EH]=Ie[PH]=Ie[mH]=Ie[_H]=Ie[rb]=Ie[gH]=Ie[vH]=Ie[yH]=Ie[CH]=Ie[MH]=Ie[kH]=Ie[DH]=Ie[OH]=!0;Ie[pH]=Ie[ob]=Ie[xH]=!1;function Bf(t,i,e,n,o,r){var a,s=i&sH,c=i&cH,l=i&dH;if(e&&(a=o?e(t,n,o,r):e(t)),a!==void 0)return a;if(!iH(t))return t;var f=eH(t);if(f){if(a=ZG(t),!s)return UG(t,a)}else{var m=XG(t),x=m==ob||m==hH;if(tH(t))return jG(t,s);if(m==rb||m==ib||x&&!o){if(a=c||x?{}:JG(t),!s)return c?$G(t,VG(a,t)):WG(t,HG(a,t))}else{if(!Ie[m])return o?t:{};a=QG(t,m,s)}}r||(r=new BG);var P=r.get(t);if(P)return P;r.set(t,a),oH(t)?t.forEach(function(j){a.add(Bf(j,i,e,j,t,r))}):nH(t)&&t.forEach(function(j,L){a.set(L,Bf(j,i,e,L,t,r))});var E=l?c?YG:KG:c?aH:rH,N=f?void 0:E(t);return qG(N||t,function(j,L){N&&(L=j,j=t[L]),GG(a,L,Bf(j,i,e,L,t,r))}),a}ab.exports=Bf});var cb=g((kne,sb)=>{"use strict";var NH=Nm(),RH=4;function AH(t){return NH(t,RH)}sb.exports=AH});var qf=g((Dne,db)=>{"use strict";function FH(t){return function(){return t}}db.exports=FH});var ub=g((One,lb)=>{"use strict";function LH(t){return function(i,e,n){for(var o=-1,r=Object(i),a=n(i),s=a.length;s--;){var c=a[t?s:++o];if(e(r[c],c,r)===!1)break}return i}}lb.exports=LH});var Gf=g((Nne,fb)=>{"use strict";var zH=ub(),BH=zH();fb.exports=BH});var Hf=g((Rne,pb)=>{"use strict";var qH=Gf(),GH=Qt();function HH(t,i){return t&&qH(t,i,GH)}pb.exports=HH});var mb=g((Ane,hb)=>{"use strict";var VH=Ht();function jH(t,i){return function(e,n){if(e==null)return e;if(!VH(e))return t(e,n);for(var o=e.length,r=i?o:-1,a=Object(e);(i?r--:++r<o)&&n(a[r],r,a)!==!1;);return e}}hb.exports=jH});var Ir=g((Fne,_b)=>{"use strict";var UH=Hf(),WH=mb(),$H=WH(UH);_b.exports=$H});var Rn=g((Lne,gb)=>{"use strict";function KH(t){return t}gb.exports=KH});var Rm=g((zne,vb)=>{"use strict";var YH=Rn();function XH(t){return typeof t=="function"?t:YH}vb.exports=XH});var Am=g((Bne,yb)=>{"use strict";var ZH=Of(),QH=Ir(),JH=Rm(),eV=Ge();function tV(t,i){var e=eV(t)?ZH:QH;return e(t,JH(i))}yb.exports=tV});var Fm=g((qne,Cb)=>{"use strict";Cb.exports=Am()});var bb=g((Gne,xb)=>{"use strict";var nV=Ir();function iV(t,i){var e=[];return nV(t,function(n,o,r){i(n,o,r)&&e.push(n)}),e}xb.exports=iV});var Sb=g((Hne,wb)=>{"use strict";var oV="__lodash_hash_undefined__";function rV(t){return this.__data__.set(t,oV),this}wb.exports=rV});var Ib=g((Vne,Tb)=>{"use strict";function aV(t){return this.__data__.has(t)}Tb.exports=aV});var Lm=g((jne,Eb)=>{"use strict";var sV=Df(),cV=Sb(),dV=Ib();function Vf(t){var i=-1,e=t==null?0:t.length;for(this.__data__=new sV;++i<e;)this.add(t[i])}Vf.prototype.add=Vf.prototype.push=cV;Vf.prototype.has=dV;Eb.exports=Vf});var Mb=g((Une,Pb)=>{"use strict";function lV(t,i){for(var e=-1,n=t==null?0:t.length;++e<n;)if(i(t[e],e,t))return!0;return!1}Pb.exports=lV});var zm=g((Wne,kb)=>{"use strict";function uV(t,i){return t.has(i)}kb.exports=uV});var Bm=g(($ne,Db)=>{"use strict";var fV=Lm(),pV=Mb(),hV=zm(),mV=1,_V=2;function gV(t,i,e,n,o,r){var a=e&mV,s=t.length,c=i.length;if(s!=c&&!(a&&c>s))return!1;var l=r.get(t),f=r.get(i);if(l&&f)return l==i&&f==t;var m=-1,x=!0,P=e&_V?new fV:void 0;for(r.set(t,i),r.set(i,t);++m<s;){var E=t[m],N=i[m];if(n)var j=a?n(N,E,m,i,t,r):n(E,N,m,t,i,r);if(j!==void 0){if(j)continue;x=!1;break}if(P){if(!pV(i,function(L,U){if(!hV(P,U)&&(E===L||o(E,L,e,n,r)))return P.push(U)})){x=!1;break}}else if(!(E===N||o(E,N,e,n,r))){x=!1;break}}return r.delete(t),r.delete(i),x}Db.exports=gV});var Nb=g((Kne,Ob)=>{"use strict";function vV(t){var i=-1,e=Array(t.size);return t.forEach(function(n,o){e[++i]=[o,n]}),e}Ob.exports=vV});var jf=g((Yne,Rb)=>{"use strict";function yV(t){var i=-1,e=Array(t.size);return t.forEach(function(n){e[++i]=n}),e}Rb.exports=yV});var Bb=g((Xne,zb)=>{"use strict";var Ab=di(),Fb=Mm(),CV=ci(),xV=Bm(),bV=Nb(),wV=jf(),SV=1,TV=2,IV="[object Boolean]",EV="[object Date]",PV="[object Error]",MV="[object Map]",kV="[object Number]",DV="[object RegExp]",OV="[object Set]",NV="[object String]",RV="[object Symbol]",AV="[object ArrayBuffer]",FV="[object DataView]",Lb=Ab?Ab.prototype:void 0,qm=Lb?Lb.valueOf:void 0;function LV(t,i,e,n,o,r,a){switch(e){case FV:if(t.byteLength!=i.byteLength||t.byteOffset!=i.byteOffset)return!1;t=t.buffer,i=i.buffer;case AV:return!(t.byteLength!=i.byteLength||!r(new Fb(t),new Fb(i)));case IV:case EV:case kV:return CV(+t,+i);case PV:return t.name==i.name&&t.message==i.message;case DV:case NV:return t==i+"";case MV:var s=bV;case OV:var c=n&SV;if(s||(s=wV),t.size!=i.size&&!c)return!1;var l=a.get(t);if(l)return l==i;n|=TV,a.set(t,i);var f=xV(s(t),s(i),n,o,r,a);return a.delete(t),f;case RV:if(qm)return qm.call(t)==qm.call(i)}return!1}zb.exports=LV});var Hb=g((Zne,Gb)=>{"use strict";var qb=bm(),zV=1,BV=Object.prototype,qV=BV.hasOwnProperty;function GV(t,i,e,n,o,r){var a=e&zV,s=qb(t),c=s.length,l=qb(i),f=l.length;if(c!=f&&!a)return!1;for(var m=c;m--;){var x=s[m];if(!(a?x in i:qV.call(i,x)))return!1}var P=r.get(t),E=r.get(i);if(P&&E)return P==i&&E==t;var N=!0;r.set(t,i),r.set(i,t);for(var j=a;++m<c;){x=s[m];var L=t[x],U=i[x];if(n)var ie=a?n(U,L,x,i,t,r):n(L,U,x,t,i,r);if(!(ie===void 0?L===U||o(L,U,e,n,r):ie)){N=!1;break}j||(j=x=="constructor")}if(N&&!j){var xe=t.constructor,le=i.constructor;xe!=le&&"constructor"in t&&"constructor"in i&&!(typeof xe=="function"&&xe instanceof xe&&typeof le=="function"&&le instanceof le)&&(N=!1)}return r.delete(t),r.delete(i),N}Gb.exports=GV});var Xb=g((Qne,Yb)=>{"use strict";var Gm=mr(),HV=Bm(),VV=Bb(),jV=Hb(),Vb=fi(),jb=Ge(),Ub=li(),UV=ro(),WV=1,Wb="[object Arguments]",$b="[object Array]",Uf="[object Object]",$V=Object.prototype,Kb=$V.hasOwnProperty;function KV(t,i,e,n,o,r){var a=jb(t),s=jb(i),c=a?$b:Vb(t),l=s?$b:Vb(i);c=c==Wb?Uf:c,l=l==Wb?Uf:l;var f=c==Uf,m=l==Uf,x=c==l;if(x&&Ub(t)){if(!Ub(i))return!1;a=!0,f=!1}if(x&&!f)return r||(r=new Gm),a||UV(t)?HV(t,i,e,n,o,r):VV(t,i,c,e,n,o,r);if(!(e&WV)){var P=f&&Kb.call(t,"__wrapped__"),E=m&&Kb.call(i,"__wrapped__");if(P||E){var N=P?t.value():t,j=E?i.value():i;return r||(r=new Gm),o(N,j,e,n,r)}}return x?(r||(r=new Gm),jV(t,i,e,n,o,r)):!1}Yb.exports=KV});var Hm=g((Jne,Jb)=>{"use strict";var YV=Xb(),Zb=Mt();function Qb(t,i,e,n,o){return t===i?!0:t==null||i==null||!Zb(t)&&!Zb(i)?t!==t&&i!==i:YV(t,i,e,n,Qb,o)}Jb.exports=Qb});var tw=g((eie,ew)=>{"use strict";var XV=mr(),ZV=Hm(),QV=1,JV=2;function e4(t,i,e,n){var o=e.length,r=o,a=!n;if(t==null)return!r;for(t=Object(t);o--;){var s=e[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<r;){s=e[o];var c=s[0],l=t[c],f=s[1];if(a&&s[2]){if(l===void 0&&!(c in t))return!1}else{var m=new XV;if(n)var x=n(l,f,c,t,i,m);if(!(x===void 0?ZV(f,l,QV|JV,n,m):x))return!1}}return!0}ew.exports=e4});var Vm=g((tie,nw)=>{"use strict";var t4=ft();function n4(t){return t===t&&!t4(t)}nw.exports=n4});var ow=g((nie,iw)=>{"use strict";var i4=Vm(),o4=Qt();function r4(t){for(var i=o4(t),e=i.length;e--;){var n=i[e],o=t[n];i[e]=[n,o,i4(o)]}return i}iw.exports=r4});var jm=g((iie,rw)=>{"use strict";function a4(t,i){return function(e){return e==null?!1:e[t]===i&&(i!==void 0||t in Object(e))}}rw.exports=a4});var sw=g((oie,aw)=>{"use strict";var s4=tw(),c4=ow(),d4=jm();function l4(t){var i=c4(t);return i.length==1&&i[0][2]?d4(i[0][0],i[0][1]):function(e){return e===t||s4(e,t,i)}}aw.exports=l4});var pi=g((rie,cw)=>{"use strict";var u4=Dn(),f4=Mt(),p4="[object Symbol]";function h4(t){return typeof t=="symbol"||f4(t)&&u4(t)==p4}cw.exports=h4});var Wf=g((aie,dw)=>{"use strict";var m4=Ge(),_4=pi(),g4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,v4=/^\w*$/;function y4(t,i){if(m4(t))return!1;var e=typeof t;return e=="number"||e=="symbol"||e=="boolean"||t==null||_4(t)?!0:v4.test(t)||!g4.test(t)||i!=null&&t in Object(i)}dw.exports=y4});var fw=g((sie,uw)=>{"use strict";var lw=Df(),C4="Expected a function";function Um(t,i){if(typeof t!="function"||i!=null&&typeof i!="function")throw new TypeError(C4);var e=function(){var n=arguments,o=i?i.apply(this,n):n[0],r=e.cache;if(r.has(o))return r.get(o);var a=t.apply(this,n);return e.cache=r.set(o,a)||r,a};return e.cache=new(Um.Cache||lw),e}Um.Cache=lw;uw.exports=Um});var hw=g((cie,pw)=>{"use strict";var x4=fw(),b4=500;function w4(t){var i=x4(t,function(n){return e.size===b4&&e.clear(),n}),e=i.cache;return i}pw.exports=w4});var _w=g((die,mw)=>{"use strict";var S4=hw(),T4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I4=/\\(\\)?/g,E4=S4(function(t){var i=[];return t.charCodeAt(0)===46&&i.push(""),t.replace(T4,function(e,n,o,r){i.push(o?r.replace(I4,"$1"):n||e)}),i});mw.exports=E4});var Er=g((lie,gw)=>{"use strict";function P4(t,i){for(var e=-1,n=t==null?0:t.length,o=Array(n);++e<n;)o[e]=i(t[e],e,t);return o}gw.exports=P4});var ww=g((uie,bw)=>{"use strict";var vw=di(),M4=Er(),k4=Ge(),D4=pi(),O4=1/0,yw=vw?vw.prototype:void 0,Cw=yw?yw.toString:void 0;function xw(t){if(typeof t=="string")return t;if(k4(t))return M4(t,xw)+"";if(D4(t))return Cw?Cw.call(t):"";var i=t+"";return i=="0"&&1/t==-O4?"-0":i}bw.exports=xw});var Wm=g((fie,Sw)=>{"use strict";var N4=ww();function R4(t){return t==null?"":N4(t)}Sw.exports=R4});var Pr=g((pie,Tw)=>{"use strict";var A4=Ge(),F4=Wf(),L4=_w(),z4=Wm();function B4(t,i){return A4(t)?t:F4(t,i)?[t]:L4(z4(t))}Tw.exports=B4});var co=g((hie,Iw)=>{"use strict";var q4=pi(),G4=1/0;function H4(t){if(typeof t=="string"||q4(t))return t;var i=t+"";return i=="0"&&1/t==-G4?"-0":i}Iw.exports=H4});var Mr=g((mie,Ew)=>{"use strict";var V4=Pr(),j4=co();function U4(t,i){i=V4(i,t);for(var e=0,n=i.length;t!=null&&e<n;)t=t[j4(i[e++])];return e&&e==n?t:void 0}Ew.exports=U4});var Mw=g((_ie,Pw)=>{"use strict";var W4=Mr();function $4(t,i,e){var n=t==null?void 0:W4(t,i);return n===void 0?e:n}Pw.exports=$4});var Dw=g((gie,kw)=>{"use strict";function K4(t,i){return t!=null&&i in Object(t)}kw.exports=K4});var $m=g((vie,Ow)=>{"use strict";var Y4=Pr(),X4=no(),Z4=Ge(),Q4=yr(),J4=Nf(),ej=co();function tj(t,i,e){i=Y4(i,t);for(var n=-1,o=i.length,r=!1;++n<o;){var a=ej(i[n]);if(!(r=t!=null&&e(t,a)))break;t=t[a]}return r||++n!=o?r:(o=t==null?0:t.length,!!o&&J4(o)&&Q4(a,o)&&(Z4(t)||X4(t)))}Ow.exports=tj});var Km=g((yie,Nw)=>{"use strict";var nj=Dw(),ij=$m();function oj(t,i){return t!=null&&ij(t,i,nj)}Nw.exports=oj});var Aw=g((Cie,Rw)=>{"use strict";var rj=Hm(),aj=Mw(),sj=Km(),cj=Wf(),dj=Vm(),lj=jm(),uj=co(),fj=1,pj=2;function hj(t,i){return cj(t)&&dj(i)?lj(uj(t),i):function(e){var n=aj(e,t);return n===void 0&&n===i?sj(e,t):rj(i,n,fj|pj)}}Rw.exports=hj});var Ym=g((xie,Fw)=>{"use strict";function mj(t){return function(i){return i?.[t]}}Fw.exports=mj});var zw=g((bie,Lw)=>{"use strict";var _j=Mr();function gj(t){return function(i){return _j(i,t)}}Lw.exports=gj});var qw=g((wie,Bw)=>{"use strict";var vj=Ym(),yj=zw(),Cj=Wf(),xj=co();function bj(t){return Cj(t)?vj(xj(t)):yj(t)}Bw.exports=bj});var Vt=g((Sie,Gw)=>{"use strict";var wj=sw(),Sj=Aw(),Tj=Rn(),Ij=Ge(),Ej=qw();function Pj(t){return typeof t=="function"?t:t==null?Tj:typeof t=="object"?Ij(t)?Sj(t[0],t[1]):wj(t):Ej(t)}Gw.exports=Pj});var Xm=g((Tie,Hw)=>{"use strict";var Mj=vm(),kj=bb(),Dj=Vt(),Oj=Ge();function Nj(t,i){var e=Oj(t)?Mj:kj;return e(t,Dj(i,3))}Hw.exports=Nj});var jw=g((Iie,Vw)=>{"use strict";var Rj=Object.prototype,Aj=Rj.hasOwnProperty;function Fj(t,i){return t!=null&&Aj.call(t,i)}Vw.exports=Fj});var Zm=g((Eie,Uw)=>{"use strict";var Lj=jw(),zj=$m();function Bj(t,i){return t!=null&&zj(t,i,Lj)}Uw.exports=Bj});var $w=g((Pie,Ww)=>{"use strict";var qj=Af(),Gj=fi(),Hj=no(),Vj=Ge(),jj=Ht(),Uj=li(),Wj=wr(),$j=ro(),Kj="[object Map]",Yj="[object Set]",Xj=Object.prototype,Zj=Xj.hasOwnProperty;function Qj(t){if(t==null)return!0;if(jj(t)&&(Vj(t)||typeof t=="string"||typeof t.splice=="function"||Uj(t)||$j(t)||Hj(t)))return!t.length;var i=Gj(t);if(i==Kj||i==Yj)return!t.size;if(Wj(t))return!qj(t).length;for(var e in t)if(Zj.call(t,e))return!1;return!0}Ww.exports=Qj});var Qm=g((Mie,Kw)=>{"use strict";function Jj(t){return t===void 0}Kw.exports=Jj});var Jm=g((kie,Yw)=>{"use strict";var e5=Ir(),t5=Ht();function n5(t,i){var e=-1,n=t5(t)?Array(t.length):[];return e5(t,function(o,r,a){n[++e]=i(o,r,a)}),n}Yw.exports=n5});var e_=g((Die,Xw)=>{"use strict";var i5=Er(),o5=Vt(),r5=Jm(),a5=Ge();function s5(t,i){var e=a5(t)?i5:r5;return e(t,o5(i,3))}Xw.exports=s5});var Qw=g((Oie,Zw)=>{"use strict";function c5(t,i,e,n){var o=-1,r=t==null?0:t.length;for(n&&r&&(e=t[++o]);++o<r;)e=i(e,t[o],o,t);return e}Zw.exports=c5});var eS=g((Nie,Jw)=>{"use strict";function d5(t,i,e,n,o){return o(t,function(r,a,s){e=n?(n=!1,r):i(e,r,a,s)}),e}Jw.exports=d5});var t_=g((Rie,tS)=>{"use strict";var l5=Qw(),u5=Ir(),f5=Vt(),p5=eS(),h5=Ge();function m5(t,i,e){var n=h5(t)?l5:p5,o=arguments.length<3;return n(t,f5(i,4),e,o,u5)}tS.exports=m5});var iS=g((Aie,nS)=>{"use strict";var _5=Dn(),g5=Ge(),v5=Mt(),y5="[object String]";function C5(t){return typeof t=="string"||!g5(t)&&v5(t)&&_5(t)==y5}nS.exports=C5});var rS=g((Fie,oS)=>{"use strict";var x5=Ym(),b5=x5("length");oS.exports=b5});var sS=g((Lie,aS)=>{"use strict";var w5="\\ud800-\\udfff",S5="\\u0300-\\u036f",T5="\\ufe20-\\ufe2f",I5="\\u20d0-\\u20ff",E5=S5+T5+I5,P5="\\ufe0e\\ufe0f",M5="\\u200d",k5=RegExp("["+M5+w5+E5+P5+"]");function D5(t){return k5.test(t)}aS.exports=D5});var _S=g((zie,mS)=>{"use strict";var dS="\\ud800-\\udfff",O5="\\u0300-\\u036f",N5="\\ufe20-\\ufe2f",R5="\\u20d0-\\u20ff",A5=O5+N5+R5,F5="\\ufe0e\\ufe0f",L5="["+dS+"]",n_="["+A5+"]",i_="\\ud83c[\\udffb-\\udfff]",z5="(?:"+n_+"|"+i_+")",lS="[^"+dS+"]",uS="(?:\\ud83c[\\udde6-\\uddff]){2}",fS="[\\ud800-\\udbff][\\udc00-\\udfff]",B5="\\u200d",pS=z5+"?",hS="["+F5+"]?",q5="(?:"+B5+"(?:"+[lS,uS,fS].join("|")+")"+hS+pS+")*",G5=hS+pS+q5,H5="(?:"+[lS+n_+"?",n_,uS,fS,L5].join("|")+")",cS=RegExp(i_+"(?="+i_+")|"+H5+G5,"g");function V5(t){for(var i=cS.lastIndex=0;cS.test(t);)++i;return i}mS.exports=V5});var vS=g((Bie,gS)=>{"use strict";var j5=rS(),U5=sS(),W5=_S();function $5(t){return U5(t)?W5(t):j5(t)}gS.exports=$5});var CS=g((qie,yS)=>{"use strict";var K5=Af(),Y5=fi(),X5=Ht(),Z5=iS(),Q5=vS(),J5="[object Map]",eU="[object Set]";function tU(t){if(t==null)return 0;if(X5(t))return Z5(t)?Q5(t):t.length;var i=Y5(t);return i==J5||i==eU?t.size:K5(t).length}yS.exports=tU});var bS=g((Gie,xS)=>{"use strict";var nU=Of(),iU=Dm(),oU=Hf(),rU=Vt(),aU=Tr(),sU=Ge(),cU=li(),dU=Zi(),lU=ft(),uU=ro();function fU(t,i,e){var n=sU(t),o=n||cU(t)||uU(t);if(i=rU(i,4),e==null){var r=t&&t.constructor;o?e=n?new r:[]:lU(t)?e=dU(r)?iU(aU(t)):{}:e={}}return(o?nU:oU)(t,function(a,s,c){return i(e,a,s,c)}),e}xS.exports=fU});var IS=g((Hie,TS)=>{"use strict";var wS=di(),pU=no(),hU=Ge(),SS=wS?wS.isConcatSpreadable:void 0;function mU(t){return hU(t)||pU(t)||!!(SS&&t&&t[SS])}TS.exports=mU});var $f=g((Vie,PS)=>{"use strict";var _U=Lf(),gU=IS();function ES(t,i,e,n,o){var r=-1,a=t.length;for(e||(e=gU),o||(o=[]);++r<a;){var s=t[r];i>0&&e(s)?i>1?ES(s,i-1,e,n,o):_U(o,s):n||(o[o.length]=s)}return o}PS.exports=ES});var kS=g((jie,MS)=>{"use strict";function vU(t,i,e){switch(e.length){case 0:return t.call(i);case 1:return t.call(i,e[0]);case 2:return t.call(i,e[0],e[1]);case 3:return t.call(i,e[0],e[1],e[2])}return t.apply(i,e)}MS.exports=vU});var o_=g((Uie,OS)=>{"use strict";var yU=kS(),DS=Math.max;function CU(t,i,e){return i=DS(i===void 0?t.length-1:i,0),function(){for(var n=arguments,o=-1,r=DS(n.length-i,0),a=Array(r);++o<r;)a[o]=n[i+o];o=-1;for(var s=Array(i+1);++o<i;)s[o]=n[o];return s[i]=e(a),yU(t,this,s)}}OS.exports=CU});var AS=g((Wie,RS)=>{"use strict";var xU=qf(),NS=fm(),bU=Rn(),wU=NS?function(t,i){return NS(t,"toString",{configurable:!0,enumerable:!1,value:xU(i),writable:!0})}:bU;RS.exports=wU});var LS=g(($ie,FS)=>{"use strict";var SU=800,TU=16,IU=Date.now;function EU(t){var i=0,e=0;return function(){var n=IU(),o=TU-(n-e);if(e=n,o>0){if(++i>=SU)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}FS.exports=EU});var r_=g((Kie,zS)=>{"use strict";var PU=AS(),MU=LS(),kU=MU(PU);zS.exports=kU});var kr=g((Yie,BS)=>{"use strict";var DU=Rn(),OU=o_(),NU=r_();function RU(t,i){return NU(OU(t,i,DU),t+"")}BS.exports=RU});var a_=g((Xie,qS)=>{"use strict";function AU(t,i,e,n){for(var o=t.length,r=e+(n?1:-1);n?r--:++r<o;)if(i(t[r],r,t))return r;return-1}qS.exports=AU});var HS=g((Zie,GS)=>{"use strict";function FU(t){return t!==t}GS.exports=FU});var jS=g((Qie,VS)=>{"use strict";function LU(t,i,e){for(var n=e-1,o=t.length;++n<o;)if(t[n]===i)return n;return-1}VS.exports=LU});var WS=g((Jie,US)=>{"use strict";var zU=a_(),BU=HS(),qU=jS();function GU(t,i,e){return i===i?qU(t,i,e):zU(t,BU,e)}US.exports=GU});var KS=g((eoe,$S)=>{"use strict";var HU=WS();function VU(t,i){var e=t==null?0:t.length;return!!e&&HU(t,i,0)>-1}$S.exports=VU});var XS=g((toe,YS)=>{"use strict";function jU(t,i,e){for(var n=-1,o=t==null?0:t.length;++n<o;)if(e(i,t[n]))return!0;return!1}YS.exports=jU});var QS=g((noe,ZS)=>{"use strict";function UU(){}ZS.exports=UU});var e1=g((ioe,JS)=>{"use strict";var s_=wm(),WU=QS(),$U=jf(),KU=1/0,YU=s_&&1/$U(new s_([,-0]))[1]==KU?function(t){return new s_(t)}:WU;JS.exports=YU});var n1=g((ooe,t1)=>{"use strict";var XU=Lm(),ZU=KS(),QU=XS(),JU=zm(),eW=e1(),tW=jf(),nW=200;function iW(t,i,e){var n=-1,o=ZU,r=t.length,a=!0,s=[],c=s;if(e)a=!1,o=QU;else if(r>=nW){var l=i?null:eW(t);if(l)return tW(l);a=!1,o=JU,c=new XU}else c=i?[]:s;e:for(;++n<r;){var f=t[n],m=i?i(f):f;if(f=e||f!==0?f:0,a&&m===m){for(var x=c.length;x--;)if(c[x]===m)continue e;i&&c.push(m),s.push(f)}else o(c,m,e)||(c!==s&&c.push(m),s.push(f))}return s}t1.exports=iW});var c_=g((roe,i1)=>{"use strict";var oW=Ht(),rW=Mt();function aW(t){return rW(t)&&oW(t)}i1.exports=aW});var r1=g((aoe,o1)=>{"use strict";var sW=$f(),cW=kr(),dW=n1(),lW=c_(),uW=cW(function(t){return dW(sW(t,1,lW,!0))});o1.exports=uW});var s1=g((soe,a1)=>{"use strict";var fW=Er();function pW(t,i){return fW(i,function(e){return t[e]})}a1.exports=pW});var d_=g((coe,c1)=>{"use strict";var hW=s1(),mW=Qt();function _W(t){return t==null?[]:hW(t,mW(t))}c1.exports=_W});var pt=g((doe,d1)=>{"use strict";var Kf;if(typeof gi=="function")try{Kf={clone:cb(),constant:qf(),each:Fm(),filter:Xm(),has:Zm(),isArray:Ge(),isEmpty:$w(),isFunction:Zi(),isUndefined:Qm(),keys:Qt(),map:e_(),reduce:t_(),size:CS(),transform:bS(),union:r1(),values:d_()}}catch{}Kf||(Kf=window._);d1.exports=Kf});var Yf=g((uoe,p1)=>{"use strict";var te=pt();p1.exports=ae;var gW="\0",hi="\0",l1="";function ae(t){this._isDirected=te.has(t,"directed")?t.directed:!0,this._isMultigraph=te.has(t,"multigraph")?t.multigraph:!1,this._isCompound=te.has(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=te.constant(void 0),this._defaultEdgeLabelFn=te.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[hi]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}ae.prototype._nodeCount=0;ae.prototype._edgeCount=0;ae.prototype.isDirected=function(){return this._isDirected};ae.prototype.isMultigraph=function(){return this._isMultigraph};ae.prototype.isCompound=function(){return this._isCompound};ae.prototype.setGraph=function(t){return this._label=t,this};ae.prototype.graph=function(){return this._label};ae.prototype.setDefaultNodeLabel=function(t){return te.isFunction(t)||(t=te.constant(t)),this._defaultNodeLabelFn=t,this};ae.prototype.nodeCount=function(){return this._nodeCount};ae.prototype.nodes=function(){return te.keys(this._nodes)};ae.prototype.sources=function(){var t=this;return te.filter(this.nodes(),function(i){return te.isEmpty(t._in[i])})};ae.prototype.sinks=function(){var t=this;return te.filter(this.nodes(),function(i){return te.isEmpty(t._out[i])})};ae.prototype.setNodes=function(t,i){var e=arguments,n=this;return te.each(t,function(o){e.length>1?n.setNode(o,i):n.setNode(o)}),this};ae.prototype.setNode=function(t,i){return te.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=i),this):(this._nodes[t]=arguments.length>1?i:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=hi,this._children[t]={},this._children[hi][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)};ae.prototype.node=function(t){return this._nodes[t]};ae.prototype.hasNode=function(t){return te.has(this._nodes,t)};ae.prototype.removeNode=function(t){var i=this;if(te.has(this._nodes,t)){var e=function(n){i.removeEdge(i._edgeObjs[n])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],te.each(this.children(t),function(n){i.setParent(n)}),delete this._children[t]),te.each(te.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],te.each(te.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this};ae.prototype.setParent=function(t,i){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(te.isUndefined(i))i=hi;else{i+="";for(var e=i;!te.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+i+" as parent of "+t+" would create a cycle");this.setNode(i)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=i,this._children[i][t]=!0,this};ae.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]};ae.prototype.parent=function(t){if(this._isCompound){var i=this._parent[t];if(i!==hi)return i}};ae.prototype.children=function(t){if(te.isUndefined(t)&&(t=hi),this._isCompound){var i=this._children[t];if(i)return te.keys(i)}else{if(t===hi)return this.nodes();if(this.hasNode(t))return[]}};ae.prototype.predecessors=function(t){var i=this._preds[t];if(i)return te.keys(i)};ae.prototype.successors=function(t){var i=this._sucs[t];if(i)return te.keys(i)};ae.prototype.neighbors=function(t){var i=this.predecessors(t);if(i)return te.union(i,this.successors(t))};ae.prototype.isLeaf=function(t){var i;return this.isDirected()?i=this.successors(t):i=this.neighbors(t),i.length===0};ae.prototype.filterNodes=function(t){var i=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});i.setGraph(this.graph());var e=this;te.each(this._nodes,function(r,a){t(a)&&i.setNode(a,r)}),te.each(this._edgeObjs,function(r){i.hasNode(r.v)&&i.hasNode(r.w)&&i.setEdge(r,e.edge(r))});var n={};function o(r){var a=e.parent(r);return a===void 0||i.hasNode(a)?(n[r]=a,a):a in n?n[a]:o(a)}return this._isCompound&&te.each(i.nodes(),function(r){i.setParent(r,o(r))}),i};ae.prototype.setDefaultEdgeLabel=function(t){return te.isFunction(t)||(t=te.constant(t)),this._defaultEdgeLabelFn=t,this};ae.prototype.edgeCount=function(){return this._edgeCount};ae.prototype.edges=function(){return te.values(this._edgeObjs)};ae.prototype.setPath=function(t,i){var e=this,n=arguments;return te.reduce(t,function(o,r){return n.length>1?e.setEdge(o,r,i):e.setEdge(o,r),r}),this};ae.prototype.setEdge=function(){var t,i,e,n,o=!1,r=arguments[0];typeof r=="object"&&r!==null&&"v"in r?(t=r.v,i=r.w,e=r.name,arguments.length===2&&(n=arguments[1],o=!0)):(t=r,i=arguments[1],e=arguments[3],arguments.length>2&&(n=arguments[2],o=!0)),t=""+t,i=""+i,te.isUndefined(e)||(e=""+e);var a=Dr(this._isDirected,t,i,e);if(te.has(this._edgeLabels,a))return o&&(this._edgeLabels[a]=n),this;if(!te.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(i),this._edgeLabels[a]=o?n:this._defaultEdgeLabelFn(t,i,e);var s=vW(this._isDirected,t,i,e);return t=s.v,i=s.w,Object.freeze(s),this._edgeObjs[a]=s,u1(this._preds[i],t),u1(this._sucs[t],i),this._in[i][a]=s,this._out[t][a]=s,this._edgeCount++,this};ae.prototype.edge=function(t,i,e){var n=arguments.length===1?l_(this._isDirected,arguments[0]):Dr(this._isDirected,t,i,e);return this._edgeLabels[n]};ae.prototype.hasEdge=function(t,i,e){var n=arguments.length===1?l_(this._isDirected,arguments[0]):Dr(this._isDirected,t,i,e);return te.has(this._edgeLabels,n)};ae.prototype.removeEdge=function(t,i,e){var n=arguments.length===1?l_(this._isDirected,arguments[0]):Dr(this._isDirected,t,i,e),o=this._edgeObjs[n];return o&&(t=o.v,i=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],f1(this._preds[i],t),f1(this._sucs[t],i),delete this._in[i][n],delete this._out[t][n],this._edgeCount--),this};ae.prototype.inEdges=function(t,i){var e=this._in[t];if(e){var n=te.values(e);return i?te.filter(n,function(o){return o.v===i}):n}};ae.prototype.outEdges=function(t,i){var e=this._out[t];if(e){var n=te.values(e);return i?te.filter(n,function(o){return o.w===i}):n}};ae.prototype.nodeEdges=function(t,i){var e=this.inEdges(t,i);if(e)return e.concat(this.outEdges(t,i))};function u1(t,i){t[i]?t[i]++:t[i]=1}function f1(t,i){--t[i]||delete t[i]}function Dr(t,i,e,n){var o=""+i,r=""+e;if(!t&&o>r){var a=o;o=r,r=a}return o+l1+r+l1+(te.isUndefined(n)?gW:n)}function vW(t,i,e,n){var o=""+i,r=""+e;if(!t&&o>r){var a=o;o=r,r=a}var s={v:o,w:r};return n&&(s.name=n),s}function l_(t,i){return Dr(t,i.v,i.w,i.name)}});var m1=g((foe,h1)=>{"use strict";h1.exports="2.1.8"});var g1=g((poe,_1)=>{"use strict";_1.exports={Graph:Yf(),version:m1()}});var y1=g((hoe,v1)=>{"use strict";var jt=pt(),yW=Yf();v1.exports={write:CW,read:wW};function CW(t){var i={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:xW(t),edges:bW(t)};return jt.isUndefined(t.graph())||(i.value=jt.clone(t.graph())),i}function xW(t){return jt.map(t.nodes(),function(i){var e=t.node(i),n=t.parent(i),o={v:i};return jt.isUndefined(e)||(o.value=e),jt.isUndefined(n)||(o.parent=n),o})}function bW(t){return jt.map(t.edges(),function(i){var e=t.edge(i),n={v:i.v,w:i.w};return jt.isUndefined(i.name)||(n.name=i.name),jt.isUndefined(e)||(n.value=e),n})}function wW(t){var i=new yW(t.options).setGraph(t.value);return jt.each(t.nodes,function(e){i.setNode(e.v,e.value),e.parent&&i.setParent(e.v,e.parent)}),jt.each(t.edges,function(e){i.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),i}});var x1=g((moe,C1)=>{"use strict";var Xf=pt();C1.exports=SW;function SW(t){var i={},e=[],n;function o(r){Xf.has(i,r)||(i[r]=!0,n.push(r),Xf.each(t.successors(r),o),Xf.each(t.predecessors(r),o))}return Xf.each(t.nodes(),function(r){n=[],o(r),n.length&&e.push(n)}),e}});var u_=g((_oe,w1)=>{"use strict";var b1=pt();w1.exports=bt;function bt(){this._arr=[],this._keyIndices={}}bt.prototype.size=function(){return this._arr.length};bt.prototype.keys=function(){return this._arr.map(function(t){return t.key})};bt.prototype.has=function(t){return b1.has(this._keyIndices,t)};bt.prototype.priority=function(t){var i=this._keyIndices[t];if(i!==void 0)return this._arr[i].priority};bt.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key};bt.prototype.add=function(t,i){var e=this._keyIndices;if(t=String(t),!b1.has(e,t)){var n=this._arr,o=n.length;return e[t]=o,n.push({key:t,priority:i}),this._decrease(o),!0}return!1};bt.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};bt.prototype.decrease=function(t,i){var e=this._keyIndices[t];if(i>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+i);this._arr[e].priority=i,this._decrease(e)};bt.prototype._heapify=function(t){var i=this._arr,e=2*t,n=e+1,o=t;e<i.length&&(o=i[e].priority<i[o].priority?e:o,n<i.length&&(o=i[n].priority<i[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))};bt.prototype._decrease=function(t){for(var i=this._arr,e=i[t].priority,n;t!==0&&(n=t>>1,!(i[n].priority<e));)this._swap(t,n),t=n};bt.prototype._swap=function(t,i){var e=this._arr,n=this._keyIndices,o=e[t],r=e[i];e[t]=r,e[i]=o,n[r.key]=t,n[o.key]=i}});var f_=g((goe,S1)=>{"use strict";var TW=pt(),IW=u_();S1.exports=PW;var EW=TW.constant(1);function PW(t,i,e,n){return MW(t,String(i),e||EW,n||function(o){return t.outEdges(o)})}function MW(t,i,e,n){var o={},r=new IW,a,s,c=function(l){var f=l.v!==a?l.v:l.w,m=o[f],x=e(l),P=s.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+x);P<m.distance&&(m.distance=P,m.predecessor=a,r.decrease(f,P))};for(t.nodes().forEach(function(l){var f=l===i?0:Number.POSITIVE_INFINITY;o[l]={distance:f},r.add(l,f)});r.size()>0&&(a=r.removeMin(),s=o[a],s.distance!==Number.POSITIVE_INFINITY);)n(a).forEach(c);return o}});var I1=g((voe,T1)=>{"use strict";var kW=f_(),DW=pt();T1.exports=OW;function OW(t,i,e){return DW.transform(t.nodes(),function(n,o){n[o]=kW(t,o,i,e)},{})}});var p_=g((yoe,P1)=>{"use strict";var E1=pt();P1.exports=NW;function NW(t){var i=0,e=[],n={},o=[];function r(a){var s=n[a]={onStack:!0,lowlink:i,index:i++};if(e.push(a),t.successors(a).forEach(function(f){E1.has(n,f)?n[f].onStack&&(s.lowlink=Math.min(s.lowlink,n[f].index)):(r(f),s.lowlink=Math.min(s.lowlink,n[f].lowlink))}),s.lowlink===s.index){var c=[],l;do l=e.pop(),n[l].onStack=!1,c.push(l);while(a!==l);o.push(c)}}return t.nodes().forEach(function(a){E1.has(n,a)||r(a)}),o}});var k1=g((Coe,M1)=>{"use strict";var RW=pt(),AW=p_();M1.exports=FW;function FW(t){return RW.filter(AW(t),function(i){return i.length>1||i.length===1&&t.hasEdge(i[0],i[0])})}});var O1=g((xoe,D1)=>{"use strict";var LW=pt();D1.exports=BW;var zW=LW.constant(1);function BW(t,i,e){return qW(t,i||zW,e||function(n){return t.outEdges(n)})}function qW(t,i,e){var n={},o=t.nodes();return o.forEach(function(r){n[r]={},n[r][r]={distance:0},o.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=i(a);n[r][s]={distance:c,predecessor:r}})}),o.forEach(function(r){var a=n[r];o.forEach(function(s){var c=n[s];o.forEach(function(l){var f=c[r],m=a[l],x=c[l],P=f.distance+m.distance;P<x.distance&&(x.distance=P,x.predecessor=m.predecessor)})})}),n}});var h_=g((boe,R1)=>{"use strict";var Or=pt();R1.exports=N1;N1.CycleException=Zf;function N1(t){var i={},e={},n=[];function o(r){if(Or.has(e,r))throw new Zf;Or.has(i,r)||(e[r]=!0,i[r]=!0,Or.each(t.predecessors(r),o),delete e[r],n.push(r))}if(Or.each(t.sinks(),o),Or.size(i)!==t.nodeCount())throw new Zf;return n}function Zf(){}Zf.prototype=new Error});var L1=g((woe,F1)=>{"use strict";var A1=h_();F1.exports=GW;function GW(t){try{A1(t)}catch(i){if(i instanceof A1.CycleException)return!1;throw i}return!0}});var m_=g((Soe,B1)=>{"use strict";var Qf=pt();B1.exports=HW;function HW(t,i,e){Qf.isArray(i)||(i=[i]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),o=[],r={};return Qf.each(i,function(a){if(!t.hasNode(a))throw new Error("Graph does not have node: "+a);z1(t,a,e==="post",r,n,o)}),o}function z1(t,i,e,n,o,r){Qf.has(n,i)||(n[i]=!0,e||r.push(i),Qf.each(o(i),function(a){z1(t,a,e,n,o,r)}),e&&r.push(i))}});var G1=g((Toe,q1)=>{"use strict";var VW=m_();q1.exports=jW;function jW(t,i){return VW(t,i,"post")}});var V1=g((Ioe,H1)=>{"use strict";var UW=m_();H1.exports=WW;function WW(t,i){return UW(t,i,"pre")}});var W1=g((Eoe,U1)=>{"use strict";var j1=pt(),$W=Yf(),KW=u_();U1.exports=YW;function YW(t,i){var e=new $W,n={},o=new KW,r;function a(c){var l=c.v===r?c.w:c.v,f=o.priority(l);if(f!==void 0){var m=i(c);m<f&&(n[l]=r,o.decrease(l,m))}}if(t.nodeCount()===0)return e;j1.each(t.nodes(),function(c){o.add(c,Number.POSITIVE_INFINITY),e.setNode(c)}),o.decrease(t.nodes()[0],0);for(var s=!1;o.size()>0;){if(r=o.removeMin(),j1.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 K1=g((Poe,$1)=>{"use strict";$1.exports={components:x1(),dijkstra:f_(),dijkstraAll:I1(),findCycles:k1(),floydWarshall:O1(),isAcyclic:L1(),postorder:G1(),preorder:V1(),prim:W1(),tarjan:p_(),topsort:h_()}});var Z1=g((Moe,X1)=>{"use strict";var Y1=g1();X1.exports={Graph:Y1.Graph,json:y1(),alg:K1(),version:Y1.version}});var wt=g((koe,Q1)=>{"use strict";var Jf;if(typeof gi=="function")try{Jf=Z1()}catch{}Jf||(Jf=window.graphlib);Q1.exports=Jf});var eT=g((Ooe,J1)=>{"use strict";var XW=Nm(),ZW=1,QW=4;function JW(t){return XW(t,ZW|QW)}J1.exports=JW});var Nr=g((Noe,tT)=>{"use strict";var e$=ci(),t$=Ht(),n$=yr(),i$=ft();function o$(t,i,e){if(!i$(e))return!1;var n=typeof i;return(n=="number"?t$(e)&&n$(i,e.length):n=="string"&&i in e)?e$(e[i],t):!1}tT.exports=o$});var oT=g((Roe,iT)=>{"use strict";var r$=kr(),a$=ci(),s$=Nr(),c$=Nn(),nT=Object.prototype,d$=nT.hasOwnProperty,l$=r$(function(t,i){t=Object(t);var e=-1,n=i.length,o=n>2?i[2]:void 0;for(o&&s$(i[0],i[1],o)&&(n=1);++e<n;)for(var r=i[e],a=c$(r),s=-1,c=a.length;++s<c;){var l=a[s],f=t[l];(f===void 0||a$(f,nT[l])&&!d$.call(t,l))&&(t[l]=r[l])}return t});iT.exports=l$});var aT=g((Aoe,rT)=>{"use strict";var u$=Vt(),f$=Ht(),p$=Qt();function h$(t){return function(i,e,n){var o=Object(i);if(!f$(i)){var r=u$(e,3);i=p$(i),e=function(s){return r(o[s],s,o)}}var a=t(i,e,n);return a>-1?o[r?i[a]:a]:void 0}}rT.exports=h$});var cT=g((Foe,sT)=>{"use strict";var m$=/\s/;function _$(t){for(var i=t.length;i--&&m$.test(t.charAt(i)););return i}sT.exports=_$});var lT=g((Loe,dT)=>{"use strict";var g$=cT(),v$=/^\s+/;function y$(t){return t&&t.slice(0,g$(t)+1).replace(v$,"")}dT.exports=y$});var hT=g((zoe,pT)=>{"use strict";var C$=lT(),uT=ft(),x$=pi(),fT=NaN,b$=/^[-+]0x[0-9a-f]+$/i,w$=/^0b[01]+$/i,S$=/^0o[0-7]+$/i,T$=parseInt;function I$(t){if(typeof t=="number")return t;if(x$(t))return fT;if(uT(t)){var i=typeof t.valueOf=="function"?t.valueOf():t;t=uT(i)?i+"":i}if(typeof t!="string")return t===0?t:+t;t=C$(t);var e=w$.test(t);return e||S$.test(t)?T$(t.slice(2),e?2:8):b$.test(t)?fT:+t}pT.exports=I$});var __=g((Boe,_T)=>{"use strict";var E$=hT(),mT=1/0,P$=17976931348623157e292;function M$(t){if(!t)return t===0?t:0;if(t=E$(t),t===mT||t===-mT){var i=t<0?-1:1;return i*P$}return t===t?t:0}_T.exports=M$});var vT=g((qoe,gT)=>{"use strict";var k$=__();function D$(t){var i=k$(t),e=i%1;return i===i?e?i-e:i:0}gT.exports=D$});var CT=g((Goe,yT)=>{"use strict";var O$=a_(),N$=Vt(),R$=vT(),A$=Math.max;function F$(t,i,e){var n=t==null?0:t.length;if(!n)return-1;var o=e==null?0:R$(e);return o<0&&(o=A$(n+o,0)),O$(t,N$(i,3),o)}yT.exports=F$});var bT=g((Hoe,xT)=>{"use strict";var L$=aT(),z$=CT(),B$=L$(z$);xT.exports=B$});var g_=g((Voe,wT)=>{"use strict";var q$=$f();function G$(t){var i=t==null?0:t.length;return i?q$(t,1):[]}wT.exports=G$});var TT=g((joe,ST)=>{"use strict";var H$=Gf(),V$=Rm(),j$=Nn();function U$(t,i){return t==null?t:H$(t,V$(i),j$)}ST.exports=U$});var ET=g((Uoe,IT)=>{"use strict";function W$(t){var i=t==null?0:t.length;return i?t[i-1]:void 0}IT.exports=W$});var MT=g((Woe,PT)=>{"use strict";var $$=_r(),K$=Hf(),Y$=Vt();function X$(t,i){var e={};return i=Y$(i,3),K$(t,function(n,o,r){$$(e,o,i(n,o,r))}),e}PT.exports=X$});var ep=g(($oe,kT)=>{"use strict";var Z$=pi();function Q$(t,i,e){for(var n=-1,o=t.length;++n<o;){var r=t[n],a=i(r);if(a!=null&&(s===void 0?a===a&&!Z$(a):e(a,s)))var s=a,c=r}return c}kT.exports=Q$});var OT=g((Koe,DT)=>{"use strict";function J$(t,i){return t>i}DT.exports=J$});var RT=g((Yoe,NT)=>{"use strict";var e8=ep(),t8=OT(),n8=Rn();function i8(t){return t&&t.length?e8(t,n8,t8):void 0}NT.exports=i8});var v_=g((Xoe,AT)=>{"use strict";var o8=_r(),r8=ci();function a8(t,i,e){(e!==void 0&&!r8(t[i],e)||e===void 0&&!(i in t))&&o8(t,i,e)}AT.exports=a8});var zT=g((Zoe,LT)=>{"use strict";var s8=Dn(),c8=Tr(),d8=Mt(),l8="[object Object]",u8=Function.prototype,f8=Object.prototype,FT=u8.toString,p8=f8.hasOwnProperty,h8=FT.call(Object);function m8(t){if(!d8(t)||s8(t)!=l8)return!1;var i=c8(t);if(i===null)return!0;var e=p8.call(i,"constructor")&&i.constructor;return typeof e=="function"&&e instanceof e&&FT.call(e)==h8}LT.exports=m8});var y_=g((Qoe,BT)=>{"use strict";function _8(t,i){if(!(i==="constructor"&&typeof t[i]=="function")&&i!="__proto__")return t[i]}BT.exports=_8});var GT=g((Joe,qT)=>{"use strict";var g8=to(),v8=Nn();function y8(t){return g8(t,v8(t))}qT.exports=y8});var $T=g((ere,WT)=>{"use strict";var HT=v_(),C8=_m(),x8=km(),b8=gm(),w8=Om(),VT=no(),jT=Ge(),S8=c_(),T8=li(),I8=Zi(),E8=ft(),P8=zT(),M8=ro(),UT=y_(),k8=GT();function D8(t,i,e,n,o,r,a){var s=UT(t,e),c=UT(i,e),l=a.get(c);if(l){HT(t,e,l);return}var f=r?r(s,c,e+"",t,i,a):void 0,m=f===void 0;if(m){var x=jT(c),P=!x&&T8(c),E=!x&&!P&&M8(c);f=c,x||P||E?jT(s)?f=s:S8(s)?f=b8(s):P?(m=!1,f=C8(c,!0)):E?(m=!1,f=x8(c,!0)):f=[]:P8(c)||VT(c)?(f=s,VT(s)?f=k8(s):(!E8(s)||I8(s))&&(f=w8(c))):m=!1}m&&(a.set(c,f),o(f,c,n,r,a),a.delete(c)),HT(t,e,f)}WT.exports=D8});var XT=g((tre,YT)=>{"use strict";var O8=mr(),N8=v_(),R8=Gf(),A8=$T(),F8=ft(),L8=Nn(),z8=y_();function KT(t,i,e,n,o){t!==i&&R8(i,function(r,a){if(o||(o=new O8),F8(r))A8(t,i,a,e,KT,n,o);else{var s=n?n(z8(t,a),r,a+"",t,i,o):void 0;s===void 0&&(s=r),N8(t,a,s)}},L8)}YT.exports=KT});var QT=g((nre,ZT)=>{"use strict";var B8=kr(),q8=Nr();function G8(t){return B8(function(i,e){var n=-1,o=e.length,r=o>1?e[o-1]:void 0,a=o>2?e[2]:void 0;for(r=t.length>3&&typeof r=="function"?(o--,r):void 0,a&&q8(e[0],e[1],a)&&(r=o<3?void 0:r,o=1),i=Object(i);++n<o;){var s=e[n];s&&t(i,s,n,r)}return i})}ZT.exports=G8});var eI=g((ire,JT)=>{"use strict";var H8=XT(),V8=QT(),j8=V8(function(t,i,e){H8(t,i,e)});JT.exports=j8});var C_=g((ore,tI)=>{"use strict";function U8(t,i){return t<i}tI.exports=U8});var iI=g((rre,nI)=>{"use strict";var W8=ep(),$8=C_(),K8=Rn();function Y8(t){return t&&t.length?W8(t,K8,$8):void 0}nI.exports=Y8});var rI=g((are,oI)=>{"use strict";var X8=ep(),Z8=Vt(),Q8=C_();function J8(t,i){return t&&t.length?X8(t,Z8(i,2),Q8):void 0}oI.exports=J8});var sI=g((sre,aI)=>{"use strict";var e6=xt(),t6=function(){return e6.Date.now()};aI.exports=t6});var lI=g((cre,dI)=>{"use strict";var n6=gr(),i6=Pr(),o6=yr(),cI=ft(),r6=co();function a6(t,i,e,n){if(!cI(t))return t;i=i6(i,t);for(var o=-1,r=i.length,a=r-1,s=t;s!=null&&++o<r;){var c=r6(i[o]),l=e;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(o!=a){var f=s[c];l=n?n(f,c,s):void 0,l===void 0&&(l=cI(f)?f:o6(i[o+1])?[]:{})}n6(s,c,l),s=s[c]}return t}dI.exports=a6});var fI=g((dre,uI)=>{"use strict";var s6=Mr(),c6=lI(),d6=Pr();function l6(t,i,e){for(var n=-1,o=i.length,r={};++n<o;){var a=i[n],s=s6(t,a);e(s,a)&&c6(r,d6(a,t),s)}return r}uI.exports=l6});var hI=g((lre,pI)=>{"use strict";var u6=fI(),f6=Km();function p6(t,i){return u6(t,i,function(e,n){return f6(t,n)})}pI.exports=p6});var _I=g((ure,mI)=>{"use strict";var h6=g_(),m6=o_(),_6=r_();function g6(t){return _6(m6(t,void 0,h6),t+"")}mI.exports=g6});var vI=g((fre,gI)=>{"use strict";var v6=hI(),y6=_I(),C6=y6(function(t,i){return t==null?{}:v6(t,i)});gI.exports=C6});var CI=g((pre,yI)=>{"use strict";var x6=Math.ceil,b6=Math.max;function w6(t,i,e,n){for(var o=-1,r=b6(x6((i-t)/(e||1)),0),a=Array(r);r--;)a[n?r:++o]=t,t+=e;return a}yI.exports=w6});var bI=g((hre,xI)=>{"use strict";var S6=CI(),T6=Nr(),x_=__();function I6(t){return function(i,e,n){return n&&typeof n!="number"&&T6(i,e,n)&&(e=n=void 0),i=x_(i),e===void 0?(e=i,i=0):e=x_(e),n=n===void 0?i<e?1:-1:x_(n),S6(i,e,n,t)}}xI.exports=I6});var SI=g((mre,wI)=>{"use strict";var E6=bI(),P6=E6();wI.exports=P6});var II=g((_re,TI)=>{"use strict";function M6(t,i){var e=t.length;for(t.sort(i);e--;)t[e]=t[e].value;return t}TI.exports=M6});var MI=g((gre,PI)=>{"use strict";var EI=pi();function k6(t,i){if(t!==i){var e=t!==void 0,n=t===null,o=t===t,r=EI(t),a=i!==void 0,s=i===null,c=i===i,l=EI(i);if(!s&&!l&&!r&&t>i||r&&a&&c&&!s&&!l||n&&a&&c||!e&&c||!o)return 1;if(!n&&!r&&!l&&t<i||l&&e&&o&&!n&&!r||s&&e&&o||!a&&o||!c)return-1}return 0}PI.exports=k6});var DI=g((vre,kI)=>{"use strict";var D6=MI();function O6(t,i,e){for(var n=-1,o=t.criteria,r=i.criteria,a=o.length,s=e.length;++n<a;){var c=D6(o[n],r[n]);if(c){if(n>=s)return c;var l=e[n];return c*(l=="desc"?-1:1)}}return t.index-i.index}kI.exports=O6});var NI=g((yre,OI)=>{"use strict";var b_=Er(),N6=Mr(),R6=Vt(),A6=Jm(),F6=II(),L6=Cr(),z6=DI(),B6=Rn(),q6=Ge();function G6(t,i,e){i.length?i=b_(i,function(r){return q6(r)?function(a){return N6(a,r.length===1?r[0]:r)}:r}):i=[B6];var n=-1;i=b_(i,L6(R6));var o=A6(t,function(r,a,s){var c=b_(i,function(l){return l(r)});return{criteria:c,index:++n,value:r}});return F6(o,function(r,a){return z6(r,a,e)})}OI.exports=G6});var FI=g((Cre,AI)=>{"use strict";var H6=$f(),V6=NI(),j6=kr(),RI=Nr(),U6=j6(function(t,i){if(t==null)return[];var e=i.length;return e>1&&RI(t,i[0],i[1])?i=[]:e>2&&RI(i[0],i[1],i[2])&&(i=[i[0]]),V6(t,H6(i,1),[])});AI.exports=U6});var zI=g((xre,LI)=>{"use strict";var W6=Wm(),$6=0;function K6(t){var i=++$6;return W6(t)+i}LI.exports=K6});var qI=g((bre,BI)=>{"use strict";function Y6(t,i,e){for(var n=-1,o=t.length,r=i.length,a={};++n<o;){var s=n<r?i[n]:void 0;e(a,t[n],s)}return a}BI.exports=Y6});var HI=g((wre,GI)=>{"use strict";var X6=gr(),Z6=qI();function Q6(t,i){return Z6(t||[],i||[],X6)}GI.exports=Q6});var Me=g((Sre,VI)=>{"use strict";var tp;if(typeof gi=="function")try{tp={cloneDeep:eT(),constant:qf(),defaults:oT(),each:Fm(),filter:Xm(),find:bT(),flatten:g_(),forEach:Am(),forIn:TT(),has:Zm(),isUndefined:Qm(),last:ET(),map:e_(),mapValues:MT(),max:RT(),merge:eI(),min:iI(),minBy:rI(),now:sI(),pick:vI(),range:SI(),reduce:t_(),sortBy:FI(),uniqueId:zI(),values:d_(),zipObject:HI()}}catch{}tp||(tp=window._);VI.exports=tp});var WI=g((Ire,UI)=>{"use strict";UI.exports=np;function np(){var t={};t._next=t._prev=t,this._sentinel=t}np.prototype.dequeue=function(){var t=this._sentinel,i=t._prev;if(i!==t)return jI(i),i};np.prototype.enqueue=function(t){var i=this._sentinel;t._prev&&t._next&&jI(t),t._next=i._next,i._next._prev=t,i._next=t,t._prev=i};np.prototype.toString=function(){for(var t=[],i=this._sentinel,e=i._prev;e!==i;)t.push(JSON.stringify(e,J6)),e=e._prev;return"["+t.join(", ")+"]"};function jI(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function J6(t,i){if(t!=="_next"&&t!=="_prev")return i}});var KI=g((Ere,$I)=>{"use strict";var Jt=Me(),e7=wt().Graph,t7=WI();$I.exports=i7;var n7=Jt.constant(1);function i7(t,i){if(t.nodeCount()<=1)return[];var e=r7(t,i||n7),n=o7(e.graph,e.buckets,e.zeroIdx);return Jt.flatten(Jt.map(n,function(o){return t.outEdges(o.v,o.w)}),!0)}function o7(t,i,e){for(var n=[],o=i[i.length-1],r=i[0],a;t.nodeCount();){for(;a=r.dequeue();)w_(t,i,e,a);for(;a=o.dequeue();)w_(t,i,e,a);if(t.nodeCount()){for(var s=i.length-2;s>0;--s)if(a=i[s].dequeue(),a){n=n.concat(w_(t,i,e,a,!0));break}}}return n}function w_(t,i,e,n,o){var r=o?[]:void 0;return Jt.forEach(t.inEdges(n.v),function(a){var s=t.edge(a),c=t.node(a.v);o&&r.push({v:a.v,w:a.w}),c.out-=s,S_(i,e,c)}),Jt.forEach(t.outEdges(n.v),function(a){var s=t.edge(a),c=a.w,l=t.node(c);l.in-=s,S_(i,e,l)}),t.removeNode(n.v),r}function r7(t,i){var e=new e7,n=0,o=0;Jt.forEach(t.nodes(),function(s){e.setNode(s,{v:s,in:0,out:0})}),Jt.forEach(t.edges(),function(s){var c=e.edge(s.v,s.w)||0,l=i(s),f=c+l;e.setEdge(s.v,s.w,f),o=Math.max(o,e.node(s.v).out+=l),n=Math.max(n,e.node(s.w).in+=l)});var r=Jt.range(o+n+3).map(function(){return new t7}),a=n+1;return Jt.forEach(e.nodes(),function(s){S_(r,a,e.node(s))}),{graph:e,buckets:r,zeroIdx:a}}function S_(t,i,e){e.out?e.in?t[e.out-e.in+i].enqueue(e):t[t.length-1].enqueue(e):t[0].enqueue(e)}});var XI=g((Pre,YI)=>{"use strict";var mi=Me(),a7=KI();YI.exports={run:s7,undo:d7};function s7(t){var i=t.graph().acyclicer==="greedy"?a7(t,e(t)):c7(t);mi.forEach(i,function(n){var o=t.edge(n);t.removeEdge(n),o.forwardName=n.name,o.reversed=!0,t.setEdge(n.w,n.v,o,mi.uniqueId("rev"))});function e(n){return function(o){return n.edge(o).weight}}}function c7(t){var i=[],e={},n={};function o(r){mi.has(n,r)||(n[r]=!0,e[r]=!0,mi.forEach(t.outEdges(r),function(a){mi.has(e,a.w)?i.push(a):o(a.w)}),delete e[r])}return mi.forEach(t.nodes(),o),i}function d7(t){mi.forEach(t.edges(),function(i){var e=t.edge(i);if(e.reversed){t.removeEdge(i);var n=e.forwardName;delete e.reversed,delete e.forwardName,t.setEdge(i.w,i.v,e,n)}})}});var nt=g((Mre,eE)=>{"use strict";var pe=Me(),ZI=wt().Graph;eE.exports={addDummyNode:QI,simplify:l7,asNonCompoundGraph:u7,successorWeights:f7,predecessorWeights:p7,intersectRect:h7,buildLayerMatrix:m7,normalizeRanks:_7,removeEmptyRanks:g7,addBorderNode:v7,maxRank:JI,partition:y7,time:C7,notime:x7};function QI(t,i,e,n){var o;do o=pe.uniqueId(n);while(t.hasNode(o));return e.dummy=i,t.setNode(o,e),o}function l7(t){var i=new ZI().setGraph(t.graph());return pe.forEach(t.nodes(),function(e){i.setNode(e,t.node(e))}),pe.forEach(t.edges(),function(e){var n=i.edge(e.v,e.w)||{weight:0,minlen:1},o=t.edge(e);i.setEdge(e.v,e.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),i}function u7(t){var i=new ZI({multigraph:t.isMultigraph()}).setGraph(t.graph());return pe.forEach(t.nodes(),function(e){t.children(e).length||i.setNode(e,t.node(e))}),pe.forEach(t.edges(),function(e){i.setEdge(e,t.edge(e))}),i}function f7(t){var i=pe.map(t.nodes(),function(e){var n={};return pe.forEach(t.outEdges(e),function(o){n[o.w]=(n[o.w]||0)+t.edge(o).weight}),n});return pe.zipObject(t.nodes(),i)}function p7(t){var i=pe.map(t.nodes(),function(e){var n={};return pe.forEach(t.inEdges(e),function(o){n[o.v]=(n[o.v]||0)+t.edge(o).weight}),n});return pe.zipObject(t.nodes(),i)}function h7(t,i){var e=t.x,n=t.y,o=i.x-e,r=i.y-n,a=t.width/2,s=t.height/2;if(!o&&!r)throw new Error("Not possible to find intersection inside of the rectangle");var c,l;return Math.abs(r)*a>Math.abs(o)*s?(r<0&&(s=-s),c=s*o/r,l=s):(o<0&&(a=-a),c=a,l=a*r/o),{x:e+c,y:n+l}}function m7(t){var i=pe.map(pe.range(JI(t)+1),function(){return[]});return pe.forEach(t.nodes(),function(e){var n=t.node(e),o=n.rank;pe.isUndefined(o)||(i[o][n.order]=e)}),i}function _7(t){var i=pe.min(pe.map(t.nodes(),function(e){return t.node(e).rank}));pe.forEach(t.nodes(),function(e){var n=t.node(e);pe.has(n,"rank")&&(n.rank-=i)})}function g7(t){var i=pe.min(pe.map(t.nodes(),function(r){return t.node(r).rank})),e=[];pe.forEach(t.nodes(),function(r){var a=t.node(r).rank-i;e[a]||(e[a]=[]),e[a].push(r)});var n=0,o=t.graph().nodeRankFactor;pe.forEach(e,function(r,a){pe.isUndefined(r)&&a%o!==0?--n:n&&pe.forEach(r,function(s){t.node(s).rank+=n})})}function v7(t,i,e,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=e,o.order=n),QI(t,"border",o,i)}function JI(t){return pe.max(pe.map(t.nodes(),function(i){var e=t.node(i).rank;if(!pe.isUndefined(e))return e}))}function y7(t,i){var e={lhs:[],rhs:[]};return pe.forEach(t,function(n){i(n)?e.lhs.push(n):e.rhs.push(n)}),e}function C7(t,i){var e=pe.now();try{return i()}finally{console.log(t+" time: "+(pe.now()-e)+"ms")}}function x7(t,i){return i()}});var iE=g((kre,nE)=>{"use strict";var tE=Me(),b7=nt();nE.exports={run:w7,undo:T7};function w7(t){t.graph().dummyChains=[],tE.forEach(t.edges(),function(i){S7(t,i)})}function S7(t,i){var e=i.v,n=t.node(e).rank,o=i.w,r=t.node(o).rank,a=i.name,s=t.edge(i),c=s.labelRank;if(r!==n+1){t.removeEdge(i);var l,f,m;for(m=0,++n;n<r;++m,++n)s.points=[],f={width:0,height:0,edgeLabel:s,edgeObj:i,rank:n},l=b7.addDummyNode(t,"edge",f,"_d"),n===c&&(f.width=s.width,f.height=s.height,f.dummy="edge-label",f.labelpos=s.labelpos),t.setEdge(e,l,{weight:s.weight},a),m===0&&t.graph().dummyChains.push(l),e=l;t.setEdge(e,o,{weight:s.weight},a)}}function T7(t){tE.forEach(t.graph().dummyChains,function(i){var e=t.node(i),n=e.edgeLabel,o;for(t.setEdge(e.edgeObj,n);e.dummy;)o=t.successors(i)[0],t.removeNode(i),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),i=o,e=t.node(i)})}});var Rr=g((Dre,oE)=>{"use strict";var ip=Me();oE.exports={longestPath:I7,slack:E7};function I7(t){var i={};function e(n){var o=t.node(n);if(ip.has(i,n))return o.rank;i[n]=!0;var r=ip.min(ip.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),o.rank=r}ip.forEach(t.sources(),e)}function E7(t,i){return t.node(i.w).rank-t.node(i.v).rank-t.edge(i).minlen}});var T_=g((Ore,rE)=>{"use strict";var op=Me(),P7=wt().Graph,rp=Rr().slack;rE.exports=M7;function M7(t){var i=new P7({directed:!1}),e=t.nodes()[0],n=t.nodeCount();i.setNode(e,{});for(var o,r;k7(i,t)<n;)o=D7(i,t),r=i.hasNode(o.v)?rp(t,o):-rp(t,o),O7(i,t,r);return i}function k7(t,i){function e(n){op.forEach(i.nodeEdges(n),function(o){var r=o.v,a=n===r?o.w:r;!t.hasNode(a)&&!rp(i,o)&&(t.setNode(a,{}),t.setEdge(n,a,{}),e(a))})}return op.forEach(t.nodes(),e),t.nodeCount()}function D7(t,i){return op.minBy(i.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w))return rp(i,e)})}function O7(t,i,e){op.forEach(t.nodes(),function(n){i.node(n).rank+=e})}});var pE=g((Nre,fE)=>{"use strict";var en=Me(),N7=T_(),R7=Rr().slack,A7=Rr().longestPath,F7=wt().alg.preorder,L7=wt().alg.postorder,z7=nt().simplify;fE.exports=_i;_i.initLowLimValues=E_;_i.initCutValues=I_;_i.calcCutValue=sE;_i.leaveEdge=dE;_i.enterEdge=lE;_i.exchangeEdges=uE;function _i(t){t=z7(t),A7(t);var i=N7(t);E_(i),I_(i,t);for(var e,n;e=dE(i);)n=lE(i,t,e),uE(i,t,e,n)}function I_(t,i){var e=L7(t,t.nodes());e=e.slice(0,e.length-1),en.forEach(e,function(n){B7(t,i,n)})}function B7(t,i,e){var n=t.node(e),o=n.parent;t.edge(e,o).cutvalue=sE(t,i,e)}function sE(t,i,e){var n=t.node(e),o=n.parent,r=!0,a=i.edge(e,o),s=0;return a||(r=!1,a=i.edge(o,e)),s=a.weight,en.forEach(i.nodeEdges(e),function(c){var l=c.v===e,f=l?c.w:c.v;if(f!==o){var m=l===r,x=i.edge(c).weight;if(s+=m?x:-x,G7(t,e,f)){var P=t.edge(e,f).cutvalue;s+=m?-P:P}}}),s}function E_(t,i){arguments.length<2&&(i=t.nodes()[0]),cE(t,{},1,i)}function cE(t,i,e,n,o){var r=e,a=t.node(n);return i[n]=!0,en.forEach(t.neighbors(n),function(s){en.has(i,s)||(e=cE(t,i,e,s,n))}),a.low=r,a.lim=e++,o?a.parent=o:delete a.parent,e}function dE(t){return en.find(t.edges(),function(i){return t.edge(i).cutvalue<0})}function lE(t,i,e){var n=e.v,o=e.w;i.hasEdge(n,o)||(n=e.w,o=e.v);var r=t.node(n),a=t.node(o),s=r,c=!1;r.lim>a.lim&&(s=a,c=!0);var l=en.filter(i.edges(),function(f){return c===aE(t,t.node(f.v),s)&&c!==aE(t,t.node(f.w),s)});return en.minBy(l,function(f){return R7(i,f)})}function uE(t,i,e,n){var o=e.v,r=e.w;t.removeEdge(o,r),t.setEdge(n.v,n.w,{}),E_(t),I_(t,i),q7(t,i)}function q7(t,i){var e=en.find(t.nodes(),function(o){return!i.node(o).parent}),n=F7(t,e);n=n.slice(1),en.forEach(n,function(o){var r=t.node(o).parent,a=i.edge(o,r),s=!1;a||(a=i.edge(r,o),s=!0),i.node(o).rank=i.node(r).rank+(s?a.minlen:-a.minlen)})}function G7(t,i,e){return t.hasEdge(i,e)}function aE(t,i,e){return e.low<=i.lim&&i.lim<=e.lim}});var gE=g((Rre,_E)=>{"use strict";var H7=Rr(),mE=H7.longestPath,V7=T_(),j7=pE();_E.exports=U7;function U7(t){switch(t.graph().ranker){case"network-simplex":hE(t);break;case"tight-tree":$7(t);break;case"longest-path":W7(t);break;default:hE(t)}}var W7=mE;function $7(t){mE(t),V7(t)}function hE(t){j7(t)}});var yE=g((Are,vE)=>{"use strict";var P_=Me();vE.exports=K7;function K7(t){var i=X7(t);P_.forEach(t.graph().dummyChains,function(e){for(var n=t.node(e),o=n.edgeObj,r=Y7(t,i,o.v,o.w),a=r.path,s=r.lca,c=0,l=a[c],f=!0;e!==o.w;){if(n=t.node(e),f){for(;(l=a[c])!==s&&t.node(l).maxRank<n.rank;)c++;l===s&&(f=!1)}if(!f){for(;c<a.length-1&&t.node(l=a[c+1]).minRank<=n.rank;)c++;l=a[c]}t.setParent(e,l),e=t.successors(e)[0]}})}function Y7(t,i,e,n){var o=[],r=[],a=Math.min(i[e].low,i[n].low),s=Math.max(i[e].lim,i[n].lim),c,l;c=e;do c=t.parent(c),o.push(c);while(c&&(i[c].low>a||s>i[c].lim));for(l=c,c=n;(c=t.parent(c))!==l;)r.push(c);return{path:o.concat(r.reverse()),lca:l}}function X7(t){var i={},e=0;function n(o){var r=e;P_.forEach(t.children(o),n),i[o]={low:r,lim:e++}}return P_.forEach(t.children(),n),i}});var bE=g((Fre,xE)=>{"use strict";var tn=Me(),M_=nt();xE.exports={run:Z7,cleanup:eK};function Z7(t){var i=M_.addDummyNode(t,"root",{},"_root"),e=Q7(t),n=tn.max(tn.values(e))-1,o=2*n+1;t.graph().nestingRoot=i,tn.forEach(t.edges(),function(a){t.edge(a).minlen*=o});var r=J7(t)+1;tn.forEach(t.children(),function(a){CE(t,i,o,r,n,e,a)}),t.graph().nodeRankFactor=o}function CE(t,i,e,n,o,r,a){var s=t.children(a);if(!s.length){a!==i&&t.setEdge(i,a,{weight:0,minlen:e});return}var c=M_.addBorderNode(t,"_bt"),l=M_.addBorderNode(t,"_bb"),f=t.node(a);t.setParent(c,a),f.borderTop=c,t.setParent(l,a),f.borderBottom=l,tn.forEach(s,function(m){CE(t,i,e,n,o,r,m);var x=t.node(m),P=x.borderTop?x.borderTop:m,E=x.borderBottom?x.borderBottom:m,N=x.borderTop?n:2*n,j=P!==E?1:o-r[a]+1;t.setEdge(c,P,{weight:N,minlen:j,nestingEdge:!0}),t.setEdge(E,l,{weight:N,minlen:j,nestingEdge:!0})}),t.parent(a)||t.setEdge(i,c,{weight:0,minlen:o+r[a]})}function Q7(t){var i={};function e(n,o){var r=t.children(n);r&&r.length&&tn.forEach(r,function(a){e(a,o+1)}),i[n]=o}return tn.forEach(t.children(),function(n){e(n,1)}),i}function J7(t){return tn.reduce(t.edges(),function(i,e){return i+t.edge(e).weight},0)}function eK(t){var i=t.graph();t.removeNode(i.nestingRoot),delete i.nestingRoot,tn.forEach(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}});var TE=g((Lre,SE)=>{"use strict";var k_=Me(),tK=nt();SE.exports=nK;function nK(t){function i(e){var n=t.children(e),o=t.node(e);if(n.length&&k_.forEach(n,i),k_.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var r=o.minRank,a=o.maxRank+1;r<a;++r)wE(t,"borderLeft","_bl",e,o,r),wE(t,"borderRight","_br",e,o,r)}}k_.forEach(t.children(),i)}function wE(t,i,e,n,o,r){var a={width:0,height:0,rank:r,borderType:i},s=o[i][r-1],c=tK.addDummyNode(t,"border",a,e);o[i][r]=c,t.setParent(c,n),s&&t.setEdge(s,c,{weight:1})}});var ME=g((zre,PE)=>{"use strict";var Ut=Me();PE.exports={adjust:iK,undo:oK};function iK(t){var i=t.graph().rankdir.toLowerCase();(i==="lr"||i==="rl")&&EE(t)}function oK(t){var i=t.graph().rankdir.toLowerCase();(i==="bt"||i==="rl")&&rK(t),(i==="lr"||i==="rl")&&(aK(t),EE(t))}function EE(t){Ut.forEach(t.nodes(),function(i){IE(t.node(i))}),Ut.forEach(t.edges(),function(i){IE(t.edge(i))})}function IE(t){var i=t.width;t.width=t.height,t.height=i}function rK(t){Ut.forEach(t.nodes(),function(i){D_(t.node(i))}),Ut.forEach(t.edges(),function(i){var e=t.edge(i);Ut.forEach(e.points,D_),Ut.has(e,"y")&&D_(e)})}function D_(t){t.y=-t.y}function aK(t){Ut.forEach(t.nodes(),function(i){O_(t.node(i))}),Ut.forEach(t.edges(),function(i){var e=t.edge(i);Ut.forEach(e.points,O_),Ut.has(e,"x")&&O_(e)})}function O_(t){var i=t.x;t.x=t.y,t.y=i}});var DE=g((Bre,kE)=>{"use strict";var nn=Me();kE.exports=sK;function sK(t){var i={},e=nn.filter(t.nodes(),function(s){return!t.children(s).length}),n=nn.max(nn.map(e,function(s){return t.node(s).rank})),o=nn.map(nn.range(n+1),function(){return[]});function r(s){if(!nn.has(i,s)){i[s]=!0;var c=t.node(s);o[c.rank].push(s),nn.forEach(t.successors(s),r)}}var a=nn.sortBy(e,function(s){return t.node(s).rank});return nn.forEach(a,r),o}});var NE=g((qre,OE)=>{"use strict";var An=Me();OE.exports=cK;function cK(t,i){for(var e=0,n=1;n<i.length;++n)e+=dK(t,i[n-1],i[n]);return e}function dK(t,i,e){for(var n=An.zipObject(e,An.map(e,function(l,f){return f})),o=An.flatten(An.map(i,function(l){return An.sortBy(An.map(t.outEdges(l),function(f){return{pos:n[f.w],weight:t.edge(f).weight}}),"pos")}),!0),r=1;r<e.length;)r<<=1;var a=2*r-1;r-=1;var s=An.map(new Array(a),function(){return 0}),c=0;return An.forEach(o.forEach(function(l){var f=l.pos+r;s[f]+=l.weight;for(var m=0;f>0;)f%2&&(m+=s[f+1]),f=f-1>>1,s[f]+=l.weight;c+=l.weight*m})),c}});var FE=g((Gre,AE)=>{"use strict";var RE=Me();AE.exports=lK;function lK(t,i){return RE.map(i,function(e){var n=t.inEdges(e);if(n.length){var o=RE.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:o.sum/o.weight,weight:o.weight}}else return{v:e}})}});var zE=g((Hre,LE)=>{"use strict";var ht=Me();LE.exports=uK;function uK(t,i){var e={};ht.forEach(t,function(o,r){var a=e[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:r};ht.isUndefined(o.barycenter)||(a.barycenter=o.barycenter,a.weight=o.weight)}),ht.forEach(i.edges(),function(o){var r=e[o.v],a=e[o.w];!ht.isUndefined(r)&&!ht.isUndefined(a)&&(a.indegree++,r.out.push(e[o.w]))});var n=ht.filter(e,function(o){return!o.indegree});return fK(n)}function fK(t){var i=[];function e(r){return function(a){a.merged||(ht.isUndefined(a.barycenter)||ht.isUndefined(r.barycenter)||a.barycenter>=r.barycenter)&&pK(r,a)}}function n(r){return function(a){a.in.push(r),--a.indegree===0&&t.push(a)}}for(;t.length;){var o=t.pop();i.push(o),ht.forEach(o.in.reverse(),e(o)),ht.forEach(o.out,n(o))}return ht.map(ht.filter(i,function(r){return!r.merged}),function(r){return ht.pick(r,["vs","i","barycenter","weight"])})}function pK(t,i){var e=0,n=0;t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),i.weight&&(e+=i.barycenter*i.weight,n+=i.weight),t.vs=i.vs.concat(t.vs),t.barycenter=e/n,t.weight=n,t.i=Math.min(i.i,t.i),i.merged=!0}});var GE=g((Vre,qE)=>{"use strict";var Ar=Me(),hK=nt();qE.exports=mK;function mK(t,i){var e=hK.partition(t,function(f){return Ar.has(f,"barycenter")}),n=e.lhs,o=Ar.sortBy(e.rhs,function(f){return-f.i}),r=[],a=0,s=0,c=0;n.sort(_K(!!i)),c=BE(r,o,c),Ar.forEach(n,function(f){c+=f.vs.length,r.push(f.vs),a+=f.barycenter*f.weight,s+=f.weight,c=BE(r,o,c)});var l={vs:Ar.flatten(r,!0)};return s&&(l.barycenter=a/s,l.weight=s),l}function BE(t,i,e){for(var n;i.length&&(n=Ar.last(i)).i<=e;)i.pop(),t.push(n.vs),e++;return e}function _K(t){return function(i,e){return i.barycenter<e.barycenter?-1:i.barycenter>e.barycenter?1:t?e.i-i.i:i.i-e.i}}});var jE=g((jre,VE)=>{"use strict";var Fn=Me(),gK=FE(),vK=zE(),yK=GE();VE.exports=HE;function HE(t,i,e,n){var o=t.children(i),r=t.node(i),a=r?r.borderLeft:void 0,s=r?r.borderRight:void 0,c={};a&&(o=Fn.filter(o,function(E){return E!==a&&E!==s}));var l=gK(t,o);Fn.forEach(l,function(E){if(t.children(E.v).length){var N=HE(t,E.v,e,n);c[E.v]=N,Fn.has(N,"barycenter")&&xK(E,N)}});var f=vK(l,e);CK(f,c);var m=yK(f,n);if(a&&(m.vs=Fn.flatten([a,m.vs,s],!0),t.predecessors(a).length)){var x=t.node(t.predecessors(a)[0]),P=t.node(t.predecessors(s)[0]);Fn.has(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+x.order+P.order)/(m.weight+2),m.weight+=2}return m}function CK(t,i){Fn.forEach(t,function(e){e.vs=Fn.flatten(e.vs.map(function(n){return i[n]?i[n].vs:n}),!0)})}function xK(t,i){Fn.isUndefined(t.barycenter)?(t.barycenter=i.barycenter,t.weight=i.weight):(t.barycenter=(t.barycenter*t.weight+i.barycenter*i.weight)/(t.weight+i.weight),t.weight+=i.weight)}});var WE=g((Ure,UE)=>{"use strict";var Fr=Me(),bK=wt().Graph;UE.exports=wK;function wK(t,i,e){var n=SK(t),o=new bK({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(r){return t.node(r)});return Fr.forEach(t.nodes(),function(r){var a=t.node(r),s=t.parent(r);(a.rank===i||a.minRank<=i&&i<=a.maxRank)&&(o.setNode(r),o.setParent(r,s||n),Fr.forEach(t[e](r),function(c){var l=c.v===r?c.w:c.v,f=o.edge(l,r),m=Fr.isUndefined(f)?0:f.weight;o.setEdge(l,r,{weight:t.edge(c).weight+m})}),Fr.has(a,"minRank")&&o.setNode(r,{borderLeft:a.borderLeft[i],borderRight:a.borderRight[i]}))}),o}function SK(t){for(var i;t.hasNode(i=Fr.uniqueId("_root")););return i}});var KE=g((Wre,$E)=>{"use strict";var TK=Me();$E.exports=IK;function IK(t,i,e){var n={},o;TK.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=o,o=a),c&&c!==a){i.setEdge(c,a);return}a=s}})}});var JE=g(($re,QE)=>{"use strict";var Ln=Me(),EK=DE(),PK=NE(),MK=jE(),kK=WE(),DK=KE(),OK=wt().Graph,YE=nt();QE.exports=NK;function NK(t){var i=YE.maxRank(t),e=XE(t,Ln.range(1,i+1),"inEdges"),n=XE(t,Ln.range(i-1,-1,-1),"outEdges"),o=EK(t);ZE(t,o);for(var r=Number.POSITIVE_INFINITY,a,s=0,c=0;c<4;++s,++c){RK(s%2?e:n,s%4>=2),o=YE.buildLayerMatrix(t);var l=PK(t,o);l<r&&(c=0,a=Ln.cloneDeep(o),r=l)}ZE(t,a)}function XE(t,i,e){return Ln.map(i,function(n){return kK(t,n,e)})}function RK(t,i){var e=new OK;Ln.forEach(t,function(n){var o=n.graph().root,r=MK(n,o,e,i);Ln.forEach(r.vs,function(a,s){n.node(a).order=s}),DK(n,e,r.vs)})}function ZE(t,i){Ln.forEach(i,function(e){Ln.forEach(e,function(n,o){t.node(n).order=o})})}});var dP=g((Kre,cP)=>{"use strict";var ne=Me(),AK=wt().Graph,FK=nt();cP.exports={positionX:BK,findType1Conflicts:eP,findType2Conflicts:tP,addConflict:N_,hasConflict:nP,verticalAlignment:iP,horizontalCompaction:oP,alignCoordinates:aP,findSmallestWidthAlignment:rP,balance:sP};function eP(t,i){var e={};function n(o,r){var a=0,s=0,c=o.length,l=ne.last(r);return ne.forEach(r,function(f,m){var x=LK(t,f),P=x?t.node(x).order:c;(x||f===l)&&(ne.forEach(r.slice(s,m+1),function(E){ne.forEach(t.predecessors(E),function(N){var j=t.node(N),L=j.order;(L<a||P<L)&&!(j.dummy&&t.node(E).dummy)&&N_(e,N,E)})}),s=m+1,a=P)}),r}return ne.reduce(i,n),e}function tP(t,i){var e={};function n(r,a,s,c,l){var f;ne.forEach(ne.range(a,s),function(m){f=r[m],t.node(f).dummy&&ne.forEach(t.predecessors(f),function(x){var P=t.node(x);P.dummy&&(P.order<c||P.order>l)&&N_(e,x,f)})})}function o(r,a){var s=-1,c,l=0;return ne.forEach(a,function(f,m){if(t.node(f).dummy==="border"){var x=t.predecessors(f);x.length&&(c=t.node(x[0]).order,n(a,l,m,s,c),l=m,s=c)}n(a,l,a.length,c,r.length)}),a}return ne.reduce(i,o),e}function LK(t,i){if(t.node(i).dummy)return ne.find(t.predecessors(i),function(e){return t.node(e).dummy})}function N_(t,i,e){if(i>e){var n=i;i=e,e=n}var o=t[i];o||(t[i]=o={}),o[e]=!0}function nP(t,i,e){if(i>e){var n=i;i=e,e=n}return ne.has(t[i],e)}function iP(t,i,e,n){var o={},r={},a={};return ne.forEach(i,function(s){ne.forEach(s,function(c,l){o[c]=c,r[c]=c,a[c]=l})}),ne.forEach(i,function(s){var c=-1;ne.forEach(s,function(l){var f=n(l);if(f.length){f=ne.sortBy(f,function(N){return a[N]});for(var m=(f.length-1)/2,x=Math.floor(m),P=Math.ceil(m);x<=P;++x){var E=f[x];r[l]===l&&c<a[E]&&!nP(e,l,E)&&(r[E]=l,r[l]=o[l]=o[E],c=a[E])}}})}),{root:o,align:r}}function oP(t,i,e,n,o){var r={},a=zK(t,i,e,o),s=o?"borderLeft":"borderRight";function c(m,x){for(var P=a.nodes(),E=P.pop(),N={};E;)N[E]?m(E):(N[E]=!0,P.push(E),P=P.concat(x(E))),E=P.pop()}function l(m){r[m]=a.inEdges(m).reduce(function(x,P){return Math.max(x,r[P.v]+a.edge(P))},0)}function f(m){var x=a.outEdges(m).reduce(function(E,N){return Math.min(E,r[N.w]-a.edge(N))},Number.POSITIVE_INFINITY),P=t.node(m);x!==Number.POSITIVE_INFINITY&&P.borderType!==s&&(r[m]=Math.max(r[m],x))}return c(l,a.predecessors.bind(a)),c(f,a.successors.bind(a)),ne.forEach(n,function(m){r[m]=r[e[m]]}),r}function zK(t,i,e,n){var o=new AK,r=t.graph(),a=qK(r.nodesep,r.edgesep,n);return ne.forEach(i,function(s){var c;ne.forEach(s,function(l){var f=e[l];if(o.setNode(f),c){var m=e[c],x=o.edge(m,f);o.setEdge(m,f,Math.max(a(t,l,c),x||0))}c=l})}),o}function rP(t,i){return ne.minBy(ne.values(i),function(e){var n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return ne.forIn(e,function(r,a){var s=GK(t,a)/2;n=Math.max(r+s,n),o=Math.min(r-s,o)}),n-o})}function aP(t,i){var e=ne.values(i),n=ne.min(e),o=ne.max(e);ne.forEach(["u","d"],function(r){ne.forEach(["l","r"],function(a){var s=r+a,c=t[s],l;if(c!==i){var f=ne.values(c);l=a==="l"?n-ne.min(f):o-ne.max(f),l&&(t[s]=ne.mapValues(c,function(m){return m+l}))}})})}function sP(t,i){return ne.mapValues(t.ul,function(e,n){if(i)return t[i.toLowerCase()][n];var o=ne.sortBy(ne.map(t,n));return(o[1]+o[2])/2})}function BK(t){var i=FK.buildLayerMatrix(t),e=ne.merge(eP(t,i),tP(t,i)),n={},o;ne.forEach(["u","d"],function(a){o=a==="u"?i:ne.values(i).reverse(),ne.forEach(["l","r"],function(s){s==="r"&&(o=ne.map(o,function(m){return ne.values(m).reverse()}));var c=(a==="u"?t.predecessors:t.successors).bind(t),l=iP(t,o,e,c),f=oP(t,o,l.root,l.align,s==="r");s==="r"&&(f=ne.mapValues(f,function(m){return-m})),n[a+s]=f})});var r=rP(t,n);return aP(n,r),sP(n,t.graph().align)}function qK(t,i,e){return function(n,o,r){var a=n.node(o),s=n.node(r),c=0,l;if(c+=a.width/2,ne.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":l=-a.width/2;break;case"r":l=a.width/2;break}if(l&&(c+=e?l:-l),l=0,c+=(a.dummy?i:t)/2,c+=(s.dummy?i:t)/2,c+=s.width/2,ne.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":l=s.width/2;break;case"r":l=-s.width/2;break}return l&&(c+=e?l:-l),l=0,c}}function GK(t,i){return t.node(i).width}});var fP=g((Yre,uP)=>{"use strict";var Lr=Me(),lP=nt(),HK=dP().positionX;uP.exports=VK;function VK(t){t=lP.asNonCompoundGraph(t),jK(t),Lr.forEach(HK(t),function(i,e){t.node(e).x=i})}function jK(t){var i=lP.buildLayerMatrix(t),e=t.graph().ranksep,n=0;Lr.forEach(i,function(o){var r=Lr.max(Lr.map(o,function(a){return t.node(a).height}));Lr.forEach(o,function(a){t.node(a).y=n+r/2}),n+=r+e})}});var vP=g((Xre,gP)=>{"use strict";var re=Me(),pP=XI(),hP=iE(),UK=gE(),WK=nt().normalizeRanks,$K=yE(),KK=nt().removeEmptyRanks,mP=bE(),YK=TE(),_P=ME(),XK=JE(),ZK=fP(),zn=nt(),QK=wt().Graph;gP.exports=JK;function JK(t,i){var e=i&&i.debugTiming?zn.time:zn.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return lY(t)});e(" runLayout",function(){eY(n,e)}),e(" updateInputGraph",function(){tY(t,n)})})}function eY(t,i){i(" makeSpaceForEdgeLabels",function(){uY(t)}),i(" removeSelfEdges",function(){CY(t)}),i(" acyclic",function(){pP.run(t)}),i(" nestingGraph.run",function(){mP.run(t)}),i(" rank",function(){UK(zn.asNonCompoundGraph(t))}),i(" injectEdgeLabelProxies",function(){fY(t)}),i(" removeEmptyRanks",function(){KK(t)}),i(" nestingGraph.cleanup",function(){mP.cleanup(t)}),i(" normalizeRanks",function(){WK(t)}),i(" assignRankMinMax",function(){pY(t)}),i(" removeEdgeLabelProxies",function(){hY(t)}),i(" normalize.run",function(){hP.run(t)}),i(" parentDummyChains",function(){$K(t)}),i(" addBorderSegments",function(){YK(t)}),i(" order",function(){XK(t)}),i(" insertSelfEdges",function(){xY(t)}),i(" adjustCoordinateSystem",function(){_P.adjust(t)}),i(" position",function(){ZK(t)}),i(" positionSelfEdges",function(){bY(t)}),i(" removeBorderNodes",function(){yY(t)}),i(" normalize.undo",function(){hP.undo(t)}),i(" fixupEdgeLabelCoords",function(){gY(t)}),i(" undoCoordinateSystem",function(){_P.undo(t)}),i(" translateGraph",function(){mY(t)}),i(" assignNodeIntersects",function(){_Y(t)}),i(" reversePoints",function(){vY(t)}),i(" acyclic.undo",function(){pP.undo(t)})}function tY(t,i){re.forEach(t.nodes(),function(e){var n=t.node(e),o=i.node(e);n&&(n.x=o.x,n.y=o.y,i.children(e).length&&(n.width=o.width,n.height=o.height))}),re.forEach(t.edges(),function(e){var n=t.edge(e),o=i.edge(e);n.points=o.points,re.has(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=i.graph().width,t.graph().height=i.graph().height}var nY=["nodesep","edgesep","ranksep","marginx","marginy"],iY={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},oY=["acyclicer","ranker","rankdir","align"],rY=["width","height"],aY={width:0,height:0},sY=["minlen","weight","width","height","labeloffset"],cY={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},dY=["labelpos"];function lY(t){var i=new QK({multigraph:!0,compound:!0}),e=A_(t.graph());return i.setGraph(re.merge({},iY,R_(e,nY),re.pick(e,oY))),re.forEach(t.nodes(),function(n){var o=A_(t.node(n));i.setNode(n,re.defaults(R_(o,rY),aY)),i.setParent(n,t.parent(n))}),re.forEach(t.edges(),function(n){var o=A_(t.edge(n));i.setEdge(n,re.merge({},cY,R_(o,sY),re.pick(o,dY)))}),i}function uY(t){var i=t.graph();i.ranksep/=2,re.forEach(t.edges(),function(e){var n=t.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(i.rankdir==="TB"||i.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function fY(t){re.forEach(t.edges(),function(i){var e=t.edge(i);if(e.width&&e.height){var n=t.node(i.v),o=t.node(i.w),r={rank:(o.rank-n.rank)/2+n.rank,e:i};zn.addDummyNode(t,"edge-proxy",r,"_ep")}})}function pY(t){var i=0;re.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,i=re.max(i,n.maxRank))}),t.graph().maxRank=i}function hY(t){re.forEach(t.nodes(),function(i){var e=t.node(i);e.dummy==="edge-proxy"&&(t.edge(e.e).labelRank=e.rank,t.removeNode(i))})}function mY(t){var i=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,o=0,r=t.graph(),a=r.marginx||0,s=r.marginy||0;function c(l){var f=l.x,m=l.y,x=l.width,P=l.height;i=Math.min(i,f-x/2),e=Math.max(e,f+x/2),n=Math.min(n,m-P/2),o=Math.max(o,m+P/2)}re.forEach(t.nodes(),function(l){c(t.node(l))}),re.forEach(t.edges(),function(l){var f=t.edge(l);re.has(f,"x")&&c(f)}),i-=a,n-=s,re.forEach(t.nodes(),function(l){var f=t.node(l);f.x-=i,f.y-=n}),re.forEach(t.edges(),function(l){var f=t.edge(l);re.forEach(f.points,function(m){m.x-=i,m.y-=n}),re.has(f,"x")&&(f.x-=i),re.has(f,"y")&&(f.y-=n)}),r.width=e-i+a,r.height=o-n+s}function _Y(t){re.forEach(t.edges(),function(i){var e=t.edge(i),n=t.node(i.v),o=t.node(i.w),r,a;e.points?(r=e.points[0],a=e.points[e.points.length-1]):(e.points=[],r=o,a=n),e.points.unshift(zn.intersectRect(n,r)),e.points.push(zn.intersectRect(o,a))})}function gY(t){re.forEach(t.edges(),function(i){var e=t.edge(i);if(re.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 vY(t){re.forEach(t.edges(),function(i){var e=t.edge(i);e.reversed&&e.points.reverse()})}function yY(t){re.forEach(t.nodes(),function(i){if(t.children(i).length){var e=t.node(i),n=t.node(e.borderTop),o=t.node(e.borderBottom),r=t.node(re.last(e.borderLeft)),a=t.node(re.last(e.borderRight));e.width=Math.abs(a.x-r.x),e.height=Math.abs(o.y-n.y),e.x=r.x+e.width/2,e.y=n.y+e.height/2}}),re.forEach(t.nodes(),function(i){t.node(i).dummy==="border"&&t.removeNode(i)})}function CY(t){re.forEach(t.edges(),function(i){if(i.v===i.w){var e=t.node(i.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:i,label:t.edge(i)}),t.removeEdge(i)}})}function xY(t){var i=zn.buildLayerMatrix(t);re.forEach(i,function(e){var n=0;re.forEach(e,function(o,r){var a=t.node(o);a.order=r+n,re.forEach(a.selfEdges,function(s){zn.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 bY(t){re.forEach(t.nodes(),function(i){var e=t.node(i);if(e.dummy==="selfedge"){var n=t.node(e.e.v),o=n.x+n.width/2,r=n.y,a=e.x-o,s=n.height/2;t.setEdge(e.e,e.label),t.removeNode(i),e.label.points=[{x:o+2*a/3,y:r-s},{x:o+5*a/6,y:r-s},{x:o+a,y:r},{x:o+5*a/6,y:r+s},{x:o+2*a/3,y:r+s}],e.label.x=e.x,e.label.y=e.y}})}function R_(t,i){return re.mapValues(re.pick(t,i),Number)}function A_(t){var i={};return re.forEach(t,function(e,n){i[n.toLowerCase()]=e}),i}});var CP=g((Zre,yP)=>{"use strict";var ap=Me(),wY=nt(),SY=wt().Graph;yP.exports={debugOrdering:TY};function TY(t){var i=wY.buildLayerMatrix(t),e=new SY({compound:!0,multigraph:!0}).setGraph({});return ap.forEach(t.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+t.node(n).rank)}),ap.forEach(t.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),ap.forEach(i,function(n,o){var r="layer"+o;e.setNode(r,{rank:"same"}),ap.reduce(n,function(a,s){return e.setEdge(a,s,{style:"invis"}),s})}),e}});var bP=g((Qre,xP)=>{"use strict";xP.exports="0.8.5"});var SP=g((Jre,wP)=>{"use strict";wP.exports={graphlib:wt(),layout:vP(),debug:CP(),util:{time:nt().time,notime:nt().notime},version:bP()}});var Kn=class{constructor(i,e,n,o,r){this.center=i,this.radiusX=e,this.radiusY=n,this.startAngle=o,this.endAngle=r}},A=class t{static castToPoint(i){return i||t.initialize()}static initialize(i=0,e=0){return{x:i,y:e}}static copy(i){return t.initialize(i.x,i.y)}static isEqual(i,e){return i.x===e.x&&i.y===e.y}static sum(i,e){return{x:i.x+e.x,y:i.y+e.y}}static sub(i,e){return{x:i.x-e.x,y:i.y-e.y}}static div(i,e){return{x:i.x/e,y:i.y/e}}static mult(i,e){return{x:i.x*e,y:i.y*e}}static interpolatePoints(i,e,n){let o=1-n;return t.initialize(i.x*o+e.x*n,i.y*o+e.y*n)}static roundTo(i,e){let n=Math.trunc(i.x/e),o=Math.trunc(i.y/e);return{x:n*e,y:o*e}}static hypotenuse(i,e){let n=e.x-i.x,o=e.y-i.y;return Math.abs(Math.sqrt(n*n+o*o))}static distance(i,e){let n=i.x-e.x,o=i.y-e.y;return Math.sqrt(n*n+o*o)}static getMinimum(i,e){return t.initialize(Math.min(i.x,e.x),Math.min(i.y,e.y))}static getMaximum(i,e){return t.initialize(Math.max(i.x,e.x),Math.max(i.y,e.y))}static matrixTransform(i,e){let n=t.initialize(i.x,i.y),o=e.getScreenCTM();if(o){let r=e.createSVGPoint();r.x=i.x,r.y=i.y,n=r.matrixTransform(o.inverse())}return n}static elementTransform(i,e){let n=t.initialize(i.x,i.y),o=e.getBoundingClientRect();return n=t.sub(n,t.initialize(o.left,o.top)),n}},Z=class t{constructor(i=0,e=0){this.x=i,this.y=e}static fromPoint(i){return new t(i.x,i.y)}add(i){let e=A.sum(this,i);return t.fromPoint(e)}sub(i){let e=A.sub(this,i);return t.fromPoint(e)}subNumber(i){let e=A.sub(this,new t(i,i));return t.fromPoint(e)}div(i){let e=A.div(this,i);return t.fromPoint(e)}mult(i){let e=A.mult(this,i);return t.fromPoint(e)}matrixTransform(i){let e=A.matrixTransform(this,i);return t.fromPoint(e)}elementTransform(i){let e=A.elementTransform(this,i);return t.fromPoint(e)}},xo=class{static initialize(i=A.initialize(),e=A.initialize()){return{point1:i,point2:e}}static copy(i){return{point1:i.point1,point2:i.point2}}static hypotenuse(i){return Math.sqrt(Math.pow(i.point1.x-i.point2.x,2)+Math.pow(i.point1.y-i.point2.y,2))}},Yn=class{constructor(i,e){this.point1=i,this.point2=e}},V=class t{static initialize(i=0,e=0,n=0,o=0){n<0&&(i=i+n,n=-n),o<0&&(e=e+o,o=-o);let r=A.initialize(i+n/2,e+o/2);return{x:i,y:e,width:n,height:o,gravityCenter:r}}static copy(i){return t.initialize(i.x,i.y,i.width,i.height)}static fromElement(i){let{x:e,y:n,width:o,height:r}=i.getBoundingClientRect();return t.initialize(e,n,o,r)}static isIncludePoint(i,e){return e.x>=t.left(i)&&e.x<=t.right(i)&&e.y>=t.top(i)&&e.y<=t.bottom(i)}static intersectionWithRect(i,e){return!(i.x+i.width<e.x||e.x+e.width<i.x||i.y+i.height<e.y||e.y+e.height<i.y)}static left(i){return i.x}static top(i){return i.y}static right(i){return i.x+i.width}static bottom(i){return i.y+i.height}static addPoint(i,e){let n=t.copy(i);return n.x+=e.x,n.y+=e.y,this.initialize(n.x,n.y,n.width,n.height)}static mult(i,e){let n=t.copy(i);return n.x*=e,n.y*=e,n.width*=e,n.height*=e,this.initialize(n.x,n.y,n.width,n.height)}static div(i,e){let n=t.copy(i);return n.x/=e,n.y/=e,n.width/=e,n.height/=e,this.initialize(n.x,n.y,n.width,n.height)}static addPointToSize(i,e){let n=t.copy(i);return n.width+=e.x,n.height+=e.y,this.initialize(n.x,n.y,n.width,n.height)}static union(i){return!i||i.length===0?null:i.reduce((e,n)=>{let o=Math.min(e.x,n.x),r=Math.min(e.y,n.y),a=Math.max(e.x+e.width,n.x+n.width),s=Math.max(e.y+e.height,n.y+n.height);return t.initialize(o,r,a-o,s-r)},i[0])}static elementTransform(i,e){let n=e.getBoundingClientRect(),o=A.sub(i,A.initialize(n.left,n.top));return t.initialize(o.x,o.y,i.width,i.height)}static updateIsNotFinite(i){return!Number.isFinite(i.width)||!Number.isFinite(i.height)||!Number.isFinite(i.x)||!Number.isFinite(i.y)?t.initialize(0,0,0,0):i}};function Xg(t,i){let e=Math.max(t.width,i),n=Math.max(t.height,i),o=(e-t.width)/2,r=(n-t.height)/2;return V.initialize(t.x-o,t.y-r,e,n)}function Np(t,i){t=V.updateIsNotFinite(t),i.setAttribute("x",t.x.toString()),i.setAttribute("y",t.y.toString()),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString())}function Zg(t,i){t=V.updateIsNotFinite(t),i.setAttribute("viewBox",`${t.x} ${t.y} ${t.width} ${t.height}`)}var Le=class t{constructor(i=0,e=0,n=0,o=0,r=0,a=0,s=0,c=0){this.x=i,this.y=e,this.width=n,this.height=o,this.radius1=r,this.radius2=a,this.radius3=s,this.radius4=c,this.gravityCenter=A.initialize(),this.gravityCenter=this.calculateGravityCenter(this)}calculateGravityCenter(i){return new Z(i.x+i.width/2,i.y+i.height/2)}static fromRect(i){return new t(i.x,i.y,i.width,i.height)}static fromRoundedRect(i){return new t(i.x,i.y,i.width,i.height,i.radius1,i.radius2,i.radius3,i.radius4)}static fromCenter(i,e,n){return new t(i.gravityCenter.x-e/2,i.gravityCenter.y-n/2,e,n,i.radius1,i.radius2,i.radius3,i.radius4)}static fromPoint(i){return new t(i.x,i.y)}addPoint(i){let e=t.fromRoundedRect(this);return e.x+=i.x,e.y+=i.y,e.gravityCenter=this.calculateGravityCenter(e),e}},et=class t{static initialize(i=0,e=0){return{width:i,height:e}}static isEqual(i,e){return i.width===e.width&&i.height===e.height}static offsetFromElement(i){if(i instanceof SVGGraphicsElement){let e=i.getBBox();return t.initialize(e.width,e.height)}else if(i instanceof HTMLElement)return t.initialize(i.offsetWidth,i.offsetHeight)}};function ok(){return{position:A.initialize(),scaledPosition:A.initialize(),scale:1,rotate:0}}function rk(t){let i;if(t){t=t.replace("matrix(",""),t=t.replace(")","");let e=t.split(" ");i={position:{x:Number(e[4]),y:Number(e[5])},scaledPosition:A.initialize(),scale:Number(e[0]),rotate:0}}return i}var vn=class{static toString(i){let e=A.sum(i.position,i.scaledPosition);return`matrix(${i.scale}, 0, 0, ${i.scale}, ${e.x}, ${e.y})`}static fromString(i){return rk(i)}static default(){return ok()}},ot=class t{static initialize(i=0,e=0){return A.initialize(i,e)}static fromPoints(i,e){return t.initialize(e.x-i.x,e.y-i.y)}static vectorLength(i){return Math.sqrt(t.magnitudeSquared(i))}static magnitudeSquared(i){return i.x*i.x+i.y*i.y}static dotProduct(i,e){return i.x*e.x+i.y*e.y}static crossProduct(i,e){return i.x*e.y-i.y*e.x}static subtract(i,e){return t.initialize(i.x-e.x,i.y-e.y)}static add(i,e){return t.initialize(i.x+e.x,i.y+e.y)}static scale(i,e){return t.initialize(i.x*e,i.y*e)}static angle(i,e){let n=Math.acos(Math.max(-1,Math.min(t.dotProduct(i,e)/(t.vectorLength(i)*t.vectorLength(e)),1)));return t.crossProduct(i,e)<0?-n:n}},Op=class{static parseRoundedRect(i){let e=Math.PI*.5,n=i.x,o=i.y,r=i.x+i.width,a=i.y+i.height,s=i.x+i.radius1,c=i.y+i.radius1,l=i.x+i.width-i.radius2,f=i.y+i.radius2,m=i.x+i.width-i.radius3,x=i.y+i.height-i.radius3,P=i.x+i.radius4,E=i.y+i.height-i.radius4;return[new Kn({x:s,y:c},i.radius1,i.radius1,2*e,3*e),new Yn({x:s,y:o},{x:l,y:o}),new Kn({x:l,y:f},i.radius2,i.radius2,3*e,4*e),new Yn({x:r,y:f},{x:r,y:x}),new Kn({x:m,y:x},i.radius3,i.radius3,0,e),new Yn({x:m,y:a},{x:P,y:a}),new Kn({x:P,y:E},i.radius4,i.radius4,e,2*e),new Yn({x:n,y:E},{x:n,y:c})]}},Pi=class{static getRoundedRectIntersections(i,e,n){let o=Op.parseRoundedRect(n);for(let r of o)if(r instanceof Kn){let a=this.intersectArcWithLine(r,i,e);if(a.length>0)return a}else if(r instanceof Yn){let a=this.intersectLineSegments(i,e,r.point1,r.point2);if(a)return[a]}return[]}static getRoundedRectIntersectionsWithSVGPath(i,e){let n=i.getTotalLength(),o=[];for(let r=0;r<=n;r+=1){let a=i.getPointAtLength(r);o.push({x:a.x,y:a.y})}for(let r=1;r<o.length;r++){let a=this.getRoundedRectIntersections(o[r-1],o[r],e);if(a.length>0)return a}return[]}static intersectArcWithLine(i,e,n){return this.filterPointsWithinArc(this.findEllipseLineIntersections(i.center,i.radiusX,i.radiusY,e,n),i)}static intersectLineSegments(i,e,n,o){let r=e.x-i.x,a=e.y-i.y,s=o.x-n.x,c=o.y-n.y,l=(-a*(i.x-n.x)+r*(i.y-n.y))/(-s*a+r*c),f=(s*(i.y-n.y)-c*(i.x-n.x))/(-s*a+r*c);return l>=0&&l<=1&&f>=0&&f<=1?{x:i.x+f*r,y:i.y+f*a}:null}static filterPointsWithinArc(i,e){let{center:n,startAngle:o,endAngle:r}=e;if(i.length===0)return i;r<o&&([o,r]=[r,o]),(o<0||r<0)&&(o+=2*Math.PI,r+=2*Math.PI);let a=[];for(let s of i){let c=this.normalizeAngle(ot.angle(ot.initialize(1,0),ot.initialize(s.x-n.x,s.y-n.y)));c<o&&(c+=2*Math.PI),o<=c&&c<=r&&a.push(s)}return a}static normalizeAngle(i){let e=i%(2*Math.PI);return e<0?e+2*Math.PI:e}static findEllipseLineIntersections(i,e,n,o,r){let a=ot.initialize(o.x,o.y),s=ot.fromPoints(o,r),c=ot.initialize(i.x,i.y),l=ot.subtract(a,c),f=ot.initialize(s.x/(e*e),s.y/(n*n)),m=ot.initialize(l.x/(e*e),l.y/(n*n)),x=ot.dotProduct(s,f),P=ot.dotProduct(s,m),E=ot.dotProduct(l,m)-1,N=P*P-x*E;return N<0?[]:this.calculateIntersectionPoints(N,x,P,o,r)}static calculateIntersectionPoints(i,e,n,o,r){let a=[];if(i>0){let s=Math.sqrt(i),c=(-n-s)/e,l=(-n+s)/e;c>=0&&c<=1&&a.push(A.interpolatePoints(o,r,c)),l>=0&&l<=1&&a.push(A.interpolatePoints(o,r,l))}else{let s=-n/e;s>=0&&s<=1&&a.push(A.interpolatePoints(o,r,s))}return a}};var Rp=class{handle(i,e){let n=!0;if(this.validator&&(n=e.get(this.validator).handle(i)),!!n)return e.get(this.execution).handle(i)}execute(i,e){return e.get(this.execution).handle(i)}setValidator(i){this.validator=i}setExecution(i){this.execution=i}},D=class t{constructor(){this._injector=u(Ye)}static registerPipeline(i,e,n){if(!i||!i.fToken)throw new Error("Type must have a fToken static property.");let o=this.pipelines.get(i.fToken)||new Rp;n?o.setValidator(e):o.setExecution(e),this.pipelines.set(i.fToken,o)}send(i){let e=t.pipelines.get(i.constructor.fToken);if(e)return e.handle(i,this._injector);throw new Error("Handler not registered for request type.")}execute(i){return t.pipelines.get(i.constructor.fToken).execute(i,this._injector)}};D.pipelines=new Map;D.\u0275fac=function(i){return new(i||D)};D.\u0275prov=y({token:D,factory:D.\u0275fac});function w(t){return function(i){D.registerPipeline(t,i,!1)}}var ak=(()=>{class t{setItem(e,n){localStorage.setItem(e,n)}getItem(e){return localStorage.getItem(e)}removeItem(e){localStorage.removeItem(e)}clear(){localStorage.clear()}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),sk=(()=>{class t{storage={};setItem(e,n){this.storage[e]=n}getItem(e){return this.storage[e]||null}removeItem(e){delete this.storage[e]}clear(){this.storage={}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ck=new ue("F_LOCAL_STORAGE",{providedIn:"root",factory:()=>an(u(jr))?u(ak):u(sk)}),dk=(()=>{class t{getComputedStyle(e){return window.getComputedStyle(e)}get innerWidth(){return window.innerWidth}get innerHeight(){return window.innerHeight}get pageXOffset(){return window.pageXOffset}get pageYOffset(){return window.pageYOffset}isMediaQuery(e){return window.matchMedia(e).matches}requestAnimationFrame(e){return window.requestAnimationFrame(e)}get location(){return window.location}open(e,n,o){window.open(e,n,o)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),lk=(()=>{class t{getComputedStyle(e){return new Proxy({getPropertyValue:n=>"0"},{get:(n,o)=>o==="getPropertyValue"?n.getPropertyValue:"0"})}get innerWidth(){return 0}get innerHeight(){return 0}get pageXOffset(){return 0}get pageYOffset(){return 0}isMediaQuery(e){return!1}requestAnimationFrame(e){return setTimeout(e,0)}get location(){return{href:"",pathname:"",search:"",hash:"",origin:""}}open(e,n,o){}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),uk=new ue("F_WINDOW",{providedIn:"root",factory:()=>an(u(jr))?u(dk):u(lk)}),yn=(function(t){return t.MAC_OS="macos",t.IOS="ios",t.WINDOWS="windows",t.ANDROID="android",t.LINUX="linux",t})(yn||{}),Ap;try{Ap=typeof Intl<"u"&&Intl.v8BreakIterator}catch{Ap=!1}var Fp=(()=>{class t{_platformId;isBrowser=!1;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||Ap)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(e){this._platformId=e,this.isBrowser=this._platformId?an(this._platformId):typeof document=="object"&&!!document}getOS(){let e=navigator.userAgent.toLowerCase(),n=/(macintosh|macintel|macppc|mac68k|macos)/i,o=/(win32|win64|windows|wince)/i,r;return n.test(e)?r=yn.MAC_OS:this.IOS?r=yn.IOS:o.test(e)?r=yn.WINDOWS:this.ANDROID?r=yn.ANDROID:!r&&/linux/.test(e)&&(r=yn.LINUX),r}static \u0275fac=function(n){return new(n||t)(yi(jr))};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ze=(()=>{class t{injectedDocument;windowService;localStorageService;platformService;constructor(e,n,o,r){this.injectedDocument=e,this.windowService=n,this.localStorageService=o,this.platformService=r}isBrowser(){return this.platformService.isBrowser}get window(){return this.windowService}get localStorage(){return this.localStorageService}get document(){return this.injectedDocument}toPixels(e,n,o,r){if(e.endsWith("px"))return parseFloat(e);if(e.endsWith("%")){let a=parseFloat(e)/100;return Math.max(n,o)*a}else{if(e.endsWith("em"))return parseFloat(e)*parseFloat(r);if(e.endsWith("rem"))return parseFloat(e)*parseFloat(getComputedStyle(this.document.documentElement).fontSize);if(e.endsWith("vh")){let a=this.window.innerHeight/100;return parseFloat(e)*a}else if(e.endsWith("vw")){let a=this.window.innerWidth/100;return parseFloat(e)*a}}return parseFloat(e)||0}static \u0275fac=function(n){return new(n||t)(yi(Vr),yi(uk),yi(ck),yi(Fp))};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Lp(t,i){return t.reduce((e,n)=>[...e,...i(n)],[])}function zp(t){let i=t.cloneNode(!0),e=i.querySelectorAll("[id]"),n=t.nodeName.toLowerCase();i.removeAttribute("id");for(let o=0;o<e.length;o++)e[o].removeAttribute("id");return n==="canvas"?e0(t,i):(n==="input"||n==="select"||n==="textarea")&&Jg(t,i),Qg("canvas",t,i,e0),Qg("input, textarea, select",t,i,Jg),i}function Qg(t,i,e,n){let o=i.querySelectorAll(t);if(o.length){let r=e.querySelectorAll(t);for(let a=0;a<o.length;a++)n(o[a],r[a])}}var fk=0;function Jg(t,i){i.type!=="file"&&(i.value=t.value),i.type==="radio"&&i.name&&(i.name=`mat-clone-${i.name}-${fk++}`)}function e0(t,i){let e=i.getContext("2d");if(e)try{e.drawImage(t,0,0)}catch{}}function Bp(t,i,e){for(let n in i)if(i.hasOwnProperty(n)){let o=i[n];o?t.setProperty(n,o,e?.has(n)?"important":""):t.removeProperty(n)}return t}function t0(t){Bp(t.style,{"touch-action":"none","-webkit-user-drag":"none","-webkit-tap-highlight-color":"transparent","user-select":"none","-ms-user-select":"none","-webkit-user-select":"none","-moz-user-select":"none"})}function n0(t,i,e){return pk(t,e).dataset[i]}function pk(t,i){return t.closest(i)}function qp(t,i){let e=t.rootNodes;if(e.length===1&&e[0].nodeType===i.ELEMENT_NODE)return e[0];let n=i.createElement("div");return e.forEach(o=>n.appendChild(o)),n}function bo(t,i){let e=hk(t,i);return!!e&&!e.classList.contains(i+"-disabled")}function hk(t,i){return t.closest(i)}function Xt(t){return t.match(/^[a-zA-Z_]/)||(t="_"+t),t.replace(/[^a-zA-Z0-9_\-:.]/g,"_")}function Mi(t,i,e){let n=e[t.toUpperCase()]||mk(e,t.toLowerCase());if(n===void 0)throw new Error(`Unknown ${i}: ${t}. Accepted values: ${Object.keys(e).join(", ")}`);return n}function mk(t,i){return Object.keys(t).find(e=>t[e]===i)}var _k=["markerElement"],gk=["fConnectionGradientRenderer",""],vk=["f-connection-path",""],yk=["fConnectionSelection",""],Ck=["f-connection-drag-handle-start",""],xk=["f-connection-drag-handle-end",""],bk=["defs"],wk=["*"],Sk=["fGroupsContainer"],Tk=["fNodesContainer"],Ik=["fConnectionsContainer"],Ek=[[["","fGroup",""],["","fGroups",""]],[["f-snap-connection"]],[["f-connection"],["","fConnections",""]],[["f-connection-for-create"]],[["","fNode",""],["","fNodes",""]]],Pk=["[fGroup], [fGroups]","f-snap-connection","f-connection, [fConnections]","f-connection-for-create","[fNode], [fNodes]"],Mk=[[["svg","fMarker",""]],[["f-connection-marker-circle"],["f-connection-marker-arrow"]],[["f-connection-gradient"]],[["f-connection-waypoints"]],[["","fConnectionContent",""]]],kk=["svg[fMarker]","f-connection-marker-circle, f-connection-marker-arrow","f-connection-gradient","f-connection-waypoints","[fConnectionContent]"];function Dk(t,i){t&1&&(Je(),R(0,"linearGradient",3)),t&2&&M("fConnectionGradientRendererFor",i)}function Ok(t,i){t&1&&(Je(),R(0,"circle",6))}function Nk(t,i){t&1&&ke(0,4)}var Rk="[_nghost-%COMP%]{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}",Ak=[[["","fDefinitions",""]],[["f-background"]],[["f-line-alignment"]],[["f-canvas"]],[["f-selection-area"]],"*"],Fk=["[fDefinitions]","f-background","f-line-alignment","f-canvas","f-selection-area","*"],Up=new ue("F_BACKGROUND_PATTERN"),jd=class{fPattern;static fToken=Symbol("AddPatternToBackgroundRequest");constructor(i){this.fPattern=i}},Ri=class{_items=[];_byId=new Map;get(i){return this._byId.get(i)}require(i){let e=this._byId.get(i);if(!e)throw new Error(`${this.kind} not found: ${i}`);return e}has(i){return this._byId.has(i)}getAll(){return this._items}size(){return this._items.length}add(i){let e=i.fId();if(this._byId.has(e))throw new Error(`${this.kind} already exists: ${e}`);this._items.push(i),this._byId.set(e,i)}addMany(i){for(let e of i)this.add(e)}remove(i){let e=i.fId(),n=this._byId.get(e);if(!n)return!1;this._byId.delete(e);let o=this._items.indexOf(n);return o>=0&&this._items.splice(o,1),!0}removeById(i){let e=this._byId.get(i);if(!e)return;this._byId.delete(i);let n=this._items.indexOf(e);return n>=0&&this._items.splice(n,1),e}clear(){this._items.length=0,this._byId.clear()}};function Xn(t){return{name:t}}var Wp=class{_instances=new Map;get(i){return this._instances.get(i.name)}require(i){let e=this.get(i);if(!e)throw new Error(`Instance not found: ${i.name}`);return e}has(i){return this._instances.has(i.name)}add(i,e){if(this._instances.has(i.name))throw new Error(`${i.name} already exists`);this._instances.set(i.name,e)}remove(i){if(!this._instances.has(i.name))throw new Error(`${i.name} does not exist`);return this._instances.delete(i.name),!0}clear(){this._instances.clear()}},So=class extends Ri{kind;constructor(i){super(),this.kind=i}},$p=class extends Ri{kind="Connection Marker"},Kp=class extends Ri{kind="Connection";_instancesForCreate;_instancesForSnap;getForSnap(){return this._instancesForSnap}getForCreate(){return this._instancesForCreate}addForCreate(i){this._instancesForCreate=i}addForSnap(i){this._instancesForSnap=i}removeInstanceForCreate(){this._instancesForCreate=void 0}removeInstanceForSnap(){this._instancesForSnap=void 0}},Yp=class extends Ri{kind="Node"},Di=class{notifyOnSubscribe;static fToken=Symbol("ListenConnectionsChangesRequest");constructor(i=!0){this.notifyOnSubscribe=i}};function Lk(){return t=>{let i=null,e=null,n=()=>{i!==null&&cancelAnimationFrame(i),e!==null&&cancelAnimationFrame(e),i=e=null};return{callback:()=>{n(),i=requestAnimationFrame(()=>{i=null,e=requestAnimationFrame(()=>{e=null,t()})})},cleanup:n}}}function zk(){return t=>{let i=null;return{callback:()=>{i!==null&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null,t()})},cleanup:()=>{i!==null&&cancelAnimationFrame(i),i=null}}}}function Ud(t){return i=>{let e=null;return{callback:()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,i()},t)},cleanup:()=>{e!==null&&clearTimeout(e),e=null}}}}var yt=class{_listeners=new Set;notify(){this._listeners.forEach(i=>i())}listen(i){return this._listeners.add(i),()=>this.stop(i)}stop(i){this._listeners.delete(i)}},Xp=class extends yt{_htmlElement;_observer=new ResizeObserver(()=>this.notify());_isObserving=!1;constructor(i){super(),this._htmlElement=i}listen(i){return this._isObserving||(this._observer.observe(this._htmlElement),this._isObserving=!0),super.listen(i)}stop(i){super.stop(i),this._listeners.size===0&&this._disconnect()}_disconnect(){this._observer.unobserve(this._htmlElement),this._observer.disconnect(),this._isObserving=!1}},Bt=class t{_channels=[];_operators=[];constructor(...i){this._channels=[...i]}pipe(...i){let e=new t(...this._channels);return e._operators=[...this._operators,...i],e}listen(i,e){let n=e,o=[],r=[],a=[];for(let m of[...this._operators].reverse()){let x=m(n);n=x.callback,x.cleanup&&o.push(x.cleanup),x.onSubscribe&&r.push(x.onSubscribe),x.setTeardown&&a.push(x.setTeardown)}let s=this._channels.map(m=>m.listen(()=>n())),c=null,l=!1,f=()=>{l||(l=!0,c?.(),c=null,s.forEach(m=>m()),o.forEach(m=>m()))};a.slice().reverse().forEach(m=>m(f)),r.slice().reverse().forEach(m=>m(n)),c=i.onDestroy(f)}};function bf(){return t=>{let i=!0;return{callback:t,onSubscribe:e=>{queueMicrotask(()=>{i&&e()})},cleanup:()=>{i=!1}}}}function i0(){return t=>{let i=!1,e=null;return{setTeardown:n=>e=n,callback:()=>{if(!i){i=!0;try{t()}finally{e?.()}}}}}}var Bk=(()=>{let t=class xa{_store=u(k);handle({notifyOnSubscribe:e}){return e?new Bt(this._store.connectionsChanges$).pipe(bf(),Ud(1)):new Bt(this._store.connectionsChanges$).pipe(Ud(1))}static \u0275fac=function(n){return new(n||xa)};static \u0275prov=y({token:xa,factory:xa.\u0275fac})};return t=b([w(Di)],t),t})(),Zp=class{static fToken=Symbol("ListenNodesChangesRequest")},qk=(()=>{let t=class ba{_store=u(k);handle(e){return new Bt(this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||ba)};static \u0275prov=y({token:ba,factory:ba.\u0275fac})};return t=b([w(Zp)],t),t})(),Wd=class{static fToken=Symbol("ListenTransformChangesRequest")},Gk=(()=>{let t=class wa{_store=u(k);handle(e){return new Bt(this._store.transformChanges$,this._store.connectionsChanges$,this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||wa)};static \u0275prov=y({token:wa,factory:wa.\u0275fac})};return t=b([w(Wd)],t),t})(),Zn=class{static fToken=Symbol("EmitConnectionsChangesRequest")},Hk=(()=>{let t=class Sa{_store=u(k);handle(e){this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Sa)};static \u0275prov=y({token:Sa,factory:Sa.\u0275fac})};return t=b([w(Zn)],t),t})(),wn=class{static fToken=Symbol("NotifyTransformChangedRequest")},k=(()=>{class t{transformChanges$=new yt;viewportAnimationChanges$=new yt;connectionsChanges$=new yt;_connectionsRevision=0;connectionsRenderedChanges$=new yt;_connectionsRenderedRevision=0;_connectionsRenderedNodesRevision=0;_viewportAnimationCount=0;nodesChanges$=new yt;_nodesRevision=0;progressiveRenderChanges$=new yt;_pendingProgressiveRenderCount=0;get connectionsRevision(){return this._connectionsRevision}get connectionsRenderedRevision(){return this._connectionsRenderedRevision}get connectionsRenderedNodesRevision(){return this._connectionsRenderedNodesRevision}get nodesRevision(){return this._nodesRevision}get hasPendingProgressiveRender(){return this._pendingProgressiveRenderCount>0}get isViewportAnimating(){return this._viewportAnimationCount>0}get flowHost(){return this.fFlow?.hostElement}fFlow;fCanvas;get transform(){return this.fCanvas?.transform}nodes=new Yp;connections=new Kp;connectionMarkers=new $p;outputs=new So("Output");inputs=new So("Input");outlets=new So("Outlet");instances=new Wp;fDraggable;emitNodeChanges(){this._nodesRevision++,this.nodesChanges$.notify()}emitConnectionChanges(){this._connectionsRevision++,this.connectionsChanges$.notify()}completeConnectionsRender(e,n){e<this._connectionsRenderedRevision||e===this._connectionsRenderedRevision&&n<=this._connectionsRenderedNodesRevision||(this._connectionsRenderedRevision=Math.min(e,this._connectionsRevision),this._connectionsRenderedNodesRevision=n,this.connectionsRenderedChanges$.notify())}beginProgressiveRender(){this._pendingProgressiveRenderCount++,this.progressiveRenderChanges$.notify()}endProgressiveRender(){this._pendingProgressiveRenderCount&&(this._pendingProgressiveRenderCount--,this.progressiveRenderChanges$.notify())}transformChanged(){this.transformChanges$.notify()}beginViewportAnimation(){this._viewportAnimationCount++,this.viewportAnimationChanges$.notify()}endViewportAnimation(){this._viewportAnimationCount&&(this._viewportAnimationCount--,this.viewportAnimationChanges$.notify())}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Te={MAGNETIC_LINES:Xn("magnetic-lines"),MAGNETIC_RECTS:Xn("magnetic-rects"),ZOOM:Xn("zoom-controls"),BACKGROUND:Xn("background"),SELECTION_AREA:Xn("selection-area"),MINIMAP:Xn("minimap"),AUTO_PAN:Xn("auto-pan")},Vk=(()=>{let t=class Ta{_store=u(k);handle(e){this._store.transformChanged()}static \u0275fac=function(n){return new(n||Ta)};static \u0275prov=y({token:Ta,factory:Ta.\u0275fac})};return t=b([w(wn)],t),t})(),Sn=class{key;instance;static fToken=Symbol("RegisterPluginInstanceRequest");constructor(i,e){this.key=i,this.instance=e}},jk=(()=>{let t=class Ia{_store=u(k);handle({key:e,instance:n}){this._store.instances.add(e,n)}static \u0275fac=function(n){return new(n||Ia)};static \u0275prov=y({token:Ia,factory:Ia.\u0275fac})};return t=b([w(Sn)],t),t})(),Tn=class{key;static fToken=Symbol("RemovePluginInstanceRequest");constructor(i){this.key=i}},Uk=(()=>{let t=class Ea{_store=u(k);handle({key:e}){this._store.instances.remove(e)}static \u0275fac=function(n){return new(n||Ea)};static \u0275prov=y({token:Ea,factory:Ea.\u0275fac})};return t=b([w(Tn)],t),t})(),Wk=[k,qk,Bk,Gk,Hk,Vk,jk,Uk],$k=0,Kk=(()=>{let t=class Pa{_store=u(k);_browser=u(ze);get _backgroundElement(){return this._store.instances.get(Te.BACKGROUND)?.hostElement}handle(e){let n=this._getPatterns(e.fPattern?.hostElement);if(!n?.length)return;let o=Ni("defs",this._browser);if(e.fPattern?.hostElement.remove(),n.forEach(r=>{o.append(r)}),n.length){this._backgroundElement?.firstChild?.appendChild(o),n[n.length-1].id="f-background-pattern-"+$k++;let r=n[n.length-1].id,a=Ni("rect",this._browser);a.setAttribute("fill","url(#"+r+")"),a.setAttribute("width","100%"),a.setAttribute("height","100%"),this._backgroundElement?.firstChild?.appendChild(a);let s=this._store.fCanvas?.transform||vn.default();e.fPattern?.setTransform(s)}}_getPatterns(e){return Array.from(e?.getElementsByTagName("pattern")||[])}static \u0275fac=function(n){return new(n||Pa)};static \u0275prov=y({token:Pa,factory:Pa.\u0275fac})};return t=b([w(jd)],t),t})(),To=class{fTransform;static fToken=Symbol("SetBackgroundTransformRequest");constructor(i){this.fTransform=i}},Yk=(()=>{let t=class Ma{_store=u(k);handle(e){this._store.instances.get(Te.BACKGROUND)?.setTransform(e.fTransform)}static \u0275fac=function(n){return new(n||Ma)};static \u0275prov=y({token:Ma,factory:Ma.\u0275fac})};return t=b([w(To)],t),t})(),Xk=[Kk,Yk],$d=class{instance;static fToken=Symbol("AddCanvasToStoreRequest");constructor(i){this.instance=i}},Zk=(()=>{let t=class ka{_store=u(k);handle({instance:e}){this._store.fCanvas=e}static \u0275fac=function(n){return new(n||ka)};static \u0275prov=y({token:ka,factory:ka.\u0275fac})};return t=b([w($d)],t),t})(),Kd=class{id;animated;static fToken=Symbol("CenterGroupOrNodeRequest");constructor(i,e){this.id=i,this.animated=e}},Qk=(()=>{let t=class Da{_store=u(k);_mediator=u(D);get _transform(){return this._store.transform}handle({id:e,animated:n}){let o=this._store.nodes.get(e);o&&(this._toCenter(this._getNodeRect(o),this._getFlowRect(),o._position),this._mediator.execute(new Ai(n,Qn.VIEWPORT_ONLY)))}_toCenter(e,n,o){this._transform.scaledPosition=A.initialize(),this._transform.position=A.initialize((n.width-e.width)/2-o.x*this._transform.scale,(n.height-e.height)/2-o.y*this._transform.scale)}_getNodeRect(e){return V.fromElement(e.hostElement)}_getFlowRect(){return V.fromElement(this._store.flowHost)}static \u0275fac=function(n){return new(n||Da)};static \u0275prov=y({token:Da,factory:Da.\u0275fac})};return t=b([w(Kd)],t),t})(),Yd=class{toCenter;animated;static fToken=Symbol("FitToFlowRequest");constructor(i,e){this.toCenter=i,this.animated=e}},Jk=(()=>{let t=class Oa{_store=u(k);get _transform(){return this._store.transform}_mediator=u(D);handle({toCenter:e,animated:n}){let o=this._mediator.execute(new Hi)||V.initialize();o.width===0||o.height===0||(this.fitToParent(o,V.fromElement(this._store.flowHost),this._store.nodes.getAll().map(r=>r._position),e),this._mediator.execute(new Ai(n,Qn.VIEWPORT_ONLY)))}fitToParent(e,n,o,r){this._transform.scaledPosition=A.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let a=e.width/this._transform.scale+r.x,s=e.height/this._transform.scale+r.y;(a>n.width||s>n.height||a<n.width&&s<n.height)&&(this._transform.scale=Math.min(n.width/a,n.height/s));let c=(n.width-a*this._transform.scale)/2-this._transform.position.x*this._transform.scale,l=(n.height-s*this._transform.scale)/2-this._transform.position.y*this._transform.scale;this._transform.position=A.initialize(c+r.x/2*this._transform.scale,l+r.y/2*this._transform.scale)}_getZeroPositionWithoutScale(e){let n=e.length?Math.min(...e.map(r=>r.x)):0,o=e.length?Math.min(...e.map(r=>r.y)):0;return A.initialize(n,o)}static \u0275fac=function(n){return new(n||Oa)};static \u0275prov=y({token:Oa,factory:Oa.\u0275fac})};return t=b([w(Yd)],t),t})(),Xd=class{transform;position;static fToken=Symbol("InputCanvasPositionRequest");constructor(i,e){this.transform=i,this.position=e}},eD=(()=>{let t=class Na{_store=u(k);handle({transform:e,position:n}){n&&(A.isEqual(this._calculateTransformPosition(e),n)||(e.position=n,e.scaledPosition=A.initialize(),this._store.fCanvas?.redraw()))}_calculateTransformPosition(e){return A.sum(e.position,e.scaledPosition)}static \u0275fac=function(n){return new(n||Na)};static \u0275prov=y({token:Na,factory:Na.\u0275fac})};return t=b([w(Xd)],t),t})(),Zd=class{transform;scale;static fToken=Symbol("InputCanvasScaleRequest");constructor(i,e){this.transform=i,this.scale=e}},tD=(()=>{let t=class Ra{_store=u(k);handle(e){!e.scale&&e.scale!==0||(e.transform.scale=e.scale,this._store.fCanvas?.redraw())}static \u0275fac=function(n){return new(n||Ra)};static \u0275prov=y({token:Ra,factory:Ra.\u0275fac})};return t=b([w(Zd)],t),t})(),Qn=(function(t){return t.VIEWPORT_ONLY="VIEWPORT_ONLY",t.WITH_CONNECTION_CHANGES="WITH_CONNECTION_CHANGES",t})(Qn||{}),Ai=class{animated;context;static fToken=Symbol("RedrawCanvasWithAnimationRequest");constructor(i,e=Qn.WITH_CONNECTION_CHANGES){this.animated=i,this.context=e}};function k0(t,i){let e=n=>{n.propertyName==="transform"&&(t.removeEventListener("transitionend",e),i(n))};t.addEventListener("transitionend",e)}var nD=(()=>{let t=class Aa{_store=u(k);get _canvas(){return this._store.fCanvas}handle(e){e.animated?this._redrawWithAnimation(e.context):this._redraw(e.context),this._canvas?.emitCanvasChangeEvent()}_redrawWithAnimation(e){this._store.beginViewportAnimation(),this._canvas?.redrawWithAnimation(),k0(this._canvas.hostElement,()=>{this._store.endViewportAnimation(),e===Qn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()})}_redraw(e){this._canvas?.redraw(),e===Qn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Aa)};static \u0275prov=y({token:Aa,factory:Aa.\u0275fac})};return t=b([w(Ai)],t),t})(),Qd=class{static fToken=Symbol("RemoveCanvasFromStoreRequest")},iD=(()=>{let t=class Fa{_store=u(k);handle(e){this._store.fCanvas=void 0}static \u0275fac=function(n){return new(n||Fa)};static \u0275prov=y({token:Fa,factory:Fa.\u0275fac})};return t=b([w(Qd)],t),t})(),Jd=class{static fToken=Symbol("ResetScaleRequest")},oD=(()=>{let t=class La{_store=u(k);get _transform(){return this._store.transform}handle(e){this._transform.scale=1,this._transform.scaledPosition=A.initialize()}static \u0275fac=function(n){return new(n||La)};static \u0275prov=y({token:La,factory:La.\u0275fac})};return t=b([w(Jd)],t),t})(),el=class{animated;static fToken=Symbol("ResetScaleAndCenterRequest");constructor(i){this.animated=i}},rD=(()=>{let t=class za{_mediator=u(D);_store=u(k);get _transform(){return this._store.transform}handle({animated:e}){let n=this._mediator.execute(new Hi)||V.initialize();n.width===0||n.height===0||(this._oneToOneCentering(n,V.fromElement(this._store.flowHost),this._store.nodes.getAll().map(o=>o._position)),this._mediator.execute(new Ai(e,Qn.VIEWPORT_ONLY)))}_oneToOneCentering(e,n,o){this._transform.scaledPosition=A.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let r=(n.width-e.width/this._transform.scale)/2-this._transform.position.x,a=(n.height-e.height/this._transform.scale)/2-this._transform.position.y;this._transform.scale=1,this._transform.position=A.initialize(r,a)}_getZeroPositionWithoutScale(e){let n=e.length?Math.min(...e.map(r=>r.x)):0,o=e.length?Math.min(...e.map(r=>r.y)):0;return A.initialize(n,o)}static \u0275fac=function(n){return new(n||za)};static \u0275prov=y({token:za,factory:za.\u0275fac})};return t=b([w(el)],t),t})(),tl=class{scale;toPosition;static fToken=Symbol("UpdateScaleRequest");constructor(i,e){this.scale=i,this.toPosition=e}},aD=(()=>{let t=class Ba{_store=u(k);get _transform(){return this._store.transform}handle({scale:e,toPosition:n}){if(e===this._transform.scale)return;let o=A.sum(this._transform.scaledPosition,this._transform.position),r=n.x-(n.x-o.x)*e/this._transform.scale,a=n.y-(n.y-o.y)*e/this._transform.scale;this._transform.scale=e,this._transform.scaledPosition=A.sub(A.initialize(r,a),this._transform.position)}static \u0275fac=function(n){return new(n||Ba)};static \u0275prov=y({token:Ba,factory:Ba.\u0275fac})};return t=b([w(tl)],t),t})(),sD=[Zk,Qk,Jk,eD,tD,nD,iD,oD,rD,aD],Qp=class{connection;static fToken=Symbol("AddConnectionForCreateToStoreRequest");constructor(i){this.connection=i}},cD=(()=>{let t=class qa{_store=u(k);handle({connection:e}){this._store.connections.addForCreate(e)}static \u0275fac=function(n){return new(n||qa)};static \u0275prov=y({token:qa,factory:qa.\u0275fac})};return t=b([w(Qp)],t),t})(),nl=class{instance;static fToken=Symbol("AddConnectionMarkerToStoreRequest");constructor(i){this.instance=i}},dD=(()=>{let t=class Ga{_store=u(k);handle({instance:e}){this._store.connectionMarkers.add(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Ga)};static \u0275prov=y({token:Ga,factory:Ga.\u0275fac})};return t=b([w(nl)],t),t})(),il=class{connection;static fToken=Symbol("AddConnectionToStoreRequest");constructor(i){this.connection=i}},lD=(()=>{let t=class Ha{_store=u(k);handle({connection:e}){this._store.connections.add(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Ha)};static \u0275prov=y({token:Ha,factory:Ha.\u0275fac})};return t=b([w(il)],t),t})(),Jp=class{connection;static fToken=Symbol("AddSnapConnectionToStoreRequest");constructor(i){this.connection=i}},uD=(()=>{let t=class Va{_store=u(k);handle({connection:e}){this._store.connections.addForSnap(e)}static \u0275fac=function(n){return new(n||Va)};static \u0275prov=y({token:Va,factory:Va.\u0275fac})};return t=b([w(Jp)],t),t})(),Fi=class{connection;static fToken=Symbol("CreateConnectionMarkersRequest");constructor(i){this.connection=i}},o0=new ue("F_CONNECTION_CONTENT");var ol=class t{points;cumulativeLengths;segmentTangents;totalLength;constructor(i){let e=t._removeConsecutiveDuplicates(i);if(e.length<2){this.points=[{x:0,y:0},{x:1,y:0}],this.cumulativeLengths=[0,1],this.segmentTangents=[{x:1,y:0}],this.totalLength=1;return}this.points=e;let n=this.points.length,o=n-1,r=new Array(n).fill(0),a=new Array(o),s=0;for(let c=0;c<o;c++){let l=this.points[c+1].x-this.points[c].x,f=this.points[c+1].y-this.points[c].y,m=Math.hypot(l,f),x=m?l/m:1,P=m?f/m:0;a[c]={x,y:P},s+=m,r[c+1]=s}this.cumulativeLengths=r,this.segmentTangents=a,this.totalLength=s||1}static from(i){return new t(i.map(e=>({x:e.x,y:e.y})))}static _removeConsecutiveDuplicates(i){let e=[];for(let n of i){let o=e[e.length-1];(!o||o.x!==n.x||o.y!==n.y)&&e.push({x:n.x,y:n.y})}return e}},eh=class t{_polyline;constructor(i=[]){this._polyline=new ol(i)}updatePoints(i){return this._polyline=new ol(i),this._polyline.totalLength}calculateTotalLength(i){return this.updatePoints(i)}get totalLength(){return this._polyline.totalLength}getPointAtProgress(i){let{points:e,cumulativeLengths:n,segmentTangents:o,totalLength:r}=this._polyline,s=t._clamp(i,0,1)*r,c=.5;if(s<=c)return{point:e[0],tangent:o[0]??{x:1,y:0},atEdge:!0};if(r-s<=c){let U=e.length-1;return{point:e[U],tangent:o[U-1]??{x:1,y:0},atEdge:!0}}let l=t._findRightIndex(n,s),f=Math.max(1,l),m=n[f-1],x=n[f],P=t._safeRatio(s-m,x-m),E=e[f-1],N=e[f],j={x:t._lerp(E.x,N.x,P),y:t._lerp(E.y,N.y,P)},L=o[f-1]??{x:1,y:0};return{point:j,tangent:L,atEdge:!1}}getPointAtLength(i){return this.getPointAtProgress(i)}getPointAtDistance(i){let e=this._polyline.totalLength?i/this._polyline.totalLength:0;return this.getPointAtProgress(e)}static _findRightIndex(i,e){let n=0,o=i.length-1;for(;n<o;){let r=n+o>>1;i[r]<e?n=r+1:o=r}return n}static _lerp(i,e,n){return i+(e-i)*n}static _clamp(i,e,n){return i<e?e:i>n?n:i}static _safeRatio(i,e){let n=Math.abs(e)<1e-6?1e-6:e;return i/n}},D0=(function(t){return t.NONE="none",t.ALONG="along",t})(D0||{}),th=class{compute(i,e){let n=this._clamp01(e.position()),{point:o,tangent:r}=i.getPointAtLength(n),a={x:-r.y,y:r.x},s=e.offset()??0,c=o.x+a.x*s,l=o.y+a.y*s,m=this._sizeAlongDirection(e.hostElement,r)*.5,x=n*i.totalLength,P=i.totalLength-x,E=this._applyEdgeGuard(c,l,r,x,P,m),N=this._calculateContentRotation(e.align(),r);return{position:E,rotationDeg:N}}_clamp01(i){return i<=0?0:i>=1?1:i}_applyEdgeGuard(i,e,n,o,r,a){if(o<=a){let s=a-o;return{x:i+n.x*s,y:e+n.y*s}}if(r<=a){let s=a-r;return{x:i-n.x*s,y:e-n.y*s}}return{x:i,y:e}}_sizeAlongDirection(i,e){let n=V.fromElement(i);return Math.abs(e.x)*n.width+Math.abs(e.y)*n.height}_normalize180(i){let e=(i+180)%360;return e<0&&(e+=360),e-180}_keepUpright(i){let e=this._normalize180(i);return e>90?e-=180:e<-90&&(e+=180),e}_calculateContentRotation(i,e){let n=0;return i===D0.ALONG&&(n=Math.atan2(e.y,e.x)*180/Math.PI,n=this._keepUpright(n)),n}},nh=class{_placement;constructor(i=new th){this._placement=i}layout(i,e){let n=new eh(i),o=n.totalLength;for(let r of e){let{position:a,rotationDeg:s}=this._placement.compute(n,r);r.hostElement.style.transform=this._createTransformString(a,s)}return o}_createTransformString(i,e){return`translate3d(${i.x}px, ${i.y}px, 0) translate(-50%, -50%) rotate(${e}deg)`}};var r0=new ue("F_CONNECTION_WAYPOINTS");function O0(t,i,e){return(t.x-i.x)**2+(t.y-i.y)**2<=e**2}function fD(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.candidates().find(o=>O0(i,o,n))}function pD(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.waypoints().find(o=>O0(i,o,n))}function hD(t,i){for(let e of t){let n=pD(e,i);if(n&&e.fWaypoints()?.visibility())return{connection:e,waypoint:n};let o=fD(e,i);if(o&&e.fWaypoints()?.visibility())return{connection:e,candidate:o}}}var wf=new ue("F_CONNECTION_COMPONENTS_PARENT");var _e=(function(t){return t.START="f-connection-marker-start",t.END="f-connection-marker-end",t.SELECTED_START="f-connection-selected-marker-start",t.SELECTED_END="f-connection-selected-marker-end",t.START_ALL_STATES="f-connection-marker-start-all-states",t.END_ALL_STATES="f-connection-marker-end-all-states",t})(_e||{}),rl=new ue("F_CONNECTION_MARKER"),mD=0,al=class{fId=z(`f-marker-${mD++}`);hostElement=u(Ne).nativeElement};function N0(t,i=_e.START){if(typeof t!="string")return i;let e=t.trim().toLowerCase();return e?_D(e)??i:i}function _D(t){switch(t){case"start":case"f-connection-marker-start":return _e.START;case"end":case"f-connection-marker-end":return _e.END;case"selected-start":case"f-connection-selected-marker-start":return _e.SELECTED_START;case"selected-end":case"f-connection-selected-marker-end":return _e.SELECTED_END;case"start-all-states":case"f-connection-marker-start-all-states":case"start-all":case"all-start":return _e.START_ALL_STATES;case"end-all-states":case"f-connection-marker-end-all-states":case"end-all":case"all-end":return _e.END_ALL_STATES;default:return null}}var R0=(()=>{class t extends al{_markerElement=Ae.required("markerElement");_type=O(_e.END_ALL_STATES,{alias:"type",transform:e=>N0(e,_e.END_ALL_STATES)});get markerElement(){return this._markerElement().nativeElement}width=6;height=7;refX=5.5;refY=3.5;get type(){return this._type()}orient="auto";markerUnits="strokeWidth";static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-connection-marker-arrow"]],viewQuery:function(n,o){n&1&&Tt(o._markerElement,_k,5),n&2&&ct()},hostAttrs:[1,"f-component",2,"display","none"],inputs:{_type:[1,"type","_type"]},features:[ge([{provide:rl,useExisting:t}]),he],decls:3,vars:0,consts:[["markerElement",""],["viewBox","0 0 6 6",1,"f-marker"],["d","M0,0 L6,3 0,6Z"]],template:function(n,o){n&1&&(Je(),W(0,"svg",1,0),bi(2,"path",2),$())},encapsulation:2})}return t})();var A0=(()=>{class t extends al{_mediator=u(D);markerElement=this.hostElement;width=0;height=0;refX=0;refY=0;type=_e.START;orient="auto";markerUnits="strokeWidth";ngOnInit(){this.hostElement.style.display="none",this._mediator.execute(new nl(this))}ngOnDestroy(){this._mediator.execute(new Ml(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,selectors:[["svg","fMarker",""]],hostAttrs:[1,"f-component","f-marker"],inputs:{width:"width",height:"height",refX:"refX",refY:"refY",type:[2,"type","type",e=>N0(e,_e.START)],orient:"orient",markerUnits:"markerUnits"},standalone:!1,features:[ge([{provide:rl,useExisting:t}]),he]})}return t})(),xn=(function(t){return t.FIXED="fixed",t.FIXED_CENTER="fixed_center",t.FLOATING="floating",t})(xn||{}),Se=(function(t){return t.DEFAULT="default",t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.CALCULATE="calculate",t.CALCULATE_HORIZONTAL="calculate_horizontal",t.CALCULATE_VERTICAL="calculate_vertical",t})(Se||{});function gD({sourceRect:t,targetRect:i}){return{point1:t.gravityCenter,point2:i.gravityCenter}}var F=(function(t){return t.LEFT="left",t.TOP="top",t.RIGHT="right",t.BOTTOM="bottom",t.CALCULATE="calculate",t.CALCULATE_HORIZONTAL="calculate_horizontal",t.CALCULATE_VERTICAL="calculate_vertical",t.AUTO="auto",t})(F||{}),ki=(function(t){return t.SEGMENT="segment",t.STRAIGHT="straight",t.BEZIER="bezier",t.ADAPTIVE_CURVE="adaptive-curve",t})(ki||{});function vD({sourceRect:t,sourceConnectableSide:i,targetRect:e,targetConnectableSide:n}){return{point1:a0(t,i===F.AUTO?F.BOTTOM:i),point2:a0(e,n===F.AUTO?F.TOP:n)}}function a0(t,i){switch(i){case F.TOP:return{x:t.x+t.width/2,y:t.y};case F.BOTTOM:return{x:t.x+t.width/2,y:t.y+t.height};case F.LEFT:return{x:t.x,y:t.y+t.height/2};case F.RIGHT:return{x:t.x+t.width,y:t.y+t.height/2};default:throw new Error(`Unknown side: ${i}`)}}function F0(t,i,e,n){if(!n||!n.rotationDeg)return Pi.getRoundedRectIntersections(t,i,e)[0];let o=ja(t,-n.rotationDeg,n.pivot),r=ja(i,-n.rotationDeg,n.pivot),a=yD(e,-n.rotationDeg,n.pivot),s=Pi.getRoundedRectIntersections(o,r,a)[0];return s?ja(s,n.rotationDeg,n.pivot):void 0}function yD(t,i,e){let n=ja(CD(t),i,e);return new Le(n.x-t.width/2,n.y-t.height/2,t.width,t.height,t.radius1,t.radius2,t.radius3,t.radius4)}function CD(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function ja(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,a=Math.cos(r),s=Math.sin(r);return{x:n*a-o*s+e.x,y:n*s+o*a+e.y}}function xD({sourceRect:t,targetRect:i,sourceRotationContext:e,targetRotationContext:n}){return SD(bD(t,i,e),wD(t,i,n),t,i)}function bD(t,i,e){return F0(t.gravityCenter,i.gravityCenter,t,e)}function wD(t,i,e){return F0(i.gravityCenter,t.gravityCenter,i,e)}function SD(t,i,e,n){return{point1:t||e.gravityCenter,point2:i||n.gravityCenter}}var ya=.5,TD={[xn.FLOATING]:xD,[xn.FIXED_CENTER]:gD,[xn.FIXED]:vD},Ki=(()=>{class t{handle(e){let n=this._calculateDirectionalVectors(e.sourceRect.gravityCenter.x,e.sourceRect.gravityCenter.y,e.targetRect.gravityCenter.x,e.targetRect.gravityCenter.y),o=this._determineSourceSide(e,n),r=this._determineTargetSide(e,n);return e.connection._applyResolvedSidesToConnection(o,r),this._getBehaviorHandler(e.connection.fBehavior)({sourceRect:e.sourceRect,targetRect:e.targetRect,sourceConnectableSide:o,targetConnectableSide:r,sourceRotationContext:e.sourceRotationContext,targetRotationContext:e.targetRotationContext})}_calculateDirectionalVectors(e,n,o,r){let a=o-e,s=r-n;return{sourceToTargetX:a,sourceToTargetY:s,targetToSourceX:-a,targetToSourceY:-s}}_determineSourceSide(e,n){return this._resolveConnectableSide(e.connection.fOutputSide(),n.sourceToTargetX,n.sourceToTargetY,e.sourceConnectableSide)}_determineTargetSide(e,n){return this._resolveConnectableSide(e.connection.fInputSide(),n.targetToSourceX,n.targetToSourceY,e.targetConnectableSide)}_resolveConnectableSide(e,n,o,r){if(e===Se.DEFAULT)return r;let a=Math.abs(n),s=Math.abs(o);if(a<ya&&s<ya)return r;let l=a>=s;switch(e){case Se.CALCULATE:return l?n>=0?F.RIGHT:F.LEFT:o>=0?F.BOTTOM:F.TOP;case Se.CALCULATE_HORIZONTAL:return a<ya?r:n>=0?F.RIGHT:F.LEFT;case Se.CALCULATE_VERTICAL:return s<ya?r:o>=0?F.BOTTOM:F.TOP;case Se.TOP:return F.TOP;case Se.BOTTOM:return F.BOTTOM;case Se.LEFT:return F.LEFT;case Se.RIGHT:return F.RIGHT;default:return r}}_getBehaviorHandler(e){let n=TD[e];if(!n)throw new Error(`[Behavior] No handler for behavior: ${e}`);return n}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Pt=class{sourceRect;targetRect;connection;sourceConnectableSide;targetConnectableSide;sourceRotationContext;targetRotationContext;constructor(i,e,n,o,r,a,s){this.sourceRect=i,this.targetRect=e,this.connection=n,this.sourceConnectableSide=o,this.targetConnectableSide=r,this.sourceRotationContext=a,this.targetRotationContext=s}};function Sf(t,i,e){return[t,...e??[],i]}function ID(t,i){let e=Math.abs(i.x-t.x)/2,n=i.x<t.x?i.x+e:i.x-e,o=Math.abs(i.y-t.y)/2,r=i.y<t.y?i.y+o:i.y-o;return{x:n,y:r}}function ED(t,i=32){let e=new Array(i+1);e[0]=ce({},t[0]);for(let n=1;n<=i;n++)e[n]=L0(t[0],t[1],t[2],t[3],n/i);return e}function L0(t,i,e,n,o){let r=1-o,a=o*o,s=r*r,c=s*r,l=a*o;return{x:c*t.x+3*s*o*i.x+3*r*a*e.x+l*n.x,y:c*t.y+3*s*o*i.y+3*r*a*e.y+l*n.y}}function z0(t){return t.map(i=>L0(i.p0,i.c1,i.c2,i.p3,.5))}function PD(t){if(t.length<2)throw new Error("Polylines must be at least two points");let i=MD(t);return i<=0?[ce({},t[0])]:[kD(t,i/2)]}function MD(t){let i=0;for(let e=0;e<t.length-1;e++)i+=B0(t[e],t[e+1]);return i}function kD(t,i){let e=0;for(let o=0;o<t.length-1;o++){let r=t[o],a=t[o+1],s=B0(r,a);if(!(s<=0)){if(e+s>=i){let c=(i-e)/s;return{x:r.x+(a.x-r.x)*c,y:r.y+(a.y-r.y)*c}}e+=s}}let n=t[t.length-1];return{x:n.x,y:n.y}}function B0(t,i){return Math.hypot(i.x-t.x,i.y-t.y)}function DD(t){let i=[];for(let e of t)for(let n of e){let o=i[i.length-1];(!o||o.x!==n.x||o.y!==n.y)&&i.push(n)}return i}function q0(t){if(!t.length)return"";let i=`M ${t[0].p0.x} ${t[0].p0.y}`;for(let e=0;e<t.length;e++){let n=t[e],o=e===t.length-1,r=o?n.p3.x+2e-4:n.p3.x,a=o?n.p3.y+2e-4:n.p3.y;i+=` C ${n.c1.x} ${n.c1.y}, ${n.c2.x} ${n.c2.y}, ${r} ${a}`}return i}function G0(t,i=16){if(!t.length)return[];let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=ED([o.p0,o.c1,o.c2,o.p3],i);n>0&&r.shift(),e.push(...r)}return e}function OD(t,i=1e-6){let e=t.length;if(e<=2)return t;let n=[];n.push(t[0]);for(let r=1;r<e;r++){let a=t[r],s=n[n.length-1];(Math.abs(a.x-s.x)>i||Math.abs(a.y-s.y)>i)&&n.push(a)}if(n.length<=2)return n;let o=[];o.push(n[0]);for(let r=1;r<n.length-1;r++){let a=o[o.length-1],s=n[r],c=n[r+1],l=Math.abs(a.x-s.x)<=i&&Math.abs(s.x-c.x)<=i,f=Math.abs(a.y-s.y)<=i&&Math.abs(s.y-c.y)<=i;!l&&!f&&o.push(s)}return o.push(n[n.length-1]),o}var ih=class t{static _dir(i){switch(i){case F.LEFT:return{x:-1,y:0};case F.RIGHT:return{x:1,y:0};case F.TOP:return{x:0,y:-1};case F.BOTTOM:return{x:0,y:1};case F.AUTO:return{x:0,y:0}}return{x:0,y:0}}static _isHorizontal(i){return i===F.LEFT||i===F.RIGHT}static _handleLength(i,e,n,o){let r=Math.abs(e.x-i.x),a=Math.abs(e.y-i.y),s=Math.hypot(r,a),c=n===F.AUTO?Math.max(r,a):this._isHorizontal(n)?r:a,l=Math.max(8,o),f=o+.5*s,m=o*1.05+c*.3;return Math.min(f,Math.max(l,m))}static _softControl(i,e,n,o){let r=this._dir(i),a=n.x-e.x,s=n.y-e.y,c=Math.hypot(a,s)||1,l=a/c,f=s/c;if(i===F.AUTO)return{x:e.x+l*o,y:e.y+f*o};let m=r.x*l+r.y*f,x=.12,P=Math.max(0,-m)*.08,E=Math.min(.2,x+P),N=r.x*(1-E)+l*E,j=r.y*(1-E)+f*E,L=Math.hypot(N,j)||1;return{x:e.x+N/L*o,y:e.y+j/L*o}}handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:a}){let s=Math.max(0,r??0),c=Sf(i,n,a),l=[];for(let m=0;m<c.length-1;m++){let x=c[m],P=c[m+1],E=t._handleLength(x,P,e,s),N=t._handleLength(P,x,o,s),j=t._softControl(e,x,P,E),L=t._softControl(o,P,x,N);l.push({p0:x,c1:j,c2:L,p3:P,chainIndex:m})}let f=G0(l,12);return{path:q0(l),secondPoint:l[0]?.c1??i,penultimatePoint:l[l.length-1]?.c2??n,points:f,candidates:z0(l)}}},oh=class{handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:a}){let s=Sf(i,n,a),c=[];for(let f=0;f<s.length-1;f++){let m=s[f],x=s[f+1],P=s0(e,m,x,r??0),E=s0(o,x,m,r??0);c.push({p0:m,c1:P,c2:E,p3:x,chainIndex:f})}let l=G0(c,12);return{path:q0(c),secondPoint:c[0]?.c1??i,penultimatePoint:c[c.length-1]?.c2??n,points:l,candidates:z0(c)}}};function s0(t,i,e,n){let o={x:i.x,y:i.y};switch(t){case F.LEFT:o.x-=Ca(i.x-e.x,n);break;case F.RIGHT:o.x+=Ca(e.x-i.x,n);break;case F.TOP:o.y-=Ca(i.y-e.y,n);break;case F.BOTTOM:o.y+=Ca(e.y-i.y,n);break;case F.AUTO:break}return o}function Ca(t,i){return t>=i?t:i*Math.sqrt(i-t)}function ND(t){let{axis:i,source:e,target:n,sourceSide:o,targetSide:r,sourceGap:a,targetGap:s,sourceDir:c,targetDir:l,currentDir:f,offset:m,sourceGapOffset:x,targetGapOffset:P}=t,E=RD(a,s),N=AD(i,c,f,E);return o===r?FD(i,e,n,m,c,f,a,s,x,P):N=LD(i,c,l,a,s,E,N),N}function RD(t,i){return{sourceTarget:[{x:t.x,y:i.y}],targetSource:[{x:i.x,y:t.y}]}}function AD(t,i,e,n){return t==="x"?i.x===e?n.targetSource:n.sourceTarget:i.y===e?n.sourceTarget:n.targetSource}function FD(t,i,e,n,o,r,a,s,c,l){let f=Math.abs(i[t]-e[t]);if(f>n)return;let m=Math.min(n-1,n-f);m<=0||(o[t]===r?c[t]=(a[t]>i[t]?-1:1)*m:l[t]=(s[t]>e[t]?-1:1)*m)}function LD(t,i,e,n,o,r,a){let s=t==="x"?"y":"x",c=i[t]===e[s],l=n[s]>o[s],f=n[s]<o[s];return i[t]===1&&(!c&&l||c&&f)||i[t]!==1&&(!c&&f||c&&l)?t==="x"?r.sourceTarget:r.targetSource:a}var wo=1e-6,c0=2e-4,zD=.75;function BD(t,i){let e=t.length,n=[];n.push(`M ${t[0].x} ${t[0].y}`);for(let r=1;r<e-1;r++)n.push(qD(t[r-1],t[r],t[r+1],i));let o=t[e-1];return n.push(`L ${o.x+c0} ${o.y+c0}`),n.join(" ")}function qD(t,i,e,n){let o=i.x,r=i.y;if(n<=0)return`L ${o} ${r}`;let a=Math.abs(t.x-o)<=wo&&Math.abs(o-e.x)<=wo,s=Math.abs(t.y-r)<=wo&&Math.abs(r-e.y)<=wo;if(a||s)return`L ${o} ${r}`;let c=Math.hypot(o-t.x,r-t.y),l=Math.hypot(e.x-o,e.y-r),f=Math.min(c*.5,l*.5,n);if(f<zD)return`L ${o} ${r}`;if(Math.abs(t.y-r)<=wo){let j=t.x<e.x?-1:1,L=t.y<e.y?1:-1,U=o+f*j,ie=r+f*L;return`L ${U} ${r} Q ${o} ${r} ${o} ${ie}`}let x=t.x<e.x?1:-1,P=t.y<e.y?-1:1,E=r+f*P,N=o+f*x;return`L ${o} ${E} Q ${o} ${r} ${N} ${r}`}var d0={[F.LEFT]:A.initialize(-1,0),[F.RIGHT]:A.initialize(1,0),[F.TOP]:A.initialize(0,-1),[F.BOTTOM]:A.initialize(0,1),[F.AUTO]:A.initialize(0,0)},rh=class{handle({source:i,sourceSide:e,target:n,targetSide:o,waypoints:r,offset:a,radius:s}){let c=Sf(i,n,r),l=[],f=[];for(let E=0;E<c.length-1;E++){let N=c[E],j=c[E+1],L=this._getPathPoints(N,e,j,o,a??0);l.push(L),f.push(...PD(L))}let m=OD(DD(l)),x=m.length>1?m[m.length-2]:i,P=m.length>1?m[1]:n;return{path:BD(m,s??0),penultimatePoint:x,secondPoint:P,points:m,candidates:f}}_getPathPoints(i,e,n,o,r){let a=d0[e],s=d0[o],c={x:i.x+a.x*r,y:i.y+a.y*r},l={x:n.x+s.x*r,y:n.y+s.y*r},f=this._getDirection(c,e,l),m=f.x!==0?"x":"y",x=f[m],P=[],E=A.initialize(),N=A.initialize(),j=ID(i,n);if(a[m]*s[m]===-1){let L=[{x:j.x,y:c.y},{x:j.x,y:l.y}],U=[{x:c.x,y:j.y},{x:l.x,y:j.y}];a[m]===x?P=m==="x"?L:U:P=m==="x"?U:L}else P=ND({axis:m,source:i,target:n,sourceSide:e,targetSide:o,sourceGap:c,targetGap:l,sourceDir:a,targetDir:s,currentDir:x,offset:r,sourceGapOffset:E,targetGapOffset:N});return[i,{x:c.x+E.x,y:c.y+E.y},...P,{x:l.x+N.x,y:l.y+N.y},n]}_getDirection(i,e,n){return e===F.LEFT||e===F.RIGHT?i.x<n.x?A.initialize(1,0):A.initialize(-1,0):i.y<n.y?A.initialize(0,1):A.initialize(0,-1)}},l0=2e-4,ah=class{handle(i){let e=Sf(i.source,i.target,i.waypoints),n=e.length,o=e[0],r=`M ${o.x} ${o.y}`,a=new Array(n-1);for(let s=0;s<n-1;s++){let c=e[s],l=e[s+1],f=s===n-2,m=f?l.x+l0:l.x,x=f?l.y+l0:l.y;r+=` L ${m} ${x}`,a[s]={x:(c.x+l.x)*.5,y:(c.y+l.y)*.5}}return{path:r,candidates:a,points:e,secondPoint:e[1]??i.target,penultimatePoint:e[n-2]??i.source}}},GD=new ue("F_CONNECTION_BUILDERS"),H0=(()=>{class t{_builtinBuilders={[ki.STRAIGHT]:new ah,[ki.BEZIER]:new oh,[ki.ADAPTIVE_CURVE]:new ih,[ki.SEGMENT]:new rh};_providedBuilders;_builders;constructor(){this._providedBuilders=u(GD,{optional:!0})||{},this._builders=ce(ce({},this._builtinBuilders),this._providedBuilders)}handle({type:e,payload:n}){let o=this._builders[e];if(!o)throw this._createBuilderNotFoundError(e);return o.handle(n)}_createBuilderNotFoundError(e){let n=Object.keys(this._builtinBuilders).sort(),o=Object.keys(this._providedBuilders).sort(),r=Object.keys(this._builders).sort(),a=n.filter(c=>c in this._providedBuilders).sort(),s=[`Connection Builder Error: builder type "${e}" not found.`,`Registered types: ${r.length?r.join(", "):"(none)"}`,`Built-in types: ${n.length?n.join(", "):"(none)"}`,`Provided (F_CONNECTION_BUILDERS) types: ${o.length?o.join(", "):"(none)"}`,a.length?`Overridden built-ins: ${a.join(", ")}`:null,"Tip: ensure you pass a valid Connection Type or provide a builder via F_CONNECTION_BUILDERS."].filter(Boolean);return new Error(s.join(`
2
- `))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function HD(t,i,e){return Xt("connection_"+t+i+e)}function VD(t,i,e){return Xt("connection_for_selection_"+t+i+e)}function V0(t){return Xt("connection_gradient_"+t)}function jD(t){return`url(#${V0(t)})`}var UD=(()=>{class t{_connection=u(wf);_hostElement=u(Ne).nativeElement;_injector=u(Ye);_hostAttributes=new Map;_startColor;_endColor;gradientId=S(()=>V0(this._connection.fId()));ngOnInit(){this._listenColorChanges()}_listenColorChanges(){J(()=>{this.gradient().fStartColor(),this.gradient().fEndColor(),At(()=>{this._updateGradient()})},{injector:this._injector})}get stop1Element(){return this._hostElement.children.item(0)}get stop2Element(){return this._hostElement.children.item(1)}redraw(e){let n=e.point2.x-e.point1.x,o=e.point2.y-e.point1.y,r=Math.sqrt(n*n+o*o)||.01,a=new Z(.5-.5*n/r,.5-.5*o/r);this._setHostAttribute("x1",a.x.toString()),this._setHostAttribute("y1",a.y.toString());let s=new Z(.5+.5*n/r,.5+.5*o/r);this._setHostAttribute("x2",s.x.toString()),this._setHostAttribute("y2",s.y.toString()),this._updateGradient()}_updateGradient(){let e=this.gradient();this._setFromColor(e.fStartColor()),this._setToColor(e.fEndColor())}_setFromColor(e){let n=e||"transparent";this._startColor!==n&&(this._startColor=n,this.stop1Element.setAttribute("stop-color",n),this.stop1Element.style.setProperty("stop-color",n))}_setToColor(e){let n=e||"transparent";this._endColor!==n&&(this._endColor=n,this.stop2Element.setAttribute("stop-color",n),this.stop2Element.style.setProperty("stop-color",n))}_setHostAttribute(e,n){this._hostAttributes.get(e)!==n&&(this._hostAttributes.set(e,n),this._hostElement.setAttribute(e,n))}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})(),sh=(()=>{class t extends UD{gradient=O.required({alias:"fConnectionGradientRendererFor"});static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["linearGradient","fConnectionGradientRenderer",""]],hostVars:1,hostBindings:function(n,o){n&2&&G("id",o.gradientId())},inputs:{gradient:[1,"fConnectionGradientRendererFor","gradient"]},features:[he],attrs:gk,decls:3,vars:0,consts:[[0,"xmlns","svg","http://www.w3.org/2000/svg"],["offset","0%"],["offset","100%"]],template:function(n,o){n&1&&(Kr(0,0),Je(),bi(1,"stop",1)(2,"stop",2),Yr())},encapsulation:2,changeDetection:0})}return t})(),u0=new ue("F_CONNECTION_GRADIENT");var ch=new ue("F_CONNECTION_PATH"),dh=class{hostElement=u(Ne).nativeElement},WD=(()=>{class t extends dh{_connection=u(wf);useGradient=O(!1);linkToGradient=S(()=>this.useGradient()?jD(this._connection.fId()):null);get fPathId(){return this._connection.fId()}get attrConnectionId(){return HD(this._connection.fId(),this._connection.fOutputId(),this._connection.fInputId())}initialize(){this.deselect()}setPath(e){this.hostElement.setAttribute("d",`${e}`)}select(){this.hostElement.setAttribute("marker-start",`url(#${YD(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${XD(this._connection.fId())})`)}deselect(){this.hostElement.setAttribute("marker-start",`url(#${$D(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${KD(this._connection.fId())})`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["path","f-connection-path",""]],hostAttrs:[1,"f-component","f-connection-path"],hostVars:4,hostBindings:function(n,o){n&2&&(G("id",o.attrConnectionId)("data-f-path-id",o.fPathId),dt("stroke",o.linkToGradient()))},inputs:{useGradient:[1,"useGradient"]},standalone:!1,features:[ge([{provide:ch,useExisting:t}]),he],attrs:vk,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})();function $D(t){return Xt(`f-connection-marker-start-${t}`)}function KD(t){return Xt(`f-connection-marker-end-${t}`)}function YD(t){return Xt(`f-connection-selected-marker-start-${t}`)}function XD(t){return Xt(`f-connection-selected-marker-end-${t}`)}var lh=new ue("F_CONNECTION_SELECTION"),uh=class{hostElement=u(Ne).nativeElement},ZD=(()=>{class t extends uh{_connection=u(wf);get connectionForSelectionId(){return VD(this._connection.fId(),this._connection.fOutputId(),this._connection.fInputId())}setPath(e){this.hostElement.setAttribute("d",`${e}`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["path","fConnectionSelection",""]],hostAttrs:[1,"f-component","f-connection-selection"],hostVars:1,hostBindings:function(n,o){n&2&&G("id",o.connectionForSelectionId)},standalone:!1,features:[ge([{provide:lh,useExisting:t}]),he],attrs:yk,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})(),fh=new ue("F_CONNECTION_DRAG_HANDLE_END"),ph=new ue("F_CONNECTION_DRAG_HANDLE_START"),sl=class{hostElement=u(Ne).nativeElement;point=A.initialize();class="f-connection-drag-handle";calculateCircleCenter(i,e,n){let o={x:e.x-i.x,y:e.y-i.y},r=Math.sqrt(o.x*o.x+o.y*o.y)||1,a={x:o.x/r,y:o.y/r},s={x:a.x*n,y:a.y*n};return{x:e.x-s.x,y:e.y-s.y}}},QD=(()=>{class t extends sl{redraw(e,n){this.point=this.calculateCircleCenter(e,n,8),this.hostElement.setAttribute("cx",this.point.x.toString()),this.hostElement.setAttribute("cy",this.point.y.toString())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["circle","f-connection-drag-handle-start",""]],hostVars:2,hostBindings:function(n,o){n&2&&Re(o.class)},standalone:!1,features:[ge([{provide:ph,useExisting:t}]),he],attrs:Ck,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),JD=(()=>{class t extends sl{redraw(e,n){this.point=this.calculateCircleCenter(e,n,8),this.hostElement.setAttribute("cx",this.point.x.toString()),this.hostElement.setAttribute("cy",this.point.y.toString())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["circle","f-connection-drag-handle-end",""]],hostVars:2,hostBindings:function(n,o){n&2&&Re(o.class)},standalone:!1,features:[ge([{provide:fh,useExisting:t}]),he],attrs:xk,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),Gp="f-selected";function j0(t){return class extends t{fId=z("");fSelectionDisabled=z(!1);unmarkAsSelected(){this.unmarkChildrenAsSelected?.(),this.hostElement.classList.remove(Gp)}markAsSelected(){this.markChildrenAsSelected?.(),this.isSelected()||this.hostElement.classList.add(Gp)}isSelected(){return this.hostElement.classList.contains(Gp)}markChildrenAsSelected(){}unmarkChildrenAsSelected(){}constructor(...i){super(...i)}}}function eO(t){return class extends t{show(){this.hostElement.style.display="unset"}hide(){this.hostElement.style.display="none"}constructor(...i){super(...i)}}}var tO=j0(eO(class{hostElement;constructor(t){this.hostElement=t}})),nO=(()=>{class t extends tO{_fConnectionBuilder=u(H0);path="";line=xo.initialize();fReassignableStart=z(!1);fDraggingDisabled=z(!1);fSelectionDisabled=z(!1);fDefs=Ae.required("defs");fPath=Ae.required(ch);fDragHandleStart=Ae(ph);fDragHandleEnd=Ae.required(fh);fSelection=Ae.required(lh);fContents=Pp(o0,{descendants:!0});fMarkers=Pp(rl,{descendants:!0});fGradient=Qr(u0);_fGradientRenderer=Ae(sh);fWaypoints=Qr(r0);fInputSide=z(Se.DEFAULT);_contentLayoutEngine=new nh;_sourceSide=F.AUTO;fOutputSide=z(Se.DEFAULT);_targetSide=F.AUTO;_penultimatePoint=A.initialize();_secondPoint=A.initialize();constructor(){super(u(Ne).nativeElement)}initialize(){this.redraw(),this.isSelected()?this.markChildrenAsSelected():this.unmarkChildrenAsSelected()}isContains(e){return(this.hostElement.firstChild?.lastChild).contains(e)||Array.from(this.fContents()?.values()??[]).some(n=>n.hostElement?.contains(e))||this.fWaypoints()?.hostElement?.contains(e)}setLine({point1:e,point2:n}){this.line=xo.initialize(e,n);let{path:o,points:r,penultimatePoint:a,secondPoint:s,candidates:c}=this._getPathResult(e,n);this.path=o,this._penultimatePoint=a||e,this._secondPoint=s||n,this.fWaypoints()?.candidates.set(c||[]),this._contentLayoutEngine.layout(r||[],this._contents())}_contents(){return Array.from(this.fContents()?.values()??[])}_getPathResult(e,n){return this._fConnectionBuilder.handle({type:this.fType,payload:{source:e,sourceSide:this._sourceSide,target:n,targetSide:this._targetSide,radius:this.fRadius,offset:this.fOffset,waypoints:this.fWaypoints()?.waypoints()||[]}})}markChildrenAsSelected(){this.fPath().select()}unmarkChildrenAsSelected(){this.fPath().deselect()}redraw(){this.fPath().setPath(this.path),this.fSelection().setPath(this.path),this.fDragHandleEnd().redraw(this._penultimatePoint,this.line.point2),this.fDragHandleStart()?.redraw(this._secondPoint,this.line.point1),this._fGradientRenderer()?.redraw(this.line)}getResolvedSides(){return{sourceSide:this._sourceSide,targetSide:this._targetSide}}_applyResolvedSidesToConnection(e,n){this._sourceSide=e,this._targetSide=n}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,contentQueries:function(n,o,r){n&1&&Ip(r,o.fContents,o0,5)(r,o.fMarkers,rl,5)(r,o.fGradient,u0,5)(r,o.fWaypoints,r0,5),n&2&&ct(4)},viewQuery:function(n,o){n&1&&Tt(o.fDefs,bk,5)(o.fPath,ch,5)(o.fDragHandleStart,ph,5)(o.fDragHandleEnd,fh,5)(o.fSelection,lh,5)(o._fGradientRenderer,sh,5),n&2&&ct(6)},standalone:!1,features:[he]})}return t})(),iO=(()=>{let t=class Ua{_browser=u(ze);_markerCache=new WeakMap;handle({connection:e}){let n=this._findConnectionMarkers(e),o=e.fDefs();if(!o)return!1;let r=oO(n),a=this._markerCache.get(e);if(a?.signature===r&&a.defsElement===o.nativeElement)return!1;let s=W0("defs",this._browser);return n.forEach(c=>{U0(c.type).forEach(l=>{let f=rO(l,c,e.fId(),this._browser),m=c.markerElement.cloneNode(!0);m.setAttribute("height",`${c.height}`),m.setAttribute("width",`${c.width}`),m.removeAttribute("markerUnits"),m.style.display="unset",f.append(m),s.append(f)})}),o.nativeElement.innerHTML=s.innerHTML,this._markerCache.set(e,{signature:r,defsElement:o.nativeElement}),this._makeSafariCompatible(e),!0}_findConnectionMarkers(e){return Array.from(e.fMarkers()??[])}_makeSafariCompatible(e){e.fPath().hostElement.replaceWith(e.fPath().hostElement)}static \u0275fac=function(n){return new(n||Ua)};static \u0275prov=y({token:Ua,factory:Ua.\u0275fac})};return t=b([w(Fi)],t),t})();function oO(t){return t.map(i=>[...U0(i.type),i.width,i.height,i.refX,i.refY,i.orient,i.markerUnits,i.markerElement.outerHTML].join("|")).join("||")}function rO(t,i,e,n){let o=W0("marker",n);return o.setAttribute("id",Xt(t+"-"+e)),o.setAttribute("markerHeight",`${i.height}`),o.setAttribute("markerWidth",`${i.width}`),o.setAttribute("orient",`${i.orient}`),o.setAttribute("refX",`${i.refX}`),o.setAttribute("refY",`${i.refY}`),o.setAttribute("markerUnits",`${i.markerUnits}`),o}function U0(t){switch(t){case _e.START:return[_e.START];case _e.END:return[_e.END];case _e.SELECTED_START:return[_e.SELECTED_START];case _e.SELECTED_END:return[_e.SELECTED_END];case _e.START_ALL_STATES:return[_e.START,_e.SELECTED_START];case _e.END_ALL_STATES:return[_e.END,_e.SELECTED_END];default:return[]}}function W0(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}var Tf=(()=>{class t{renderTicket=0;_connectedInPreviousRender=new Set;beginRender(){return++this.renderTicket}resetConnectedConnectors(){for(let e of this._connectedInPreviousRender)e.resetConnected();this._connectedInPreviousRender.clear()}trackConnectedConnectors(e,n){this._connectedInPreviousRender.add(e),this._connectedInPreviousRender.add(n)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),aO=String.raw`
3
- const EPSILON = 0.5;
4
-
5
- addEventListener('message', (event) => {
6
- const data = event?.data;
7
- const requestId = data?.requestId;
8
- const items = Array.isArray(data?.items) ? data.items : [];
9
-
10
- try {
11
- const results = items.map((item) => calculateItem(item));
12
- postMessage({ requestId, results });
13
- } catch (error) {
14
- const message = error instanceof Error ? error.message : 'Connection worker failed.';
15
- postMessage({ requestId, error: message });
16
- }
17
- });
18
-
19
- function calculateItem(item) {
20
- const sourceCenterX = item.sourceRect.x + item.sourceRect.width / 2;
21
- const sourceCenterY = item.sourceRect.y + item.sourceRect.height / 2;
22
- const targetCenterX = item.targetRect.x + item.targetRect.width / 2;
23
- const targetCenterY = item.targetRect.y + item.targetRect.height / 2;
24
-
25
- const sourceSide = resolveConnectableSide(
26
- item.outputSide,
27
- targetCenterX - sourceCenterX,
28
- targetCenterY - sourceCenterY,
29
- item.sourceConnectableSide,
30
- );
31
-
32
- const targetSide = resolveConnectableSide(
33
- item.inputSide,
34
- sourceCenterX - targetCenterX,
35
- sourceCenterY - targetCenterY,
36
- item.targetConnectableSide,
37
- );
38
-
39
- if (item.behavior === 'fixed_center') {
40
- return {
41
- originalIndex: item.originalIndex,
42
- supported: true,
43
- sourceSide,
44
- targetSide,
45
- line: {
46
- point1: { x: sourceCenterX, y: sourceCenterY },
47
- point2: { x: targetCenterX, y: targetCenterY },
48
- },
49
- };
50
- }
51
-
52
- if (item.sourceRotation || item.targetRotation) {
53
- return { originalIndex: item.originalIndex, supported: false };
54
- }
55
-
56
- if (item.behavior !== 'fixed') {
57
- if (item.behavior !== 'floating') {
58
- return { originalIndex: item.originalIndex, supported: false };
59
- }
60
-
61
- if (hasRoundedCorners(item.sourceRect) || hasRoundedCorners(item.targetRect)) {
62
- return { originalIndex: item.originalIndex, supported: false };
63
- }
64
-
65
- return {
66
- originalIndex: item.originalIndex,
67
- supported: true,
68
- sourceSide,
69
- targetSide,
70
- line: buildFloatingLine(item.sourceRect, item.targetRect),
71
- };
72
- }
73
-
74
- const line = buildFixedLine(item.sourceRect, item.targetRect, sourceSide, targetSide);
75
- if (!line) {
76
- return { originalIndex: item.originalIndex, supported: false };
77
- }
78
-
79
- return {
80
- originalIndex: item.originalIndex,
81
- supported: true,
82
- sourceSide,
83
- targetSide,
84
- line,
85
- };
86
- }
87
-
88
- function resolveConnectableSide(requestedSide, deltaX, deltaY, fallbackSide) {
89
- if (requestedSide === 'default') {
90
- return fallbackSide;
91
- }
92
-
93
- const absX = Math.abs(deltaX);
94
- const absY = Math.abs(deltaY);
95
- const nearZero = absX < EPSILON && absY < EPSILON;
96
-
97
- if (nearZero) {
98
- return fallbackSide;
99
- }
100
-
101
- const horizontalDominant = absX >= absY;
102
-
103
- switch (requestedSide) {
104
- case 'calculate':
105
- return horizontalDominant ? (deltaX >= 0 ? 'right' : 'left') : deltaY >= 0 ? 'bottom' : 'top';
106
-
107
- case 'calculate_horizontal':
108
- if (absX < EPSILON) {
109
- return fallbackSide;
110
- }
111
-
112
- return deltaX >= 0 ? 'right' : 'left';
113
-
114
- case 'calculate_vertical':
115
- if (absY < EPSILON) {
116
- return fallbackSide;
117
- }
118
-
119
- return deltaY >= 0 ? 'bottom' : 'top';
120
-
121
- case 'top':
122
- case 'bottom':
123
- case 'left':
124
- case 'right':
125
- return requestedSide;
126
-
127
- default:
128
- return fallbackSide;
129
- }
130
- }
131
-
132
- function buildFixedLine(sourceRect, targetRect, sourceSide, targetSide) {
133
- const sourceAnchor = sourceSide === 'auto' ? 'bottom' : sourceSide;
134
- const targetAnchor = targetSide === 'auto' ? 'top' : targetSide;
135
-
136
- const point1 = getSidePoint(sourceRect, sourceAnchor);
137
- const point2 = getSidePoint(targetRect, targetAnchor);
138
-
139
- if (!point1 || !point2) {
140
- return null;
141
- }
142
-
143
- return { point1, point2 };
144
- }
145
-
146
- function buildFloatingLine(sourceRect, targetRect) {
147
- const sourceCenter = getRectCenter(sourceRect);
148
- const targetCenter = getRectCenter(targetRect);
149
-
150
- return {
151
- point1: getRectBorderIntersection(sourceRect, sourceCenter, targetCenter),
152
- point2: getRectBorderIntersection(targetRect, targetCenter, sourceCenter),
153
- };
154
- }
155
-
156
- function hasRoundedCorners(rect) {
157
- return !!(rect.radius1 || rect.radius2 || rect.radius3 || rect.radius4);
158
- }
159
-
160
- function getRectCenter(rect) {
161
- return {
162
- x: rect.x + rect.width / 2,
163
- y: rect.y + rect.height / 2,
164
- };
165
- }
166
-
167
- function getRectBorderIntersection(rect, from, to) {
168
- const halfWidth = rect.width / 2;
169
- const halfHeight = rect.height / 2;
170
- const center = getRectCenter(rect);
171
-
172
- const dx = to.x - from.x;
173
- const dy = to.y - from.y;
174
-
175
- if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) {
176
- return center;
177
- }
178
-
179
- const scaleX = Math.abs(dx) < EPSILON ? Number.POSITIVE_INFINITY : halfWidth / Math.abs(dx);
180
- const scaleY = Math.abs(dy) < EPSILON ? Number.POSITIVE_INFINITY : halfHeight / Math.abs(dy);
181
- const scale = Math.min(scaleX, scaleY);
182
-
183
- return {
184
- x: center.x + dx * scale,
185
- y: center.y + dy * scale,
186
- };
187
- }
188
-
189
- function getSidePoint(rect, side) {
190
- const centerX = rect.x + rect.width / 2;
191
- const centerY = rect.y + rect.height / 2;
192
-
193
- switch (side) {
194
- case 'top':
195
- return { x: centerX, y: rect.y };
196
-
197
- case 'right':
198
- return { x: rect.x + rect.width, y: centerY };
199
-
200
- case 'bottom':
201
- return { x: centerX, y: rect.y + rect.height };
202
-
203
- case 'left':
204
- return { x: rect.x, y: centerY };
205
-
206
- default:
207
- return null;
208
- }
209
- }
210
- `.trim();function $0(t){return!!K0(t)}function K0(t){let i=t,e=i?.Blob,n=i?.Worker,o=i?.URL;return!e||!n||typeof o?.createObjectURL!="function"||typeof o.revokeObjectURL!="function"?null:{blobCtor:e,workerCtor:n,urlApi:o}}function sO(t){let i=new t.blobCtor([aO],{type:"text/javascript"});return t.urlApi.createObjectURL(i)}function Y0(t,i){if(!t)return;let e=i??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var ai=(()=>{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,Y0(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})(),cl=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(i,e){this.connection=i,this.line=e}},cO=(()=>{let t=class Wa{_mediator=u(D);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new Fi(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let o=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),a=this._renderCache.get(e);return a?.signature===r&&a.pathElement===o?!1:(this._renderCache.set(e,{signature:r,pathElement:o}),!0)}_createConnectionRenderSignature(e,n){let{sourceSide:o,targetSide:r}=e.getResolvedSides();return[e.fBehavior,e.fType,e.fRadius,e.fOffset,e.fReassignableStart(),this._serializeContents([...e.fContents()||[]]),o,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||Wa)};static \u0275prov=y({token:Wa,factory:Wa.\u0275fac})};return t=b([w(cl)],t),t})(),dl=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(i,e){this.source=i,this.target=e}},dO=(()=>{let t=class $a{_state=u(Tf);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||$a)};static \u0275prov=y({token:$a,factory:$a.\u0275fac})};return t=b([w(dl)],t),t})(),In=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(i,e=!0){this.element=i,this.cache=e}},lO={enabled:!1},qt=new ue("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>ce({},lO)});var ll=class{id;nodeId;kind;element;static fToken=Symbol("RegisterFCacheConnectorRequest");constructor(i,e,n,o){this.id=i,this.nodeId=e,this.kind=n,this.element=o}},Gt=(()=>{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})(),hh=class{key;id;kind;nodeId;element;rect;constructor(i,e,n,o,r,a){this.key=i,this.id=e,this.kind=n,this.nodeId=o,this.element=r,this.rect=a}},Io=class{static build(i,e){return`${i}:${e}`}},mh=class{id;element;reference;rect;constructor(i,e,n,o){this.id=i,this.element=e,this.reference=n,this.rect=o}},Li=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(i,e="manual"){this.nodeId=i,this.reason=e}},uO=(()=>{let t=class Ka{_store=u(Gt);_options=u(qt);handle({nodeId:e,reason:n}){if(!this._options.enabled)return;let o=this._store.nodeEntries.get(e);if(!o)return;o.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||Ka)};static \u0275prov=y({token:Ka,factory:Ka.\u0275fac})};return t=b([w(Li)],t),t})(),ul=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(i,e,n){this.id=i,this.element=e,this.reference=n}},fO=(()=>{let t=class Ya{_store=u(Gt);_options=u(qt);handle({id:e,element:n,reference:o}){if(!this._options.enabled)return;let r=new mh(e,n,o);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||Ya)};static \u0275prov=y({token:Ya,factory:Ya.\u0275fac})};return t=b([w(ul)],t),t})(),fl=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(i){this.id=i}},pO=(()=>{let t=class Xa{_store=u(Gt);_mediator=u(D);_options=u(qt);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 o=Array.from(this._store.connectorKeysByNodeId.get(e)??[]);for(let r of o){let a=this._store.connectorEntries.get(r);a&&this._mediator.execute(new Eo(a.id,a.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||Xa)};static \u0275prov=y({token:Xa,factory:Xa.\u0275fac})};return t=b([w(fl)],t),t})(),hO=(()=>{let t=class Za{_store=u(Gt);_mediator=u(D);_options=u(qt);handle({id:e,nodeId:n,kind:o,element:r}){if(!this._options.enabled)return;let a=Io.build(e,o),s=this._store.connectorEntries.get(a);s&&(this._detachConnectorFromNode(s.key,s.nodeId),this._store.connectorKeyByElement.delete(s.element));let c=new hh(a,e,o,n,r);this._store.connectorEntries.set(a,c),this._store.connectorKeyByElement.set(r,a);let l=this._store.connectorKeysByNodeId.get(n)??new Set;l.add(a),this._store.connectorKeysByNodeId.set(n,l),this._mediator.execute(new Li(n,"connector-registered"))}_detachConnectorFromNode(e,n){let o=this._store.connectorKeysByNodeId.get(n);o&&(o.delete(e),o.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Za)};static \u0275prov=y({token:Za,factory:Za.\u0275fac})};return t=b([w(ll)],t),t})(),Eo=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(i,e){this.connectorId=i,this.kind=e}},mO=(()=>{let t=class Qa{_store=u(Gt);_mediator=u(D);_options=u(qt);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let o=Io.build(e,n),r=this._store.connectorEntries.get(o);r&&(this._store.connectorEntries.delete(o),this._store.connectorKeyByElement.delete(r.element),this._detachConnectorFromNode(o,r.nodeId),this._store.nodeEntries.has(r.nodeId)&&this._mediator.execute(new Li(r.nodeId,"connector-unregistered")))}_detachConnectorFromNode(e,n){let o=this._store.connectorKeysByNodeId.get(n);o&&(o.delete(e),o.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||Qa)};static \u0275prov=y({token:Qa,factory:Qa.\u0275fac})};return t=b([w(Eo)],t),t})(),zi=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(i){this.element=i}},_O=(()=>{let t=class Ja{_store=u(Gt);_options=u(qt);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 o=this._store.connectorKeyByElement.get(e);if(o)return this._store.connectorEntries.get(o)?.rect??void 0}static \u0275fac=function(n){return new(n||Ja)};static \u0275prov=y({token:Ja,factory:Ja.\u0275fac})};return t=b([w(zi)],t),t})(),Jn=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(i,e,n){this.connectorId=i,this.kind=e,this.rect=n}},gO=(()=>{let t=class es{_store=u(Gt);_options=u(qt);handle({connectorId:e,kind:n,rect:o}){if(!this._options.enabled)return;let r=Io.build(e,n),a=this._store.connectorEntries.get(r);a&&(a.rect=Le.fromRoundedRect(o))}static \u0275fac=function(n){return new(n||es)};static \u0275prov=y({token:es,factory:es.\u0275fac})};return t=b([w(Jn)],t),t})(),ei=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(i,e){this.nodeId=i,this.rect=e}},vO=(()=>{let t=class ts{_store=u(Gt);_options=u(qt);handle({nodeId:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeEntries.get(e);if(!o)return;let r=o.rect;o.rect=V.initialize(n.x,n.y,n.width,n.height),r&&this._updateConnectorRectsByNodeRect(e,r,o.rect)}_updateConnectorRectsByNodeRect(e,n,o){let r=this._store.connectorKeysByNodeId.get(e);if(!r?.size)return;let a=o.x-n.x,s=o.y-n.y,c=n.width!==0,l=n.height!==0,f=c?o.width/n.width:1,m=l?o.height/n.height:1;for(let x of r){let P=this._store.connectorEntries.get(x);if(!P?.rect)continue;let E=P.rect,N=E.gravityCenter,j=c?o.x+(N.x-n.x)*f:N.x+a,L=l?o.y+(N.y-n.y)*m:N.y+s;P.rect=new Le(j-E.width/2,L-E.height/2,E.width,E.height,E.radius1,E.radius2,E.radius3,E.radius4)}}static \u0275fac=function(n){return new(n||ts)};static \u0275prov=y({token:ts,factory:ts.\u0275fac})};return t=b([w(ei)],t),t})(),Po=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(i,e){this.element=i,this.rect=e}},yO=(()=>{let t=class ns{_store=u(Gt);_options=u(qt);handle({element:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeIdByElement.get(e);if(o){let s=this._store.nodeEntries.get(o);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||ns)};static \u0275prov=y({token:ns,factory:ns.\u0275fac})};return t=b([w(Po)],t),t})(),CO=[Gt,fO,pO,uO,hO,mO,_O,vO,gO,yO];function Yi(t,i,e){return i?Z.fromPoint(t).elementTransform(i).sub(e.scaledPosition).sub(e.position).div(e.scale):Z.fromPoint(t)}function X0(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Bi(t){return t?`${t}`:void 0}var xO=(()=>{let t=class is{_store=u(k);_mediator=u(D);_browser=u(ze);get _transform(){return this._store.transform}handle({element:e,cache:n}){let o=this._mediator.execute(new zi(e));if(o&&n)return o;let r=this._getElementRoundedRect(e),a=this._normalizePosition(r),s=this._unscaleSize(r),c=this._getUnscaledRect(a,s,r),l=this._getOffsetSize(e,s),f=Le.fromCenter(c,l.width,l.height);return this._mediator.execute(new Po(e,f)),f}_getElementRoundedRect(e){return this._getRoundedRect(V.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,o){let[r,a,s,c]=this._normalizeCircularBorderRadii(e.width,e.height,[this._getSystemRadius(o.borderTopLeftRadius,n,o.fontSize),this._getSystemRadius(o.borderTopRightRadius,n,o.fontSize),this._getSystemRadius(o.borderBottomRightRadius,n,o.fontSize),this._getSystemRadius(o.borderBottomLeftRadius,n,o.fontSize)]);return new Le(e.x,e.y,e.width,e.height,r,a,s,c)}_getComputedStyle(e){return this._browser.window.getComputedStyle(e)}_toPixels(e,n,o){return this._browser.toPixels(e,n.clientWidth,n.clientHeight,o)||0}_getSystemRadius(e,n,o){return this._toPixels(e,n,o)*this._transform.scale}_normalizeCircularBorderRadii(e,n,o){let[r,a,s,c]=o.map(f=>Math.max(0,f)),l=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*l,a*l,s*l,c*l]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return Yi(e,this._store.flowHost,this._transform)}_unscaleSize(e){return et.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n,o){return new Le(e.x,e.y,n.width,n.height,this._unscaleRadius(o.radius1),this._unscaleRadius(o.radius2),this._unscaleRadius(o.radius3),this._unscaleRadius(o.radius4))}_unscaleRadius(e){return e/this._transform.scale}_getOffsetSize(e,n){return et.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||is)};static \u0275prov=y({token:is,factory:is.\u0275fac})};return t=b([w(In)],t),t})(),pl=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(i,e){this.connector=i,this.cache=e}},bO=(()=>{let t=class os{_mediator=u(D);handle({connector:e,cache:n}){let o=this._buildCacheKey(e),r=n.get(o)??this._calculateRect(e);return n.set(o,r),r}_buildCacheKey(e){return`${e.kind}::${e.fId()}`}_calculateRect(e){return this._mediator.execute(new In(e.hostElement))}static \u0275fac=function(n){return new(n||os)};static \u0275prov=y({token:os,factory:os.\u0275fac})};return t=b([w(pl)],t),t})(),hl=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(i){this.connection=i}},wO=(()=>{let t=class rs{_store=u(k);handle({connection:e}){let n=this._store.outputs.get(e.fOutputId()),o=this._store.inputs.get(e.fInputId());return!n||!o?null:{source:n,target:o}}static \u0275fac=function(n){return new(n||rs)};static \u0275prov=y({token:rs,factory:rs.\u0275fac})};return t=b([w(hl)],t),t})(),Mo=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(i,e){this.connection=i,this.cache=e}},SO=(()=>{let t=class as{_mediator=u(D);handle({connection:e,cache:n}){let o=this._resolveConnectionEndpoints(e);return o?Hn(ce({},o),{sourceRect:this._resolveEndpointRect(o.source,n),targetRect:this._resolveEndpointRect(o.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new hl(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new pl(e,n))}static \u0275fac=function(n){return new(n||as)};static \u0275prov=y({token:as,factory:as.\u0275fac})};return t=b([w(Mo)],t),t})(),Fe=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(i){this.element=i}},TO=(()=>{let t=class ss{_store=u(k);_mediator=u(D);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new zi(e));if(n)return n;let o=V.fromElement(e),r=this._normalizePosition(o),a=this._unscaleSize(o),s=this._getUnscaledRect(r,a),c=this._getOffsetSize(e,a),l=this._fromCenter(s,c.width,c.height);return this._mediator.execute(new Po(e,l)),l}_fromCenter(e,n,o){return V.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-o/2,n,o)}_normalizePosition(e){return Yi(e,this._store.flowHost,this._transform)}_unscaleSize(e){return et.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n){return new Le(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return et.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||ss)};static \u0275prov=y({token:ss,factory:ss.\u0275fac})};return t=b([w(Fe)],t),t})(),Zt=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(i){this.connector=i}},IO=(()=>{let t=class cs{_store=u(k);_mediator=u(D);handle({connector:e}){if(!e)return;let n=this._store.nodes.get(e.fNodeId);if(!n||!n._rotate)return;let o=this._mediator.execute(new Fe(n.hostElement));return{rotationDeg:n._rotate,pivot:o.gravityCenter}}static \u0275fac=function(n){return new(n||cs)};static \u0275prov=y({token:cs,factory:cs.\u0275fac})};return t=b([w(Zt)],t),t})(),ml=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(i,e){this.connection=i,this.geometry=e}},EO=(()=>{let t=class ds{_mediator=u(D);_connectionBehaviour=u(Ki);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new Pt(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 Zt(e))}static \u0275fac=function(n){return new(n||ds)};static \u0275prov=y({token:ds,factory:ds.\u0275fac})};return t=b([w(ml)],t),t})(),ko=class{connection;source;target;line;static fToken=Symbol("RenderConnectionWithLineRequest");constructor(i,e,n,o){this.connection=i,this.source=e,this.target=n,this.line=o}},PO=(()=>{let t=class ls{_mediator=u(D);handle({connection:e,source:n,target:o,line:r}){this._mediator.execute(new dl(n,o)),this._mediator.execute(new cl(e,r))}static \u0275fac=function(n){return new(n||ls)};static \u0275prov=y({token:ls,factory:ls.\u0275fac})};return t=b([w(ko)],t),t})(),Do=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(i,e){this.connection=i,this.geometry=e}},MO=(()=>{let t=class us{_mediator=u(D);handle({connection:e,geometry:n}){let o=this._mediator.execute(new ml(e,n));this._mediator.execute(new ko(e,n.source,n.target,o))}static \u0275fac=function(n){return new(n||us)};static \u0275prov=y({token:us,factory:us.\u0275fac})};return t=b([w(Do)],t),t})(),_l=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(i,e){this.connection=i,this.cache=e}},kO=(()=>{let t=class fs{_mediator=u(D);handle({connection:e,cache:n}){let o=this._mediator.execute(new Mo(e,n));o&&this._mediator.execute(new Do(e,o))}static \u0275fac=function(n){return new(n||fs)};static \u0275prov=y({token:fs,factory:fs.\u0275fac})};return t=b([w(_l)],t),t})(),ti=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(i){this.session=i}},DO=(()=>{let t=class ps{_store=u(k);_state=u(Tf);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||ps)};static \u0275prov=y({token:ps,factory:ps.\u0275fac})};return t=b([w(ti)],t),t})(),Oo=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(i){this.session=i}},OO=(()=>{let t=class hs{_mediator=u(D);_store=u(k);handle({session:e}){this._mediator.execute(new ti(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||hs)};static \u0275prov=y({token:hs,factory:hs.\u0275fac})};return t=b([w(Oo)],t),t})(),gl=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(i,e){this.batchItem=i,this.result=e}},NO=(()=>{let t=class ms{_mediator=u(D);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 ko(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new Do(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||ms)};static \u0275prov=y({token:ms,factory:ms.\u0275fac})};return t=b([w(gl)],t),t})(),bn=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(i,e,n,o,r,a){this.connections=i,this.cache=e,this.startIndex=n,this.session=o,this.batchItems=r,this.workerResults=a}},RO=500,AO=6,FO=(()=>{let t=class _s{_mediator=u(D);_browser=u(ze);handle({connections:e,cache:n,startIndex:o,session:r,batchItems:a,workerResults:s}){if(!this._isCurrent(r))return;let c=this._now(),l=o,f=0;for(;l<e.length&&f<RO&&this._isWithinSliceBudget(c);){let m=e[l];if(a?this._mediator.execute(new gl(a[l]??null,s?.[l])):this._mediator.execute(new _l(m,n)),l++,f++,!this._isCurrent(r))return}if(l>=e.length){this._mediator.execute(new Oo(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new bn(e,n,l,r,a,s)))}_isCurrent(e){return this._mediator.execute(new ti(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<AO:!0}static \u0275fac=function(n){return new(n||_s)};static \u0275prov=y({token:_s,factory:_s.\u0275fac})};return t=b([w(bn)],t),t})(),vl=class{static fToken=Symbol("StartConnectionRedrawRequest")},LO=(()=>{let t=class gs{_store=u(k);_state=u(Tf);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||gs)};static \u0275prov=y({token:gs,factory:gs.\u0275fac})};return t=b([w(vl)],t),t})(),No=class{static fToken=Symbol("RedrawConnectionsRequest")},yl=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(i){this.connectionCount=i}},Ro=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},zO=(()=>{let t=class vs{_browser=u(ze);_state=u(ai);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return $0(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||vs)};static \u0275prov=y({token:vs,factory:vs.\u0275fac})};return t=b([w(Ro)],t),t})(),BO=(()=>{let t=class ys{_mediator=u(D);handle({connectionCount:e}){return e>0&&this._mediator.execute(new Ro)}static \u0275fac=function(n){return new(n||ys)};static \u0275prov=y({token:ys,factory:ys.\u0275fac})};return t=b([w(yl)],t),t})(),Cl=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(i,e,n){this.connection=i,this.geometry=e,this.originalIndex=n}},qO=(()=>{let t=class Cs{_store=u(k);handle({connection:e,geometry:n,originalIndex:o}){let{source:r,target:a,sourceRect:s,targetRect:c}=n;return{originalIndex:o,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||Cs)};static \u0275prov=y({token:Cs,factory:Cs.\u0275fac})};return t=b([w(Cl)],t),t})(),xl=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(i,e){this.connections=i,this.cache=e}},GO=(()=>{let t=class xs{_mediator=u(D);handle({connections:e,cache:n}){let o=new Array(e.length),r=[];for(let a=0;a<e.length;a++){let s=this._buildBatchItem(e[a],n,a);o[a]=s,s&&r.push(s.payload)}return{items:o,payload:r}}_buildBatchItem(e,n,o){let r=this._mediator.execute(new Mo(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new Cl(e,r,o))}:null}static \u0275fac=function(n){return new(n||xs)};static \u0275prov=y({token:xs,factory:xs.\u0275fac})};return t=b([w(xl)],t),t})(),bl=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(i){this.error=i}},Ao=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(i){this.error=i}},HO=(()=>{let t=class bs{_state=u(ai);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||bs)};static \u0275prov=y({token:bs,factory:bs.\u0275fac})};return t=b([w(Ao)],t),t})(),VO=(()=>{let t=class ws{_state=u(ai);_mediator=u(D);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new Ao(e))}static \u0275fac=function(n){return new(n||ws)};static \u0275prov=y({token:ws,factory:ws.\u0275fac})};return t=b([w(bl)],t),t})(),wl=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(i){this.message=i}},jO=(()=>{let t=class Ss{_state=u(ai);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||Ss)};static \u0275prov=y({token:Ss,factory:Ss.\u0275fac})};return t=b([w(wl)],t),t})(),Sl=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},UO=(()=>{let t=class Ts{_browser=u(ze);_state=u(ai);_mediator=u(D);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!$0(n))return null;let o=K0(n);if(!o)return null;let r=sO(o);try{let a=new o.workerCtor(r,{name:"f-flow-connection-worker"});return a.onmessage=s=>{this._mediator.execute(new wl(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 Y0(r,o.urlApi),this._disableWorker(a instanceof Error?a:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new bl(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new Ao(e))}static \u0275fac=function(n){return new(n||Ts)};static \u0275prov=y({token:Ts,factory:Ts.\u0275fac})};return t=b([w(Sl)],t),t})(),Tl=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(i){this.payload=i}},WO=(()=>{let t=class Is{_state=u(ai);_mediator=u(D);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new Ro))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new Sl);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let o=++this._state.nextRequestId;return new Promise((r,a)=>{this._state.pending.set(o,{resolve:r,reject:a});try{n.postMessage({requestId:o,items:e})}catch(s){this._state.pending.delete(o),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||Is)};static \u0275prov=y({token:Is,factory:Is.\u0275fac})};return t=b([w(Tl)],t),t})(),Il=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(i){this.batch=i}},$O=(()=>{let t=class Es{_mediator=u(D);handle({batch:e}){return e.payload.length?this._mediator.execute(new Tl(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Es)};static \u0275prov=y({token:Es,factory:Es.\u0275fac})};return t=b([w(Il)],t),t})(),El=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(i,e,n){this.connections=i,this.cache=e,this.session=n}},KO=(()=>{let t=class Ps{_mediator=u(D);handle({connections:e,cache:n,session:o}){let r=this._mediator.execute(new xl(e,n));if(!r.payload.length){this._mediator.execute(new bn(e,n,0,o,r.items));return}this._mediator.execute(new Il(r)).then(a=>{this._mediator.execute(new ti(o))&&this._mediator.execute(new bn(e,n,0,o,r.items,this._alignWorkerResults(a,e.length)))}).catch(()=>{this._mediator.execute(new ti(o))&&this._mediator.execute(new bn(e,n,0,o,r.items))})}_alignWorkerResults(e,n){let o=new Array(n);for(let r of e){let a=r.originalIndex;a<0||a>=n||(o[a]=r)}return o}static \u0275fac=function(n){return new(n||Ps)};static \u0275prov=y({token:Ps,factory:Ps.\u0275fac})};return t=b([w(El)],t),t})(),YO=(()=>{let t=class Ms{_mediator=u(D);_store=u(k);handle(e){let n=this._mediator.execute(new vl);this._createMarkersForCreate(),this._createMarkersForSnap();let o=[...this._store.connections.getAll()],r=new Map;if(!o.length){this._mediator.execute(new Oo(n));return}this._shouldUseConnectionWorker(o.length)?this._redrawUsingWorker(o,r,n):this._redrawWithoutWorker(o,r,n)}_createMarkersForCreate(){let e=this._store.connections.getForCreate();e&&this._mediator.execute(new Fi(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new Fi(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new yl(e))}_redrawUsingWorker(e,n,o){this._mediator.execute(new El(e,n,o))}_redrawWithoutWorker(e,n,o){this._mediator.execute(new bn(e,n,0,o))}static \u0275fac=function(n){return new(n||Ms)};static \u0275prov=y({token:Ms,factory:Ms.\u0275fac})};return t=b([w(No)],t),t})(),_h=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},XO=(()=>{let t=class ks{_store=u(k);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||ks)};static \u0275prov=y({token:ks,factory:ks.\u0275fac})};return t=b([w(_h)],t),t})(),Pl=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(i){this.connection=i}},ZO=(()=>{let t=class Ds{_store=u(k);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Ds)};static \u0275prov=y({token:Ds,factory:Ds.\u0275fac})};return t=b([w(Pl)],t),t})(),Ml=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(i){this.instance=i}},QO=(()=>{let t=class Os{_store=u(k);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Os)};static \u0275prov=y({token:Os,factory:Os.\u0275fac})};return t=b([w(Ml)],t),t})(),gh=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(i,e){this.waypointIndex=i,this.connectionId=e}},kl=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},JO=(()=>{let t=class Ns{_store=u(k);_dragSession=u(Q);handle(e){this._store.flowHost.classList.remove(je.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Ns)};static \u0275prov=y({token:Ns,factory:Ns.\u0275fac})};return t=b([w(kl)],t),t})(),Dl=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},eN=(()=>{let t=class Rs{_mediator=u(D);_store=u(k);_dragContext=u(Q);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(je.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new Fo),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Ll(e.kind,e.data?ce({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||Rs)};static \u0275prov=y({token:Rs,factory:Rs.\u0275fac})};return t=b([w(Dl)],t),t})(),Fo=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},ni=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(i,e){this._event=i,this._target=e}setTarget(i){this._target=i}preventDefault(){this.originalEvent.preventDefault()}get isEventInLockedContext(){return this.targetElement.closest("[fLockedContext]")!==null}},Ol=class extends ni{constructor(i,e){super(i,e)}isMouseLeftButton(){return this.originalEvent.button===0}isMouseRightButton(){return this.originalEvent.buttons===2}getPosition(){return{x:this.originalEvent.clientX,y:this.originalEvent.clientY}}},vh=class extends ni{constructor(i,e){super(i,e)}isMouseLeftButton(){let i=this.originalEvent;return i.pointerType==="mouse"&&i.button===0||i.pointerType==="touch"}isMouseRightButton(){let i=this.originalEvent;return i.pointerType==="mouse"&&i.button===2||i.pointerType==="touch"}getPosition(){let i=this.originalEvent;return{x:i.clientX,y:i.clientY}}getPointerType(){return this.originalEvent.pointerType}getPointerId(){return this.originalEvent.pointerId}},yh=class extends ni{constructor(i){super(i)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let i=this.originalEvent.touches;return{x:i[0].clientX,y:i[0].clientY}}},Ch=class extends ni{constructor(i,e){super(i,e)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let i=this.originalEvent.targetTouches[0];return{x:i.clientX,y:i.clientY}}},ve=(()=>{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})(),tN=800,xh=class{_document=u(Vr);_ngZone=u(Vn,{optional:!0});_mouseListeners=ve.emptyListener();_touchListeners=ve.emptyListener();_startListeners=ve.emptyListener();isSyntheticEvent(i){return!!this._lastTouchEventTime&&this._lastTouchEventTime+tN>Date.now()}_lastTouchEventTime=0;isDragStarted=!1;_dragStartThreshold=3;_dragStartDelay=0;_dragStartTime=0;_dragStartPosition={x:0,y:0};_moveHandler=this._checkDragSequenceToStart;_pointerDownElement=null;_onMouseDown=i=>{let e=this.isSyntheticEvent(i),n=iN(i),o=new Ol(i);if(e||n||this.disabled||this.isDragStarted)return;this._pointerDownElement=o.targetElement,this.onPointerDown(o)&&(this._dragStartTime=Date.now(),this._dragStartPosition=o.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,ve.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ve.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ve.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ve.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ve.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ve.activeCaptureListener())})};_onTouchDown=i=>{let e=oN(i),n=new yh(i);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,ve.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ve.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ve.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ve.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ve.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ve.activeCaptureListener())})};_onSelectStart=i=>{this.onSelect(i)};_onMouseMove=i=>{this._moveHandler(new Ol(i))};_onTouchMove=i=>{this._moveHandler(new Ch(i))};_checkDragSequenceToStart(i){let e=i.getPosition();if(!this.isDragStarted&&this._pointerDownElement){i.setTarget(this._pointerDownElement);let n=Math.abs(e.x-this._dragStartPosition.x),o=Math.abs(e.y-this._dragStartPosition.y);if(n+o>=this._dragStartThreshold){if(!(Date.now()>=this._dragStartTime+this._dragStartDelay)){this._endDragSequence();return}i.preventDefault(),this.prepareDragSequence(i),this.isDragStarted=!0,this._moveHandler=this.onPointerMove,nN(i.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=i=>{this.isDragStarted&&this.onPointerUp(new vh(i)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=ve.emptyListener(),this._touchListeners(),this._touchListeners=ve.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,ve.activeListener()),this._listen("touchstart",this._onTouchDown,ve.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,ve.activeListener()),this._unlisten("touchstart",this._onTouchDown,ve.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=ve.emptyListener(),this._touchListeners(),this._touchListeners=ve.emptyListener(),this._mouseListeners(),this._mouseListeners=ve.emptyListener()}_listen(i,e,n){this._document.addEventListener(i,e,n)}_unlisten(i,e,n){this._document.removeEventListener(i,e,n)}_preventDuringDrag=i=>{this.isDragStarted&&i.preventDefault()}};function nN(t){return t.type[0]==="t"}function iN(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function oN(t){let i=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0];return!!i&&i.identifier===-1&&(i.radiusX==null||i.radiusX===1)&&(i.radiusY==null||i.radiusY===1)}var bh=class extends ni{_position;_isMouseLeftButton;_isMouseRightButton;constructor(i){super(i.originalEvent,i.targetElement),this._position=i.getPosition(),this._isMouseLeftButton=i.isMouseLeftButton(),this._isMouseRightButton=i.isMouseRightButton()}isMouseLeftButton(){return this._isMouseLeftButton}isMouseRightButton(){return this._isMouseRightButton}getPosition(){return ce({},this._position)}};function rN(t){return new bh(t)}var Q=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new Z(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 Z(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=rN(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})(),wh=class{nodeIds;groupIds;connectionIds;get fNodeIds(){return this.nodeIds}get fGroupIds(){return this.groupIds}get fConnectionIds(){return this.connectionIds}constructor(i,e,n){this.nodeIds=i,this.groupIds=e,this.connectionIds=n}},aN=(()=>{let t=class As{_mediator=u(D);_store=u(k);_dragSession=u(Q);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new wn))}_getSelection(){return this._mediator.execute(new rr)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new wh(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||As)};static \u0275prov=y({token:As,factory:As.\u0275fac})};return t=b([w(Fo)],t),t})(),Sh=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(i){this.nodeOrGroup=i}},sN=(()=>{let t=class Fs{_store=u(k);_mediator=u(D);handle({nodeOrGroup:e}){let n=V.initialize(-1/0,-1/0,1/0,1/0),o=this._getNode(e.fParentId());return o&&(n=this._getParentRect(o)),n}_getNode(e){return this._store.nodes.get(e)}_getParentRect(e){let n=this._getNodeRect(e),o=this._getNodePadding(e,n);return V.initialize(n.x+o[0],n.y+o[1],n.width-o[0]-o[2],n.height-o[1]-o[3])}_getNodeRect(e){return this._mediator.execute(new Fe(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new oi(e,n))}static \u0275fac=function(n){return new(n||Fs)};static \u0275prov=y({token:Fs,factory:Fs.\u0275fac})};return t=b([w(Sh)],t),t})(),Th=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(i,e){this.fParentNodes=i,this.fDraggedNodes=e}},cN=(()=>{let t=class Ls{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(o=>e.includes(o.fId()))}static \u0275fac=function(n){return new(n||Ls)};static \u0275prov=y({token:Ls,factory:Ls.\u0275fac})};return t=b([w(Th)],t),t})(),Ih=class{fNodeId;fConnectionIds;constructor(i,e){this.fNodeId=i,this.fConnectionIds=e}},Nl=class extends Ih{nodeId;connectionIds;constructor(i,e){super(i,e),this.nodeId=i,this.connectionIds=e}},Rl=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(i){this.nodeOrGroup=i}},dN=(()=>{let t=class zs{_mediator=u(D);_store=u(k);handle({nodeOrGroup:e}){let n=this._collectConnectableConnectorIds(e,"source"),o=this._collectConnectableConnectorIds(e,"target");if(!n.size||!o.size)return;let r=this._collectAttachedConnectionIds(n,o),a=this._collectConnectionsUnderNode(e),s=[];for(let c of a){let l=c.fId();r.has(l)||s.push(l)}s.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Nl(e.fId(),s)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Nl(e.fId(),s)))}_collectConnectableConnectorIds(e,n){let o=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let a of o)a.canBeConnected&&e.isContains(a.hostElement)&&r.add(a.fId());return r}_collectAttachedConnectionIds(e,n){let o=new Set;for(let r of this._store.connections.getAll())(e.has(r.fOutputId())||n.has(r.fInputId()))&&o.add(r.fId());return o}_collectConnectionsUnderNode(e){let n=this._mediator.execute(new In(e.hostElement,!1)),o=[];for(let r of this._store.connections.getAll())this._hasIntersection(r,n)&&o.push(r);return o}_hasIntersection(e,n){return Pi.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||zs)};static \u0275prov=y({token:zs,factory:zs.\u0275fac})};return t=b([w(Rl)],t),t})(),lN=[eN,JO,aN,sN,cN,dN],uN=new Set(["create-connection","reassign-connection","drag-node"]),fN=new Set(["selection-area"]),pN=new Set(["assign-to-container"]);function Z0(t){let i=null;for(let e of t){if(pN.has(e))continue;let n=uN.has(e)?"rebase":fN.has(e)?"direct":null;if(!n)return null;if(!i){i=n;continue}if(i!==n)return null}return i}function Q0(t,i,e,n,o){return A.initialize(f0(t.x,i.left,i.right,e,n,o),f0(t.y,i.top,i.bottom,e,n,o))}function f0(t,i,e,n,o,r){let a=Math.max(0,n),s=Math.max(0,o);if(!a||!s)return 0;if(t<=i+a){let c=h0((i+a-t)/a,0,1);return p0(c,s,r)}if(t>=e-a){let c=h0((t-(e-a))/a,0,1);return-p0(c,s,r)}return 0}function hN(t,i,e){let n=e||1;return Z.fromPoint(t).add(Z.fromPoint(i).div(n))}function p0(t,i,e){return e?i*t:i}function h0(t,i,e){return Math.max(i,Math.min(e,t))}var Al=class{static fToken=Symbol("RunAutoPanFrameRequest")},En=class{static fToken=Symbol("StopAutoPanRequest")},mN=(()=>{let t=class Bs{_store=u(k);_dragContext=u(Q);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||Bs)};static \u0275prov=y({token:Bs,factory:Bs.\u0275fac})};return t=b([w(En)],t),t})(),Lo=class{static fToken=Symbol("SyncAutoPanRequest")},_N=(()=>{let t=class qs{_mediator=u(D);_store=u(k);_dragContext=u(Q);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new En);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Al)}))}_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?A.initialize():Q0(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return Z0(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(Te.AUTO_PAN)}static \u0275fac=function(n){return new(n||qs)};static \u0275prov=y({token:qs,factory:qs.\u0275fac})};return t=b([w(Lo)],t),t})(),gN=(()=>{let t=class Gs{_mediator=u(D);_store=u(k);_dragContext=u(Q);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new En);return}let o=this._getAutoPanDelta();if(!o.x&&!o.y){this._mediator.execute(new En);return}this._applyCanvasDelta(o,n),this._replayLastPointerMove(),this._mediator.execute(new Lo)}_applyCanvasDelta(e,n){let o=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=hN(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||o.scale||1)),o.position=Z.fromPoint(o.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(o=>{o.onPointerMove(ce({},n),e)})}_getPointerPositionInCanvas(e){return Z.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 Z0(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?A.initialize():Q0(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(Te.AUTO_PAN)}static \u0275fac=function(n){return new(n||Gs)};static \u0275prov=y({token:Gs,factory:Gs.\u0275fac})};return t=b([w(Al)],t),t})(),vN=[_N,gN,mN],Fl=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(i){this.event=i}},Ll=class{kind;data;fEventType;get fData(){return this.data}constructor(i,e,n){this.kind=i,this.data=e,this.fEventType=n??i}},tt=class{data(){}_features=[];getEvent(){return new Ll(this.kind,this.data(),this.type)}attachFeature(i){this._features.push(i)}featuresPrepare(i){for(let e of this._features)e.onPrepare?.(i)}featuresMove(i,e){for(let n of this._features)n.onMove?.(i,e)}featuresFinalize(i,e){for(let n of this._features)n.onFinalize?.(i,e)}featuresEnd(i){for(let e of this._features)e.onEnd?.(i)}},zl=class{_isConnected=!1;get isConnected(){return this._isConnected}toConnector=[];isSelfConnectable=!0;fConnectableSide=F.AUTO;userFConnectableSide=F.AUTO;isContains(i){return this.hostElement.contains(i)}setConnected(i){this._isConnected=!0,this.toConnector.push(i)}resetConnected(){this._isConnected=!1,this.toConnector=[]}},yN=new ue("F_NODE_INPUT"),CN=(()=>{class t extends zl{kind="input";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,standalone:!1,features:[he]})}return t})(),zt=(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})(zt||{});function xN(t){return bo(t,".f-rotate-handle")}var J0=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),If=new ue("F_NODE"),bN=j0(class{hostElement;constructor(t){this.hostElement=t}}),Bl=class extends bN{_injector=u(Ye);renderer=u(tg);browser=u(ze);stateChanges=new yt;_position=A.initialize();_rotate=0;_size;connectors=[];positionChanges(){J(()=>{let i=this.position();At(()=>{A.isEqual(this._position,i)||(this._position=i,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){J(()=>{let i=this.size();At(()=>{this._isSizeEqual(i)||(this._size=i,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){J(()=>{let i=this.rotate();At(()=>{this._rotate!==i&&(this._rotate=i,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){J(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),At(()=>this.refresh())},{injector:this._injector})}_isSizeEqual(i){return this._size?.width===i?.width&&this._size?.height===i?.height}isContains(i){return this.hostElement.contains(i)}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(i){this._position=i}updateRotate(i){this._rotate=i}updateSize(i){this._size=i}setClass(i){this.hostElement.classList.add(i)}removeClass(i){this.hostElement.classList.remove(i)}addConnector(i){this.connectors.push(i),this.refresh()}removeConnector(i){let e=this.connectors.indexOf(i);e!==-1&&this.connectors.splice(e,1),this.refresh()}},wN=0,SN=3,Eh=(()=>{class t extends Bl{_debounceTimer=null;_destroyRef=u(it);_mediator=u(D);fId=O(`f-group-${wN++}`,{alias:"fGroupId"});fParentId=O(null,{alias:"fGroupParentId"});position=Wn(A.initialize(),{alias:"fGroupPosition"});size=O(void 0,{alias:"fGroupSize"});sizeChange=Ve({alias:"fGroupSizeChange"});rotate=Wn(0,{alias:"fGroupRotate"});fConnectOnNode=O(!0,{transform:me});fMinimapClass=O([]);fDraggingDisabled=O(!1,{alias:"fGroupDraggingDisabled",transform:me});fSelectionDisabled=O(!1,{alias:"fGroupSelectionDisabled",transform:me});fIncludePadding=O(!0,{transform:me});fAutoExpandOnChildHit=O(!1,{transform:me});fAutoSizeToFitChildren=O(!1,{transform:me});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qo(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 wn),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),SN))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Gi(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new er(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new tr(this))}static \u0275fac=function(n){return new(n||t)(wp(Ne))};static \u0275dir=Ee({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(G("data-f-group-id",o.fId()),de("f-group-dragging-disabled",o.fDraggingDisabled())("f-group-selection-disabled",o.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:[ge([{provide:If,useExisting:t}]),he]})}return t})(),m0=0,TN=3,Ef=(()=>{class t extends Bl{_debounceTimer=null;_destroyRef=u(it);_mediator=u(D);fId=O(`f-node-${m0++}`,{alias:"fNodeId",transform:e=>Bi(e)||`f-node-${m0++}`});fParentId=O(null,{alias:"fNodeParentId"});position=Wn(A.initialize(),{alias:"fNodePosition"});size=O(void 0,{alias:"fNodeSize"});sizeChange=Ve({alias:"fNodeSizeChange"});rotate=Wn(0,{alias:"fNodeRotate"});fConnectOnNode=O(!0,{transform:me});fMinimapClass=O([]);fDraggingDisabled=O(!1,{alias:"fNodeDraggingDisabled",transform:me});fSelectionDisabled=O(!1,{alias:"fNodeSelectionDisabled",transform:me});fIncludePadding=O(!0,{transform:me});fAutoExpandOnChildHit=O(!1,{transform:me});fAutoSizeToFitChildren=O(!1,{transform:me});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Qo(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 wn),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),TN))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Gi(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new er(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new tr(this))}static \u0275fac=function(n){return new(n||t)(wp(Ne))};static \u0275dir=Ee({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(G("data-f-node-id",o.fId()),de("f-node-dragging-disabled",o.fDraggingDisabled())("f-node-selection-disabled",o.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:[ge([{provide:If,useExisting:t}]),he]})}return t})();function IN(t){return!!t.closest("[fNode]")}var _0=0,ev=(()=>{class t extends CN{hostElement=u(Ne).nativeElement;_mediator=u(D);_node=u(If);fId=O(`f-node-input-${_0++}`,{alias:"fInputId",transform:e=>Bi(e)||`f-node-input-${_0++}`});category=O(void 0,{alias:"fInputCategory",transform:Bi});multiple=O(!0,{alias:"fInputMultiple",transform:me});disabled=O(!1,{alias:"fInputDisabled",transform:me});userFConnectableSide=F.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yo(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(je.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(je.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(je.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(je.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new nr(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,o){n&2&&(G("data-f-input-id",o.fId()),de("f-node-input-multiple",o.multiple)("f-node-input-disabled",o.disabled()))},inputs:{fId:[1,"fInputId","fId"],category:[1,"fInputCategory","category"],multiple:[1,"fInputMultiple","multiple"],disabled:[1,"fInputDisabled","disabled"],userFConnectableSide:[2,"fInputConnectableSide","userFConnectableSide",e=>Mi(e,"fInputConnectableSide",F)]},exportAs:["fNodeInput"],standalone:!1,features:[ge([{provide:yN,useExisting:t}]),he,Ci]})}return t})(),EN=(()=>{class t extends zl{get hasConnectionLimits(){return!!this.canBeConnectedInputs&&this.canBeConnectedInputs.length>0}canConnectTo(e){return[e.fId(),e.category()].some(o=>o&&this.canBeConnectedInputs?.includes(o))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,standalone:!1,features:[he]})}return t})();function tv(t){return!!t.closest("[fNodeOutlet]")}var PN=new ue("F_NODE_OUTPUT"),MN=(()=>{class t extends EN{kind="output";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,standalone:!1,features:[he]})}return t})();function nv(t){return!!t.closest("[fNodeOutput]")}var g0=0,iv=(()=>{class t extends MN{hostElement=u(Ne).nativeElement;_mediator=u(D);_node=u(If);fId=O(`f-node-output-${g0++}`,{alias:"fOutputId",transform:e=>Bi(e)||`f-node-output-${g0++}`});multiple=O(!1,{alias:"fOutputMultiple",transform:me});disabled=O(!1,{alias:"fOutputDisabled",transform:me});userFConnectableSide=F.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Yo(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(je.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(je.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(je.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(je.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new nr(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,o){n&2&&(G("data-f-output-id",o.fId()),de("f-node-output-multiple",o.multiple)("f-node-output-disabled",o.disabled())("f-node-output-self-connectable",o.isSelfConnectable))},inputs:{fId:[1,"fOutputId","fId"],multiple:[1,"fOutputMultiple","multiple"],disabled:[1,"fOutputDisabled","disabled"],userFConnectableSide:[2,"fOutputConnectableSide","userFConnectableSide",e=>Mi(e,"fOutputConnectableSide",F)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[ge([{provide:PN,useExisting:t}]),he,Ci]})}return t})();var ql=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(i){this.event=i}},zo=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(i){this.outlet=i}},kN=(()=>{let t=class Hs{_store=u(k);handle({outlet:e}){let n=this._findOwnerNode(e);if(!n)throw new Error("The fOutlet must belong to an fNode");let o=this._findFirstConnectableOutputInNode(n);if(!o)throw new Error("Outlet requires at least one connectable output in the same node.");return o}_findOwnerNode(e){let n=e.hostElement;return this._store.nodes.getAll().find(o=>o.isContains(n))}_findFirstConnectableOutputInNode(e){return this._store.outputs.getAll().find(n=>e.isContains(n.hostElement)&&n.canBeConnected)}static \u0275fac=function(n){return new(n||Hs)};static \u0275prov=y({token:Hs,factory:Hs.\u0275fac})};return t=b([w(zo)],t),t})(),Ph=class{sourceId;targetId;dropPosition;fOutputId;fInputId;fDropPosition;constructor(i,e,n){this.sourceId=i,this.targetId=e,this.dropPosition=n,this.fOutputId=i,this.fInputId=e,this.fDropPosition=n}},Gl=(()=>{class t extends tt{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=u(Mn);_mediator=u(D);_connectionBehaviour=u(Ki);_store=u(k);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new Le;initialize(e,n){this._sourceRef=this._mediator.execute(new ut(e)),this._pointerDown=Le.fromRect(V.initialize(n.x,n.y))}prepareDragSequence(){this._collectAndMarkTargets(),this._initSnapConnection(),this._initCreateConnection(),this._connection.show(),this.onPointerMove(A.initialize()),this._result.setData({toConnectorRect:this._pointerDown,canBeConnectedInputs:this._targets,fOutputId:this._sourceRef.connector.fId()})}_collectAndMarkTargets(){this._targets=this._mediator.execute(new Zo(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new ji(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),o=this._findClosestTarget(n),r=o?.connector.fConnectableSide||F.TOP;this._drawCreateConnection(n,r);let a=this._snapConnection;if(!a)return;let s=o&&o.distance<a.fSnapThreshold?o:void 0;this._drawSnapConnection(s)}_findClosestTarget(e){return this._mediator.execute(new ii(e,this._targets))}_drawCreateConnection(e,n){let o=this._connectionBehaviour.handle(new Pt(this._sourceRef.rect,e,this._connection,this._sourceRef.connector.fConnectableSide,n,this._resolveRotationContext(this._sourceRef.connector)));this._connection.setLine(o),this._connection.redraw()}_drawSnapConnection(e){let n=this._snapConnection;if(!n)return;if(!e){n.hide();return}let o=this._connectionBehaviour.handle(new Pt(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(o),n.redraw()}onPointerUp(){this._connection.redraw(),this._connection.hide(),this._snapConnection?.hide(),this._mediator.execute(new Ui(this._targets.map(e=>e.connector)))}_resolveRotationContext(e){return this._mediator.execute(new Zt(e))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),DN=(()=>{let t=class Vs{_result=u(Mn);_mediator=u(D);_store=u(k);_dragContext=u(Q);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 Gl)}_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 tv(e.hostElement)?this._mediator.execute(new zo(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 Ph(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new Xo(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||Vs)};static \u0275prov=y({token:Vs,factory:Vs.\u0275fac})};return t=b([w(ql)],t),t})(),Bo=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(i,e){this.eventPosition=i,this.source=e}},ON=(()=>{let t=class js{_store=u(k);_dragContext=u(Q);_dragInjector=u(Ke);get _transform(){return this._store.transform}handle({source:e,eventPosition:n}){this._dragContext.onPointerDownScale=this._transform.scale;let o=this._toFlowSpace(n);this._dragContext.onPointerDownPosition=o;let r=this._toCanvasSpace(o),a=this._dragInjector.get(Gl);a.initialize(e,r),this._dragContext.draggableItems=[a]}_toFlowSpace(e){return Z.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return Z.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||js)};static \u0275prov=y({token:js,factory:js.\u0275fac})};return t=b([w(Bo)],t),t})(),Hl=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(i,e){this.event=i,this.node=e}},NN=(()=>{let t=class Us{_mediator=u(D);_store=u(k);handle({event:e,node:n}){let o=this._findOutlet(n);if(!o||(o.setOutputs(this._getOutputs(n)),!o.canBeConnected))return;let r=o.isConnectionFromOutlet?o:this._resolveOutput(o);!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 zo(e))}_startDrag(e,n){this._mediator.execute(new Bo(e,n))}static \u0275fac=function(n){return new(n||Us)};static \u0275prov=y({token:Us,factory:Us.\u0275fac})};return t=b([w(Hl)],t),t})(),Vl=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(i,e){this.event=i,this.node=e}},RN=(()=>{let t=class Ws{_mediator=u(D);_store=u(k);handle({event:e,node:n}){if(!nv(e.targetElement)||this._hasOutlet(n))return;let o=this._findOutput(e.targetElement);!o||!o.canBeConnected||this._startDrag(e.getPosition(),o)}_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 Bo(e,n))}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=y({token:Ws,factory:Ws.\u0275fac})};return t=b([w(Vl)],t),t})(),jl=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},AN=(()=>{let t=class $s{_mediator=u(D);_store=u(k);_dragContext=u(Q);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let o=tv(e.targetElement),r=!o&&nv(e.targetElement);if(!o&&!r)return;let a=this._findOwnerNode(e.targetElement);a&&(o?this._mediator.execute(new Hl(e,a)):this._mediator.execute(new Vl(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 Ct(e.originalEvent,n)}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=y({token:$s,factory:$s.\u0275fac})};return t=b([w(jl)],t),t})(),Ul=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(i){this.event=i}},Mh=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(i,e,n,o,r,a,s){this.connectionId=i,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=o,this.previousTargetId=r,this.nextTargetId=a,this.dropPosition=s,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=o,this.oldTargetId=r,this.newTargetId=a,this.dropPoint=s}},FN=(()=>{let t=class Ks{_dragResult=u(Mn);_mediator=u(D);_store=u(k);_dragContext=u(Q);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(),o=this._findConnectableConnector(e,n.candidates);o&&!this._isReassignedToDifferentConnector(n,o)||this._dragDirective.fReassignConnection.emit(this._buildEvent(n,e,o))}_findConnectableConnector(e,n){return this._mediator.execute(new Xo(e.getPosition(),n))}_isReassignedToDifferentConnector(e,n){let o=e.connection;return e.draggedEnd==="target"?o.fInputId()!==n.fId():o.fOutputId()!==n.fId()}_buildEvent(e,n,o){let r=e.connection;return new Mh(r.fId(),e.draggedEnd,r.fOutputId(),e.draggedEnd==="source"?o?.fId():void 0,r.fInputId(),e.draggedEnd==="target"?o?.fId():void 0,n.getPosition())}static \u0275fac=function(n){return new(n||Ks)};static \u0275prov=y({token:Ks,factory:Ks.\u0275fac})};return t=b([w(Ul)],t),t})(),Wl=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function LN(t,i){return ov(t,i)||zN(t,i)}function ov(t,i){return t.fDragHandleEnd()?.point&&rv(i,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function zN(t,i){return!!t.fDragHandleStart()?.point&&rv(i,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function rv(t,i){return(t.x-i.x)**2+(t.y-i.y)**2<=8**2}function av(t,i){return t&&t.distance<i.fSnapThreshold?t:void 0}function $l(t){return Le.fromRect(V.initialize(t.x,t.y))}var kh=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(i,e,n,o,r){this._mediator=i,this._behaviour=e,this._connection=n,this._sourceRef=o,this._targetRef=r,this._anchorRect=$l(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Xu(this._target,this._targetRef.rect.gravityCenter)),this._candidates.some(i=>i.connector.fId()===this._source.fId())||this._candidates.push(this._sourceRef),this._mediator.execute(new ji(this._candidates.map(i=>i.connector)))}setSnapConnection(i){this._snap=i,i&&(i.fInputId.set(this._connection.fInputId()),i.initialize())}onPointerMove(i){let e=this._anchorRect.addPoint(i),n=this._findClosest(e.gravityCenter),o=n?.connector.fConnectableSide??this._source.fConnectableSide;this._draw(e,o);let r=this._snap;r&&this._drawSnap(av(n,r))}_findClosest(i){return this._mediator.execute(new ii(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new Pt(i,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(i){let e=this._snap;if(!e)return;if(!i){e.hide();return}let n=this._behaviour.handle(new Pt(i.rect,this._targetRef.rect,e,i.connector.fConnectableSide,this._target.fConnectableSide,this._resolveRotationContext(i.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 Ui(this._candidates.map(i=>i.connector)))}_resolveRotationContext(i){return this._mediator.execute(new Zt(i))}},Dh=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(i,e,n,o,r){this._mediator=i,this._behaviour=e,this._connection=n,this._sourceRef=o,this._targetRef=r,this._anchorRect=$l(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Zo(this._source,this._sourceRef.rect.gravityCenter));let i=this._connection.fInputId();i&&!this._candidates.some(e=>e.connector.fId()===i)&&this._candidates.push(this._targetRef),this._mediator.execute(new ji(this._candidates.map(e=>e.connector)))}setSnapConnection(i){this._snap=i,i&&(i.fOutputId.set(this._connection.fOutputId()),i.initialize())}onPointerMove(i){let e=this._anchorRect.addPoint(i),n=this._findClosest(e.gravityCenter),o=n?.connector.fConnectableSide??this._target.fConnectableSide;this._draw(e,o);let r=this._snap;r&&this._drawSnap(av(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Ui(this._candidates.map(i=>i.connector)))}_findClosest(i){return this._mediator.execute(new ii(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new Pt(this._sourceRef.rect,i,this._connection,this._source.fConnectableSide,e,this._resolveRotationContext(this._sourceRef.connector),void 0));this._connection.setLine(n),this._connection.redraw()}_drawSnap(i){let e=this._snap;if(!e)return;if(!i){e.hide();return}let n=this._behaviour.handle(new Pt(this._sourceRef.rect,i.rect,e,this._source.fConnectableSide,i.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(i.connector)));e.show(),e.setLine(n),e.redraw()}_resolveRotationContext(i){return this._mediator.execute(new Zt(i))}},Oh=(()=>{class t extends tt{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=u(Mn);_mediator=u(D);_connectionBehaviour=u(Ki);_store=u(k);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 ut(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new ut(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new kh(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new Dh(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:$l(this._connection.line.point1),targetAnchorRect:$l(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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),BN=(()=>{let t=class Ys{_mediator=u(D);_store=u(k);_dragContext=u(Q);_dragInjector=u(Ke);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=Yi(e.event.getPosition(),this._store.flowHost,this._transform),o=this._findConnectionAt(n);o&&(this._capturePointerDown(e),this._startDrag(o,n),queueMicrotask(()=>this._bringToFront(o)))}_findConnectionAt(e){return this._connections.find(n=>LN(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=Z.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let o=this._dragInjector.get(Oh);o.initialize(e,ov(e,n)),this._dragContext.draggableItems=[o]}_isValidTrigger(e){return Ct(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new ri(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=y({token:Ys,factory:Ys.\u0275fac})};return t=b([w(Wl)],t),t})(),Kl=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(i){this.event=i}},Yl=class{connectionId;waypoints;constructor(i,e){this.connectionId=i,this.waypoints=e}},Xl=(()=>{class t extends tt{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=u(k);_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=ce({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=ce({},this._pick.waypoint),this._waypointsComponent.select(this._pick.waypoint)),this._redrawConnection()}onPointerMove(e){this._waypointsComponent.move(A.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 Yl(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),qN=(()=>{let t=class Xs{_dragContext=u(Q);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof Xl)}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=y({token:Xs,factory:Xs.\u0275fac})};return t=b([w(Kl)],t),t})(),Zl=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},GN=(()=>{let t=class Zs{_mediator=u(D);_store=u(k);_dragContext=u(Q);_dragInjector=u(Ke);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=Yi(e.event.getPosition(),this._flowHost,this._transform),o=this._pickControlPoint(n);if(!o||!this._isValidTrigger(e))return;let r=this._dragInjector.get(Xl);r.setPick(o),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=Z.fromPoint(e.event.getPosition()).elementTransform(this._flowHost).div(this._transform.scale),this._dragContext.draggableItems=[r],queueMicrotask(()=>this._updateConnectionLayer(o.connection))}_pickControlPoint(e){if(this._dragContext.isEmpty())return hD(this._connections,e)}_isValidTrigger(e){return Ct(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new ri(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=y({token:Zs,factory:Zs.\u0275fac})};return t=b([w(Zl)],t),t})(),HN=[DN,ON,NN,kN,RN,AN,FN,BN,GN,qN],Ql=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(i){this.event=i}},VN=1,qo=(()=>{class t extends tt{type="move-node-to-parent";kind="assign-to-container";_store=u(k);_dragSession=u(Q);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(je.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),VN)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(je.GROUPING.DROP_ACTIVE);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}_updateActiveTarget(e){let n=this._getPointerInFlow(e),o=this._findTargetUnderPointer(n);o?this._setActiveTarget(o):this._clearActiveTarget()}_getPointerInFlow(e){let n=Z.fromPoint(this._dragSession.onPointerDownPosition).add(e),o=Z.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(o)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>V.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(je.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(je.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Jl=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(i){this.nodesAndGroups=i}},Nh=class{rootHandlers;participants;constructor(i,e){this.rootHandlers=i,this.participants=e}},Rh=class{fNodeIds;constructor(i){this.fNodeIds=i}},am="move-node",sm="drag-node";function jN(t){return t.getEvent().kind===sm||t.getEvent().fEventType===am}var Pn=(()=>{class t extends tt{type=am;kind=sm;data(){return new Rh(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 o=n.getLastRect();e=e?V.union([e,o]):o}return e??V.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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),eu=class{_limits;_quantizeStep;constructor(i,e=.5){this._limits=i,this._quantizeStep=e}applyInto(i,e){let{min:n,max:o}=this._limits,r=this._clamp(i.x,n.x,o.x),a=this._clamp(i.y,n.y,o.y),s=i.x-r,c=i.y-a,l=this._quantizeSigned(s,this._quantizeStep),f=this._quantizeSigned(c,this._quantizeStep);e.value.x=r,e.value.y=a,e.edges.left=l<0,e.edges.right=l>0,e.edges.top=f<0,e.edges.bottom=f>0,e.overflow.x=Math.abs(l),e.overflow.y=Math.abs(f)}_quantizeSigned(i,e){if(e<=0||i===0)return 0;let n=i/e;return(i>0?Math.ceil(n):Math.floor(n))*e}_clamp(i,e,n){return Math.min(Math.max(i,e),n)}},Ah=class{_pointerDown;_vCellSize;_hCellSize;_snapWhileDragging;constructor(i,e){this._pointerDown=e,this._vCellSize=i.vCellSize(),this._hCellSize=i.hCellSize(),this._snapWhileDragging=i.fCellSizeWhileDragging()}snap(i,e){let n=e||this._snapWhileDragging;return this._strategies[+n](i)}_strategies={0:this._noSnap.bind(this),1:this._snapWithCellSize.bind(this)};_snapWithCellSize(i){return{x:this._snapToGrid(this._pointerDown.x+i.x,this._hCellSize)-this._pointerDown.x,y:this._snapToGrid(this._pointerDown.y+i.y,this._vCellSize)-this._pointerDown.y}}_noSnap(i){return i}_snapToGrid(i,e){return Math.round(i/e)*e}};function v0(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var Fh=class{_snapper;_hardClamp;_hardResult=v0();_softClamps=[];_softResults=[];constructor(i,e,n){let o=i.get(k).fDraggable;this._snapper=new Ah(o,e),this._hardClamp=new eu(n.hard,.5);for(let r of n.soft)this._softClamps.push(new eu(r.limits,.5)),this._softResults.push(v0())}apply(i,e=!1){let n=this._snapper.snap(i,e);this._hardClamp.applyInto(n,this._hardResult);let o={x:this._hardResult.value.x,y:this._hardResult.value.y};for(let r=0;r<this._softClamps.length;r++)this._softClamps[r].applyInto(o,this._softResults[r]);return{hardDelta:o,soft:this._softResults}}finalize(i){return this.apply(i,!0)}};function y0(t,i,e){let{x:n,y:o,width:r,height:a}=t;return e.right&&i.x>0&&(r+=i.x),e.left&&i.x>0&&(n-=i.x,r+=i.x),e.bottom&&i.y>0&&(a+=i.y),e.top&&i.y>0&&(o-=i.y,a+=i.y),V.initialize(n,o,r,a)}var Lh=class extends tt{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=am;kind=sm;_startPosition=A.initialize();_startRect=V.initialize();_applyConstraints=i=>i;_lastSoftResults=[];_deltaConstraints;_constraints;_lastPosition=A.initialize();_softParentConnectionHandlers=[];_mediator;constructor(i,e,n=[],o=[],r=[]){super(),this._injector=i,this.nodeOrGroup=e,this.children=n,this.sourceConnectionHandlers=o,this.targetConnectionHandlers=r,this._mediator=i.get(D),this._startRect=this._mediator.execute(new Fe(e.hostElement)),this._startPosition=ce({},e._position)}setConstraints(i){this._constraints=i,this._deltaConstraints=new Fh(this._injector,this._startPosition,i),this._applyConstraints=e=>{let n=this._deltaConstraints.apply(e);return this._applySoftExpansions(n.soft),n.hardDelta}}setSoftParentConnectionHandlers(i){this._softParentConnectionHandlers=i}finalizeConstraints(){this._applyConstraints=i=>{let e=this._deltaConstraints.finalize(i);return this._applySoftExpansions(e.soft),e.hardDelta}}getLastRect(){return V.initialize(this._lastPosition.x,this._lastPosition.y,this._startRect.width,this._startRect.height)}prepareDragSequence(){for(let i of this.children)i.prepareDragSequence();this.nodeOrGroup.hostElement.classList.add(je.DRAG_AND_DROP.DRAGGING)}onPointerMove(i){let e=this._applyConstraints(i);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 i of this.children)i.onPointerUp();this.nodeOrGroup.position.set(this.nodeOrGroup._position),this.nodeOrGroup.hostElement.classList.remove(je.DRAG_AND_DROP.DRAGGING),this._emitExpandedEvent()}_startPlus(i){return A.sum(this._startPosition,i)}_redraw(i){this._lastPosition=i,this.nodeOrGroup.updatePosition(i),this._mediator.execute(new ei(this.nodeOrGroup.fId(),V.initialize(i.x,i.y,this._startRect.width,this._startRect.height))),this.nodeOrGroup.redraw()}_applySoftExpansions(i){this._lastSoftResults=i;for(let e=0;e<i.length;e++){let n=i[e],o=this._constraints.soft[e],r=y0(o.boundingRect,n.overflow,n.edges);this._commitParentRect(o.nodeOrGroup,r)&&this._updateParentConnectionHandlers(e)}}_commitParentRect(i,e){let n=i._position.x!==e.x||i._position.y!==e.y||i._size?.width!==e.width||i._size?.height!==e.height;return i.updateSize({width:e.width,height:e.height}),i.updatePosition({x:e.x,y:e.y}),this._mediator.execute(new ei(i.fId(),e)),i.redraw(),n}_updateParentConnectionHandlers(i){let e=this._softParentConnectionHandlers[i];if(!e)return;let n=new Map;for(let o of e.source){let r=this._readConnectorRect(o.connector,n);o.handler.setSourceDelta(this._buildDelta(o.baselineRect,r))}for(let o of e.target){let r=this._readConnectorRect(o.connector,n);o.handler.setTargetDelta(this._buildDelta(o.baselineRect,r))}}_readConnectorRect(i,e){let n=`${i.kind}::${i.fId()}`,o=e.get(n);if(o)return o;let r=this._mediator.execute(new ut(i)).rect;return e.set(n,r),r}_buildDelta(i,e){return A.initialize(e.x-i.x,e.y-i.y)}_emitExpandedEvent(){for(let i=0;i<this._lastSoftResults.length;i++){let e=this._lastSoftResults[i];if(!e.overflow.x&&!e.overflow.y)continue;let n=this._constraints.soft[i],o=y0(n.boundingRect,e.overflow,e.edges);n.nodeOrGroup.sizeChange.emit(o)}}destroy(){for(let i of this.children)i.destroy?.();this.children=[],this.sourceConnectionHandlers=[],this.targetConnectionHandlers=[],this._lastSoftResults=[],this._applyConstraints=i=>i,this._softParentConnectionHandlers=[]}},UN=(()=>{let t=class Qs{_injector=u(Ye);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),o=this._linkParentsAndCollectRoots(e,n);return new Nh(o,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let o of e)n.set(o.fId(),new Lh(this._injector,o));return n}_linkParentsAndCollectRoots(e,n){let o=[];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):o.push(a)}return o}static \u0275fac=function(n){return new(n||Qs)};static \u0275prov=y({token:Qs,factory:Qs.\u0275fac})};return t=b([w(Jl)],t),t})(),tu=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(i){this.nodeOrGroup=i}},Go=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(i,e){this.nodeOrGroup=i,this.childrenPaddings=e}},zh=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(i,e,n,o){this.nodeOrGroup=i,this.boundingRect=e,this.innerRect=n,this.paddings=o}},WN=(()=>{let t=class Js{_mediator=u(D);handle({nodeOrGroup:e,childrenPaddings:n}){let o=this._readBoundingRect(e),r=this._readOwnPaddings(e,o),a=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],s=V.initialize(o.x+a[0],o.y+a[1],o.width-a[0]-a[2],o.height-a[1]-a[3]);return new zh(e,o,s,a)}_readBoundingRect(e){return this._mediator.execute(new Fe(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new oi(e,n))}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=y({token:Js,factory:Js.\u0275fac})};return t=b([w(Go)],t),t})(),$N=(()=>{let t=class ec{_mediator=u(D);handle({nodeOrGroup:e}){let n=this._readCurrentRect(e),o=this._readParentsChain(e);return this._buildConstraints(o,n)}_readCurrentRect(e){return this._mediator.execute(new Fe(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Vi(e))??[]}_buildConstraints(e,n){let o=[],r=X0(),a=[0,0,0,0];for(let s of e){let c=this._readParentBounds(s,a);a=c.paddings;let l=this._calculateDifference(c.innerRect,n);if(this._isAutoExpand(s))o.push(this._makeSoftLimit(s,c.boundingRect,l));else{r=l;break}}return{soft:o,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new Go(e,n))}_calculateDifference(e,n){return{min:this._calculateMinimumDifference(e,n),max:this._calculateMaximumDifference(e,n)}}_calculateMinimumDifference(e,n){return A.initialize(e.x-n.x,e.y-n.y)}_calculateMaximumDifference(e,n){return A.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,o){return{nodeOrGroup:e,boundingRect:n,initialSize:e._size,limits:o}}static \u0275fac=function(n){return new(n||ec)};static \u0275prov=y({token:ec,factory:ec.\u0275fac})};return t=b([w(tu)],t),t})(),nu=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(i,e){this.rootHandlers=i,this.participants=e}},iu=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.constraints=e,this.handlerPool=n}},Ho=class{_mediator=u(D);_store=u(k);_behaviour=u(Ki);_source;_target;_sourceRef;_targetRef;_sourceDelta=A.initialize();_targetDelta=A.initialize();connection;initialize(i){this.connection=i,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(i){this._sourceDelta=i,this._mediator.execute(new Jn(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,i)))}setTargetDelta(i){this._targetDelta=i,this._mediator.execute(new Jn(this._target.fId(),this._target.kind,this._withDelta(this._targetRef.rect,i)))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=Le.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=Le.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new Pt(i,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(i){return this._mediator.execute(new ut(i))}_withDelta(i,e){return Le.fromRoundedRect(i).addPoint(e)}_resolveRotationContext(i){return this._mediator.execute(new Zt(i))}},Vo=(()=>{class t extends Ho{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jo=(()=>{class t extends Ho{_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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Uo=(()=>{class t extends Ho{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),KN=(()=>{let t=class tc{_store=u(k);_mediator=u(D);_dragInjector=u(Ke);handle({dragHandler:e,constraints:n,handlerPool:o}){let r=n.soft.map(a=>this._buildParentConnectionHandlers(a.nodeOrGroup,o));e.setSoftParentConnectionHandlers(r)}_buildParentConnectionHandlers(e,n){let o=this._store.outputs.getAll().filter(f=>f.fNodeId===e.fId()),r=this._store.inputs.getAll().filter(f=>f.fNodeId===e.fId());if(!o.length&&!r.length)return{source:[],target:[]};let a=new Set(o.map(f=>f.fId())),s=new Set(r.map(f=>f.fId())),c=new Map,l={source:[],target:[]};for(let f of this._store.connections.getAll()){let m=a.has(f.fOutputId()),x=s.has(f.fInputId());if(!m&&!x)continue;let P=this._getExistingConnectionHandler(n,f);if(P||(P=this._createConnectionHandler(f,m,x),n.push(P)),m){let E=this._store.outputs.require(f.fOutputId());l.source.push({handler:P,connector:E,baselineRect:this._readConnectorRect(E,c)})}if(x){let E=this._store.inputs.require(f.fInputId());l.target.push({handler:P,connector:E,baselineRect:this._readConnectorRect(E,c)})}}return l}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n,o){let r;return n&&o?r=this._dragInjector.createInstance(jo):n?r=this._dragInjector.createInstance(Vo):r=this._dragInjector.createInstance(Uo),r.initialize(e),r}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let a=this._mediator.execute(new ut(e)).rect;return n.set(o,a),a}static \u0275fac=function(n){return new(n||tc)};static \u0275prov=y({token:tc,factory:tc.\u0275fac})};return t=b([w(iu)],t),t})(),YN=(()=>{let t=class nc{_dragInjector=u(Ke);_mediator=u(D);handle({rootHandlers:e,participants:n}){let o=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,o);let r=this._dragInjector.createInstance(Pn);return r.initialize(n,e),r}_applyConstraintsToRoots(e,n){for(let o of e){let r=this._calculateConstraints(o.nodeOrGroup);o.setConstraints(r),this._attachSoftParentConnectionHandlers(o,r,n)}}_collectConnectionHandlers(e){let n=new Map;for(let o of e){for(let r of o.sourceConnectionHandlers)n.set(r.connection.fId(),r);for(let r of o.targetConnectionHandlers)n.set(r.connection.fId(),r)}return Array.from(n.values())}_attachSoftParentConnectionHandlers(e,n,o){this._mediator.execute(new iu(e,n,o))}_calculateConstraints(e){return this._mediator.execute(new tu(e))}static \u0275fac=function(n){return new(n||nc)};static \u0275prov=y({token:nc,factory:nc.\u0275fac})};return t=b([w(nu)],t),t})(),ou=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.sourceIds=e,this.handlerPool=n}},XN=(()=>{let t=class ic{_store=u(k);_dragInjector=u(Ke);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(o=>n.has(o.fInputId()))}_getNodeInputIds(e){return this._store.inputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let o=this._getExistingConnectionHandler(n.handlerPool,e);o||(o=this._createConnectionHandler(n.sourceIds,e),n.handlerPool.push(o)),n.dragHandler.targetConnectionHandlers.push(o)}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n){let o;return e.includes(n.fOutputId())?o=this._dragInjector.createInstance(jo):o=this._dragInjector.createInstance(Uo),o.initialize(n),o}static \u0275fac=function(n){return new(n||ic)};static \u0275prov=y({token:ic,factory:ic.\u0275fac})};return t=b([w(ou)],t),t})(),ru=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.targetIds=e,this.handlerPool=n}},ZN=(()=>{let t=class oc{_store=u(k);_dragInjector=u(Ke);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(o=>n.has(o.fOutputId()))}_getNodeOutputIds(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let o=this._getExistingConnectionHandler(n.handlerPool,e);o||(o=this._createConnectionHandler(n.targetIds,e),n.handlerPool.push(o)),n.dragHandler.sourceConnectionHandlers.push(o)}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n){let o;return e.includes(n.fInputId())?o=this._dragInjector.createInstance(jo):o=this._dragInjector.createInstance(Vo),o.initialize(n),o}static \u0275fac=function(n){return new(n||oc)};static \u0275prov=y({token:oc,factory:oc.\u0275fac})};return t=b([w(ru)],t),t})(),au=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(i){this.nodeOrGroup=i}},QN=(()=>{let t=class rc{_mediator=u(D);_store=u(k);_dragSession=u(Q);handle({nodeOrGroup:e}){let n=this._collectSelected(e),o=this._withDeepChildren(n),r=this._mediator.execute(new Jl(o)),a=this._collectSourceConnectorIds(o),s=this._collectTargetConnectorIds(o);return this._attachConnectionHandlers(r.participants,a,s),this._mediator.execute(new nu(r.rootHandlers,r.participants))}_collectSelected(e){let n=[];for(let o of this._dragSession.selectedItems){let r=this._findNodeByHost(o.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 o of e){n.push(o);let r=this._mediator.execute(new $i(o.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return Lp(e,n=>this._store.outputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_collectTargetConnectorIds(e){return Lp(e,n=>this._store.inputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_attachConnectionHandlers(e,n,o){let r=[];for(let a of e)this._mediator.execute(new ru(a,o,r)),this._mediator.execute(new ou(a,n,r))}static \u0275fac=function(n){return new(n||rc)};static \u0275prov=y({token:rc,factory:rc.\u0275fac})};return t=b([w(au)],t),t})(),JN=[UN,$N,YN,XN,ZN,KN,WN,QN];function eR(t,i,e=10){let n=i.x,o=i.y,r=n+i.width,a=o+i.height,s=i.gravityCenter.x,c=i.gravityCenter.y,l,f,m=1/0,x,P,E=1/0,N=(L,U)=>{let ie=U<0?-U:U;ie<=e&&ie<m&&(m=ie,l=L,f=U)},j=(L,U)=>{let ie=U<0?-U:U;ie<=e&&ie<E&&(E=ie,x=L,P=U)};for(let L=0;L<t.length;L++){let U=t[L],ie=U.x,xe=U.y,le=ie+U.width,He=xe+U.height,rn=U.gravityCenter.x,Dt=U.gravityCenter.y;N(ie,n-ie),N(le,n-le),N(rn,s-rn),N(ie,r-ie),N(le,r-le),j(xe,o-xe),j(He,o-He),j(Dt,c-Dt),j(xe,a-xe),j(He,a-He)}return{x:{guide:l,delta:f},y:{guide:x,delta:P}}}var C0=["left","top","width","height"],su=class{_element;constructor(i,e,n="f-line"){this._element=i.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(i){for(let e of C0){let n=i[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let i of C0)this._element.style.removeProperty(i)}destroy(){this._element.remove()}},Bh=class{_horizontal;_vertical;constructor(i,e){this._horizontal=new su(i,e),this._vertical=new su(i,e),this._horizontal.hide(),this._vertical.hide()}drawVerticalLine(i,e,n){this._vertical.show(),this._vertical.render({left:i*n.scale+n.position.x+n.scaledPosition.x,top:0,width:1,height:e.height})}drawHorizontalLine(i,e,n){this._horizontal.show(),this._horizontal.render({left:0,top:i*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()}},cu=class{static fToken=Symbol("MagneticLinesPreparationRequest")},tR=(()=>{let t=class ac{_mediator=u(D);_store=u(k);_browser=u(ze);_injector=u(Ye);_dragSession=u(Q);_renderer;handle(e){let n=this._store.instances.get(Te.MAGNETIC_LINES);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof Pn);o&&o.setMagneticLines(new qh(this._injector,this._renderer??this._createRenderer(n),this._flowHostSize(),this._notDraggedRects(this._draggedNodes(o.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_flowHostSize(){return this._store.flowHost.getBoundingClientRect()}_createRenderer({hostElement:e}){return this._renderer=new Bh(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 Fe(r.hostElement)))}static \u0275fac=function(n){return new(n||ac)};static \u0275prov=y({token:ac,factory:ac.\u0275fac})};return t=b([w(cu)],t),t})(),qh=class{_renderer;_size;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;constructor(i,e,n,o){this._renderer=e,this._size=n,this._rects=o;let r=i.get(k);this._alignThreshold=r.instances.require(Te.MAGNETIC_LINES).threshold(),this._canvasTransform=r.transform}scheduleRender(i){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderGuides(this._computeGuides(i)),15)}_renderGuides(i){this._renderVertical(i),this._renderHorizontal(i)}_renderVertical(i){i.x.guide!==void 0?this._renderer.drawVerticalLine(i.x.guide,this._size,this._canvasTransform):this._renderer.hideVertical()}_renderHorizontal(i){i.y.guide!==void 0?this._renderer.drawHorizontalLine(i.y.guide,this._size,this._canvasTransform):this._renderer.hideHorizontal()}_computeGuides(i){return eR(this._rects,i,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},x0=["top","center","bottom"],b0=["left","center","right"];function nR(t,i,e=10,n=10){let o=i.x,r=i.y,a=o+i.width,s=r+i.height,c=i.gravityCenter.x,l=i.gravityCenter.y,f=iR(t,i,o,r,a,s,c,l,e,n),m=oR(t,i,o,r,a,s,c,l,e,n);return f&&(!m||f.absDelta<=m.absDelta)?{axis:"x",delta:f.delta,gap:f.gap,rects:f.rects,alignMode:f.alignMode,crossDelta:f.crossDelta}:m?{axis:"y",delta:m.delta,gap:m.gap,rects:m.rects,alignMode:m.alignMode,crossDelta:m.crossDelta}:{rects:[]}}function iR(t,i,e,n,o,r,a,s,c,l){let f=1/0,m,x=0,P,E=[],N=0,j=[],L=[],U=[];for(let ie=0;ie<x0.length;ie++){let xe=ie===0?n:ie===1?s:r;j.length=0,L.length=0,U.length=0;let le=1/0,He=-1/0,rn=0,Dt=1/0,fo=1/0;for(let ye=0;ye<t.length;ye++){let fe=t[ye],ho=ie===0?fe.y:ie===1?fe.gravityCenter.y:fe.y+fe.height,bp=xe-ho,$t=Oi(bp);if($t>c)continue;j.push(ye),L.push(fe.x),U.push(fe.x+fe.width);let mo=fe.y,_o=fe.y+fe.height;mo<le&&(le=mo),_o>He&&(He=_o),($t<Dt||$t===Dt&&ye<fo)&&(Dt=$t,rn=ho,fo=ye)}let We=j.length;if(We<2)continue;sv(j,L,U);let Be=0;for(;Be<We&&L[Be]<=a;)Be++;let qn=Be>0&&Be<We,Qe,rt;qn?(Qe=Be-1,rt=Be):Be<=0?(Qe=0,rt=1):(Qe=We-2,rt=We-1);let at=L[rt]-U[Qe];if(at<0)continue;let Ue;if(qn){Ue=U[Qe]+at;let ye=Ue+i.width,fe=L[rt]-ye;if(Oi(fe-at)>l)continue}else Be<=0?Ue=L[0]-at-i.width:Ue=U[We-1]+at;let po=e-Ue,Gn=Oi(po);if(Gn>l||Gn>=f)continue;let St=rR(j,L,U,le,He);if(qn){let ye=Ue,fe=Ue+i.width;St.push({left:U[Qe],top:le,width:ye-U[Qe],height:He-le}),St.push({left:fe,top:le,width:L[rt]-fe,height:He-le})}else if(Be<=0){let ye=Ue+i.width;St.push({left:ye,top:le,width:L[0]-ye,height:He-le})}else St.push({left:U[We-1],top:le,width:Ue-U[We-1],height:He-le});let xp=xe-rn;f=Gn,m=po,x=at,P=x0[ie],E=St,N=xp}if(!(m===void 0||P===void 0))return{delta:m,absDelta:f,gap:x,rects:E,alignMode:P,crossDelta:N}}function oR(t,i,e,n,o,r,a,s,c,l){let f=1/0,m,x=0,P,E=[],N=0,j=[],L=[],U=[];for(let ie=0;ie<b0.length;ie++){let xe=ie===0?e:ie===1?a:o;j.length=0,L.length=0,U.length=0;let le=1/0,He=-1/0,rn=0,Dt=1/0,fo=1/0;for(let ye=0;ye<t.length;ye++){let fe=t[ye],ho=ie===0?fe.x:ie===1?fe.gravityCenter.x:fe.x+fe.width,bp=xe-ho,$t=Oi(bp);if($t>c)continue;j.push(ye),L.push(fe.y),U.push(fe.y+fe.height);let mo=fe.x,_o=fe.x+fe.width;mo<le&&(le=mo),_o>He&&(He=_o),($t<Dt||$t===Dt&&ye<fo)&&(Dt=$t,rn=ho,fo=ye)}let We=j.length;if(We<2)continue;sv(j,L,U);let Be=0;for(;Be<We&&L[Be]<=s;)Be++;let qn=Be>0&&Be<We,Qe,rt;qn?(Qe=Be-1,rt=Be):Be<=0?(Qe=0,rt=1):(Qe=We-2,rt=We-1);let at=L[rt]-U[Qe];if(at<0)continue;let Ue;if(qn){Ue=U[Qe]+at;let ye=Ue+i.height,fe=L[rt]-ye;if(Oi(fe-at)>l)continue}else Be<=0?Ue=L[0]-at-i.height:Ue=U[We-1]+at;let po=n-Ue,Gn=Oi(po);if(Gn>l||Gn>=f)continue;let St=aR(j,L,U,le,He);if(qn){let ye=Ue,fe=Ue+i.height;St.push({left:le,top:U[Qe],width:He-le,height:ye-U[Qe]}),St.push({left:le,top:fe,width:He-le,height:L[rt]-fe})}else if(Be<=0){let ye=Ue+i.height;St.push({left:le,top:ye,width:He-le,height:L[0]-ye})}else St.push({left:le,top:U[We-1],width:He-le,height:Ue-U[We-1]});let xp=xe-rn;f=Gn,m=po,x=at,P=b0[ie],E=St,N=xp}if(!(m===void 0||P===void 0))return{delta:m,absDelta:f,gap:x,rects:E,alignMode:P,crossDelta:N}}function rR(t,i,e,n,o){let r=[],a=o-n;for(let s=0;s<t.length-1;s++){let c=i[s+1]-e[s];c<0||r.push({left:e[s],top:n,width:c,height:a})}return r}function aR(t,i,e,n,o){let r=[],a=o-n;for(let s=0;s<t.length-1;s++){let c=i[s+1]-e[s];c<0||r.push({left:n,top:e[s],width:a,height:c})}return r}function sv(t,i,e){for(let n=1;n<i.length;n++){let o=i[n],r=e[n],a=t[n],s=n-1;for(;s>=0;){let c=i[s],l=t[s];if(c<o||c===o&&l<a)break;i[s+1]=c,e[s+1]=e[s],t[s+1]=l,s--}i[s+1]=o,e[s+1]=r,t[s+1]=a}}function Oi(t){return t<0?-t:t}var Gh=class{_element;_isVisible=!1;_left=Number.NaN;_top=Number.NaN;_width=Number.NaN;_height=Number.NaN;constructor(i,e,n="f-rect"){this._element=i.document.createElement("div"),this._element.classList.add(n);let o=this._element.style;o.position="absolute",o.display="none",o.boxSizing="border-box",o.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(i,e,n,o){let r=this._element.style;i!==this._left&&(this._left=i,r.left=i+"px"),e!==this._top&&(this._top=e,r.top=e+"px"),n!==this._width&&(this._width=n,r.width=n+"px"),o!==this._height&&(this._height=o,r.height=o+"px")}clearRect(){this._left=Number.NaN,this._top=Number.NaN,this._width=Number.NaN,this._height=Number.NaN;let i=this._element.style;i.removeProperty("left"),i.removeProperty("top"),i.removeProperty("width"),i.removeProperty("height")}destroy(){this._element.remove()}},Hh=class{_browser;_hostElement;_className;_pool=[];_activeCount=0;constructor(i,e,n="f-rect"){this._browser=i,this._hostElement=e,this._className=n}draw(i,e){let n=e.scale,o=e.position.x+e.scaledPosition.x,r=e.position.y+e.scaledPosition.y;for(let a=0;a<i.length;a++){let s=this._getOrCreate(a),c=i[a];s.show(),s.render(c.left*n+o,c.top*n+r,c.width*n,c.height*n)}for(let a=i.length;a<this._activeCount;a++)this._pool[a].hide();this._activeCount=i.length}hideAll(){for(let i=0;i<this._activeCount;i++)this._pool[i].hide();this._activeCount=0}destroy(){for(let i of this._pool)i.destroy();this._pool.length=0,this._activeCount=0}_getOrCreate(i){if(i<this._pool.length)return this._pool[i];let e=new Gh(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},du=class{static fToken=Symbol("MagneticRectsPreparationRequest")},sR=(()=>{let t=class sc{_mediator=u(D);_store=u(k);_browser=u(ze);_injector=u(Ye);_dragSession=u(Q);_renderer;handle(e){let n=this._store.instances.get(Te.MAGNETIC_RECTS);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof Pn);o&&o.setMagneticRects(new Vh(this._injector,this._getRenderer(n),this._notDraggedRects(this._draggedNodes(o.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_getRenderer(e){return this._renderer||(this._renderer=new Hh(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 Fe(r.hostElement)))}static \u0275fac=function(n){return new(n||sc)};static \u0275prov=y({token:sc,factory:sc.\u0275fac})};return t=b([w(du)],t),t})(),Vh=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(i,e,n){this._renderer=e,this._rects=n;let o=i.get(k),r=o.instances.require(Te.MAGNETIC_RECTS);this._alignThreshold=r.alignThreshold(),this._spacingThreshold=r.spacingThreshold(),this._canvasTransform=o.transform}scheduleRender(i){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderRects(this._computeRects(i)),15)}_renderRects(i){if(i.axis!==void 0&&i.delta!==void 0&&i.rects.length>0){this._renderer.draw(i.rects,this._canvasTransform);return}this._renderer.hideAll()}_computeRects(i){return nR(this._rects,i,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},lu=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(i){this.event=i}},jh=class{nodes;fNodes;constructor(i){this.nodes=i,this.fNodes=i}},cR=(()=>{let t=class cc{_mediator=u(D);_store=u(k);_dragSession=u(Q);_dragHandler;handle({event:e}){if(this._dragHandler=this._getDragHandler(),!this._dragHandler)return;let n=this._buildDragDelta(e.getPosition()),o=this._dragHandler.calculateMagneticSnaps(n),r=this._applySnapToDelta(n,o.lines,o.rects);this._finalizeMove(this._dragHandler,r),this._emitNodeIntersectIfNeeded(this._dragHandler)}_getDragHandler(){return this._dragSession.draggableItems.find(jN)}_buildDragDelta(e){return Z.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,o){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(o)&&(o.axis==="x"?(r=e.x-o.delta,a=e.y-(o.crossDelta??0)):(a=e.y-o.delta,r=e.x-(o.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 o of e.roots)o.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 jh(a)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new Rl(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||cc)};static \u0275prov=y({token:cc,factory:cc.\u0275fac})};return t=b([w(lu)],t),t})(),uu=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(i,e){this.event=i,this.trigger=e}},dR=(()=>{let t=class dc{_mediator=u(D);_store=u(k);_dragSession=u(Q);handle({event:e,trigger:n}){if(!this._canStartDrag(e,n))return;let o=this._findDraggableNode(e.targetElement);o&&(this._storePointerDownContext(e),this._dragSession.draggableItems=[this._buildDragNodeHandler(o)],this._mediator.execute(new cu),this._mediator.execute(new du))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&Ct(e.originalEvent,n)}_isDragHandle(e){return bo(e,".f-drag-handle")}_findDraggableNode(e){let n=this._store.nodes.getAll();for(let o of n)if(!o.fDraggingDisabled()&&o.isContains(e))return o}_storePointerDownContext(e){this._dragSession.onPointerDownScale=this._store.transform.scale,this._dragSession.onPointerDownPosition=Z.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new Wi(e))}),this._mediator.execute(new au(e))}static \u0275fac=function(n){return new(n||dc)};static \u0275prov=y({token:dc,factory:dc.\u0275fac})};return t=b([w(uu)],t),t})(),lR=[...JN,tR,sR,cR,dR],Uh=class{targetGroupId;nodeIds;dropPosition;fTargetNode;fNodes;fDropPosition;constructor(i,e,n){this.targetGroupId=i,this.nodeIds=e,this.dropPosition=n,this.fTargetNode=i,this.fNodes=e,this.fDropPosition=n}},uR=(()=>{let t=class lc{_dragSession=u(Q);_store=u(k);handle({event:e}){let n=this._findDropHandler();if(!n)return;let o=n.activeTarget?.node;o&&this._emitDropToGroupEvent(o.fId(),e),n.onPointerUp?.()}_findDropHandler(){return this._dragSession.draggableItems.find(e=>e instanceof qo)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new Uh(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(a=>a.nodeOrGroup),o=new Set(n.map(a=>a.fId())),r=[];for(let a of n){let s=a.fParentId();(!s||!o.has(s))&&r.push(a.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof Pn);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||lc)};static \u0275prov=y({token:lc,factory:lc.\u0275fac})};return t=b([w(Ql)],t),t})(),fu=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(i){this.event=i}},pu=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(i){this.candidates=i}},fR=(()=>{let t=class uc{handle({candidates:e}){let n=e.map((o,r)=>({candidate:o,index:r}));return n.sort((o,r)=>{let a=this._compareDomOrder(o.candidate.node.hostElement,r.candidate.node.hostElement);return a!==0?-a:o.index-r.index}),n.map(o=>o.candidate)}_compareDomOrder(e,n){if(e===n)return 0;let o=e.compareDocumentPosition(n);if((o&Node.DOCUMENT_POSITION_FOLLOWING)!==0)return-1;if((o&Node.DOCUMENT_POSITION_PRECEDING)!==0)return 1;if(o&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=b([w(pu)],t),t})(),Wh=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(i,e,n){this._onPointerDown=e,this._limit=n;let o=i.get(k);this._vCellSize=o.fDraggable.vCellSize(),this._hCellSize=o.fDraggable.hCellSize(),this._adjustCellSize=o.fDraggable.fCellSizeWhileDragging()}limit(i){let{min:e,max:n}=this._limit,{x:o,y:r}=this._cellSizeStrategies[+this._adjustCellSize](i);return{x:this._clamp(o,e.x,n.x),y:this._clamp(r,e.y,n.y)}}_cellSizeStrategies={0:this._skipCellSize.bind(this),1:this._applyCellSize.bind(this)};_applyCellSize(i){return{x:this._snapToGrid(this._onPointerDown.x+i.x,this._hCellSize)-this._onPointerDown.x,y:this._snapToGrid(this._onPointerDown.y+i.y,this._vCellSize)-this._onPointerDown.y}}_skipCellSize(i){return i}_clamp(i,e,n){return Math.min(Math.max(i,e),n)}_snapToGrid(i,e){return Math.round(i/e)*e}},hu=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(i){this.externalItem=i}},pR=(()=>{let t=class fc{_browser=u(ze);_containerRef=u(Wr);handle({externalItem:e}){let{hostElement:n,placeholder:o}=e,r=o(),a=r?this._fromTemplate(r):this._fromHost(n);return a.classList.add("f-external-item-placeholder"),a.style.pointerEvents="none",a}_fromTemplate(e){return qp(this._createViewRef(e),this._browser.document)}_fromHost(e){return zp(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||fc)};static \u0275prov=y({token:fc,factory:fc.\u0275fac})};return t=b([w(hu)],t),t})(),mu=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(i){this.externalItem=i}},hR=(()=>{let t=class pc{_browser=u(ze);_containerRef=u(Wr);handle({externalItem:e}){let{hostElement:n,preview:o}=e,r=o(),a=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(a),t0(a),a.classList.add("f-external-item-preview"),a}_fromTemplate(e){return qp(this._createViewRef(e),this._browser.document)}_fromHost(e){return zp(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){Bp(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||pc)};static \u0275prov=y({token:pc,factory:pc.\u0275fac})};return t=b([w(mu)],t),t})(),_u=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(i){this.event=i}},$h=class{externalItemRect;data;targetContainerId;dropPosition;rect;fTargetNode;fDropPosition;constructor(i,e,n,o){this.externalItemRect=i,this.data=e,this.targetContainerId=n,this.dropPosition=o,this.rect=i,this.fTargetNode=n,this.fDropPosition=o}},mR="external-item",_R="drag-external-item";function gR(t){return t.getEvent().kind===_R||t.getEvent().fEventType===mR}var vR=(()=>{let t=class hc{_result=u(Mn);_mediator=u(D);_store=u(k);_dragSession=u(Q);_browser=u(ze);get _createNodeEmitter(){return this._store.fDraggable?.fCreateNode}handle(e){let n=this._findExternalItemHandler();if(!n)return;let o=this._getDestinationNodeOrGroupId();this._emitEvent(this._getElementsFromPoint(e.event.getPosition()),o,e.event.getPosition()),n.onPointerUp(),this._dragSession.draggableItems=[]}_findExternalItemHandler(){return this._dragSession.draggableItems.find(e=>gR(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 qo);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,o){this._isPointerInCanvasRect(e)&&this._createNodeEmitter?.emit(new $h(this._getPreviewRect(),this._result.getData().externalItem.data(),n,n?o:void 0))}_isPointerInCanvasRect(e){return e.length?this._store.flowHost.contains(e[0]):!1}_getPreviewRect(){return this._mediator.execute(new Fe(this._result.getData().preview))}static \u0275fac=function(n){return new(n||hc)};static \u0275prov=y({token:hc,factory:hc.\u0275fac})};return t=b([w(_u)],t),t})(),Kh=class{data;constructor(i){this.data=i}},gu=class extends tt{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new Kh(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=V.initialize();_pointerDownRect=V.initialize();_absoluteOffsetFromFlow=A.initialize();_grabOffsetFromPointer=A.initialize();_originalParent;_originalNextSibling;_originalDisplay;_applyConstraints=i=>i;constructor(i,e,n){super(),this._externalItem=e,this._pointerDownClientPosition=n,this._store=i.get(k),this._result=i.get(Mn),this._mediator=i.get(D),this._browser=i.get(ze),this._originalDisplay=this._host.style.display,this._initConstraints(i)}get _host(){return this._externalItem.hostElement}get _overlayRoot(){return this._browser.document.fullscreenElement??this._browser.document.body}get _transform(){return this._store.transform}_initConstraints(i){this._startRect=this._getStartRect();let e=new Wh(i,this._startRect,X0());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new Fe(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=Z.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 i=this._host.parentNode;if(!i){this._originalParent=void 0,this._originalNextSibling=null;return}this._originalParent=i,this._originalNextSibling=this._host.nextSibling}_createPreview(){let i=this._mediator.execute(new mu(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(i,this._pointerDownRect),i.style.transform=w0(this._pointerDownRect),i}_createPlaceholder(){return this._mediator.execute(new hu(this._externalItem))}_placePreviewIntoOverlay(){this._overlayRoot.appendChild(this._previewEl)}_swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(){let i=this._originalParent,e=this._placeholderEl;if(!i||!e)return;let n=i.replaceChild(e,this._host);this._overlayRoot.appendChild(n),this._host.style.display="none"}onPointerMove(i,e){if(!this._previewEl)return;let n=this._resolveDeltaFromPointer(i,e),o=this._applyConstraints(n),r=Z.fromPoint(this._startRect).add(o),a=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=w0(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 i=this._originalParent,e=this._placeholderEl;if(!(!i||!e)){if(e.parentNode===i){i.replaceChild(this._host,e);return}this._originalNextSibling&&this._originalNextSibling.parentNode===i?i.insertBefore(this._host,this._originalNextSibling):i.appendChild(this._host)}}_matchSize(i,e){i.style.width=`${e.width}px`,i.style.height=`${e.height}px`}_readAbsoluteRect(i){let e=i.getBoundingClientRect(),n=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,o=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return V.initialize(e.left+o,e.top+n,e.width,e.height)}_toAbsolutePoint(i){let e=Z.fromPoint(this._transform.position).add(this._transform.scaledPosition);return Z.fromPoint(i).mult(this._transform.scale).add(e).add(this._getFlowHostAbsolutePosition())}_resolveDeltaFromPointer(i,e){let n=e?.getPosition();if(!n)return i;let o=this._clientToAbsolute(n).sub(this._grabOffsetFromPointer),r=this._toFlowPoint(o);return Z.fromPoint(r).sub(this._startRect)}_toFlowPoint(i){let e=this._getFlowHostAbsolutePosition(),n=Z.fromPoint(this._transform.position).add(this._transform.scaledPosition);return Z.fromPoint(i).sub(e).sub(n).div(this._transform.scale)}_getFlowHostAbsolutePosition(){let i=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 A.initialize(i.left+n,i.top+e)}_clientToAbsolute(i){let e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return Z.fromPoint(i).add(A.initialize(n,e))}};function w0({x:t,y:i}){return`translate3d(${Math.round(t)}px, ${Math.round(i)}px, 0)`}var vu=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function yR(t){return!!t.closest?.("[fExternalItem]")}function CR(t){return t.closest("[fExternalItem]")}var xR=(()=>{class t{_byHost=new Map;_items=z([]);items=S(()=>this._items());getByElement(e){let n=CR(e);return n?this._byHost.get(n):void 0}getByHost(e){return this._byHost.get(e)}register(e){let n=e.hostElement,o=this._byHost.get(n);o!==e&&(o&&o!==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 bR=(()=>{let t=class mc{_apiService=u(xR);_dragSession=u(Q);_store=u(k);_injector=u(Ye);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!Ct(e.originalEvent,n))return;let o=this._resolveExternalItem(e.targetElement);if(!o||o.disabled())return;let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=Z.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new gu(this._injector,o,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=b([w(vu)],t),t})(),yu=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(i){this.event=i}},wR=(()=>{let t=class _c{handle(e){this._isTargetItemExternal(e.event)&&e.event.preventDefault()}_isTargetItemExternal(e){let n=this._isExternalItem(e.target),o=this._isExternalItem(e.target.parentNode);return n||o}_isExternalItem(e){let n=!1;try{n=yR(e)}catch{}return n}static \u0275fac=function(n){return new(n||_c)};static \u0275prov=y({token:_c,factory:_c.\u0275fac})};return t=b([w(yu)],t),t})(),SR=[pR,hR,vR,bR,wR],TR=(()=>{let t=class gc{_mediator=u(D);_dragContext=u(Q);_store=u(k);_dragInjector=u(Ke);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 o=this._sortedTargetsForDrop();if(n){let a=n.fParentId(),s=this._mediator.execute(new Yu(a));s.length&&(o=o.filter(c=>s.includes(c.node.fId())))}let r=this._dragInjector.get(qo);r.initialize(o),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof Pn)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof gu)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(s=>s instanceof Eh),o=this._withParents(e),a=this._eligibleTargets(o,n).map(s=>{let c=this._mediator.execute(new Fe(s.hostElement));return{node:s,rect:c}});return this._mediator.execute(new pu(a))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof Pn);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,o)=>{n.push(o);let r=this._mediator.execute(new Vi(o));return n.push(...r),n},[])}_eligibleTargets(e,n){let o=this._allNodes.filter(r=>!e.includes(r));return n?o.filter(r=>r instanceof Eh):o}static \u0275fac=function(n){return new(n||gc)};static \u0275prov=y({token:gc,factory:gc.\u0275fac})};return t=b([w(fu)],t),t})(),IR=[fR,TR,uR],Cu=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(i){this.event=i}},ER=.5,xu=(()=>{class t extends tt{type="pinch-to-zoom";kind="pinch-to-zoom";_store=u(k);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(Te.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=S0(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 o=S0(n.touches),r=PR(n.touches);if(o==null||r==null){this._reset();return}if(Math.abs(o-this._startDistance)<ER)return;n.preventDefault();let a=o/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 Z.fromPoint(e).elementTransform(this._flowHost)}_reset(){this._startScale=null,this._startDistance=null}onPointerUp(){this._reset(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function PR(t){if(t.length!==2)return null;let i=t[0],e=t[1];return A.initialize((i.clientX+e.clientX)/2,(i.clientY+e.clientY)/2)}function S0(t){if(t.length!==2)return null;let i=t[0],e=t[1];return Math.hypot(e.clientX-i.clientX,e.clientY-i.clientY)}var MR=(()=>{let t=class vc{_dragSession=u(Q);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof xu)}static \u0275fac=function(n){return new(n||vc)};static \u0275prov=y({token:vc,factory:vc.\u0275fac})};return t=b([w(Cu)],t),t})(),bu=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(i){this.event=i}},kR=(()=>{let t=class yc{_dragInjector=u(Ke);_store=u(k);_dragSession=u(Q);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new Z,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(Te.ZOOM)}_getHandler(e){let n=this._dragInjector.get(xu);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||yc)};static \u0275prov=y({token:yc,factory:yc.\u0275fac})};return t=b([w(bu)],t),t})(),DR=[kR,MR],wu=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(i){this.event=i}},OR=(()=>{let t=class Cc{_dragSession=u(Q);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||Cc)};static \u0275prov=y({token:Cc,factory:Cc.\u0275fac})};return t=b([w(wu)],t),t})(),Yh=(()=>{class t extends tt{type="selection-area";kind="selection-area";_store=u(k);_dragSession=u(Q);_mediator=u(D);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return Z.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(Te.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new df),this._show(),this._draw(V.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=Z.fromPoint(e).add(this._dragSession.onPointerDownPosition),o=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),a=Math.abs(e.y),s=V.initialize(o.x,o.y,r,a);this._draw(s),this._selectedByMove=[],this._canBeSelected.forEach(c=>{c.element.unmarkAsSelected();let l=V.addPoint(V.mult(c.fRect,this._transform.scale),this._canvasPosition);V.intersectionWithRect(l,s)&&(c.element.markAsSelected(),this._selectedByMove.push(c.element))}),this._mediator.execute(new wn)}_getMinimumPoint(e,n){return A.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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Su=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(i){this.event=i}},NR=(()=>{let t=class xc{_store=u(k);_dragSession=u(Q);_dragInjector=u(Ke);get _instance(){return this._store.instances.get(Te.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=Z.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(Yh)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&Ct(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||xc)};static \u0275prov=y({token:xc,factory:xc.\u0275fac})};return t=b([w(Su)],t),t})(),RR=[NR,OR],Tu=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(i,e){this.rect=i,this.childrenBounds=e}},AR=(()=>{let t=class bc{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 o=e.x-n.x;o>0&&(e.x-=o,e.width+=o)}_restrictTop(e,n){let o=e.y-n.y;o>0&&(e.y-=o,e.height+=o)}_restrictRight(e,n){let o=n.x+n.width;e.x+e.width<=o&&(e.width=o-e.x)}_restrictBottom(e,n){let o=n.y+n.height;e.y+e.height<=o&&(e.height=o-e.y)}static \u0275fac=function(n){return new(n||bc)};static \u0275prov=y({token:bc,factory:bc.\u0275fac})};return t=b([w(Tu)],t),t})(),Iu=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(i,e){this.rect=i,this.limits=e}},FR=(()=>{let t=class wc{_mediator=u(D);handle({rect:e,limits:n}){this._applyResizeConstraints(e,n)}_applyResizeConstraints(e,n){if(!n)return;let o=this._clampedCopyForCalculation(e,n);this._applySoftParentExpansions(o,n.softLimits),n.hardLimit&&this._clampRectToInner(e,n.hardLimit.innerRect)}_clampedCopyForCalculation(e,n){let o=ce({},e);return n.hardLimit&&this._clampRectToInner(o,n.hardLimit.innerRect),o}_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 o=n.x+n.width;e.x+e.width>o&&(e.width=o-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 o of n)this._expandParentFromOriginalIfOverflow(e,o)}_expandParentFromOriginalIfOverflow(e,n){let o=n.innerRect,r=n.boundingRect,a=this._computeOverflow(o,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 o=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:o,top:r,right:a,bottom:s}}_buildExpandedParentRect(e,n){let o=ce({},e);return n.left&&(o.x=e.x-n.left,o.width=e.width+n.left),n.top&&(o.y=e.y-n.top,o.height=e.height+n.top),n.right&&(o.width=(o.width??e.width)+n.right),n.bottom&&(o.height=(o.height??e.height)+n.bottom),o}_applyParentRect(e,n){e.nodeOrGroup.updatePosition(n),e.nodeOrGroup.updateSize(n),this._mediator.execute(new ei(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=b([w(Iu)],t),t})(),Eu=class{originalRect;difference;handleType;minimumSize;static fToken=Symbol("CalculateChangedRectFromDifferenceRequest");constructor(i,e,n,o){this.originalRect=i,this.difference=e,this.handleType=n,this.minimumSize=o}},T0={[zt.LEFT]:{x:-1,y:0},[zt.LEFT_TOP]:{x:-1,y:-1},[zt.TOP]:{x:0,y:-1},[zt.RIGHT_TOP]:{x:1,y:-1},[zt.RIGHT]:{x:1,y:0},[zt.RIGHT_BOTTOM]:{x:1,y:1},[zt.BOTTOM]:{x:0,y:1},[zt.LEFT_BOTTOM]:{x:-1,y:1}},LR=(()=>{let t=class Sc{handle({originalRect:e,difference:n,handleType:o,minimumSize:r}){let a=this._changeSizeInRect(e,n,T0[o],r);return this._changePosition(e,n,T0[o],a)}_changeSizeInRect(e,n,o,r){let a=e.width+o.x*n.x,s=e.height+o.y*n.y,c=0,l=0;return a<0&&(c=a,a=Math.abs(a)),a<r.width&&(o.x===-1&&(c+=a-r.width),a=r.width),s<0&&(l=s,s=Math.abs(s)),s<r.height&&(o.y===-1&&(l+=s-r.height),s=r.height),V.initialize(c,l,a,s)}_changePosition(e,n,o,r){let a=e.x+(o.x===-1?n.x:0)+r.x,s=e.y+(o.y===-1?n.y:0)+r.y;return V.initialize(a,s,r.width,r.height)}static \u0275fac=function(n){return new(n||Sc)};static \u0275prov=y({token:Sc,factory:Sc.\u0275fac})};return t=b([w(Eu)],t),t})(),Pu=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(i,e){this.nodeOrGroup=i,this.paddings=e}},zR=(()=>{let t=class Tc{_mediator=u(D);_store=u(k);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let o=V.union(this._calculateDirectChildren(e.fId()).map(r=>this._normalizeRect(r)));return o?this._concatRectWithParentPadding(o,n):null}_calculateDirectChildren(e){return this._allNodesAndGroups.filter(n=>n.fParentId()===e)}_normalizeRect(e){return this._mediator.execute(new Fe(e.hostElement))}_concatRectWithParentPadding(e,n){return V.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||Tc)};static \u0275prov=y({token:Tc,factory:Tc.\u0275fac})};return t=b([w(Pu)],t),t})(),Wo=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(i,e){this.nodeOrGroup=i,this.rect=e}},BR=(()=>{let t=class Ic{_mediator=u(D);handle({nodeOrGroup:e,rect:n}){let o=this._getParentsChain(e),r=this._calculateNodePaddings(e,n);return{limits:this._buildSoftHardLimits(o),childrenBounds:this._getNormalizedChildrenBounds(e,r),minimumSize:et.initialize(r[0]+r[2],r[1]+r[3])}}_calculateNodePaddings(e,n){return this._mediator.execute(new oi(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new Pu(e,n))}_getParentsChain(e){return this._mediator.execute(new Vi(e))??[]}_buildSoftHardLimits(e){let n=[],o,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{o=this._makeLimit(a,s);break}}return{softLimits:n,hardLimit:o}}_getParentInfo(e,n){return this._mediator.execute(new Go(e,n))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeLimit(e,{boundingRect:n,innerRect:o}){return{nodeOrGroup:e,boundingRect:n,innerRect:o}}static \u0275fac=function(n){return new(n||Ic)};static \u0275prov=y({token:Ic,factory:Ic.\u0275fac})};return t=b([w(Wo)],t),t})(),Mu=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(i){this.event=i}},cv="node-resize",dv="resize-node";function qR(t){return t.getEvent().kind===dv||t.getEvent().fEventType===cv}var GR=(()=>{let t=class Ec{_dragSession=u(Q);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>qR(e))}static \u0275fac=function(n){return new(n||Ec)};static \u0275prov=y({token:Ec,factory:Ec.\u0275fac})};return t=b([w(Mu)],t),t})(),Xh=class{fNodeId;constructor(i){this.fNodeId=i}},Zh=(()=>{class t extends tt{type=cv;kind=dv;data(){return new Xh(this._nodeOrGroup.fId())}_mediator=u(D);_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 o of this._softParentConnections)this._applyConnectionHandlers(o);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 Fe(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new Wo(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new Eu(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Tu(e,this._constraints.childrenBounds)),this._mediator.execute(new Iu(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 ei(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return V.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 o of e.source){let r=this._readConnectorRect(o.connector,n);o.handler.setSourceRect(r)}for(let o of e.target){let r=this._readConnectorRect(o.connector,n);o.handler.setTargetRect(r)}}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let a=this._mediator.execute(new In(e.hostElement,!1));return n.set(o,a),a}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),$o=class{_mediator=u(D);_store=u(k);_behaviour=u(Ki);_source;_target;_sourceRef;_targetRef;_sourceRect;_targetRect;connection;initialize(i){this.connection=i,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=Le.fromRoundedRect(this._sourceRef.rect),this._targetRect=Le.fromRoundedRect(this._targetRef.rect)}setSourceRect(i){this._sourceRect=Le.fromRoundedRect(i),this._mediator.execute(new Jn(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(i){this._targetRect=Le.fromRoundedRect(i),this._mediator.execute(new Jn(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=Le.fromRoundedRect(this._sourceRect),e=Le.fromRoundedRect(this._targetRect);return this._behaviour.handle(new Pt(i,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(i){return{connector:i,rect:this._mediator.execute(new In(i.hostElement,!1))}}_resolveRotationContext(i){return this._mediator.execute(new Zt(i))}},HR=(()=>{class t extends $o{_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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),VR=(()=>{class t extends $o{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),jR=(()=>{class t extends $o{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ku=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Du=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(i,e){this.handler=i,this.nodeOrGroup=e}},UR=(()=>{let t=class Pc{_store=u(k);_mediator=u(D);_dragInjector=u(Ke);handle({handler:e,nodeOrGroup:n}){let o=this._readSoftParents(n),r=[n,...o],a=this._collectSourceConnectorIds(r),s=this._collectTargetConnectorIds(r),c=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,a,s,c)),e.setSoftParentConnectionHandlers(o.map(l=>this._buildConnectionHandlersForNode(l,a,s,c)))}_readSoftParents(e){let n=this._mediator.execute(new Fe(e.hostElement));return this._mediator.execute(new Wo(e,n)).limits.softLimits.map(r=>r.nodeOrGroup)}_collectSourceConnectorIds(e){let n=new Set(e.map(o=>o.fId()));return new Set(this._store.outputs.getAll().filter(o=>n.has(o.fNodeId)).map(o=>o.fId()))}_collectTargetConnectorIds(e){let n=new Set(e.map(o=>o.fId()));return new Set(this._store.inputs.getAll().filter(o=>n.has(o.fNodeId)).map(o=>o.fId()))}_buildConnectionHandlersForNode(e,n,o,r){let a=this._store.outputs.getAll().filter(m=>m.fNodeId===e.fId()),s=this._store.inputs.getAll().filter(m=>m.fNodeId===e.fId());if(!a.length&&!s.length)return{source:[],target:[]};let c=new Set(a.map(m=>m.fId())),l=new Set(s.map(m=>m.fId())),f={source:[],target:[]};for(let m of this._store.connections.getAll()){let x=c.has(m.fOutputId()),P=l.has(m.fInputId());if(!x&&!P)continue;let E=r.get(m.fId())??this._createConnectionHandler(m,n,o);if(r.set(m.fId(),E),x){let N=this._store.outputs.require(m.fOutputId());f.source.push({handler:E,connector:N})}if(P){let N=this._store.inputs.require(m.fInputId());f.target.push({handler:E,connector:N})}}return f}_createConnectionHandler(e,n,o){let r=n.has(e.fOutputId()),a=o.has(e.fInputId()),s=r&&a?this._dragInjector.createInstance(HR):r?this._dragInjector.createInstance(VR):this._dragInjector.createInstance(jR);return s.initialize(e),s}static \u0275fac=function(n){return new(n||Pc)};static \u0275prov=y({token:Pc,factory:Pc.\u0275fac})};return t=b([w(Du)],t),t})(),WR=(()=>{let t=class Mc{_mediator=u(D);_store=u(k);_dragSession=u(Q);_dragInjector=u(Ke);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!Ct(e.originalEvent,n))return;let o=this._findResizableNode(e.targetElement);if(!o)return;this._selectBeforeResize(o);let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=Z.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let a=this._dragInjector.createInstance(Zh);a.initialize(o,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new Du(a,o)),this._dragSession.draggableItems=[a]}_isResizeHandle(e){return bo(e,".f-resize-handle")}_findResizableNode(e){let n=this._store.nodes.getAll().find(o=>o.isContains(e));if(n)return n.fDraggingDisabled()?void 0:n}_selectBeforeResize(e){queueMicrotask(()=>{this._mediator.execute(new Wi(e))})}_readResizeHandleType(e){let n=n0(e,"fResizeHandleType",".f-resize-handle");return zt[n]}static \u0275fac=function(n){return new(n||Mc)};static \u0275prov=y({token:Mc,factory:Mc.\u0275fac})};return t=b([w(ku)],t),t})(),$R=[AR,FR,LR,zR,BR,UR,GR,WR],Ou=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(i){this.event=i}},lv="node-rotate",uv="rotate-node";function KR(t){return t.getEvent().kind===uv||t.getEvent().fEventType===lv}var YR=(()=>{let t=class kc{_dragSession=u(Q);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>KR(e))}static \u0275fac=function(n){return new(n||kc)};static \u0275prov=y({token:kc,factory:kc.\u0275fac})};return t=b([w(Ou)],t),t})(),Nu=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Qh=class{fNodeId;constructor(i){this.fNodeId=i}};function XR(t,i,e){let{x:n,y:o}=ZR(t,i,e),r=n-t.x,a=o-t.y;return{x:r,y:a}}function ZR(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=n*a-o*s,l=n*s+o*a,f=c+e.x,m=l+e.y;return{x:f,y:m}}var Jh=(()=>{class t extends tt{type=lv;kind=uv;data(){return new Qh(this._nodeOrGroup.fId())}_store=u(k);_mediator=u(D);_dragSession=u(Q);_nodeOrGroup;_sourceConnections;_targetConnections;_startRotation=0;_nodeRect;_nodeCenter;_pointerDownInFlow;_rotationOffsetDeg=0;get _transform(){return this._store.transform}initialize(e,n,o){this._nodeOrGroup=e,this._sourceConnections=n,this._targetConnections=o,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=A.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 Fe(this._nodeOrGroup.hostElement))}_calculatePointerDownInFlow(){return A.sub(this._dragSession.onPointerDownPosition,A.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 XR(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),QR=(()=>{let t=class Dc{_mediator=u(D);_store=u(k);_dragContext=u(Q);_dragInjector=u(Ke);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 o=this._transform.scale;this._dragContext.onPointerDownScale=o,this._dragContext.onPointerDownPosition=Z.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(o);let r=this._dragInjector.createInstance(Jh);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&xN(e.targetElement)&&Ct(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 Wi(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new Bu(e)).map(n=>{let o=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new ut(o)),a=this._dragInjector.get(Uo);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new Ku(e)).map(n=>{let o=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new ut(o)),a=this._dragInjector.get(Vo);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||Dc)};static \u0275prov=y({token:Dc,factory:Dc.\u0275fac})};return t=b([w(Nu)],t),t})(),JR=[YR,QR],Ko=class{flowRect;canvasPosition;eventPoint;minimap;static fToken=Symbol("CalculateFlowPointFromMinimapPointRequest");constructor(i,e,n,o){this.flowRect=i,this.canvasPosition=e,this.eventPoint=n,this.minimap=o}},e2=(()=>{let t=class Oc{_store=u(k);get _canvasScale(){return this._store.transform.scale||1}handle(e){return A.sub(e.canvasPosition,A.sub(this._getPositionInViewBox(e.eventPoint,e.minimap),this._getNormalizedFlowCenter(e.flowRect)))}_getNormalizedFlowCenter(e){return Z.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let o=this.normalizeEventPoint(e,n);return A.sum(o,V.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return Z.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||Oc)};static \u0275prov=y({token:Oc,factory:Oc.\u0275fac})};return t=b([w(Ko)],t),t})(),Ru=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(i){this.event=i}},t2=(()=>{let t=class Nc{_dragSession=u(Q);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(n2)}static \u0275fac=function(n){return new(n||Nc)};static \u0275prov=y({token:Nc,factory:Nc.\u0275fac})};return t=b([w(Ru)],t),t})(),fv="minimap",pv="minimap";function n2(t){return t.getEvent().kind===pv||t.getEvent().fEventType===fv}var em=(()=>{class t extends tt{type=fv;kind=pv;_store=u(k);_mediator=u(D);_lastDelta=null;_flowRect;_startCanvasPosition;_eventPoint;_minimap;initialize(e,n,o,r){this._flowRect=e,this._startCanvasPosition=n,this._eventPoint=o,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(Z.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 Ko(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(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Au=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(i){this.event=i}},i2=(()=>{let t=class Rc{_store=u(k);_mediator=u(D);_dragSession=u(Q);_dragInjector=u(Ke);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(Te.MINIMAP).state,o=e.getPosition(),r=Z.fromPoint(this._store.transform.position),a=V.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(a,o,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=Z.fromPoint(o).elementTransform(this._flowHost);let s=this._dragInjector.createInstance(em);s.initialize(a,r,o,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(Te.MINIMAP))}_calculateCanvasPosition(e,n,o){return this._mediator.execute(new Ko(e,Z.fromPoint(this._canvas.transform.position),n,o))}static \u0275fac=function(n){return new(n||Rc)};static \u0275prov=y({token:Rc,factory:Rc.\u0275fac})};return t=b([w(Au)],t),t})(),o2=[e2,t2,i2];function r2(t){return!!t&&typeof t.destroy=="function"}var Ke=(()=>{class t{_injector=u(Ye);_dragInjector=null;_created=[];create(){this._dragInjector=Ye.create({providers:[{provide:Fu,useClass:Fu},{provide:Xl,useClass:Xl},{provide:Gl,useClass:Gl},{provide:Oh,useClass:Oh},{provide:qo,useClass:qo},{provide:Vo,useClass:Vo},{provide:Uo,useClass:Uo},{provide:jo,useClass:jo},{provide:Pn,useClass:Pn},{provide:xu,useClass:xu},{provide:Yh,useClass:Yh},{provide:Zh,useClass:Zh},{provide:Jh,useClass:Jh},{provide:em,useClass:em}],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=J_(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)r2(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})(),Mn=(()=>{class t{_data;setData(e){this._data=ce(ce({},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})(),I0="f-canvas-dragging",E0="canvas-dragging",Fu=(()=>{class t extends tt{type="canvas-move";kind="drag-canvas";_store=u(k);_onPointerDownPosition=A.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(I0,E0)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(Z.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(I0,E0)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),a2=(()=>{let t=class Ac{_dragContext=u(Q);handle(e){this._isValid()&&this._dragContext.draggableItems.forEach(n=>n.onPointerUp?.())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Fu)}static \u0275fac=function(n){return new(n||Ac)};static \u0275prov=y({token:Ac,factory:Ac.\u0275fac})};return t=b([w(Fl)],t),t})(),Lu=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},s2=(()=>{let t=class Fc{_store=u(k);_dragContext=u(Q);_dragInjector=u(Ke);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=Z.fromPoint(e.getPosition()).elementTransform(this._store.flowHost),this._dragContext.draggableItems=[this._dragInjector.get(Fu)])}_isValid(e){return this._dragContext.isEmpty()&&(this._isBackgroundElement(e.targetElement)||this._isDragOnHost(e.targetElement))}_isBackgroundElement(e){return this._store.instances.get(Te.BACKGROUND)?.hostElement.contains(e)}_isDragOnHost(e){return this._store.flowHost.contains(e)&&!this._getNode(e)}_getNode(e){let n=this._store.nodes.getAll().find(o=>o.isContains(e));return n&&n.fDraggingDisabled()&&(n=void 0),n}_isValidTrigger(e,n){return Ct(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Fc)};static \u0275prov=y({token:Fc,factory:Fc.\u0275fac})};return t=b([w(Lu)],t),t})(),c2=[a2,s2],zu=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(i,e){this.event=i,this.trigger=e}},d2=(()=>{let t=class Lc{_mediator=u(D);_store=u(k);_dragSession=u(Q);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let o=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(o),Ct(e.originalEvent,n)?this._applyToggleSelect(o):this._applySingleSelect(o)}_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 ri(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=b([w(zu)],t),t})(),l2=[d2];var tm=class extends xh{hostElement=u(Ne).nativeElement};function u2(t){return bo(t,".f-drag-blocker")}var hv=(()=>{class t extends tm{_result=u(Mn);_mediator=u(D);_platform=u(Fp);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===yn.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=It;fCreateConnectionTrigger=It;fConnectionWaypointsTrigger=O(It);fMoveControlPointTrigger=It;fNodeResizeTrigger=It;fNodeRotateTrigger=It;fNodeMoveTrigger=It;fCanvasMoveTrigger=It;fExternalItemTrigger=It;fSelectionChange=new st;fNodeIntersectedWithConnections=new st;fNodeConnectionsIntersection=Ve();fEmitOnNodeIntersect=!1;fCreateNode=new st;fMoveNodes=new st;fReassignConnection=new st;fCreateConnection=new st;fConnectionWaypointsChanged=Ve();fDropToGroup=new st;vCellSize=O(1,{transform:e=>$e(e,1)});hCellSize=O(1,{transform:e=>$e(e,1)});fCellSizeWhileDragging=O(!1,{transform:e=>me(e)});fDragStarted=new st;fDragEnded=new st;_dragHandlerInjector=u(Ke);ngOnInit(){this._mediator.execute(new Hu(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(u2(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new ju),this._mediator.execute(new Su(e)),this._mediator.execute(new Au(e)),this._mediator.execute(new bu(e)),this._mediator.execute(new zu(e,this.fMultiSelectTrigger)),this._mediator.execute(new Wl(e,this.fReassignConnectionTrigger)),this._mediator.execute(new jl(e,this.fCreateConnectionTrigger)),this._mediator.execute(new Zl(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new ku(e,this.fNodeResizeTrigger)),this._mediator.execute(new Nu(e,this.fNodeRotateTrigger)),this._mediator.execute(new uu(e,this.fNodeMoveTrigger)),this._mediator.execute(new vu(e,this.fExternalItemTrigger)),this._mediator.execute(new fu(e)),this._mediator.execute(new Lu(e,this.fCanvasMoveTrigger)),this._mediator.execute(new Uu)}onSelect(e){this._mediator.execute(new yu(e))}onPointerMove(e){this._mediator.execute(new Vu(e))}onPointerUp(e){this._mediator.execute(new Ru(e)),this._mediator.execute(new wu(e)),this._mediator.execute(new Ul(e)),this._mediator.execute(new ql(e)),this._mediator.execute(new Mu(e)),this._mediator.execute(new Ou(e)),this._mediator.execute(new lu(e)),this._mediator.execute(new _u(e)),this._mediator.execute(new Ql(e)),this._mediator.execute(new Fl(e)),this._mediator.execute(new Cu(e)),this._mediator.execute(new Kl(e)),this._mediator.execute(new kl)}finalizeDragSequence(){this._mediator.execute(new En),this._mediator.execute(new Fo),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new En),this._mediator.execute(new Wu),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",me],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",me],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:[ge([Mn,Ke]),he]})}return t})(),f2=[...c2,...HN,...lN,...l2,...SR,...vN,...o2,...lR,...IR,...$R,...JR,...RR,...DR],p2=(()=>{let t=class zc{_store=u(k);handle({waypointIndex:e,connectionId:n}){let o=this._store.connections.require(n),r=o.fWaypoints()?.waypoints().slice();if(!r)throw new Error("Connection waypoints not found");r.splice(e,1),o.fWaypoints()?.waypoints.set(r),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._changeEvent(o))}_changeEvent(e){return new Yl(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||zc)};static \u0275prov=y({token:zc,factory:zc.\u0275fac})};return t=b([w(gh)],t),t})(),nm=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},h2=(()=>{let t=class Bc{_store=u(k);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||Bc)};static \u0275prov=y({token:Bc,factory:Bc.\u0275fac})};return t=b([w(nm)],t),t})(),m2=[Tf,ai,cD,dD,lD,uD,iO,NO,cO,EO,GO,qO,OO,VO,UO,jO,DO,zO,dO,YO,kO,MO,PO,bO,IO,wO,SO,HO,FO,WO,$O,BO,LO,KO,XO,ZO,QO,h2,p2],Yo=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(i){this.instance=i}},_2=(()=>{let t=class qc{_store=u(k);_mediator=u(D);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 ll(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||qc)};static \u0275prov=y({token:qc,factory:qc.\u0275fac})};return t=b([w(Yo)],t),t})(),ii=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(i,e){this.position=i,this.connectorRefs=e}},g2=(()=>{let t=class Gc{handle({position:e,connectorRefs:n}){let o,r=1/0;for(let a of n){let s=this._distanceToRect(e,a.rect);s<r&&(r=s,o=a)}return o?Hn(ce({},o),{distance:r}):void 0}_distanceToRect(e,{x:n,y:o,width:r,height:a}){let s=this._clamp(e.x,n,n+r),c=this._clamp(e.y,o,o+a),l=e.x-s,f=e.y-c;return Math.sqrt(l*l+f*f)}_clamp(e,n,o){return Math.max(n,Math.min(o,e))}static \u0275fac=function(n){return new(n||Gc)};static \u0275prov=y({token:Gc,factory:Gc.\u0275fac})};return t=b([w(ii)],t),t})(),Xo=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(i,e){this.pointerPosition=i,this.connectableConnectors=e}},v2=(()=>{let t=class Hc{_mediator=u(D);_store=u(k);_browser=u(ze);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 o=this._isSnapConnectionEnabledAndHasClosestConnector(e);o&&n.unshift(o.connector);let r=this._getFirstConnectableConnectorOfNodeAtPosition(e);return r&&n.push(r),n}_filterConnectorsThatLocatedAtPosition(e){return e.connectableConnectors.filter(n=>V.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return Yi(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new ii(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(o=>o.connector.fNodeId===n.fId())?.connector}static \u0275fac=function(n){return new(n||Hc)};static \u0275prov=y({token:Hc,factory:Hc.\u0275fac})};return t=b([w(Xo)],t),t})(),Zo=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(i,e){this.source=i,this.pointer=e}},ut=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(i){this.connector=i}},y2=(()=>{let t=class Vc{_mediator=u(D);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new In(e.hostElement))}static \u0275fac=function(n){return new(n||Vc)};static \u0275prov=y({token:Vc,factory:Vc.\u0275fac})};return t=b([w(ut)],t),t})(),Qo=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(i){this.nodeOrGroup=i}},C2=(()=>{let t=class jc{_store=u(k);_mediator=u(D);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new ul(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=b([w(Qo)],t),t})(),Bu=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},x2=(()=>{let t=class Uc{_store=u(k);handle({nodeOrGroup:e}){let n=this._collectInputIds(e);return this._collectConnections(n)}_collectInputIds(e){let n=new Set,o=this._store.inputs.getAll();for(let r of o)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],o=this._store.connections.getAll();for(let r of o)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=b([w(Bu)],t),t})(),qi=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(i,e){this.connector=i,this.pointerPosition=e}},P0=2,Ze=(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})(Ze||{});function b2(t,i,e,n,o){let r=w2(o),a=e-t,s=n-i,c=S2(a,s);return T2(c,r)?c:I2(a,s,r,c)}function w2(t){if(!t||t.length===0)return Ze.ALL;let i=Ze.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case F.LEFT:i|=Ze.LEFT;break;case F.RIGHT:i|=Ze.RIGHT;break;case F.TOP:i|=Ze.TOP;break;case F.BOTTOM:i|=Ze.BOTTOM;break}return i||Ze.ALL}function S2(t,i){let e=t<0?-t:t,n=i<0?-i:i;return e-n>P0?t<0?F.LEFT:F.RIGHT:(n-e>P0,i<0?F.TOP:F.BOTTOM)}function T2(t,i){switch(t){case F.LEFT:return(i&Ze.LEFT)!==0;case F.RIGHT:return(i&Ze.RIGHT)!==0;case F.TOP:return(i&Ze.TOP)!==0;case F.BOTTOM:return(i&Ze.BOTTOM)!==0;default:return!0}}function I2(t,i,e,n){let o=n,r=-1/0;if(e&Ze.RIGHT){let a=t;a>r&&(r=a,o=F.RIGHT)}if(e&Ze.LEFT){let a=-t;a>r&&(r=a,o=F.LEFT)}if(e&Ze.BOTTOM){let a=i;a>r&&(r=a,o=F.BOTTOM)}if(e&Ze.TOP){let a=-i;a>r&&(r=a,o=F.TOP)}return o}function qu(t){return t===F.CALCULATE||t===F.CALCULATE_HORIZONTAL||t===F.CALCULATE_VERTICAL}var E2={[F.CALCULATE]:[F.TOP,F.BOTTOM,F.LEFT,F.RIGHT],[F.CALCULATE_HORIZONTAL]:[F.LEFT,F.RIGHT],[F.CALCULATE_VERTICAL]:[F.TOP,F.BOTTOM]},P2=(()=>{let t=class Wc{_mediator=u(D);handle({connector:e,pointerPosition:n}){let o=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 b2(r.x,r.y,s,c,E2[o])}_accumulateConnectedCenters(e,n,o){let r=o?.x||0,a=o?.y||0,s=o?1:0;if(n&&n.length)for(let c=0;c<n.length;c++){let l=n[c].hostElement;if(l===e)continue;let f=this._getConnectorRect(l).gravityCenter;r+=f.x,a+=f.y,s++}return{sumX:r,sumY:a,count:s}}_getConnectorRect(e){return this._mediator.execute(new Fe(e))}static \u0275fac=function(n){return new(n||Wc)};static \u0275prov=y({token:Wc,factory:Wc.\u0275fac})};return t=b([w(qi)],t),t})(),Gu=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(i){this.connector=i}},Hu=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(i){this.fComponent=i}},M2=(()=>{let t=class $c{_store=u(k);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||$c)};static \u0275prov=y({token:$c,factory:$c.\u0275fac})};return t=b([w(Hu)],t),t})(),Vu=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(i){this.event=i}},k2=(()=>{let t=class Kc{_mediator=u(D);_store=u(k);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=u(Q);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new Lo)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(o=>{o.onPointerMove(ce({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return Z.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||Kc)};static \u0275prov=y({token:Kc,factory:Kc.\u0275fac})};return t=b([w(Vu)],t),t})(),ju=class{static fToken=Symbol("InitializeDragSequenceRequest")},D2=(()=>{let t=class Yc{_dragContext=u(Q);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||Yc)};static \u0275prov=y({token:Yc,factory:Yc.\u0275fac})};return t=b([w(ju)],t),t})(),kn=class{static fToken=Symbol("IsDragStartedRequest")},O2=(()=>{let t=class Xc{_store=u(k);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=b([w(kn)],t),t})(),Uu=class{static fToken=Symbol("PrepareDragSequenceRequest")},N2=(()=>{let t=class Zc{_mediator=u(D);_dragContext=u(Q);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new Dl)}_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=b([w(Uu)],t),t})(),Wu=class{static fToken=Symbol("RemoveDndFromStoreRequest")},R2=(()=>{let t=class Qc{_store=u(k);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=b([w(Wu)],t),t})(),A2=[M2,k2,D2,N2,O2,R2],F2=new ue("CONNECTABLE_SIDE_EPSILON"),L2=(()=>{let t=class Jc{_mediator=u(D);_lastSide=new WeakMap;_epsilon=Math.max(0,u(F2,{optional:!0})??2);handle({connector:e}){if(this._isDragging()){let o=this._lastSide.get(e);if(o!==void 0)return o;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,o){let r=V.fromElement(e),a=n.getBoundingClientRect(),s=r.gravityCenter.x,c=r.gravityCenter.y,l=s-a.left,f=a.right-s,m=c-a.top,x=a.bottom-c,P=0,E=l,N=[l,f,m,x];for(let U=1;U<4;U++){let ie=N[U];ie<E&&(E=ie,P=U)}let j=P===0?F.LEFT:P===1?F.RIGHT:P===2?F.TOP:F.BOTTOM,L=this._lastSide.get(o);if(L!==void 0&&L!==j){let U=L===F.LEFT?0:L===F.RIGHT?1:L===F.TOP?2:3;(U===0?l:U===1?f:U===2?m:x)-E<=this._epsilon&&(j=L)}return j}_isDragging(){return this._mediator.execute(new kn)}static \u0275fac=function(n){return new(n||Jc)};static \u0275prov=y({token:Jc,factory:Jc.\u0275fac})};return t=b([w(Gu)],t),t})(),Gi=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(i){this.nodeOrGroup=i}},z2=(()=>{let t=class ed{_mediator=u(D);handle({nodeOrGroup:e}){let n=e.connectors,o=n.length;for(let a=0;a<o;a++){let s=n[a];s.fConnectableSide=this._resolveSideForConnectorFast(s)}let r=new Set;for(let a=0;a<o;a++){let c=n[a].toConnector;if(c&&c.length)for(let l=0,f=c.length;l<f;l++){let m=c[l],x=m.userFConnectableSide;qu(x)&&r.add(m)}}r.size>0&&r.forEach(a=>{a.fConnectableSide=this._calculateByConnectedPositions(a)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===F.AUTO?this._mediator.execute(new Gu(e)):qu(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new qi(e))}static \u0275fac=function(n){return new(n||ed)};static \u0275prov=y({token:ed,factory:ed.\u0275fac})};return t=b([w(Gi)],t),t})(),Hi=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},B2=(()=>{let t=class td{_store=u(k);handle(e){return V.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>V.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||td)};static \u0275prov=y({token:td,factory:td.\u0275fac})};return t=b([w(Hi)],t),t})(),$u=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(i){this.fNodes=i}},q2=(()=>{let t=class nd{_store=u(k);_mediator=u(D);handle(e){return V.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 zi(e.hostElement));if(n)return this._getElementRect(e,n);let o=this._mediator.execute(new Fe(e.hostElement));return this._getElementRect(e,o)}_getElementRect(e,n){return V.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=b([w($u)],t),t})(),Ku=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},G2=(()=>{let t=class id{_store=u(k);handle({nodeOrGroup:e}){let n=this._collectOutputIds(e);return this._collectConnections(n)}_collectOutputIds(e){let n=new Set,o=this._store.outputs.getAll();for(let r of o)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],o=this._store.connections.getAll();for(let r of o)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=b([w(Ku)],t),t})(),Jo=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(i){this.nodeOrGroup=i}},oi=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(i,e){this.fNode=i,this.rect=e}},H2=(()=>{let t=class od{_browser=u(ze);handle(e){return e.fNode.fIncludePadding()?this._getPaddingData(e.fNode,e.rect):[0,0,0,0]}_getPaddingData(e,n){let o=this._browser.window.getComputedStyle(e.hostElement);return[this._browser.toPixels(o.paddingLeft,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingTop,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingRight,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingBottom,n.width,n.height,o.fontSize)]}static \u0275fac=function(n){return new(n||od)};static \u0275prov=y({token:od,factory:od.\u0275fac})};return t=b([w(oi)],t),t})(),V2=(()=>{let t=class rd{_mediator=u(D);_store=u(k);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 o=this._nodes.find(r=>r.fId()===n);o&&this._mediator.execute(new Jo(o))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return V.union(e.map(n=>this._boundingRect(n)))||V.initialize()}_boundingRect(e){return this._mediator.execute(new Fe(e.hostElement))}_paddings(e,n){return this._mediator.execute(new oi(e,n))}_calculateChildrenBounding(e,[n,o,r,a]){let s=this._unionRect(e);return s=V.initialize(s.x-n,s.y-o,s.width+n+r,s.height+o+a),s}static \u0275fac=function(n){return new(n||rd)};static \u0275prov=y({token:rd,factory:rd.\u0275fac})};return t=b([w(Jo)],t),t})(),Yu=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(i){this.id=i}},j2=(()=>{let t=class ad{_store=u(k);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle(e){if(!e.id)return[];let n=new Set,o=[];return this._collectDescendants(e.id,o,n),o}_collectDescendants(e,n,o){if(o.has(e))throw new Error(`Circular reference detected in the node hierarchy. Node id: ${e}`);o.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,o)}static \u0275fac=function(n){return new(n||ad)};static \u0275prov=y({token:ad,factory:ad.\u0275fac})};return t=b([w(Yu)],t),t})(),Vi=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(i){this.nodeOrGroup=i}},U2=(()=>{let t=class sd{_store=u(k);handle({nodeOrGroup:e}){return this._getParentNodes(e,new Set,[])}_getParentNodes(e,n,o){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?(o.push(r),this._getParentNodes(r,n,o)):o}static \u0275fac=function(n){return new(n||sd)};static \u0275prov=y({token:sd,factory:sd.\u0275fac})};return t=b([w(Vi)],t),t})(),er=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(i,e){this.nodeOrGroup=i,this.destroyRef=e}},W2=(()=>{let t=class cd{_mediator=u(D);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:o,stateChanges:r}=e;new Bt(new Xp(o),r).listen(n,()=>{this._mediator.execute(new Zn),this._isDragging()||(this._mediator.execute(new Li(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new Gi(e)),this._mediator.execute(new Jo(e)))})}_isDragging(){return this._mediator.execute(new kn)}static \u0275fac=function(n){return new(n||cd)};static \u0275prov=y({token:cd,factory:cd.\u0275fac})};return t=b([w(er)],t),t})(),tr=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(i){this.instance=i}},$2=(()=>{let t=class dd{_store=u(k);_mediator=u(D);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new fl(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||dd)};static \u0275prov=y({token:dd,factory:dd.\u0275fac})};return t=b([w(tr)],t),t})(),K2=[C2,P2,L2,x2,z2,B2,q2,G2,V2,j2,H2,U2,W2,$2],Y2=(()=>{let t=class ld{_mediator=u(D);_store=u(k);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let o=this._getConnectableTargets(e),r=[];for(let a of o)r.push(this._mediator.execute(new ut(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableTargets(e){if(e.hasConnectionLimits)return this._targets.filter(o=>e.canConnectTo(o));let n=this._targets.filter(o=>o.canBeConnected);return e.isSelfConnectable||(n=n.filter(o=>o.fNodeId!==e.fNodeId)),n}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:o}of e)qu(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new qi(e,n))}static \u0275fac=function(n){return new(n||ld)};static \u0275prov=y({token:ld,factory:ld.\u0275fac})};return t=b([w(Zo)],t),t})(),Xu=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(i,e){this.target=i,this.pointer=e}},X2=(()=>{let t=class ud{_mediator=u(D);_store=u(k);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let o=this._getConnectableSources(e),r=[];for(let a of o)r.push(this._mediator.execute(new ut(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableSources(e){return this._sources.filter(n=>{let o=n.canBeConnected;return o&&n.hasConnectionLimits&&(o=n.canConnectTo(e)),o})}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:o}of e)qu(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new qi(e,n))}static \u0275fac=function(n){return new(n||ud)};static \u0275prov=y({token:ud,factory:ud.\u0275fac})};return t=b([w(Xu)],t),t})(),ji=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},je={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"}},Z2=(()=>{let t=class fd{_store=u(k);handle({connectors:e}){this._store.flowHost.classList.add(je.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(je.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||fd)};static \u0275prov=y({token:fd,factory:fd.\u0275fac})};return t=b([w(ji)],t),t})(),nr=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(i){this.instance=i}},Q2=(()=>{let t=class pd{_store=u(k);_mediator=u(D);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 Eo(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||pd)};static \u0275prov=y({token:pd,factory:pd.\u0275fac})};return t=b([w(nr)],t),t})(),Ui=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},J2=(()=>{let t=class hd{_store=u(k);handle({connectors:e}){this._store.flowHost.classList.remove(je.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(je.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||hd)};static \u0275prov=y({token:hd,factory:hd.\u0275fac})};return t=b([w(Ui)],t),t})(),eA=[_2,Q2,g2,v2,X2,Y2,y2,Z2,J2],Zu=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(i){this.instance=i}},si=(function(t){return t.TOP_BOTTOM="TOP_BOTTOM",t.BOTTOM_TOP="BOTTOM_TOP",t.LEFT_RIGHT="LEFT_RIGHT",t.RIGHT_LEFT="RIGHT_LEFT",t})(si||{}),Cn=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(Cn||{});function tA(t){let i=[...t.nodes.map(M0),...t.groups.map(M0)],e=new Set(t.nodes.map(s=>s.id)),n=new Set(t.groups.map(s=>s.id)),o=new Map,r=new Map;for(let s of[...t.nodes,...t.groups]){for(let c of s.fOutputs)o.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 l=o.get(c.fOutputId),f=r.get(c.fInputId);return!l||!f||s.push({source:l,target:f}),s},[]);return{nodes:i,connections:a,nodeIds:e,groupIds:n}}function M0(t){return{id:t.id,size:t.measuredSize?ce({},t.measuredSize):t.size?ce({},t.size):void 0}}var nA=1,Pf=(()=>{class t{_destroyRef=u(it);_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 o=e.fId();this.unregisterFlow(o);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(o)),n.connectionsChanges$.listen(()=>this._handleConnectionsChanges(o))),this._flows.set(o,r),this._engine?.getMode()===Cn.AUTO&&this._scheduleRelayout(o)}unregisterFlow(e){let n=this._flows.get(e);n&&(n.unsubs.forEach(o=>o()),this._clearScheduledWork(n),this._flows.delete(e))}handleModeChanged(e){if(e===Cn.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,o]of this._flows.entries())await this._relayoutRegisteredFlow(n,o)}}_handleNodesChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let o=this._buildNodeSignature(n.store);o!==n.nodeSignature&&(n.nodeSignature=o,this._scheduleRelayout(e))}_handleConnectionsChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let o=this._buildConnectionSignature(n.store);o!==n.connectionSignature&&(n.connectionSignature=o,this._scheduleRelayout(e))}_scheduleRelayout(e){let n=this._flows.get(e);!n||!this._engine||this._engine.getMode()!==Cn.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},nA))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==Cn.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let o=tA(n.flow.getState({measuredSize:!0})),r=++n.runId,a=await this._engine.calculate(o.nodes,o.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,o.nodeIds,o.groupIds)}finally{queueMicrotask(()=>{let l=this._flows.get(e);l&&(l.isApplying=!1)})}}}_emitWriteback(e,n,o,r){let a=this._engine?.getWriteback();a&&a({flowId:e,nodes:n.filter(s=>o.has(s.id)),groups:n.filter(s=>r.has(s.id))})}_applyPositions(e,n){return n.filter(o=>{let r=e.nodes.get(o.id);return!r||A.isEqual(r._position,o.position)?!1:(r.position.set(ce({},o.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})(),mv=new ue("F_LAYOUT_OPTIONS");function _v(t,i){return t.reduce((e,n)=>{let o=i.get(n.id);return o&&e.push({id:n.id,position:o}),e},[])}var iA=new ue("F_LAYOUT"),Qu=class{_controller=u(Pf);_config=u(mv,{optional:!0})??{};_interactiveOptions;_mode;_writeback;_defaultOptions;interactiveOptions;constructor(i){this._mode=this._config.mode??Cn.MANUAL,this._writeback=this._config.writeback??null,this._defaultOptions=this.mergeOptions(i,this._config.options),this._interactiveOptions=z(this.mergeOptions(this._defaultOptions,{})),this.interactiveOptions=S(()=>this.mergeOptions(this._interactiveOptions(),{})),this._controller.attachEngine(this)}setMode(i){this._mode=i,this._controller.handleModeChanged(i)}getMode(){return this._mode}setWriteback(i){this._writeback=i}getWriteback(){return this._writeback}setInteractiveOptions(i){this._interactiveOptions.set(this.mergeOptions(this._interactiveOptions(),i))}relayout(i){return this._controller.relayout(i)}getProviderConfig(){return ce({},this._config)}resolveLayoutOptions(i){let e=ce({},i??{});return delete e.flowId,delete e.mode,this.mergeOptions(this._interactiveOptions(),e)}};function gv(t,i){return[Pf,t,{provide:iA,useExisting:t},{provide:mv,useValue:i??{}}]}var oA=(()=>{let t=class md{_store=u(k);_layoutController=u(Pf,{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=b([w(Zu)],t),t})(),Ju=class{static fToken=Symbol("GetFlowRequest")},rA=(()=>{let t=class _d{_store=u(k);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=b([w(Ju)],t),t})(),ef=class{static fToken=Symbol("CalculateConnectionsStateRequest")},aA=(()=>{let t=class gd{_store=u(k);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=b([w(ef)],t),t})(),ir=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(i,e=!1){this.component=i,this.measuredSize=e}},sA=(()=>{let t=class vd{_store=u(k);_mediator=u(D);handle({component:e,measuredSize:n}){return this._store.nodes.getAll().filter(o=>o instanceof e).map(o=>{let r=n?this._mediator.execute(new Fe(o.hostElement)):null;return{id:o.fId(),parentId:o.fParentId()??void 0,position:ce({},o._position),size:o._size?ce({},o._size):void 0,measuredSize:r?{width:r.width,height:r.height}:void 0,rotate:o._rotate,fOutputs:this._getOutputs(o.hostElement),fInputs:this._getInputs(o.hostElement),isSelected:o.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||vd)};static \u0275prov=y({token:vd,factory:vd.\u0275fac})};return t=b([w(ir)],t),t})(),tf=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(i=!1){this.measuredSize=i}},cA=(()=>{let t=class yd{_mediator=u(D);_store=u(k);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _canvasPosition(){return A.sum(this._transform.position,this._transform.scaledPosition)}handle({measuredSize:e}){return{position:this._canvasPosition,scale:this._canvas.transform.scale,nodes:this._mediator.execute(new ir(Ef,e)),groups:this._mediator.execute(new ir(Eh,e)),connections:this._mediator.execute(new ef)}}static \u0275fac=function(n){return new(n||yd)};static \u0275prov=y({token:yd,factory:yd.\u0275fac})};return t=b([w(tf)],t),t})(),dA=[cA,sA,aA],nf=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(i){this.instance=i}},lA=(()=>{let t=class Cd{_store=u(k);_layoutController=u(Pf,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||Cd)};static \u0275prov=y({token:Cd,factory:Cd.\u0275fac})};return t=b([w(nf)],t),t})(),Mf=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),of=class{static fToken=Symbol("NotifyNodesRenderedRequest")},cm=new ue("F_FLOW"),im=class{},uA=(()=>{let t=class xd{_state=u(Mf);_fFlow=u(cm);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||xd)};static \u0275prov=y({token:xd,factory:xd.\u0275fac})};return t=b([w(of)],t),t})(),rf=class{static fToken=Symbol("NotifyFullRenderedRequest")},fA=(()=>{let t=class bd{_state=u(Mf);_fFlow=u(cm);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||bd)};static \u0275prov=y({token:bd,factory:bd.\u0275fac})};return t=b([w(rf)],t),t})(),or=class{targetConnectionsRevision;targetNodesRevision;callback;destroyRef;static fToken=Symbol("WaitForConnectionsRenderedRequest");constructor(i,e,n,o){this.targetConnectionsRevision=i,this.targetNodesRevision=e,this.callback=n,this.destroyRef=o}},pA=(()=>{let t=class wd{_store=u(k);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:o,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){o();return}let a=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(a(),o())});r.onDestroy(a)}static \u0275fac=function(n){return new(n||wd)};static \u0275prov=y({token:wd,factory:wd.\u0275fac})};return t=b([w(or)],t),t})(),af=class{static fToken=Symbol("ResetRenderLifecycleRequest")},hA=(()=>{let t=class Sd{_state=u(Mf);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||Sd)};static \u0275prov=y({token:Sd,factory:Sd.\u0275fac})};return t=b([w(af)],t),t})(),sf=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(i){this.destroyRef=i}},vv=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),mA=(()=>{let t=class Td{_state=u(vv);_store=u(k);_mediator=u(D);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 o=this._state.pendingRedraw;n(),this._state.isWaitingForViewportAnimation=!1,this._state.pendingRedraw=!1,o&&this._mediator.execute(new No)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||Td)};static \u0275prov=y({token:Td,factory:Td.\u0275fac})};return t=b([w(sf)],t),t})(),_A=[oA,rA,...dA,lA,Mf,uA,fA,pA,hA,vv,mA],cf=class{static fToken=Symbol("ClearSelectionRequest")},gA=(()=>{let t=class Id{_dragContext=u(Q);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Id)};static \u0275prov=y({token:Id,factory:Id.\u0275fac})};return t=b([w(cf)],t),t})(),df=class{static fToken=Symbol("CalculateSelectableItemsRequest")},vA=(()=>{let t=class Ed{_mediator=u(D);_store=u(k);_dragContext=u(Q);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 Fe(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new Fe(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Ed)};static \u0275prov=y({token:Ed,factory:Ed.\u0275fac})};return t=b([w(df)],t),t})(),rr=class{static fToken=Symbol("GetCurrentSelectionRequest")},yA=(()=>{let t=class Pd{_dragContext=u(Q);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||Pd)};static \u0275prov=y({token:Pd,factory:Pd.\u0275fac})};return t=b([w(rr)],t),t})(),lf=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(i,e,n=!0){this.nodes=i,this.connections=e,this.isSelectedChanged=n}},CA=(()=>{let t=class Md{_dragContext=u(Q);_store=u(k);handle(e){this._dragContext.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragContext.selectedItems=[],e.nodes.forEach(n=>{let o=this._store.nodes.get(n);o&&(o.markAsSelected(),this._dragContext.selectedItems.push(o))}),e.connections.forEach(n=>{let o=this._store.connections.get(n);o&&(o.markAsSelected(),this._dragContext.selectedItems.push(o))}),this._dragContext.isSelectedChanged=e.isSelectedChanged}static \u0275fac=function(n){return new(n||Md)};static \u0275prov=y({token:Md,factory:Md.\u0275fac})};return t=b([w(lf)],t),t})(),uf=class{static fToken=Symbol("SelectAllRequest")},xA=(()=>{let t=class kd{_dragSession=u(Q);_store=u(k);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||kd)};static \u0275prov=y({token:kd,factory:kd.\u0275fac})};return t=b([w(uf)],t),t})(),Wi=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(i){this.nodeOrGroup=i}},ff=class{fItemsContainer;allElements;elementsThatShouldBeInFront;targetIndex;static fToken=Symbol("MoveFrontElementsBeforeTargetElementRequest");constructor(i,e,n,o){this.fItemsContainer=i,this.allElements=e,this.elementsThatShouldBeInFront=n,this.targetIndex=o}},bA=(()=>{let t=class Dd{handle(e){let n=[];for(let o=e.targetIndex+1;o<e.allElements.length;o++){let r=e.allElements[o];e.elementsThatShouldBeInFront.includes(r)||n.push(r)}n.forEach(o=>{e.fItemsContainer.removeChild(o),e.fItemsContainer.insertBefore(o,e.allElements[e.targetIndex])})}static \u0275fac=function(n){return new(n||Dd)};static \u0275prov=y({token:Dd,factory:Dd.\u0275fac})};return t=b([w(ff)],t),t})(),ri=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(i,e){this.item=i,this.itemContainer=e}},$i=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(i){this.nodeOrGroupId=i}},wA=(()=>{let t=class Od{_store=u(k);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 o=this._store.nodes.getAll().filter(r=>r.fParentId()===e);return o.reduce((r,a)=>r.concat(this._getChildrenNodes(a.fId(),n)),o)}static \u0275fac=function(n){return new(n||Od)};static \u0275prov=y({token:Od,factory:Od.\u0275fac})};return t=b([w($i)],t),t})(),SA=(()=>{let t=class Nd{_store=u(k);_mediator=u(D);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()),o=this._getChildrenGroups(n);this._updateLayers(this._groupsContainer,e.item.hostElement,o);let r=this._getChildrenNodes(n);r.length&&this._updateLayers(this._nodesContainer,r[0],r)}_handleNode(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),o=this._getChildrenNodes(n);this._updateLayers(e.itemContainer,e.item.hostElement,o)}_handleConnection(e){this._updateLayers(e.itemContainer,e.item.hostElement,[])}_updateLayers(e,n,o){let r=Array.from(e.children),a=r.findIndex(s=>s===n);this._isAnythingNeedToBeMoved(r,a,o)&&this._mediator.execute(new ff(e,r,o,a))}_isAnythingNeedToBeMoved(e,n,o){for(let r=n+1;r<e.length;r++)if(!o.includes(e[r]))return!0;return!1}_getChildrenGroups(e){let n=Array.from(this._groupsContainer.children);return e.filter(o=>this._groupsContainer.contains(o)).sort((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodes(e){let n=Array.from(this._nodesContainer.children);return e.filter(o=>this._nodesContainer.contains(o)).sort((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodesAndGroups(e){return this._mediator.execute(new $i(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Nd)};static \u0275prov=y({token:Nd,factory:Nd.\u0275fac})};return t=b([w(ri)],t),t})(),TA=(()=>{let t=class Rd{_dragSession=u(Q);_mediator=u(D);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new ri(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||Rd)};static \u0275prov=y({token:Rd,factory:Rd.\u0275fac})};return t=b([w(Wi)],t),t})(),IA=[gA,vA,yA,CA,xA,TA],pf=class{static fToken=Symbol("ResetZoomRequest")},EA=(()=>{let t=class Ad{_store=u(k);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||Ad)};static \u0275prov=y({token:Ad,factory:Ad.\u0275fac})};return t=b([w(pf)],t),t})(),hf=class{position;step;direction;animate;static fToken=Symbol("SetZoomRequest");constructor(i,e,n,o=!1){this.position=i,this.step=e,this.direction=n,this.animate=o}},PA=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),MA=new Set(["drag-canvas","selection-area"]),kA=(()=>{let t=class Fd{_mediator=u(D);_store=u(k);_dragContext=u(Q,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(Te.ZOOM)}get _isDragStarted(){return this._mediator.execute(new kn)}handle(e){if(!this._zoomComponent)return;let n=this._canvas.transform.scale,o=this._clamp(n+e.step*e.direction);if(o===n)return;let r=this._castPositionToFlow(e.position);if(this._isDragStarted){let a=this._getDragZoomMode();if(a==="blocked")return;a==="rebase"&&this._rebaseDragContext(r,o)}this._canvas.setScale(o,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 Z.fromPoint(e).elementTransform(this._flowHost)}_getDragZoomMode(){if(this._dragContext?.isEmpty())return"blocked";let e=!1;for(let n of this._dragContext?.draggableItems??[]){let o=n.getEvent().kind;if(PA.has(o)){e=!0;continue}if(!MA.has(o))return"blocked"}return e?"rebase":"direct"}_rebaseDragContext(e,n){if(!this._dragContext)return;let o=this._dragContext.onPointerDownScale;if(!o||o===n){this._dragContext.onPointerDownScale=n;return}let r=1/n-1/o;this._dragContext.onPointerDownPosition=Z.fromPoint(this._dragContext.onPointerDownPosition).add(Z.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||Fd)};static \u0275prov=y({token:Fd,factory:Fd.\u0275fac})};return t=b([w(hf)],t),t})(),DA=[EA,kA],mf=class{static fToken=Symbol("MinimapDrawNodesRequest")},OA=(()=>{let t=class Ld{_browser=u(ze);_store=u(k);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;return!n||!o?[]:this._store.nodes.getAll().map(a=>this._renderNode(a,n,o))}_renderNode(e,n,o){let r=Ni("rect",this._browser);Np(this._nodeRect(e,n,o),r);let a=e instanceof Ef;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,o){let r=V.elementTransform(V.fromElement(e.hostElement),n.hostElement);return V.div(r,o.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=b([w(mf)],t),t})(),_f=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(i,e){this.svg=i,this.minSize=e}},NA=(()=>{let t=class zd{_mediator=u(D);_store=u(k);handle({svg:e,minSize:n}){let o=this._store.fFlow,r=this._store.fCanvas;if(!o||!r)return{scale:1,viewBox:V.initialize(0,0,0,0)};let a=this._contentRectInMinimapSpace(o,r,n),s=this._minimapRectInFlowSpace(e,o),c=this._viewportScale(a,s),l=this._viewportViewBox(a,s,c);return{scale:c,viewBox:l}}_contentRectInMinimapSpace(e,n,o){let r=this._nodesBoundingBox(),a=V.elementTransform(r,e.hostElement),s=V.div(a,n.transform.scale);return Xg(s,o)}_nodesBoundingBox(){return this._mediator.execute(new Hi)??V.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return V.elementTransform(V.fromElement(e),n.hostElement)}_viewportScale(e,n){let o=n.width||1,r=n.height||1;return Math.max(e.width/o,e.height/r)}_viewportViewBox(e,n,o){let r=this._viewportSize(n,o),a=e.x-(r.width-e.width)/2,s=e.y-(r.height-e.height)/2;return V.initialize(a,s,r.width,r.height)}_viewportSize(e,n){return et.initialize(e.width*n||0,e.height*n||0)}static \u0275fac=function(n){return new(n||zd)};static \u0275prov=y({token:zd,factory:zd.\u0275fac})};return t=b([w(_f)],t),t})(),gf=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},RA=(()=>{let t=class Bd{_store=u(k);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;if(!n||!o)return V.initialize();let r=V.div(V.fromElement(n.hostElement),o.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||Bd)};static \u0275prov=y({token:Bd,factory:Bd.\u0275fac})};return t=b([w(gf)],t),t})(),vf=class{element;scale;viewBox;constructor(i,e=1,n=V.initialize(0,0,0,0)){this.element=i,this.scale=e,this.viewBox=n}},AA=[OA,NA,RA],yf=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(i){this.position=i}},FA=(()=>{let t=class qd{_store=u(k);handle({position:e}){return Yi(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||qd)};static \u0275prov=y({token:qd,factory:qd.\u0275fac})};return t=b([w(yf)],t),t})(),Cf=class{static fToken=Symbol("SortNodeLayersRequest")},LA=(()=>{let t=class Gd{_store=u(k);_mediator=u(D);_browser=u(ze);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((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodes(e){return this._mediator.execute(new $i(e)).filter(n=>this._nodesContainer.contains(n.hostElement)).map(n=>n.hostElement)}_moveChildrenNodes(e){let n=this._browser.document.createDocumentFragment();e.forEach(o=>{n.appendChild(o)}),this._nodesContainer.appendChild(n)}static \u0275fac=function(n){return new(n||Gd)};static \u0275prov=y({token:Gd,factory:Gd.\u0275fac})};return t=b([w(Cf)],t),t})(),ar=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(i){this.itemsContainer=i}},zA=(()=>{let t=class Hd{_store=u(k);_browser=u(ze);handle({itemsContainer:e}){let n=Array.from(e.children);if(n.length<2)return;let o=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 l=this._getSortedChildrenBeforeParent(e,o,c,a,s);l.length&&this._moveBeforeNextSibling(e,l,c.hostElement.nextElementSibling)}}_buildPositions(e){let n=new Map;for(let o=0;o<e.length;o++)n.set(e[o],o);return n}_getSortedChildrenBeforeParent(e,n,o,r,a){let s=n.get(o.hostElement);if(s===void 0)return[];let c=this._getDeepChildren(o.fId(),r,a);if(!c.length)return[];let l=[];for(let f of c){let m=f.hostElement;if(!e.contains(m))continue;let x=n.get(m);x===void 0||x>=s||l.push(m)}return l.sort((f,m)=>(n.get(f)??0)-(n.get(m)??0)),l}_buildChildrenByParentId(e){let n=new Map;for(let o of e){let r=o.fParentId();if(!r)continue;let a=n.get(r)??[];a.push(o),n.set(r,a)}return n}_getDeepChildren(e,n,o){let r=o.get(e);if(r)return r;let a=[],s=[...n.get(e)??[]],c=new Set([e]);for(;s.length;){let l=s.pop();if(!l)continue;let f=l.fId();if(c.has(f))continue;c.add(f),a.push(l);let m=n.get(f);m?.length&&s.push(...m)}return o.set(e,a),a}_moveBeforeNextSibling(e,n,o){let r=this._browser.document.createDocumentFragment();for(let a of n)r.appendChild(a);e.insertBefore(r,o)}static \u0275fac=function(n){return new(n||Hd)};static \u0275prov=y({token:Hd,factory:Hd.\u0275fac})};return t=b([w(ar)],t),t})(),xf=class{static fToken=Symbol("SortItemLayersRequest")},BA=(()=>{let t=class Vd{_store=u(k);_mediator=u(D);get _canvas(){return this._store.fCanvas}handle(e){if(!this._canvas)return;let n=this._store.nodes.getAll();n.length<2||!n.some(o=>!!o.fParentId())||(this._mediator.execute(new ar(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new Cf),this._mediator.execute(new ar(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||Vd)};static \u0275prov=y({token:Vd,factory:Vd.\u0275fac})};return t=b([w(xf)],t),t})();function Ni(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}function Ct(t,i){return i(t)}function It(t){return!0}function qA(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var GA=[...sD,...m2,...Xk,...eA,...A2,..._A,...K2,...IA,...DA,...AA,...CO,wA,xO,TO,FA,BA,zA,LA,SA,bA],HA=0,yv=(()=>{class t{_destroyRef=u(it);_elementReference=u(Ne);_fBrowser=u(ze);_stateChanges=new yt;get hostElement(){return this._elementReference.nativeElement}id=O(`f-pattern-${HA++}`);vColor=O("rgba(0,0,0,0.1)");hColor=O("rgba(0,0,0,0.1)");vSize=O(20,{transform:$e});hSize=O(20,{transform:$e});_transform=vn.default();_position=A.initialize();_size=et.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=Ni("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=Ni("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=Ni("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new Bt(this._stateChanges).pipe(bf()).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=et.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,o,r,a,s){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${o}`),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=K({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,o){n&2&&G("id",o.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[ge([{provide:Up,useExisting:t}]),Ci],decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})();var VA=new ue("F_BACKGROUND"),jA=(()=>{class t{hostElement=u(Ne).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})(),Cv=(()=>{class t extends jA{_mediator=u(D);fBackgroundPattern=Qr(Up);ngOnInit(){this._mediator.execute(new Sn(Te.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new jd(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new Tn(Te.BACKGROUND))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-background"]],contentQueries:function(n,o,r){n&1&&Ip(r,o.fBackgroundPattern,Up,5),n&2&&ct()},hostAttrs:[1,"f-component","f-background"],features:[ge([{provide:VA,useExisting:t}]),he],ngContentSelectors:wk,decls:2,vars:0,template:function(n,o){n&1&&(Kt(),Je(),W(0,"svg"),ke(1),$())},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 om=class{position;scale;constructor(i,e){this.position=i,this.scale=e}},UA=new ue("F_CANVAS"),WA=(()=>{class t{transform=vn.default();_fCanvasChange=new yt;destroyRef=u(it);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new Bt(this._fCanvasChange).pipe(Ud(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new om(A.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})(),sr=(()=>{class t extends WA{_mediator=u(D);_componentsStore=u(k);_elementReference=u(Ne);_injector=u(Ye);_flowId;fCanvasChange=Ve();position=O(A.initialize(),{transform:A.castToPoint});scale=O(1,{transform:$e});debounceTime=O(0,{transform:$e});debounce=S(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=Ae.required("fGroupsContainer");fNodesContainer=Ae.required("fNodesContainer");fConnectionsContainer=Ae.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new Ju).fId(),this._mediator.execute(new $d(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){J(()=>{this._mediator.execute(new Xd(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){J(()=>{this._mediator.execute(new Zd(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new To(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=vn.toString(this.transform),this._mediator.execute(new wn)}redrawWithAnimation(){this._mediator.execute(new To(this.transform)),this.hostElement.style.transition=`transform ${qA()?80:150}ms ease-in-out`,this.hostElement.style.transform=vn.toString(this.transform),k0(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new Kd(e,n))})}fitToScreen(e=A.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new Yd(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new el(e))})}getScale(){return this.transform.scale||1}setScale(e,n=A.initialize()){this._mediator.execute(new tl(e,n))}resetScale(){this._mediator.execute(new Jd)}ngOnDestroy(){this._mediator.execute(new Qd)}_afterRedraw(e){this._mediator.execute(new or(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>yo(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-canvas"]],viewQuery:function(n,o){n&1&&Tt(o.fGroupsContainer,Sk,5)(o.fNodesContainer,Tk,5)(o.fConnectionsContainer,Ik,5),n&2&&ct(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[ge([{provide:UA,useExisting:t}]),he],ngContentSelectors:Pk,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,o){n&1&&(Kt(Ek),Kr(0),W(1,"div",null,0),ke(3),$(),W(4,"div",3,1),ke(6,1),ke(7,2),ke(8,3),$(),W(9,"div",null,2),ke(11,4),$(),Yr())},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 $A=0,xv=(()=>{class t extends nO{fId=O(`f-connection-${$A++}`,{alias:"fConnectionId"});fOutputId=O("",{transform:e=>Bi(e)||""});fInputId=O("",{transform:e=>Bi(e)||""});fRadius=8;fOffset=12;fBehavior=xn.FIXED;fType=ki.STRAIGHT;fSelectionDisabled=O(!1,{transform:me});fReassignableStart=O(!1,{transform:me});fDraggingDisabled=O(!1,{alias:"fReassignDisabled",transform:me});fInputSide=O(Se.DEFAULT,{transform:e=>Mi(e,"fInputSide",Se)});fOutputSide=O(Se.DEFAULT,{transform:e=>Mi(e,"fOutputSide",Se)});get boundingElement(){return this.fPath().hostElement}_mediator=u(D);ngOnInit(){this._mediator.execute(new il(this))}ngOnChanges(){this._mediator.execute(new Zn)}ngOnDestroy(){this._mediator.execute(new Pl(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,o){n&2&&(G("id",o.fId()),de("f-connection-selection-disabled",o.fSelectionDisabled())("f-connection-reassign-disabled",o.fDraggingDisabled()))},inputs:{fId:[1,"fConnectionId","fId"],fOutputId:[1,"fOutputId"],fInputId:[1,"fInputId"],fRadius:[2,"fRadius","fRadius",$e],fOffset:[2,"fOffset","fOffset",$e],fBehavior:[2,"fBehavior","fBehavior",e=>Mi(e,"fBehavior",xn)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:wf,useExisting:t}]),he,Ci],ngContentSelectors:kk,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,o){if(n&1&&(Kt(Mk),Je(),p(0,"svg",1),R(1,"defs",null,0),ke(3),p(4,"g",2),T(5,Dk,1,1,":svg:linearGradient",3),R(6,"path",4),p(7,"g"),R(8,"path",5),T(9,Ok,1,0,":svg:circle",6),R(10,"circle",7),h()()(),ke(11,1),ke(12,2),ke(13,3),T(14,Nk,1,0)),n&2){let r;d(5),I((r=o.fGradient())?5:-1,r),d(),G("d",o.path),d(2),M("useGradient",!!o.fGradient()),G("d",o.path),d(),I(o.fReassignableStart()?9:-1),d(5),I(o.fContents().length?14:-1)}},dependencies:[sh,QD,JD,WD,ZD],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 KA=new ue("F_MAGNETIC_LINES"),YA=(()=>{class t{hostElement=u(Ne).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})();var bv=(()=>{class t extends YA{threshold=O(10,{transform:$e,alias:"fAlignThreshold"});_mediator=u(D);ngOnInit(){this._mediator.execute(new Sn(Te.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new Tn(Te.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:KA,useExisting:t}]),he],decls:0,vars:0,template:function(n,o){},styles:[Rk]})}return t})();var Hp=(()=>{class t{fMinSize=O(1e3);_mediator=u(D);hostElement=u(Ne).nativeElement;model=new vf(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new _f(this.hostElement,this.fMinSize()));this.model=new vf(this.hostElement,e,n),Zg(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),Vp=(()=>{class t{_mediator=u(D);_elementRef=u(Ne);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new mf).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),jp=(()=>{class t{_mediator=u(D);hostElement=u(Ne).nativeElement;redraw(){Np(this._mediator.execute(new gf),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),XA=new ue("F_MINIMAP_BASE"),ZA=(()=>{class t{hostElement=u(Ne).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})(),wv=(()=>{class t extends ZA{_destroyRef=u(it);_mediator=u(D);_browser=u(ze);_store=u(k);_canvas=Ae.required(Vp);_flow=Ae.required(Hp);_minimapView=Ae.required(jp);fMinSize=O(1e3);fNodeRenderLimit=O(1500,{transform:$e});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new Sn(Te.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new Wd).pipe(bf(),zk()).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 Tn(Te.MINIMAP))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-minimap"]],viewQuery:function(n,o){n&1&&Tt(o._canvas,Vp,5)(o._flow,Hp,5)(o._minimapView,jp,5),n&2&&ct(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[ge([{provide:XA,useExisting:t}]),he],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,o){n&1&&(Je(),p(0,"svg",0),R(1,"g",1)(2,"rect",2),h()),n&2&&M("fMinSize",o.fMinSize())},dependencies:[Hp,Vp,jp],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var QA=(()=>{class t{hostElement=u(Ne).nativeElement;initialize(){this.hostElement.style.display="none"}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,standalone:!1})}return t})(),Sv=(()=>{class t extends QA{_mediator=u(D);fTrigger=e=>e.shiftKey;ngOnInit(){this._mediator.execute(new Sn(Te.SELECTION_AREA,this)),super.initialize()}ngOnDestroy(){this._mediator.execute(new Tn(Te.SELECTION_AREA))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-selection-area"]],hostAttrs:[1,"f-selection-area","f-component"],inputs:{fTrigger:"fTrigger"},features:[he],decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{position:absolute}"]})}return t})();var JA=0,eF=120,cr=(()=>{class t extends im{_destroyRef=u(it);_mediator=u(D);_browser=u(ze);_componentsStore=u(k);_cache=u(qt);_injector=u(Ye);fId=O(`f-flow-${JA++}`,{alias:"fFlowId"});fCache=O(!1,{transform:me});hostElement=u(Ne).nativeElement;fNodesRendered=Ve();fFullRendered=Ve();fLoaded=Ve();ngOnInit(){this._mediator.execute(new Zu(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){J(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new Bt(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(bf(),Ud(eF),Lk()).listen(this._destroyRef,()=>{this._mediator.execute(new kn)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new xf),this._mediator.execute(new of),this._mediator.execute(new or(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new rf),this._destroyRef)),this._mediator.execute(new Zn))})}_listenConnectionsChanges(){this._mediator.execute(new Di).listen(this._destroyRef,()=>{if(!this._mediator.execute(new kn)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new sf(this._destroyRef));return}this._mediator.execute(new No)}})}redraw(){this._mediator.execute(new Zn)}reset(){this._mediator.execute(new af)}getNodesBoundingBox(){return this._mediator.execute(new $u)}getSelection(){return this._mediator.execute(new rr)}getPositionInFlow(e){return this._mediator.execute(new yf(e))}getState(e){return this._mediator.execute(new tf(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new Di).pipe(i0()).listen(this._destroyRef,()=>{this._mediator.execute(new uf)})}select(e,n,o=!0){this._mediator.execute(new Di).pipe(i0()).listen(this._destroyRef,()=>{this._mediator.execute(new lf(e,n,o))})}clearSelection(){this._mediator.execute(new cf)}ngOnDestroy(){this._mediator.execute(new nf(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,o){n&2&&G("id",o.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[ge([D,...Wk,H0,Ki,...GA,Q,...f2,{provide:cm,useExisting:t}]),he],ngContentSelectors:Fk,decls:7,vars:0,template:function(n,o){n&1&&(Kt(Ak),Kr(0),ke(1),ke(2,1),ke(3,2),ke(4,3),ke(5,4),ke(6,5),Yr())},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 Tv=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=u(Wr);_tpl=u(eg);_zone=u(Vn);_componentsStore=u(k,{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 o=()=>{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(o);return}this._rafId=null,this._finishProgressiveRender()};this._rafId=requestAnimationFrame(o)})}_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=Ee({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[Ci]})}return t})();var Et=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(Et||{}),tF=new ue("F_ZOOM"),rm=class{},nF=.1,iF=1,oF=.5,rF=60,aF=.5;function sF(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function cF(t,i,e){return dF(t)?uF(i,e):lF(i,e)}function dF(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function lF(t,i){let e=Math.abs(t)/100,n=Iv(e,nF,iF);return i*n}function uF(t,i){if(Math.abs(t)<oF)return 0;let e=Math.abs(t)/rF,n=Iv(e,0,aF);return i*n}function Iv(t,i,e){return Math.max(i,Math.min(e,t))}var dr=(()=>{class t extends rm{_mediator=u(D);_injector=u(Ye);_store=u(k);_triggersListener=ve.emptyListener();isEnabled=O(!1,{alias:"fZoom",transform:me});fWheelTrigger=It;fDblClickTrigger=It;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 Sn(Te.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){J(()=>{this.isEnabled(),At(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,ve.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,ve.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!Ct(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let o=sF(e);if(o===0)return;let r=this._normalizeWheelStep(e,o);r!==0&&this.setZoom(A.initialize(e.clientX,e.clientY),r,this._calculateDirection(o),!1)};_normalizeWheelStep(e,n){return cF(e,n,this.step)}_calculateDirection(e){return e>0?Et.ZOOM_OUT:Et.ZOOM_IN}_onDoubleClick=e=>{if(!Ct(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;IN(n)||n?.closest("[fLockedContext]")||this.setZoom(A.initialize(e.clientX,e.clientY),this.dblClickStep,Et.ZOOM_IN,!0)};_getToCenterPosition(e,n){return A.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(Et.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(Et.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,V.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,o,r){this._mediator.execute(new hf(e,n,o,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new pf)}_disposeListeners(){this._triggersListener(),this._triggersListener=ve.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new Tn(Te.ZOOM))}_listen(e,n,o){this._flowHost.addEventListener(e,n,o)}_unlisten(e,n,o){this._flowHost.removeEventListener(e,n,o)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275dir=Ee({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",$e],maximum:[2,"fZoomMaximum","maximum",$e],step:[2,"fZoomStep","step",$e],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",$e]},features:[ge([{provide:tF,useExisting:t}]),he]})}return t})();var Ev=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=xi({type:t});static \u0275inj=vi({imports:[Si]})}return t})();var sp=ik(SP(),1);var zr=(function(t){return t.NETWORK_SIMPLEX="network-simplex",t.TIGHT_TREE="tight-tree",t.LONGEST_PATH="longest-path",t})(zr||{}),IY={direction:si.TOP_BOTTOM,nodeGap:48,layerGap:64,algorithm:zr.NETWORK_SIMPLEX,defaultNodeSize:et.initialize(120,72)},F_=(()=>{class t extends Qu{constructor(){super(IY)}mergeOptions(e,n={}){return Hn(ce(ce({},e),n),{defaultNodeSize:n.defaultNodeSize?et.initialize(n.defaultNodeSize.width,n.defaultNodeSize.height):et.initialize(e.defaultNodeSize.width,e.defaultNodeSize.height)})}async calculate(e,n,o){let r=this.resolveLayoutOptions(o),a=this._buildGraph(e,n,r),s=new Map;return sp.layout(a),a.nodes().forEach(c=>{let l=a.node(c),f=e.find(x=>x.id===c);if(!l||!f)return;let m=f.size??r.defaultNodeSize;s.set(c,A.initialize(l.x-m.width/2,l.y-m.height/2))}),{nodes:_v(e,s)}}_buildGraph(e,n,o){let r=new sp.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:this._mapDirection(o.direction),nodesep:o.nodeGap,ranksep:o.layerGap,ranker:this._mapAlgorithm(o.algorithm)}),e.forEach(a=>{let s=a.size??o.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 zr.TIGHT_TREE:return"tight-tree";case zr.LONGEST_PATH:return"longest-path";case zr.NETWORK_SIMPLEX:default:return"network-simplex"}}_mapDirection(e){switch(e){case si.BOTTOM_TOP:return"BT";case si.LEFT_RIGHT:return"LR";case si.RIGHT_LEFT:return"RL";case si.TOP_BOTTOM:default:return"TB"}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var on={loading:"Loading collection",errorTitle:"Failed to load",emptyTitle:"No nodes match the current filters.",resetFilters:"Reset filters",a11y:{toolbar:"Map controls",panel:"Selected node details"},toolbar:{zoomIn:"Zoom in",zoomOut:"Zoom out",fitToScreen:"Fit to screen",resetLayoutLabel:"Reset layout",resetLayoutTooltip:"Reset layout (re-run auto layout, clear saved positions)",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:"Reset layout?",message:"Reset all node positions to the automatic layout. This cannot be undone.",accept:"Reset",reject:"Cancel"}};var lo={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0},inspector:{actionMocks:!1}};var EY="adaptive-curve",L_=["segment","straight","bezier","adaptive-curve"],TP="sm.graph.connection-type",IP="sm.graph.layout-algorithm",EP="sm.graph.layout-direction",PP="sm.graph.layout-spacing",lp=(()=>{class t{_connectionType=z(cp(TP,PY,EY));_layoutAlgorithm=z(cp(IP,Ag,Og));_layoutDirection=z(cp(EP,Fg,Ng));_layoutSpacing=z(cp(PP,Lg,Rg));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),dp(TP,e))}setLayoutAlgorithm(e){this._layoutAlgorithm()!==e&&(this._layoutAlgorithm.set(e),dp(IP,e))}setLayoutDirection(e){this._layoutDirection()!==e&&(this._layoutDirection.set(e),dp(EP,e))}setLayoutSpacing(e){this._layoutSpacing()!==e&&(this._layoutSpacing.set(e),dp(PP,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 cp(t,i,e){let n=null;try{n=localStorage.getItem(t)}catch{return e}return n&&i(n)?n:e}function dp(t,i){try{localStorage.setItem(t,i)}catch{}}function PY(t){return typeof t=="string"&&L_.includes(t)}var MY={TOP_BOTTOM:{output:Se.BOTTOM,input:Se.TOP},BOTTOM_TOP:{output:Se.TOP,input:Se.BOTTOM},LEFT_RIGHT:{output:Se.RIGHT,input:Se.LEFT},RIGHT_LEFT:{output:Se.LEFT,input:Se.RIGHT}};function MP(t,i){return pa(t)?MY[i]:{input:Se.CALCULATE,output:Se.CALCULATE}}var kP=`
211
- .p-popover {
212
- margin-block-start: dt('popover.gutter');
213
- background: dt('popover.background');
214
- color: dt('popover.color');
215
- border: 1px solid dt('popover.border.color');
216
- border-radius: dt('popover.border.radius');
217
- box-shadow: dt('popover.shadow');
218
- will-change: transform;
219
- }
220
-
221
- .p-popover-content {
222
- padding: dt('popover.content.padding');
223
- }
224
-
225
- .p-popover-flipped {
226
- margin-block-start: calc(dt('popover.gutter') * -1);
227
- margin-block-end: dt('popover.gutter');
228
- }
229
-
230
- .p-popover:after,
231
- .p-popover:before {
232
- bottom: 100%;
233
- left: calc(dt('popover.arrow.offset') + dt('popover.arrow.left'));
234
- content: ' ';
235
- height: 0;
236
- width: 0;
237
- position: absolute;
238
- pointer-events: none;
239
- }
240
-
241
- .p-popover:after {
242
- border-width: calc(dt('popover.gutter') - 2px);
243
- margin-left: calc(-1 * (dt('popover.gutter') - 2px));
244
- border-style: solid;
245
- border-color: transparent;
246
- border-bottom-color: dt('popover.background');
247
- }
248
-
249
- .p-popover:before {
250
- border-width: dt('popover.gutter');
251
- margin-left: calc(-1 * dt('popover.gutter'));
252
- border-style: solid;
253
- border-color: transparent;
254
- border-bottom-color: dt('popover.border.color');
255
- }
256
-
257
- .p-popover-flipped:after,
258
- .p-popover-flipped:before {
259
- bottom: auto;
260
- top: 100%;
261
- }
262
-
263
- .p-popover.p-popover-flipped:after {
264
- border-bottom-color: transparent;
265
- border-top-color: dt('popover.background');
266
- }
267
-
268
- .p-popover.p-popover-flipped:before {
269
- border-bottom-color: transparent;
270
- border-top-color: dt('popover.border.color');
271
- }
272
- `;var OY=["content"],NY=["*"],RY=t=>({closeCallback:t});function AY(t,i){}function FY(t,i){t&1&&be(0,AY,0,0,"ng-template")}function LY(t,i){if(t&1){let e=se();p(0,"div",1),H("click",function(o){B(e);let r=_();return q(r.onOverlayClick(o))})("pMotionOnEnter",function(o){B(e);let r=_();return q(r.onAnimationStart(o))})("pMotionOnAfterLeave",function(){B(e);let o=_();return q(o.onAnimationEnd())}),p(1,"div",2),H("click",function(o){B(e);let r=_();return q(r.onContentClick(o))})("mousedown",function(o){B(e);let r=_();return q(r.onContentClick(o))}),ke(2),be(3,FY,1,0,null,3),h()()}if(t&2){let e=_();Zr(e.sx("root")),Re(e.cn(e.cx("root"),e.styleClass)),M("pBind",e.ptm("root"))("ngStyle",e.style)("pMotion",e.overlayVisible)("pMotionAppear",!0)("pMotionOptions",e.computedMotionOptions()),G("aria-modal",e.overlayVisible)("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy),d(),Re(e.cx("content")),M("pBind",e.ptm("content")),d(2),M("ngTemplateOutlet",e.contentTemplate||e._contentTemplate)("ngTemplateOutletContext",vt(17,RY,e.onCloseClick.bind(e)))}}var zY={root:()=>({position:"absolute"})},BY={root:"p-popover p-component",content:"p-popover-content"},DP=(()=>{class t extends na{name="popover";style=kP;classes=BY;inlineStyles=zY;static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),OP=new ue("POPOVER_INSTANCE"),z_=(()=>{class t extends oa{componentName="Popover";$pcPopover=u(OP,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=u(Ft,{self:!0});onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptm("host"))}ariaLabel;ariaLabelledBy;dismissable=!0;style;styleClass;appendTo=O("body");autoZIndex=!0;ariaCloseLabel;baseZIndex=0;focusOnShow=!0;showTransitionOptions=".12s cubic-bezier(0, 0, 0.2, 1)";hideTransitionOptions=".1s linear";motionOptions=O(void 0);computedMotionOptions=S(()=>ce(ce({},this.ptm("motion")),this.motionOptions()));onShow=new st;onHide=new st;$appendTo=S(()=>this.appendTo()||this.config.overlayAppendTo());container;overlayVisible=!1;render=!1;selfClick=!1;documentClickListener;target;willHide;scrollHandler;documentResizeListener;contentTemplate;templates;_contentTemplate;destroyCallback;overlayEventListener;overlaySubscription;_componentStyle=u(DP);zone=u(Vn);overlayService=u(pg);onAfterContentInit(){this.templates.forEach(e=>{e.getType()==="content"&&(this._contentTemplate=e.template)})}bindDocumentClickListener(){if(an(this.platformId)&&!this.documentClickListener){let e=lg()?"touchstart":"click",n=this.el?this.el.nativeElement.ownerDocument:this.document;this.documentClickListener=this.renderer.listen(n,e,o=>{this.dismissable&&(!this.container?.contains(o.target)&&this.target!==o.target&&!this.target.contains(o.target)&&!this.selfClick&&this.hide(),this.selfClick=!1,this.cd.markForCheck())})}}unbindDocumentClickListener(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null,this.selfClick=!1)}toggle(e,n){this.overlayVisible?(this.hasTargetChanged(e,n)&&(this.destroyCallback=()=>{this.show(null,n||e.currentTarget||e.target)}),this.hide()):this.show(e,n)}show(e,n){n&&e&&e.stopPropagation(),this.container&&!this.overlayVisible&&(this.container=null),this.target=n||e.currentTarget||e.target,this.overlayVisible=!0,this.render=!0,this.cd.markForCheck()}onOverlayClick(e){this.overlayService.add({originalEvent:e,target:this.el.nativeElement}),this.selfClick=!0}onContentClick(e){let n=e.target;this.selfClick=e.offsetX<n.clientWidth&&e.offsetY<n.clientHeight}hasTargetChanged(e,n){return this.target!=null&&this.target!==(n||e.currentTarget||e.target)}appendOverlay(){this.$appendTo()&&this.$appendTo()!=="self"&&(this.$appendTo()==="body"?ta(this.document.body,this.container):ta(this.$appendTo(),this.container))}restoreAppend(){this.container&&this.$appendTo()&&this.$appendTo()!=="self"&&ta(this.el.nativeElement,this.container)}setZIndex(){this.autoZIndex&&aa.set("overlay",this.container,this.baseZIndex+this.config.zIndex.overlay)}align(){if(this.target&&this.container){cg(this.container,this.target,!1);let e=Mp(this.container),n=Mp(this.target),o=this.document.defaultView?.getComputedStyle(this.container).getPropertyValue("border-radius"),r=0;e.left<n.left&&(r=n.left-e.left-parseFloat(o)*2),this.container.style.setProperty(_g("popover.arrow.left").name,`${r}px`),e.top<n.top&&(this.container.setAttribute("data-p-popover-flipped","true"),!this.$unstyled()&&sg(this.container,"p-popover-flipped"))}}onAnimationStart(e){this.container=e.element,this.container?.setAttribute(this.$attrSelector,""),this.appendOverlay(),this.align(),this.setZIndex(),this.bindDocumentClickListener(),this.bindDocumentResizeListener(),this.bindScrollListener(),this.focusOnShow&&this.focus(),this.overlayEventListener=n=>{this.container&&this.container.contains(n.target)&&(this.selfClick=!0)},this.overlaySubscription=this.overlayService.clickObservable.subscribe(this.overlayEventListener),this.onShow.emit(null)}onAnimationEnd(){this.overlayVisible||(this.destroyCallback&&(this.destroyCallback(),this.destroyCallback=null),this.overlaySubscription&&this.overlaySubscription.unsubscribe(),this.autoZIndex&&aa.clear(this.container),this.onContainerDestroy(),this.onHide.emit({}),this.render=!1,this.container=null)}focus(){let e=dg(this.container,"[autofocus]");e&&this.zone.runOutsideAngular(()=>{setTimeout(()=>e.focus(),5)})}hide(){this.overlayVisible=!1,this.cd.markForCheck()}onCloseClick(e){this.hide(),e.preventDefault()}onEscapeKeydown(e){this.hide()}onWindowResize(){this.overlayVisible&&!ug()&&this.hide()}bindDocumentResizeListener(){if(an(this.platformId)&&!this.documentResizeListener){let e=this.document.defaultView;this.documentResizeListener=this.renderer.listen(e,"resize",this.onWindowResize.bind(this))}}unbindDocumentResizeListener(){this.documentResizeListener&&(this.documentResizeListener(),this.documentResizeListener=null)}bindScrollListener(){an(this.platformId)&&(this.scrollHandler||(this.scrollHandler=new gg(this.target,()=>{this.overlayVisible&&this.hide()})),this.scrollHandler.bindScrollListener())}unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}onContainerDestroy(){this.cd.destroyed||(this.target=null),this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.unbindScrollListener()}onDestroy(){this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.container&&this.autoZIndex&&aa.clear(this.container),this.cd.destroyed||(this.target=null),this.destroyCallback=null,this.container&&(this.restoreAppend(),this.onContainerDestroy()),this.overlaySubscription&&this.overlaySubscription.unsubscribe()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["p-popover"]],contentQueries:function(n,o,r){if(n&1&&Xr(r,OY,4)(r,Ii,4),n&2){let a;_t(a=gt())&&(o.contentTemplate=a.first),_t(a=gt())&&(o.templates=a)}},hostBindings:function(n,o){n&1&&H("keydown.escape",function(a){return o.onEscapeKeydown(a)},Ur)},inputs:{ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",dismissable:[2,"dismissable","dismissable",me],style:"style",styleClass:"styleClass",appendTo:[1,"appendTo"],autoZIndex:[2,"autoZIndex","autoZIndex",me],ariaCloseLabel:"ariaCloseLabel",baseZIndex:[2,"baseZIndex","baseZIndex",$e],focusOnShow:[2,"focusOnShow","focusOnShow",me],showTransitionOptions:"showTransitionOptions",hideTransitionOptions:"hideTransitionOptions",motionOptions:[1,"motionOptions"]},outputs:{onShow:"onShow",onHide:"onHide"},features:[ge([DP,{provide:OP,useExisting:t},{provide:ia,useExisting:t}]),$r([Ft]),he],ngContentSelectors:NY,decls:1,vars:1,consts:[["role","dialog","pMotionName","p-anchored-overlay",3,"pBind","class","style","ngStyle","pMotion","pMotionAppear","pMotionOptions"],["role","dialog","pMotionName","p-anchored-overlay",3,"click","pMotionOnEnter","pMotionOnAfterLeave","pBind","ngStyle","pMotion","pMotionAppear","pMotionOptions"],[3,"click","mousedown","pBind"],[4,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(n,o){n&1&&(Kt(),T(0,LY,4,19,"div",0)),n&2&&I(o.render?0:-1)},dependencies:[Si,Jr,og,sn,Ft,yg,vg],encapsulation:2,changeDetection:0})}return t})(),NP=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=xi({type:t});static \u0275inj=vi({imports:[z_,sn,sn]})}return t})();function GY(t,i){if(t&1){let e=se();p(0,"li",12)(1,"button",17),H("click",function(){let o=B(e).$implicit,r=_(),a=Yt(7);return r.setLayoutAlgorithm(o),q(a.hide())}),v(2),h()()}if(t&2){let e=i.$implicit,n=_();d(),de("is-active",n.layoutAlgorithm()===e),G("aria-checked",n.layoutAlgorithm()===e)("data-testid","graph-layout-algorithm-option-"+e),d(),qe(" ",n.layoutAlgorithmLabel(e)," ")}}function HY(t,i){if(t&1){let e=se();p(0,"button",18),H("click",function(){let o=B(e).$implicit,r=_(),a=Yt(12);return r.setLayoutDirection(o),q(a.hide())}),R(1,"i",19),h()}if(t&2){let e=i.$implicit,n=_();de("is-active",n.layoutDirection()===e),M("pTooltip",n.layoutDirectionLabel(e)),G("aria-checked",n.layoutDirection()===e)("aria-label",n.layoutDirectionLabel(e))("data-testid","graph-layout-direction-option-"+e),d(),Re(n.directionItemIcon(e))}}function VY(t,i){if(t&1){let e=se();p(0,"button",18),H("click",function(){let o=B(e).$implicit,r=_(),a=Yt(17);return r.setLayoutSpacing(o),q(a.hide())}),R(1,"i",19),h()}if(t&2){let e=i.$implicit,n=_();de("is-active",n.layoutSpacing()===e),M("pTooltip",n.layoutSpacingLabel(e)),G("aria-checked",n.layoutSpacing()===e)("aria-label",n.layoutSpacingLabel(e))("data-testid","graph-layout-spacing-option-"+e),d(),Re(n.spacingItemIcon(e))}}function jY(t,i){if(t&1){let e=se();p(0,"button",18),H("click",function(){let o=B(e).$implicit,r=_(),a=Yt(22);return r.setConnectionType(o),q(a.hide())}),Je(),p(1,"svg",20),R(2,"path",9),h()()}if(t&2){let e=i.$implicit,n=_();de("is-active",n.connectionType()===e),M("pTooltip",n.connectionTypeLabel(e)),G("aria-checked",n.connectionType()===e)("aria-label",n.connectionTypeLabel(e))("data-testid","graph-connection-type-option-"+e),d(2),G("d",n.connectionTypeItemPath(e))}}var RP={TOP_BOTTOM:"pi pi-arrow-down",BOTTOM_TOP:"pi pi-arrow-up",LEFT_RIGHT:"pi pi-arrow-right",RIGHT_LEFT:"pi pi-arrow-left"},AP={compact:"pi pi-window-minimize",normal:"pi pi-bars",spacious:"pi pi-window-maximize"},UY={segment:"M 2 14 L 8 14 L 8 2 L 14 2",straight:"M 2 14 L 14 2",bezier:"M 2 14 C 6 14, 10 2, 14 2","adaptive-curve":"M 2 14 C 8 14, 8 2, 14 2"},FP=(()=>{class t{graphPreferences=u(lp);texts=on;layoutAlgorithms=Pg;layoutDirections=kg;layoutSpacings=Dg;connectionTypes=L_;layoutAlgorithm=this.graphPreferences.layoutAlgorithm;layoutDirection=this.graphPreferences.layoutDirection;layoutSpacing=this.graphPreferences.layoutSpacing;connectionType=this.graphPreferences.connectionType;directionIcon=S(()=>RP[this.layoutDirection()]);spacingIcon=S(()=>AP[this.layoutSpacing()]);directionAvailable=S(()=>pa(this.layoutAlgorithm()));spacingAvailable=S(()=>Mg(this.layoutAlgorithm()));layoutAlgorithmLabel(e){return on.layout.algorithm.options[e].label}layoutDirectionLabel(e){return on.layout.direction.options[e].label}layoutSpacingLabel(e){return on.layout.spacing.options[e].label}connectionTypeLabel(e){return on.layout.connection.options[e].label}setLayoutAlgorithm(e){this.graphPreferences.setLayoutAlgorithm(e)}setLayoutDirection(e){this.graphPreferences.setLayoutDirection(e)}setLayoutSpacing(e){this.graphPreferences.setLayoutSpacing(e)}setConnectionType(e){this.graphPreferences.setConnectionType(e)}directionItemIcon(e){return RP[e]}spacingItemIcon(e){return AP[e]}connectionTypeItemPath(e){return UY[e]}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-graph-layout-toolbar"]],decls:26,vars:21,consts:[["algorithmPopover",""],["directionPopover",""],["spacingPopover",""],["connectionTypePopover",""],["icon","pi pi-sitemap","severity","secondary","size","small","data-testid","graph-layout-algorithm-toggle",3,"onClick","ariaLabel","pTooltip","text","rounded"],["severity","secondary","size","small","data-testid","graph-layout-direction-toggle",3,"onClick","icon","ariaLabel","pTooltip","text","rounded","disabled"],["severity","secondary","size","small","data-testid","graph-layout-spacing-toggle",3,"onClick","icon","ariaLabel","pTooltip","text","rounded","disabled"],["severity","secondary","size","small","data-testid","graph-connection-type-toggle",3,"onClick","ariaLabel","pTooltip","text","rounded"],["viewBox","0 0 16 16","aria-hidden","true",1,"graph__connection-svg","graph__connection-svg--toggle"],["fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["appendTo","body","styleClass","graph__layout-popover"],["role","menu","data-testid","graph-layout-algorithm-menu",1,"graph__layout-menu"],["role","none"],["role","menu","data-testid","graph-layout-direction-menu",1,"graph__layout-icon-row"],["type","button","role","menuitemradio",1,"graph__layout-icon-item",3,"is-active","pTooltip"],["role","menu","data-testid","graph-layout-spacing-menu",1,"graph__layout-icon-row"],["role","menu","data-testid","graph-connection-type-menu",1,"graph__layout-icon-row"],["type","button","role","menuitemradio",1,"graph__layout-menu-item",3,"click"],["type","button","role","menuitemradio",1,"graph__layout-icon-item",3,"click","pTooltip"],["aria-hidden","true"],["viewBox","0 0 16 16","aria-hidden","true",1,"graph__connection-svg"]],template:function(n,o){if(n&1){let r=se();p(0,"p-button",4),H("onClick",function(s){B(r);let c=Yt(7);return q(c.toggle(s))}),h(),p(1,"p-button",5),H("onClick",function(s){B(r);let c=Yt(12);return q(c.toggle(s))}),h(),p(2,"p-button",6),H("onClick",function(s){B(r);let c=Yt(17);return q(c.toggle(s))}),h(),p(3,"p-button",7),H("onClick",function(s){B(r);let c=Yt(22);return q(c.toggle(s))}),Je(),p(4,"svg",8),R(5,"path",9),h()(),Hr(),p(6,"p-popover",10,0)(8,"ul",11),Y(9,GY,3,5,"li",12,Ce),h()(),p(11,"p-popover",10,1)(13,"div",13),Y(14,HY,2,8,"button",14,Ce),h()(),p(16,"p-popover",10,2)(18,"div",15),Y(19,VY,2,8,"button",14,Ce),h()(),p(21,"p-popover",10,3)(23,"div",16),Y(24,jY,3,7,"button",14,Ce),h()()}n&2&&(M("ariaLabel",o.texts.toolbar.layoutAlgorithmLabel)("pTooltip",o.texts.toolbar.layoutAlgorithmTooltip)("text",!0)("rounded",!0),d(),M("icon",o.directionIcon())("ariaLabel",o.texts.toolbar.layoutDirectionLabel)("pTooltip",o.directionAvailable()?o.texts.toolbar.layoutDirectionTooltip:o.texts.toolbar.layoutDirectionUnavailableTooltip)("text",!0)("rounded",!0)("disabled",!o.directionAvailable()),d(),M("icon",o.spacingIcon())("ariaLabel",o.texts.toolbar.layoutSpacingLabel)("pTooltip",o.spacingAvailable()?o.texts.toolbar.layoutSpacingTooltip:o.texts.toolbar.layoutSpacingUnavailableTooltip)("text",!0)("rounded",!0)("disabled",!o.spacingAvailable()),d(),M("ariaLabel",o.texts.toolbar.connectionTypeLabel)("pTooltip",o.texts.toolbar.connectionTypeTooltip)("text",!0)("rounded",!0),d(2),G("d",o.connectionTypeItemPath(o.connectionType())),d(4),X(o.layoutAlgorithms),d(5),X(o.layoutDirections),d(5),X(o.layoutSpacings),d(5),X(o.connectionTypes))},dependencies:[dn,cn,NP,z_,Oe,De],styles:['[_nghost-%COMP%] .graph__layout-popover .p-popover-content{padding:4px}.graph__layout-menu[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;min-width:160px}.graph__layout-menu-item[_ngcontent-%COMP%]{appearance:none;border:0;background:transparent;color:var(--sm-text);font:inherit;text-align:left;padding:6px 10px;border-radius:var(--sm-radius-sm);cursor:pointer;display:flex;align-items:center;gap:8px;transition:background .12s ease,color .12s ease}.graph__layout-menu-item[_ngcontent-%COMP%]:hover, .graph__layout-menu-item[_ngcontent-%COMP%]:focus-visible{background:color-mix(in srgb,var(--p-primary-color) 12%,transparent);outline:none}.graph__layout-menu-item.is-active[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--p-primary-color) 18%,transparent);color:var(--p-primary-color);font-weight:600}.graph__layout-menu-item[_ngcontent-%COMP%]:before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:transparent;flex-shrink:0}.graph__layout-menu-item.is-active[_ngcontent-%COMP%]:before{background:var(--p-primary-color)}.graph__layout-icon-row[_ngcontent-%COMP%]{display:inline-flex;flex-direction:row;gap:2px;padding:2px}.graph__layout-icon-item[_ngcontent-%COMP%]{appearance:none;border:0;background:transparent;color:var(--sm-text);cursor:pointer;width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--sm-radius-sm);transition:background .12s ease,color .12s ease}.graph__layout-icon-item[_ngcontent-%COMP%] > i[_ngcontent-%COMP%]{font-size:1rem}.graph__connection-svg[_ngcontent-%COMP%]{width:20px;height:20px;overflow:visible}.graph__connection-svg--toggle[_ngcontent-%COMP%]{width:16px;height:16px}.graph__layout-icon-item[_ngcontent-%COMP%]:hover, .graph__layout-icon-item[_ngcontent-%COMP%]:focus-visible{background:color-mix(in srgb,var(--p-primary-color) 12%,transparent);outline:none}.graph__layout-icon-item.is-active[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--p-primary-color) 18%,transparent);color:var(--p-primary-color)}'],changeDetection:0})}return t})();var LP={a11y:{toolbarLabel:"Toggle node kinds"},favorites:{label:"Favorites"},search:{openTooltip:"Search nodes",closeTooltip:"Close search",placeholder:"Search\u2026",inputAriaLabel:"Search nodes by name or tag"}};function WY(t,i){if(t&1&&bi(0,"i",4),t&2){let e=_();Re(e.piClass()),dt("font-size",e.size(),"px")}}function $Y(t,i){if(t&1&&(Je(),W(0,"svg",1),bi(1,"path"),$()),t&2){let e=_();G("width",e.size())("height",e.size()),d(),G("d",e.svgPath())}}function KY(t,i){if(t&1&&(W(0,"span",4),v(1),$()),t&2){let e=_();dt("font-size",e.size(),"px")("line-height",e.size(),"px"),d(),C(e.emoji())}}function YY(t,i){if(t&1&&(W(0,"span",5),v(1),$()),t&2){let e=_();dt("font-size",e.size(),"px")("line-height",e.size(),"px"),d(),C(e.letter())}}var uo=(()=>{class t{kindRegistry=u(Ei);kind=O.required();size=O(18);provider=O(null);resolvedUi=S(()=>this.kindRegistry.lookup(this.kind()));variant=S(()=>{let e=this.resolvedUi();return e?.icon?.kind==="pi"?"pi":e?.icon?.kind==="svg"?"svg":e?.emoji?"emoji":"letter"});piClass=S(()=>{let e=this.resolvedUi()?.icon;return e?.kind==="pi"?`pi ${e.id}`:""});svgPath=S(()=>{let e=this.resolvedUi()?.icon;return e?.kind==="svg"?e.path:""});emoji=S(()=>this.resolvedUi()?.emoji??"");letter=S(()=>this.kindRegistry.labelOf(this.kind()).charAt(0).toUpperCase());static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-kind-icon"]],inputs:{kind:[1,"kind"],size:[1,"size"],provider:[1,"provider"]},decls:4,vars:1,consts:[["aria-hidden","true",3,"class","font-size"],["viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2.2","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["aria-hidden","true",3,"font-size","line-height"],["aria-hidden","true",1,"kind-icon__letter",3,"font-size","line-height"],["aria-hidden","true"],["aria-hidden","true",1,"kind-icon__letter"]],template:function(n,o){if(n&1&&T(0,WY,1,4,"i",0)(1,$Y,2,3,":svg:svg",1)(2,KY,2,5,"span",2)(3,YY,2,5,"span",3),n&2){let r;I((r=o.variant())==="pi"?0:r==="svg"?1:r==="emoji"?2:r==="letter"?3:-1)}},styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center;justify-content:center;line-height:1}"],changeDetection:0})}return t})();var XY=["searchInput"],zP=()=>({class:"kind-palette__content"}),BP=t=>({content:t}),ZY=(t,i)=>i.kind;function QY(t,i){if(t&1&&(R(0,"sm-kind-icon",10),p(1,"span"),v(2),h()),t&2){let e=_().$implicit;M("kind",e.kind)("size",16),d(2),C(e.count)}}function JY(t,i){if(t&1){let e=se();p(0,"p-togglebutton",9),H("ngModelChange",function(){let o=B(e).$implicit,r=_();return q(r.toggle(o.kind))}),be(1,QY,3,3,"ng-template",null,1,Rt),h()}if(t&2){let e=i.$implicit,n=_();M("ngModel",n.isActive(e.kind))("pTooltip",e.label)("ariaLabel",e.label)("styleClass","kind-palette__btn kind-palette__btn--"+e.kind)("pt",vt(7,BP,Nt(6,zP))),G("data-testid","kind-palette-"+e.kind)}}function eX(t,i){if(t&1&&(R(0,"i",12),p(1,"span"),v(2),h()),t&2){let e=_(2);de("pi-star-fill",e.favoritesActive())("pi-star",!e.favoritesActive()),d(2),C(e.favoritesCount())}}function tX(t,i){if(t&1){let e=se();p(0,"p-togglebutton",11),H("ngModelChange",function(){B(e);let o=_();return q(o.toggleFavoritesOnly())}),be(1,eX,3,5,"ng-template",null,1,Rt),h()}if(t&2){let e=_();M("ngModel",e.favoritesActive())("pTooltip",e.texts.favorites.label)("ariaLabel",e.texts.favorites.label)("pt",vt(5,BP,Nt(4,zP)))}}var qP=(()=>{class t{loader=u(Lt);filters=u(un);kindRegistry=u(Ei);texts=LP;entries=S(()=>{let e=new Map;for(let n of this.loader.nodes())e.set(n.kind,(e.get(n.kind)??0)+1);return this.kindRegistry.kinds().map(n=>({kind:n.name,label:n.label,count:e.get(n.name)??0})).filter(n=>n.count>0)});favoritesCount=S(()=>this.loader.nodes().filter(e=>e.isFavorite===!0).length);showFavorites=S(()=>this.loader.hasAnyFavorites()||this.filters.favoritesOnly());favoritesActive=S(()=>this.filters.favoritesOnly());searchExpanded=z(!1);searchActive=S(()=>this.filters.searchText().trim().length>0);searchInputRef=Ae("searchInput");constructor(){J(()=>{this.searchExpanded()&&queueMicrotask(()=>this.searchInputRef()?.nativeElement.focus())})}toggleSearch(){this.searchExpanded.set(!this.searchExpanded())}onSearchInput(e){this.filters.setSearchText(e)}onSearchKeydown(e){e.key==="Escape"&&(e.stopPropagation(),this.searchExpanded.set(!1))}onSearchBlur(){this.searchActive()||this.searchExpanded.set(!1)}isActive(e){return this.filters.isKindActive(e)}toggle(e){let n=this.entries().map(o=>o.kind);this.filters.toggleKind(e,n)}toggleFavoritesOnly(){this.filters.setFavoritesOnly(!this.filters.favoritesOnly())}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-kind-palette"]],viewQuery:function(n,o){n&1&&Tt(o.searchInputRef,XY,5),n&2&&ct()},decls:9,vars:13,consts:[["searchInput",""],["content",""],["data-testid","kind-palette-search",1,"kind-palette-search"],["type","button","tooltipPosition","right","data-testid","kind-palette-search-toggle",1,"kind-palette-search__icon",3,"click","pTooltip"],["aria-hidden","true",1,"pi","pi-search"],["type","text","data-testid","kind-palette-search-input",1,"kind-palette-search__input",3,"input","keydown","blur","placeholder","value"],["role","toolbar","data-testid","kind-palette",1,"kind-palette"],[3,"ngModel","pTooltip","ariaLabel","styleClass","pt"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModel","pTooltip","ariaLabel","pt"],[3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass","pt"],[3,"kind","size"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModelChange","ngModel","pTooltip","ariaLabel","pt"],["aria-hidden","true",1,"pi"]],template:function(n,o){n&1&&(p(0,"div",2)(1,"button",3),H("click",function(){return o.toggleSearch()}),R(2,"i",4),h(),p(3,"input",5,0),H("input",function(a){return o.onSearchInput(a.target.value)})("keydown",function(a){return o.onSearchKeydown(a)})("blur",function(){return o.onSearchBlur()}),h()(),p(5,"div",6),Y(6,JY,3,9,"p-togglebutton",7,ZY),T(8,tX,3,7,"p-togglebutton",8),h()),n&2&&(de("kind-palette-search--expanded",o.searchExpanded())("kind-palette-search--active",o.searchActive()),d(),M("pTooltip",o.searchExpanded()?o.texts.search.closeTooltip:o.texts.search.openTooltip),G("aria-label",o.searchExpanded()?o.texts.search.closeTooltip:o.texts.search.openTooltip)("aria-expanded",o.searchExpanded()),d(2),M("placeholder",o.texts.search.placeholder)("value",o.filters.searchText()),G("aria-label",o.texts.search.inputAriaLabel)("tabindex",o.searchExpanded()?0:-1),d(2),G("aria-label",o.texts.a11y.toolbarLabel),d(),X(o.entries()),d(2),I(o.showFavorites()?8:-1))},dependencies:[hn,fn,pn,_n,mn,Oe,De,uo],styles:["[_nghost-%COMP%]{position:relative;display:block;pointer-events:auto}.kind-palette[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;padding:4px;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating);margin-top:44px}.kind-palette-search[_ngcontent-%COMP%]{position:absolute;top:0;left:0;display:inline-flex;align-items:center;width:64px;height:38px;padding:4px;border:1px solid var(--sm-border);border-radius:.65rem;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);box-shadow:var(--sm-shadow-floating);overflow:hidden;transition:width .2s ease-out;z-index:1}.kind-palette-search--expanded[_ngcontent-%COMP%]{width:240px}.kind-palette-search__icon[_ngcontent-%COMP%]{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:56px;height:30px;padding:0;border:0;background:transparent;border-radius:var(--sm-radius-pill);color:var(--p-text-muted-color);cursor:pointer;transition:color .12s ease-out,width .2s ease-out,background .12s ease-out}.kind-palette-search__icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.95rem;line-height:1}.kind-palette-search__icon[_ngcontent-%COMP%]:hover, .kind-palette-search__icon[_ngcontent-%COMP%]:focus-visible{color:var(--p-text-color);background:var(--sm-bg-hover)}.kind-palette-search--expanded[_ngcontent-%COMP%] .kind-palette-search__icon[_ngcontent-%COMP%]{width:30px;color:var(--p-text-color)}.kind-palette-search--active[_ngcontent-%COMP%]:not(.kind-palette-search--expanded) .kind-palette-search__icon[_ngcontent-%COMP%]{color:var(--p-primary-color)}.kind-palette-search__input[_ngcontent-%COMP%]{flex:1;min-width:0;height:100%;border:0;outline:none;background:transparent;font-size:.8rem;color:var(--p-text-color);padding:0 .5rem 0 0;opacity:0;pointer-events:none;transition:opacity .16s ease-out}.kind-palette-search__input[_ngcontent-%COMP%]::placeholder{color:var(--p-text-muted-color)}.kind-palette-search--expanded[_ngcontent-%COMP%] .kind-palette-search__input[_ngcontent-%COMP%]{opacity:1;pointer-events:auto}.kind-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0 .55rem;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-gap: .4rem;--p-togglebutton-background: transparent;--p-togglebutton-checked-background: transparent;--p-togglebutton-hover-background: transparent;--p-togglebutton-border-color: transparent;--p-togglebutton-checked-border-color: transparent;--p-togglebutton-content-checked-background: var(--sm-bg-hover);--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-color);--p-togglebutton-icon-color: var(--p-text-muted-color);--p-togglebutton-icon-hover-color: var(--p-text-color);--p-togglebutton-icon-checked-color: var(--p-text-color);width:56px;height:30px;font-size:.72rem;font-weight:600;font-variant-numeric:tabular-nums}[_nghost-%COMP%] .kind-palette__content{width:100%;height:100%;justify-content:flex-start;display:flex;align-items:center;gap:.4rem}[_nghost-%COMP%] .kind-palette__content>span{flex:1;text-align:right}[_nghost-%COMP%] .kind-palette__btn sm-kind-icon{display:inline-flex;align-items:center;color:var(--p-text-muted-color)}[_nghost-%COMP%] .kind-palette__btn[aria-pressed=true] sm-kind-icon{color:var(--p-text-color)}[_nghost-%COMP%] .kind-palette__btn--skill[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-skill)}[_nghost-%COMP%] .kind-palette__btn--agent[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-agent)}[_nghost-%COMP%] .kind-palette__btn--command[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-command)}[_nghost-%COMP%] .kind-palette__btn--markdown[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-markdown)}[_nghost-%COMP%] .kind-palette__btn--favorites .pi{font-size:.95rem;line-height:1;color:var(--p-text-muted-color)}[_nghost-%COMP%] .kind-palette__btn--favorites:hover .pi{color:var(--p-text-color)}[_nghost-%COMP%] .kind-palette__btn--favorites[aria-pressed=true] .pi{color:var(--p-primary-color)}"],changeDetection:0})}return t})();var Wt={a11y:{toolbarLabel:"Link kind filters"},kinds:{invokes:"Invokes",references:"References",mentions:"Mentions",supersedes:"Supersedes"},tooltips:{invokes:`Invokes:
273
- "/skill-command"`,references:`References:
274
- "[link](./link.md)"`,mentions:`Mention:
275
- "@agent.md"`,supersedes:`Supersedes:
276
- .sm annotation`}};var nX=()=>({class:"link-kind-palette__content"}),iX=t=>({content:t}),oX=(t,i)=>i.kind;function rX(t,i){if(t&1&&v(0),t&2){let e=_(2).$implicit;qe(" ",e.text," ")}}function aX(t,i){if(t&1&&R(0,"i"),t&2){let e=_(2).$implicit;Re(e.icon)}}function sX(t,i){if(t&1&&(p(0,"span",4),T(1,rX,1,1)(2,aX,1,2,"i",5),h()),t&2){let e=_().$implicit;d(),I(e.text?1:e.icon?2:-1)}}function cX(t,i){if(t&1){let e=se();p(0,"p-togglebutton",3),H("ngModelChange",function(){let o=B(e).$implicit,r=_(2);return q(r.toggle(o.kind))}),be(1,sX,3,1,"ng-template",null,0,Rt),h()}if(t&2){let e=i.$implicit,n=_(2);M("ngModel",n.isActive(e.kind))("pTooltip",e.tooltip)("ariaLabel",e.label)("styleClass","link-kind-palette__btn link-kind-palette__btn--"+e.kind)("pt",vt(7,iX,Nt(6,nX))),G("data-testid","link-kind-palette-"+e.kind)}}function dX(t,i){if(t&1&&(p(0,"div",1),Y(1,cX,3,9,"p-togglebutton",2,oX),h()),t&2){let e=_();G("aria-label",e.texts.a11y.toolbarLabel),d(),X(e.entries())}}var GP=[{kind:"invokes",label:Wt.kinds.invokes,tooltip:Wt.tooltips.invokes,text:"/"},{kind:"references",label:Wt.kinds.references,tooltip:Wt.tooltips.references,icon:"pi pi-link"},{kind:"mentions",label:Wt.kinds.mentions,tooltip:Wt.tooltips.mentions,text:"@"},{kind:"supersedes",label:Wt.kinds.supersedes,tooltip:Wt.tooltips.supersedes,icon:"pi pi-angle-double-right"}];for(let t of GP)if(!Eg.includes(t.kind))throw new Error(`link-kind-palette: unknown link kind "${t.kind}"`);var HP=(()=>{class t{loader=u(Lt);filters=u(un);texts=Wt;counts=S(()=>{let e=this.loader.scan(),n=new Map;if(!e)return n;for(let o of e.links)n.set(o.kind,(n.get(o.kind)??0)+1);return n});entries=S(()=>{let e=this.counts(),n=this.filters.selectedLinkKinds(),o=new Set(n);return GP.filter(r=>(e.get(r.kind)??0)>0||o.has(r.kind))});constructor(){J(()=>{let e=this.counts(),n=this.filters.selectedLinkKinds(),o=n.filter(r=>(e.get(r)??0)>0);o.length!==n.length&&this.filters.setLinkKinds(o)})}isActive(e){return this.filters.isLinkKindActive(e)}toggle(e){this.filters.toggleLinkKind(e)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-link-kind-palette"]],decls:1,vars:1,consts:[["content",""],["role","toolbar","data-testid","link-kind-palette",1,"link-kind-palette"],["tooltipStyleClass","link-kind-palette__tooltip",3,"ngModel","pTooltip","ariaLabel","styleClass","pt"],["tooltipStyleClass","link-kind-palette__tooltip",3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass","pt"],["aria-hidden","true",1,"link-kind-palette__glyph"],[3,"class"]],template:function(n,o){n&1&&T(0,dX,3,1,"div",1),n&2&&I(o.entries().length>0?0:-1)},dependencies:[hn,fn,pn,_n,mn,Oe,De],styles:["[_nghost-%COMP%]{display:block;width:100%;pointer-events:auto}.link-kind-palette[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:2px;padding:4px;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating)}.link-kind-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-background: transparent;--p-togglebutton-checked-background: transparent;--p-togglebutton-hover-background: transparent;--p-togglebutton-border-color: transparent;--p-togglebutton-checked-border-color: transparent;--p-togglebutton-content-checked-background: var(--sm-bg-hover);--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-color);width:100%;height:30px}[_nghost-%COMP%] .link-kind-palette__content{width:100%;height:100%;display:flex;align-items:center;justify-content:center}[_nghost-%COMP%] .link-kind-palette__glyph{font-size:.95rem;line-height:1;font-weight:600;display:inline-flex;align-items:center;justify-content:center}[_nghost-%COMP%] .link-kind-palette__btn--invokes .link-kind-palette__glyph{color:var(--sm-edge-invokes)}[_nghost-%COMP%] .link-kind-palette__btn--invokes[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-invokes-active)}[_nghost-%COMP%] .link-kind-palette__btn--references .link-kind-palette__glyph{color:var(--sm-edge-references)}[_nghost-%COMP%] .link-kind-palette__btn--references[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-references-active)}[_nghost-%COMP%] .link-kind-palette__btn--mentions .link-kind-palette__glyph{color:var(--sm-edge-mentions)}[_nghost-%COMP%] .link-kind-palette__btn--mentions[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-mentions-active)}[_nghost-%COMP%] .link-kind-palette__btn--supersedes .link-kind-palette__glyph{color:var(--sm-edge-supersedes)}[_nghost-%COMP%] .link-kind-palette__btn--supersedes[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-supersedes-active)}[_nghost-%COMP%] .link-kind-palette__tooltip .p-tooltip-text{white-space:pre-line;text-align:center;line-height:1.35}"],changeDetection:0})}return t})();var VP={a11y:{toolbarLabel:"Toggle severity filters"},error:{label:"Errors",tooltip:"Only nodes with errors"},warn:{label:"Warnings",tooltip:"Only nodes with warnings"}};var UP=()=>({class:"severity-palette__content"}),WP=t=>({content:t});function lX(t,i){if(t&1&&(p(0,"span",5),R(1,"i",6),h(),p(2,"span",7),v(3),h()),t&2){let e=_(3);d(3),C(e.errorCount())}}function uX(t,i){if(t&1){let e=se();p(0,"p-togglebutton",4),H("ngModelChange",function(){B(e);let o=_(2);return q(o.toggle("error"))}),be(1,lX,4,1,"ng-template",null,0,Rt),h()}if(t&2){let e=_(2);M("ngModel",e.isActive("error"))("pTooltip",e.texts.error.tooltip)("ariaLabel",e.texts.error.label)("pt",vt(5,WP,Nt(4,UP)))}}function fX(t,i){if(t&1&&(p(0,"span",5),R(1,"i",9),h(),p(2,"span",7),v(3),h()),t&2){let e=_(3);d(3),C(e.warnCount())}}function pX(t,i){if(t&1){let e=se();p(0,"p-togglebutton",8),H("ngModelChange",function(){B(e);let o=_(2);return q(o.toggle("warn"))}),be(1,fX,4,1,"ng-template",null,0,Rt),h()}if(t&2){let e=_(2);M("ngModel",e.isActive("warn"))("pTooltip",e.texts.warn.tooltip)("ariaLabel",e.texts.warn.label)("pt",vt(5,WP,Nt(4,UP)))}}function hX(t,i){if(t&1&&(p(0,"div",1),T(1,uX,3,7,"p-togglebutton",2),T(2,pX,3,7,"p-togglebutton",3),h()),t&2){let e=_();G("aria-label",e.texts.a11y.toolbarLabel),d(),I(e.showError()?1:-1),d(),I(e.showWarn()?2:-1)}}var $P=(()=>{class t{loader=u(Lt);filters=u(un);issuePaths=u(ha);texts=VP;visibleSet=S(()=>{let e=this.filters.apply(this.loader.nodes(),this.issuePaths.bySeverity()),n=new Set;for(let o of e)n.add(o.path);return n});rawErrorCount=S(()=>this.issuePaths.bySeverity().errors.size);rawWarnCount=S(()=>this.issuePaths.bySeverity().warns.size);errorCount=S(()=>jP(this.issuePaths.bySeverity().errors,this.visibleSet()));warnCount=S(()=>jP(this.issuePaths.bySeverity().warns,this.visibleSet()));showError=S(()=>this.rawErrorCount()>0||this.filters.severityErrorActive());showWarn=S(()=>this.rawWarnCount()>0||this.filters.severityWarnActive());hasAny=S(()=>this.showError()||this.showWarn());constructor(){J(()=>{this.rawErrorCount()===0&&this.filters.severityErrorActive()&&this.filters.toggleSeverity("error"),this.rawWarnCount()===0&&this.filters.severityWarnActive()&&this.filters.toggleSeverity("warn")})}isActive(e){return this.filters.isSeverityActive(e)}toggle(e){this.filters.toggleSeverity(e)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-severity-palette"]],decls:1,vars:1,consts:[["content",""],["role","toolbar","data-testid","severity-palette",1,"severity-palette"],["styleClass","severity-palette__btn severity-palette__btn--error","data-testid","severity-palette-error",3,"ngModel","pTooltip","ariaLabel","pt"],["styleClass","severity-palette__btn severity-palette__btn--warn","data-testid","severity-palette-warn",3,"ngModel","pTooltip","ariaLabel","pt"],["styleClass","severity-palette__btn severity-palette__btn--error","data-testid","severity-palette-error",3,"ngModelChange","ngModel","pTooltip","ariaLabel","pt"],["aria-hidden","true",1,"severity-palette__glyph"],[1,"pi","pi-times-circle"],[1,"severity-palette__count"],["styleClass","severity-palette__btn severity-palette__btn--warn","data-testid","severity-palette-warn",3,"ngModelChange","ngModel","pTooltip","ariaLabel","pt"],[1,"pi","pi-exclamation-triangle"]],template:function(n,o){n&1&&T(0,hX,3,3,"div",1),n&2&&I(o.hasAny()?0:-1)},dependencies:[hn,fn,pn,_n,mn,Oe,De],styles:["[_nghost-%COMP%]{display:block;width:100%;pointer-events:auto}.severity-palette[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;padding:4px;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating)}.severity-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0 .55rem;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-gap: .4rem;--p-togglebutton-background: transparent;--p-togglebutton-checked-background: transparent;--p-togglebutton-hover-background: transparent;--p-togglebutton-border-color: transparent;--p-togglebutton-checked-border-color: transparent;--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-color);--p-togglebutton-icon-color: var(--p-text-muted-color);--p-togglebutton-icon-hover-color: var(--p-text-color);--p-togglebutton-icon-checked-color: var(--p-text-color);width:56px;height:30px;font-size:.72rem;font-weight:600;font-variant-numeric:tabular-nums}.severity-palette__btn--error[_ngcontent-%COMP%]{--p-togglebutton-content-checked-background: color-mix(in srgb, var(--sm-severity-error-bg) 55%, var(--sm-bg-content))}.severity-palette__btn--warn[_ngcontent-%COMP%]{--p-togglebutton-content-checked-background: color-mix(in srgb, var(--sm-severity-warn-bg) 55%, var(--sm-bg-content))}[_nghost-%COMP%] .severity-palette__content{width:100%;height:100%;justify-content:flex-start;display:flex;align-items:center;gap:.4rem}[_nghost-%COMP%] .severity-palette__count{flex:1;text-align:right}[_nghost-%COMP%] .severity-palette__glyph{display:inline-flex;align-items:center;justify-content:center;font-size:.95rem;line-height:1}[_nghost-%COMP%] .severity-palette__btn--error .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--error .severity-palette__count{color:color-mix(in srgb,var(--sm-severity-error) 55%,var(--p-text-muted-color))}[_nghost-%COMP%] .severity-palette__btn--warn .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--warn .severity-palette__count{color:color-mix(in srgb,var(--sm-severity-warn) 55%,var(--p-text-muted-color))}[_nghost-%COMP%] .severity-palette__btn--error:hover .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--error:hover .severity-palette__count{color:color-mix(in srgb,var(--sm-severity-error) 80%,var(--p-text-color))}[_nghost-%COMP%] .severity-palette__btn--warn:hover .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--warn:hover .severity-palette__count{color:color-mix(in srgb,var(--sm-severity-warn) 80%,var(--p-text-color))}[_nghost-%COMP%] .severity-palette__btn--error[aria-pressed=true] .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--error[aria-pressed=true] .severity-palette__count{color:var(--sm-severity-error)}[_nghost-%COMP%] .severity-palette__btn--warn[aria-pressed=true] .severity-palette__glyph, [_nghost-%COMP%] .severity-palette__btn--warn[aria-pressed=true] .severity-palette__count{color:var(--sm-severity-warn)}"],changeDetection:0})}return t})();function jP(t,i){let[e,n]=t.size<=i.size?[t,i]:[i,t],o=0;for(let r of e)n.has(r)&&o++;return o}function Br(t,i){Ot(Br);let e=z(null),n=0;return J(()=>{let o=t().trim(),r=++n;e.set(null),o&&i.renderInline(o).then(a=>{r===n&&e.set(a)}).catch(()=>{r===n&&e.set(null)})}),e.asReadonly()}var mX=(t,i)=>i.step;function _X(t,i){t&1&&(p(0,"span",8),v(1),h()),t&2&&(d(),C(i))}function gX(t,i){if(t&1&&(p(0,"span",12)(1,"span",28),v(2,"T"),h(),v(3),h()),t&2){let e=_(),n=oe(0);M("pTooltip",e.texts.stats.tokens(n.tokensTotal)),d(3),C(e.tokensShort())}}function vX(t,i){if(t&1&&(p(0,"span",13)(1,"span",28),v(2,"B"),h(),v(3),h()),t&2){let e=_(),n=oe(0);M("pTooltip",e.texts.stats.bytes(n.bytesTotal)),d(3),C(e.bytesShort())}}function yX(t,i){if(t&1&&(p(0,"span",29),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function CX(t,i){if(t&1&&(p(0,"span",30),v(1),h()),t&2){let e=_(2),n=oe(2);d(),C(e.texts.tagOverflow(n))}}function xX(t,i){if(t&1&&(p(0,"div",17),Y(1,yX,2,1,"span",29,Ce),T(3,CX,2,1,"span",30),h()),t&2){_();let e=oe(1),n=oe(2);d(),X(e),d(2),I(n>0?3:-1)}}function bX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function wX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,bX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.topics.tooltip),d(),C(n.texts.llm.topics.label),d(2),X(e.topics)}}function SX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function TX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,SX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.facts.tooltip),d(),C(n.texts.llm.facts.label),d(2),X(e.keyFacts)}}function IX(t,i){if(t&1&&(T(0,wX,6,2,"div",31),T(1,TX,6,2,"div",31)),t&2){let e=i;I(e.topics!=null&&e.topics.length?0:-1),d(),I(e.keyFacts!=null&&e.keyFacts.length?1:-1)}}function EX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"span"),v(4),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.when.tooltip),d(),C(n.texts.llm.when.label),d(2),C(e.whenToUse)}}function PX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"span"),v(4),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.style.tooltip),d(),C(n.texts.llm.style.label),d(2),C(e.interactionStyle)}}function MX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function kX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,MX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.does.tooltip),d(),C(n.texts.llm.does.label),d(2),X(e.capabilities)}}function DX(t,i){if(t&1&&(T(0,EX,5,3,"div",31),T(1,PX,5,3,"div",31),T(2,kX,6,2,"div",31)),t&2){let e=i;I(e.whenToUse?0:-1),d(),I(e.interactionStyle?1:-1),d(),I(e.capabilities!=null&&e.capabilities.length?2:-1)}}function OX(t,i){if(t&1&&v(0),t&2){let e=i.$implicit,n=i.$index,o=i.$count;ng("",e.step,". ",e.description,"",n===o-1?"":" \xB7 ")}}function NX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"span"),Y(4,OX,1,3,null,null,mX),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.steps.tooltip),d(),C(n.texts.llm.steps.label),d(2),X(e.recipe)}}function RX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function AX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,RX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.pre.tooltip),d(),C(n.texts.llm.pre.label),d(2),X(e.preconditions)}}function FX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function LX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,FX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.out.tooltip),d(),C(n.texts.llm.out.label),d(2),X(e.outputs)}}function zX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function BX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,zX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.fx.tooltip),d(),C(n.texts.llm.fx.label),d(2),X(e.sideEffects)}}function qX(t,i){if(t&1&&(T(0,NX,6,2,"div",31),T(1,AX,6,2,"div",31),T(2,LX,6,2,"div",31),T(3,BX,6,2,"div",31)),t&2){let e=i;I(e.recipe!=null&&e.recipe.length?0:-1),d(),I(e.preconditions!=null&&e.preconditions.length?1:-1),d(),I(e.outputs!=null&&e.outputs.length?2:-1),d(),I(e.sideEffects!=null&&e.sideEffects.length?3:-1)}}function GX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"code",35),v(4),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.eg.tooltip),d(),C(n.texts.llm.eg.label),d(2),C(e.invocationExample)}}function HX(t,i){if(t&1&&(p(0,"span",34),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function VX(t,i){if(t&1&&(p(0,"div",31)(1,"span",32),v(2),h(),p(3,"div",33),Y(4,HX,2,1,"span",34,Ce),h()()),t&2){let e=_(),n=_(2);d(),M("pTooltip",n.texts.llm.fx.tooltip),d(),C(n.texts.llm.fx.label),d(2),X(e.sideEffects)}}function jX(t,i){if(t&1&&(T(0,GX,5,3,"div",31),T(1,VX,6,2,"div",31)),t&2){let e=i;I(e.invocationExample?0:-1),d(),I(e.sideEffects!=null&&e.sideEffects.length?1:-1)}}function UX(t,i){if(t&1&&(p(0,"div",22),T(1,IX,2,2),T(2,DX,3,3),T(3,qX,4,4),T(4,jX,2,2),h()),t&2){let e,n,o,r,a=_();d(),I((e=a.summaryMarkdown())?1:-1,e),d(),I((n=a.summaryAgent())?2:-1,n),d(),I((o=a.summarySkill())?3:-1,o),d(),I((r=a.summaryCommand())?4:-1,r)}}function WX(t,i){if(t&1&&R(0,"div",23),t&2){let e=_();M("innerHTML",e.descriptionHtml(),go)}}function $X(t,i){if(t&1&&(p(0,"div",36)(1,"div",37)(2,"span",38),v(3),h(),p(4,"span",39),v(5),h()()()),t&2){let e=_(),n=_();d(3),C(n.texts.meta.model),d(2),C(e.model)}}function KX(t,i){t&1&&T(0,$X,6,2,"div",36),t&2&&I(i.model?0:-1)}var YX={selected:!1,highlighted:!1,dimmed:!1},KP=(()=>{class t{node=O.required();stats=O({linksIn:0,linksOut:0});summary=O(null);selection=O(YX);isFavorite=O(!1);favoriteToggle=Ve();texts=$n;expanded=Wn(!1);fmAgent=S(()=>{let e=this.node();return e.kind==="agent"?e.frontmatter:null});summaryAgent=S(()=>{let e=this.summary();return e?.kind==="agent"?e:null});summarySkill=S(()=>{let e=this.summary();return e?.kind==="skill"?e:null});summaryCommand=S(()=>{let e=this.summary();return e?.kind==="command"?e:null});summaryMarkdown=S(()=>{let e=this.summary();return e?.kind==="markdown"?e:null});hasLlmCluster=S(()=>{let e=this.summary();return e!==null&&this.hasLlmContent(e)});hasLlmContent(e){switch(e.kind){case"markdown":return(e.topics?.length??0)>0||(e.keyFacts?.length??0)>0;case"agent":return!!e.whenToUse||!!e.interactionStyle||(e.capabilities?.length??0)>0;case"skill":return(e.recipe?.length??0)>0||(e.preconditions?.length??0)>0||(e.outputs?.length??0)>0||(e.sideEffects?.length??0)>0;case"command":return!!e.invocationExample||(e.sideEffects?.length??0)>0;default:return!1}}nodeColor=S(()=>this.agentVendorColor());kindRegistry=u(Ei);markdown=u(ma);providerAccent=S(()=>null);bytesShort=S(()=>{let e=this.stats().bytesTotal;return e===void 0?null:Dp(e)});tokensShort=S(()=>{let e=this.stats().tokensTotal;return e===void 0?null:Dp(e)});version=S(()=>la(this.node()));stability=S(()=>ua(this.node()));tagChips=S(()=>fa(this.node()));visibleTagChips=S(()=>this.tagChips().slice(0,3));moreTagsCount=S(()=>Math.max(0,this.tagChips().length-3));agentVendorColor=S(()=>{let e=this.node();if(e.kind!=="agent")return null;let o=e.frontmatter.color;return typeof o=="string"&&o.length>0?o:null});displayName=S(()=>{let e=this.node().frontmatter;return e.name?e.name:zg(this.node().path)});description=S(()=>this.node().frontmatter.description??"");descriptionHtml=Br(this.description,this.markdown);toggleExpanded(e){e.stopPropagation(),this.expanded.update(n=>!n)}toggleFavorite(e){e.stopPropagation();let n=!this.isFavorite();this.favoriteToggle.emit({path:this.node().path,value:n})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-node-card"]],hostAttrs:[1,"sm-gnode"],hostVars:17,hostBindings:function(n,o){n&2&&(G("data-kind",o.node().kind),dt("--node-color",o.nodeColor())("--accent",o.providerAccent()),de("sm-gnode--with-color",!!o.nodeColor())("sm-gnode--deprecated",o.stability()==="deprecated")("sm-gnode--expanded",o.expanded())("sm-gnode--selected",o.selection().selected)("sm-gnode--highlighted",o.selection().highlighted)("sm-gnode--dimmed",o.selection().dimmed))},inputs:{node:[1,"node"],stats:[1,"stats"],summary:[1,"summary"],selection:[1,"selection"],isFavorite:[1,"isFavorite"],expanded:[1,"expanded"]},outputs:{favoriteToggle:"favoriteToggle",expanded:"expandedChange"},decls:34,vars:30,consts:[[1,"sm-gnode__main"],["aria-hidden","true",1,"sm-gnode__icon-box"],[3,"kind","provider","size"],[1,"sm-gnode__content"],[1,"sm-gnode__name-row"],[1,"sm-gnode__name",3,"pTooltip"],["slot","card.title.right",3,"node"],[1,"sm-gnode__actions"],["data-testid","node-card-version",1,"sm-gnode__name-version"],["type","button",1,"sm-gnode__chevron",3,"click"],["aria-hidden","true",1,"pi","pi-chevron-down"],[1,"sm-gnode__sub"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--tokens",3,"pTooltip"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--bytes",3,"pTooltip"],["type","button","data-testid","node-card-favorite",1,"sm-gnode__favorite",3,"click","pTooltip"],["aria-hidden","true",1,"pi"],["slot","card.subtitle.left",3,"node"],["data-testid","node-card-tags",1,"sm-gnode__tagrow"],[1,"sm-gnode__panel"],["data-testid","node-card-path",1,"sm-gnode__path",3,"pTooltip"],["aria-hidden","true",1,"fa-regular","fa-folder-open","sm-gnode__path-icon"],[1,"sm-gnode__path-value"],[1,"sm-gnode__llm"],[1,"sm-gnode__desc",3,"innerHTML"],[1,"sm-gnode__footer"],["slot","card.footer.left",3,"node"],[1,"sm-gnode__footer-right-cluster"],["slot","card.footer.right",3,"node"],[1,"sm-gnode__sub-key"],[1,"sm-gnode__tag-chip"],["data-testid","node-card-tags-more",1,"sm-gnode__tag-more"],[1,"sm-gnode__llm-line"],[1,"sm-gnode__llm-label",3,"pTooltip"],[1,"sm-gnode__chips"],[1,"sm-gnode__chip","sm-gnode__chip--llm"],[1,"sm-gnode__llm-code"],[1,"sm-gnode__meta"],[1,"sm-gnode__meta-row"],[1,"sm-gnode__meta-label"],[1,"sm-gnode__meta-value","sm-gnode__meta-value--mono"]],template:function(n,o){if(n&1&&(lt(0)(1)(2),p(3,"div",0)(4,"div",1),R(5,"sm-kind-icon",2),h(),p(6,"div",3)(7,"div",4)(8,"span",5),v(9),h(),R(10,"sm-view-contributions-host",6),h()(),p(11,"div",7),T(12,_X,2,1,"span",8),p(13,"button",9),H("click",function(a){return o.toggleExpanded(a)}),R(14,"i",10),h()(),p(15,"div",11),T(16,gX,4,2,"span",12),T(17,vX,4,2,"span",13),p(18,"button",14),H("click",function(a){return o.toggleFavorite(a)}),R(19,"i",15),h(),R(20,"sm-view-contributions-host",16),h()(),T(21,xX,4,1,"div",17),p(22,"div",18)(23,"div",19),R(24,"i",20),p(25,"span",21),v(26),h()(),T(27,UX,5,4,"div",22),T(28,WX,1,1,"div",23),T(29,KX,1,1),h(),p(30,"div",24),R(31,"sm-view-contributions-host",25),p(32,"div",26),R(33,"sm-view-contributions-host",27),h()()),n&2){let r,a,s=o.node();Xe(o.stats()),d();let c=Xe(o.visibleTagChips());d(),Xe(o.moreTagsCount()),d(3),M("kind",s.kind)("provider",s.provider)("size",18),d(3),M("pTooltip",o.displayName()),d(),C(o.displayName()),d(),M("node",o.node()),d(2),I((r=o.version())?12:-1,r),d(),G("aria-label",o.texts.ariaExpand),d(3),I(o.tokensShort()!==null?16:-1),d(),I(o.bytesShort()!==null?17:-1),d(),de("sm-gnode__favorite--on",o.isFavorite()),M("pTooltip",o.isFavorite()?o.texts.favoriteRemoveTooltip:o.texts.favoriteAddTooltip),G("aria-label",o.isFavorite()?o.texts.ariaFavoriteRemove:o.texts.ariaFavoriteAdd),d(),de("pi-star-fill",o.isFavorite())("pi-star",!o.isFavorite()),d(),M("node",o.node()),d(),I(c.length?21:-1),d(2),M("pTooltip",s.path),d(3),C(s.path),d(),I(o.hasLlmCluster()?27:-1),d(),I(o.description()?28:-1),d(),I((a=o.fmAgent())?29:-1,a),d(2),M("node",o.node()),d(2),M("node",o.node())}},dependencies:[uo,Oe,De,gn],styles:['[_nghost-%COMP%]{--accent: var(--sm-kind-markdown);position:relative;display:inline-block;width:260px;background:var(--sm-bg-content);border:1px solid var(--sm-border);border-radius:8px;box-shadow:var(--sm-shadow-card);overflow:hidden;transition:box-shadow .12s ease,border-color .12s ease,transform .12s ease;-webkit-user-select:none;user-select:none;text-align:start}[_nghost-%COMP%]:hover{box-shadow:var(--sm-shadow-card-hover)}[_nghost-%COMP%]:before{content:"";position:absolute;top:0;left:0;right:0;height:3px;background:var(--accent)}[data-kind="skill"][_nghost-%COMP%]{--accent: var(--sm-kind-skill)}[data-kind="agent"][_nghost-%COMP%]{--accent: var(--sm-kind-agent)}[data-kind="command"][_nghost-%COMP%]{--accent: var(--sm-kind-command)}[data-kind="markdown"][_nghost-%COMP%]{--accent: var(--sm-kind-markdown)}.sm-gnode--deprecated[_nghost-%COMP%]{opacity:.55}.sm-gnode--selected[_nghost-%COMP%]{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color),0 4px 16px color-mix(in srgb,var(--p-primary-color) 25%,transparent)}.sm-gnode--highlighted[_nghost-%COMP%]{border-color:var(--p-primary-color);box-shadow:var(--sm-shadow-card-hover)}.sm-gnode--dimmed[_nghost-%COMP%]{opacity:.25}.sm-gnode__main[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:.6rem;row-gap:.3rem;align-items:start;padding:.6rem .65rem}.sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-markdown-bg);--kind-fg: var(--sm-kind-markdown-fg);width:38px;height:38px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--kind-bg);color:var(--kind-fg);flex:none;font-size:1.05rem;grid-row:1 / span 2;align-self:center}[data-kind="skill"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-skill-bg);--kind-fg: var(--sm-kind-skill-fg)}[data-kind="agent"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-agent-bg);--kind-fg: var(--sm-kind-agent-fg)}[data-kind="command"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-command-bg);--kind-fg: var(--sm-kind-command-fg)}[data-kind="markdown"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-markdown-bg);--kind-fg: var(--sm-kind-markdown-fg)}.sm-gnode__content[_ngcontent-%COMP%]{min-width:0;width:100%;justify-self:stretch;display:flex;flex-direction:column;gap:.15rem}.sm-gnode__name-row[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.35rem;min-width:0}.sm-gnode__name-row[_ngcontent-%COMP%] > sm-view-contributions-host[_ngcontent-%COMP%]{margin-left:auto;align-self:center}.sm-gnode__name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:600;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--p-text-color);flex:0 1 auto;min-width:0}.sm-gnode__name-version[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.65rem;color:var(--sm-text-muted);background:color-mix(in srgb,var(--accent) 10%,transparent);padding:.05rem .35rem;border-radius:var(--sm-radius-sm);line-height:1.2;flex:none;align-self:center}.sm-gnode--with-color[_nghost-%COMP%] .sm-gnode__name[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--node-color) 7%,transparent);padding:.05rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__actions[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.2rem}.sm-gnode__confidence[_ngcontent-%COMP%]{display:flex;align-items:flex-start;font-size:.65rem;font-weight:600;font-variant-numeric:tabular-nums;line-height:1;flex:none;cursor:help;padding-top:.35rem}.sm-gnode__llm-marker--high[_ngcontent-%COMP%]{color:var(--sm-severity-success)}.sm-gnode__llm-marker--med[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__llm-marker--low[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__chevron[_ngcontent-%COMP%]{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;border:none;background:transparent;cursor:pointer;color:var(--sm-text-muted);border-radius:var(--sm-radius-md);transition:transform .16s ease,background .12s ease,color .12s ease}.sm-gnode__chevron[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.7rem;line-height:1}.sm-gnode__chevron[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);color:var(--p-text-color)}.sm-gnode--expanded[_nghost-%COMP%] .sm-gnode__chevron[_ngcontent-%COMP%]{transform:rotate(180deg)}.sm-gnode__favorite[_ngcontent-%COMP%]{position:absolute;top:-3px;right:0;width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;border:none;background:transparent;cursor:pointer;color:var(--sm-text-muted);border-radius:var(--sm-radius-md);flex:none;transition:background .12s ease,color .12s ease}.sm-gnode__favorite[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.8rem;line-height:1}.sm-gnode__favorite[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);color:var(--p-text-color)}.sm-gnode__favorite--on[_ngcontent-%COMP%], .sm-gnode__favorite--on[_ngcontent-%COMP%]:hover{color:var(--p-primary-color)}.sm-gnode__sub[_ngcontent-%COMP%]{position:relative;grid-column:2 / -1;grid-row:2;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-family:var(--sm-font-mono);font-size:.6rem;color:var(--sm-text-muted);line-height:1.2;margin-top:.1rem;min-width:0;width:100%;padding-right:28px}.sm-gnode__sub-stat[_ngcontent-%COMP%]{padding:.08rem .35rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);font-family:var(--sm-font-mono);font-size:.6rem;color:var(--sm-text-muted);font-weight:400;flex:none}.sm-gnode__sub-stat[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.15rem}.sm-gnode__sub-stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.65rem}.sm-gnode__sub-key[_ngcontent-%COMP%]{font-weight:700}.sm-gnode__sub-stat--tokens[_ngcontent-%COMP%]{background:var(--sm-stat-tokens-bg)}.sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:var(--sm-stat-bytes-bg)}.sm-gnode__panel[_ngcontent-%COMP%]{display:none;border-top:1px solid var(--sm-border)}.sm-gnode--expanded[_nghost-%COMP%] .sm-gnode__panel[_ngcontent-%COMP%]{display:block}.sm-gnode__llm[_ngcontent-%COMP%]{padding:.5rem .7rem;display:flex;flex-direction:column;gap:.25rem;font-size:.75rem;line-height:1.4}.sm-gnode__llm-line[_ngcontent-%COMP%]{display:flex;gap:.4rem;align-items:baseline;color:var(--p-text-color);font-style:italic;min-width:0}.sm-gnode__llm-label[_ngcontent-%COMP%]{flex:none;font-style:normal;color:var(--sm-text-muted);font-size:.6rem;letter-spacing:.04em;text-transform:uppercase;font-weight:600;min-width:2.2rem;padding-top:.2rem;cursor:help}.sm-gnode__chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.25rem;flex:1;min-width:0}.sm-gnode__chip[_ngcontent-%COMP%]{font-size:.65rem;padding:.1rem .4rem;border-radius:var(--sm-radius-sm);border:1px solid var(--sm-border);background:var(--sm-bg-hover);color:var(--p-text-color);line-height:1.3}.sm-gnode__chip--mono[_ngcontent-%COMP%]{font-family:var(--sm-font-mono)}.sm-gnode__chip--allowed[_ngcontent-%COMP%]{border-style:dashed;background:transparent;color:var(--sm-text-muted)}.sm-gnode__chip--llm[_ngcontent-%COMP%]{font-style:italic}.sm-gnode__chip-required[_ngcontent-%COMP%]{color:var(--sm-severity-error);margin-left:2px}.sm-gnode__llm-code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);font-size:.7rem;font-style:normal;color:var(--p-text-color)}.sm-gnode__path[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.35rem;padding:.4rem .7rem;font-family:var(--sm-font-mono);font-size:.68rem;color:var(--sm-text-muted);background:var(--sm-bg-hover);border-top:1px solid var(--sm-border);min-width:0}.sm-gnode__path-icon[_ngcontent-%COMP%]{flex:none;font-size:.7rem;color:var(--sm-text-muted)}.sm-gnode__path-value[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;unicode-bidi:plaintext;text-align:left}.sm-gnode__desc[_ngcontent-%COMP%]{padding:.55rem .7rem;font-size:.78rem;line-height:1.45;color:var(--p-text-color);max-height:140px;overflow-y:auto;overscroll-behavior:contain;border-top:1px solid var(--sm-border);scrollbar-width:thin;scrollbar-color:var(--sm-border) transparent}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--sm-border);border-radius:var(--sm-radius-sm)}[_nghost-%COMP%] .sm-gnode__desc code{background:var(--sm-bg-hover);padding:.02rem .25rem;border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.85em}[_nghost-%COMP%] .sm-gnode__desc a{color:var(--p-primary-color);text-decoration:underline}.sm-gnode__meta[_ngcontent-%COMP%]{padding:.5rem .7rem;border-top:1px solid var(--sm-border);display:flex;flex-direction:column;gap:.35rem}.sm-gnode__meta-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;font-size:.7rem;min-width:0}.sm-gnode__meta-label[_ngcontent-%COMP%]{color:var(--sm-text-muted);text-transform:uppercase;letter-spacing:.04em;font-weight:600;font-size:.6rem;flex:none;min-width:60px;padding-top:.15rem}.sm-gnode__meta-value[_ngcontent-%COMP%]{color:var(--p-text-color);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm-gnode__meta-value--mono[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.08rem .4rem;border-radius:var(--sm-radius-sm);font-size:.68rem}.sm-gnode__footer[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.7rem;min-height:1.4rem;padding:.4rem .7rem;border-top:1px solid var(--sm-border);background:var(--sm-bg-hover);font-size:.7rem;color:var(--sm-text-muted)}.sm-gnode__footer-right-cluster[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.7rem;margin-left:auto}.sm-gnode__stat[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;line-height:1}.sm-gnode__stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.6rem;line-height:1;display:block}.sm-gnode__stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{transform:translateY(1px)}.sm-gnode__stat-num[_ngcontent-%COMP%]{font-weight:600;color:var(--p-text-color);line-height:1;display:block}.sm-gnode__stat--error[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error);padding:.1rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__stat--error[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__stat--warn[_ngcontent-%COMP%]{background:var(--sm-severity-warn-bg);color:var(--sm-severity-warn);padding:.1rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__stat--warn[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%], .sm-gnode__stat--stale[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__tagrow[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;padding:0 .65rem .35rem}.sm-gnode__tag-chip[_ngcontent-%COMP%]{font-size:.6rem;font-family:var(--sm-font-mono);padding:.05rem .35rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);color:var(--sm-text-muted);border:1px solid var(--sm-border);line-height:1.4}.sm-gnode__tag-more[_ngcontent-%COMP%]{font-size:.6rem;color:var(--sm-text-muted);font-style:italic}'],changeDetection:0})}return t})();var YP={a11y:{expand:"Expand performance HUD",collapse:"Collapse performance HUD"},units:{fps:t=>`${t} fps`,ms:t=>`${t}ms`,mb:t=>`${t} MB`,longTasks:t=>`${t} long`,domNodes:t=>`${t} dom`,nodes:(t,i)=>`${t}/${i} nodes`,links:t=>`${t} links`}};var XX=["sparkline"],ZX=()=>({class:"perf-hud__content"}),QX=t=>({content:t});function JX(t,i){if(t&1&&(p(0,"span",9),v(1),h()),t&2){let e=_(2);d(),C(e.texts.units.mb(e.heapMb()))}}function e9(t,i){if(t&1&&(p(0,"div",3)(1,"span",4),v(2),h()(),p(3,"div",5)(4,"div",6)(5,"div",7),R(6,"canvas",8,1),p(8,"span",9),v(9),h()(),p(10,"div",10)(11,"div",11),T(12,JX,2,1,"span",9),p(13,"span",9),v(14),h(),p(15,"span",9),v(16),h()()(),p(17,"div",10)(18,"div",11)(19,"span",9),v(20),h(),p(21,"span",9),v(22),h()()()()()),t&2){let e=_();d(2),C(e.texts.units.fps(e.fps())),d(),G("aria-hidden",!e.expanded()),d(6),C(e.texts.units.ms(e.frameTimeMs())),d(3),I(e.hasHeap()?12:-1),d(2),C(e.texts.units.domNodes(e.domNodes())),d(2),C(e.texts.units.longTasks(e.longTasks())),d(4),C(e.texts.units.nodes(e.visible(),e.total())),d(2),C(e.texts.units.links(e.edges()))}}var t9=30,H_=60,up=14,XP=(()=>{class t{visible=O(0);total=O(0);edges=O(0);texts=YP;destroyRef=u(it);zone=u(Vn);fps=z(0);frameTimeMs=z(0);fpsSamples=z([]);sparklineCanvas=Ae("sparkline");heapMb=z(null);longTasks=z(0);domNodes=z(0);expanded=z(n9());hasHeap=S(()=>this.heapMb()!==null);constructor(){let e=0,n=0,o=performance.now(),r=o,a=0,s=l=>{let f=l-o;if(o=l,e+=1,n+=f,l-r>=1e3){let m=(l-r)/1e3,x=Math.round(e/m);this.fps.set(x),this.frameTimeMs.set(Math.round(n/Math.max(e,1))),this.heapMb.set(o9()),this.domNodes.set(document.querySelectorAll("*").length),this.fpsSamples.update(P=>{let E=P.length>=t9?P.slice(1):P.slice();return E.push(x),E}),e=0,n=0,r=l}a=requestAnimationFrame(s)};this.zone.runOutsideAngular(()=>{a=requestAnimationFrame(s)});let c=null;if(typeof PerformanceObserver<"u")try{c=new PerformanceObserver(l=>{this.longTasks.update(f=>f+l.getEntries().length)}),c.observe({type:"longtask",buffered:!0})}catch{}this.destroyRef.onDestroy(()=>{cancelAnimationFrame(a),c?.disconnect()}),J(()=>{let l=this.sparklineCanvas(),f=this.fpsSamples();l&&r9(l.nativeElement,f)})}setExpanded(e){this.expanded.set(e),i9(e)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-perf-hud"]],viewQuery:function(n,o){n&1&&Tt(o.sparklineCanvas,XX,5),n&2&&ct()},inputs:{visible:[1,"visible"],total:[1,"total"],edges:[1,"edges"]},decls:3,vars:7,consts:[["content",""],["sparkline",""],["data-testid","perf-hud",3,"ngModelChange","ngModel","ariaLabel","styleClass","pt"],[1,"perf-hud__header"],[1,"perf-hud__cell","perf-hud__cell--fps"],[1,"perf-hud__expandable"],[1,"perf-hud__expandable-inner"],[1,"perf-hud__row","perf-hud__row--sparkline"],["aria-hidden","true",1,"perf-hud__sparkline"],[1,"perf-hud__cell"],[1,"perf-hud__section"],[1,"perf-hud__row"]],template:function(n,o){n&1&&(p(0,"p-togglebutton",2),H("ngModelChange",function(a){return o.setExpanded(a)}),be(1,e9,23,8,"ng-template",null,0,Rt),h()),n&2&&M("ngModel",o.expanded())("ariaLabel",o.expanded()?o.texts.a11y.collapse:o.texts.a11y.expand)("styleClass",o.expanded()?"perf-hud perf-hud--expanded":"perf-hud")("pt",vt(5,QX,Nt(4,ZX)))},dependencies:[hn,fn,pn,_n,mn],styles:["[_nghost-%COMP%]{position:absolute;bottom:16px;left:16px;z-index:2;pointer-events:none}.perf-hud[_ngcontent-%COMP%]{pointer-events:auto;--p-togglebutton-padding: 0;--p-togglebutton-content-padding: .25rem .7rem;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-gap: .4rem;--p-togglebutton-background: var(--sm-bg-content);--p-togglebutton-checked-background: var(--sm-bg-content);--p-togglebutton-hover-background: var(--sm-bg-content);--p-togglebutton-border-color: var(--sm-border);--p-togglebutton-checked-border-color: var(--sm-border);--p-togglebutton-content-checked-background: transparent;--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-muted-color);box-shadow:var(--sm-shadow-floating);font-family:var(--sm-font-mono);font-size:.7rem;font-weight:500;line-height:14px;opacity:.75;transition:opacity .15s ease,color .15s ease}.perf-hud[_ngcontent-%COMP%]:hover{opacity:1}.perf-hud--expanded[_ngcontent-%COMP%]{--p-togglebutton-border-radius: var(--sm-radius-md);--p-togglebutton-content-border-radius: var(--sm-radius-md);--p-togglebutton-content-padding: .45rem .7rem;line-height:1.35;opacity:.95}[_nghost-%COMP%] .perf-hud__content{display:flex;flex-direction:column;align-items:stretch;gap:0}.perf-hud__cell[_ngcontent-%COMP%]{white-space:nowrap;font-variant-numeric:tabular-nums}.perf-hud--expanded[_ngcontent-%COMP%] .perf-hud__cell--fps[_ngcontent-%COMP%]{font-weight:600;color:var(--p-text-color)}.perf-hud__sparkline[_ngcontent-%COMP%]{width:60px;height:14px;opacity:.6}.perf-hud__header[_ngcontent-%COMP%]{display:flex;align-items:center}.perf-hud__expandable[_ngcontent-%COMP%]{display:grid;grid-template-rows:0fr;grid-template-columns:0fr;overflow:hidden;transition:grid-template-rows .22s ease,grid-template-columns .22s ease}.perf-hud--expanded[_ngcontent-%COMP%] .perf-hud__expandable[_ngcontent-%COMP%]{grid-template-rows:1fr;grid-template-columns:1fr}.perf-hud__expandable-inner[_ngcontent-%COMP%]{min-height:0;min-width:0;overflow:hidden;display:flex;flex-direction:column;gap:.3rem;padding-top:0;transition:padding-top .22s ease}.perf-hud--expanded[_ngcontent-%COMP%] .perf-hud__expandable-inner[_ngcontent-%COMP%]{padding-top:.3rem}.perf-hud__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.15rem;padding-top:.3rem;border-top:1px solid var(--sm-border)}.perf-hud__section[_ngcontent-%COMP%]:first-child{padding-top:0;border-top:0}.perf-hud__row[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.6rem;white-space:nowrap}.perf-hud__row--sparkline[_ngcontent-%COMP%]{justify-content:space-between;gap:.6rem}"],changeDetection:0})}return t})(),ZP="sm.perf-hud.expanded";function n9(){try{return localStorage.getItem(ZP)==="1"}catch{return!1}}function i9(t){try{localStorage.setItem(ZP,t?"1":"0")}catch{}}function o9(){let t=performance.memory;return t?Math.round(t.usedJSHeapSize/1024/1024):null}function r9(t,i){let e=window.devicePixelRatio||1,n=H_*e,o=up*e;(t.width!==n||t.height!==o)&&(t.width=n,t.height=o);let r=t.getContext("2d");if(!r||(r.setTransform(e,0,0,e,0,0),r.clearRect(0,0,H_,up),i.length<2))return;let a=Math.max(60,...i),s=H_/(i.length-1);r.beginPath();for(let c=0;c<i.length;c+=1){let l=c*s,f=up-i[c]/a*up;c===0?r.moveTo(l,f):r.lineTo(l,f)}r.strokeStyle=getComputedStyle(t).color,r.lineWidth=1,r.stroke()}var a9="debug-perf",QP=(()=>{class t{visible=z(this.resolveInitial());resolveInitial(){let n=new URLSearchParams(window.location.search).get(a9);return n==="1"||n==="true"?!0:n==="0"||n==="false"?!1:lo.graph.perfHud}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Bn={emptyNoSelection:{title:"No node selected",descPrefix:"Pick a node from the ",listLink:"files",descMiddle:" or ",mapLink:"map",descSuffix:"."},emptyNotFound:{title:"Node not found",descSuffix:" does not exist in the collection. ",backLink:"Back to files",descAfterLink:"."},backToList:"\u2190 back to files",header:{invalidFrontmatter:"invalid frontmatter",invalidFrontmatterTooltip:"The YAML frontmatter could not be parsed, so name, description and other metadata are unavailable. Check the Findings section for the parser error."},sections:{annotations:"Annotations",connections:"Connections",findings:"Findings",audit:"Audit",plugins:"Plugin contributions",viewContributions:"View contributions",debug:"Debug",body:"Body"},body:{loading:"Loading body\u2026",empty:"This file has no body content (only frontmatter).",unavailable:"Body content unavailable. The source file may have moved or been deleted since the last scan.",renderError:"Failed to render markdown body.",refreshLabel:"Refresh body"},bump:{label:"Bump version",tooltipEnabled:"Increment the sidecar version and refresh hashes.",tooltipDisabledFresh:"No drift detected (bump is only available when the body or frontmatter has changed since the last bump).",tooltipDisabledNoSidecar:"No sidecar yet. Run `sm sidecar annotate <path>` from your terminal to create one.",errorPrefix:"Bump failed:",errorFresh:"This node is fresh; nothing to bump.",errorNotFound:"Node not found on the server.",errorGeneric:"Could not bump the sidecar.",consentHeader:"Allow skill-map to create files in this project?",consentMessage:`Skill-map will create companion files (*.sm) next to your markdown files to track version, history and tags. Your markdown stays clean, metadata never gets mixed into the content you wrote.
277
-
278
- The choice is per-project and per-machine, it does not travel with the repo, and we won't ask again.`,consentAccept:"Yes, allow",consentReject:"Not now",consentDialogAriaLabel:"Sidecar consent"},findingHintLabel:"Hint:",bumpErrorDismissAriaLabel:"Dismiss",audit:{headerSummary:(t,i)=>`last bumped ${t} by ${i}`,headerEmpty:"never bumped",fields:{lastBumpedAt:"Last bumped",lastBumpedBy:"by",createdAt:"Created",createdBy:"by"}},supersededByBanner:t=>`Superseded by ${t}`,debugToggleAriaLabel:"Toggle debug panel",debugToggleTooltip:"Show diagnostic fields (hash diffs, resolved provider/kind, sidecar status enum).",actionMocks:{label:"Actions",summary:"Generate summary",audit:"Run audit",validate:"Validate"}};var JP=(()=>{class t{dataSource=u(ln);async bump(e,n={}){return this.dataSource.bumpSidecar(e,n)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var eM={cardHeader:"Annotations",emptyOverlay:"No sidecar (.sm) file present for this node.",emptyAnnotations:"Sidecar present but no annotations are declared yet.",sections:{lifecycle:"Lifecycle",supersession:"Supersession",provenance:"Provenance",taxonomy:"Taxonomy",docs:"Docs"},fields:{version:"Version",stability:"Stability",supersedes:"Supersedes",supersededBy:"Superseded by",authors:"Authors",license:"License",source:"Source",sourceVersion:"Source version",tags:"Tags",docsUrl:"Docs URL"},brokenRefTooltip:"This path does not resolve to a node in the current scan scope."};function qr(t){if(typeof t!="string"||t.length===0)return null;try{let i=new URL(t);return i.protocol==="http:"||i.protocol==="https:"?t:null}catch{return null}}var c9=(t,i)=>"u:"+i;function d9(t,i){if(t&1&&(p(0,"p",1),v(1),h()),t&2){let e=_(2);d(),C(e.texts.emptyOverlay)}}function l9(t,i){if(t&1&&(p(0,"p",2),v(1),h()),t&2){let e=_(2);d(),C(e.texts.emptyAnnotations)}}function u9(t,i){if(t&1&&T(0,d9,2,1,"p",1)(1,l9,2,1,"p",2),t&2){let e,n=_();I((e=n.overlay())!=null&&e.present?1:0)}}function f9(t,i){if(t&1&&(p(0,"code",4),v(1),h()),t&2){_();let e=oe(0);d(),qe("v",e.version)}}function p9(t,i){if(t&1&&R(0,"p-tag",5),t&2){_();let e=oe(0),n=_(2);M("value",e.stability)("severity",n.stabilitySeverity(e.stability))("rounded",!0)}}function h9(t,i){if(t&1&&(lt(0),p(1,"dt"),v(2),h(),p(3,"dd",3),T(4,f9,2,1,"code",4),T(5,p9,1,3,"p-tag",5),h()),t&2){let e=_(2),n=Xe(e.lifecycle());d(2),C(e.texts.sections.lifecycle),d(2),I(n.version!==null?4:-1),d(),I(n.stability!==null?5:-1)}}function m9(t,i){if(t&1){let e=se();p(0,"span",7),R(1,"i",8),p(2,"span"),v(3),h()(),p(4,"p-chip",9),H("click",function(){B(e),_();let o=oe(0),r=_(2);return q(r.onOpenPath(o.supersededBy))}),h()}if(t&2){_();let e=oe(0),n=_(2);d(3),C(n.texts.fields.supersededBy),d(),M("label",e.supersededBy)("styleClass",n.isBroken(e.supersededBy)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e.supersededBy)?n.texts.brokenRefTooltip:"")}}function _9(t,i){if(t&1){let e=se();p(0,"p-chip",9),H("click",function(){let o=B(e).$implicit,r=_(4);return q(r.onOpenPath(o))}),h()}if(t&2){let e=i.$implicit,n=_(4);M("label",e)("styleClass",n.isBroken(e)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e)?n.texts.brokenRefTooltip:"")}}function g9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",10),p(2,"span"),v(3),h()(),Y(4,_9,1,3,"p-chip",11,Ce)),t&2){_();let e=oe(0),n=_(2);d(3),C(n.texts.fields.supersedes),d(),X(e.supersedes)}}function v9(t,i){if(t&1&&(lt(0),p(1,"dt"),v(2),h(),p(3,"dd",6),T(4,m9,5,4),T(5,g9,6,1),h()),t&2){let e=_(2),n=Xe(e.supersession());d(2),C(e.texts.sections.supersession),d(2),I(n.supersededBy!==null?4:-1),d(),I(n.supersedes.length?5:-1)}}function y9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",13),p(2,"span"),v(3),h()()),t&2){let e=i.$implicit;d(3),C(e)}}function C9(t,i){if(t&1&&Y(0,y9,4,1,"span",7,Ce),t&2){_();let e=oe(0);X(e.authors)}}function x9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",14),p(2,"span"),v(3),h()()),t&2){_();let e=oe(0);d(3),C(e.license)}}function b9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",15),p(2,"a",16),v(3),h()()),t&2){_();let e=oe(0);d(2),M("href",e.source,vo),d(),C(e.source)}}function w9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",17),p(2,"code"),v(3),h()()),t&2){_();let e=oe(0);d(3),C(e.sourceVersion)}}function S9(t,i){if(t&1&&(lt(0),p(1,"dt"),v(2),h(),p(3,"dd",12),T(4,C9,2,0),T(5,x9,4,1,"span",7),T(6,b9,4,2,"span",7),T(7,w9,4,1,"span",7),h()),t&2){let e=_(2),n=Xe(e.provenance());d(2),C(e.texts.sections.provenance),d(2),I(n.authors.length?4:-1),d(),I(n.license!==null?5:-1),d(),I(n.source!==null?6:-1),d(),I(n.sourceVersion!==null?7:-1)}}function T9(t,i){if(t&1){let e=se();p(0,"p-chip",21),H("click",function(){let o=B(e).$implicit,r=_(3);return q(r.tagClick.emit(o))})("keydown.enter",function(){let o=B(e).$implicit,r=_(3);return q(r.tagClick.emit(o))})("keydown.space",function(o){let r=B(e).$implicit;return _(3).tagClick.emit(r),q(o.preventDefault())}),h()}if(t&2){let e=i.$implicit,n=_(3);M("label",e)("styleClass","ann-panel__chip ann-panel__chip--user"+(n.isActiveTag(e)?" ann-panel__chip--active":""))}}function I9(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",18)(3,"div",19),Y(4,T9,1,2,"p-chip",20,c9),h()()),t&2){let e=_(2),n=e.taxonomy();d(),C(e.texts.fields.tags),d(3),X(n.userTags)}}function E9(t,i){if(t&1&&(p(0,"span",7),R(1,"i",23),p(2,"a",16),v(3),h()()),t&2){_();let e=oe(0);d(2),M("href",e.docsUrl,vo),d(),C(e.docsUrl)}}function P9(t,i){if(t&1&&(lt(0),p(1,"dt"),v(2),h(),p(3,"dd",22),T(4,E9,4,2,"span",7),h()),t&2){let e=_(2),n=Xe(e.docs());d(2),C(e.texts.sections.docs),d(2),I(n.docsUrl!==null?4:-1)}}function M9(t,i){if(t&1&&(p(0,"dl",0),T(1,h9,6,4),T(2,v9,6,4),T(3,S9,8,6),T(4,I9,6,1),T(5,P9,5,3),h()),t&2){let e=_();d(),I(e.hasLifecycle()?1:-1),d(),I(e.hasSupersession()?2:-1),d(),I(e.hasProvenance()?3:-1),d(),I(e.hasTaxonomy()?4:-1),d(),I(e.hasDocs()?5:-1)}}var tM=(()=>{class t{overlay=O(void 0);knownPaths=O(null);openPath=Ve();tagClick=Ve();activeTag=O(null);isActiveTag(e){return this.activeTag()===e}texts=eM;annotations=S(()=>{let e=this.overlay();return!e||!e.present?null:e.annotations??null});hasAnnotations=S(()=>{let e=this.annotations();return e!==null&&Object.keys(e).length>0});hasAnyContent=S(()=>this.hasLifecycle()||this.hasSupersession()||this.hasProvenance()||this.hasTaxonomy()||this.hasDocs());lifecycle=S(()=>{let e=this.annotations()??{};return{version:k9(e.version),stability:D9(e.stability)}});hasLifecycle=S(()=>fp(this.lifecycle()));supersession=S(()=>{let e=this.annotations()??{};return{supersedes:j_(e.supersedes),supersededBy:V_(e.supersededBy)}});hasSupersession=S(()=>fp(this.supersession()));provenance=S(()=>{let e=this.annotations()??{};return{authors:j_(e.authors),license:V_(e.license),source:qr(e.source),sourceVersion:V_(e.sourceVersion)}});hasProvenance=S(()=>fp(this.provenance()));taxonomy=S(()=>{let e=this.annotations()??{};return{userTags:j_(e.tags)}});hasTaxonomy=S(()=>this.taxonomy().userTags.length>0);docs=S(()=>{let e=this.annotations()??{};return{docsUrl:qr(e.docsUrl)}});hasDocs=S(()=>fp(this.docs()));stabilitySeverity(e){return Gg[e]}isBroken(e){let n=this.knownPaths();return n?!n.has(e):!1}onOpenPath(e){this.isBroken(e)||this.openPath.emit(e)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-annotations-panel"]],inputs:{overlay:[1,"overlay"],knownPaths:[1,"knownPaths"],activeTag:[1,"activeTag"]},outputs:{openPath:"openPath",tagClick:"tagClick"},decls:2,vars:1,consts:[[1,"ann-panel__rows","sm-block__kv"],["data-testid","annotations-panel-empty-overlay",1,"ann-panel__empty"],["data-testid","annotations-panel-empty-annotations",1,"ann-panel__empty"],["data-testid","annotations-section-lifecycle",1,"ann-panel__inline"],["data-testid","annotations-version"],["data-testid","annotations-stability",3,"value","severity","rounded"],["data-testid","annotations-section-supersession",1,"ann-panel__inline"],[1,"ann-panel__meta"],["aria-hidden","true",1,"pi","pi-arrow-down"],[3,"click","label","styleClass","pTooltip"],["aria-hidden","true",1,"pi","pi-arrow-up"],[3,"label","styleClass","pTooltip"],["data-testid","annotations-section-provenance",1,"ann-panel__inline"],["aria-hidden","true",1,"pi","pi-user"],["aria-hidden","true",1,"pi","pi-shield"],["aria-hidden","true",1,"pi","pi-link"],["target","_blank","rel","noopener noreferrer",3,"href"],["aria-hidden","true",1,"pi","pi-tag"],["data-testid","annotations-section-taxonomy",1,"ann-panel__chips"],["data-testid","annotations-tags",1,"ann-panel__chips-row"],["data-tag-source","user","role","button","tabindex","0",3,"label","styleClass"],["data-tag-source","user","role","button","tabindex","0",3,"click","keydown.enter","keydown.space","label","styleClass"],["data-testid","annotations-section-docs",1,"ann-panel__inline"],["aria-hidden","true",1,"pi","pi-external-link"]],template:function(n,o){n&1&&T(0,u9,2,1)(1,M9,6,5,"dl",0),n&2&&I(o.hasAnyContent()?1:0)},dependencies:[_a,qg,va,ga,Oe,De],styles:["[_nghost-%COMP%]{display:block}.ann-panel__empty[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-style:italic;font-size:.85rem;margin:0}.ann-panel__rows[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{display:flex;align-items:center}.ann-panel__inline[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.45rem .65rem;row-gap:.35rem}.ann-panel__meta[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;font-size:.83rem;color:var(--p-text-color)}.ann-panel__meta[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-size:.85rem}.ann-panel__meta[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--p-primary-color);word-break:break-all}.ann-panel__meta[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.05rem .35rem;border-radius:var(--sm-radius-sm);font-size:.78rem}.ann-panel__chips[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap}.ann-panel__chips-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.3rem}[_nghost-%COMP%] .chip--broken{background:var(--sm-bg-hover);color:var(--sm-text-muted);text-decoration:line-through;cursor:not-allowed}[_nghost-%COMP%] .chip--link{cursor:pointer;background:var(--p-primary-50);color:var(--p-primary-color);transition:background .15s ease}[_nghost-%COMP%] .chip--link:hover{background:var(--p-primary-100)}[_nghost-%COMP%] .ann-panel__chip--user{background:var(--p-chip-background);color:var(--p-chip-color);cursor:pointer;transition:filter .1s ease,box-shadow .1s ease}[_nghost-%COMP%] .ann-panel__chip--user:hover{filter:brightness(1.05)}[_nghost-%COMP%] .ann-panel__chip--user:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:1px}[_nghost-%COMP%] .ann-panel__chip--active{background:var(--p-primary-color);color:var(--p-primary-color-text);border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-200)}"],changeDetection:0})}return t})();function k9(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function V_(t){return typeof t=="string"&&t.length>0?t:null}function D9(t){return t==="stable"||t==="experimental"||t==="deprecated"?t:null}function j_(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function fp(t){for(let i of Object.values(t))if(i!=null){if(Array.isArray(i)){if(i.length>0)return!0;continue}if(typeof i=="string"){if(i.length>0)return!0;continue}return!0}return!1}var nM=`
279
- .p-card {
280
- background: dt('card.background');
281
- color: dt('card.color');
282
- box-shadow: dt('card.shadow');
283
- border-radius: dt('card.border.radius');
284
- display: flex;
285
- flex-direction: column;
286
- }
287
-
288
- .p-card-caption {
289
- display: flex;
290
- flex-direction: column;
291
- gap: dt('card.caption.gap');
292
- }
293
-
294
- .p-card-body {
295
- padding: dt('card.body.padding');
296
- display: flex;
297
- flex-direction: column;
298
- gap: dt('card.body.gap');
299
- }
300
-
301
- .p-card-title {
302
- font-size: dt('card.title.font.size');
303
- font-weight: dt('card.title.font.weight');
304
- }
305
-
306
- .p-card-subtitle {
307
- color: dt('card.subtitle.color');
308
- }
309
- `;var O9=["header"],N9=["title"],R9=["subtitle"],A9=["content"],F9=["footer"],L9=["*",[["p-header"]],[["p-footer"]]],z9=["*","p-header","p-footer"];function B9(t,i){t&1&&wi(0)}function q9(t,i){if(t&1&&(p(0,"div",1),ke(1,1),be(2,B9,1,0,"ng-container",2),h()),t&2){let e=_();Re(e.cx("header")),M("pBind",e.ptm("header")),d(2),M("ngTemplateOutlet",e.headerTemplate||e._headerTemplate)}}function G9(t,i){if(t&1&&(jn(0),v(1),Un()),t&2){let e=_(2);d(),C(e.header)}}function H9(t,i){t&1&&wi(0)}function V9(t,i){if(t&1&&(p(0,"div",1),be(1,G9,2,1,"ng-container",3)(2,H9,1,0,"ng-container",2),h()),t&2){let e=_();Re(e.cx("title")),M("pBind",e.ptm("title")),d(),M("ngIf",e.header&&!e._titleTemplate&&!e.titleTemplate),d(),M("ngTemplateOutlet",e.titleTemplate||e._titleTemplate)}}function j9(t,i){if(t&1&&(jn(0),v(1),Un()),t&2){let e=_(2);d(),C(e.subheader)}}function U9(t,i){t&1&&wi(0)}function W9(t,i){if(t&1&&(p(0,"div",1),be(1,j9,2,1,"ng-container",3)(2,U9,1,0,"ng-container",2),h()),t&2){let e=_();Re(e.cx("subtitle")),M("pBind",e.ptm("subtitle")),d(),M("ngIf",e.subheader&&!e._subtitleTemplate&&!e.subtitleTemplate),d(),M("ngTemplateOutlet",e.subtitleTemplate||e._subtitleTemplate)}}function $9(t,i){t&1&&wi(0)}function K9(t,i){t&1&&wi(0)}function Y9(t,i){if(t&1&&(p(0,"div",1),ke(1,2),be(2,K9,1,0,"ng-container",2),h()),t&2){let e=_();Re(e.cx("footer")),M("pBind",e.ptm("footer")),d(2),M("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}var X9=`
310
- ${nM}
311
-
312
- .p-card {
313
- display: block;
314
- }
315
- `,Z9={root:"p-card p-component",header:"p-card-header",body:"p-card-body",caption:"p-card-caption",title:"p-card-title",subtitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer"},iM=(()=>{class t extends na{name="card";style=X9;classes=Z9;static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var oM=new ue("CARD_INSTANCE"),U_=(()=>{class t extends oa{componentName="Card";$pcCard=u(oM,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=u(Ft,{self:!0});_componentStyle=u(iM);onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}header;subheader;set style(e){fg(this._style(),e)||(this._style.set(e),this.el?.nativeElement&&e&&Object.keys(e).forEach(n=>{this.el.nativeElement.style[n]=e[n]}))}get style(){return this._style()}styleClass;headerFacet;footerFacet;headerTemplate;titleTemplate;subtitleTemplate;contentTemplate;footerTemplate;_headerTemplate;_titleTemplate;_subtitleTemplate;_contentTemplate;_footerTemplate;_style=z(null);getBlockableElement(){return this.el.nativeElement}templates;onAfterContentInit(){this.templates.forEach(e=>{switch(e.getType()){case"header":this._headerTemplate=e.template;break;case"title":this._titleTemplate=e.template;break;case"subtitle":this._subtitleTemplate=e.template;break;case"content":this._contentTemplate=e.template;break;case"footer":this._footerTemplate=e.template;break;default:this._contentTemplate=e.template;break}})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ee(t)))(o||t)}})();static \u0275cmp=K({type:t,selectors:[["p-card"]],contentQueries:function(n,o,r){if(n&1&&Xr(r,hg,5)(r,mg,5)(r,O9,4)(r,N9,4)(r,R9,4)(r,A9,4)(r,F9,4)(r,Ii,4),n&2){let a;_t(a=gt())&&(o.headerFacet=a.first),_t(a=gt())&&(o.footerFacet=a.first),_t(a=gt())&&(o.headerTemplate=a.first),_t(a=gt())&&(o.titleTemplate=a.first),_t(a=gt())&&(o.subtitleTemplate=a.first),_t(a=gt())&&(o.contentTemplate=a.first),_t(a=gt())&&(o.footerTemplate=a.first),_t(a=gt())&&(o.templates=a)}},hostVars:4,hostBindings:function(n,o){n&2&&(Zr(o._style()),Re(o.cn(o.cx("root"),o.styleClass)))},inputs:{header:"header",subheader:"subheader",style:"style",styleClass:"styleClass"},features:[ge([iM,{provide:oM,useExisting:t},{provide:ia,useExisting:t}]),$r([Ft]),he],ngContentSelectors:z9,decls:8,vars:11,consts:[[3,"pBind","class",4,"ngIf"],[3,"pBind"],[4,"ngTemplateOutlet"],[4,"ngIf"]],template:function(n,o){n&1&&(Kt(L9),be(0,q9,3,4,"div",0),p(1,"div",1),be(2,V9,3,5,"div",0)(3,W9,3,5,"div",0),p(4,"div",1),ke(5),be(6,$9,1,0,"ng-container",2),h(),be(7,Y9,3,4,"div",0),h()),n&2&&(M("ngIf",o.headerFacet||o.headerTemplate||o._headerTemplate),d(),Re(o.cx("body")),M("pBind",o.ptm("body")),d(),M("ngIf",o.header||o.titleTemplate||o._titleTemplate),d(),M("ngIf",o.subheader||o.subtitleTemplate||o._subtitleTemplate),d(),Re(o.cx("content")),M("pBind",o.ptm("content")),d(2),M("ngTemplateOutlet",o.contentTemplate||o._contentTemplate),d(),M("ngIf",o.footerFacet||o.footerTemplate||o._footerTemplate))},dependencies:[Si,ig,Jr,sn,ra,Ft],encapsulation:2,changeDetection:0})}return t})(),rM=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=xi({type:t});static \u0275inj=vi({imports:[U_,sn,ra,sn,ra]})}return t})();var aM={cardHeader:"Linked nodes",refreshLabel:"Refresh links",outgoingHeader:"Outgoing",incomingHeader:"Incoming",findingsHeader:"Findings",emptyFindings:"No findings on this node.",loading:"Loading links\u2026",error:"Failed to load links.",emptyOutgoing:"No outgoing links from this node.",emptyIncoming:"No incoming links to this node.",confidence:{high:"high",medium:"medium",low:"low"},sourcesPrefix:"detected by ",sourcesSeparator:", ",issueOnTargetTooltip:"Target has an issue: ",issueOnSourceTooltip:"Source has an issue: ",occurrencesHeader:"Occurs at:",occurrencesItem:"line {{line}} \xB7 `{{trigger}}` ({{extractor}})",occurrencesItemUnknownLine:"`{{trigger}}` ({{extractor}})",externalRefsHeader:"External references",emptyExternalRefs:"No external URLs in this node's body.",externalRefsItemLine:"line {{line}}",externalRefsItemUnknownLine:"unknown line"};var J9=(t,i)=>i.url+"|"+(i.line??-1),eZ=(t,i)=>i.analyzerId+"|"+((i.data==null?null:i.data.target)??"")+"|"+i.message,cM=(t,i)=>i.source+"|"+i.target+"|"+i.kind+"|"+((i.trigger==null?null:i.trigger.normalizedTrigger)??""),dM=(t,i)=>i.extractor+"|"+i.originalTrigger+"|"+((i.location==null?null:i.location.line)??-1);function tZ(t,i){if(t&1){let e=se();p(0,"div",4)(1,"h3",5),v(2),h(),p(3,"p-button",6),H("onClick",function(){B(e);let o=_(2);return q(o.refresh())}),h()()}if(t&2){let e=_(2);d(2),C(e.texts.cardHeader),d(),M("rounded",!0)("text",!0)("ariaLabel",e.texts.refreshLabel)("pTooltip",e.texts.refreshLabel)("disabled",e.state()==="loading")}}function nZ(t,i){if(t&1&&(p(0,"p",2),v(1),h()),t&2){let e=_(2);d(),C(e.texts.loading)}}function iZ(t,i){if(t&1&&(p(0,"p",3),v(1),h()),t&2){let e=_(2);d(),C(e.texts.error)}}function oZ(t,i){if(t&1&&v(0),t&2){let e=_().$implicit,n=_(4);qe(" ",n.texts.externalRefsItemLine.replace("{{line}}",e.line.toString())," ")}}function rZ(t,i){if(t&1&&v(0),t&2){let e=_(5);qe(" ",e.texts.externalRefsItemUnknownLine," ")}}function aZ(t,i){if(t&1&&(p(0,"li",16)(1,"span",17),T(2,oZ,1,1)(3,rZ,1,1),h(),p(4,"a",18),v(5),h()()),t&2){let e=i.$implicit;G("data-testid","linked-nodes-external-ref-"+e.url),d(2),I(e.line?2:3),d(2),M("href",e.url,vo),d(),C(e.url)}}function sZ(t,i){if(t&1&&(p(0,"section",7)(1,"h4",9),v(2),h(),p(3,"ul",11),Y(4,aZ,6,4,"li",16,J9),h()()),t&2){let e=_(3);d(2),C(e.texts.externalRefsHeader),d(2),X(e.externalRefs())}}function cZ(t,i){if(t&1&&(p(0,"p",10),v(1),h()),t&2){let e=_(3);d(),C(e.texts.emptyFindings)}}function dZ(t,i){if(t&1&&(p(0,"li",19),R(1,"p-tag",20),p(2,"span",21),v(3),h()()),t&2){let e=i.$implicit,n=_(4);G("data-testid","linked-nodes-finding-"+e.analyzerId),d(),M("value",e.analyzerId)("severity",n.issueSeverity(e.severity))("rounded",!0),d(2),C(e.message)}}function lZ(t,i){if(t&1&&(p(0,"ul",11),Y(1,dZ,4,5,"li",19,eZ),h()),t&2){let e=_(3);d(),X(e.findings())}}function uZ(t,i){if(t&1&&(p(0,"p",13),v(1),h()),t&2){let e=_(3);d(),C(e.texts.emptyOutgoing)}}function fZ(t,i){if(t&1&&R(0,"p-tag",25),t&2){let e=i,n=_().$implicit,o=_(4);M("value",e.analyzerId)("severity",o.issueSeverity(e.severity))("rounded",!0)("pTooltip",e.message),G("data-testid","linked-nodes-outgoing-issue-"+n.target)}}function pZ(t,i){if(t&1&&(p(0,"span",26),v(1),h()),t&2){let e=_().$implicit,n=_(4);d(),Ep(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function hZ(t,i){if(t&1&&(p(0,"li",29),v(1),h()),t&2){let e=i.$implicit,n=_(6);d(),C(n.occurrenceLabel(e))}}function mZ(t,i){if(t&1&&(p(0,"ul",27)(1,"li",28),v(2),h(),Y(3,hZ,2,1,"li",29,dM),h()),t&2){let e=_().$implicit,n=_(4);G("data-testid","linked-nodes-occurrences-"+e.target),d(2),C(n.texts.occurrencesHeader),d(),X(e.occurrences)}}function _Z(t,i){if(t&1){let e=se();p(0,"li",22),R(1,"p-tag",23),p(2,"p-button",24),H("onClick",function(){let o=B(e).$implicit,r=_(4);return q(r.onOpen(o.target))}),h(),R(3,"p-tag",25),T(4,fZ,1,5,"p-tag",25),T(5,pZ,2,2,"span",26),T(6,mZ,5,2,"ul",27),h()}if(t&2){let e,n=i.$implicit,o=_(4);G("data-testid","linked-nodes-outgoing-row-"+n.target),d(),M("value",n.kind)("severity",o.kindSeverity(n.kind)),d(),M("link",!0)("label",n.target),G("data-testid","linked-nodes-outgoing-link-"+n.target),d(),M("value",o.confidenceValue(n.confidence))("severity",o.confidenceSeverity(n.confidence))("rounded",!0)("pTooltip",o.confidenceLabel(n.confidence)),d(),I((e=o.issueForOutgoing(n))?4:-1,e),d(),I(n.sources.length?5:-1),d(),I(n.occurrences&&n.occurrences.length>0?6:-1)}}function gZ(t,i){if(t&1&&(p(0,"ul",11),Y(1,_Z,7,13,"li",22,cM),h()),t&2){let e=_(3);d(),X(e.outgoing())}}function vZ(t,i){if(t&1&&(p(0,"p",15),v(1),h()),t&2){let e=_(3);d(),C(e.texts.emptyIncoming)}}function yZ(t,i){if(t&1&&R(0,"p-tag",25),t&2){let e=i,n=_().$implicit,o=_(4);M("value",e.analyzerId)("severity",o.issueSeverity(e.severity))("rounded",!0)("pTooltip",e.message),G("data-testid","linked-nodes-incoming-issue-"+n.source)}}function CZ(t,i){if(t&1&&(p(0,"span",26),v(1),h()),t&2){let e=_().$implicit,n=_(4);d(),Ep(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function xZ(t,i){if(t&1&&(p(0,"li",29),v(1),h()),t&2){let e=i.$implicit,n=_(6);d(),C(n.occurrenceLabel(e))}}function bZ(t,i){if(t&1&&(p(0,"ul",27)(1,"li",28),v(2),h(),Y(3,xZ,2,1,"li",29,dM),h()),t&2){let e=_().$implicit,n=_(4);G("data-testid","linked-nodes-occurrences-"+e.target),d(2),C(n.texts.occurrencesHeader),d(),X(e.occurrences)}}function wZ(t,i){if(t&1){let e=se();p(0,"li",22),R(1,"p-tag",23),p(2,"p-button",24),H("onClick",function(){let o=B(e).$implicit,r=_(4);return q(r.onOpen(o.source))}),h(),R(3,"p-tag",25),T(4,yZ,1,5,"p-tag",25),T(5,CZ,2,2,"span",26),T(6,bZ,5,2,"ul",27),h()}if(t&2){let e,n=i.$implicit,o=_(4);G("data-testid","linked-nodes-incoming-row-"+n.source),d(),M("value",n.kind)("severity",o.kindSeverity(n.kind)),d(),M("link",!0)("label",n.source),G("data-testid","linked-nodes-incoming-link-"+n.source),d(),M("value",o.confidenceValue(n.confidence))("severity",o.confidenceSeverity(n.confidence))("rounded",!0)("pTooltip",o.confidenceLabel(n.confidence)),d(),I((e=o.issueForIncoming(n))?4:-1,e),d(),I(n.sources.length?5:-1),d(),I(n.occurrences&&n.occurrences.length>0?6:-1)}}function SZ(t,i){if(t&1&&(p(0,"ul",11),Y(1,wZ,7,13,"li",22,cM),h()),t&2){let e=_(3);d(),X(e.incoming())}}function TZ(t,i){if(t&1&&(T(0,sZ,6,1,"section",7),p(1,"section",8)(2,"h4",9),v(3),h(),T(4,cZ,2,1,"p",10)(5,lZ,3,0,"ul",11),h(),p(6,"section",12)(7,"h4",9),v(8),h(),T(9,uZ,2,1,"p",13)(10,gZ,3,0,"ul",11),h(),p(11,"section",14)(12,"h4",9),v(13),h(),T(14,vZ,2,1,"p",15)(15,SZ,3,0,"ul",11),h()),t&2){let e=_(2);I(e.externalRefs().length>0?0:-1),d(3),C(e.texts.findingsHeader),d(),I(e.findings().length===0?4:5),d(4),C(e.texts.outgoingHeader),d(),I(e.outgoing().length===0?9:10),d(4),C(e.texts.incomingHeader),d(),I(e.incoming().length===0?14:15)}}function IZ(t,i){if(t&1&&(p(0,"p-card",0),be(1,tZ,4,6,"ng-template",1),T(2,nZ,2,1,"p",2)(3,iZ,2,1,"p",3)(4,TZ,16,7),h()),t&2){let e,n=_();d(2),I((e=n.state())==="loading"?2:e==="error"?3:e==="ready"?4:-1)}}var lM=(()=>{class t{dataSource=u(ln);wsEvents=u(xg);destroyRef=u(it);texts=aM;path=O(null);openPath=Ve();state=z("idle");outgoingRaw=z([]);incomingRaw=z([]);outgoing=S(()=>this.outgoingRaw().filter(e=>!sM(e)));incoming=S(()=>this.incomingRaw().filter(e=>!sM(e)));issues=z([]);externalRefsRaw=z([]);externalRefs=S(()=>this.externalRefsRaw().filter(e=>qr(e.url)!==null));fetchToken=0;hasResults=S(()=>this.state()==="ready"&&(this.outgoing().length>0||this.incoming().length>0));findings=S(()=>{let e=this.path();return e?this.issues().filter(n=>n.nodeIds.includes(e)):[]});constructor(){this.wsEvents.scanCompleted$.pipe(da(this.destroyRef)).subscribe(()=>{let e=this.path();e&&this.fetch(e)}),J(()=>{let e=this.path();if(!e){this.fetchToken++,this.state.set("idle"),this.outgoingRaw.set([]),this.incomingRaw.set([]);return}this.fetch(e)})}refresh(){let e=this.path();e&&this.fetch(e)}onOpen(e){this.openPath.emit(e)}kindSeverity(e){return Hg[e]??"secondary"}confidenceSeverity(e){return jg(e)}confidenceLabel(e){return this.texts.confidence[Vg(e)]}confidenceValue(e){return e.toFixed(2)}issueSeverity(e){return e==="error"?"danger":e==="warn"?"warn":"info"}issueForOutgoing(e){let n=this.path();if(!n)return null;let o=[e.target,e.resolvedTarget].filter(c=>typeof c=="string"),r=this.issues().find(c=>{if(!c.nodeIds.includes(n))return!1;let l=c.data?.target;return typeof l!="string"?!1:o.includes(l)});if(r)return r;let a=e.resolvedTarget??e.target;return this.issues().find(c=>{if(!c.nodeIds.includes(a))return!1;let l=c.data?.target;return typeof l!="string"||l===a})??null}occurrenceLabel(e){let n=e.location?.line;return typeof n!="number"?this.texts.occurrencesItemUnknownLine.replace("{{trigger}}",e.originalTrigger).replace("{{extractor}}",e.extractor):this.texts.occurrencesItem.replace("{{line}}",String(n)).replace("{{trigger}}",e.originalTrigger).replace("{{extractor}}",e.extractor)}issueForIncoming(e){let n=this.path();if(!n)return null;let o=[e.target,e.resolvedTarget,n].filter(a=>typeof a=="string");return this.issues().find(a=>{if(!a.nodeIds.includes(e.source))return!1;let s=a.data?.target;return typeof s!="string"?!1:o.includes(s)})??null}async fetch(e){let n=++this.fetchToken;this.state.set("loading");try{let[o,r,a]=await Promise.allSettled([this.dataSource.listLinks({from:e}),this.dataSource.listLinks({to:e}),this.dataSource.getNode(e)]);if(n!==this.fetchToken)return;if(o.status!=="fulfilled"||r.status!=="fulfilled"){this.outgoingRaw.set([]),this.incomingRaw.set([]),this.issues.set([]),this.externalRefsRaw.set([]),this.state.set("error");return}let s=o.value.items,c=r.value.items,l=EZ(e,s,c),f;try{let m=await this.dataSource.listIssues({nodes:l});if(n!==this.fetchToken)return;f=m.items}catch{if(n!==this.fetchToken)return;this.outgoingRaw.set([]),this.incomingRaw.set([]),this.issues.set([]),this.externalRefsRaw.set([]),this.state.set("error");return}this.outgoingRaw.set(s),this.incomingRaw.set(c),this.issues.set(f),this.externalRefsRaw.set(a.status==="fulfilled"?a.value?.item?.externalRefs??[]:[]),this.state.set("ready")}catch{if(n!==this.fetchToken)return;this.outgoingRaw.set([]),this.incomingRaw.set([]),this.issues.set([]),this.externalRefsRaw.set([]),this.state.set("error")}}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-linked-nodes-panel"]],inputs:{path:[1,"path"]},outputs:{openPath:"openPath"},decls:1,vars:1,consts:[["styleClass","linked-nodes-panel","data-testid","linked-nodes-panel"],["pTemplate","header"],["data-testid","linked-nodes-loading",1,"linked-nodes-panel__status"],["data-testid","linked-nodes-error",1,"linked-nodes-panel__status","linked-nodes-panel__status--warn"],[1,"linked-nodes-panel__header"],[1,"linked-nodes-panel__title"],["icon","pi pi-refresh","severity","secondary","data-testid","linked-nodes-refresh",3,"onClick","rounded","text","ariaLabel","pTooltip","disabled"],["data-testid","linked-nodes-external-refs",1,"linked-nodes-panel__section"],["data-testid","linked-nodes-findings",1,"linked-nodes-panel__section"],[1,"linked-nodes-panel__section-title"],["data-testid","linked-nodes-findings-empty",1,"linked-nodes-panel__status"],[1,"linked-nodes-panel__rows"],["data-testid","linked-nodes-outgoing",1,"linked-nodes-panel__section"],["data-testid","linked-nodes-outgoing-empty",1,"linked-nodes-panel__status"],["data-testid","linked-nodes-incoming",1,"linked-nodes-panel__section"],["data-testid","linked-nodes-incoming-empty",1,"linked-nodes-panel__status"],[1,"linked-nodes-panel__row","linked-nodes-panel__row--external-ref"],[1,"linked-nodes-panel__external-ref-line"],["target","_blank","rel","noopener noreferrer",1,"linked-nodes-panel__external-ref-url",3,"href"],[1,"linked-nodes-panel__row","linked-nodes-panel__row--finding"],[3,"value","severity","rounded"],[1,"linked-nodes-panel__finding-message"],[1,"linked-nodes-panel__row"],[3,"value","severity"],["severity","primary","styleClass","linked-nodes-panel__path",3,"onClick","link","label"],[3,"value","severity","rounded","pTooltip"],[1,"linked-nodes-panel__sources"],[1,"linked-nodes-panel__occurrences"],[1,"linked-nodes-panel__occurrences-header"],[1,"linked-nodes-panel__occurrences-item"]],template:function(n,o){n&1&&T(0,IZ,5,1,"p-card",0),n&2&&I(o.path()?0:-1)},dependencies:[rM,U_,Ii,va,ga,_a,dn,cn,Oe,De],styles:["[_nghost-%COMP%]{display:block}.linked-nodes-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.75rem 1rem 0}.linked-nodes-panel__title[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600}.linked-nodes-panel__status[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--p-text-muted-color);font-style:italic}.linked-nodes-panel__status--warn[_ngcontent-%COMP%]{color:var(--sm-severity-warn);font-style:normal}.linked-nodes-panel__section[_ngcontent-%COMP%] + .linked-nodes-panel__section[_ngcontent-%COMP%]{margin-top:1rem}.linked-nodes-panel__section-title[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:.8rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color)}.linked-nodes-panel__rows[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.linked-nodes-panel__row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;padding:.4rem .5rem;border-radius:var(--sm-radius-md);background:var(--p-content-background);border:1px solid var(--p-content-border-color)}.linked-nodes-panel__path[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.85rem;padding:0;text-underline-offset:2px}.linked-nodes-panel__sources[_ngcontent-%COMP%]{font-size:.75rem;color:var(--p-text-muted-color);margin-left:auto}.linked-nodes-panel__occurrences[_ngcontent-%COMP%]{flex-basis:100%;list-style:none;margin:.25rem 0 0;padding:.25rem 0 0;border-top:1px dashed var(--p-content-border-color);display:flex;flex-direction:column;gap:.15rem}.linked-nodes-panel__occurrences-header[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color)}.linked-nodes-panel__occurrences-item[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem;color:var(--p-text-muted-color)}.linked-nodes-panel__row--finding[_ngcontent-%COMP%]{align-items:flex-start}.linked-nodes-panel__finding-message[_ngcontent-%COMP%]{font-size:.8rem;line-height:1.4;color:var(--p-text-color)}.linked-nodes-panel__row--external-ref[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.85rem}.linked-nodes-panel__external-ref-line[_ngcontent-%COMP%]{font-size:.75rem;color:var(--p-text-muted-color);min-width:4.5rem}.linked-nodes-panel__external-ref-url[_ngcontent-%COMP%]{flex:1;word-break:break-all;color:var(--p-primary-color);text-decoration:none}.linked-nodes-panel__external-ref-url[_ngcontent-%COMP%]:hover{text-decoration:underline}"],changeDetection:0})}return t})();function EZ(t,i,e){let n=new Set([t]);for(let o of i)o.resolvedTarget&&n.add(o.resolvedTarget),o.target&&n.add(o.target);for(let o of e)o.source&&n.add(o.source);return[...n]}function sM(t){return!!(t.source===t.target||t.resolvedTarget&&t.source===t.resolvedTarget)}var uM={sections:{behavior:"Behavior",capabilities:"Capabilities",initialPrompt:"Initial prompt"},fields:{tools:"Tools",model:"Model",skills:"Skills",disallowedTools:"Disallowed",permissionMode:"Permission",maxTurns:"Max turns",memory:"Memory",background:"Background",effort:"Effort",isolation:"Isolation",mcpServers:"MCP servers",hooks:"Hooks"},skillBaseFields:{whenToUse:"When to use",argumentHint:"Argument hint",arguments:"Arguments",allowedTools:"Allowed tools",disallowedTools:"Disallowed tools",model:"Model",effort:"Effort",context:"Context",agent:"Agent",shell:"Shell",paths:"Paths",disableModelInvocation:"Model invocation",userInvocable:"User invocable"}};var PZ=(t,i)=>i.name,MZ=(t,i)=>i.event;function kZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){let e=_(3);d(),C(e.texts.fields.model),d(3),C(i)}}function DZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd"),v(3),h()),t&2){let e=_(3);d(),C(e.texts.fields.effort),d(2),C(i)}}function OZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){let e=_(3);d(),C(e.texts.fields.permissionMode),d(3),C(i)}}function NZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd"),v(3),h()),t&2){let e=_(3);d(),C(e.texts.fields.maxTurns),d(2),C(e.maxTurns())}}function RZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){let e=_(3);d(),C(e.texts.fields.memory),d(3),C(i)}}function AZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4,"true"),h()()),t&2){let e=_(3);d(),C(e.texts.fields.background)}}function FZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){let e=_(3);d(),C(e.texts.fields.isolation),d(3),C(i)}}function LZ(t,i){if(t&1&&(p(0,"section",1)(1,"h3",4),v(2),h(),p(3,"dl",5),T(4,kZ,5,2),T(5,DZ,4,2),T(6,OZ,5,2),T(7,NZ,4,2),T(8,RZ,5,2),T(9,AZ,5,1),T(10,FZ,5,2),h()()),t&2){let e,n,o,r,a,s=_(2);d(2),C(s.texts.sections.behavior),d(2),I((e=s.model())?4:-1,e),d(),I((n=s.effort())?5:-1,n),d(),I((o=s.permissionMode())?6:-1,o),d(),I(s.maxTurns()!==null?7:-1),d(),I((r=s.memory())?8:-1,r),d(),I(s.background()?9:-1),d(),I((a=s.isolation())?10:-1,a)}}function zZ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function BZ(t,i){if(t&1&&(p(0,"code"),v(1),h(),T(2,zZ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(),C(e),d(),I(n!==o-1?2:-1)}}function qZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,BZ,3,2,null,null,Ce),h()),t&2){let e=_(4);d(),C(e.texts.fields.tools),d(2),X(e.tools())}}function GZ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function HZ(t,i){if(t&1&&(p(0,"span",9),R(1,"i",10),p(2,"code"),v(3),h()(),T(4,GZ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(3),C(e),d(),I(n!==o-1?4:-1)}}function VZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,HZ,5,2,null,null,Ce),h()),t&2){let e=_(4);d(),C(e.texts.fields.disallowedTools),d(2),X(e.disallowedTools())}}function jZ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function UZ(t,i){if(t&1){let e=se();p(0,"a",11),H("click",function(){let o=B(e).$implicit,r=_(5);return q(r.onSkillChipClick(o))})("keydown.enter",function(){let o=B(e).$implicit,r=_(5);return q(r.onSkillChipClick(o))}),R(1,"i",12),v(2),h(),T(3,jZ,2,0,"span",8)}if(t&2){let e=i.$implicit,n=i.$index,o=i.$count,r=_(5);de("vfm__link--known",r.isSkillKnown(e)),d(2),qe(" ",e," "),d(),I(n!==o-1?3:-1)}}function WZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,UZ,4,4,null,null,Ce),h()),t&2){let e=_(4);d(),C(e.texts.fields.skills),d(2),X(e.skills())}}function $Z(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function KZ(t,i){if(t&1&&(p(0,"code",13),v(1),h(),T(2,$Z,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;M("pTooltip",e.command??""),d(),C(e.name),d(),I(n!==o-1?2:-1)}}function YZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,KZ,3,3,null,null,PZ),h()),t&2){let e=_(4);d(),C(e.texts.fields.mcpServers),d(2),X(e.mcpServers())}}function XZ(t,i){if(t&1&&(p(0,"span",15),v(1,"\u2192"),h(),p(2,"code"),v(3),h()),t&2){let e=_().$implicit;d(3),C(e.keys[0])}}function ZZ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function QZ(t,i){if(t&1&&(p(0,"span",14)(1,"code"),v(2),h(),T(3,XZ,4,1),h(),T(4,ZZ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(2),C(e.event),d(),I(e.keys.length?3:-1),d(),I(n!==o-1?4:-1)}}function JZ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,QZ,5,3,null,null,MZ),h()),t&2){let e=_(4);d(),C(e.texts.fields.hooks),d(2),X(e.hooks())}}function eQ(t,i){if(t&1&&(p(0,"dl",5),T(1,qZ,5,1),T(2,VZ,5,1),T(3,WZ,5,1),T(4,YZ,5,1),T(5,JZ,5,1),h()),t&2){let e=_(3);d(),I(e.tools().length?1:-1),d(),I(e.disallowedTools().length?2:-1),d(),I(e.skills().length?3:-1),d(),I(e.mcpServers().length?4:-1),d(),I(e.hooks().length?5:-1)}}function tQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd"),v(3),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.whenToUse),d(2),C(e.when_to_use)}}function nQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.argumentHint),d(3),C(e.argumentHint)}}function iQ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function oQ(t,i){if(t&1&&(p(0,"code"),v(1),h(),T(2,iQ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(),C(e),d(),I(n!==o-1?2:-1)}}function rQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,oQ,3,2,null,null,Ce),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.arguments),d(2),X(e.arguments)}}function aQ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function sQ(t,i){if(t&1&&(p(0,"code"),v(1),h(),T(2,aQ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(),C(e),d(),I(n!==o-1?2:-1)}}function cQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,sQ,3,2,null,null,Ce),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.allowedTools),d(2),X(e.allowedTools)}}function dQ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function lQ(t,i){if(t&1&&(p(0,"span",9),R(1,"i",10),p(2,"code"),v(3),h()(),T(4,dQ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(3),C(e),d(),I(n!==o-1?4:-1)}}function uQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,lQ,5,2,null,null,Ce),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.disallowedTools),d(2),X(e.disallowedTools)}}function fQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.model),d(3),C(e.model)}}function pQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd"),v(3),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.effort),d(2),C(e.effort)}}function hQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.context),d(3),C(e.context)}}function mQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.agent),d(3),C(e.agent)}}function _Q(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.shell),d(3),C(e.shell)}}function gQ(t,i){t&1&&(p(0,"span",8),v(1,"\xB7"),h())}function vQ(t,i){if(t&1&&(p(0,"code"),v(1),h(),T(2,gQ,2,0,"span",8)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;d(),C(e),d(),I(n!==o-1?2:-1)}}function yQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd",7),Y(3,vQ,3,2,null,null,Ce),h()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.paths),d(2),X(e.paths)}}function CQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4,"disabled"),h()()),t&2){let e=_(4);d(),C(e.texts.skillBaseFields.disableModelInvocation)}}function xQ(t,i){if(t&1&&(p(0,"dt"),v(1),h(),p(2,"dd")(3,"code"),v(4),h()()),t&2){_();let e=oe(0),n=_(3);d(),C(n.texts.skillBaseFields.userInvocable),d(3),C(e.userInvocable)}}function bQ(t,i){if(t&1&&(lt(0),p(1,"dl",6),T(2,tQ,4,2),T(3,nQ,5,2),T(4,rQ,5,1),T(5,cQ,5,1),T(6,uQ,5,1),T(7,fQ,5,2),T(8,pQ,4,2),T(9,hQ,5,2),T(10,mQ,5,2),T(11,_Q,5,2),T(12,yQ,5,1),T(13,CQ,5,1),T(14,xQ,5,2),h()),t&2){let e=Xe(_(3).skillBase());d(2),I(e.when_to_use!==null?2:-1),d(),I(e.argumentHint!==null?3:-1),d(),I(e.arguments.length?4:-1),d(),I(e.allowedTools.length?5:-1),d(),I(e.disallowedTools.length?6:-1),d(),I(e.model!==null?7:-1),d(),I(e.effort!==null?8:-1),d(),I(e.context!==null?9:-1),d(),I(e.agent!==null?10:-1),d(),I(e.shell!==null?11:-1),d(),I(e.paths.length?12:-1),d(),I(e.disableModelInvocation?13:-1),d(),I(e.userInvocable!==null?14:-1)}}function wQ(t,i){if(t&1&&(p(0,"section",2)(1,"h3",4),v(2),h(),T(3,eQ,6,5,"dl",5)(4,bQ,15,14,"dl",6),h()),t&2){let e=_(2);d(2),C(e.texts.sections.capabilities),d(),I(e.isAgent()?3:e.isSkillOrCommand()?4:-1)}}function SQ(t,i){if(t&1&&(p(0,"section",3)(1,"h3",4),v(2),h(),p(3,"blockquote",16),v(4),h()()),t&2){let e=_(2);d(2),C(e.texts.sections.initialPrompt),d(2),C(e.initialPrompt())}}function TQ(t,i){if(t&1&&(p(0,"div",0),T(1,LZ,11,8,"section",1),T(2,wQ,5,2,"section",2),T(3,SQ,5,2,"section",3),h()),t&2){let e=_();d(),I(e.hasBehavior()?1:-1),d(),I(e.hasCapabilities()?2:-1),d(),I(e.hasInitialPrompt()?3:-1)}}var fM=(()=>{class t{frontmatter=O.required();kind=O.required();provider=O(void 0);knownPaths=O(null);onSkillClick=O(null);texts=uM;hasVendorSurface=S(()=>{let e=this.kind();return e==="agent"||e==="skill"||e==="command"});isAgent=S(()=>this.kind()==="agent");isSkillOrCommand=S(()=>{let e=this.kind();return e==="skill"||e==="command"});tools=S(()=>hp(this.fm().tools));model=S(()=>mt(this.fm().model));skills=S(()=>hp(this.fm().skills));disallowedTools=S(()=>hp(this.fm().disallowedTools));initialPrompt=S(()=>mt(this.fm().initialPrompt));permissionMode=S(()=>mt(this.fm().permissionMode));maxTurns=S(()=>IQ(this.fm().maxTurns));memory=S(()=>mt(this.fm().memory));background=S(()=>this.fm().background===!0);effort=S(()=>mt(this.fm().effort));isolation=S(()=>mt(this.fm().isolation));mcpServers=S(()=>{let e=this.fm().mcpServers;return Array.isArray(e)?e.filter(n=>typeof n=="object"&&n!==null).map((n,o)=>{let r=n.args,a=Array.isArray(r)?r.length:0;return{name:typeof n.name=="string"&&n.name.length>0?n.name:`mcpServer[${o}]`,command:typeof n.command=="string"?n.command:null,argsCount:a}}):[]});hooks=S(()=>{let e=this.fm().hooks;if(typeof e!="object"||e===null)return[];let n=[];for(let[o,r]of Object.entries(e)){let a=typeof r=="object"&&r!==null?Object.keys(r):[];n.push({event:o,keys:a})}return n});skillBase=S(()=>{let e=this.fm();return{when_to_use:mt(e.when_to_use),argumentHint:mt(e["argument-hint"]),arguments:pp(e.arguments),disableModelInvocation:e["disable-model-invocation"]===!0,userInvocable:typeof e["user-invocable"]=="boolean"?e["user-invocable"]:null,allowedTools:pp(e["allowed-tools"]),disallowedTools:pp(e["disallowed-tools"]),model:mt(e.model),effort:mt(e.effort),context:mt(e.context),agent:mt(e.agent),paths:pp(e.paths),shell:mt(e.shell)}});hasBehavior=S(()=>this.isAgent()?this.model()!==null||this.permissionMode()!==null||this.maxTurns()!==null||this.memory()!==null||this.background()||this.effort()!==null||this.isolation()!==null:!1);hasCapabilities=S(()=>{if(this.isAgent())return this.tools().length>0||this.disallowedTools().length>0||this.skills().length>0||this.mcpServers().length>0||this.hooks().length>0;if(this.isSkillOrCommand()){let e=this.skillBase();return e.when_to_use!==null||e.argumentHint!==null||e.arguments.length>0||e.allowedTools.length>0||e.disallowedTools.length>0||e.model!==null||e.effort!==null||e.context!==null||e.agent!==null||e.shell!==null||e.paths.length>0||e.disableModelInvocation||e.userInvocable!==null}return!1});hasInitialPrompt=S(()=>this.isAgent()&&this.initialPrompt()!==null);hasAnyContent=S(()=>this.hasVendorSurface()&&(this.hasBehavior()||this.hasCapabilities()||this.hasInitialPrompt()));onSkillChipClick(e){let n=this.onSkillClick();n&&n(e)}isSkillKnown(e){let n=this.knownPaths();return n?n.has(e):!1}fm(){return this.frontmatter()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-vendor-frontmatter"]],inputs:{frontmatter:[1,"frontmatter"],kind:[1,"kind"],provider:[1,"provider"],knownPaths:[1,"knownPaths"],onSkillClick:[1,"onSkillClick"]},decls:1,vars:1,consts:[["data-testid","vendor-frontmatter",1,"vfm"],["data-testid","vendor-frontmatter-behavior",1,"sm-block"],["data-testid","vendor-frontmatter-capabilities",1,"sm-block"],["data-testid","vendor-frontmatter-initial-prompt",1,"sm-block"],[1,"sm-block__title"],[1,"sm-block__kv"],["data-testid","vendor-frontmatter-skill-base",1,"sm-block__kv"],[1,"vfm__inline"],["aria-hidden","true",1,"vfm__sep"],[1,"vfm__danger"],["aria-hidden","true",1,"pi","pi-ban"],["role","button","tabindex","0",1,"vfm__link",3,"click","keydown.enter"],["aria-hidden","true",1,"pi","pi-arrow-up-right"],[3,"pTooltip"],[1,"vfm__hook"],["aria-hidden","true",1,"vfm__sep-arrow"],["data-testid","vendor-frontmatter-initial-prompt-quote",1,"vfm__quote"]],template:function(n,o){n&1&&T(0,TQ,4,3,"div",0),n&2&&I(o.hasAnyContent()?0:-1)},dependencies:[Oe,De],styles:["[_nghost-%COMP%]{display:block}.vfm[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.85rem}.vfm__inline[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.3rem;font-size:.83rem}.vfm__inline[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.05rem .4rem;border-radius:var(--sm-radius-sm);font-size:.78rem;color:var(--p-text-color);font-family:var(--sm-font-mono)}.vfm__sep[_ngcontent-%COMP%]{color:var(--sm-border);font-size:.75rem}.vfm__sep-arrow[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-size:.78rem;margin:0 .1rem}.vfm__danger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.25rem;color:var(--sm-severity-error)}.vfm__danger[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error)}.vfm__danger[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.7rem}.vfm__link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.25rem;color:var(--p-text-muted-color);cursor:default;text-decoration:none;font-size:.83rem}.vfm__link[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.7rem}.vfm__link--known[_ngcontent-%COMP%]{color:var(--p-primary-color);cursor:pointer}.vfm__link--known[_ngcontent-%COMP%]:hover{text-decoration:underline}.vfm__hook[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.25rem}.vfm__hook[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.05rem .4rem;border-radius:var(--sm-radius-sm);font-size:.78rem;font-family:var(--sm-font-mono)}.vfm__quote[_ngcontent-%COMP%]{margin:0;padding:.7rem .95rem;border-left:2px solid var(--sm-border);background:var(--sm-bg-hover);color:var(--p-text-color);font-style:italic;font-size:.9rem;line-height:1.55;border-radius:0 var(--sm-radius-sm) var(--sm-radius-sm) 0;white-space:pre-wrap}"],changeDetection:0})}return t})();function mt(t){return typeof t=="string"&&t.length>0?t:null}function IQ(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function hp(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function pp(t){return typeof t=="string"?t.length>0?[t]:[]:Array.isArray(t)?hp(t):[]}var pM={header:"Plugin contributions",count:t=>`${t} namespace${t===1?"":"s"}`,unregisteredBadge:"unregistered",rootContribBadge:t=>`from plugin: ${t}`,empty:"No plugin contributions on this sidecar."};var _M=(t,i)=>i.key,EQ=(t,i)=>i.pluginId;function PQ(t,i){if(t&1&&(p(0,"p",0),v(1),h()),t&2){let e=_();d(),C(e.texts.empty)}}function MQ(t,i){if(t&1&&(p(0,"span",5),v(1),h()),t&2){let e=_().$implicit,n=_(3);d(),C(n.texts.rootContribBadge(e.pluginId))}}function kQ(t,i){if(t&1&&(p(0,"div",3)(1,"code",4),v(2),h(),T(3,MQ,2,1,"span",5),p(4,"pre",6),v(5),h()()),t&2){let e=i.$implicit;d(2),C(e.key),d(),I(e.pluginId!==null?3:-1),d(2),C(e.value)}}function DQ(t,i){if(t&1&&(p(0,"div",1),Y(1,kQ,6,3,"div",3,_M),h()),t&2){let e=_(2);d(),X(e.rootContributions())}}function OQ(t,i){if(t&1&&(p(0,"span",10),v(1),h()),t&2){let e=_(4);d(),C(e.texts.unregisteredBadge)}}function NQ(t,i){if(t&1&&(p(0,"dt",12),v(1),h(),p(2,"dd")(3,"pre"),v(4),h()()),t&2){let e=i.$implicit;M("pTooltip",e.description??""),d(),C(e.key),d(3),C(e.value)}}function RQ(t,i){if(t&1&&(p(0,"section",7)(1,"h5",8)(2,"span",9),v(3),h(),T(4,OQ,2,1,"span",10),h(),p(5,"dl",11),Y(6,NQ,5,3,null,null,_M),h()()),t&2){let e=i.$implicit;G("data-testid","plugin-contributions-ns-"+e.pluginId),d(3),C(e.pluginId),d(),I(e.registered?-1:4),d(2),X(e.rows)}}function AQ(t,i){if(t&1&&(p(0,"div",2),Y(1,RQ,8,3,"section",7,EQ),h()),t&2){let e=_(2);d(),X(e.namespaces())}}function FQ(t,i){if(t&1&&(T(0,DQ,3,0,"div",1),T(1,AQ,3,0,"div",2)),t&2){let e=_();I(e.rootContributions().length?0:-1),d(),I(e.namespaces().length?1:-1)}}var hM=new Set(["identity","annotations","settings","audit"]),gM=(()=>{class t{dataSource=u(ln);sidecarRoot=O(void 0);texts=pM;catalog=z(null);constructor(){this.fetchCatalog()}namespaces=S(()=>{let e=this.sidecarRoot();if(!e)return[];let n=this.catalog(),o=new Map;if(n)for(let a of n){if(a.location!=="namespaced")continue;let s=o.get(a.pluginId);s?s.push(a):o.set(a.pluginId,[a])}let r=[];for(let[a,s]of Object.entries(e)){if(hM.has(a)||this.isRegisteredRootKey(a))continue;let l=typeof s=="object"&&s!==null&&!Array.isArray(s)?s:{value:s},f=o.has(a),m=o.get(a)??[],x=Object.entries(l).map(([P,E])=>({key:P,value:mM(E),description:f?LQ(m,P):null}));r.push({pluginId:a,registered:f,rows:x})}return r});rootContributions=S(()=>{let e=this.sidecarRoot();if(!e)return[];let n=this.catalog();if(!n)return[];let o=new Map;for(let a of n)a.location==="root"&&o.set(a.key,a);let r=[];for(let[a,s]of Object.entries(e)){if(hM.has(a))continue;let c=o.get(a);c&&r.push({key:a,pluginId:c.pluginId,value:mM(s)})}return r});count=S(()=>this.namespaces().length+this.rootContributions().length);isEmpty=S(()=>this.count()===0);isRegisteredRootKey(e){let n=this.catalog();return n?n.some(o=>o.location==="root"&&o.key===e):!1}async fetchCatalog(){try{let e=await this.dataSource.getRegisteredAnnotations();this.catalog.set(e)}catch{this.catalog.set([])}}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-plugin-contributions"]],inputs:{sidecarRoot:[1,"sidecarRoot"]},decls:2,vars:1,consts:[["data-testid","plugin-contributions-empty",1,"pcp__empty"],["data-testid","plugin-contributions-roots",1,"pcp__roots"],[1,"pcp__namespaces"],[1,"pcp__root-row"],[1,"pcp__root-key"],[1,"pcp__root-badge"],[1,"pcp__root-value"],[1,"pcp__ns"],[1,"pcp__ns-header"],[1,"pcp__ns-name"],["data-testid","plugin-contributions-unregistered-badge",1,"pcp__ns-badge"],[1,"pcp__kv"],[3,"pTooltip"]],template:function(n,o){n&1&&T(0,PQ,2,1,"p",0)(1,FQ,2,2),n&2&&I(o.isEmpty()?0:1)},dependencies:[Oe,De],styles:["[_nghost-%COMP%]{display:block}.pcp__empty[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--sm-text-muted);font-style:italic}.pcp__roots[_ngcontent-%COMP%], .pcp__namespaces[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.6rem}.pcp__root-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;font-size:.85rem}.pcp__root-key[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);font-weight:600}.pcp__root-badge[_ngcontent-%COMP%]{font-size:.7rem;color:var(--sm-text-muted);font-style:italic;background:var(--sm-bg-hover);padding:.05rem .35rem;border-radius:var(--sm-radius-sm)}.pcp__root-value[_ngcontent-%COMP%]{flex:1 1 100%;margin:.2rem 0 0;padding:.45rem .6rem;background:var(--sm-bg-hover);border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.8rem;white-space:pre-wrap;word-break:break-word}.pcp__ns[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.pcp__ns[_ngcontent-%COMP%] + .pcp__ns[_ngcontent-%COMP%]{border-top:1px solid var(--sm-border);padding-top:.5rem}.pcp__ns-header[_ngcontent-%COMP%]{margin:0;display:inline-flex;align-items:center;gap:.5rem;font-size:.85rem;font-weight:600}.pcp__ns-name[_ngcontent-%COMP%]{font-family:var(--sm-font-mono)}.pcp__ns-badge[_ngcontent-%COMP%]{font-size:.65rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--sm-text-muted);background:var(--sm-bg-hover);padding:.05rem .4rem;border-radius:var(--sm-radius-sm)}.pcp__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.85rem}.pcp__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500;font-family:var(--sm-font-mono);cursor:help}.pcp__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.pcp__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:0;font-family:var(--sm-font-mono);font-size:.8rem;white-space:pre-wrap;word-break:break-word}"],changeDetection:0})}return t})();function mM(t){if(t===null)return"null";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function LQ(t,i){for(let e of t)if(e.key===i){let n=e.schema.description;return typeof n=="string"&&n.length>0?n:null}return null}var vM=(()=>{class t{node=O(null);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-inspector-slots-panel"]],inputs:{node:[1,"node"]},decls:6,vars:6,consts:[["slot","inspector.body.panel.breakdown",3,"node"],["slot","inspector.body.panel.records",3,"node"],["slot","inspector.body.panel.tree",3,"node"],["slot","inspector.body.panel.key-values",3,"node"],["slot","inspector.body.panel.link-list",3,"node"],["slot","inspector.body.panel.markdown",3,"node"]],template:function(n,o){n&1&&R(0,"sm-view-contributions-host",0)(1,"sm-view-contributions-host",1)(2,"sm-view-contributions-host",2)(3,"sm-view-contributions-host",3)(4,"sm-view-contributions-host",4)(5,"sm-view-contributions-host",5),n&2&&(M("node",o.node()),d(),M("node",o.node()),d(),M("node",o.node()),d(),M("node",o.node()),d(),M("node",o.node()),d(),M("node",o.node()))},dependencies:[gn],encapsulation:2,changeDetection:0})}return t})();var yM={header:"Debug",toggleAriaLabel:"Toggle debug panel",fields:{forPath:"for.path",bodyHashStored:"for.bodyHash (stored)",bodyHashLive:"node.bodyHash (live)",frontmatterHashStored:"for.frontmatterHash (stored)",frontmatterHashLive:"node.frontmatterHash (live)",resolvedProvider:"for.resolvedAs.provider",resolvedKind:"for.resolvedAs.kind",sidecarStatus:"sidecar.status",sidecarPresent:"sidecar.present"},diffMarker:"!=",absentMarker:"(absent)",notSetMarker:"(not set)"};function zQ(t,i){t&1&&(W(0,"code"),v(1),$()),t&2&&(d(),C(i))}function BQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}function qQ(t,i){if(t&1&&(W(0,"code"),v(1),$()),t&2){let e=_();de("dbg__diff",e.bodyHashDrift()),d(),C(i)}}function GQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}function HQ(t,i){if(t&1&&(W(0,"code"),v(1),$()),t&2){let e=_();de("dbg__diff",e.bodyHashDrift()),d(),C(i)}}function VQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}function jQ(t,i){if(t&1&&(W(0,"code"),v(1),$()),t&2){let e=_();de("dbg__diff",e.frontmatterHashDrift()),d(),C(i)}}function UQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}function WQ(t,i){if(t&1&&(W(0,"code"),v(1),$()),t&2){let e=_();de("dbg__diff",e.frontmatterHashDrift()),d(),C(i)}}function $Q(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}function KQ(t,i){t&1&&(W(0,"code"),v(1),$()),t&2&&(d(),C(i))}function YQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.notSetMarker)}}function XQ(t,i){t&1&&(W(0,"code"),v(1),$()),t&2&&(d(),C(i))}function ZQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.notSetMarker)}}function QQ(t,i){t&1&&(W(0,"code"),v(1),$()),t&2&&(d(),C(i))}function JQ(t,i){if(t&1&&(W(0,"span",2),v(1),$()),t&2){let e=_();d(),C(e.texts.absentMarker)}}var CM=(()=>{class t{node=O.required();sidecarRoot=O(null);overlay=O(void 0);texts=yM;identityBlock=S(()=>{let e=this.sidecarRoot(),n={path:null,bodyHash:null,frontmatterHash:null,resolvedProvider:null,resolvedKind:null};if(!e)return n;let o=e.identity;if(typeof o!="object"||o===null)return n;let r=o,a=typeof r.resolvedAs=="object"&&r.resolvedAs!==null?r.resolvedAs:null;return{path:typeof r.path=="string"?r.path:null,bodyHash:typeof r.bodyHash=="string"?r.bodyHash:null,frontmatterHash:typeof r.frontmatterHash=="string"?r.frontmatterHash:null,resolvedProvider:a&&typeof a.provider=="string"?a.provider:null,resolvedKind:a&&typeof a.kind=="string"?a.kind:null}});bodyHashLive=S(()=>this.node().bodyHash??null);frontmatterHashLive=S(()=>this.node().frontmatterHash??null);bodyHashDrift=S(()=>{let e=this.identityBlock().bodyHash,n=this.bodyHashLive();return e!==null&&n!==null&&e!==n});frontmatterHashDrift=S(()=>{let e=this.identityBlock().frontmatterHash,n=this.frontmatterHashLive();return e!==null&&n!==null&&e!==n});sidecarStatusLiteral=S(()=>{let e=this.overlay();if(!e)return null;let n=e.status??null;return n===null?null:String(n)});sidecarPresent=S(()=>this.overlay()?.present===!0);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-inspector-debug-panel"]],inputs:{node:[1,"node"],sidecarRoot:[1,"sidecarRoot"],overlay:[1,"overlay"]},decls:46,vars:18,consts:[["data-testid","inspector-debug-panel",1,"dbg__kv"],["data-testid","dbg-for-path"],[1,"dbg__absent"],["data-testid","dbg-body-hash-stored"],[3,"dbg__diff"],["data-testid","dbg-body-hash-live"],["data-testid","dbg-fm-hash-stored"],["data-testid","dbg-fm-hash-live"],["data-testid","dbg-resolved-provider"],["data-testid","dbg-resolved-kind"],["data-testid","dbg-sidecar-status"],["data-testid","dbg-sidecar-present"]],template:function(n,o){if(n&1&&(W(0,"dl",0)(1,"dt"),v(2),$(),W(3,"dd",1),T(4,zQ,2,1,"code")(5,BQ,2,1,"span",2),$(),W(6,"dt"),v(7),$(),W(8,"dd",3),T(9,qQ,2,3,"code",4)(10,GQ,2,1,"span",2),$(),W(11,"dt"),v(12),$(),W(13,"dd",5),T(14,HQ,2,3,"code",4)(15,VQ,2,1,"span",2),$(),W(16,"dt"),v(17),$(),W(18,"dd",6),T(19,jQ,2,3,"code",4)(20,UQ,2,1,"span",2),$(),W(21,"dt"),v(22),$(),W(23,"dd",7),T(24,WQ,2,3,"code",4)(25,$Q,2,1,"span",2),$(),W(26,"dt"),v(27),$(),W(28,"dd",8),T(29,KQ,2,1,"code")(30,YQ,2,1,"span",2),$(),W(31,"dt"),v(32),$(),W(33,"dd",9),T(34,XQ,2,1,"code")(35,ZQ,2,1,"span",2),$(),W(36,"dt"),v(37),$(),W(38,"dd",10),T(39,QQ,2,1,"code")(40,JQ,2,1,"span",2),$(),W(41,"dt"),v(42),$(),W(43,"dd",11)(44,"code"),v(45),$()()()),n&2){let r,a,s,c,l,f,m,x;d(2),C(o.texts.fields.forPath),d(2),I((r=o.identityBlock().path)?4:5,r),d(3),C(o.texts.fields.bodyHashStored),d(2),I((a=o.identityBlock().bodyHash)?9:10,a),d(3),C(o.texts.fields.bodyHashLive),d(2),I((s=o.bodyHashLive())?14:15,s),d(3),C(o.texts.fields.frontmatterHashStored),d(2),I((c=o.identityBlock().frontmatterHash)?19:20,c),d(3),C(o.texts.fields.frontmatterHashLive),d(2),I((l=o.frontmatterHashLive())?24:25,l),d(3),C(o.texts.fields.resolvedProvider),d(2),I((f=o.identityBlock().resolvedProvider)?29:30,f),d(3),C(o.texts.fields.resolvedKind),d(2),I((m=o.identityBlock().resolvedKind)?34:35,m),d(3),C(o.texts.fields.sidecarStatus),d(2),I((x=o.sidecarStatusLiteral())?39:40,x),d(3),C(o.texts.fields.sidecarPresent),d(3),C(o.sidecarPresent())}},styles:["[_nghost-%COMP%]{display:block}.dbg__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.8rem}.dbg__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-family:var(--sm-font-mono);font-weight:500}.dbg__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0}.dbg__kv[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem;background:var(--sm-bg-hover);padding:.05rem .3rem;border-radius:var(--sm-radius-sm);word-break:break-all}.dbg__diff[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error)}.dbg__absent[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem;color:var(--sm-text-muted);font-style:italic}"],changeDetection:0})}return t})();function eJ(t,i){if(t&1&&(W(0,"span",3),v(1),W(2,"code"),v(3),$()()),t&2){_(2);let e=oe(0),n=_();d(),qe(" ",n.texts.fields.lastBumpedBy," "),d(2),C(e.lastBumpedBy)}}function tJ(t,i){if(t&1&&(W(0,"dt"),v(1),$(),W(2,"dd")(3,"span",2),v(4),$(),T(5,eJ,4,2,"span",3),$()),t&2){_();let e=oe(0),n=_();d(),C(n.texts.fields.lastBumpedAt),d(2),Tp("title",e.lastBumpedAt),d(),C(n.lastBumpedRel()),d(),I(e.lastBumpedBy!==null?5:-1)}}function nJ(t,i){if(t&1&&(W(0,"span",3),v(1),W(2,"code"),v(3),$()()),t&2){_(2);let e=oe(0),n=_();d(),qe(" ",n.texts.fields.createdBy," "),d(2),C(e.createdBy)}}function iJ(t,i){if(t&1&&(W(0,"dt"),v(1),$(),W(2,"dd")(3,"span",2),v(4),$(),T(5,nJ,4,2,"span",3),$()),t&2){_();let e=oe(0),n=_();d(),C(n.texts.fields.createdAt),d(2),Tp("title",e.createdAt),d(),C(n.createdRel()),d(),I(e.createdBy!==null?5:-1)}}function oJ(t,i){if(t&1&&(lt(0),W(1,"dl",0),T(2,tJ,6,4),T(3,iJ,6,4),$()),t&2){let e=Xe(_().audit());d(2),I(e.lastBumpedAt!==null?2:-1),d(),I(e.createdAt!==null?3:-1)}}function rJ(t,i){if(t&1&&(W(0,"p",1),v(1),$()),t&2){let e=_();d(),C(e.texts.headerEmpty)}}var xM=(()=>{class t{sidecarRoot=O(null);texts=Bn.audit;audit=S(()=>{let e=this.sidecarRoot(),n={lastBumpedAt:null,lastBumpedBy:null,createdAt:null,createdBy:null};if(!e)return n;let o=e.audit;if(typeof o!="object"||o===null)return n;let r=o;return{lastBumpedAt:mp(r.lastBumpedAt),lastBumpedBy:mp(r.lastBumpedBy),createdAt:mp(r.createdAt),createdBy:mp(r.createdBy)}});hasContent=S(()=>{let e=this.audit();return e.lastBumpedAt!==null||e.lastBumpedBy!==null||e.createdAt!==null||e.createdBy!==null});lastBumpedRel=S(()=>{let e=this.audit().lastBumpedAt;return e===null?null:Co(e)});createdRel=S(()=>{let e=this.audit().createdAt;return e===null?null:Co(e)});static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-inspector-audit-panel"]],inputs:{sidecarRoot:[1,"sidecarRoot"]},decls:2,vars:1,consts:[["data-testid","inspector-audit-panel",1,"audit__kv"],["data-testid","inspector-audit-panel-empty",1,"audit__empty"],[3,"title"],[1,"audit__by"]],template:function(n,o){n&1&&T(0,oJ,4,3,"dl",0)(1,rJ,2,1,"p",1),n&2&&I(o.hasContent()?0:1)},styles:["[_nghost-%COMP%]{display:block}.audit__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.85rem}.audit__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500}.audit__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0}.audit__by[_ngcontent-%COMP%]{color:var(--sm-text-muted)}.audit__by[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem}.audit__empty[_ngcontent-%COMP%]{margin:0;font-style:italic;color:var(--sm-text-muted);font-size:.85rem}"],changeDetection:0})}return t})();function mp(t){return typeof t=="string"&&t.length>0?t:null}function aJ(t,i){if(t&1&&(p(0,"span",7),R(1,"i",19),v(2),h()),t&2){let e=_();M("pTooltip",e.texts.header.invalidFrontmatterTooltip),d(2),qe(" ",e.texts.header.invalidFrontmatter," ")}}function sJ(t,i){t&1&&(p(0,"span",8),v(1),h()),t&2&&(d(),C(i))}function cJ(t,i){if(t&1&&(p(0,"span",9)(1,"span",20),v(2,"\u25CF"),h(),v(3),h()),t&2){let e=i,n=_();M("pTooltip",e==="experimental"?n.cardTexts.stability.experimental:e==="deprecated"?n.cardTexts.stability.deprecated:""),G("data-stability",e),d(3),qe(" ",e," ")}}function dJ(t,i){if(t&1&&(p(0,"span",14),R(1,"i",21),h()),t&2){let e=_();M("pTooltip",e.headerStaleTooltip())}}function lJ(t,i){if(t&1&&(p(0,"div",17)(1,"span",22),v(2),h(),p(3,"button",23),R(4,"i",24),p(5,"span"),v(6),h()(),p(7,"button",25),R(8,"i",26),p(9,"span"),v(10),h()(),p(11,"button",27),R(12,"i",28),p(13,"span"),v(14),h()()()),t&2){let e=_();d(2),C(e.texts.actionMocks.label),d(4),C(e.texts.actionMocks.summary),d(4),C(e.texts.actionMocks.audit),d(4),C(e.texts.actionMocks.validate)}}function uJ(t,i){if(t&1&&(p(0,"span",29),v(1),h()),t&2){let e=i.$implicit;d(),C(e)}}function fJ(t,i){if(t&1&&(p(0,"div",18),Y(1,uJ,2,1,"span",29,Ce),h()),t&2){let e=_();d(),X(e.headerTools())}}var pJ=new Set(["red","orange","yellow","green","cyan","blue","purple","pink"]),bM=(()=>{class t{node=O.required();showActionMocks=O(!1);frontmatterInvalid=O(!1);favoriteToggle=Ve();texts=Bn;cardTexts=$n;headerName=S(()=>{let e=this.node(),n=e.frontmatter.name;return typeof n=="string"&&n.trim().length>0?n:e.path.split("/").pop()??e.path});headerVersion=S(()=>la(this.node()));headerStability=S(()=>ua(this.node()));headerTitleColor=S(()=>{let e=this.node(),o=e.frontmatter.color;return typeof o=="string"&&pJ.has(o)?o:`var(--sm-kind-${e.kind})`});headerTools=S(()=>wg(this.node()));headerIsStale=S(()=>Sg(this.node()));headerStaleTooltip=S(()=>Ig(this.node(),$n.sidecar));onFavoriteClick(e){e.stopPropagation(),this.favoriteToggle.emit(this.node().path)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-inspector-header"]],inputs:{node:[1,"node"],showActionMocks:[1,"showActionMocks"],frontmatterInvalid:[1,"frontmatterInvalid"]},outputs:{favoriteToggle:"favoriteToggle"},decls:22,vars:22,consts:[["data-testid","inspector-title",1,"inspector__header"],["data-testid","inspector-kind-chip",1,"inspector__kind-eyebrow"],["aria-hidden","true",1,"inspector__icon-box"],[3,"kind","provider","size"],[1,"inspector__content"],[1,"inspector__name-row"],["data-testid","inspector-title-text",1,"inspector__name"],["data-testid","inspector-fm-invalid",1,"inspector__fm-invalid",3,"pTooltip"],["data-testid","inspector-version",1,"inspector__name-version"],["data-testid","inspector-stability-tag",1,"inspector__stability",3,"pTooltip"],["data-testid","inspector-path",1,"inspector__path-code"],[1,"inspector__actions-cluster"],["type","button","data-testid","inspector-favorite",1,"inspector__favorite",3,"click","pTooltip"],["aria-hidden","true",1,"pi"],["data-testid","inspector-stale-badge",1,"inspector__stale-icon",3,"pTooltip"],["slot","inspector.header.badge.counter",3,"node"],["slot","inspector.header.badge.tag",3,"node"],["data-testid","inspector-plugin-actions",1,"inspector__plugin-actions"],["data-testid","inspector-header-tools",1,"inspector__tools"],["aria-hidden","true",1,"pi","pi-exclamation-triangle"],["aria-hidden","true",1,"inspector__stability-dot"],["aria-hidden","true",1,"pi","pi-clock"],[1,"inspector__plugin-actions-label"],["type","button","data-testid","inspector-plugin-btn-summary",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-sparkles"],["type","button","data-testid","inspector-plugin-btn-audit",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-search"],["type","button","data-testid","inspector-plugin-btn-validate",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-check-circle"],[1,"inspector__tool-tag"]],template:function(n,o){if(n&1&&(p(0,"header",0)(1,"span",1),v(2),h(),p(3,"div",2),R(4,"sm-kind-icon",3),h(),p(5,"div",4)(6,"div",5)(7,"h2",6),v(8),h(),T(9,aJ,3,2,"span",7),T(10,sJ,2,1,"span",8),T(11,cJ,4,3,"span",9),h(),p(12,"code",10),v(13),h()(),p(14,"div",11)(15,"button",12),H("click",function(a){return o.onFavoriteClick(a)}),R(16,"i",13),h(),T(17,dJ,2,1,"span",14),R(18,"sm-view-contributions-host",15)(19,"sm-view-contributions-host",16),h(),T(20,lJ,15,4,"div",17),T(21,fJ,3,0,"div",18),h()),n&2){let r,a,s=o.node();d(2),C(s.kind),d(2),M("kind",s.kind)("provider",s.provider)("size",18),d(4),C(o.headerName()),d(),I(o.frontmatterInvalid()?9:-1),d(),I((r=o.headerVersion())?10:-1,r),d(),I((a=o.headerStability())?11:-1,a),d(2),C(s.path),d(2),de("inspector__favorite--on",s.isFavorite===!0),M("pTooltip",s.isFavorite===!0?o.cardTexts.favoriteRemoveTooltip:o.cardTexts.favoriteAddTooltip),G("aria-label",s.isFavorite===!0?o.cardTexts.ariaFavoriteRemove:o.cardTexts.ariaFavoriteAdd),d(),de("pi-star-fill",s.isFavorite===!0)("pi-star",s.isFavorite!==!0),d(),I(o.headerIsStale()?17:-1),d(),M("node",s),d(),M("node",s),d(),I(o.showActionMocks()?20:-1),d(),I(o.headerTools().length>0?21:-1)}},dependencies:[Oe,De,uo,gn],styles:["[_nghost-%COMP%]{display:block}.inspector__header[_ngcontent-%COMP%]{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:.75rem;row-gap:.3rem;align-items:start;padding:0 0 .85rem .85rem;background:color-mix(in srgb,var(--accent) 10%,transparent);color:var(--p-text-color);border-left:3px solid var(--accent);border-bottom:1px solid var(--sm-border)}.inspector__kind-eyebrow[_ngcontent-%COMP%]{grid-column:1 / -1;grid-row:1;font-size:.78rem;font-weight:600;color:var(--accent);text-transform:lowercase;line-height:1.2}.inspector__icon-box[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:var(--sm-radius-md);display:flex;align-items:center;justify-content:center;background:var(--accent);color:var(--sm-accent-fg);flex:none;font-size:1.05rem;grid-column:1;grid-row:2;align-self:start}.inspector__content[_ngcontent-%COMP%]{min-width:0;width:100%;display:flex;flex-direction:column;gap:.18rem}.inspector__name-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:baseline;gap:.5rem;min-width:0}.inspector__name[_ngcontent-%COMP%]{margin:0;font-size:1.05rem;font-weight:600;line-height:1.25;letter-spacing:-.01em;word-break:break-word;color:var(--p-text-color)}.inspector__fm-invalid[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.25rem;padding:.05rem .4rem;border-radius:var(--sm-radius-sm);font-size:.7rem;font-weight:500;text-transform:lowercase;white-space:nowrap;cursor:help;color:var(--sm-severity-warn);background:color-mix(in srgb,var(--sm-severity-warn) 12%,transparent);border:1px solid color-mix(in srgb,var(--sm-severity-warn) 35%,transparent)}.inspector__fm-invalid[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.68rem}.inspector__stability[_ngcontent-%COMP%]{font-size:.78rem;font-weight:500;text-transform:lowercase;cursor:help;white-space:nowrap}.inspector__stability-dot[_ngcontent-%COMP%]{margin-right:.25rem;font-size:.55rem;vertical-align:middle}.inspector__stability[data-stability=stable][_ngcontent-%COMP%]{color:var(--sm-severity-success)}.inspector__stability[data-stability=experimental][_ngcontent-%COMP%]{color:var(--sm-severity-info)}.inspector__stability[data-stability=deprecated][_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.inspector__path-code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.7rem;color:var(--p-text-muted-color);background:var(--sm-bg-hover);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);word-break:break-all;align-self:flex-start;max-width:100%;margin-top:.15rem}.inspector__actions-cluster[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.3rem;align-self:start}.inspector__favorite[_ngcontent-%COMP%]{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;padding:0;cursor:pointer;color:var(--p-text-muted-color);border-radius:var(--sm-radius-md);flex:none;transition:background .12s ease,color .12s ease}.inspector__favorite[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.85rem;line-height:1}.inspector__favorite[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);color:var(--p-text-color)}.inspector__favorite[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:1px}.inspector__favorite--on[_ngcontent-%COMP%]{color:var(--p-primary-color)}.inspector__stale-icon[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;color:var(--sm-severity-warn);cursor:help}.inspector__stale-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.78rem;width:1em;height:1em;line-height:1}.inspector__name-version[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.7rem;color:var(--p-text-color);background:var(--sm-bg-hover);padding:.08rem .4rem;border-radius:var(--sm-radius-sm);line-height:1.2;flex:none}.inspector__plugin-actions[_ngcontent-%COMP%]{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;margin-top:.55rem;padding-top:.5rem;border-top:1px solid var(--sm-border)}.inspector__plugin-actions-label[_ngcontent-%COMP%]{font-size:.6rem;text-transform:uppercase;letter-spacing:.05em;font-weight:600;color:var(--p-text-muted-color);margin-right:.15rem}.inspector__plugin-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.35rem;padding:.3rem .65rem;border:1px solid var(--sm-border);border-radius:var(--sm-radius-md);background:var(--sm-bg-content);color:var(--p-text-color);font-size:.78rem;font-weight:500;cursor:pointer;transition:background .12s ease,border-color .12s ease,color .12s ease;font-family:inherit}.inspector__plugin-btn[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);border-color:var(--p-text-muted-color);color:var(--p-text-color)}.inspector__plugin-btn[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.82rem}.inspector__tools[_ngcontent-%COMP%]{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:.3rem;margin-top:.55rem;padding-top:.5rem;border-top:1px solid var(--sm-border)}.inspector__tool-tag[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:.1rem .5rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);color:var(--p-text-color);font-family:var(--sm-font-mono);font-size:.7rem;font-weight:500;line-height:1.35;flex:none}"],changeDetection:0})}return t})();function W_(t){Ot(W_);let{path:i,dataSource:e,markdown:n}=t,o=z("idle"),r=z(null),a=0,s=async(l,f)=>{try{let m=await e.getNode(l,{includeBody:!0});if(f!==a)return;if(m===null){o.set("unavailable");return}let x=m.item.body;if(x===null){o.set("unavailable");return}if(x===void 0||x.trim().length===0){o.set("empty");return}let P=await n.render(x);if(f!==a)return;r.set(P),o.set("ready")}catch{if(f!==a)return;o.set("error")}};J(()=>{let l=i(),f=++a;if(r.set(null),!l){o.set("idle");return}o.set("loading"),s(l,f)});let c=()=>{let l=i();if(!l||o()==="loading")return;let f=++a;r.set(null),o.set("loading"),s(l,f)};return{bodyState:o.asReadonly(),bodyHtml:r.asReadonly(),refresh:c}}function $_(t){Ot($_);let{node:i,sidecarService:e,confirmation:n}=t,o=Bn,r=S(()=>{let E=i();if(!E)return!1;let N=E.sidecar;return!N||N.present===!1||N.status==="fresh"?!1:bg(N)}),a=z(!1),s=z(null),c=S(()=>{let N=i()?.sidecar;return!N||N.present===!1?o.bump.tooltipDisabledNoSidecar:r()?o.bump.tooltipEnabled:o.bump.tooltipDisabledFresh}),l=E=>{if(E instanceof kp)switch(E.code){case"sidecar-fresh":return`${o.bump.errorPrefix} ${o.bump.errorFresh}`;case"not-found":return`${o.bump.errorPrefix} ${o.bump.errorNotFound}`;default:return`${o.bump.errorPrefix} ${E.message||o.bump.errorGeneric}`}let N=E instanceof Error?E.message:String(E);return`${o.bump.errorPrefix} ${N||o.bump.errorGeneric}`},f=async E=>{if(!a()){a.set(!0),s.set(null);try{await e.bump(E,{confirm:!0})}catch(N){s.set(l(N))}finally{a.set(!1)}}},m=E=>{n.confirm({header:o.bump.consentHeader,message:o.bump.consentMessage,acceptLabel:o.bump.consentAccept,rejectLabel:o.bump.consentReject,acceptButtonProps:{severity:"primary"},rejectButtonProps:{severity:"secondary"},accept:()=>{f(E)}})},x=async()=>{let E=i();if(E&&r()&&!a()){a.set(!0),s.set(null);try{await e.bump(E.path)}catch(N){if(N instanceof kp&&N.code==="confirm-required"&&hJ(N.details)){m(E.path);return}s.set(l(N))}finally{a.set(!1)}}},P=()=>{s.set(null)};return{canBump:r,bumpInFlight:a.asReadonly(),bumpError:s.asReadonly(),bumpTooltip:c,onBumpClick:x,dismissBumpError:P}}function hJ(t){return typeof t!="object"||t===null?!1:t.key==="allowEditSmFiles"}function K_(t){Ot(K_);let{path:i,pathSet:e,dataSource:n}=t,o=z(new Set),r=z(new Set),a=z(new Set);return J(()=>{i(),o.set(new Set),r.set(new Set),a.set(new Set)}),{linkStatus:f=>e().has(f)||o().has(f)?"live":r().has(f)?"dead-confirmed":"dead-heuristic",isVerifying:f=>a().has(f),verifyDeadLink:async f=>{if(!(o().has(f)||r().has(f))&&!a().has(f)){a.update(m=>new Set(m).add(f));try{await n.getNode(f)===null?r.update(x=>new Set(x).add(f)):o.update(x=>new Set(x).add(f))}catch{}finally{a.update(m=>{let x=new Set(m);return x.delete(f),x})}}}}}function Y_(t){Ot(Y_);let i=z(!1),e=z(!1),n=z(!1);return J(()=>{t.path(),i.set(!1),e.set(!1),n.set(!1)}),{auditExpanded:i.asReadonly(),pluginsExpanded:e.asReadonly(),debugVisible:n.asReadonly(),toggleAudit:()=>i.update(o=>!o),togglePlugins:()=>e.update(o=>!o),toggleDebug:()=>n.update(o=>!o)}}var mJ=new Set(["inspector.body.panel.breakdown","inspector.body.panel.records","inspector.body.panel.tree","inspector.body.panel.key-values","inspector.body.panel.link-list","inspector.body.panel.markdown"]),_J=new Set(["identity","annotations","settings","audit"]),gJ=new Set(["agent","skill","command"]);function wM(t){let{node:i,texts:e}=t,n=S(()=>{let c=i()?.sidecar;if(!c||!c.present)return null;if(c.root)return c.root;let l={};return c.annotations&&(l.annotations=c.annotations),l}),o=S(()=>{let c=i()?.kind;return c!==void 0&&gJ.has(c)}),r=S(()=>{let c=n();if(!c)return!1;for(let l of Object.keys(c))if(!_J.has(l))return!0;return!1}),a=S(()=>{let c=i()?.contributions??[];for(let l of c)if(mJ.has(l.slot))return!0;return!1}),s=S(()=>{let c=n();if(!c)return e.audit.headerEmpty;let l=c.audit;if(typeof l!="object"||l===null)return e.audit.headerEmpty;let f=l,m=typeof f.lastBumpedAt=="string"?f.lastBumpedAt:null,x=typeof f.lastBumpedBy=="string"?f.lastBumpedBy:null;return m===null?e.audit.headerEmpty:e.audit.headerSummary(Co(m),x??"?")});return{sidecarRoot:n,hasVendorFrontmatter:o,hasPluginContributions:r,hasViewContributions:a,auditSummary:s}}function yJ(t,i){if(t&1&&(p(0,"section",0)(1,"div",2),R(2,"span",3),p(3,"p",4),v(4),h(),p(5,"p",5)(6,"span"),v(7),h(),p(8,"a",6),v(9),h(),p(10,"span"),v(11),h(),p(12,"a",7),v(13),h(),p(14,"span"),v(15),h()()()()),t&2){let e=_();d(4),C(e.texts.emptyNoSelection.title),d(3),C(e.texts.emptyNoSelection.descPrefix),d(2),C(e.texts.emptyNoSelection.listLink),d(2),C(e.texts.emptyNoSelection.descMiddle),d(2),C(e.texts.emptyNoSelection.mapLink),d(2),C(e.texts.emptyNoSelection.descSuffix)}}function CJ(t,i){if(t&1&&(p(0,"section",0)(1,"div",8),R(2,"span",9),p(3,"p",4),v(4),h(),p(5,"p",5)(6,"code"),v(7),h(),p(8,"span"),v(9),h(),p(10,"a",6),v(11),h(),p(12,"span"),v(13),h()()()()),t&2){let e=_();d(4),C(e.texts.emptyNotFound.title),d(3),C(e.path()),d(2),C(e.texts.emptyNotFound.descSuffix),d(2),C(e.texts.emptyNotFound.backLink),d(2),C(e.texts.emptyNotFound.descAfterLink)}}function xJ(t,i){if(t&1&&R(0,"p",11),t&2){let e=_(2);M("innerHTML",e.descriptionHtml(),go)}}function bJ(t,i){if(t&1&&(p(0,"div",12),R(1,"i",41),p(2,"span"),v(3),h()()),t&2){let e=_(2);d(3),C(e.texts.supersededByBanner(i))}}function wJ(t,i){if(t&1){let e=se();p(0,"div",13),R(1,"i",42),p(2,"span"),v(3),h(),p(4,"button",43),H("click",function(){B(e);let o=_(2);return q(o.dismissBumpError())}),R(5,"i",44),h()()}if(t&2){let e=_(2);d(3),C(i),d(),G("aria-label",e.texts.bumpErrorDismissAriaLabel)}}function SJ(t,i){if(t&1&&(p(0,"a",17),v(1),h()),t&2){let e=_(2);d(),C(e.texts.backToList)}}function TJ(t,i){if(t&1&&(p(0,"div",18),R(1,"sm-vendor-frontmatter",45),h()),t&2){_();let e=oe(0),n=oe(1),o=_();d(),M("frontmatter",n)("kind",e.kind)("provider",e.provider)("knownPaths",o.pathSet())("onSkillClick",o.onSkillChip)}}function IJ(t,i){if(t&1){let e=se();p(0,"section",19)(1,"h3",21),v(2),h(),p(3,"sm-annotations-panel",46),H("openPath",function(o){B(e);let r=_(2);return q(r.openPath(o))})("tagClick",function(o){B(e);let r=_(2);return q(r.tagSelect.emit(o))}),h()()}if(t&2){_();let e=oe(0),n=_();d(2),C(n.texts.sections.annotations),d(),M("overlay",e.sidecar)("knownPaths",n.pathSet())("activeTag",n.activeTag())}}function EJ(t,i){if(t&1&&(p(0,"p",54)(1,"strong"),v(2),h(),v(3),h()),t&2){let e=_(4);d(2),C(e.texts.findingHintLabel),d(),qe(" ",i," ")}}function PJ(t,i){if(t&1&&(p(0,"li",49)(1,"div",50)(2,"span",51),v(3),h(),p(4,"code",52),v(5),h()(),p(6,"p",53),v(7),h(),T(8,EJ,4,2,"p",54),h()),t&2){let e,n=i.$implicit;G("data-severity",n.severity),d(2),G("data-severity",n.severity),d(),C(n.severity),d(2),C(n.analyzerId),d(2),C(n.message),d(),I((e=n.fix==null?null:n.fix.summary)?8:-1,e)}}function MJ(t,i){if(t&1&&(p(0,"section",23)(1,"h3",21),v(2),p(3,"span",47),v(4),h()(),p(5,"ul",48),Y(6,PJ,9,6,"li",49,Sp),h()()),t&2){let e=_(2);d(2),qe(" ",e.texts.sections.findings," "),d(2),qe("(",e.issues().length,")"),d(2),X(e.issues())}}function kJ(t,i){if(t&1&&R(0,"sm-inspector-audit-panel",28),t&2){let e=_(2);M("sidecarRoot",e.sidecarRoot())}}function DJ(t,i){if(t&1&&R(0,"sm-plugin-contributions",28),t&2){let e=_(3);M("sidecarRoot",e.sidecarRoot())}}function OJ(t,i){if(t&1){let e=se();p(0,"section",29)(1,"button",55),H("click",function(){B(e);let o=_(2);return q(o.togglePlugins())}),p(2,"span",21),v(3),h(),R(4,"i",27),h(),T(5,DJ,1,1,"sm-plugin-contributions",28),h()}if(t&2){let e=_(2);d(),G("aria-expanded",e.pluginsExpanded()),d(2),C(e.texts.sections.plugins),d(),de("pi-chevron-right",!e.pluginsExpanded())("pi-chevron-down",e.pluginsExpanded()),d(),I(e.pluginsExpanded()?5:-1)}}function NJ(t,i){if(t&1&&(p(0,"section",30)(1,"h3",21),v(2),h(),R(3,"sm-inspector-slots-panel",56),h()),t&2){let e=_(2);d(2),C(e.texts.sections.viewContributions),d(),M("node",e.node())}}function RJ(t,i){if(t&1&&(p(0,"div",33),R(1,"sm-inspector-debug-panel",57),h()),t&2){_();let e=oe(0),n=_();d(),M("node",e)("sidecarRoot",n.sidecarRoot())("overlay",e.sidecar)}}function AJ(t,i){if(t&1&&(p(0,"p",35),v(1),h()),t&2){let e=_(2);d(),C(e.texts.body.loading)}}function FJ(t,i){if(t&1&&(p(0,"p",36),v(1),h()),t&2){let e=_(2);d(),C(e.texts.body.empty)}}function LJ(t,i){if(t&1&&(p(0,"p",37),v(1),h()),t&2){let e=_(2);d(),C(e.texts.body.unavailable)}}function zJ(t,i){if(t&1&&(p(0,"p",38),v(1),h()),t&2){let e=_(2);d(),C(e.texts.body.renderError)}}function BJ(t,i){if(t&1&&R(0,"div",39),t&2){let e=_(2);M("innerHTML",e.bodyHtml(),go)}}function qJ(t,i){if(t&1){let e=se();lt(0)(1),p(2,"section",0)(3,"sm-inspector-header",10),H("favoriteToggle",function(o){B(e);let r=_();return q(r.onHeaderFavoriteToggle(o))}),h(),T(4,xJ,1,1,"p",11),T(5,bJ,4,1,"div",12),T(6,wJ,6,2,"div",13),p(7,"div",14)(8,"p-button",15),H("onClick",function(){B(e);let o=_();return q(o.onBumpClick())}),h(),p(9,"p-button",16),H("onClick",function(){B(e);let o=_();return q(o.refreshBody())}),h(),T(10,SJ,2,1,"a",17),h(),T(11,TJ,2,5,"div",18),T(12,IJ,4,4,"section",19),p(13,"section",20)(14,"h3",21),v(15),h(),p(16,"sm-linked-nodes-panel",22),H("openPath",function(o){B(e);let r=_();return q(r.openPath(o))}),h()(),T(17,MJ,8,2,"section",23),p(18,"section",24)(19,"button",25),H("click",function(){B(e);let o=_();return q(o.toggleAudit())}),p(20,"span",21),v(21),h(),p(22,"span",26),v(23),h(),R(24,"i",27),h(),T(25,kJ,1,1,"sm-inspector-audit-panel",28),h(),T(26,OJ,6,7,"section",29),T(27,NJ,4,2,"section",30),p(28,"section",31)(29,"button",32),H("click",function(){B(e);let o=_();return q(o.toggleDebug())}),p(30,"span",21),v(31),h(),R(32,"i",27),h(),T(33,RJ,2,3,"div",33),h(),p(34,"section",34)(35,"h3",21),v(36),h(),T(37,AJ,2,1,"p",35)(38,FJ,2,1,"p",36)(39,LJ,2,1,"p",37)(40,zJ,2,1,"p",38)(41,BJ,1,1,"div",39),h(),R(42,"p-confirmdialog",40),h()}if(t&2){let e,n,o,r=_(),a=Xe(r.node());d();let s=Xe(a.frontmatter);d(),dt("--accent","var(--sm-kind-"+a.kind+", var(--sm-kind-markdown))"),d(),M("node",a)("showActionMocks",r.showActionMocks)("frontmatterInvalid",r.frontmatterInvalid()),d(),I(s.description?4:-1),d(),I((e=r.headerSupersededBy())?5:-1,e),d(),I((n=r.bumpError())?6:-1,n),d(2),M("label",r.texts.bump.label)("disabled",!r.canBump()||r.bumpInFlight())("loading",r.bumpInFlight())("pTooltip",r.bumpTooltip()),d(),M("text",!0)("ariaLabel",r.texts.body.refreshLabel)("pTooltip",r.texts.body.refreshLabel)("disabled",r.bodyState()==="loading"||!r.path())("loading",r.bodyState()==="loading"),d(),I(r.mode()==="standalone"?10:-1),d(),I(r.hasVendorFrontmatter()?11:-1),d(),I(a.sidecar!=null&&a.sidecar.present?12:-1),d(3),C(r.texts.sections.connections),d(),M("path",a.path),d(),I(r.issues().length>0?17:-1),d(2),G("aria-expanded",r.auditExpanded()),d(2),C(r.texts.sections.audit),d(2),C(r.auditSummary()),d(),de("pi-chevron-right",!r.auditExpanded())("pi-chevron-down",r.auditExpanded()),d(),I(r.auditExpanded()?25:-1),d(),I(r.hasPluginContributions()?26:-1),d(),I(r.hasViewContributions()?27:-1),d(2),M("pTooltip",r.texts.debugToggleTooltip),G("aria-expanded",r.debugVisible())("aria-label",r.texts.debugToggleAriaLabel),d(2),C(r.texts.sections.debug),d(),de("pi-chevron-right",!r.debugVisible())("pi-chevron-down",r.debugVisible()),d(),I(r.debugVisible()?33:-1),d(3),C(r.texts.sections.body),d(),I((o=r.bodyState())==="loading"?37:o==="empty"?38:o==="unavailable"?39:o==="error"?40:o==="ready"?41:-1),d(5),M("ariaLabel",r.texts.bump.consentDialogAriaLabel)}}var SM=(()=>{class t{loader=u(Lt);router=u(ea);dataSource=u(ln);markdown=u(ma);sidecarService=u(JP);confirmation=u(Ti);texts=Bn;cardTexts=$n;showActionMocks=lo.inspector.actionMocks;path=O(void 0);mode=O("standalone");activeTag=O(null);tagSelect=Ve();node=S(()=>{let e=this.path();return e?this.loader.nodes().find(n=>n.path===e)??null:null});pathSet=S(()=>{let e=new Set;for(let n of this.loader.nodes())e.add(n.path);return e});headerSupersededBy=S(()=>Tg(this.node()));bodyHandle=W_({path:this.path,dataSource:this.dataSource,markdown:this.markdown});bodyState=this.bodyHandle.bodyState;bodyHtml=this.bodyHandle.bodyHtml;descriptionHtml=Br(()=>this.node()?.frontmatter.description??"",this.markdown);deadLink=K_({path:this.path,pathSet:this.pathSet,dataSource:this.dataSource});sectionCollapse=Y_({path:this.path});auditExpanded=this.sectionCollapse.auditExpanded;pluginsExpanded=this.sectionCollapse.pluginsExpanded;debugVisible=this.sectionCollapse.debugVisible;derivations=wM({node:this.node,texts:this.texts});sidecarRoot=this.derivations.sidecarRoot;hasVendorFrontmatter=this.derivations.hasVendorFrontmatter;hasPluginContributions=this.derivations.hasPluginContributions;hasViewContributions=this.derivations.hasViewContributions;auditSummary=this.derivations.auditSummary;issues=z([]);issuesLoaderEffect=J(e=>{let n=this.path();if(this.issues.set([]),!n)return;let o=!1;e(()=>{o=!0}),this.dataSource.listIssues({node:n}).then(r=>{o||this.issues.set(r.items)}).catch(()=>{o||this.issues.set([])})});frontmatterInvalid=S(()=>this.issues().some(e=>e.analyzerId==="frontmatter-parse-error"));ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}openPath(e){this.router.navigate(["/map"],{queryParams:{path:e}})}onSkillChip=e=>{this.openPath(e)};pathExists(e){return this.pathSet().has(e)}linkStatus(e){return this.deadLink.linkStatus(e)}isVerifying(e){return this.deadLink.isVerifying(e)}verifyDeadLink(e){return this.deadLink.verifyDeadLink(e)}refreshBody(){this.bodyHandle.refresh()}onHeaderFavoriteToggle(e){let n=this.node();!n||n.path!==e||this.loader.toggleFavorite(e,!n.isFavorite)}toggleAudit(){this.sectionCollapse.toggleAudit()}togglePlugins(){this.sectionCollapse.togglePlugins()}toggleDebug(){this.sectionCollapse.toggleDebug()}bumpHandle=$_({node:this.node,sidecarService:this.sidecarService,confirmation:this.confirmation});canBump=this.bumpHandle.canBump;bumpInFlight=this.bumpHandle.bumpInFlight;bumpError=this.bumpHandle.bumpError;bumpTooltip=this.bumpHandle.bumpTooltip;onBumpClick(){return this.bumpHandle.onBumpClick()}dismissBumpError(){this.bumpHandle.dismissBumpError()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-inspector-view"]],hostVars:2,hostBindings:function(n,o){n&2&&de("inspector-view--embedded",o.mode()==="embedded")},inputs:{path:[1,"path"],mode:[1,"mode"],activeTag:[1,"activeTag"]},outputs:{tagSelect:"tagSelect"},features:[ge([Ti])],decls:3,vars:1,consts:[["data-testid","inspector-view",1,"inspector"],["data-testid","inspector-view",1,"inspector",3,"--accent"],["data-testid","inspector-empty-no-selection",1,"empty-state"],[1,"empty-state__icon","pi","pi-eye"],[1,"empty-state__title"],[1,"empty-state__desc"],["routerLink","/files",1,"inspector__back"],["routerLink","/map",1,"inspector__back"],["data-testid","inspector-empty-not-found",1,"empty-state"],[1,"empty-state__icon","empty-state__icon--warn","pi","pi-question-circle"],[3,"favoriteToggle","node","showActionMocks","frontmatterInvalid"],["data-testid","inspector-description",1,"inspector__desc",3,"innerHTML"],["data-testid","inspector-superseded-banner",1,"inspector__banner","inspector__banner--warn"],["data-testid","inspector-bump-error",1,"inspector__banner","inspector__banner--error"],[1,"inspector__toolbar"],["icon","pi pi-arrow-up-right","severity","secondary","size","small","data-testid","inspector-bump",3,"onClick","label","disabled","loading","pTooltip"],["icon","pi pi-refresh","severity","secondary","size","small","data-testid","inspector-body-refresh",3,"onClick","text","ariaLabel","pTooltip","disabled","loading"],["routerLink","/files","data-testid","inspector-back",1,"inspector__back"],["data-testid","inspector-card-vendor-frontmatter",1,"inspector__vendor"],["data-testid","inspector-card-annotations",1,"sm-block"],["data-testid","inspector-card-linked-nodes",1,"sm-block"],[1,"sm-block__title"],[3,"openPath","path"],["data-testid","inspector-findings",1,"sm-block"],["data-testid","inspector-card-audit",1,"sm-block","sm-block--collapsible"],["type","button","data-testid","inspector-audit-toggle",1,"sm-block__row","sm-block__row--toggle",3,"click"],["data-testid","inspector-audit-summary",1,"sm-block__summary"],["aria-hidden","true",1,"pi","sm-block__chevron"],[3,"sidecarRoot"],["data-testid","inspector-card-plugins",1,"sm-block","sm-block--collapsible"],["data-testid","inspector-card-view-contributions",1,"sm-block"],["data-testid","inspector-card-debug",1,"sm-block","sm-block--collapsible"],["type","button","data-testid","inspector-debug-toggle",1,"sm-block__row","sm-block__row--toggle",3,"click","pTooltip"],["data-testid","inspector-debug-section",1,"inspector__debug"],["data-testid","inspector-card-body",1,"sm-block","inspector__body-section"],["data-testid","inspector-body-loading",1,"inspector__body-status"],["data-testid","inspector-body-empty",1,"inspector__body-status"],["data-testid","inspector-body-unavailable",1,"inspector__body-status","inspector__body-status--warn"],["data-testid","inspector-body-error",1,"inspector__body-status","inspector__body-status--warn"],["data-testid","inspector-body-rendered",1,"inspector__body-rendered",3,"innerHTML"],["data-testid","inspector-bump-consent","styleClass","sm-consent-dialog",3,"ariaLabel"],["aria-hidden","true",1,"pi","pi-arrow-up-right"],["aria-hidden","true",1,"pi","pi-exclamation-triangle"],["type","button",1,"inspector__banner-dismiss",3,"click"],["aria-hidden","true",1,"pi","pi-times"],[3,"frontmatter","kind","provider","knownPaths","onSkillClick"],[3,"openPath","tagClick","overlay","knownPaths","activeTag"],[1,"sm-block__count"],[1,"inspector__findings-list"],["data-testid","inspector-finding",1,"inspector__finding"],[1,"inspector__finding-head"],[1,"inspector__finding-severity"],[1,"inspector__finding-analyzer"],[1,"inspector__finding-message"],["data-testid","inspector-finding-hint",1,"inspector__finding-hint"],["type","button","data-testid","inspector-plugins-toggle",1,"sm-block__row","sm-block__row--toggle",3,"click"],[3,"node"],[3,"node","sidecarRoot","overlay"]],template:function(n,o){n&1&&T(0,yJ,16,6,"section",0)(1,CJ,14,5,"section",0)(2,qJ,43,47,"section",1),n&2&&I(o.path()?o.node()?2:1:0)},dependencies:[ag,dn,cn,Oe,De,ca,sa,lM,tM,fM,gM,vM,CM,xM,bM],styles:["[_nghost-%COMP%]{display:block}.inspector[_ngcontent-%COMP%]{--accent: var(--sm-kind-markdown);display:flex;flex-direction:column;gap:.85rem;padding:1rem 1.1rem 1.25rem;background:var(--sm-bg-content);color:var(--p-text-color)}.inspector--empty[_ngcontent-%COMP%]{padding:2rem;color:var(--p-text-muted-color)}.inspector__back[_ngcontent-%COMP%]{font-size:.85rem;color:var(--p-primary-color)}.inspector__desc[_ngcontent-%COMP%]{margin:0;color:var(--p-text-color);font-size:.9rem;line-height:1.55;max-width:72ch}[_nghost-%COMP%] .inspector__desc code{background:var(--sm-bg-hover);padding:.05rem .3rem;border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.85em}[_nghost-%COMP%] .inspector__desc a{color:var(--p-primary-color);text-decoration:underline}.inspector__toolbar[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;flex-wrap:wrap}[_nghost-%COMP%] .sm-block{display:flex;flex-direction:column;gap:.45rem;padding-left:.7rem;border-left:2px solid color-mix(in srgb,var(--accent) 70%,transparent);transition:border-color .14s ease}[_nghost-%COMP%] .sm-block--collapsible:hover{border-left-color:var(--accent)}[_nghost-%COMP%] .sm-block__title{margin:0;font-size:.82rem;font-weight:600;letter-spacing:0;color:var(--p-text-color);display:flex;align-items:baseline;gap:.4rem}[_nghost-%COMP%] .sm-block__count{font-size:.75rem;font-weight:500;color:var(--p-text-muted-color)}[_nghost-%COMP%] .sm-block__sub{margin:0;font-size:.72rem;font-weight:500;color:var(--p-text-muted-color);text-transform:uppercase;letter-spacing:.05em}[_nghost-%COMP%] .sm-block__row{display:flex;align-items:center;gap:.5rem;width:100%;padding:0;margin:0;background:transparent;border:none;text-align:left;font:inherit;color:var(--p-text-color)}[_nghost-%COMP%] .sm-block__row--toggle{cursor:pointer}[_nghost-%COMP%] .sm-block--collapsible>.sm-block__row--toggle+:not(.inspector__debug){margin-top:.5rem;padding-top:.7rem;border-top:1px solid var(--sm-border)}[_nghost-%COMP%] .sm-block__row--toggle:hover .sm-block__title{color:var(--accent)}[_nghost-%COMP%] .sm-block__summary{font-size:.78rem;color:var(--p-text-muted-color);font-weight:400;flex:1 1 auto;margin-left:.3rem}[_nghost-%COMP%] .sm-block__chevron{color:var(--p-text-muted-color);font-size:.75rem;margin-left:auto}[_nghost-%COMP%] .sm-block__kv{display:grid;grid-template-columns:max-content 1fr;column-gap:1rem;row-gap:.35rem;margin:0;font-size:.85rem;align-items:baseline}[_nghost-%COMP%] .sm-block__kv dt{color:var(--p-text-muted-color);font-weight:500;font-size:.8rem}[_nghost-%COMP%] .sm-block__kv dd{margin:0;word-break:break-word;color:var(--p-text-color)}[_nghost-%COMP%] .sm-block__kv code{background:var(--sm-bg-hover);padding:.05rem .4rem;border-radius:var(--sm-radius-sm);font-size:.78rem;font-family:var(--sm-font-mono)}.inspector__vendor[_ngcontent-%COMP%]{display:contents}.inspector__body-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.6rem}.inspector__body-status[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--p-text-muted-color);font-style:italic}.inspector__body-status--warn[_ngcontent-%COMP%]{color:var(--sm-severity-warn);font-style:normal}.inspector__body-rendered[_ngcontent-%COMP%]{font-size:.9rem;line-height:1.6;max-height:600px;overflow:auto;padding:.25rem 0 0}.inspector__body-rendered[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.inspector__body-rendered[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.inspector__body-rendered[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{background:var(--p-content-background);border:1px solid var(--p-content-border-color);border-radius:var(--sm-radius-md);padding:.75rem;margin:.75rem 0;white-space:pre-wrap;word-wrap:break-word;font-family:var(--sm-font-mono);font-size:.85rem;line-height:1.5;overflow-x:auto}.inspector__body-rendered[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .3rem;border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.85em}.inspector__body-rendered[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:transparent;padding:0;border-radius:0}.inspector__banner[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.55rem;padding:.55rem .75rem;border-radius:var(--sm-radius-md);font-size:.85rem;border:1px solid transparent}.inspector__banner--warn[_ngcontent-%COMP%]{background:var(--sm-severity-warn-bg);color:var(--sm-severity-warn);border-color:color-mix(in srgb,var(--sm-severity-warn) 30%,transparent)}.inspector__banner--error[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error);border-color:color-mix(in srgb,var(--sm-severity-error) 30%,transparent)}.inspector__banner-dismiss[_ngcontent-%COMP%]{margin-left:auto;background:transparent;border:none;cursor:pointer;color:inherit;display:inline-flex;align-items:center;justify-content:center}.inspector__debug[_ngcontent-%COMP%]{margin-top:.5rem;padding-top:.7rem;border-top:1px solid var(--sm-border)}.inspector__findings-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.45rem}.inspector__finding[_ngcontent-%COMP%]{padding:.55rem .7rem;border-left:3px solid var(--p-content-border-color);background:var(--p-content-background);border-radius:var(--sm-radius-sm)}.inspector__finding[data-severity=error][_ngcontent-%COMP%]{border-left-color:var(--sm-severity-error);background:var(--sm-severity-error-bg)}.inspector__finding[data-severity=warn][_ngcontent-%COMP%]{border-left-color:var(--sm-severity-warn);background:var(--sm-severity-warn-bg)}.inspector__finding[data-severity=info][_ngcontent-%COMP%]{border-left-color:var(--sm-severity-info);background:var(--sm-severity-info-bg)}.inspector__finding-head[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.2rem}.inspector__finding-severity[_ngcontent-%COMP%]{text-transform:uppercase;font-size:.65rem;font-weight:700;letter-spacing:.05em;padding:.05rem .4rem;border-radius:var(--sm-radius-sm);color:var(--p-content-background);background:var(--p-text-color)}.inspector__finding-severity[data-severity=error][_ngcontent-%COMP%]{background:var(--sm-severity-error)}.inspector__finding-severity[data-severity=warn][_ngcontent-%COMP%]{background:var(--sm-severity-warn)}.inspector__finding-severity[data-severity=info][_ngcontent-%COMP%]{background:var(--sm-severity-info)}.inspector__finding-analyzer[_ngcontent-%COMP%]{font-size:.78rem;color:var(--p-text-muted-color)}.inspector__finding-message[_ngcontent-%COMP%]{margin:0;font-size:.88rem;color:var(--p-text-color)}.inspector__finding-hint[_ngcontent-%COMP%]{margin:.35rem 0 0;font-size:.82rem;color:var(--p-text-color);background:var(--p-content-background);padding:.35rem .5rem;border-radius:var(--sm-radius-sm)}.inspector-view--embedded[_nghost-%COMP%] .inspector[_ngcontent-%COMP%]{gap:.75rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__desc[_ngcontent-%COMP%]{font-size:.88rem;line-height:1.5;max-width:none}.inspector-view--embedded[_nghost-%COMP%] .inspector__body-rendered[_ngcontent-%COMP%]{max-height:480px}[_nghost-%COMP%] .ann-panel__chip--user{padding:.1rem .55rem}"],changeDetection:0})}return t})();var TM=(()=>{class t{smMiddleMousePan=O.required();origin=null;rafId=null;pendingPosition=null;onMouseDown(e){if(e.button!==1)return;let n=this.smMiddleMousePan();if(!n)return;e.preventDefault();let o=n.getPosition()??{x:0,y:0};this.origin={mouseX:e.clientX,mouseY:e.clientY,canvasX:o.x,canvasY:o.y},document.addEventListener("mousemove",this.onMove),document.addEventListener("mouseup",this.onEnd)}ngOnDestroy(){this.onEnd()}onMove=e=>{this.origin&&(this.pendingPosition={x:this.origin.canvasX+(e.clientX-this.origin.mouseX),y:this.origin.canvasY+(e.clientY-this.origin.mouseY)},this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let n=this.smMiddleMousePan();!n||!this.pendingPosition||(n.setPosition(this.pendingPosition),n.redraw())})))};onEnd=()=>{this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingPosition=null,this.origin=null,document.removeEventListener("mousemove",this.onMove),document.removeEventListener("mouseup",this.onEnd),this.smMiddleMousePan()?.emitCanvasChangeEvent()};static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ee({type:t,selectors:[["","smMiddleMousePan",""]],hostBindings:function(n,o){n&1&&H("mousedown",function(a){return o.onMouseDown(a)})},inputs:{smMiddleMousePan:[1,"smMiddleMousePan"]}})}return t})();function IM(t,i){if(t.size===0)return{next:t,dirty:!1};let e=!1,n=new Set;for(let o of t)i.has(o)?n.add(o):e=!0;return{next:e?n:t,dirty:e}}function EM(t){let{nodes:i,current:e,layout:n}=t,o=new Set(i.map(c=>c.path)),r=!1,a=new Map(e);for(let c of a.keys())o.has(c)||(a.delete(c),r=!0);let s=!1;for(let c of o)if(!a.has(c)){s=!0;break}for(let c of o){let l=n.positions.get(c);if(!l)continue;let f=a.get(c);if(!f){a.set(c,{x:l.x,y:l.y}),r=!0;continue}f.manual!==!0&&s&&(f.x===l.x&&f.y===l.y||(a.set(c,{x:l.x,y:l.y}),r=!0))}return{next:a,dirty:r}}function PM(t){let{selectedPath:i,setSelectedNodeId:e,readSelectedNodeId:n,graphNodes:o,onDeepLinkSelect:r,router:a,route:s}=t,c=Cg(s.queryParamMap.pipe(Z_(l=>l.get("path"))),{initialValue:s.snapshot.queryParamMap.get("path")});J(()=>{let l=c(),f=o();if(f.length===0||!l)return;let m=At(()=>n());if(m!==null&&f.find(E=>E.id===m)?.view.path===l)return;let x=f.find(P=>P.view.path===l);x&&(e(x.id),r?.(x.id))}),J(()=>{let l=i(),f=At(()=>c());(l??null)!==(f??null)&&a.navigate([],{relativeTo:s,queryParams:{path:l??null},queryParamsHandling:"merge",replaceUrl:!0})})}function MM(t,i){return fa(t).includes(i)}function kM(t){if(typeof t!="object"||t===null)return!1;let i=t;return typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)}function DM(t){if(typeof t!="object"||t===null)return!1;let i=t;return typeof i.x=="number"&&typeof i.y=="number"&&typeof i.scale=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)&&Number.isFinite(i.scale)&&i.scale>0}function OM(t){return t.querySelector(".p-overlay-mask, .p-dialog, .p-overlay")!==null}var NM="sm.graph.viewport",RM="sm.graph.node-positions",AM="sm.graph.node-expanded",FM="sm.graph.panel-width";function LM(){let t=null;try{t=localStorage.getItem(NM)}catch{return null}if(!t)return null;let i;try{i=JSON.parse(t)}catch{return null}return DM(i)?i:null}function zM(t){try{localStorage.setItem(NM,JSON.stringify(t))}catch{}}function BM(){let t=new Map,i=null;try{i=localStorage.getItem(RM)}catch{return t}if(!i)return t;let e;try{e=JSON.parse(i)}catch{return t}if(typeof e!="object"||e===null)return t;for(let[n,o]of Object.entries(e)){if(!kM(o))continue;let r=o,s=r.manual===!0?{x:r.x,y:r.y,manual:!0}:{x:r.x,y:r.y};t.set(n,s)}return t}function _p(t){try{let i={};for(let[e,n]of t)i[e]=n.manual?{x:n.x,y:n.y,manual:!0}:{x:n.x,y:n.y};localStorage.setItem(RM,JSON.stringify(i))}catch{}}function qM(){let t=null;try{t=localStorage.getItem(AM)}catch{return new Set}if(!t)return new Set;let i;try{i=JSON.parse(t)}catch{return new Set}if(!Array.isArray(i))return new Set;let e=new Set;for(let n of i)typeof n=="string"&&n.length>0&&e.add(n);return e}function gp(t){try{localStorage.setItem(AM,JSON.stringify([...t]))}catch{}}function GM(){let t=null;try{t=localStorage.getItem(FM)}catch{return null}if(!t)return null;let i=Number(t);return!Number.isFinite(i)||i<=0?null:i}function HM(t){try{localStorage.setItem(FM,String(Math.round(t)))}catch{}}var VM=400,vp=400,jM=80;function UM(t){let i=z(t.initialWidth),e=z(typeof window>"u"?1920:window.innerWidth);typeof window<"u"&&Q_(window,"resize").pipe(da(t.destroyRef)).subscribe(()=>e.set(window.innerWidth));let n=S(()=>{let m=Math.max(vp,e()-jM),x=i();return x>m||x<vp?Math.min(VM,m):x}),o=null,r=null,a=null,s=()=>{a=null,r!==null&&(i.set(r),r=null)},c=m=>{if(!o)return;let x=m.clientX-o.mouseX,P=o.widthAtStart-x,E=Math.max(vp,e()-jM);r=Math.min(E,Math.max(vp,P)),a===null&&typeof window<"u"&&(a=window.requestAnimationFrame(s))},l=()=>{o&&(o=null,document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l),a!==null&&typeof window<"u"&&(window.cancelAnimationFrame(a),a=null),r!==null&&(i.set(r),r=null),t.onCommit(i()))};return{clampedPanelWidth:n,onPanelResizeStart:m=>{m.button===0&&(m.preventDefault(),m.stopPropagation(),o={mouseX:m.clientX,widthAtStart:n()},document.addEventListener("mousemove",c),document.addEventListener("mouseup",l))}}}function yp(t){let{points:i,wrap:e,panelW:n,zoomMin:o}=t;if(i.length===0)return null;let r=1/0,a=1/0,s=-1/0,c=-1/0;for(let xe of i)xe.x<r&&(r=xe.x),xe.y<a&&(a=xe.y),xe.x+260>s&&(s=xe.x+260),xe.y+120>c&&(c=xe.y+120);let l=Math.max(1,e.width-n),f=Math.max(1,s-r),m=Math.max(1,c-a),x=Math.max(1,l-160),P=Math.max(1,e.height-160),E=Math.min(x/f,P/m),N=Math.min(2,Math.max(o,E)),j=(r+s)/2,L=(a+c)/2,U=l/2-j*N,ie=e.height/2-L*N;return{position:{x:U,y:ie},scale:N}}function WM(t){let{point:i,wrap:e,panelW:n,scale:o}=t,r=i.x+260/2,a=i.y+120/2,c=Math.max(1,e.width-n)/2-r*o,l=e.height/2-a*o;return{position:{x:c,y:l},scale:o}}function Gr(t,i,e){if(typeof requestAnimationFrame>"u"||e<=0){t.writePosition(i.position),t.writeScale(i.scale);return}let n=t.readPosition(),o=t.readScale(),r=performance.now(),a=s=>{if(t.isStaleToken())return;let c=Math.min(1,(s-r)/e),l=GJ(c);t.writePosition({x:n.x+(i.position.x-n.x)*l,y:n.y+(i.position.y-n.y)*l}),t.writeScale(o+(i.scale-o)*l),c<1&&requestAnimationFrame(a)};requestAnimationFrame(a)}function GJ(t){return 1-Math.pow(1-t,3)}var $M=320;function KM(t){let i=z(null),e=null,n=0,o=(c,l)=>{let f=++n;Gr({readPosition:()=>t.viewportPosition(),readScale:()=>t.viewportScale(),writePosition:m=>t.viewportPosition.set(m),writeScale:m=>t.viewportScale.set(m),isStaleToken:()=>f!==n},c,l)},r=c=>{let l=t.canvasWrap();if(!l||c.length===0)return;let f=t.fullLayout(),m=[];for(let P of c){let E=f.positions.get(P);E&&m.push(E)}if(m.length===0)return;let x=yp({points:m,wrap:l,panelW:t.selectedNodeId()!==null?t.clampedPanelWidth():0,zoomMin:t.zoomMin});x&&o(x,$M)},a=()=>{let c=e;c&&(e=null,o({position:c.position,scale:c.scale},$M))};return{activeTagSelection:i,onTagSelect:c=>{let l=t.flow();if(!l)return;if(i()===c){l.clearSelection(),i.set(null),a();return}let f=t.nodes().filter(m=>MM(m,c)).map(m=>m.path);if(f.length===0){l.clearSelection(),i.set(null),a();return}e===null&&(e={position:ce({},t.viewportPosition()),scale:t.viewportScale()}),l.select(f,[]),i.set(c),r(f)}}}var Cp=.05,X_=2;function YM(t){let i=z(t.savedViewport?{x:t.savedViewport.x,y:t.savedViewport.y}:{x:0,y:0}),e=z(t.savedViewport?.scale??1),n=S(()=>e()<X_-1e-6),o=S(()=>e()>Cp+1e-6);return{viewportPosition:i,viewportScale:e,canZoomIn:n,canZoomOut:o,onCanvasChange:a=>{let s=i();(s.x!==a.position.x||s.y!==a.position.y)&&i.set({x:a.position.x,y:a.position.y}),e()!==a.scale&&e.set(a.scale),t.hasCompletedInitialLayout()&&zM({x:a.position.x,y:a.position.y,scale:a.scale})}}}function XM(t){let i=S(()=>{let c=new Map;for(let l of t.graph().edges)c.has(l.from)||c.set(l.from,new Set),c.has(l.to)||c.set(l.to,new Set),c.get(l.from).add(l.to),c.get(l.to).add(l.from);return c}),e=c=>t.selectedNodeId()===c,n=c=>{let l=t.selectedNodeId();return l===null||l===c?!1:i().get(l)?.has(c)??!1},o=c=>{if(t.activeTagSelection()!==null)return!1;let l=t.selectedNodeId();return l===null||l===c?!1:!(i().get(l)?.has(c)??!1)},r=c=>{let l=t.selectedNodeId();return l!==null&&(c.from===l||c.to===l)},a=c=>{if(t.activeTagSelection()!==null)return!1;let l=t.selectedNodeId();return l===null?!1:c.from!==l&&c.to!==l},s=S(()=>{let c=t.selectedNodeId(),l=t.activeTagSelection()!==null,f=c!==null?i().get(c)??null:null,m=new Map;for(let x of t.graph().nodes){let P=x.id,E=c===P,N=!E&&c!==null&&(f?.has(P)??!1),j=!l&&c!==null&&!E&&!(f?.has(P)??!1);m.set(P,{selected:E,highlighted:N,dimmed:j})}return m});return{isSelected:e,isHighlighted:n,isDimmed:o,isEdgeHighlighted:r,isEdgeDimmed:a,selectionView:s}}function ZM(t){let i=t.onCommit??_p,e=null,n=!1,o=null,r=()=>{queueMicrotask(()=>{if(!n){o=null;return}n=!1,o&&(t.nodePositions.set(o),o=null),i(t.nodePositions())})},a=(l,f)=>{o||(o=new Map(t.nodePositions())),o.set(l,{x:f.x,y:f.y,manual:!0}),n=!0},s=l=>{e={x:l.clientX,y:l.clientY},document.addEventListener("mouseup",r,{once:!0})},c=l=>{let f=e;if(e=null,!f)return!0;let m=l.clientX-f.x,x=l.clientY-f.y;return Math.hypot(m,x)<=4};return t.destroyRef.onDestroy(()=>{document.removeEventListener("mouseup",r)}),{onNodePositionChange:a,onNodePointerDown:s,isClickWithoutDrag:c}}function QM(t){let i=z(qM());return J(()=>{let r=new Set(t.nodes().map(s=>s.path));if(r.size===0)return;let a=IM(i(),r);a.dirty&&(i.set(a.next),gp(a.next))}),{isExpanded:r=>i().has(r),setExpanded:(r,a)=>{let s=i();if(s.has(r)===a)return;let c=new Set(s);a?c.add(r):c.delete(r),i.set(c),gp(c)},resetAll:()=>{i.set(new Set),gp(new Set)},expandedNodeIds:i}}function JM(t){let i=z(!1),e=!1,n=null;return J(()=>{let o=t.visibleNodes();e||o.length!==0&&queueMicrotask(()=>{e=!0,i.set(!0),t.savedViewport||t.fit()})}),J(()=>{let o=t.pathsFingerprint();if(!e){n=o;return}n!==o&&(n=o,(t.animatedFit??t.fit)())}),{hasCompletedInitialLayout:()=>i()}}var HJ=["canvasWrap"],nk=(t,i)=>i.id;function VJ(t,i){if(t&1&&(p(0,"div",2),R(1,"span",7),p(2,"p",8),v(3),h()()),t&2){let e=_();d(3),C(e.texts.loading)}}function jJ(t,i){if(t&1&&(p(0,"div",3),R(1,"span",9),p(2,"p",8),v(3),h(),p(4,"p",10),v(5),h()()),t&2){let e=_();d(3),C(e.texts.errorTitle),d(2),C(e.error())}}function UJ(t,i){if(t&1){let e=se();p(0,"div",4),R(1,"i",11),p(2,"p",12),v(3),h(),p(4,"p-button",13),H("onClick",function(){B(e);let o=_();return q(o.resetFilters())}),h()()}if(t&2){let e=_();d(3),C(e.texts.emptyTitle),d(),M("label",e.texts.resetFilters)("text",!0)}}function WJ(t,i){if(t&1&&(p(0,"f-connection",33),Je(),p(1,"svg",34),R(2,"circle",35),h(),Hr(),R(3,"f-connection-marker-arrow",36),h()),t&2){let e=i.$implicit,n=_(2);Re("f-conn--"+e.kind),dt("opacity",n.edgeOpacity(e)),de("f-conn--highlighted",n.isEdgeHighlighted(e))("f-conn--dimmed",n.isEdgeDimmed(e)),M("fOutputId",e.from+"-out")("fInputId",e.to+"-in")("fOutputSide",n.outputSide())("fInputSide",n.inputSide())("fType",n.connectionType())("fBehavior",n.connectionBehavior)("fReassignDisabled",!0),d(),M("type",n.markerStart)("width",9)("height",9)("refX",4.5)("refY",4.5),d(2),M("type",n.markerEnd)}}function $J(t,i){if(t&1){let e=se();jn(0,20),p(1,"div",38),H("fNodePositionChange",function(o){let r=B(e).$implicit,a=_(3);return q(a.onNodePositionChange(r.id,o))})("pointerdown",function(o){B(e);let r=_(3);return q(r.onNodePointerDown(o))})("click",function(o){let r=B(e).$implicit,a=_(3);return q(a.selectNode(r,o))})("dblclick",function(){let o=B(e).$implicit,r=_(3);return q(r.openNode(o))}),p(2,"sm-node-card",39),H("expandedChange",function(o){let r=B(e).$implicit,a=_(3);return q(a.setExpanded(r.id,o))})("favoriteToggle",function(o){B(e);let r=_(3);return q(r.onFavoriteToggle(o))}),h(),p(3,"div",40),R(4,"sm-view-contributions-host",41),h()(),Un()}if(t&2){let e=i.$implicit,n=_(3);d(),M("fNodeId",e.id)("fNodePosition",e.position)("fInputId",e.id+"-in")("fInputConnectableSide",n.inputSide())("fOutputId",e.id+"-out")("fOutputConnectableSide",n.outputSide()),G("data-testid","graph-node-"+e.id),d(),M("node",e.view)("stats",e.stats)("summary",e.summary)("selection",n.selectionFor(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),d(2),M("node",e.view)}}function KJ(t,i){if(t&1&&be(0,$J,5,14,"ng-container",37),t&2){let e=_(2);M("fVirtualForOf",e.graph().nodes)}}function YJ(t,i){if(t&1){let e=se();p(0,"div",43),H("fNodePositionChange",function(o){let r=B(e).$implicit,a=_(3);return q(a.onNodePositionChange(r.id,o))})("pointerdown",function(o){B(e);let r=_(3);return q(r.onNodePointerDown(o))})("click",function(o){let r=B(e).$implicit,a=_(3);return q(a.selectNode(r,o))})("dblclick",function(){let o=B(e).$implicit,r=_(3);return q(r.openNode(o))}),p(1,"sm-node-card",39),H("expandedChange",function(o){let r=B(e).$implicit,a=_(3);return q(a.setExpanded(r.id,o))})("favoriteToggle",function(o){B(e);let r=_(3);return q(r.onFavoriteToggle(o))}),h(),p(2,"div",40),R(3,"sm-view-contributions-host",41),h()()}if(t&2){let e=i.$implicit,n=_(3);M("fNodeId",e.id)("fNodePosition",e.position)("fInputId",e.id+"-in")("fOutputId",e.id+"-out"),G("data-testid","graph-node-"+e.id),d(),M("node",e.view)("stats",e.stats)("summary",e.summary)("selection",n.selectionFor(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),d(2),M("node",e.view)}}function XJ(t,i){if(t&1&&(jn(0,20),Y(1,YJ,4,12,"div",42,nk),Un()),t&2){let e=_(2);d(),X(e.graph().nodes)}}function ZJ(t,i){if(t&1&&R(0,"sm-perf-hud",26),t&2){let e=_(2);M("visible",e.visibleCount())("total",e.totalCount())("edges",e.edgeCount())}}function QJ(t,i){if(t&1){let e=se();p(0,"div",14,0),H("click",function(o){B(e);let r=_();return q(r.onCanvasClick(o))}),p(2,"f-flow",15),H("fLoaded",function(){B(e);let o=_();return q(o.onLoaded())}),R(3,"f-selection-area"),p(4,"f-background"),R(5,"f-rect-pattern"),h(),R(6,"f-line-alignment",16),p(7,"f-canvas",17),H("fCanvasChange",function(o){B(e);let r=_();return q(r.onCanvasChange(o))}),jn(8,18),Y(9,WJ,4,21,"f-connection",19,nk),Un(),T(11,KJ,1,1,"ng-container",20)(12,XJ,3,0,"ng-container",20),h(),R(13,"f-minimap"),h(),p(14,"div",21),R(15,"sm-kind-palette")(16,"sm-severity-palette")(17,"sm-link-kind-palette"),h(),p(18,"aside",22)(19,"div",23),H("mousedown",function(o){B(e);let r=_();return q(r.onPanelResizeStart(o))}),h(),p(20,"div",24)(21,"sm-inspector-view",25),H("tagSelect",function(o){B(e);let r=_();return q(r.onTagSelect(o))}),h()()(),T(22,ZJ,1,3,"sm-perf-hud",26),p(23,"div",27)(24,"p-button",28),H("onClick",function(){B(e);let o=_();return q(o.zoomIn())}),h(),p(25,"p-button",29),H("onClick",function(){B(e);let o=_();return q(o.zoomOut())}),h(),p(26,"p-button",30),H("onClick",function(){B(e);let o=_();return q(o.fitToScreen())}),h(),R(27,"span",31)(28,"sm-graph-layout-toolbar")(29,"span",31),p(30,"p-button",32),H("onClick",function(){B(e);let o=_();return q(o.resetLayout())}),h()()()}if(t&2){let e=_();M("smMiddleMousePan",e.canvas()),d(2),M("fCache",e.perf.cache),d(4),M("fAlignThreshold",20),d(),M("position",e.viewportPosition())("scale",e.viewportScale())("fZoomStep",.06)("fZoomDblClickStep",.35)("fZoomMinimum",e.zoomMin)("fZoomMaximum",e.zoomMax)("debounceTime",150),d(2),X(e.graph().edges),d(2),I(e.perf.virtualization?11:12),d(7),dt("width",e.clampedPanelWidth(),"px"),de("is-open",e.selectedNodeId()!==null),G("aria-label",e.texts.a11y.panel),d(),G("aria-label",e.texts.panel.resizeLabel),d(2),M("path",e.selectedPath())("activeTag",e.activeTagSelection()),d(),I(e.perfHud()?22:-1),d(),G("aria-label",e.texts.a11y.toolbar),d(),M("ariaLabel",e.texts.toolbar.zoomIn)("pTooltip",e.texts.toolbar.zoomIn)("text",!0)("rounded",!0)("disabled",!e.canZoomIn()),d(),M("ariaLabel",e.texts.toolbar.zoomOut)("pTooltip",e.texts.toolbar.zoomOut)("text",!0)("rounded",!0)("disabled",!e.canZoomOut()),d(),M("ariaLabel",e.texts.toolbar.fitToScreen)("pTooltip",e.texts.toolbar.fitToScreen)("text",!0)("rounded",!0),d(4),M("ariaLabel",e.texts.toolbar.resetLayoutLabel)("pTooltip",e.texts.toolbar.resetLayoutTooltip)("text",!0)("rounded",!0)}}var ek=.2,tk=420,JJ=.15,eee=.25,tee=.75,nee=.6,iee={selected:!1,highlighted:!1,dimmed:!1},lfe=(()=>{class t{loader=u(Lt);filters=u(un);issuePaths=u(ha);graphPreferences=u(lp);router=u(ea);route=u(rg);confirmationService=u(Ti);destroyRef=u(it);dagreLayout=u(F_);injector=u(Ye);usageTracker=u(Bg);flow=Ae(cr);canvas=Ae(sr);zoom=Ae(dr);canvasWrap=Ae("canvasWrap");connectionType=this.graphPreferences.connectionType;connectionBehavior=xn.FIXED;markerStart=_e.START_ALL_STATES;markerEnd=_e.END_ALL_STATES;perf=lo.graph.perf;perfHud=u(QP).visible;savedViewport=LM();viewportStore=YM({savedViewport:this.savedViewport,hasCompletedInitialLayout:()=>this.layoutFit.hasCompletedInitialLayout()});viewportPosition=this.viewportStore.viewportPosition;viewportScale=this.viewportStore.viewportScale;canZoomIn=this.viewportStore.canZoomIn;canZoomOut=this.viewportStore.canZoomOut;zoomMin=Cp;zoomMax=X_;texts=on;nodePositions=z(BM());nodeDrag=ZM({destroyRef:this.destroyRef,nodePositions:this.nodePositions});expansion=QM({nodes:this.loader.nodes});panelResize=UM({destroyRef:this.destroyRef,initialWidth:GM()??400,onCommit:e=>HM(e)});clampedPanelWidth=this.panelResize.clampedPanelWidth;loading=this.loader.loading;error=this.loader.error;visibleNodes=S(()=>this.filters.apply(this.loader.nodes(),this.issuePaths.bySeverity()));topology=S(()=>Wg(this.loader.nodes(),this.loader.scan()));layoutPositions=z(new Map);layoutComputedAtSignal=z(0);fullLayout=S(()=>Hn(ce({},this.topology()),{positions:this.layoutPositions(),computedAt:this.layoutComputedAtSignal()}));graph=S(()=>{let e=new Set(this.visibleNodes().map(r=>r.path)),n=this.filters.selectedLinkKinds(),o=n.length>0?new Set(n):null;return Yg(this.fullLayout(),e,this.nodePositions(),o)});hasData=S(()=>this.graph().nodes.length>0);showEmptyState=S(()=>!this.hasData()&&!this.filters.kindToggleExplicitEmpty()&&this.filters.searchText().trim().length===0);visibleCount=S(()=>this.graph().nodes.length);totalCount=S(()=>this.loader.nodes().length);edgeCount=S(()=>this.graph().edges.length);layoutComputedAt=S(()=>this.layoutComputedAtSignal());connectionSides=S(()=>MP(this.graphPreferences.layoutAlgorithm(),this.graphPreferences.layoutDirection()));inputSide=S(()=>this.connectionSides().input);outputSide=S(()=>this.connectionSides().output);selectedNodeId=z(null);selectedPath=S(()=>{let e=this.selectedNodeId();return e?this.graph().nodes.find(o=>o.id===e)?.view.path:void 0});selectionGuard=J(()=>{let e=this.selectedNodeId();if(e===null)return;this.graph().nodes.some(o=>o.id===e)||this.selectedNodeId.set(null)});pathsFingerprint=S(()=>this.loader.nodes().map(e=>e.path).sort().join("|"));layoutFit=JM({visibleNodes:this.visibleNodes,pathsFingerprint:this.pathsFingerprint,savedViewport:this.savedViewport,fit:()=>this.fitToScreenClamped(),animatedFit:()=>this.animatedFitToScreen()});constructor(){let e=S(()=>this.loader.nodes().map(r=>({id:r.path,view:{path:r.path}})),{equal:(r,a)=>{if(r.length!==a.length)return!1;for(let s=0;s<r.length;s++)if(r[s]?.id!==a[s]?.id)return!1;return!0}});PM({selectedPath:this.selectedPath,setSelectedNodeId:r=>this.selectedNodeId.set(r),readSelectedNodeId:()=>this.selectedNodeId(),graphNodes:e,onDeepLinkSelect:r=>{this.pendingCenterNodeId=r},router:this.router,route:this.route}),J(()=>{let r=this.loader.nodes();if(r.length===0)return;let a=this.fullLayout();if(a.positions.size===0)return;let s=EM({nodes:r,current:this.nodePositions(),layout:a});s.dirty&&(this.nodePositions.set(s.next),_p(s.next))}),J(()=>{this.layoutComputedAt(),this.autoFitPending&&(this.autoFitPending=!1,this.runAnimatedFit())}),J(()=>{this.layoutComputedAt();let r=this.layoutFit.hasCompletedInitialLayout(),a=this.pendingCenterNodeId;a===null||!r||this.fullLayout().positions.size!==0&&(this.pendingCenterNodeId=null,yo(()=>this.centerOnNode(a),{injector:this.injector}))});let n="",o="";J(()=>{let r=this.loader.nodes(),a=this.topology(),s={algorithm:this.graphPreferences.layoutAlgorithm(),direction:this.graphPreferences.layoutDirection(),spacing:this.graphPreferences.layoutSpacing()};if(r.length===0)return;let c=Ug(r,a.edges),l=`${s.algorithm}|${s.direction}|${s.spacing}`,f=`${c}|${l}`;if(f===n)return;let m=o!==""&&o!==l;n=f,o=l,(s.algorithm==="force"?Promise.resolve(Kg(r,a.edges)):Promise.resolve().then(()=>$g(this.dagreLayout,r,a.edges,s))).then(P=>{this.layoutPositions.set(P),this.layoutComputedAtSignal.set(performance.now()),m&&(this.nodePositions.set(new Map),this.fitToScreenClamped())}).catch(P=>{console.error("[graph-view] layout failed:",P)})})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}onLoaded(){}onCanvasChange=this.viewportStore.onCanvasChange;fitToScreenClamped(){let e=this.canvas(),n=this.zoom();e&&(e.fitToScreen({x:40,y:40},!1),yo(()=>{let o=e.transform.scale;if(o<=this.zoomMax&&o>=this.zoomMin)return;let r=Math.max(this.zoomMin,Math.min(o,this.zoomMax)),a=Math.abs(o-r),s=o>r?Et.ZOOM_OUT:Et.ZOOM_IN;n?.setZoom(this.getViewportCenter(),a,s,!1)},{injector:this.injector}))}autoFitAnimToken=0;autoFitPending=!1;pendingCenterNodeId=null;animatedFitToScreen(){this.autoFitPending=!0}runAnimatedFit(){let e=this.canvasWrap()?.nativeElement;if(!e)return;let n={width:e.clientWidth,height:e.clientHeight},o=this.fullLayout().positions;if(o.size===0)return;let r=this.nodePositions(),a=this.visibleNodes().map(f=>f.path),s=[];for(let f of a){let m=r.get(f)??o.get(f);m&&s.push({x:m.x,y:m.y})}if(s.length===0)return;let c=yp({points:s,wrap:n,panelW:this.selectedNodeId()!==null?this.clampedPanelWidth():0,zoomMin:this.zoomMin});if(!c)return;let l=++this.autoFitAnimToken;Gr({readPosition:()=>this.viewportPosition(),readScale:()=>this.viewportScale(),writePosition:f=>this.viewportPosition.set(f),writeScale:f=>this.viewportScale.set(f),isStaleToken:()=>l!==this.autoFitAnimToken},c,tk)}centerOnNode(e){let n=this.canvasWrap()?.nativeElement;if(!n)return;let o=this.nodePositions().get(e)??this.fullLayout().positions.get(e);if(!o)return;let r=WM({point:o,wrap:{width:n.clientWidth,height:n.clientHeight},panelW:this.selectedNodeId()!==null?this.clampedPanelWidth():0,scale:this.viewportScale()}),a=++this.autoFitAnimToken;Gr({readPosition:()=>this.viewportPosition(),readScale:()=>this.viewportScale(),writePosition:s=>this.viewportPosition.set(s),writeScale:s=>this.viewportScale.set(s),isStaleToken:()=>a!==this.autoFitAnimToken},r,tk)}onNodePositionChange(e,n){this.nodeDrag.onNodePositionChange(e,n)}zoomIn(){this.zoom()?.setZoom(this.getViewportCenter(),ek,Et.ZOOM_IN,!0)}zoomOut(){this.zoom()?.setZoom(this.getViewportCenter(),ek,Et.ZOOM_OUT,!0)}fitToScreen(){this.fitToScreenClamped()}resetLayout(){let e=on.resetLayoutConfirm;this.confirmationService.confirm({header:e.header,message:e.message,icon:"pi pi-exclamation-triangle",acceptButtonProps:{label:e.accept,severity:"danger"},rejectButtonProps:{label:e.reject,severity:"secondary",outlined:!0},accept:()=>{this.nodePositions.set(new Map),this.expansion.resetAll(),this.fitToScreenClamped()}})}getViewportCenter(){let e=this.canvasWrap()?.nativeElement;if(!e)return{x:0,y:0};let n=e.getBoundingClientRect();return{x:n.width/2,y:n.height/2}}onNodePointerDown(e){this.nodeDrag.onNodePointerDown(e)}selectNode(e,n){this.nodeDrag.isClickWithoutDrag(n)&&(this.selectedNodeId.set(e.id),this.usageTracker.trackFeature("inspector"))}tagSelection=KM({flow:this.flow,nodes:this.loader.nodes,fullLayout:S(()=>this.fullLayout()),canvasWrap:()=>{let e=this.canvasWrap()?.nativeElement;return e?{width:e.clientWidth,height:e.clientHeight}:null},selectedNodeId:this.selectedNodeId,clampedPanelWidth:this.clampedPanelWidth,zoomMin:Cp,viewportPosition:this.viewportPosition,viewportScale:this.viewportScale});activeTagSelection=this.tagSelection.activeTagSelection;selectionState=XM({graph:this.graph,selectedNodeId:this.selectedNodeId,activeTagSelection:this.activeTagSelection});onTagSelect(e){this.tagSelection.onTagSelect(e)}closePanel(){this.selectedNodeId.set(null)}onEscape(){this.selectedNodeId()!==null&&(typeof document<"u"&&OM(document)||this.closePanel())}resetFilters(){this.filters.reset()}onPanelResizeStart(e){this.panelResize.onPanelResizeStart(e)}openNode(e){this.selectedNodeId.set(e.id)}onCanvasClick(e){let n=e.target;n?.closest(".sm-gnode")||n?.closest(".graph__toolbar")||n?.closest(".perf-hud")||n?.closest(".kind-palette")||n?.closest(".graph__panel")||this.selectedNodeId.set(null)}isSelected(e){return this.selectionState.isSelected(e)}isHighlighted(e){return this.selectionState.isHighlighted(e)}isDimmed(e){return this.selectionState.isDimmed(e)}selectionFor(e){return this.selectionState.selectionView().get(e)??iee}isExpanded(e){return this.expansion.isExpanded(e)}setExpanded(e,n){this.expansion.setExpanded(e,n)}onFavoriteToggle(e){this.loader.toggleFavorite(e.path,e.value)}isEdgeHighlighted(e){return this.selectionState.isEdgeHighlighted(e)}isEdgeDimmed(e){return this.selectionState.isEdgeDimmed(e)}edgeOpacity(e){if(this.isEdgeDimmed(e))return JJ;let n=typeof e.confidence=="number"?e.confidence:nee;return eee+tee*n}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=K({type:t,selectors:[["sm-graph-view"]],viewQuery:function(n,o){n&1&&Tt(o.flow,cr,5)(o.canvas,sr,5)(o.zoom,dr,5)(o.canvasWrap,HJ,5),n&2&&ct(4)},hostBindings:function(n,o){n&1&&H("keydown.escape",function(){return o.onEscape()},Ur)},features:[ge([Ti,gv(F_,{mode:Cn.MANUAL})])],decls:6,vars:2,consts:[["canvasWrap",""],["data-testid","graph-view",1,"graph"],["data-testid","graph-loading",1,"empty-state"],["data-testid","graph-error",1,"empty-state"],["data-testid","graph-empty",1,"empty-state"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"smMiddleMousePan"],["styleClass","graph__confirm","maskStyleClass","graph__confirm-mask","data-testid","graph-reset-layout-confirm",3,"ariaLabel"],[1,"empty-state__icon","fa-solid","fa-spinner","fa-spin"],[1,"empty-state__title"],[1,"empty-state__icon","empty-state__icon--error","fa-solid","fa-circle-exclamation"],[1,"empty-state__desc"],["aria-hidden","true",1,"pi","pi-filter-slash","empty-state__icon"],["data-testid","graph-empty-filtered",1,"empty-state__title"],["size","small","data-testid","graph-reset-filters",3,"onClick","label","text"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"click","smMiddleMousePan"],["fDraggable","",3,"fLoaded","fCache"],[3,"fAlignThreshold"],["fZoom","",3,"fCanvasChange","position","scale","fZoomStep","fZoomDblClickStep","fZoomMinimum","fZoomMaximum","debounceTime"],["ngProjectAs","[fConnections]",5,["","fConnections",""]],[3,"fOutputId","fInputId","fOutputSide","fInputSide","fType","fBehavior","fReassignDisabled","class","f-conn--highlighted","f-conn--dimmed","opacity"],["ngProjectAs","[fNodes]",5,["","fNodes",""]],[1,"graph__filter-stack"],["role","complementary","data-testid","graph-panel",1,"graph__panel"],["role","separator","aria-orientation","vertical","data-testid","graph-panel-resize",1,"graph__panel-resize",3,"mousedown"],[1,"graph__panel-scroll"],["mode","embedded",3,"tagSelect","path","activeTag"],[3,"visible","total","edges"],["role","toolbar","data-testid","graph-toolbar",1,"graph__toolbar"],["icon","pi pi-search-plus","severity","secondary","size","small","data-testid","graph-zoom-in",3,"onClick","ariaLabel","pTooltip","text","rounded","disabled"],["icon","pi pi-search-minus","severity","secondary","size","small","data-testid","graph-zoom-out",3,"onClick","ariaLabel","pTooltip","text","rounded","disabled"],["icon","pi pi-stop","severity","secondary","size","small","data-testid","graph-fit-to-screen",3,"onClick","ariaLabel","pTooltip","text","rounded"],["aria-hidden","true",1,"graph__toolbar-sep"],["icon","pi pi-history","severity","secondary","size","small","data-testid","graph-reset-layout",3,"onClick","ariaLabel","pTooltip","text","rounded"],[3,"fOutputId","fInputId","fOutputSide","fInputSide","fType","fBehavior","fReassignDisabled"],["fMarker","","viewBox","0 0 9 9","markerUnits","userSpaceOnUse",1,"sm-edge-dot",3,"type","width","height","refX","refY"],["cx","4.5","cy","4.5","r","3.5"],[3,"type"],["ngProjectAs","[fNodes]",5,["","fNodes",""],4,"fVirtualFor","fVirtualForOf"],["fNode","","fDragHandle","","fNodeInput","","fNodeOutput","",1,"sm-gnode-host",3,"fNodePositionChange","pointerdown","click","dblclick","fNodeId","fNodePosition","fInputId","fInputConnectableSide","fOutputId","fOutputConnectableSide"],[3,"expandedChange","favoriteToggle","node","stats","summary","selection","expanded","isFavorite"],[1,"sm-gnode__marker-anchor"],["slot","graph.node.alert",3,"node"],["fNode","","fDragHandle","","fNodeInput","","fNodeOutput","","fInputConnectableSide","top","fOutputConnectableSide","bottom",1,"sm-gnode-host",3,"fNodeId","fNodePosition","fInputId","fOutputId"],["fNode","","fDragHandle","","fNodeInput","","fNodeOutput","","fInputConnectableSide","top","fOutputConnectableSide","bottom",1,"sm-gnode-host",3,"fNodePositionChange","pointerdown","click","dblclick","fNodeId","fNodePosition","fInputId","fOutputId"]],template:function(n,o){n&1&&(p(0,"section",1),T(1,VJ,4,1,"div",2)(2,jJ,6,2,"div",3)(3,UJ,5,3,"div",4)(4,QJ,31,39,"div",5),R(5,"p-confirmdialog",6),h()),n&2&&(d(),I(o.loading()&&!o.hasData()?1:o.error()&&!o.hasData()?2:o.showEmptyState()?3:4),d(4),M("ariaLabel",o.texts.resetLayoutConfirm.header))},dependencies:[Ev,cr,sr,Cv,yv,dr,Sv,R0,A0,xv,ev,iv,bv,wv,Ef,J0,Tv,hv,FP,qP,HP,$P,KP,XP,SM,dn,cn,ca,sa,Oe,De,gn,TM],styles:["[_nghost-%COMP%]{display:block;height:100%}.graph[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%]{position:relative;flex:1;min-height:0;background:var(--sm-bg-content);overflow:hidden;--ff-connection-drag-handle-stroke: transparent;--ff-connection-drag-handle-fill: transparent;--ff-canvas-background-color: transparent}.graph__filter-stack[_ngcontent-%COMP%]{position:absolute;top:16px;left:16px;z-index:2;display:flex;flex-direction:column;gap:8px;pointer-events:none}.graph__filter-stack[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{pointer-events:auto}.graph__canvas-wrap[_ngcontent-%COMP%] f-flow[_ngcontent-%COMP%]{width:100%;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%] .f-connection-drag-handle{fill:transparent;stroke:transparent}.graph__panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;background:var(--sm-bg-content);border-left:1px solid var(--sm-border);box-shadow:0 4px 24px #0000002e;transform:translate(100%);transition:transform .22s ease;z-index:20;pointer-events:none;display:flex;overflow:hidden}.graph__panel.is-open[_ngcontent-%COMP%]{transform:translate(0);pointer-events:auto}.graph__panel-scroll[_ngcontent-%COMP%]{flex:1;min-height:0;min-width:0;overflow-y:auto}.graph__panel-resize[_ngcontent-%COMP%]{position:absolute;top:0;left:0;bottom:0;width:6px;cursor:ew-resize;z-index:2;background:transparent;transition:background .12s ease}.graph__panel-resize[_ngcontent-%COMP%]:hover, .graph__panel-resize[_ngcontent-%COMP%]:active{background:color-mix(in srgb,var(--p-primary-color) 30%,transparent)}.graph__toolbar[_ngcontent-%COMP%]{position:absolute;bottom:16px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:2px;padding:4px;background:var(--sm-bg-content);border:1px solid var(--sm-border);border-radius:var(--sm-radius-pill);box-shadow:var(--sm-shadow-floating);z-index:2;pointer-events:auto;transition:box-shadow .22s ease}.graph__toolbar-sep[_ngcontent-%COMP%]{width:1px;height:18px;margin:0 2px;background:var(--sm-border);flex-shrink:0}.sm-gnode-host[_ngcontent-%COMP%]{position:relative;display:inline-block;cursor:pointer;--ff-node-width: auto;--ff-node-min-height: 0;--ff-node-padding: 0;--ff-node-background-color: transparent;--ff-node-border-color: transparent;--ff-node-border-color-selected: transparent;--ff-node-border-radius: 0;--ff-node-shadow: none;--ff-node-shadow-selected: none}.sm-gnode-host.f-selected[_ngcontent-%COMP%]{filter:drop-shadow(0 0 6px var(--p-primary-color-300))}.sm-gnode-host.f-selected[_ngcontent-%COMP%] > .sm-gnode[_ngcontent-%COMP%]{box-shadow:0 0 0 3px var(--p-primary-color),var(--sm-shadow-card)}.f-conn--invokes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes);--ff-connection-width: 1.5px;--ff-marker-color: var(--sm-edge-invokes)}.f-conn--references[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references);--ff-connection-width: 1.25px;--ff-marker-color: var(--sm-edge-references)}.f-conn--mentions[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions);--ff-connection-width: 1px;--ff-marker-color: var(--sm-edge-mentions)}.f-conn--supersedes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes);--ff-connection-width: 1.25px;--ff-marker-color: var(--sm-edge-supersedes)}.graph__canvas-wrap[_ngcontent-%COMP%] .f-conn--supersedes .f-connection-path{stroke-dasharray:none}.f-conn--highlighted[_ngcontent-%COMP%]{--ff-connection-width: 2px}.f-conn--dimmed[_ngcontent-%COMP%]{opacity:.15}.f-connection.f-selected[_ngcontent-%COMP%]{--ff-connection-width: 2.5px}.f-conn--invokes.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes-active);--ff-connection-selected-color: var(--sm-edge-invokes-active);--ff-marker-color: var(--sm-edge-invokes-active)}.f-conn--references.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references-active);--ff-connection-selected-color: var(--sm-edge-references-active);--ff-marker-color: var(--sm-edge-references-active)}.f-conn--mentions.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions-active);--ff-connection-selected-color: var(--sm-edge-mentions-active);--ff-marker-color: var(--sm-edge-mentions-active)}.f-conn--supersedes.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes-active);--ff-connection-selected-color: var(--sm-edge-supersedes-active);--ff-marker-color: var(--sm-edge-supersedes-active)}.sm-gnode__marker-anchor[_ngcontent-%COMP%]{position:absolute;top:-10px;right:-10px;z-index:4;display:inline-flex;align-items:center;gap:.25rem;pointer-events:none;transition:opacity .15s ease}sm-node-card.sm-gnode--dimmed[_ngcontent-%COMP%] + .sm-gnode__marker-anchor[_ngcontent-%COMP%]{opacity:.25}sm-node-card.sm-gnode--deprecated[_ngcontent-%COMP%] + .sm-gnode__marker-anchor[_ngcontent-%COMP%]{opacity:.55}"],changeDetection:0})}return t})();export{lfe as GraphView};