@skill-map/cli 0.16.6 → 0.17.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.
@@ -0,0 +1,247 @@
1
+ import{d as co,e as lo,f as uo,i as fo,j as ho,k as po,l as mo,m as lh,n as _o}from"./chunk-WMWULWZX.js";import{$ as k,$a as dn,A as $,Aa as Ct,Ac as oh,B as fe,Ba as nt,Bb as eh,Bc as ln,C as cn,Ca as Un,Cc as oo,D as W,Da as It,Db as io,E as Ce,Ea as Le,Eb as th,Ec as rh,F as qi,Fa as Qi,G as Uf,Ga as Te,H as Vn,Ha as v,Hc as sh,I as Wf,Ia as I,Ic as ah,J as l,Ja as Wn,Jc as ch,K as $f,Ka as $n,Kc as dh,L as qf,La as Zf,M as Xf,N as Wl,O as Xi,P as J,Pa as qn,Q as Yi,Qa as St,Qc as Yn,R as be,Ra as q,Rc as ro,S as Yf,Sa as Ie,T as he,U as me,Ua as Xn,X as K,Yc as un,Zc as fn,_ as N,aa as Ne,ab as dt,ba as re,bb as H,bd as lt,ca as se,cb as it,cd as ut,d as y,da as P,db as A,dd as so,ea as p,eb as Se,fa as m,fb as Ji,fd as hn,g as Hf,ga as G,gb as ql,gd as pn,ha as Ve,hb as Ht,i as jf,ia as Xe,id as ao,ja as bt,jb as pe,ka as zt,kb as ze,l as h,la as Bt,m as Wi,ma as tt,n as oe,na as Ki,nc as nh,o as an,oa as Zi,p as c,pa as Fe,pb as Qf,q as Vf,r as Z,ra as ie,rb as eo,s as Q,sa as _,sb as to,t as qe,ta as Gt,tb as no,u as je,ua as ve,v as $i,va as Kf,w as Ke,x as ct,xa as gt,y as jn,ya as yt,za as $l,zb as Jf,zc as ih}from"./chunk-5ZGVBIPP.js";import{a as de,b as Ul}from"./chunk-Q7L6LLAK.js";var jt=class{constructor(i,e,n,o,r){this.center=i,this.radiusX=e,this.radiusY=n,this.startAngle=o,this.endAngle=r}},O=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}},V=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=O.sum(this,i);return t.fromPoint(e)}sub(i){let e=O.sub(this,i);return t.fromPoint(e)}subNumber(i){let e=O.sub(this,new t(i,i));return t.fromPoint(e)}div(i){let e=O.div(this,i);return t.fromPoint(e)}mult(i){let e=O.mult(this,i);return t.fromPoint(e)}matrixTransform(i){let e=O.matrixTransform(this,i);return t.fromPoint(e)}elementTransform(i){let e=O.elementTransform(this,i);return t.fromPoint(e)}},Kn=class{static initialize(i=O.initialize(),e=O.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))}},Vt=class{constructor(i,e){this.point1=i,this.point2=e}},z=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=O.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),s=Math.max(e.x+e.width,n.x+n.width),a=Math.max(e.y+e.height,n.y+n.height);return t.initialize(o,r,s-o,a-r)},i[0])}static elementTransform(i,e){let n=e.getBoundingClientRect(),o=O.sub(i,O.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 uh(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 z.initialize(t.x-o,t.y-r,e,n)}function Yl(t,i){t=z.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 fh(t,i){t=z.updateIsNotFinite(t),i.setAttribute("viewBox",`${t.x} ${t.y} ${t.width} ${t.height}`)}var xe=class t{constructor(i=0,e=0,n=0,o=0,r=0,s=0,a=0,d=0){this.x=i,this.y=e,this.width=n,this.height=o,this.radius1=r,this.radius2=s,this.radius3=a,this.radius4=d,this.gravityCenter=O.initialize(),this.gravityCenter=this.calculateGravityCenter(this)}calculateGravityCenter(i){return new V(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}},ot=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 Am(){return{position:O.initialize(),scaledPosition:O.initialize(),scale:1,rotate:0}}function Lm(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:O.initialize(),scale:Number(e[0]),rotate:0}}return i}var Tt=class{static toString(i){let e=O.sum(i.position,i.scaledPosition);return`matrix(${i.scale}, 0, 0, ${i.scale}, ${e.x}, ${e.y})`}static fromString(i){return Lm(i)}static default(){return Am()}},Ue=class t{static initialize(i=0,e=0){return O.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}},Xl=class{static parseRoundedRect(i){let e=Math.PI*.5,n=i.x,o=i.y,r=i.x+i.width,s=i.y+i.height,a=i.x+i.radius1,d=i.y+i.radius1,u=i.x+i.width-i.radius2,f=i.y+i.radius2,g=i.x+i.width-i.radius3,x=i.y+i.height-i.radius3,w=i.x+i.radius4,M=i.y+i.height-i.radius4;return[new jt({x:a,y:d},i.radius1,i.radius1,2*e,3*e),new Vt({x:a,y:o},{x:u,y:o}),new jt({x:u,y:f},i.radius2,i.radius2,3*e,4*e),new Vt({x:r,y:f},{x:r,y:x}),new jt({x:g,y:x},i.radius3,i.radius3,0,e),new Vt({x:g,y:s},{x:w,y:s}),new jt({x:w,y:M},i.radius4,i.radius4,e,2*e),new Vt({x:n,y:M},{x:n,y:d})]}},mn=class{static getRoundedRectIntersections(i,e,n){let o=Xl.parseRoundedRect(n);for(let r of o)if(r instanceof jt){let s=this.intersectArcWithLine(r,i,e);if(s.length>0)return s}else if(r instanceof Vt){let s=this.intersectLineSegments(i,e,r.point1,r.point2);if(s)return[s]}return[]}static getRoundedRectIntersectionsWithSVGPath(i,e){let n=i.getTotalLength(),o=[];for(let r=0;r<=n;r+=1){let s=i.getPointAtLength(r);o.push({x:s.x,y:s.y})}for(let r=1;r<o.length;r++){let s=this.getRoundedRectIntersections(o[r-1],o[r],e);if(s.length>0)return s}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,s=e.y-i.y,a=o.x-n.x,d=o.y-n.y,u=(-s*(i.x-n.x)+r*(i.y-n.y))/(-a*s+r*d),f=(a*(i.y-n.y)-d*(i.x-n.x))/(-a*s+r*d);return u>=0&&u<=1&&f>=0&&f<=1?{x:i.x+f*r,y:i.y+f*s}: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 s=[];for(let a of i){let d=this.normalizeAngle(Ue.angle(Ue.initialize(1,0),Ue.initialize(a.x-n.x,a.y-n.y)));d<o&&(d+=2*Math.PI),o<=d&&d<=r&&s.push(a)}return s}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 s=Ue.initialize(o.x,o.y),a=Ue.fromPoints(o,r),d=Ue.initialize(i.x,i.y),u=Ue.subtract(s,d),f=Ue.initialize(a.x/(e*e),a.y/(n*n)),g=Ue.initialize(u.x/(e*e),u.y/(n*n)),x=Ue.dotProduct(a,f),w=Ue.dotProduct(a,g),M=Ue.dotProduct(u,g)-1,T=w*w-x*M;return T<0?[]:this.calculateIntersectionPoints(T,x,w,o,r)}static calculateIntersectionPoints(i,e,n,o,r){let s=[];if(i>0){let a=Math.sqrt(i),d=(-n-a)/e,u=(-n+a)/e;d>=0&&d<=1&&s.push(O.interpolatePoints(o,r,d)),u>=0&&u<=1&&s.push(O.interpolatePoints(o,r,u))}else{let a=-n/e;a>=0&&a<=1&&s.push(O.interpolatePoints(o,r,a))}return s}};var Kl=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}},E=class t{constructor(){this._injector=c(je)}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 Kl;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)}};E.pipelines=new Map;E.\u0275fac=function(i){return new(i||E)};E.\u0275prov=h({token:E,factory:E.\u0275fac});function C(t){return function(i){E.registerPipeline(t,i,!1)}}var zm=(()=>{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=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Bm=(()=>{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=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Gm=new oe("F_LOCAL_STORAGE",{providedIn:"root",factory:()=>no(c(qi))?c(zm):c(Bm)}),Hm=(()=>{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=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),jm=(()=>{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=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Vm=new oe("F_WINDOW",{providedIn:"root",factory:()=>no(c(qi))?c(Hm):c(jm)}),Dt=(function(t){return t.MAC_OS="macos",t.IOS="ios",t.WINDOWS="windows",t.ANDROID="android",t.LINUX="linux",t})(Dt||{}),Zl;try{Zl=typeof Intl<"u"&&Intl.v8BreakIterator}catch{Zl=!1}var Ql=(()=>{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||Zl)&&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?no(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=Dt.MAC_OS:this.IOS?r=Dt.IOS:o.test(e)?r=Dt.WINDOWS:this.ANDROID?r=Dt.ANDROID:!r&&/linux/.test(e)&&(r=Dt.LINUX),r}static \u0275fac=function(n){return new(n||t)(an(qi))};static \u0275prov=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),we=(()=>{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 s=parseFloat(e)/100;return Math.max(n,o)*s}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 s=this.window.innerHeight/100;return parseFloat(e)*s}else if(e.endsWith("vw")){let s=this.window.innerWidth/100;return parseFloat(e)*s}}return parseFloat(e)||0}static \u0275fac=function(n){return new(n||t)(an($i),an(Vm),an(Gm),an(Ql))};static \u0275prov=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Jl(t,i){return t.reduce((e,n)=>[...e,...i(n)],[])}function eu(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"?mh(t,i):(n==="input"||n==="select"||n==="textarea")&&ph(t,i),hh("canvas",t,i,mh),hh("input, textarea, select",t,i,ph),i}function hh(t,i,e,n){let o=i.querySelectorAll(t);if(o.length){let r=e.querySelectorAll(t);for(let s=0;s<o.length;s++)n(o[s],r[s])}}var Um=0;function ph(t,i){i.type!=="file"&&(i.value=t.value),i.type==="radio"&&i.name&&(i.name=`mat-clone-${i.name}-${Um++}`)}function mh(t,i){let e=i.getContext("2d");if(e)try{e.drawImage(t,0,0)}catch{}}function tu(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 _h(t){tu(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 gh(t,i,e){return Wm(t,e).dataset[i]}function Wm(t,i){return t.closest(i)}function nu(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 Zn(t,i){let e=$m(t,i);return!!e&&!e.classList.contains(i+"-disabled")}function $m(t,i){return t.closest(i)}function vt(t){return t.match(/^[a-zA-Z_]/)||(t="_"+t),t.replace(/[^a-zA-Z0-9_\-:.]/g,"_")}function _n(t,i,e){let n=e[t.toUpperCase()]||qm(e,t.toLowerCase());if(n===void 0)throw new Error(`Unknown ${i}: ${t}. Accepted values: ${Object.keys(e).join(", ")}`);return n}function qm(t,i){return Object.keys(t).find(e=>t[e]===i)}var Xm=["markerElement"],Ym=["fConnectionGradientRenderer",""],Km=["f-connection-path",""],Zm=["fConnectionSelection",""],Qm=["f-connection-drag-handle-start",""],Jm=["f-connection-drag-handle-end",""],e_=["defs"],t_=["*"],n_=["fGroupsContainer"],i_=["fNodesContainer"],o_=["fConnectionsContainer"],r_=[[["","fGroup",""],["","fGroups",""]],[["f-snap-connection"]],[["f-connection"],["","fConnections",""]],[["f-connection-for-create"]],[["","fNode",""],["","fNodes",""]]],s_=["[fGroup], [fGroups]","f-snap-connection","f-connection, [fConnections]","f-connection-for-create","[fNode], [fNodes]"],a_=[[["svg","fMarker",""]],[["f-connection-marker-circle"],["f-connection-marker-arrow"]],[["f-connection-gradient"]],[["f-connection-waypoints"]],[["","fConnectionContent",""]]],c_=["svg[fMarker]","f-connection-marker-circle, f-connection-marker-arrow","f-connection-gradient","f-connection-waypoints","[fConnectionContent]"];function d_(t,i){t&1&&(qe(),G(0,"linearGradient",3)),t&2&&P("fConnectionGradientRendererFor",i)}function l_(t,i){t&1&&(qe(),G(0,"circle",6))}function u_(t,i){t&1&&ve(0,4)}var f_="[_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}",h_=[[["","fDefinitions",""]],[["f-background"]],[["f-line-alignment"]],[["f-canvas"]],[["f-selection-area"]],"*"],p_=["[fDefinitions]","f-background","f-line-alignment","f-canvas","f-selection-area","*"],au=new oe("F_BACKGROUND_PATTERN"),ja=class{fPattern;static fToken=Symbol("AddPatternToBackgroundRequest");constructor(i){this.fPattern=i}},vn=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 Ut(t){return{name:t}}var cu=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()}},ei=class extends vn{kind;constructor(i){super(),this.kind=i}},du=class extends vn{kind="Connection Marker"},lu=class extends vn{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}},uu=class extends vn{kind="Node"},gn=class{notifyOnSubscribe;static fToken=Symbol("ListenConnectionsChangesRequest");constructor(i=!0){this.notifyOnSubscribe=i}};function m_(){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 __(){return t=>{let i=null;return{callback:()=>{i!==null&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null,t()})},cleanup:()=>{i!==null&&cancelAnimationFrame(i),i=null}}}}function Va(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 Qe=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)}},fu=class extends Qe{_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}},ht=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=[],s=[];for(let g of[...this._operators].reverse()){let x=g(n);n=x.callback,x.cleanup&&o.push(x.cleanup),x.onSubscribe&&r.push(x.onSubscribe),x.setTeardown&&s.push(x.setTeardown)}let a=this._channels.map(g=>g.listen(()=>n())),d=null,u=!1,f=()=>{u||(u=!0,d?.(),d=null,a.forEach(g=>g()),o.forEach(g=>g()))};s.slice().reverse().forEach(g=>g(f)),r.slice().reverse().forEach(g=>g(n)),d=i.onDestroy(f)}};function pl(){return t=>{let i=!0;return{callback:t,onSubscribe:e=>{queueMicrotask(()=>{i&&e()})},cleanup:()=>{i=!1}}}}function yh(){return t=>{let i=!1,e=null;return{setTeardown:n=>e=n,callback:()=>{if(!i){i=!0;try{t()}finally{e?.()}}}}}}var g_=(()=>{let t=class Co{_store=c(b);handle({notifyOnSubscribe:e}){return e?new ht(this._store.connectionsChanges$).pipe(pl(),Va(1)):new ht(this._store.connectionsChanges$).pipe(Va(1))}static \u0275fac=function(n){return new(n||Co)};static \u0275prov=h({token:Co,factory:Co.\u0275fac})};return t=y([C(gn)],t),t})(),hu=class{static fToken=Symbol("ListenNodesChangesRequest")},y_=(()=>{let t=class vo{_store=c(b);handle(e){return new ht(this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||vo)};static \u0275prov=h({token:vo,factory:vo.\u0275fac})};return t=y([C(hu)],t),t})(),Ua=class{static fToken=Symbol("ListenTransformChangesRequest")},C_=(()=>{let t=class xo{_store=c(b);handle(e){return new ht(this._store.transformChanges$,this._store.connectionsChanges$,this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||xo)};static \u0275prov=h({token:xo,factory:xo.\u0275fac})};return t=y([C(Ua)],t),t})(),Wt=class{static fToken=Symbol("EmitConnectionsChangesRequest")},v_=(()=>{let t=class wo{_store=c(b);handle(e){this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||wo)};static \u0275prov=h({token:wo,factory:wo.\u0275fac})};return t=y([C(Wt)],t),t})(),Rt=class{static fToken=Symbol("NotifyTransformChangedRequest")},b=(()=>{class t{transformChanges$=new Qe;viewportAnimationChanges$=new Qe;connectionsChanges$=new Qe;_connectionsRevision=0;connectionsRenderedChanges$=new Qe;_connectionsRenderedRevision=0;_connectionsRenderedNodesRevision=0;_viewportAnimationCount=0;nodesChanges$=new Qe;_nodesRevision=0;progressiveRenderChanges$=new Qe;_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 uu;connections=new lu;connectionMarkers=new du;outputs=new ei("Output");inputs=new ei("Input");outlets=new ei("Outlet");instances=new cu;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=h({token:t,factory:t.\u0275fac})}return t})(),_e={MAGNETIC_LINES:Ut("magnetic-lines"),MAGNETIC_RECTS:Ut("magnetic-rects"),ZOOM:Ut("zoom-controls"),BACKGROUND:Ut("background"),SELECTION_AREA:Ut("selection-area"),MINIMAP:Ut("minimap"),AUTO_PAN:Ut("auto-pan")},x_=(()=>{let t=class bo{_store=c(b);handle(e){this._store.transformChanged()}static \u0275fac=function(n){return new(n||bo)};static \u0275prov=h({token:bo,factory:bo.\u0275fac})};return t=y([C(Rt)],t),t})(),$t=class{key;instance;static fToken=Symbol("RegisterPluginInstanceRequest");constructor(i,e){this.key=i,this.instance=e}},w_=(()=>{let t=class Io{_store=c(b);handle({key:e,instance:n}){this._store.instances.add(e,n)}static \u0275fac=function(n){return new(n||Io)};static \u0275prov=h({token:Io,factory:Io.\u0275fac})};return t=y([C($t)],t),t})(),qt=class{key;static fToken=Symbol("RemovePluginInstanceRequest");constructor(i){this.key=i}},b_=(()=>{let t=class So{_store=c(b);handle({key:e}){this._store.instances.remove(e)}static \u0275fac=function(n){return new(n||So)};static \u0275prov=h({token:So,factory:So.\u0275fac})};return t=y([C(qt)],t),t})(),I_=[b,y_,g_,C_,v_,x_,w_,b_],S_=0,T_=(()=>{let t=class To{_store=c(b);_browser=c(we);get _backgroundElement(){return this._store.instances.get(_e.BACKGROUND)?.hostElement}handle(e){let n=this._getPatterns(e.fPattern?.hostElement);if(!n?.length)return;let o=Cn("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-"+S_++;let r=n[n.length-1].id,s=Cn("rect",this._browser);s.setAttribute("fill","url(#"+r+")"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),this._backgroundElement?.firstChild?.appendChild(s);let a=this._store.fCanvas?.transform||Tt.default();e.fPattern?.setTransform(a)}}_getPatterns(e){return Array.from(e?.getElementsByTagName("pattern")||[])}static \u0275fac=function(n){return new(n||To)};static \u0275prov=h({token:To,factory:To.\u0275fac})};return t=y([C(ja)],t),t})(),ti=class{fTransform;static fToken=Symbol("SetBackgroundTransformRequest");constructor(i){this.fTransform=i}},D_=(()=>{let t=class Do{_store=c(b);handle(e){this._store.instances.get(_e.BACKGROUND)?.setTransform(e.fTransform)}static \u0275fac=function(n){return new(n||Do)};static \u0275prov=h({token:Do,factory:Do.\u0275fac})};return t=y([C(ti)],t),t})(),E_=[T_,D_],Wa=class{instance;static fToken=Symbol("AddCanvasToStoreRequest");constructor(i){this.instance=i}},P_=(()=>{let t=class Eo{_store=c(b);handle({instance:e}){this._store.fCanvas=e}static \u0275fac=function(n){return new(n||Eo)};static \u0275prov=h({token:Eo,factory:Eo.\u0275fac})};return t=y([C(Wa)],t),t})(),$a=class{id;animated;static fToken=Symbol("CenterGroupOrNodeRequest");constructor(i,e){this.id=i,this.animated=e}},M_=(()=>{let t=class Po{_store=c(b);_mediator=c(E);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 xn(n,Xt.VIEWPORT_ONLY)))}_toCenter(e,n,o){this._transform.scaledPosition=O.initialize(),this._transform.position=O.initialize((n.width-e.width)/2-o.x*this._transform.scale,(n.height-e.height)/2-o.y*this._transform.scale)}_getNodeRect(e){return z.fromElement(e.hostElement)}_getFlowRect(){return z.fromElement(this._store.flowHost)}static \u0275fac=function(n){return new(n||Po)};static \u0275prov=h({token:Po,factory:Po.\u0275fac})};return t=y([C($a)],t),t})(),qa=class{toCenter;animated;static fToken=Symbol("FitToFlowRequest");constructor(i,e){this.toCenter=i,this.animated=e}},R_=(()=>{let t=class Mo{_store=c(b);get _transform(){return this._store.transform}_mediator=c(E);handle({toCenter:e,animated:n}){let o=this._mediator.execute(new En)||z.initialize();o.width===0||o.height===0||(this.fitToParent(o,z.fromElement(this._store.flowHost),this._store.nodes.getAll().map(r=>r._position),e),this._mediator.execute(new xn(n,Xt.VIEWPORT_ONLY)))}fitToParent(e,n,o,r){this._transform.scaledPosition=O.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let s=e.width/this._transform.scale+r.x,a=e.height/this._transform.scale+r.y;(s>n.width||a>n.height||s<n.width&&a<n.height)&&(this._transform.scale=Math.min(n.width/s,n.height/a));let d=(n.width-s*this._transform.scale)/2-this._transform.position.x*this._transform.scale,u=(n.height-a*this._transform.scale)/2-this._transform.position.y*this._transform.scale;this._transform.position=O.initialize(d+r.x/2*this._transform.scale,u+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 O.initialize(n,o)}static \u0275fac=function(n){return new(n||Mo)};static \u0275prov=h({token:Mo,factory:Mo.\u0275fac})};return t=y([C(qa)],t),t})(),Xa=class{transform;position;static fToken=Symbol("InputCanvasPositionRequest");constructor(i,e){this.transform=i,this.position=e}},N_=(()=>{let t=class Ro{_store=c(b);handle({transform:e,position:n}){n&&(O.isEqual(this._calculateTransformPosition(e),n)||(e.position=n,e.scaledPosition=O.initialize(),this._store.fCanvas?.redraw()))}_calculateTransformPosition(e){return O.sum(e.position,e.scaledPosition)}static \u0275fac=function(n){return new(n||Ro)};static \u0275prov=h({token:Ro,factory:Ro.\u0275fac})};return t=y([C(Xa)],t),t})(),Ya=class{transform;scale;static fToken=Symbol("InputCanvasScaleRequest");constructor(i,e){this.transform=i,this.scale=e}},k_=(()=>{let t=class No{_store=c(b);handle(e){!e.scale&&e.scale!==0||(e.transform.scale=e.scale,this._store.fCanvas?.redraw())}static \u0275fac=function(n){return new(n||No)};static \u0275prov=h({token:No,factory:No.\u0275fac})};return t=y([C(Ya)],t),t})(),Xt=(function(t){return t.VIEWPORT_ONLY="VIEWPORT_ONLY",t.WITH_CONNECTION_CHANGES="WITH_CONNECTION_CHANGES",t})(Xt||{}),xn=class{animated;context;static fToken=Symbol("RedrawCanvasWithAnimationRequest");constructor(i,e=Xt.WITH_CONNECTION_CHANGES){this.animated=i,this.context=e}};function Wh(t,i){let e=n=>{n.propertyName==="transform"&&(t.removeEventListener("transitionend",e),i(n))};t.addEventListener("transitionend",e)}var O_=(()=>{let t=class ko{_store=c(b);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(),Wh(this._canvas.hostElement,()=>{this._store.endViewportAnimation(),e===Xt.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()})}_redraw(e){this._canvas?.redraw(),e===Xt.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||ko)};static \u0275prov=h({token:ko,factory:ko.\u0275fac})};return t=y([C(xn)],t),t})(),Ka=class{static fToken=Symbol("RemoveCanvasFromStoreRequest")},F_=(()=>{let t=class Oo{_store=c(b);handle(e){this._store.fCanvas=void 0}static \u0275fac=function(n){return new(n||Oo)};static \u0275prov=h({token:Oo,factory:Oo.\u0275fac})};return t=y([C(Ka)],t),t})(),Za=class{static fToken=Symbol("ResetScaleRequest")},A_=(()=>{let t=class Fo{_store=c(b);get _transform(){return this._store.transform}handle(e){this._transform.scale=1,this._transform.scaledPosition=O.initialize()}static \u0275fac=function(n){return new(n||Fo)};static \u0275prov=h({token:Fo,factory:Fo.\u0275fac})};return t=y([C(Za)],t),t})(),Qa=class{animated;static fToken=Symbol("ResetScaleAndCenterRequest");constructor(i){this.animated=i}},L_=(()=>{let t=class Ao{_mediator=c(E);_store=c(b);get _transform(){return this._store.transform}handle({animated:e}){let n=this._mediator.execute(new En)||z.initialize();n.width===0||n.height===0||(this._oneToOneCentering(n,z.fromElement(this._store.flowHost),this._store.nodes.getAll().map(o=>o._position)),this._mediator.execute(new xn(e,Xt.VIEWPORT_ONLY)))}_oneToOneCentering(e,n,o){this._transform.scaledPosition=O.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let r=(n.width-e.width/this._transform.scale)/2-this._transform.position.x,s=(n.height-e.height/this._transform.scale)/2-this._transform.position.y;this._transform.scale=1,this._transform.position=O.initialize(r,s)}_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 O.initialize(n,o)}static \u0275fac=function(n){return new(n||Ao)};static \u0275prov=h({token:Ao,factory:Ao.\u0275fac})};return t=y([C(Qa)],t),t})(),Ja=class{scale;toPosition;static fToken=Symbol("UpdateScaleRequest");constructor(i,e){this.scale=i,this.toPosition=e}},z_=(()=>{let t=class Lo{_store=c(b);get _transform(){return this._store.transform}handle({scale:e,toPosition:n}){if(e===this._transform.scale)return;let o=O.sum(this._transform.scaledPosition,this._transform.position),r=n.x-(n.x-o.x)*e/this._transform.scale,s=n.y-(n.y-o.y)*e/this._transform.scale;this._transform.scale=e,this._transform.scaledPosition=O.sub(O.initialize(r,s),this._transform.position)}static \u0275fac=function(n){return new(n||Lo)};static \u0275prov=h({token:Lo,factory:Lo.\u0275fac})};return t=y([C(Ja)],t),t})(),B_=[P_,M_,R_,N_,k_,O_,F_,A_,L_,z_],pu=class{connection;static fToken=Symbol("AddConnectionForCreateToStoreRequest");constructor(i){this.connection=i}},G_=(()=>{let t=class zo{_store=c(b);handle({connection:e}){this._store.connections.addForCreate(e)}static \u0275fac=function(n){return new(n||zo)};static \u0275prov=h({token:zo,factory:zo.\u0275fac})};return t=y([C(pu)],t),t})(),mu=class{instance;static fToken=Symbol("AddConnectionMarkerToStoreRequest");constructor(i){this.instance=i}},H_=(()=>{let t=class Bo{_store=c(b);handle({instance:e}){this._store.connectionMarkers.add(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Bo)};static \u0275prov=h({token:Bo,factory:Bo.\u0275fac})};return t=y([C(mu)],t),t})(),ec=class{connection;static fToken=Symbol("AddConnectionToStoreRequest");constructor(i){this.connection=i}},j_=(()=>{let t=class Go{_store=c(b);handle({connection:e}){this._store.connections.add(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Go)};static \u0275prov=h({token:Go,factory:Go.\u0275fac})};return t=y([C(ec)],t),t})(),_u=class{connection;static fToken=Symbol("AddSnapConnectionToStoreRequest");constructor(i){this.connection=i}},V_=(()=>{let t=class Ho{_store=c(b);handle({connection:e}){this._store.connections.addForSnap(e)}static \u0275fac=function(n){return new(n||Ho)};static \u0275prov=h({token:Ho,factory:Ho.\u0275fac})};return t=y([C(_u)],t),t})(),wn=class{connection;static fToken=Symbol("CreateConnectionMarkersRequest");constructor(i){this.connection=i}},Ch=new oe("F_CONNECTION_CONTENT");var tc=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),s=new Array(o),a=0;for(let d=0;d<o;d++){let u=this.points[d+1].x-this.points[d].x,f=this.points[d+1].y-this.points[d].y,g=Math.hypot(u,f),x=g?u/g:1,w=g?f/g:0;s[d]={x,y:w},a+=g,r[d+1]=a}this.cumulativeLengths=r,this.segmentTangents=s,this.totalLength=a||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}},gu=class t{_polyline;constructor(i=[]){this._polyline=new tc(i)}updatePoints(i){return this._polyline=new tc(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,a=t._clamp(i,0,1)*r,d=.5;if(a<=d)return{point:e[0],tangent:o[0]??{x:1,y:0},atEdge:!0};if(r-a<=d){let R=e.length-1;return{point:e[R],tangent:o[R-1]??{x:1,y:0},atEdge:!0}}let u=t._findRightIndex(n,a),f=Math.max(1,u),g=n[f-1],x=n[f],w=t._safeRatio(a-g,x-g),M=e[f-1],T=e[f],S={x:t._lerp(M.x,T.x,w),y:t._lerp(M.y,T.y,w)},D=o[f-1]??{x:1,y:0};return{point:S,tangent:D,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}},$h=(function(t){return t.NONE="none",t.ALONG="along",t})($h||{}),yu=class{compute(i,e){let n=this._clamp01(e.position()),{point:o,tangent:r}=i.getPointAtLength(n),s={x:-r.y,y:r.x},a=e.offset()??0,d=o.x+s.x*a,u=o.y+s.y*a,g=this._sizeAlongDirection(e.hostElement,r)*.5,x=n*i.totalLength,w=i.totalLength-x,M=this._applyEdgeGuard(d,u,r,x,w,g),T=this._calculateContentRotation(e.align(),r);return{position:M,rotationDeg:T}}_clamp01(i){return i<=0?0:i>=1?1:i}_applyEdgeGuard(i,e,n,o,r,s){if(o<=s){let a=s-o;return{x:i+n.x*a,y:e+n.y*a}}if(r<=s){let a=s-r;return{x:i-n.x*a,y:e-n.y*a}}return{x:i,y:e}}_sizeAlongDirection(i,e){let n=z.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===$h.ALONG&&(n=Math.atan2(e.y,e.x)*180/Math.PI,n=this._keepUpright(n)),n}},Cu=class{_placement;constructor(i=new yu){this._placement=i}layout(i,e){let n=new gu(i),o=n.totalLength;for(let r of e){let{position:s,rotationDeg:a}=this._placement.compute(n,r);r.hostElement.style.transform=this._createTransformString(s,a)}return o}_createTransformString(i,e){return`translate3d(${i.x}px, ${i.y}px, 0) translate(-50%, -50%) rotate(${e}deg)`}};var vh=new oe("F_CONNECTION_WAYPOINTS");function qh(t,i,e){return(t.x-i.x)**2+(t.y-i.y)**2<=e**2}function U_(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.candidates().find(o=>qh(i,o,n))}function W_(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.waypoints().find(o=>qh(i,o,n))}function $_(t,i){for(let e of t){let n=W_(e,i);if(n&&e.fWaypoints()?.visibility())return{connection:e,waypoint:n};let o=U_(e,i);if(o&&e.fWaypoints()?.visibility())return{connection:e,candidate:o}}}var ml=new oe("F_CONNECTION_COMPONENTS_PARENT");var le=(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})(le||{}),vu=new oe("F_CONNECTION_MARKER"),q_=0,xu=class{fId=$(`f-marker-${q_++}`);hostElement=c(Ce).nativeElement};function X_(t,i=le.START){if(typeof t!="string")return i;let e=t.trim().toLowerCase();return e?Y_(e)??i:i}function Y_(t){switch(t){case"start":case"f-connection-marker-start":return le.START;case"end":case"f-connection-marker-end":return le.END;case"selected-start":case"f-connection-selected-marker-start":return le.SELECTED_START;case"selected-end":case"f-connection-selected-marker-end":return le.SELECTED_END;case"start-all-states":case"f-connection-marker-start-all-states":case"start-all":case"all-start":return le.START_ALL_STATES;case"end-all-states":case"f-connection-marker-end-all-states":case"end-all":case"all-end":return le.END_ALL_STATES;default:return null}}var Xh=(()=>{class t extends xu{_markerElement=Se.required("markerElement");_type=A(le.END_ALL_STATES,{alias:"type",transform:e=>X_(e,le.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=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-connection-marker-arrow"]],viewQuery:function(n,o){n&1&&Ct(o._markerElement,Xm,5),n&2&&nt()},hostAttrs:[1,"f-component",2,"display","none"],inputs:{_type:[1,"type","_type"]},features:[Ie([{provide:vu,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&&(qe(),Ve(0,"svg",1,0),bt(2,"path",2),Xe())},encapsulation:2})}return t})();var Pt=(function(t){return t.FIXED="fixed",t.FIXED_CENTER="fixed_center",t.FLOATING="floating",t})(Pt||{}),Be=(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})(Be||{});function K_({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||{}),Et=(function(t){return t.SEGMENT="segment",t.STRAIGHT="straight",t.BEZIER="bezier",t.ADAPTIVE_CURVE="adaptive-curve",t})(Et||{});function Z_({sourceRect:t,sourceConnectableSide:i,targetRect:e,targetConnectableSide:n}){return{point1:xh(t,i===F.AUTO?F.BOTTOM:i),point2:xh(e,n===F.AUTO?F.TOP:n)}}function xh(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 Yh(t,i,e,n){if(!n||!n.rotationDeg)return mn.getRoundedRectIntersections(t,i,e)[0];let o=jo(t,-n.rotationDeg,n.pivot),r=jo(i,-n.rotationDeg,n.pivot),s=Q_(e,-n.rotationDeg,n.pivot),a=mn.getRoundedRectIntersections(o,r,s)[0];return a?jo(a,n.rotationDeg,n.pivot):void 0}function Q_(t,i,e){let n=jo(J_(t),i,e);return new xe(n.x-t.width/2,n.y-t.height/2,t.width,t.height,t.radius1,t.radius2,t.radius3,t.radius4)}function J_(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function jo(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,s=Math.cos(r),a=Math.sin(r);return{x:n*s-o*a+e.x,y:n*a+o*s+e.y}}function eg({sourceRect:t,targetRect:i,sourceRotationContext:e,targetRotationContext:n}){return ig(tg(t,i,e),ng(t,i,n),t,i)}function tg(t,i,e){return Yh(t.gravityCenter,i.gravityCenter,t,e)}function ng(t,i,e){return Yh(i.gravityCenter,t.gravityCenter,i,e)}function ig(t,i,e,n){return{point1:t||e.gravityCenter,point2:i||n.gravityCenter}}var go=.5,og={[Pt.FLOATING]:eg,[Pt.FIXED_CENTER]:K_,[Pt.FIXED]:Z_},On=(()=>{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 s=o-e,a=r-n;return{sourceToTargetX:s,sourceToTargetY:a,targetToSourceX:-s,targetToSourceY:-a}}_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===Be.DEFAULT)return r;let s=Math.abs(n),a=Math.abs(o);if(s<go&&a<go)return r;let u=s>=a;switch(e){case Be.CALCULATE:return u?n>=0?F.RIGHT:F.LEFT:o>=0?F.BOTTOM:F.TOP;case Be.CALCULATE_HORIZONTAL:return s<go?r:n>=0?F.RIGHT:F.LEFT;case Be.CALCULATE_VERTICAL:return a<go?r:o>=0?F.BOTTOM:F.TOP;case Be.TOP:return F.TOP;case Be.BOTTOM:return F.BOTTOM;case Be.LEFT:return F.LEFT;case Be.RIGHT:return F.RIGHT;default:return r}}_getBehaviorHandler(e){let n=og[e];if(!n)throw new Error(`[Behavior] No handler for behavior: ${e}`);return n}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),st=class{sourceRect;targetRect;connection;sourceConnectableSide;targetConnectableSide;sourceRotationContext;targetRotationContext;constructor(i,e,n,o,r,s,a){this.sourceRect=i,this.targetRect=e,this.connection=n,this.sourceConnectableSide=o,this.targetConnectableSide=r,this.sourceRotationContext=s,this.targetRotationContext=a}};function _l(t,i,e){return[t,...e??[],i]}function rg(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 sg(t,i=32){let e=new Array(i+1);e[0]=de({},t[0]);for(let n=1;n<=i;n++)e[n]=Kh(t[0],t[1],t[2],t[3],n/i);return e}function Kh(t,i,e,n,o){let r=1-o,s=o*o,a=r*r,d=a*r,u=s*o;return{x:d*t.x+3*a*o*i.x+3*r*s*e.x+u*n.x,y:d*t.y+3*a*o*i.y+3*r*s*e.y+u*n.y}}function Zh(t){return t.map(i=>Kh(i.p0,i.c1,i.c2,i.p3,.5))}function ag(t){if(t.length<2)throw new Error("Polylines must be at least two points");let i=cg(t);return i<=0?[de({},t[0])]:[dg(t,i/2)]}function cg(t){let i=0;for(let e=0;e<t.length-1;e++)i+=Qh(t[e],t[e+1]);return i}function dg(t,i){let e=0;for(let o=0;o<t.length-1;o++){let r=t[o],s=t[o+1],a=Qh(r,s);if(!(a<=0)){if(e+a>=i){let d=(i-e)/a;return{x:r.x+(s.x-r.x)*d,y:r.y+(s.y-r.y)*d}}e+=a}}let n=t[t.length-1];return{x:n.x,y:n.y}}function Qh(t,i){return Math.hypot(i.x-t.x,i.y-t.y)}function lg(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 Jh(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,s=o?n.p3.y+2e-4:n.p3.y;i+=` C ${n.c1.x} ${n.c1.y}, ${n.c2.x} ${n.c2.y}, ${r} ${s}`}return i}function ep(t,i=16){if(!t.length)return[];let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=sg([o.p0,o.c1,o.c2,o.p3],i);n>0&&r.shift(),e.push(...r)}return e}function ug(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 s=t[r],a=n[n.length-1];(Math.abs(s.x-a.x)>i||Math.abs(s.y-a.y)>i)&&n.push(s)}if(n.length<=2)return n;let o=[];o.push(n[0]);for(let r=1;r<n.length-1;r++){let s=o[o.length-1],a=n[r],d=n[r+1],u=Math.abs(s.x-a.x)<=i&&Math.abs(a.x-d.x)<=i,f=Math.abs(s.y-a.y)<=i&&Math.abs(a.y-d.y)<=i;!u&&!f&&o.push(a)}return o.push(n[n.length-1]),o}var wu=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),s=Math.abs(e.y-i.y),a=Math.hypot(r,s),d=n===F.AUTO?Math.max(r,s):this._isHorizontal(n)?r:s,u=Math.max(8,o),f=o+.5*a,g=o*1.05+d*.3;return Math.min(f,Math.max(u,g))}static _softControl(i,e,n,o){let r=this._dir(i),s=n.x-e.x,a=n.y-e.y,d=Math.hypot(s,a)||1,u=s/d,f=a/d;if(i===F.AUTO)return{x:e.x+u*o,y:e.y+f*o};let g=r.x*u+r.y*f,x=.12,w=Math.max(0,-g)*.08,M=Math.min(.2,x+w),T=r.x*(1-M)+u*M,S=r.y*(1-M)+f*M,D=Math.hypot(T,S)||1;return{x:e.x+T/D*o,y:e.y+S/D*o}}handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:s}){let a=Math.max(0,r??0),d=_l(i,n,s),u=[];for(let g=0;g<d.length-1;g++){let x=d[g],w=d[g+1],M=t._handleLength(x,w,e,a),T=t._handleLength(w,x,o,a),S=t._softControl(e,x,w,M),D=t._softControl(o,w,x,T);u.push({p0:x,c1:S,c2:D,p3:w,chainIndex:g})}let f=ep(u,12);return{path:Jh(u),secondPoint:u[0]?.c1??i,penultimatePoint:u[u.length-1]?.c2??n,points:f,candidates:Zh(u)}}},bu=class{handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:s}){let a=_l(i,n,s),d=[];for(let f=0;f<a.length-1;f++){let g=a[f],x=a[f+1],w=wh(e,g,x,r??0),M=wh(o,x,g,r??0);d.push({p0:g,c1:w,c2:M,p3:x,chainIndex:f})}let u=ep(d,12);return{path:Jh(d),secondPoint:d[0]?.c1??i,penultimatePoint:d[d.length-1]?.c2??n,points:u,candidates:Zh(d)}}};function wh(t,i,e,n){let o={x:i.x,y:i.y};switch(t){case F.LEFT:o.x-=yo(i.x-e.x,n);break;case F.RIGHT:o.x+=yo(e.x-i.x,n);break;case F.TOP:o.y-=yo(i.y-e.y,n);break;case F.BOTTOM:o.y+=yo(e.y-i.y,n);break;case F.AUTO:break}return o}function yo(t,i){return t>=i?t:i*Math.sqrt(i-t)}function fg(t){let{axis:i,source:e,target:n,sourceSide:o,targetSide:r,sourceGap:s,targetGap:a,sourceDir:d,targetDir:u,currentDir:f,offset:g,sourceGapOffset:x,targetGapOffset:w}=t,M=hg(s,a),T=pg(i,d,f,M);return o===r?mg(i,e,n,g,d,f,s,a,x,w):T=_g(i,d,u,s,a,M,T),T}function hg(t,i){return{sourceTarget:[{x:t.x,y:i.y}],targetSource:[{x:i.x,y:t.y}]}}function pg(t,i,e,n){return t==="x"?i.x===e?n.targetSource:n.sourceTarget:i.y===e?n.sourceTarget:n.targetSource}function mg(t,i,e,n,o,r,s,a,d,u){let f=Math.abs(i[t]-e[t]);if(f>n)return;let g=Math.min(n-1,n-f);g<=0||(o[t]===r?d[t]=(s[t]>i[t]?-1:1)*g:u[t]=(a[t]>e[t]?-1:1)*g)}function _g(t,i,e,n,o,r,s){let a=t==="x"?"y":"x",d=i[t]===e[a],u=n[a]>o[a],f=n[a]<o[a];return i[t]===1&&(!d&&u||d&&f)||i[t]!==1&&(!d&&f||d&&u)?t==="x"?r.sourceTarget:r.targetSource:s}var Qn=1e-6,bh=2e-4,gg=.75;function yg(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(Cg(t[r-1],t[r],t[r+1],i));let o=t[e-1];return n.push(`L ${o.x+bh} ${o.y+bh}`),n.join(" ")}function Cg(t,i,e,n){let o=i.x,r=i.y;if(n<=0)return`L ${o} ${r}`;let s=Math.abs(t.x-o)<=Qn&&Math.abs(o-e.x)<=Qn,a=Math.abs(t.y-r)<=Qn&&Math.abs(r-e.y)<=Qn;if(s||a)return`L ${o} ${r}`;let d=Math.hypot(o-t.x,r-t.y),u=Math.hypot(e.x-o,e.y-r),f=Math.min(d*.5,u*.5,n);if(f<gg)return`L ${o} ${r}`;if(Math.abs(t.y-r)<=Qn){let S=t.x<e.x?-1:1,D=t.y<e.y?1:-1,R=o+f*S,L=r+f*D;return`L ${R} ${r} Q ${o} ${r} ${o} ${L}`}let x=t.x<e.x?1:-1,w=t.y<e.y?-1:1,M=r+f*w,T=o+f*x;return`L ${o} ${M} Q ${o} ${r} ${T} ${r}`}var Ih={[F.LEFT]:O.initialize(-1,0),[F.RIGHT]:O.initialize(1,0),[F.TOP]:O.initialize(0,-1),[F.BOTTOM]:O.initialize(0,1),[F.AUTO]:O.initialize(0,0)},Iu=class{handle({source:i,sourceSide:e,target:n,targetSide:o,waypoints:r,offset:s,radius:a}){let d=_l(i,n,r),u=[],f=[];for(let M=0;M<d.length-1;M++){let T=d[M],S=d[M+1],D=this._getPathPoints(T,e,S,o,s??0);u.push(D),f.push(...ag(D))}let g=ug(lg(u)),x=g.length>1?g[g.length-2]:i,w=g.length>1?g[1]:n;return{path:yg(g,a??0),penultimatePoint:x,secondPoint:w,points:g,candidates:f}}_getPathPoints(i,e,n,o,r){let s=Ih[e],a=Ih[o],d={x:i.x+s.x*r,y:i.y+s.y*r},u={x:n.x+a.x*r,y:n.y+a.y*r},f=this._getDirection(d,e,u),g=f.x!==0?"x":"y",x=f[g],w=[],M=O.initialize(),T=O.initialize(),S=rg(i,n);if(s[g]*a[g]===-1){let D=[{x:S.x,y:d.y},{x:S.x,y:u.y}],R=[{x:d.x,y:S.y},{x:u.x,y:S.y}];s[g]===x?w=g==="x"?D:R:w=g==="x"?R:D}else w=fg({axis:g,source:i,target:n,sourceSide:e,targetSide:o,sourceGap:d,targetGap:u,sourceDir:s,targetDir:a,currentDir:x,offset:r,sourceGapOffset:M,targetGapOffset:T});return[i,{x:d.x+M.x,y:d.y+M.y},...w,{x:u.x+T.x,y:u.y+T.y},n]}_getDirection(i,e,n){return e===F.LEFT||e===F.RIGHT?i.x<n.x?O.initialize(1,0):O.initialize(-1,0):i.y<n.y?O.initialize(0,1):O.initialize(0,-1)}},Sh=2e-4,Su=class{handle(i){let e=_l(i.source,i.target,i.waypoints),n=e.length,o=e[0],r=`M ${o.x} ${o.y}`,s=new Array(n-1);for(let a=0;a<n-1;a++){let d=e[a],u=e[a+1],f=a===n-2,g=f?u.x+Sh:u.x,x=f?u.y+Sh:u.y;r+=` L ${g} ${x}`,s[a]={x:(d.x+u.x)*.5,y:(d.y+u.y)*.5}}return{path:r,candidates:s,points:e,secondPoint:e[1]??i.target,penultimatePoint:e[n-2]??i.source}}},vg=new oe("F_CONNECTION_BUILDERS"),tp=(()=>{class t{_builtinBuilders={[Et.STRAIGHT]:new Su,[Et.BEZIER]:new bu,[Et.ADAPTIVE_CURVE]:new wu,[Et.SEGMENT]:new Iu};_providedBuilders;_builders;constructor(){this._providedBuilders=c(vg,{optional:!0})||{},this._builders=de(de({},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(),s=n.filter(d=>d in this._providedBuilders).sort(),a=[`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)"}`,s.length?`Overridden built-ins: ${s.join(", ")}`:null,"Tip: ensure you pass a valid Connection Type or provide a builder via F_CONNECTION_BUILDERS."].filter(Boolean);return new Error(a.join(`
2
+ `))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})();function xg(t,i,e){return vt("connection_"+t+i+e)}function wg(t,i,e){return vt("connection_for_selection_"+t+i+e)}function np(t){return vt("connection_gradient_"+t)}function bg(t){return`url(#${np(t)})`}var Ig=(()=>{class t{_connection=c(ml);_hostElement=c(Ce).nativeElement;_injector=c(je);_hostAttributes=new Map;_startColor;_endColor;gradientId=H(()=>np(this._connection.fId()));ngOnInit(){this._listenColorChanges()}_listenColorChanges(){fe(()=>{this.gradient().fStartColor(),this.gradient().fEndColor(),dt(()=>{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,s=new V(.5-.5*n/r,.5-.5*o/r);this._setHostAttribute("x1",s.x.toString()),this._setHostAttribute("y1",s.y.toString());let a=new V(.5+.5*n/r,.5+.5*o/r);this._setHostAttribute("x2",a.x.toString()),this._setHostAttribute("y2",a.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=be({type:t,standalone:!1})}return t})(),Tu=(()=>{class t extends Ig{gradient=A.required({alias:"fConnectionGradientRendererFor"});static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["linearGradient","fConnectionGradientRenderer",""]],hostVars:1,hostBindings:function(n,o){n&2&&K("id",o.gradientId())},inputs:{gradient:[1,"fConnectionGradientRendererFor","gradient"]},features:[he],attrs:Ym,decls:3,vars:0,consts:[[0,"xmlns","svg","http://www.w3.org/2000/svg"],["offset","0%"],["offset","100%"]],template:function(n,o){n&1&&(Ki(0,0),qe(),bt(1,"stop",1)(2,"stop",2),Zi())},encapsulation:2,changeDetection:0})}return t})(),Th=new oe("F_CONNECTION_GRADIENT");var Du=new oe("F_CONNECTION_PATH"),Eu=class{hostElement=c(Ce).nativeElement},Sg=(()=>{class t extends Eu{_connection=c(ml);useGradient=A(!1);linkToGradient=H(()=>this.useGradient()?bg(this._connection.fId()):null);get fPathId(){return this._connection.fId()}get attrConnectionId(){return xg(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(#${Eg(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${Pg(this._connection.fId())})`)}deselect(){this.hostElement.setAttribute("marker-start",`url(#${Tg(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${Dg(this._connection.fId())})`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["path","f-connection-path",""]],hostAttrs:[1,"f-component","f-connection-path"],hostVars:4,hostBindings:function(n,o){n&2&&(K("id",o.attrConnectionId)("data-f-path-id",o.fPathId),It("stroke",o.linkToGradient()))},inputs:{useGradient:[1,"useGradient"]},standalone:!1,features:[Ie([{provide:Du,useExisting:t}]),he],attrs:Km,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})();function Tg(t){return vt(`f-connection-marker-start-${t}`)}function Dg(t){return vt(`f-connection-marker-end-${t}`)}function Eg(t){return vt(`f-connection-selected-marker-start-${t}`)}function Pg(t){return vt(`f-connection-selected-marker-end-${t}`)}var Pu=new oe("F_CONNECTION_SELECTION"),Mu=class{hostElement=c(Ce).nativeElement},Mg=(()=>{class t extends Mu{_connection=c(ml);get connectionForSelectionId(){return wg(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=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["path","fConnectionSelection",""]],hostAttrs:[1,"f-component","f-connection-selection"],hostVars:1,hostBindings:function(n,o){n&2&&K("id",o.connectionForSelectionId)},standalone:!1,features:[Ie([{provide:Pu,useExisting:t}]),he],attrs:Zm,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})(),Ru=new oe("F_CONNECTION_DRAG_HANDLE_END"),Nu=new oe("F_CONNECTION_DRAG_HANDLE_START"),nc=class{hostElement=c(Ce).nativeElement;point=O.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,s={x:o.x/r,y:o.y/r},a={x:s.x*n,y:s.y*n};return{x:e.x-a.x,y:e.y-a.y}}},Rg=(()=>{class t extends nc{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=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["circle","f-connection-drag-handle-start",""]],hostVars:2,hostBindings:function(n,o){n&2&&Te(o.class)},standalone:!1,features:[Ie([{provide:Nu,useExisting:t}]),he],attrs:Qm,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),Ng=(()=>{class t extends nc{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=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["circle","f-connection-drag-handle-end",""]],hostVars:2,hostBindings:function(n,o){n&2&&Te(o.class)},standalone:!1,features:[Ie([{provide:Ru,useExisting:t}]),he],attrs:Jm,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),iu="f-selected";function ip(t){return class extends t{fId=$("");fSelectionDisabled=$(!1);unmarkAsSelected(){this.unmarkChildrenAsSelected?.(),this.hostElement.classList.remove(iu)}markAsSelected(){this.markChildrenAsSelected?.(),this.isSelected()||this.hostElement.classList.add(iu)}isSelected(){return this.hostElement.classList.contains(iu)}markChildrenAsSelected(){}unmarkChildrenAsSelected(){}constructor(...i){super(...i)}}}function kg(t){return class extends t{show(){this.hostElement.style.display="unset"}hide(){this.hostElement.style.display="none"}constructor(...i){super(...i)}}}var Og=ip(kg(class{hostElement;constructor(t){this.hostElement=t}})),Fg=(()=>{class t extends Og{_fConnectionBuilder=c(tp);path="";line=Kn.initialize();fReassignableStart=$(!1);fDraggingDisabled=$(!1);fSelectionDisabled=$(!1);fDefs=Se.required("defs");fPath=Se.required(Du);fDragHandleStart=Se(Nu);fDragHandleEnd=Se.required(Ru);fSelection=Se.required(Pu);fContents=ql(Ch,{descendants:!0});fMarkers=ql(vu,{descendants:!0});fGradient=Ji(Th);_fGradientRenderer=Se(Tu);fWaypoints=Ji(vh);fInputSide=$(Be.DEFAULT);_contentLayoutEngine=new Cu;_sourceSide=F.AUTO;fOutputSide=$(Be.DEFAULT);_targetSide=F.AUTO;_penultimatePoint=O.initialize();_secondPoint=O.initialize();constructor(){super(c(Ce).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=Kn.initialize(e,n);let{path:o,points:r,penultimatePoint:s,secondPoint:a,candidates:d}=this._getPathResult(e,n);this.path=o,this._penultimatePoint=s||e,this._secondPoint=a||n,this.fWaypoints()?.candidates.set(d||[]),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=be({type:t,contentQueries:function(n,o,r){n&1&&$l(r,o.fContents,Ch,5)(r,o.fMarkers,vu,5)(r,o.fGradient,Th,5)(r,o.fWaypoints,vh,5),n&2&&nt(4)},viewQuery:function(n,o){n&1&&Ct(o.fDefs,e_,5)(o.fPath,Du,5)(o.fDragHandleStart,Nu,5)(o.fDragHandleEnd,Ru,5)(o.fSelection,Pu,5)(o._fGradientRenderer,Tu,5),n&2&&nt(6)},standalone:!1,features:[he]})}return t})(),Ag=(()=>{let t=class Vo{_browser=c(we);_markerCache=new WeakMap;handle({connection:e}){let n=this._findConnectionMarkers(e),o=e.fDefs();if(!o)return!1;let r=Lg(n),s=this._markerCache.get(e);if(s?.signature===r&&s.defsElement===o.nativeElement)return!1;let a=rp("defs",this._browser);return n.forEach(d=>{op(d.type).forEach(u=>{let f=zg(u,d,e.fId(),this._browser),g=d.markerElement.cloneNode(!0);g.setAttribute("height",`${d.height}`),g.setAttribute("width",`${d.width}`),g.removeAttribute("markerUnits"),g.style.display="unset",f.append(g),a.append(f)})}),o.nativeElement.innerHTML=a.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||Vo)};static \u0275prov=h({token:Vo,factory:Vo.\u0275fac})};return t=y([C(wn)],t),t})();function Lg(t){return t.map(i=>[...op(i.type),i.width,i.height,i.refX,i.refY,i.orient,i.markerUnits,i.markerElement.outerHTML].join("|")).join("||")}function zg(t,i,e,n){let o=rp("marker",n);return o.setAttribute("id",vt(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 op(t){switch(t){case le.START:return[le.START];case le.END:return[le.END];case le.SELECTED_START:return[le.SELECTED_START];case le.SELECTED_END:return[le.SELECTED_END];case le.START_ALL_STATES:return[le.START,le.SELECTED_START];case le.END_ALL_STATES:return[le.END,le.SELECTED_END];default:return[]}}function rp(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}var gl=(()=>{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=h({token:t,factory:t.\u0275fac})}return t})(),Bg=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 sp(t){return!!ap(t)}function ap(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 Gg(t){let i=new t.blobCtor([Bg],{type:"text/javascript"});return t.urlApi.createObjectURL(i)}function cp(t,i){if(!t)return;let e=i??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var nn=(()=>{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,cp(this.workerUrl),this.workerUrl=null}dispose(){this.resetRuntime(new Error("Connection worker was destroyed."))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),ic=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(i,e){this.connection=i,this.line=e}},Hg=(()=>{let t=class Uo{_mediator=c(E);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new wn(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let o=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),s=this._renderCache.get(e);return s?.signature===r&&s.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||Uo)};static \u0275prov=h({token:Uo,factory:Uo.\u0275fac})};return t=y([C(ic)],t),t})(),oc=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(i,e){this.source=i,this.target=e}},jg=(()=>{let t=class Wo{_state=c(gl);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||Wo)};static \u0275prov=h({token:Wo,factory:Wo.\u0275fac})};return t=y([C(oc)],t),t})(),Nt=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(i,e=!0){this.element=i,this.cache=e}},Vg={enabled:!1},pt=new oe("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>de({},Vg)});var rc=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}},mt=(()=>{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=h({token:t,factory:t.\u0275fac})}return t})(),ku=class{key;id;kind;nodeId;element;rect;constructor(i,e,n,o,r,s){this.key=i,this.id=e,this.kind=n,this.nodeId=o,this.element=r,this.rect=s}},ni=class{static build(i,e){return`${i}:${e}`}},Ou=class{id;element;reference;rect;constructor(i,e,n,o){this.id=i,this.element=e,this.reference=n,this.rect=o}},bn=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(i,e="manual"){this.nodeId=i,this.reason=e}},Ug=(()=>{let t=class $o{_store=c(mt);_options=c(pt);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 s of r){let a=this._store.connectorEntries.get(s);a&&(a.rect=void 0)}}static \u0275fac=function(n){return new(n||$o)};static \u0275prov=h({token:$o,factory:$o.\u0275fac})};return t=y([C(bn)],t),t})(),sc=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(i,e,n){this.id=i,this.element=e,this.reference=n}},Wg=(()=>{let t=class qo{_store=c(mt);_options=c(pt);handle({id:e,element:n,reference:o}){if(!this._options.enabled)return;let r=new Ou(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||qo)};static \u0275prov=h({token:qo,factory:qo.\u0275fac})};return t=y([C(sc)],t),t})(),ac=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(i){this.id=i}},$g=(()=>{let t=class Xo{_store=c(mt);_mediator=c(E);_options=c(pt);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 s=this._store.connectorEntries.get(r);s&&this._mediator.execute(new ii(s.id,s.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||Xo)};static \u0275prov=h({token:Xo,factory:Xo.\u0275fac})};return t=y([C(ac)],t),t})(),qg=(()=>{let t=class Yo{_store=c(mt);_mediator=c(E);_options=c(pt);handle({id:e,nodeId:n,kind:o,element:r}){if(!this._options.enabled)return;let s=ni.build(e,o),a=this._store.connectorEntries.get(s);a&&(this._detachConnectorFromNode(a.key,a.nodeId),this._store.connectorKeyByElement.delete(a.element));let d=new ku(s,e,o,n,r);this._store.connectorEntries.set(s,d),this._store.connectorKeyByElement.set(r,s);let u=this._store.connectorKeysByNodeId.get(n)??new Set;u.add(s),this._store.connectorKeysByNodeId.set(n,u),this._mediator.execute(new bn(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||Yo)};static \u0275prov=h({token:Yo,factory:Yo.\u0275fac})};return t=y([C(rc)],t),t})(),ii=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(i,e){this.connectorId=i,this.kind=e}},Xg=(()=>{let t=class Ko{_store=c(mt);_mediator=c(E);_options=c(pt);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let o=ni.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 bn(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||Ko)};static \u0275prov=h({token:Ko,factory:Ko.\u0275fac})};return t=y([C(ii)],t),t})(),In=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(i){this.element=i}},Yg=(()=>{let t=class Zo{_store=c(mt);_options=c(pt);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||Zo)};static \u0275prov=h({token:Zo,factory:Zo.\u0275fac})};return t=y([C(In)],t),t})(),Yt=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(i,e,n){this.connectorId=i,this.kind=e,this.rect=n}},Kg=(()=>{let t=class Qo{_store=c(mt);_options=c(pt);handle({connectorId:e,kind:n,rect:o}){if(!this._options.enabled)return;let r=ni.build(e,n),s=this._store.connectorEntries.get(r);s&&(s.rect=xe.fromRoundedRect(o))}static \u0275fac=function(n){return new(n||Qo)};static \u0275prov=h({token:Qo,factory:Qo.\u0275fac})};return t=y([C(Yt)],t),t})(),Kt=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(i,e){this.nodeId=i,this.rect=e}},Zg=(()=>{let t=class Jo{_store=c(mt);_options=c(pt);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=z.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 s=o.x-n.x,a=o.y-n.y,d=n.width!==0,u=n.height!==0,f=d?o.width/n.width:1,g=u?o.height/n.height:1;for(let x of r){let w=this._store.connectorEntries.get(x);if(!w?.rect)continue;let M=w.rect,T=M.gravityCenter,S=d?o.x+(T.x-n.x)*f:T.x+s,D=u?o.y+(T.y-n.y)*g:T.y+a;w.rect=new xe(S-M.width/2,D-M.height/2,M.width,M.height,M.radius1,M.radius2,M.radius3,M.radius4)}}static \u0275fac=function(n){return new(n||Jo)};static \u0275prov=h({token:Jo,factory:Jo.\u0275fac})};return t=y([C(Kt)],t),t})(),oi=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(i,e){this.element=i,this.rect=e}},Qg=(()=>{let t=class er{_store=c(mt);_options=c(pt);handle({element:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeIdByElement.get(e);if(o){let a=this._store.nodeEntries.get(o);a&&(a.rect=n);return}let r=this._store.connectorKeyByElement.get(e);if(!r)return;let s=this._store.connectorEntries.get(r);s&&(s.rect=n)}static \u0275fac=function(n){return new(n||er)};static \u0275prov=h({token:er,factory:er.\u0275fac})};return t=y([C(oi)],t),t})(),Jg=[mt,Wg,$g,Ug,qg,Xg,Yg,Zg,Kg,Qg];function Fn(t,i,e){return i?V.fromPoint(t).elementTransform(i).sub(e.scaledPosition).sub(e.position).div(e.scale):V.fromPoint(t)}function dp(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Sn(t){return t?`${t}`:void 0}var e0=(()=>{let t=class tr{_store=c(b);_mediator=c(E);_browser=c(we);get _transform(){return this._store.transform}handle({element:e,cache:n}){let o=this._mediator.execute(new In(e));if(o&&n)return o;let r=this._getElementRoundedRect(e),s=this._normalizePosition(r),a=this._unscaleSize(r),d=this._getUnscaledRect(s,a,r),u=this._getOffsetSize(e,a),f=xe.fromCenter(d,u.width,u.height);return this._mediator.execute(new oi(e,f)),f}_getElementRoundedRect(e){return this._getRoundedRect(z.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,o){let[r,s,a,d]=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 xe(e.x,e.y,e.width,e.height,r,s,a,d)}_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,s,a,d]=o.map(f=>Math.max(0,f)),u=Math.min(1,this._getRadiusScaleFactor(e,r+s),this._getRadiusScaleFactor(n,s+a),this._getRadiusScaleFactor(e,a+d),this._getRadiusScaleFactor(n,d+r));return[r*u,s*u,a*u,d*u]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return Fn(e,this._store.flowHost,this._transform)}_unscaleSize(e){return ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n,o){return new xe(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 ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||tr)};static \u0275prov=h({token:tr,factory:tr.\u0275fac})};return t=y([C(Nt)],t),t})(),cc=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(i,e){this.connector=i,this.cache=e}},t0=(()=>{let t=class nr{_mediator=c(E);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 Nt(e.hostElement))}static \u0275fac=function(n){return new(n||nr)};static \u0275prov=h({token:nr,factory:nr.\u0275fac})};return t=y([C(cc)],t),t})(),dc=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(i){this.connection=i}},n0=(()=>{let t=class ir{_store=c(b);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||ir)};static \u0275prov=h({token:ir,factory:ir.\u0275fac})};return t=y([C(dc)],t),t})(),ri=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(i,e){this.connection=i,this.cache=e}},i0=(()=>{let t=class or{_mediator=c(E);handle({connection:e,cache:n}){let o=this._resolveConnectionEndpoints(e);return o?Ul(de({},o),{sourceRect:this._resolveEndpointRect(o.source,n),targetRect:this._resolveEndpointRect(o.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new dc(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new cc(e,n))}static \u0275fac=function(n){return new(n||or)};static \u0275prov=h({token:or,factory:or.\u0275fac})};return t=y([C(ri)],t),t})(),ge=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(i){this.element=i}},o0=(()=>{let t=class rr{_store=c(b);_mediator=c(E);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new In(e));if(n)return n;let o=z.fromElement(e),r=this._normalizePosition(o),s=this._unscaleSize(o),a=this._getUnscaledRect(r,s),d=this._getOffsetSize(e,s),u=this._fromCenter(a,d.width,d.height);return this._mediator.execute(new oi(e,u)),u}_fromCenter(e,n,o){return z.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-o/2,n,o)}_normalizePosition(e){return Fn(e,this._store.flowHost,this._transform)}_unscaleSize(e){return ot.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n){return new xe(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return ot.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||rr)};static \u0275prov=h({token:rr,factory:rr.\u0275fac})};return t=y([C(ge)],t),t})(),wt=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(i){this.connector=i}},r0=(()=>{let t=class sr{_store=c(b);_mediator=c(E);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 ge(n.hostElement));return{rotationDeg:n._rotate,pivot:o.gravityCenter}}static \u0275fac=function(n){return new(n||sr)};static \u0275prov=h({token:sr,factory:sr.\u0275fac})};return t=y([C(wt)],t),t})(),lc=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(i,e){this.connection=i,this.geometry=e}},s0=(()=>{let t=class ar{_mediator=c(E);_connectionBehaviour=c(On);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new st(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 wt(e))}static \u0275fac=function(n){return new(n||ar)};static \u0275prov=h({token:ar,factory:ar.\u0275fac})};return t=y([C(lc)],t),t})(),si=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}},a0=(()=>{let t=class cr{_mediator=c(E);handle({connection:e,source:n,target:o,line:r}){this._mediator.execute(new oc(n,o)),this._mediator.execute(new ic(e,r))}static \u0275fac=function(n){return new(n||cr)};static \u0275prov=h({token:cr,factory:cr.\u0275fac})};return t=y([C(si)],t),t})(),ai=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(i,e){this.connection=i,this.geometry=e}},c0=(()=>{let t=class dr{_mediator=c(E);handle({connection:e,geometry:n}){let o=this._mediator.execute(new lc(e,n));this._mediator.execute(new si(e,n.source,n.target,o))}static \u0275fac=function(n){return new(n||dr)};static \u0275prov=h({token:dr,factory:dr.\u0275fac})};return t=y([C(ai)],t),t})(),uc=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(i,e){this.connection=i,this.cache=e}},d0=(()=>{let t=class lr{_mediator=c(E);handle({connection:e,cache:n}){let o=this._mediator.execute(new ri(e,n));o&&this._mediator.execute(new ai(e,o))}static \u0275fac=function(n){return new(n||lr)};static \u0275prov=h({token:lr,factory:lr.\u0275fac})};return t=y([C(uc)],t),t})(),Zt=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(i){this.session=i}},l0=(()=>{let t=class ur{_store=c(b);_state=c(gl);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||ur)};static \u0275prov=h({token:ur,factory:ur.\u0275fac})};return t=y([C(Zt)],t),t})(),ci=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(i){this.session=i}},u0=(()=>{let t=class fr{_mediator=c(E);_store=c(b);handle({session:e}){this._mediator.execute(new Zt(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||fr)};static \u0275prov=h({token:fr,factory:fr.\u0275fac})};return t=y([C(ci)],t),t})(),fc=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(i,e){this.batchItem=i,this.result=e}},f0=(()=>{let t=class hr{_mediator=c(E);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 si(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new ai(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||hr)};static \u0275prov=h({token:hr,factory:hr.\u0275fac})};return t=y([C(fc)],t),t})(),Mt=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(i,e,n,o,r,s){this.connections=i,this.cache=e,this.startIndex=n,this.session=o,this.batchItems=r,this.workerResults=s}},h0=500,p0=6,m0=(()=>{let t=class pr{_mediator=c(E);_browser=c(we);handle({connections:e,cache:n,startIndex:o,session:r,batchItems:s,workerResults:a}){if(!this._isCurrent(r))return;let d=this._now(),u=o,f=0;for(;u<e.length&&f<h0&&this._isWithinSliceBudget(d);){let g=e[u];if(s?this._mediator.execute(new fc(s[u]??null,a?.[u])):this._mediator.execute(new uc(g,n)),u++,f++,!this._isCurrent(r))return}if(u>=e.length){this._mediator.execute(new ci(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new Mt(e,n,u,r,s,a)))}_isCurrent(e){return this._mediator.execute(new Zt(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<p0:!0}static \u0275fac=function(n){return new(n||pr)};static \u0275prov=h({token:pr,factory:pr.\u0275fac})};return t=y([C(Mt)],t),t})(),hc=class{static fToken=Symbol("StartConnectionRedrawRequest")},_0=(()=>{let t=class mr{_store=c(b);_state=c(gl);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||mr)};static \u0275prov=h({token:mr,factory:mr.\u0275fac})};return t=y([C(hc)],t),t})(),di=class{static fToken=Symbol("RedrawConnectionsRequest")},pc=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(i){this.connectionCount=i}},li=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},g0=(()=>{let t=class _r{_browser=c(we);_state=c(nn);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return sp(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||_r)};static \u0275prov=h({token:_r,factory:_r.\u0275fac})};return t=y([C(li)],t),t})(),y0=(()=>{let t=class gr{_mediator=c(E);handle({connectionCount:e}){return e>0&&this._mediator.execute(new li)}static \u0275fac=function(n){return new(n||gr)};static \u0275prov=h({token:gr,factory:gr.\u0275fac})};return t=y([C(pc)],t),t})(),mc=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(i,e,n){this.connection=i,this.geometry=e,this.originalIndex=n}},C0=(()=>{let t=class yr{_store=c(b);handle({connection:e,geometry:n,originalIndex:o}){let{source:r,target:s,sourceRect:a,targetRect:d}=n;return{originalIndex:o,behavior:e.fBehavior,outputSide:e.fOutputSide(),inputSide:e.fInputSide(),sourceConnectableSide:r.fConnectableSide,targetConnectableSide:s.fConnectableSide,sourceRotation:this._store.nodes.get(r.fNodeId)?._rotate||0,targetRotation:this._store.nodes.get(s.fNodeId)?._rotate||0,sourceRect:{x:a.x,y:a.y,width:a.width,height:a.height,radius1:a.radius1,radius2:a.radius2,radius3:a.radius3,radius4:a.radius4},targetRect:{x:d.x,y:d.y,width:d.width,height:d.height,radius1:d.radius1,radius2:d.radius2,radius3:d.radius3,radius4:d.radius4}}}static \u0275fac=function(n){return new(n||yr)};static \u0275prov=h({token:yr,factory:yr.\u0275fac})};return t=y([C(mc)],t),t})(),_c=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(i,e){this.connections=i,this.cache=e}},v0=(()=>{let t=class Cr{_mediator=c(E);handle({connections:e,cache:n}){let o=new Array(e.length),r=[];for(let s=0;s<e.length;s++){let a=this._buildBatchItem(e[s],n,s);o[s]=a,a&&r.push(a.payload)}return{items:o,payload:r}}_buildBatchItem(e,n,o){let r=this._mediator.execute(new ri(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new mc(e,r,o))}:null}static \u0275fac=function(n){return new(n||Cr)};static \u0275prov=h({token:Cr,factory:Cr.\u0275fac})};return t=y([C(_c)],t),t})(),gc=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(i){this.error=i}},ui=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(i){this.error=i}},x0=(()=>{let t=class vr{_state=c(nn);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||vr)};static \u0275prov=h({token:vr,factory:vr.\u0275fac})};return t=y([C(ui)],t),t})(),w0=(()=>{let t=class xr{_state=c(nn);_mediator=c(E);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new ui(e))}static \u0275fac=function(n){return new(n||xr)};static \u0275prov=h({token:xr,factory:xr.\u0275fac})};return t=y([C(gc)],t),t})(),yc=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(i){this.message=i}},b0=(()=>{let t=class wr{_state=c(nn);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||wr)};static \u0275prov=h({token:wr,factory:wr.\u0275fac})};return t=y([C(yc)],t),t})(),Cc=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},I0=(()=>{let t=class br{_browser=c(we);_state=c(nn);_mediator=c(E);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!sp(n))return null;let o=ap(n);if(!o)return null;let r=Gg(o);try{let s=new o.workerCtor(r,{name:"f-flow-connection-worker"});return s.onmessage=a=>{this._mediator.execute(new yc(a.data))},s.onerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker runtime error."))},s.onmessageerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker message deserialization error."))},this._state.workerUrl=r,this._state.worker=s,s}catch(s){return cp(r,o.urlApi),this._disableWorker(s instanceof Error?s:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new gc(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new ui(e))}static \u0275fac=function(n){return new(n||br)};static \u0275prov=h({token:br,factory:br.\u0275fac})};return t=y([C(Cc)],t),t})(),vc=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(i){this.payload=i}},S0=(()=>{let t=class Ir{_state=c(nn);_mediator=c(E);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new li))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new Cc);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let o=++this._state.nextRequestId;return new Promise((r,s)=>{this._state.pending.set(o,{resolve:r,reject:s});try{n.postMessage({requestId:o,items:e})}catch(a){this._state.pending.delete(o),s(a instanceof Error?a: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||Ir)};static \u0275prov=h({token:Ir,factory:Ir.\u0275fac})};return t=y([C(vc)],t),t})(),xc=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(i){this.batch=i}},T0=(()=>{let t=class Sr{_mediator=c(E);handle({batch:e}){return e.payload.length?this._mediator.execute(new vc(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Sr)};static \u0275prov=h({token:Sr,factory:Sr.\u0275fac})};return t=y([C(xc)],t),t})(),wc=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(i,e,n){this.connections=i,this.cache=e,this.session=n}},D0=(()=>{let t=class Tr{_mediator=c(E);handle({connections:e,cache:n,session:o}){let r=this._mediator.execute(new _c(e,n));if(!r.payload.length){this._mediator.execute(new Mt(e,n,0,o,r.items));return}this._mediator.execute(new xc(r)).then(s=>{this._mediator.execute(new Zt(o))&&this._mediator.execute(new Mt(e,n,0,o,r.items,this._alignWorkerResults(s,e.length)))}).catch(()=>{this._mediator.execute(new Zt(o))&&this._mediator.execute(new Mt(e,n,0,o,r.items))})}_alignWorkerResults(e,n){let o=new Array(n);for(let r of e){let s=r.originalIndex;s<0||s>=n||(o[s]=r)}return o}static \u0275fac=function(n){return new(n||Tr)};static \u0275prov=h({token:Tr,factory:Tr.\u0275fac})};return t=y([C(wc)],t),t})(),E0=(()=>{let t=class Dr{_mediator=c(E);_store=c(b);handle(e){let n=this._mediator.execute(new hc);this._createMarkersForCreate(),this._createMarkersForSnap();let o=[...this._store.connections.getAll()],r=new Map;if(!o.length){this._mediator.execute(new ci(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 wn(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new wn(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new pc(e))}_redrawUsingWorker(e,n,o){this._mediator.execute(new wc(e,n,o))}_redrawWithoutWorker(e,n,o){this._mediator.execute(new Mt(e,n,0,o))}static \u0275fac=function(n){return new(n||Dr)};static \u0275prov=h({token:Dr,factory:Dr.\u0275fac})};return t=y([C(di)],t),t})(),Fu=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},P0=(()=>{let t=class Er{_store=c(b);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||Er)};static \u0275prov=h({token:Er,factory:Er.\u0275fac})};return t=y([C(Fu)],t),t})(),bc=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(i){this.connection=i}},M0=(()=>{let t=class Pr{_store=c(b);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Pr)};static \u0275prov=h({token:Pr,factory:Pr.\u0275fac})};return t=y([C(bc)],t),t})(),Au=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(i){this.instance=i}},R0=(()=>{let t=class Mr{_store=c(b);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Mr)};static \u0275prov=h({token:Mr,factory:Mr.\u0275fac})};return t=y([C(Au)],t),t})(),Lu=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(i,e){this.waypointIndex=i,this.connectionId=e}},Ic=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},N0=(()=>{let t=class Rr{_store=c(b);_dragSession=c(U);handle(e){this._store.flowHost.classList.remove(De.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Rr)};static \u0275prov=h({token:Rr,factory:Rr.\u0275fac})};return t=y([C(Ic)],t),t})(),Sc=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},k0=(()=>{let t=class Nr{_mediator=c(E);_store=c(b);_dragContext=c(U);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(De.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new fi),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Rc(e.kind,e.data?de({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||Nr)};static \u0275prov=h({token:Nr,factory:Nr.\u0275fac})};return t=y([C(Sc)],t),t})(),fi=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},Qt=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}},Tc=class extends Qt{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}}},zu=class extends Qt{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}},Bu=class extends Qt{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}}},Gu=class extends Qt{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}}},ae=(()=>{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})(),O0=800,Hu=class{_document=c($i);_ngZone=c(jn,{optional:!0});_mouseListeners=ae.emptyListener();_touchListeners=ae.emptyListener();_startListeners=ae.emptyListener();isSyntheticEvent(i){return!!this._lastTouchEventTime&&this._lastTouchEventTime+O0>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=A0(i),o=new Tc(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,ae.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ae.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ae.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ae.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ae.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ae.activeCaptureListener())})};_onTouchDown=i=>{let e=L0(i),n=new Bu(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,ae.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ae.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ae.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ae.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ae.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ae.activeCaptureListener())})};_onSelectStart=i=>{this.onSelect(i)};_onMouseMove=i=>{this._moveHandler(new Tc(i))};_onTouchMove=i=>{this._moveHandler(new Gu(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,F0(i.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=i=>{this.isDragStarted&&this.onPointerUp(new zu(i)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=ae.emptyListener(),this._touchListeners(),this._touchListeners=ae.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,ae.activeListener()),this._listen("touchstart",this._onTouchDown,ae.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,ae.activeListener()),this._unlisten("touchstart",this._onTouchDown,ae.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=ae.emptyListener(),this._touchListeners(),this._touchListeners=ae.emptyListener(),this._mouseListeners(),this._mouseListeners=ae.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 F0(t){return t.type[0]==="t"}function A0(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function L0(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 ju=class extends Qt{_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 de({},this._position)}};function z0(t){return new ju(t)}var U=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new V(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 V(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=z0(e),this.lastPointerPosition=this.lastPointerEvent.getPosition()}isEmpty(){return!this.draggableItems.length}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Vu=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}},B0=(()=>{let t=class kr{_mediator=c(E);_store=c(b);_dragSession=c(U);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new Rt))}_getSelection(){return this._mediator.execute(new Fi)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new Vu(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||kr)};static \u0275prov=h({token:kr,factory:kr.\u0275fac})};return t=y([C(fi)],t),t})(),Uu=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(i){this.nodeOrGroup=i}},G0=(()=>{let t=class Or{_store=c(b);_mediator=c(E);handle({nodeOrGroup:e}){let n=z.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 z.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 ge(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new en(e,n))}static \u0275fac=function(n){return new(n||Or)};static \u0275prov=h({token:Or,factory:Or.\u0275fac})};return t=y([C(Uu)],t),t})(),Wu=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(i,e){this.fParentNodes=i,this.fDraggedNodes=e}},H0=(()=>{let t=class Fr{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||Fr)};static \u0275prov=h({token:Fr,factory:Fr.\u0275fac})};return t=y([C(Wu)],t),t})(),$u=class{fNodeId;fConnectionIds;constructor(i,e){this.fNodeId=i,this.fConnectionIds=e}},Dc=class extends $u{nodeId;connectionIds;constructor(i,e){super(i,e),this.nodeId=i,this.connectionIds=e}},Ec=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(i){this.nodeOrGroup=i}},j0=(()=>{let t=class Ar{_mediator=c(E);_store=c(b);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),s=this._collectConnectionsUnderNode(e),a=[];for(let d of s){let u=d.fId();r.has(u)||a.push(u)}a.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Dc(e.fId(),a)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Dc(e.fId(),a)))}_collectConnectableConnectorIds(e,n){let o=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let s of o)s.canBeConnected&&e.isContains(s.hostElement)&&r.add(s.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 Nt(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 mn.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||Ar)};static \u0275prov=h({token:Ar,factory:Ar.\u0275fac})};return t=y([C(Ec)],t),t})(),V0=[k0,N0,B0,G0,H0,j0],U0=new Set(["create-connection","reassign-connection","drag-node"]),W0=new Set(["selection-area"]),$0=new Set(["assign-to-container"]);function lp(t){let i=null;for(let e of t){if($0.has(e))continue;let n=U0.has(e)?"rebase":W0.has(e)?"direct":null;if(!n)return null;if(!i){i=n;continue}if(i!==n)return null}return i}function up(t,i,e,n,o){return O.initialize(Dh(t.x,i.left,i.right,e,n,o),Dh(t.y,i.top,i.bottom,e,n,o))}function Dh(t,i,e,n,o,r){let s=Math.max(0,n),a=Math.max(0,o);if(!s||!a)return 0;if(t<=i+s){let d=Ph((i+s-t)/s,0,1);return Eh(d,a,r)}if(t>=e-s){let d=Ph((t-(e-s))/s,0,1);return-Eh(d,a,r)}return 0}function q0(t,i,e){let n=e||1;return V.fromPoint(t).add(V.fromPoint(i).div(n))}function Eh(t,i,e){return e?i*t:i}function Ph(t,i,e){return Math.max(i,Math.min(e,t))}var Pc=class{static fToken=Symbol("RunAutoPanFrameRequest")},kt=class{static fToken=Symbol("StopAutoPanRequest")},X0=(()=>{let t=class Lr{_store=c(b);_dragContext=c(U);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||Lr)};static \u0275prov=h({token:Lr,factory:Lr.\u0275fac})};return t=y([C(kt)],t),t})(),hi=class{static fToken=Symbol("SyncAutoPanRequest")},Y0=(()=>{let t=class zr{_mediator=c(E);_store=c(b);_dragContext=c(U);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new kt);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Pc)}))}_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?O.initialize():up(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return lp(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(_e.AUTO_PAN)}static \u0275fac=function(n){return new(n||zr)};static \u0275prov=h({token:zr,factory:zr.\u0275fac})};return t=y([C(hi)],t),t})(),K0=(()=>{let t=class Br{_mediator=c(E);_store=c(b);_dragContext=c(U);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new kt);return}let o=this._getAutoPanDelta();if(!o.x&&!o.y){this._mediator.execute(new kt);return}this._applyCanvasDelta(o,n),this._replayLastPointerMove(),this._mediator.execute(new hi)}_applyCanvasDelta(e,n){let o=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=q0(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||o.scale||1)),o.position=V.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(de({},n),e)})}_getPointerPositionInCanvas(e){return V.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 lp(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?O.initialize():up(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(_e.AUTO_PAN)}static \u0275fac=function(n){return new(n||Br)};static \u0275prov=h({token:Br,factory:Br.\u0275fac})};return t=y([C(Pc)],t),t})(),Z0=[Y0,K0,X0],Mc=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(i){this.event=i}},Rc=class{kind;data;fEventType;get fData(){return this.data}constructor(i,e,n){this.kind=i,this.data=e,this.fEventType=n??i}},Ge=class{data(){}_features=[];getEvent(){return new Rc(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)}},Nc=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=[]}},Q0=new oe("F_NODE_INPUT"),J0=(()=>{class t extends Nc{kind="input";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275dir=be({type:t,standalone:!1,features:[he]})}return t})(),ft=(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})(ft||{});function ey(t){return Zn(t,".f-rotate-handle")}var fp=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),yl=new oe("F_NODE"),ty=ip(class{hostElement;constructor(t){this.hostElement=t}}),kc=class extends ty{_injector=c(je);renderer=c(Xf);browser=c(we);stateChanges=new Qe;_position=O.initialize();_rotate=0;_size;connectors=[];positionChanges(){fe(()=>{let i=this.position();dt(()=>{O.isEqual(this._position,i)||(this._position=i,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){fe(()=>{let i=this.size();dt(()=>{this._isSizeEqual(i)||(this._size=i,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){fe(()=>{let i=this.rotate();dt(()=>{this._rotate!==i&&(this._rotate=i,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){fe(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),dt(()=>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()}},ny=0,iy=3,qu=(()=>{class t extends kc{_debounceTimer=null;_destroyRef=c(Ke);_mediator=c(E);fId=A(`f-group-${ny++}`,{alias:"fGroupId"});fParentId=A(null,{alias:"fGroupParentId"});position=Ht(O.initialize(),{alias:"fGroupPosition"});size=A(void 0,{alias:"fGroupSize"});sizeChange=it({alias:"fGroupSizeChange"});rotate=Ht(0,{alias:"fGroupRotate"});fConnectOnNode=A(!0,{transform:pe});fMinimapClass=A([]);fDraggingDisabled=A(!1,{alias:"fGroupDraggingDisabled",transform:pe});fSelectionDisabled=A(!1,{alias:"fGroupSelectionDisabled",transform:pe});fIncludePadding=A(!0,{transform:pe});fAutoExpandOnChildHit=A(!1,{transform:pe});fAutoSizeToFitChildren=A(!1,{transform:pe});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ei(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 Rt),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),iy))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Dn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new Mi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Ri(this))}static \u0275fac=function(n){return new(n||t)(Wl(Ce))};static \u0275dir=be({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(K("data-f-group-id",o.fId()),Le("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:[Ie([{provide:yl,useExisting:t}]),he]})}return t})(),Mh=0,oy=3,Cl=(()=>{class t extends kc{_debounceTimer=null;_destroyRef=c(Ke);_mediator=c(E);fId=A(`f-node-${Mh++}`,{alias:"fNodeId",transform:e=>Sn(e)||`f-node-${Mh++}`});fParentId=A(null,{alias:"fNodeParentId"});position=Ht(O.initialize(),{alias:"fNodePosition"});size=A(void 0,{alias:"fNodeSize"});sizeChange=it({alias:"fNodeSizeChange"});rotate=Ht(0,{alias:"fNodeRotate"});fConnectOnNode=A(!0,{transform:pe});fMinimapClass=A([]);fDraggingDisabled=A(!1,{alias:"fNodeDraggingDisabled",transform:pe});fSelectionDisabled=A(!1,{alias:"fNodeSelectionDisabled",transform:pe});fIncludePadding=A(!0,{transform:pe});fAutoExpandOnChildHit=A(!1,{transform:pe});fAutoSizeToFitChildren=A(!1,{transform:pe});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ei(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 Rt),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),oy))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Dn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new Mi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Ri(this))}static \u0275fac=function(n){return new(n||t)(Wl(Ce))};static \u0275dir=be({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(K("data-f-node-id",o.fId()),Le("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:[Ie([{provide:yl,useExisting:t}]),he]})}return t})();function ry(t){return!!t.closest("[fNode]")}var Rh=0,hp=(()=>{class t extends J0{hostElement=c(Ce).nativeElement;_mediator=c(E);_node=c(yl);fId=A(`f-node-input-${Rh++}`,{alias:"fInputId",transform:e=>Sn(e)||`f-node-input-${Rh++}`});category=A(void 0,{alias:"fInputCategory",transform:Sn});multiple=A(!0,{alias:"fInputMultiple",transform:pe});disabled=A(!1,{alias:"fInputDisabled",transform:pe});userFConnectableSide=F.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Si(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(De.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(De.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(De.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(De.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Ni(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275dir=be({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,o){n&2&&(K("data-f-input-id",o.fId()),Le("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=>_n(e,"fInputConnectableSide",F)]},exportAs:["fNodeInput"],standalone:!1,features:[Ie([{provide:Q0,useExisting:t}]),he,cn]})}return t})(),sy=(()=>{class t extends Nc{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=W(t)))(o||t)}})();static \u0275dir=be({type:t,standalone:!1,features:[he]})}return t})();function pp(t){return!!t.closest("[fNodeOutlet]")}var ay=new oe("F_NODE_OUTPUT"),cy=(()=>{class t extends sy{kind="output";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275dir=be({type:t,standalone:!1,features:[he]})}return t})();function mp(t){return!!t.closest("[fNodeOutput]")}var Nh=0,_p=(()=>{class t extends cy{hostElement=c(Ce).nativeElement;_mediator=c(E);_node=c(yl);fId=A(`f-node-output-${Nh++}`,{alias:"fOutputId",transform:e=>Sn(e)||`f-node-output-${Nh++}`});multiple=A(!1,{alias:"fOutputMultiple",transform:pe});disabled=A(!1,{alias:"fOutputDisabled",transform:pe});userFConnectableSide=F.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Si(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(De.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(De.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(De.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(De.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Ni(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275dir=be({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,o){n&2&&(K("data-f-output-id",o.fId()),Le("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=>_n(e,"fOutputConnectableSide",F)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[Ie([{provide:ay,useExisting:t}]),he,cn]})}return t})();var Oc=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(i){this.event=i}},pi=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(i){this.outlet=i}},dy=(()=>{let t=class Gr{_store=c(b);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||Gr)};static \u0275prov=h({token:Gr,factory:Gr.\u0275fac})};return t=y([C(pi)],t),t})(),Xu=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}},Fc=(()=>{class t extends Ge{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=c(Ft);_mediator=c(E);_connectionBehaviour=c(On);_store=c(b);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new xe;initialize(e,n){this._sourceRef=this._mediator.execute(new Ye(e)),this._pointerDown=xe.fromRect(z.initialize(n.x,n.y))}prepareDragSequence(){this._collectAndMarkTargets(),this._initSnapConnection(),this._initCreateConnection(),this._connection.show(),this.onPointerMove(O.initialize()),this._result.setData({toConnectorRect:this._pointerDown,canBeConnectedInputs:this._targets,fOutputId:this._sourceRef.connector.fId()})}_collectAndMarkTargets(){this._targets=this._mediator.execute(new Di(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new Mn(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 s=this._snapConnection;if(!s)return;let a=o&&o.distance<s.fSnapThreshold?o:void 0;this._drawSnapConnection(a)}_findClosestTarget(e){return this._mediator.execute(new Jt(e,this._targets))}_drawCreateConnection(e,n){let o=this._connectionBehaviour.handle(new st(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 st(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 Rn(this._targets.map(e=>e.connector)))}_resolveRotationContext(e){return this._mediator.execute(new wt(e))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),ly=(()=>{let t=class Hr{_result=c(Ft);_mediator=c(E);_store=c(b);_dragContext=c(U);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 Fc)}_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 pp(e.hostElement)?this._mediator.execute(new pi(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 Xu(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new Ti(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||Hr)};static \u0275prov=h({token:Hr,factory:Hr.\u0275fac})};return t=y([C(Oc)],t),t})(),mi=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(i,e){this.eventPosition=i,this.source=e}},uy=(()=>{let t=class jr{_store=c(b);_dragContext=c(U);_dragInjector=c(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),s=this._dragInjector.get(Fc);s.initialize(e,r),this._dragContext.draggableItems=[s]}_toFlowSpace(e){return V.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return V.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||jr)};static \u0275prov=h({token:jr,factory:jr.\u0275fac})};return t=y([C(mi)],t),t})(),Ac=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(i,e){this.event=i,this.node=e}},fy=(()=>{let t=class Vr{_mediator=c(E);_store=c(b);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 pi(e))}_startDrag(e,n){this._mediator.execute(new mi(e,n))}static \u0275fac=function(n){return new(n||Vr)};static \u0275prov=h({token:Vr,factory:Vr.\u0275fac})};return t=y([C(Ac)],t),t})(),Lc=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(i,e){this.event=i,this.node=e}},hy=(()=>{let t=class Ur{_mediator=c(E);_store=c(b);handle({event:e,node:n}){if(!mp(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 mi(e,n))}static \u0275fac=function(n){return new(n||Ur)};static \u0275prov=h({token:Ur,factory:Ur.\u0275fac})};return t=y([C(Lc)],t),t})(),zc=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},py=(()=>{let t=class Wr{_mediator=c(E);_store=c(b);_dragContext=c(U);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let o=pp(e.targetElement),r=!o&&mp(e.targetElement);if(!o&&!r)return;let s=this._findOwnerNode(e.targetElement);s&&(o?this._mediator.execute(new Ac(e,s)):this._mediator.execute(new Lc(e,s)))}_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 Je(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Wr)};static \u0275prov=h({token:Wr,factory:Wr.\u0275fac})};return t=y([C(zc)],t),t})(),Bc=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(i){this.event=i}},Yu=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(i,e,n,o,r,s,a){this.connectionId=i,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=o,this.previousTargetId=r,this.nextTargetId=s,this.dropPosition=a,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=o,this.oldTargetId=r,this.newTargetId=s,this.dropPoint=a}},my=(()=>{let t=class $r{_dragResult=c(Ft);_mediator=c(E);_store=c(b);_dragContext=c(U);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 Ti(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 Yu(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||$r)};static \u0275prov=h({token:$r,factory:$r.\u0275fac})};return t=y([C(Bc)],t),t})(),Gc=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function _y(t,i){return gp(t,i)||gy(t,i)}function gp(t,i){return t.fDragHandleEnd()?.point&&yp(i,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function gy(t,i){return!!t.fDragHandleStart()?.point&&yp(i,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function yp(t,i){return(t.x-i.x)**2+(t.y-i.y)**2<=8**2}function Cp(t,i){return t&&t.distance<i.fSnapThreshold?t:void 0}function Hc(t){return xe.fromRect(z.initialize(t.x,t.y))}var Ku=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=Hc(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Ud(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 Mn(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(Cp(n,r))}_findClosest(i){return this._mediator.execute(new Jt(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new st(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 st(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 Rn(this._candidates.map(i=>i.connector)))}_resolveRotationContext(i){return this._mediator.execute(new wt(i))}},Zu=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=Hc(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Di(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 Mn(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(Cp(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Rn(this._candidates.map(i=>i.connector)))}_findClosest(i){return this._mediator.execute(new Jt(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new st(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 st(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 wt(i))}},Qu=(()=>{class t extends Ge{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=c(Ft);_mediator=c(E);_connectionBehaviour=c(On);_store=c(b);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 Ye(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new Ye(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new Ku(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new Zu(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:Hc(this._connection.line.point1),targetAnchorRect:Hc(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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),yy=(()=>{let t=class qr{_mediator=c(E);_store=c(b);_dragContext=c(U);_dragInjector=c(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=Fn(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=>_y(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=V.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let o=this._dragInjector.get(Qu);o.initialize(e,gp(e,n)),this._dragContext.draggableItems=[o]}_isValidTrigger(e){return Je(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new tn(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||qr)};static \u0275prov=h({token:qr,factory:qr.\u0275fac})};return t=y([C(Gc)],t),t})(),jc=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(i){this.event=i}},Vc=class{connectionId;waypoints;constructor(i,e){this.connectionId=i,this.waypoints=e}},Uc=(()=>{class t extends Ge{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=c(b);_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=de({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=de({},this._pick.waypoint),this._waypointsComponent.select(this._pick.waypoint)),this._redrawConnection()}onPointerMove(e){this._waypointsComponent.move(O.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 Vc(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Cy=(()=>{let t=class Xr{_dragContext=c(U);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof Uc)}static \u0275fac=function(n){return new(n||Xr)};static \u0275prov=h({token:Xr,factory:Xr.\u0275fac})};return t=y([C(jc)],t),t})(),Wc=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},vy=(()=>{let t=class Yr{_mediator=c(E);_store=c(b);_dragContext=c(U);_dragInjector=c(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=Fn(e.event.getPosition(),this._flowHost,this._transform),o=this._pickControlPoint(n);if(!o||!this._isValidTrigger(e))return;let r=this._dragInjector.get(Uc);r.setPick(o),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=V.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 $_(this._connections,e)}_isValidTrigger(e){return Je(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new tn(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||Yr)};static \u0275prov=h({token:Yr,factory:Yr.\u0275fac})};return t=y([C(Wc)],t),t})(),xy=[ly,uy,fy,dy,hy,py,my,yy,vy,Cy],$c=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(i){this.event=i}},wy=1,_i=(()=>{class t extends Ge{type="move-node-to-parent";kind="assign-to-container";_store=c(b);_dragSession=c(U);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(De.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),wy)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(De.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=V.fromPoint(this._dragSession.onPointerDownPosition).add(e),o=V.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(o)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>z.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(De.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(De.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),qc=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(i){this.nodesAndGroups=i}},Ju=class{rootHandlers;participants;constructor(i,e){this.rootHandlers=i,this.participants=e}},ef=class{fNodeIds;constructor(i){this.fNodeIds=i}},Df="move-node",Ef="drag-node";function by(t){return t.getEvent().kind===Ef||t.getEvent().fEventType===Df}var Ot=(()=>{class t extends Ge{type=Df;kind=Ef;data(){return new ef(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?z.union([e,o]):o}return e??z.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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Xc=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),s=this._clamp(i.y,n.y,o.y),a=i.x-r,d=i.y-s,u=this._quantizeSigned(a,this._quantizeStep),f=this._quantizeSigned(d,this._quantizeStep);e.value.x=r,e.value.y=s,e.edges.left=u<0,e.edges.right=u>0,e.edges.top=f<0,e.edges.bottom=f>0,e.overflow.x=Math.abs(u),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)}},tf=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 kh(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var nf=class{_snapper;_hardClamp;_hardResult=kh();_softClamps=[];_softResults=[];constructor(i,e,n){let o=i.get(b).fDraggable;this._snapper=new tf(o,e),this._hardClamp=new Xc(n.hard,.5);for(let r of n.soft)this._softClamps.push(new Xc(r.limits,.5)),this._softResults.push(kh())}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 Oh(t,i,e){let{x:n,y:o,width:r,height:s}=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&&(s+=i.y),e.top&&i.y>0&&(o-=i.y,s+=i.y),z.initialize(n,o,r,s)}var of=class extends Ge{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=Df;kind=Ef;_startPosition=O.initialize();_startRect=z.initialize();_applyConstraints=i=>i;_lastSoftResults=[];_deltaConstraints;_constraints;_lastPosition=O.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(E),this._startRect=this._mediator.execute(new ge(e.hostElement)),this._startPosition=de({},e._position)}setConstraints(i){this._constraints=i,this._deltaConstraints=new nf(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 z.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(De.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(De.DRAG_AND_DROP.DRAGGING),this._emitExpandedEvent()}_startPlus(i){return O.sum(this._startPosition,i)}_redraw(i){this._lastPosition=i,this.nodeOrGroup.updatePosition(i),this._mediator.execute(new Kt(this.nodeOrGroup.fId(),z.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=Oh(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 Kt(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 Ye(i)).rect;return e.set(n,r),r}_buildDelta(i,e){return O.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=Oh(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=[]}},Iy=(()=>{let t=class Kr{_injector=c(je);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),o=this._linkParentsAndCollectRoots(e,n);return new Ju(o,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let o of e)n.set(o.fId(),new of(this._injector,o));return n}_linkParentsAndCollectRoots(e,n){let o=[];for(let r of e){let s=n.get(r.fId());if(!s)continue;let a=r.fParentId(),d=a?n.get(a):void 0;d?d.children.push(s):o.push(s)}return o}static \u0275fac=function(n){return new(n||Kr)};static \u0275prov=h({token:Kr,factory:Kr.\u0275fac})};return t=y([C(qc)],t),t})(),Yc=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(i){this.nodeOrGroup=i}},gi=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(i,e){this.nodeOrGroup=i,this.childrenPaddings=e}},rf=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(i,e,n,o){this.nodeOrGroup=i,this.boundingRect=e,this.innerRect=n,this.paddings=o}},Sy=(()=>{let t=class Zr{_mediator=c(E);handle({nodeOrGroup:e,childrenPaddings:n}){let o=this._readBoundingRect(e),r=this._readOwnPaddings(e,o),s=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],a=z.initialize(o.x+s[0],o.y+s[1],o.width-s[0]-s[2],o.height-s[1]-s[3]);return new rf(e,o,a,s)}_readBoundingRect(e){return this._mediator.execute(new ge(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new en(e,n))}static \u0275fac=function(n){return new(n||Zr)};static \u0275prov=h({token:Zr,factory:Zr.\u0275fac})};return t=y([C(gi)],t),t})(),Ty=(()=>{let t=class Qr{_mediator=c(E);handle({nodeOrGroup:e}){let n=this._readCurrentRect(e),o=this._readParentsChain(e);return this._buildConstraints(o,n)}_readCurrentRect(e){return this._mediator.execute(new ge(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Pn(e))??[]}_buildConstraints(e,n){let o=[],r=dp(),s=[0,0,0,0];for(let a of e){let d=this._readParentBounds(a,s);s=d.paddings;let u=this._calculateDifference(d.innerRect,n);if(this._isAutoExpand(a))o.push(this._makeSoftLimit(a,d.boundingRect,u));else{r=u;break}}return{soft:o,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new gi(e,n))}_calculateDifference(e,n){return{min:this._calculateMinimumDifference(e,n),max:this._calculateMaximumDifference(e,n)}}_calculateMinimumDifference(e,n){return O.initialize(e.x-n.x,e.y-n.y)}_calculateMaximumDifference(e,n){return O.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||Qr)};static \u0275prov=h({token:Qr,factory:Qr.\u0275fac})};return t=y([C(Yc)],t),t})(),Kc=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(i,e){this.rootHandlers=i,this.participants=e}},Zc=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.constraints=e,this.handlerPool=n}},yi=class{_mediator=c(E);_store=c(b);_behaviour=c(On);_source;_target;_sourceRef;_targetRef;_sourceDelta=O.initialize();_targetDelta=O.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 Yt(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,i)))}setTargetDelta(i){this._targetDelta=i,this._mediator.execute(new Yt(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=xe.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=xe.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new st(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 Ye(i))}_withDelta(i,e){return xe.fromRoundedRect(i).addPoint(e)}_resolveRotationContext(i){return this._mediator.execute(new wt(i))}},Ci=(()=>{class t extends yi{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),vi=(()=>{class t extends yi{_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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),xi=(()=>{class t extends yi{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Dy=(()=>{let t=class Jr{_store=c(b);_mediator=c(E);_dragInjector=c(ke);handle({dragHandler:e,constraints:n,handlerPool:o}){let r=n.soft.map(s=>this._buildParentConnectionHandlers(s.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 s=new Set(o.map(f=>f.fId())),a=new Set(r.map(f=>f.fId())),d=new Map,u={source:[],target:[]};for(let f of this._store.connections.getAll()){let g=s.has(f.fOutputId()),x=a.has(f.fInputId());if(!g&&!x)continue;let w=this._getExistingConnectionHandler(n,f);if(w||(w=this._createConnectionHandler(f,g,x),n.push(w)),g){let M=this._store.outputs.require(f.fOutputId());u.source.push({handler:w,connector:M,baselineRect:this._readConnectorRect(M,d)})}if(x){let M=this._store.inputs.require(f.fInputId());u.target.push({handler:w,connector:M,baselineRect:this._readConnectorRect(M,d)})}}return u}_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(vi):n?r=this._dragInjector.createInstance(Ci):r=this._dragInjector.createInstance(xi),r.initialize(e),r}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let s=this._mediator.execute(new Ye(e)).rect;return n.set(o,s),s}static \u0275fac=function(n){return new(n||Jr)};static \u0275prov=h({token:Jr,factory:Jr.\u0275fac})};return t=y([C(Zc)],t),t})(),Ey=(()=>{let t=class es{_dragInjector=c(ke);_mediator=c(E);handle({rootHandlers:e,participants:n}){let o=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,o);let r=this._dragInjector.createInstance(Ot);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 Zc(e,n,o))}_calculateConstraints(e){return this._mediator.execute(new Yc(e))}static \u0275fac=function(n){return new(n||es)};static \u0275prov=h({token:es,factory:es.\u0275fac})};return t=y([C(Kc)],t),t})(),Qc=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.sourceIds=e,this.handlerPool=n}},Py=(()=>{let t=class ts{_store=c(b);_dragInjector=c(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(vi):o=this._dragInjector.createInstance(xi),o.initialize(n),o}static \u0275fac=function(n){return new(n||ts)};static \u0275prov=h({token:ts,factory:ts.\u0275fac})};return t=y([C(Qc)],t),t})(),Jc=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.targetIds=e,this.handlerPool=n}},My=(()=>{let t=class ns{_store=c(b);_dragInjector=c(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(vi):o=this._dragInjector.createInstance(Ci),o.initialize(n),o}static \u0275fac=function(n){return new(n||ns)};static \u0275prov=h({token:ns,factory:ns.\u0275fac})};return t=y([C(Jc)],t),t})(),ed=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(i){this.nodeOrGroup=i}},Ry=(()=>{let t=class is{_mediator=c(E);_store=c(b);_dragSession=c(U);handle({nodeOrGroup:e}){let n=this._collectSelected(e),o=this._withDeepChildren(n),r=this._mediator.execute(new qc(o)),s=this._collectSourceConnectorIds(o),a=this._collectTargetConnectorIds(o);return this._attachConnectionHandlers(r.participants,s,a),this._mediator.execute(new Kc(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 kn(o.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return Jl(e,n=>this._store.outputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_collectTargetConnectorIds(e){return Jl(e,n=>this._store.inputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_attachConnectionHandlers(e,n,o){let r=[];for(let s of e)this._mediator.execute(new Jc(s,o,r)),this._mediator.execute(new Qc(s,n,r))}static \u0275fac=function(n){return new(n||is)};static \u0275prov=h({token:is,factory:is.\u0275fac})};return t=y([C(ed)],t),t})(),Ny=[Iy,Ty,Ey,Py,My,Dy,Sy,Ry];function ky(t,i,e=10){let n=i.x,o=i.y,r=n+i.width,s=o+i.height,a=i.gravityCenter.x,d=i.gravityCenter.y,u,f,g=1/0,x,w,M=1/0,T=(D,R)=>{let L=R<0?-R:R;L<=e&&L<g&&(g=L,u=D,f=R)},S=(D,R)=>{let L=R<0?-R:R;L<=e&&L<M&&(M=L,x=D,w=R)};for(let D=0;D<t.length;D++){let R=t[D],L=R.x,B=R.y,j=L+R.width,X=B+R.height,ye=R.gravityCenter.x,ne=R.gravityCenter.y;T(L,n-L),T(j,n-j),T(ye,a-ye),T(L,r-L),T(j,r-j),S(B,o-B),S(X,o-X),S(ne,d-ne),S(B,s-B),S(X,s-X)}return{x:{guide:u,delta:f},y:{guide:x,delta:w}}}var Fh=["left","top","width","height"],td=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 Fh){let n=i[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let i of Fh)this._element.style.removeProperty(i)}destroy(){this._element.remove()}},sf=class{_horizontal;_vertical;constructor(i,e){this._horizontal=new td(i,e),this._vertical=new td(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()}},nd=class{static fToken=Symbol("MagneticLinesPreparationRequest")},Oy=(()=>{let t=class os{_mediator=c(E);_store=c(b);_browser=c(we);_injector=c(je);_dragSession=c(U);_renderer;handle(e){let n=this._store.instances.get(_e.MAGNETIC_LINES);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof Ot);o&&o.setMagneticLines(new af(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 sf(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 ge(r.hostElement)))}static \u0275fac=function(n){return new(n||os)};static \u0275prov=h({token:os,factory:os.\u0275fac})};return t=y([C(nd)],t),t})(),af=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(b);this._alignThreshold=r.instances.require(_e.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 ky(this._rects,i,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},Ah=["top","center","bottom"],Lh=["left","center","right"];function Fy(t,i,e=10,n=10){let o=i.x,r=i.y,s=o+i.width,a=r+i.height,d=i.gravityCenter.x,u=i.gravityCenter.y,f=Ay(t,i,o,r,s,a,d,u,e,n),g=Ly(t,i,o,r,s,a,d,u,e,n);return f&&(!g||f.absDelta<=g.absDelta)?{axis:"x",delta:f.delta,gap:f.gap,rects:f.rects,alignMode:f.alignMode,crossDelta:f.crossDelta}:g?{axis:"y",delta:g.delta,gap:g.gap,rects:g.rects,alignMode:g.alignMode,crossDelta:g.crossDelta}:{rects:[]}}function Ay(t,i,e,n,o,r,s,a,d,u){let f=1/0,g,x=0,w,M=[],T=0,S=[],D=[],R=[];for(let L=0;L<Ah.length;L++){let B=L===0?n:L===1?a:r;S.length=0,D.length=0,R.length=0;let j=1/0,X=-1/0,ye=0,ne=1/0,Re=1/0;for(let ce=0;ce<t.length;ce++){let ee=t[ce],Bn=L===0?ee.y:L===1?ee.gravityCenter.y:ee.y+ee.height,Vl=B-Bn,_t=yn(Vl);if(_t>d)continue;S.push(ce),D.push(ee.x),R.push(ee.x+ee.width);let Gn=ee.y,Hn=ee.y+ee.height;Gn<j&&(j=Gn),Hn>X&&(X=Hn),(_t<ne||_t===ne&&ce<Re)&&(ne=_t,ye=Bn,Re=ce)}let Y=S.length;if(Y<2)continue;vp(S,D,R);let te=0;for(;te<Y&&D[te]<=s;)te++;let Oe=te>0&&te<Y,ue,We;Oe?(ue=te-1,We=te):te<=0?(ue=0,We=1):(ue=Y-2,We=Y-1);let $e=D[We]-R[ue];if($e<0)continue;let Pe;if(Oe){Pe=R[ue]+$e;let ce=Pe+i.width,ee=D[We]-ce;if(yn(ee-$e)>u)continue}else te<=0?Pe=D[0]-$e-i.width:Pe=R[Y-1]+$e;let zn=e-Pe,Lt=yn(zn);if(Lt>u||Lt>=f)continue;let et=zy(S,D,R,j,X);if(Oe){let ce=Pe,ee=Pe+i.width;et.push({left:R[ue],top:j,width:ce-R[ue],height:X-j}),et.push({left:ee,top:j,width:D[We]-ee,height:X-j})}else if(te<=0){let ce=Pe+i.width;et.push({left:ce,top:j,width:D[0]-ce,height:X-j})}else et.push({left:R[Y-1],top:j,width:Pe-R[Y-1],height:X-j});let jl=B-ye;f=Lt,g=zn,x=$e,w=Ah[L],M=et,T=jl}if(!(g===void 0||w===void 0))return{delta:g,absDelta:f,gap:x,rects:M,alignMode:w,crossDelta:T}}function Ly(t,i,e,n,o,r,s,a,d,u){let f=1/0,g,x=0,w,M=[],T=0,S=[],D=[],R=[];for(let L=0;L<Lh.length;L++){let B=L===0?e:L===1?s:o;S.length=0,D.length=0,R.length=0;let j=1/0,X=-1/0,ye=0,ne=1/0,Re=1/0;for(let ce=0;ce<t.length;ce++){let ee=t[ce],Bn=L===0?ee.x:L===1?ee.gravityCenter.x:ee.x+ee.width,Vl=B-Bn,_t=yn(Vl);if(_t>d)continue;S.push(ce),D.push(ee.y),R.push(ee.y+ee.height);let Gn=ee.x,Hn=ee.x+ee.width;Gn<j&&(j=Gn),Hn>X&&(X=Hn),(_t<ne||_t===ne&&ce<Re)&&(ne=_t,ye=Bn,Re=ce)}let Y=S.length;if(Y<2)continue;vp(S,D,R);let te=0;for(;te<Y&&D[te]<=a;)te++;let Oe=te>0&&te<Y,ue,We;Oe?(ue=te-1,We=te):te<=0?(ue=0,We=1):(ue=Y-2,We=Y-1);let $e=D[We]-R[ue];if($e<0)continue;let Pe;if(Oe){Pe=R[ue]+$e;let ce=Pe+i.height,ee=D[We]-ce;if(yn(ee-$e)>u)continue}else te<=0?Pe=D[0]-$e-i.height:Pe=R[Y-1]+$e;let zn=n-Pe,Lt=yn(zn);if(Lt>u||Lt>=f)continue;let et=By(S,D,R,j,X);if(Oe){let ce=Pe,ee=Pe+i.height;et.push({left:j,top:R[ue],width:X-j,height:ce-R[ue]}),et.push({left:j,top:ee,width:X-j,height:D[We]-ee})}else if(te<=0){let ce=Pe+i.height;et.push({left:j,top:ce,width:X-j,height:D[0]-ce})}else et.push({left:j,top:R[Y-1],width:X-j,height:Pe-R[Y-1]});let jl=B-ye;f=Lt,g=zn,x=$e,w=Lh[L],M=et,T=jl}if(!(g===void 0||w===void 0))return{delta:g,absDelta:f,gap:x,rects:M,alignMode:w,crossDelta:T}}function zy(t,i,e,n,o){let r=[],s=o-n;for(let a=0;a<t.length-1;a++){let d=i[a+1]-e[a];d<0||r.push({left:e[a],top:n,width:d,height:s})}return r}function By(t,i,e,n,o){let r=[],s=o-n;for(let a=0;a<t.length-1;a++){let d=i[a+1]-e[a];d<0||r.push({left:n,top:e[a],width:s,height:d})}return r}function vp(t,i,e){for(let n=1;n<i.length;n++){let o=i[n],r=e[n],s=t[n],a=n-1;for(;a>=0;){let d=i[a],u=t[a];if(d<o||d===o&&u<s)break;i[a+1]=d,e[a+1]=e[a],t[a+1]=u,a--}i[a+1]=o,e[a+1]=r,t[a+1]=s}}function yn(t){return t<0?-t:t}var cf=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()}},df=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 s=0;s<i.length;s++){let a=this._getOrCreate(s),d=i[s];a.show(),a.render(d.left*n+o,d.top*n+r,d.width*n,d.height*n)}for(let s=i.length;s<this._activeCount;s++)this._pool[s].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 cf(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},id=class{static fToken=Symbol("MagneticRectsPreparationRequest")},Gy=(()=>{let t=class rs{_mediator=c(E);_store=c(b);_browser=c(we);_injector=c(je);_dragSession=c(U);_renderer;handle(e){let n=this._store.instances.get(_e.MAGNETIC_RECTS);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof Ot);o&&o.setMagneticRects(new lf(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 df(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 ge(r.hostElement)))}static \u0275fac=function(n){return new(n||rs)};static \u0275prov=h({token:rs,factory:rs.\u0275fac})};return t=y([C(id)],t),t})(),lf=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(i,e,n){this._renderer=e,this._rects=n;let o=i.get(b),r=o.instances.require(_e.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 Fy(this._rects,i,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},od=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(i){this.event=i}},uf=class{nodes;fNodes;constructor(i){this.nodes=i,this.fNodes=i}},Hy=(()=>{let t=class ss{_mediator=c(E);_store=c(b);_dragSession=c(U);_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(by)}_buildDragDelta(e){return V.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,o){let r=e.x,s=e.y;return n&&(r=this._hasLineSnapValue(n.x)?e.x-(n.x.delta||0):r,s=this._hasLineSnapValue(n.y)?e.y-(n.y.delta||0):s),this._hasRectSnapValue(o)&&(o.axis==="x"?(r=e.x-o.delta,s=e.y-(o.crossDelta??0)):(s=e.y-o.delta,r=e.x-(o.crossDelta??0))),{x:r,y:s}}_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(),s=((n.data??n.fData)?.fNodeIds??[]).map(a=>({id:a,position:this._store.nodes.get(a)?._position}));return new uf(s)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new Ec(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||ss)};static \u0275prov=h({token:ss,factory:ss.\u0275fac})};return t=y([C(od)],t),t})(),rd=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(i,e){this.event=i,this.trigger=e}},jy=(()=>{let t=class as{_mediator=c(E);_store=c(b);_dragSession=c(U);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 nd),this._mediator.execute(new id))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&Je(e.originalEvent,n)}_isDragHandle(e){return Zn(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=V.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new Nn(e))}),this._mediator.execute(new ed(e))}static \u0275fac=function(n){return new(n||as)};static \u0275prov=h({token:as,factory:as.\u0275fac})};return t=y([C(rd)],t),t})(),Vy=[...Ny,Oy,Gy,Hy,jy],ff=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}},Uy=(()=>{let t=class cs{_dragSession=c(U);_store=c(b);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 _i)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new ff(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(s=>s.nodeOrGroup),o=new Set(n.map(s=>s.fId())),r=[];for(let s of n){let a=s.fParentId();(!a||!o.has(a))&&r.push(s.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof Ot);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||cs)};static \u0275prov=h({token:cs,factory:cs.\u0275fac})};return t=y([C($c)],t),t})(),sd=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(i){this.event=i}},ad=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(i){this.candidates=i}},Wy=(()=>{let t=class ds{handle({candidates:e}){let n=e.map((o,r)=>({candidate:o,index:r}));return n.sort((o,r)=>{let s=this._compareDomOrder(o.candidate.node.hostElement,r.candidate.node.hostElement);return s!==0?-s: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},s=n.getBoundingClientRect?.()??{top:0,left:0};return r.top!==s.top?r.top<s.top?-1:1:r.left!==s.left?r.left<s.left?-1:1:0}return 0}static \u0275fac=function(n){return new(n||ds)};static \u0275prov=h({token:ds,factory:ds.\u0275fac})};return t=y([C(ad)],t),t})(),hf=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(i,e,n){this._onPointerDown=e,this._limit=n;let o=i.get(b);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}},cd=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(i){this.externalItem=i}},$y=(()=>{let t=class ls{_browser=c(we);_containerRef=c(Xi);handle({externalItem:e}){let{hostElement:n,placeholder:o}=e,r=o(),s=r?this._fromTemplate(r):this._fromHost(n);return s.classList.add("f-external-item-placeholder"),s.style.pointerEvents="none",s}_fromTemplate(e){return nu(this._createViewRef(e),this._browser.document)}_fromHost(e){return eu(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||ls)};static \u0275prov=h({token:ls,factory:ls.\u0275fac})};return t=y([C(cd)],t),t})(),dd=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(i){this.externalItem=i}},qy=(()=>{let t=class us{_browser=c(we);_containerRef=c(Xi);handle({externalItem:e}){let{hostElement:n,preview:o}=e,r=o(),s=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(s),_h(s),s.classList.add("f-external-item-preview"),s}_fromTemplate(e){return nu(this._createViewRef(e),this._browser.document)}_fromHost(e){return eu(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){tu(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||us)};static \u0275prov=h({token:us,factory:us.\u0275fac})};return t=y([C(dd)],t),t})(),ld=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(i){this.event=i}},pf=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}},Xy="external-item",Yy="drag-external-item";function Ky(t){return t.getEvent().kind===Yy||t.getEvent().fEventType===Xy}var Zy=(()=>{let t=class fs{_result=c(Ft);_mediator=c(E);_store=c(b);_dragSession=c(U);_browser=c(we);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=>Ky(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 _i);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 pf(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 ge(this._result.getData().preview))}static \u0275fac=function(n){return new(n||fs)};static \u0275prov=h({token:fs,factory:fs.\u0275fac})};return t=y([C(ld)],t),t})(),mf=class{data;constructor(i){this.data=i}},ud=class extends Ge{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new mf(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=z.initialize();_pointerDownRect=z.initialize();_absoluteOffsetFromFlow=O.initialize();_grabOffsetFromPointer=O.initialize();_originalParent;_originalNextSibling;_originalDisplay;_applyConstraints=i=>i;constructor(i,e,n){super(),this._externalItem=e,this._pointerDownClientPosition=n,this._store=i.get(b),this._result=i.get(Ft),this._mediator=i.get(E),this._browser=i.get(we),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 hf(i,this._startRect,dp());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new ge(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=V.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 dd(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(i,this._pointerDownRect),i.style.transform=zh(this._pointerDownRect),i}_createPlaceholder(){return this._mediator.execute(new cd(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=V.fromPoint(this._startRect).add(o),s=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=zh(s)}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 z.initialize(e.left+o,e.top+n,e.width,e.height)}_toAbsolutePoint(i){let e=V.fromPoint(this._transform.position).add(this._transform.scaledPosition);return V.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 V.fromPoint(r).sub(this._startRect)}_toFlowPoint(i){let e=this._getFlowHostAbsolutePosition(),n=V.fromPoint(this._transform.position).add(this._transform.scaledPosition);return V.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 O.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 V.fromPoint(i).add(O.initialize(n,e))}};function zh({x:t,y:i}){return`translate3d(${Math.round(t)}px, ${Math.round(i)}px, 0)`}var fd=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function Qy(t){return!!t.closest?.("[fExternalItem]")}function Jy(t){return t.closest("[fExternalItem]")}var eC=(()=>{class t{_byHost=new Map;_items=$([]);items=H(()=>this._items());getByElement(e){let n=Jy(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=h({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var tC=(()=>{let t=class hs{_apiService=c(eC);_dragSession=c(U);_store=c(b);_injector=c(je);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!Je(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=V.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new ud(this._injector,o,e.getPosition())]}_resolveExternalItem(e){return this._apiService.getByElement(e)}static \u0275fac=function(n){return new(n||hs)};static \u0275prov=h({token:hs,factory:hs.\u0275fac})};return t=y([C(fd)],t),t})(),hd=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(i){this.event=i}},nC=(()=>{let t=class ps{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=Qy(e)}catch{}return n}static \u0275fac=function(n){return new(n||ps)};static \u0275prov=h({token:ps,factory:ps.\u0275fac})};return t=y([C(hd)],t),t})(),iC=[$y,qy,Zy,tC,nC],oC=(()=>{let t=class ms{_mediator=c(E);_dragContext=c(U);_store=c(b);_dragInjector=c(ke);get _allNodes(){return this._store.nodes.getAll()}handle({event:e}){if(!this._canPrepare())return;let n=this._allNodes.find(s=>s.isContains(e.targetElement));if(!n&&!this._hasExternalDrag())throw new Error("Drag target node not found");let o=this._sortedTargetsForDrop();if(n){let s=n.fParentId(),a=this._mediator.execute(new Vd(s));a.length&&(o=o.filter(d=>a.includes(d.node.fId())))}let r=this._dragInjector.get(_i);r.initialize(o),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof Ot)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof ud)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(a=>a instanceof qu),o=this._withParents(e),s=this._eligibleTargets(o,n).map(a=>{let d=this._mediator.execute(new ge(a.hostElement));return{node:a,rect:d}});return this._mediator.execute(new ad(s))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof Ot);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,o)=>{n.push(o);let r=this._mediator.execute(new Pn(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 qu):o}static \u0275fac=function(n){return new(n||ms)};static \u0275prov=h({token:ms,factory:ms.\u0275fac})};return t=y([C(sd)],t),t})(),rC=[Wy,oC,Uy],pd=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(i){this.event=i}},sC=.5,md=(()=>{class t extends Ge{type="pinch-to-zoom";kind="pinch-to-zoom";_store=c(b);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(_e.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=Bh(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=Bh(n.touches),r=aC(n.touches);if(o==null||r==null){this._reset();return}if(Math.abs(o-this._startDistance)<sC)return;n.preventDefault();let s=o/this._startDistance,a=this._clamp(this._startScale*s);this._canvas.setScale(a,this._castPositionToFlow(r)),this._canvas.redraw()}_clamp(e){return Math.max(this._zoomComponent.minimum,Math.min(e,this._zoomComponent.maximum))}_castPositionToFlow(e){return V.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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})();function aC(t){if(t.length!==2)return null;let i=t[0],e=t[1];return O.initialize((i.clientX+e.clientX)/2,(i.clientY+e.clientY)/2)}function Bh(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 cC=(()=>{let t=class _s{_dragSession=c(U);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof md)}static \u0275fac=function(n){return new(n||_s)};static \u0275prov=h({token:_s,factory:_s.\u0275fac})};return t=y([C(pd)],t),t})(),_d=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(i){this.event=i}},dC=(()=>{let t=class gs{_dragInjector=c(ke);_store=c(b);_dragSession=c(U);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new V,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(_e.ZOOM)}_getHandler(e){let n=this._dragInjector.get(md);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||gs)};static \u0275prov=h({token:gs,factory:gs.\u0275fac})};return t=y([C(_d)],t),t})(),lC=[dC,cC],gd=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(i){this.event=i}},uC=(()=>{let t=class ys{_dragSession=c(U);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||ys)};static \u0275prov=h({token:ys,factory:ys.\u0275fac})};return t=y([C(gd)],t),t})(),_f=(()=>{class t extends Ge{type="selection-area";kind="selection-area";_store=c(b);_dragSession=c(U);_mediator=c(E);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return V.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(_e.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new tl),this._show(),this._draw(z.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=V.fromPoint(e).add(this._dragSession.onPointerDownPosition),o=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),s=Math.abs(e.y),a=z.initialize(o.x,o.y,r,s);this._draw(a),this._selectedByMove=[],this._canBeSelected.forEach(d=>{d.element.unmarkAsSelected();let u=z.addPoint(z.mult(d.fRect,this._transform.scale),this._canvasPosition);z.intersectionWithRect(u,a)&&(d.element.markAsSelected(),this._selectedByMove.push(d.element))}),this._mediator.execute(new Rt)}_getMinimumPoint(e,n){return O.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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),yd=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(i){this.event=i}},fC=(()=>{let t=class Cs{_store=c(b);_dragSession=c(U);_dragInjector=c(ke);get _instance(){return this._store.instances.get(_e.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=V.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(_f)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&Je(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||Cs)};static \u0275prov=h({token:Cs,factory:Cs.\u0275fac})};return t=y([C(yd)],t),t})(),hC=[fC,uC],Cd=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(i,e){this.rect=i,this.childrenBounds=e}},pC=(()=>{let t=class vs{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||vs)};static \u0275prov=h({token:vs,factory:vs.\u0275fac})};return t=y([C(Cd)],t),t})(),vd=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(i,e){this.rect=i,this.limits=e}},mC=(()=>{let t=class xs{_mediator=c(E);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=de({},e);return n.hardLimit&&this._clampRectToInner(o,n.hardLimit.innerRect),o}_clampRectToInner(e,n){if(e.x<n.x){let s=n.x-e.x;e.x+=s,e.width-=s}if(e.y<n.y){let s=n.y-e.y;e.y+=s,e.height-=s}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,s=this._computeOverflow(o,e);if(!this._hasOverflow(s)){this._applyParentRect(n,r);return}let a=this._buildExpandedParentRect(r,s);this._applyParentRect(n,a)}_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),s=Math.max(0,n.x+n.width-(e.x+e.width)),a=Math.max(0,n.y+n.height-(e.y+e.height));return{left:o,top:r,right:s,bottom:a}}_buildExpandedParentRect(e,n){let o=de({},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 Kt(e.nodeOrGroup.fId(),n)),e.nodeOrGroup.redraw()}static \u0275fac=function(n){return new(n||xs)};static \u0275prov=h({token:xs,factory:xs.\u0275fac})};return t=y([C(vd)],t),t})(),xd=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}},Gh={[ft.LEFT]:{x:-1,y:0},[ft.LEFT_TOP]:{x:-1,y:-1},[ft.TOP]:{x:0,y:-1},[ft.RIGHT_TOP]:{x:1,y:-1},[ft.RIGHT]:{x:1,y:0},[ft.RIGHT_BOTTOM]:{x:1,y:1},[ft.BOTTOM]:{x:0,y:1},[ft.LEFT_BOTTOM]:{x:-1,y:1}},_C=(()=>{let t=class ws{handle({originalRect:e,difference:n,handleType:o,minimumSize:r}){let s=this._changeSizeInRect(e,n,Gh[o],r);return this._changePosition(e,n,Gh[o],s)}_changeSizeInRect(e,n,o,r){let s=e.width+o.x*n.x,a=e.height+o.y*n.y,d=0,u=0;return s<0&&(d=s,s=Math.abs(s)),s<r.width&&(o.x===-1&&(d+=s-r.width),s=r.width),a<0&&(u=a,a=Math.abs(a)),a<r.height&&(o.y===-1&&(u+=a-r.height),a=r.height),z.initialize(d,u,s,a)}_changePosition(e,n,o,r){let s=e.x+(o.x===-1?n.x:0)+r.x,a=e.y+(o.y===-1?n.y:0)+r.y;return z.initialize(s,a,r.width,r.height)}static \u0275fac=function(n){return new(n||ws)};static \u0275prov=h({token:ws,factory:ws.\u0275fac})};return t=y([C(xd)],t),t})(),wd=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(i,e){this.nodeOrGroup=i,this.paddings=e}},gC=(()=>{let t=class bs{_mediator=c(E);_store=c(b);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let o=z.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 ge(e.hostElement))}_concatRectWithParentPadding(e,n){return z.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||bs)};static \u0275prov=h({token:bs,factory:bs.\u0275fac})};return t=y([C(wd)],t),t})(),wi=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(i,e){this.nodeOrGroup=i,this.rect=e}},yC=(()=>{let t=class Is{_mediator=c(E);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:ot.initialize(r[0]+r[2],r[1]+r[3])}}_calculateNodePaddings(e,n){return this._mediator.execute(new en(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new wd(e,n))}_getParentsChain(e){return this._mediator.execute(new Pn(e))??[]}_buildSoftHardLimits(e){let n=[],o,r=[0,0,0,0];for(let s of e){let a=this._getParentInfo(s,r);if(r=a.paddings,this._isAutoExpand(s))n.push(this._makeLimit(s,a));else{o=this._makeLimit(s,a);break}}return{softLimits:n,hardLimit:o}}_getParentInfo(e,n){return this._mediator.execute(new gi(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||Is)};static \u0275prov=h({token:Is,factory:Is.\u0275fac})};return t=y([C(wi)],t),t})(),bd=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(i){this.event=i}},xp="node-resize",wp="resize-node";function CC(t){return t.getEvent().kind===wp||t.getEvent().fEventType===xp}var vC=(()=>{let t=class Ss{_dragSession=c(U);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>CC(e))}static \u0275fac=function(n){return new(n||Ss)};static \u0275prov=h({token:Ss,factory:Ss.\u0275fac})};return t=y([C(bd)],t),t})(),gf=class{fNodeId;constructor(i){this.fNodeId=i}},yf=(()=>{class t extends Ge{type=xp;kind=wp;data(){return new gf(this._nodeOrGroup.fId())}_mediator=c(E);_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 ge(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new wi(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new xd(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Cd(e,this._constraints.childrenBounds)),this._mediator.execute(new vd(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 Kt(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return z.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 s=this._mediator.execute(new Nt(e.hostElement,!1));return n.set(o,s),s}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),bi=class{_mediator=c(E);_store=c(b);_behaviour=c(On);_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=xe.fromRoundedRect(this._sourceRef.rect),this._targetRect=xe.fromRoundedRect(this._targetRef.rect)}setSourceRect(i){this._sourceRect=xe.fromRoundedRect(i),this._mediator.execute(new Yt(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(i){this._targetRect=xe.fromRoundedRect(i),this._mediator.execute(new Yt(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=xe.fromRoundedRect(this._sourceRect),e=xe.fromRoundedRect(this._targetRect);return this._behaviour.handle(new st(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 Nt(i.hostElement,!1))}}_resolveRotationContext(i){return this._mediator.execute(new wt(i))}},xC=(()=>{class t extends bi{_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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),wC=(()=>{class t extends bi{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),bC=(()=>{class t extends bi{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Id=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Sd=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(i,e){this.handler=i,this.nodeOrGroup=e}},IC=(()=>{let t=class Ts{_store=c(b);_mediator=c(E);_dragInjector=c(ke);handle({handler:e,nodeOrGroup:n}){let o=this._readSoftParents(n),r=[n,...o],s=this._collectSourceConnectorIds(r),a=this._collectTargetConnectorIds(r),d=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,s,a,d)),e.setSoftParentConnectionHandlers(o.map(u=>this._buildConnectionHandlersForNode(u,s,a,d)))}_readSoftParents(e){let n=this._mediator.execute(new ge(e.hostElement));return this._mediator.execute(new wi(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 s=this._store.outputs.getAll().filter(g=>g.fNodeId===e.fId()),a=this._store.inputs.getAll().filter(g=>g.fNodeId===e.fId());if(!s.length&&!a.length)return{source:[],target:[]};let d=new Set(s.map(g=>g.fId())),u=new Set(a.map(g=>g.fId())),f={source:[],target:[]};for(let g of this._store.connections.getAll()){let x=d.has(g.fOutputId()),w=u.has(g.fInputId());if(!x&&!w)continue;let M=r.get(g.fId())??this._createConnectionHandler(g,n,o);if(r.set(g.fId(),M),x){let T=this._store.outputs.require(g.fOutputId());f.source.push({handler:M,connector:T})}if(w){let T=this._store.inputs.require(g.fInputId());f.target.push({handler:M,connector:T})}}return f}_createConnectionHandler(e,n,o){let r=n.has(e.fOutputId()),s=o.has(e.fInputId()),a=r&&s?this._dragInjector.createInstance(xC):r?this._dragInjector.createInstance(wC):this._dragInjector.createInstance(bC);return a.initialize(e),a}static \u0275fac=function(n){return new(n||Ts)};static \u0275prov=h({token:Ts,factory:Ts.\u0275fac})};return t=y([C(Sd)],t),t})(),SC=(()=>{let t=class Ds{_mediator=c(E);_store=c(b);_dragSession=c(U);_dragInjector=c(ke);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!Je(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=V.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let s=this._dragInjector.createInstance(yf);s.initialize(o,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new Sd(s,o)),this._dragSession.draggableItems=[s]}_isResizeHandle(e){return Zn(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 Nn(e))})}_readResizeHandleType(e){let n=gh(e,"fResizeHandleType",".f-resize-handle");return ft[n]}static \u0275fac=function(n){return new(n||Ds)};static \u0275prov=h({token:Ds,factory:Ds.\u0275fac})};return t=y([C(Id)],t),t})(),TC=[pC,mC,_C,gC,yC,IC,vC,SC],Td=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(i){this.event=i}},bp="node-rotate",Ip="rotate-node";function DC(t){return t.getEvent().kind===Ip||t.getEvent().fEventType===bp}var EC=(()=>{let t=class Es{_dragSession=c(U);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>DC(e))}static \u0275fac=function(n){return new(n||Es)};static \u0275prov=h({token:Es,factory:Es.\u0275fac})};return t=y([C(Td)],t),t})(),Dd=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Cf=class{fNodeId;constructor(i){this.fNodeId=i}};function PC(t,i,e){let{x:n,y:o}=MC(t,i,e),r=n-t.x,s=o-t.y;return{x:r,y:s}}function MC(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,s=Math.cos(r),a=Math.sin(r),d=n*s-o*a,u=n*a+o*s,f=d+e.x,g=u+e.y;return{x:f,y:g}}var vf=(()=>{class t extends Ge{type=bp;kind=Ip;data(){return new Cf(this._nodeOrGroup.fId())}_store=c(b);_mediator=c(E);_dragSession=c(U);_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=O.sum(this._pointerDownInFlow,e),r=this._angleDeg(n)-this._rotationOffsetDeg;this._applyRotation(r);let s=r-this._startRotation;for(let a of this._sourceConnections)a.connection.setSourceDelta(this._deltaAfterRotation(a.connector,s));for(let a of this._targetConnections)a.connection.setTargetDelta(this._deltaAfterRotation(a.connector,s))}onPointerUp(){this._nodeOrGroup.rotate.set(this._nodeOrGroup._rotate),this._nodeOrGroup.refresh()}_readNodeRect(){return this._mediator.execute(new ge(this._nodeOrGroup.hostElement))}_calculatePointerDownInFlow(){return O.sub(this._dragSession.onPointerDownPosition,O.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 PC(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),RC=(()=>{let t=class Ps{_mediator=c(E);_store=c(b);_dragContext=c(U);_dragInjector=c(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=V.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(o);let r=this._dragInjector.createInstance(vf);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&ey(e.targetElement)&&Je(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 Nn(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new kd(e)).map(n=>{let o=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new Ye(o)),s=this._dragInjector.get(xi);return s.initialize(n),{connection:s,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new jd(e)).map(n=>{let o=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new Ye(o)),s=this._dragInjector.get(Ci);return s.initialize(n),{connection:s,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||Ps)};static \u0275prov=h({token:Ps,factory:Ps.\u0275fac})};return t=y([C(Dd)],t),t})(),NC=[EC,RC],Ii=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}},kC=(()=>{let t=class Ms{_store=c(b);get _canvasScale(){return this._store.transform.scale||1}handle(e){return O.sub(e.canvasPosition,O.sub(this._getPositionInViewBox(e.eventPoint,e.minimap),this._getNormalizedFlowCenter(e.flowRect)))}_getNormalizedFlowCenter(e){return V.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let o=this.normalizeEventPoint(e,n);return O.sum(o,z.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return V.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||Ms)};static \u0275prov=h({token:Ms,factory:Ms.\u0275fac})};return t=y([C(Ii)],t),t})(),Ed=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(i){this.event=i}},OC=(()=>{let t=class Rs{_dragSession=c(U);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(FC)}static \u0275fac=function(n){return new(n||Rs)};static \u0275prov=h({token:Rs,factory:Rs.\u0275fac})};return t=y([C(Ed)],t),t})(),Sp="minimap",Tp="minimap";function FC(t){return t.getEvent().kind===Tp||t.getEvent().fEventType===Sp}var xf=(()=>{class t extends Ge{type=Sp;kind=Tp;_store=c(b);_mediator=c(E);_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(V.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 Ii(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=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Pd=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(i){this.event=i}},AC=(()=>{let t=class Ns{_store=c(b);_mediator=c(E);_dragSession=c(U);_dragInjector=c(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(_e.MINIMAP).state,o=e.getPosition(),r=V.fromPoint(this._store.transform.position),s=z.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(s,o,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=V.fromPoint(o).elementTransform(this._flowHost);let a=this._dragInjector.createInstance(xf);a.initialize(s,r,o,n),this._dragSession.draggableItems=[a]}_isValid(e){return!(!this._dragSession.isEmpty()||!this._flowHost.contains(e.targetElement)||!e.targetElement.closest(".f-minimap")||!this._store.instances.get(_e.MINIMAP))}_calculateCanvasPosition(e,n,o){return this._mediator.execute(new Ii(e,V.fromPoint(this._canvas.transform.position),n,o))}static \u0275fac=function(n){return new(n||Ns)};static \u0275prov=h({token:Ns,factory:Ns.\u0275fac})};return t=y([C(Pd)],t),t})(),LC=[kC,OC,AC];function zC(t){return!!t&&typeof t.destroy=="function"}var ke=(()=>{class t{_injector=c(je);_dragInjector=null;_created=[];create(){this._dragInjector=je.create({providers:[{provide:Md,useClass:Md},{provide:Uc,useClass:Uc},{provide:Fc,useClass:Fc},{provide:Qu,useClass:Qu},{provide:_i,useClass:_i},{provide:Ci,useClass:Ci},{provide:xi,useClass:xi},{provide:vi,useClass:vi},{provide:Ot,useClass:Ot},{provide:md,useClass:md},{provide:_f,useClass:_f},{provide:yf,useClass:yf},{provide:vf,useClass:vf},{provide:xf,useClass:xf}],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=Vf(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)zC(e)&&e.destroy();this._created=[],this._dragInjector?.destroy?.(),this._dragInjector=null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Ft=(()=>{class t{_data;setData(e){this._data=de(de({},this._data),e)}getData(){return this._data}clear(){this._data=void 0}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Hh="f-canvas-dragging",jh="canvas-dragging",Md=(()=>{class t extends Ge{type="canvas-move";kind="drag-canvas";_store=c(b);_onPointerDownPosition=O.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(Hh,jh)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(V.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(Hh,jh)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),BC=(()=>{let t=class ks{_dragContext=c(U);handle(e){this._isValid()&&this._dragContext.draggableItems.forEach(n=>n.onPointerUp?.())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Md)}static \u0275fac=function(n){return new(n||ks)};static \u0275prov=h({token:ks,factory:ks.\u0275fac})};return t=y([C(Mc)],t),t})(),Rd=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},GC=(()=>{let t=class Os{_store=c(b);_dragContext=c(U);_dragInjector=c(ke);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=V.fromPoint(e.getPosition()).elementTransform(this._store.flowHost),this._dragContext.draggableItems=[this._dragInjector.get(Md)])}_isValid(e){return this._dragContext.isEmpty()&&(this._isBackgroundElement(e.targetElement)||this._isDragOnHost(e.targetElement))}_isBackgroundElement(e){return this._store.instances.get(_e.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 Je(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Os)};static \u0275prov=h({token:Os,factory:Os.\u0275fac})};return t=y([C(Rd)],t),t})(),HC=[BC,GC],Nd=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(i,e){this.event=i,this.trigger=e}},jC=(()=>{let t=class Fs{_mediator=c(E);_store=c(b);_dragSession=c(U);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let o=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(o),Je(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 tn(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||Fs)};static \u0275prov=h({token:Fs,factory:Fs.\u0275fac})};return t=y([C(Nd)],t),t})(),VC=[jC];var wf=class extends Hu{hostElement=c(Ce).nativeElement};function UC(t){return Zn(t,".f-drag-blocker")}var Dp=(()=>{class t extends wf{_result=c(Ft);_mediator=c(E);_platform=c(Ql);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===Dt.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=rt;fCreateConnectionTrigger=rt;fConnectionWaypointsTrigger=A(rt);fMoveControlPointTrigger=rt;fNodeResizeTrigger=rt;fNodeRotateTrigger=rt;fNodeMoveTrigger=rt;fCanvasMoveTrigger=rt;fExternalItemTrigger=rt;fSelectionChange=new ct;fNodeIntersectedWithConnections=new ct;fNodeConnectionsIntersection=it();fEmitOnNodeIntersect=!1;fCreateNode=new ct;fMoveNodes=new ct;fReassignConnection=new ct;fCreateConnection=new ct;fConnectionWaypointsChanged=it();fDropToGroup=new ct;vCellSize=A(1,{transform:e=>ze(e,1)});hCellSize=A(1,{transform:e=>ze(e,1)});fCellSizeWhileDragging=A(!1,{transform:e=>pe(e)});fDragStarted=new ct;fDragEnded=new ct;_dragHandlerInjector=c(ke);ngOnInit(){this._mediator.execute(new Ad(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(UC(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new zd),this._mediator.execute(new yd(e)),this._mediator.execute(new Pd(e)),this._mediator.execute(new _d(e)),this._mediator.execute(new Nd(e,this.fMultiSelectTrigger)),this._mediator.execute(new Gc(e,this.fReassignConnectionTrigger)),this._mediator.execute(new zc(e,this.fCreateConnectionTrigger)),this._mediator.execute(new Wc(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new Id(e,this.fNodeResizeTrigger)),this._mediator.execute(new Dd(e,this.fNodeRotateTrigger)),this._mediator.execute(new rd(e,this.fNodeMoveTrigger)),this._mediator.execute(new fd(e,this.fExternalItemTrigger)),this._mediator.execute(new sd(e)),this._mediator.execute(new Rd(e,this.fCanvasMoveTrigger)),this._mediator.execute(new Bd)}onSelect(e){this._mediator.execute(new hd(e))}onPointerMove(e){this._mediator.execute(new Ld(e))}onPointerUp(e){this._mediator.execute(new Ed(e)),this._mediator.execute(new gd(e)),this._mediator.execute(new Bc(e)),this._mediator.execute(new Oc(e)),this._mediator.execute(new bd(e)),this._mediator.execute(new Td(e)),this._mediator.execute(new od(e)),this._mediator.execute(new ld(e)),this._mediator.execute(new $c(e)),this._mediator.execute(new Mc(e)),this._mediator.execute(new pd(e)),this._mediator.execute(new jc(e)),this._mediator.execute(new Ic)}finalizeDragSequence(){this._mediator.execute(new kt),this._mediator.execute(new fi),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new kt),this._mediator.execute(new Gd),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275dir=be({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",pe],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",pe],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:[Ie([Ft,ke]),he]})}return t})(),WC=[...HC,...xy,...V0,...VC,...iC,...Z0,...LC,...Vy,...rC,...TC,...NC,...hC,...lC],$C=(()=>{let t=class As{_store=c(b);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 Vc(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||As)};static \u0275prov=h({token:As,factory:As.\u0275fac})};return t=y([C(Lu)],t),t})(),bf=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},qC=(()=>{let t=class Ls{_store=c(b);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||Ls)};static \u0275prov=h({token:Ls,factory:Ls.\u0275fac})};return t=y([C(bf)],t),t})(),XC=[gl,nn,G_,H_,j_,V_,Ag,f0,Hg,s0,v0,C0,u0,w0,I0,b0,l0,g0,jg,E0,d0,c0,a0,t0,r0,n0,i0,x0,m0,S0,T0,y0,_0,D0,P0,M0,R0,qC,$C],Si=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(i){this.instance=i}},YC=(()=>{let t=class zs{_store=c(b);_mediator=c(E);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 rc(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||zs)};static \u0275prov=h({token:zs,factory:zs.\u0275fac})};return t=y([C(Si)],t),t})(),Jt=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(i,e){this.position=i,this.connectorRefs=e}},KC=(()=>{let t=class Bs{handle({position:e,connectorRefs:n}){let o,r=1/0;for(let s of n){let a=this._distanceToRect(e,s.rect);a<r&&(r=a,o=s)}return o?Ul(de({},o),{distance:r}):void 0}_distanceToRect(e,{x:n,y:o,width:r,height:s}){let a=this._clamp(e.x,n,n+r),d=this._clamp(e.y,o,o+s),u=e.x-a,f=e.y-d;return Math.sqrt(u*u+f*f)}_clamp(e,n,o){return Math.max(n,Math.min(o,e))}static \u0275fac=function(n){return new(n||Bs)};static \u0275prov=h({token:Bs,factory:Bs.\u0275fac})};return t=y([C(Jt)],t),t})(),Ti=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(i,e){this.pointerPosition=i,this.connectableConnectors=e}},ZC=(()=>{let t=class Gs{_mediator=c(E);_store=c(b);_browser=c(we);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=>z.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return Fn(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new Jt(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||Gs)};static \u0275prov=h({token:Gs,factory:Gs.\u0275fac})};return t=y([C(Ti)],t),t})(),Di=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(i,e){this.source=i,this.pointer=e}},Ye=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(i){this.connector=i}},QC=(()=>{let t=class Hs{_mediator=c(E);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new Nt(e.hostElement))}static \u0275fac=function(n){return new(n||Hs)};static \u0275prov=h({token:Hs,factory:Hs.\u0275fac})};return t=y([C(Ye)],t),t})(),Ei=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(i){this.nodeOrGroup=i}},JC=(()=>{let t=class js{_store=c(b);_mediator=c(E);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new sc(e.fId(),e.hostElement,e)),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||js)};static \u0275prov=h({token:js,factory:js.\u0275fac})};return t=y([C(Ei)],t),t})(),kd=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},ev=(()=>{let t=class Vs{_store=c(b);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||Vs)};static \u0275prov=h({token:Vs,factory:Vs.\u0275fac})};return t=y([C(kd)],t),t})(),Tn=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(i,e){this.connector=i,this.pointerPosition=e}},Vh=2,Ae=(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})(Ae||{});function tv(t,i,e,n,o){let r=nv(o),s=e-t,a=n-i,d=iv(s,a);return ov(d,r)?d:rv(s,a,r,d)}function nv(t){if(!t||t.length===0)return Ae.ALL;let i=Ae.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case F.LEFT:i|=Ae.LEFT;break;case F.RIGHT:i|=Ae.RIGHT;break;case F.TOP:i|=Ae.TOP;break;case F.BOTTOM:i|=Ae.BOTTOM;break}return i||Ae.ALL}function iv(t,i){let e=t<0?-t:t,n=i<0?-i:i;return e-n>Vh?t<0?F.LEFT:F.RIGHT:(n-e>Vh,i<0?F.TOP:F.BOTTOM)}function ov(t,i){switch(t){case F.LEFT:return(i&Ae.LEFT)!==0;case F.RIGHT:return(i&Ae.RIGHT)!==0;case F.TOP:return(i&Ae.TOP)!==0;case F.BOTTOM:return(i&Ae.BOTTOM)!==0;default:return!0}}function rv(t,i,e,n){let o=n,r=-1/0;if(e&Ae.RIGHT){let s=t;s>r&&(r=s,o=F.RIGHT)}if(e&Ae.LEFT){let s=-t;s>r&&(r=s,o=F.LEFT)}if(e&Ae.BOTTOM){let s=i;s>r&&(r=s,o=F.BOTTOM)}if(e&Ae.TOP){let s=-i;s>r&&(r=s,o=F.TOP)}return o}function Od(t){return t===F.CALCULATE||t===F.CALCULATE_HORIZONTAL||t===F.CALCULATE_VERTICAL}var sv={[F.CALCULATE]:[F.TOP,F.BOTTOM,F.LEFT,F.RIGHT],[F.CALCULATE_HORIZONTAL]:[F.LEFT,F.RIGHT],[F.CALCULATE_VERTICAL]:[F.TOP,F.BOTTOM]},av=(()=>{let t=class Us{_mediator=c(E);handle({connector:e,pointerPosition:n}){let o=e.userFConnectableSide,r=this._getConnectorRect(e.hostElement).gravityCenter,s=this._accumulateConnectedCenters(e.hostElement,e.toConnector,n),a=s.sumX/s.count,d=s.sumY/s.count;return tv(r.x,r.y,a,d,sv[o])}_accumulateConnectedCenters(e,n,o){let r=o?.x||0,s=o?.y||0,a=o?1:0;if(n&&n.length)for(let d=0;d<n.length;d++){let u=n[d].hostElement;if(u===e)continue;let f=this._getConnectorRect(u).gravityCenter;r+=f.x,s+=f.y,a++}return{sumX:r,sumY:s,count:a}}_getConnectorRect(e){return this._mediator.execute(new ge(e))}static \u0275fac=function(n){return new(n||Us)};static \u0275prov=h({token:Us,factory:Us.\u0275fac})};return t=y([C(Tn)],t),t})(),Fd=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(i){this.connector=i}},Ad=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(i){this.fComponent=i}},cv=(()=>{let t=class Ws{_store=c(b);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=h({token:Ws,factory:Ws.\u0275fac})};return t=y([C(Ad)],t),t})(),Ld=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(i){this.event=i}},dv=(()=>{let t=class $s{_mediator=c(E);_store=c(b);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=c(U);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new hi)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(o=>{o.onPointerMove(de({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return V.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=h({token:$s,factory:$s.\u0275fac})};return t=y([C(Ld)],t),t})(),zd=class{static fToken=Symbol("InitializeDragSequenceRequest")},lv=(()=>{let t=class qs{_dragContext=c(U);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||qs)};static \u0275prov=h({token:qs,factory:qs.\u0275fac})};return t=y([C(zd)],t),t})(),At=class{static fToken=Symbol("IsDragStartedRequest")},uv=(()=>{let t=class Xs{_store=c(b);handle(e){return!!this._store.fDraggable?.isDragStarted}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=h({token:Xs,factory:Xs.\u0275fac})};return t=y([C(At)],t),t})(),Bd=class{static fToken=Symbol("PrepareDragSequenceRequest")},fv=(()=>{let t=class Ys{_mediator=c(E);_dragContext=c(U);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new Sc)}_callPrepareDragSequence(){this._dragContext.draggableItems.forEach(e=>e.prepareDragSequence?.())}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=h({token:Ys,factory:Ys.\u0275fac})};return t=y([C(Bd)],t),t})(),Gd=class{static fToken=Symbol("RemoveDndFromStoreRequest")},hv=(()=>{let t=class Ks{_store=c(b);handle(e){this._store.fDraggable=void 0}static \u0275fac=function(n){return new(n||Ks)};static \u0275prov=h({token:Ks,factory:Ks.\u0275fac})};return t=y([C(Gd)],t),t})(),pv=[cv,dv,lv,fv,uv,hv],mv=new oe("CONNECTABLE_SIDE_EPSILON"),_v=(()=>{let t=class Zs{_mediator=c(E);_lastSide=new WeakMap;_epsilon=Math.max(0,c(mv,{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=z.fromElement(e),s=n.getBoundingClientRect(),a=r.gravityCenter.x,d=r.gravityCenter.y,u=a-s.left,f=s.right-a,g=d-s.top,x=s.bottom-d,w=0,M=u,T=[u,f,g,x];for(let R=1;R<4;R++){let L=T[R];L<M&&(M=L,w=R)}let S=w===0?F.LEFT:w===1?F.RIGHT:w===2?F.TOP:F.BOTTOM,D=this._lastSide.get(o);if(D!==void 0&&D!==S){let R=D===F.LEFT?0:D===F.RIGHT?1:D===F.TOP?2:3;(R===0?u:R===1?f:R===2?g:x)-M<=this._epsilon&&(S=D)}return S}_isDragging(){return this._mediator.execute(new At)}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=h({token:Zs,factory:Zs.\u0275fac})};return t=y([C(Fd)],t),t})(),Dn=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(i){this.nodeOrGroup=i}},gv=(()=>{let t=class Qs{_mediator=c(E);handle({nodeOrGroup:e}){let n=e.connectors,o=n.length;for(let s=0;s<o;s++){let a=n[s];a.fConnectableSide=this._resolveSideForConnectorFast(a)}let r=new Set;for(let s=0;s<o;s++){let d=n[s].toConnector;if(d&&d.length)for(let u=0,f=d.length;u<f;u++){let g=d[u],x=g.userFConnectableSide;Od(x)&&r.add(g)}}r.size>0&&r.forEach(s=>{s.fConnectableSide=this._calculateByConnectedPositions(s)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===F.AUTO?this._mediator.execute(new Fd(e)):Od(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new Tn(e))}static \u0275fac=function(n){return new(n||Qs)};static \u0275prov=h({token:Qs,factory:Qs.\u0275fac})};return t=y([C(Dn)],t),t})(),En=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},yv=(()=>{let t=class Js{_store=c(b);handle(e){return z.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>z.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=h({token:Js,factory:Js.\u0275fac})};return t=y([C(En)],t),t})(),Hd=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(i){this.fNodes=i}},Cv=(()=>{let t=class ea{_store=c(b);_mediator=c(E);handle(e){return z.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 In(e.hostElement));if(n)return this._getElementRect(e,n);let o=this._mediator.execute(new ge(e.hostElement));return this._getElementRect(e,o)}_getElementRect(e,n){return z.initialize(e._position.x,e._position.y,n.width,n.height)}static \u0275fac=function(n){return new(n||ea)};static \u0275prov=h({token:ea,factory:ea.\u0275fac})};return t=y([C(Hd)],t),t})(),jd=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},vv=(()=>{let t=class ta{_store=c(b);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||ta)};static \u0275prov=h({token:ta,factory:ta.\u0275fac})};return t=y([C(jd)],t),t})(),Pi=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(i){this.nodeOrGroup=i}},en=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(i,e){this.fNode=i,this.rect=e}},xv=(()=>{let t=class na{_browser=c(we);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||na)};static \u0275prov=h({token:na,factory:na.\u0275fac})};return t=y([C(en)],t),t})(),wv=(()=>{let t=class ia{_mediator=c(E);_store=c(b);get _nodes(){return this._store.nodes.getAll()}handle({nodeOrGroup:e}){if(e.fAutoSizeToFitChildren()){let r=this._calculateDirectChildren(e);if(r.length){let s=this._boundingRect(e),a=this._calculateChildrenBounding(r,this._paddings(e,s));e.updatePosition(a),e.updateSize(a),e.redraw()}}let n=e.fParentId();if(!n)return;let o=this._nodes.find(r=>r.fId()===n);o&&this._mediator.execute(new Pi(o))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return z.union(e.map(n=>this._boundingRect(n)))||z.initialize()}_boundingRect(e){return this._mediator.execute(new ge(e.hostElement))}_paddings(e,n){return this._mediator.execute(new en(e,n))}_calculateChildrenBounding(e,[n,o,r,s]){let a=this._unionRect(e);return a=z.initialize(a.x-n,a.y-o,a.width+n+r,a.height+o+s),a}static \u0275fac=function(n){return new(n||ia)};static \u0275prov=h({token:ia,factory:ia.\u0275fac})};return t=y([C(Pi)],t),t})(),Vd=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(i){this.id=i}},bv=(()=>{let t=class oa{_store=c(b);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(s=>s.fParentId()===e).map(s=>s.fId());n.push(...r);for(let s of r)this._collectDescendants(s,n,o)}static \u0275fac=function(n){return new(n||oa)};static \u0275prov=h({token:oa,factory:oa.\u0275fac})};return t=y([C(Vd)],t),t})(),Pn=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(i){this.nodeOrGroup=i}},Iv=(()=>{let t=class ra{_store=c(b);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||ra)};static \u0275prov=h({token:ra,factory:ra.\u0275fac})};return t=y([C(Pn)],t),t})(),Mi=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(i,e){this.nodeOrGroup=i,this.destroyRef=e}},Sv=(()=>{let t=class sa{_mediator=c(E);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:o,stateChanges:r}=e;new ht(new fu(o),r).listen(n,()=>{this._mediator.execute(new Wt),this._isDragging()||(this._mediator.execute(new bn(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new Dn(e)),this._mediator.execute(new Pi(e)))})}_isDragging(){return this._mediator.execute(new At)}static \u0275fac=function(n){return new(n||sa)};static \u0275prov=h({token:sa,factory:sa.\u0275fac})};return t=y([C(Mi)],t),t})(),Ri=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(i){this.instance=i}},Tv=(()=>{let t=class aa{_store=c(b);_mediator=c(E);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new ac(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||aa)};static \u0275prov=h({token:aa,factory:aa.\u0275fac})};return t=y([C(Ri)],t),t})(),Dv=[JC,av,_v,ev,gv,yv,Cv,vv,wv,bv,xv,Iv,Sv,Tv],Ev=(()=>{let t=class ca{_mediator=c(E);_store=c(b);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let o=this._getConnectableTargets(e),r=[];for(let s of o)r.push(this._mediator.execute(new Ye(s)));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)Od(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Tn(e,n))}static \u0275fac=function(n){return new(n||ca)};static \u0275prov=h({token:ca,factory:ca.\u0275fac})};return t=y([C(Di)],t),t})(),Ud=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(i,e){this.target=i,this.pointer=e}},Pv=(()=>{let t=class da{_mediator=c(E);_store=c(b);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let o=this._getConnectableSources(e),r=[];for(let s of o)r.push(this._mediator.execute(new Ye(s)));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)Od(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Tn(e,n))}static \u0275fac=function(n){return new(n||da)};static \u0275prov=h({token:da,factory:da.\u0275fac})};return t=y([C(Ud)],t),t})(),Mn=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},De={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"}},Mv=(()=>{let t=class la{_store=c(b);handle({connectors:e}){this._store.flowHost.classList.add(De.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(De.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||la)};static \u0275prov=h({token:la,factory:la.\u0275fac})};return t=y([C(Mn)],t),t})(),Ni=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(i){this.instance=i}},Rv=(()=>{let t=class ua{_store=c(b);_mediator=c(E);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 ii(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||ua)};static \u0275prov=h({token:ua,factory:ua.\u0275fac})};return t=y([C(Ni)],t),t})(),Rn=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},Nv=(()=>{let t=class fa{_store=c(b);handle({connectors:e}){this._store.flowHost.classList.remove(De.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(De.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||fa)};static \u0275prov=h({token:fa,factory:fa.\u0275fac})};return t=y([C(Rn)],t),t})(),kv=[YC,Rv,KC,ZC,Pv,Ev,QC,Mv,Nv],Wd=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(i){this.instance=i}};var Jn=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(Jn||{});function Ov(t){let i=[...t.nodes.map(Uh),...t.groups.map(Uh)],e=new Set(t.nodes.map(a=>a.id)),n=new Set(t.groups.map(a=>a.id)),o=new Map,r=new Map;for(let a of[...t.nodes,...t.groups]){for(let d of a.fOutputs)o.set(d.id,a.id);for(let d of a.fInputs)r.set(d.id,a.id)}let s=t.connections.reduce((a,d)=>{let u=o.get(d.fOutputId),f=r.get(d.fInputId);return!u||!f||a.push({source:u,target:f}),a},[]);return{nodes:i,connections:s,nodeIds:e,groupIds:n}}function Uh(t){return{id:t.id,size:t.measuredSize?de({},t.measuredSize):t.size?de({},t.size):void 0}}var Fv=1,Ep=(()=>{class t{_destroyRef=c(Ke);_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()===Jn.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===Jn.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()!==Jn.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},Fv))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==Jn.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let o=Ov(n.flow.getState({measuredSize:!0})),r=++n.runId,s=await this._engine.calculate(o.nodes,o.connections,{flowId:e,mode:this._engine.getMode()}),a=this._flows.get(e);if(!(!a||a.runId!==r||!this._applyPositions(a.store,s.nodes).length)){a.isApplying=!0;try{a.flow.redraw(),this._emitWriteback(e,s.nodes,o.nodeIds,o.groupIds)}finally{queueMicrotask(()=>{let u=this._flows.get(e);u&&(u.isApplying=!1)})}}}_emitWriteback(e,n,o,r){let s=this._engine?.getWriteback();s&&s({flowId:e,nodes:n.filter(a=>o.has(a.id)),groups:n.filter(a=>r.has(a.id))})}_applyPositions(e,n){return n.filter(o=>{let r=e.nodes.get(o.id);return!r||O.isEqual(r._position,o.position)?!1:(r.position.set(de({},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=h({token:t,factory:t.\u0275fac})}return t})();var Av=(()=>{let t=class ha{_store=c(b);_layoutController=c(Ep,{optional:!0});handle({instance:e}){this._store.fFlow=e,this._layoutController?.registerFlow(e,this._store)}static \u0275fac=function(n){return new(n||ha)};static \u0275prov=h({token:ha,factory:ha.\u0275fac})};return t=y([C(Wd)],t),t})(),$d=class{static fToken=Symbol("GetFlowRequest")},Lv=(()=>{let t=class pa{_store=c(b);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||pa)};static \u0275prov=h({token:pa,factory:pa.\u0275fac})};return t=y([C($d)],t),t})(),qd=class{static fToken=Symbol("CalculateConnectionsStateRequest")},zv=(()=>{let t=class ma{_store=c(b);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||ma)};static \u0275prov=h({token:ma,factory:ma.\u0275fac})};return t=y([C(qd)],t),t})(),ki=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(i,e=!1){this.component=i,this.measuredSize=e}},Bv=(()=>{let t=class _a{_store=c(b);_mediator=c(E);handle({component:e,measuredSize:n}){return this._store.nodes.getAll().filter(o=>o instanceof e).map(o=>{let r=n?this._mediator.execute(new ge(o.hostElement)):null;return{id:o.fId(),parentId:o.fParentId()??void 0,position:de({},o._position),size:o._size?de({},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||_a)};static \u0275prov=h({token:_a,factory:_a.\u0275fac})};return t=y([C(ki)],t),t})(),Xd=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(i=!1){this.measuredSize=i}},Gv=(()=>{let t=class ga{_mediator=c(E);_store=c(b);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _canvasPosition(){return O.sum(this._transform.position,this._transform.scaledPosition)}handle({measuredSize:e}){return{position:this._canvasPosition,scale:this._canvas.transform.scale,nodes:this._mediator.execute(new ki(Cl,e)),groups:this._mediator.execute(new ki(qu,e)),connections:this._mediator.execute(new qd)}}static \u0275fac=function(n){return new(n||ga)};static \u0275prov=h({token:ga,factory:ga.\u0275fac})};return t=y([C(Xd)],t),t})(),Hv=[Gv,Bv,zv],Yd=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(i){this.instance=i}},jv=(()=>{let t=class ya{_store=c(b);_layoutController=c(Ep,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||ya)};static \u0275prov=h({token:ya,factory:ya.\u0275fac})};return t=y([C(Yd)],t),t})(),vl=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),Kd=class{static fToken=Symbol("NotifyNodesRenderedRequest")},Pf=new oe("F_FLOW"),If=class{},Vv=(()=>{let t=class Ca{_state=c(vl);_fFlow=c(Pf);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||Ca)};static \u0275prov=h({token:Ca,factory:Ca.\u0275fac})};return t=y([C(Kd)],t),t})(),Zd=class{static fToken=Symbol("NotifyFullRenderedRequest")},Uv=(()=>{let t=class va{_state=c(vl);_fFlow=c(Pf);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||va)};static \u0275prov=h({token:va,factory:va.\u0275fac})};return t=y([C(Zd)],t),t})(),Oi=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}},Wv=(()=>{let t=class xa{_store=c(b);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:o,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){o();return}let s=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(s(),o())});r.onDestroy(s)}static \u0275fac=function(n){return new(n||xa)};static \u0275prov=h({token:xa,factory:xa.\u0275fac})};return t=y([C(Oi)],t),t})(),Qd=class{static fToken=Symbol("ResetRenderLifecycleRequest")},$v=(()=>{let t=class wa{_state=c(vl);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||wa)};static \u0275prov=h({token:wa,factory:wa.\u0275fac})};return t=y([C(Qd)],t),t})(),Jd=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(i){this.destroyRef=i}},Pp=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})(),qv=(()=>{let t=class ba{_state=c(Pp);_store=c(b);_mediator=c(E);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 di)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||ba)};static \u0275prov=h({token:ba,factory:ba.\u0275fac})};return t=y([C(Jd)],t),t})(),Xv=[Av,Lv,...Hv,jv,vl,Vv,Uv,Wv,$v,Pp,qv],el=class{static fToken=Symbol("ClearSelectionRequest")},Yv=(()=>{let t=class Ia{_dragContext=c(U);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Ia)};static \u0275prov=h({token:Ia,factory:Ia.\u0275fac})};return t=y([C(el)],t),t})(),tl=class{static fToken=Symbol("CalculateSelectableItemsRequest")},Kv=(()=>{let t=class Sa{_mediator=c(E);_store=c(b);_dragContext=c(U);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 ge(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new ge(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Sa)};static \u0275prov=h({token:Sa,factory:Sa.\u0275fac})};return t=y([C(tl)],t),t})(),Fi=class{static fToken=Symbol("GetCurrentSelectionRequest")},Zv=(()=>{let t=class Ta{_dragContext=c(U);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||Ta)};static \u0275prov=h({token:Ta,factory:Ta.\u0275fac})};return t=y([C(Fi)],t),t})(),nl=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(i,e,n=!0){this.nodes=i,this.connections=e,this.isSelectedChanged=n}},Qv=(()=>{let t=class Da{_dragContext=c(U);_store=c(b);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||Da)};static \u0275prov=h({token:Da,factory:Da.\u0275fac})};return t=y([C(nl)],t),t})(),il=class{static fToken=Symbol("SelectAllRequest")},Jv=(()=>{let t=class Ea{_dragSession=c(U);_store=c(b);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||Ea)};static \u0275prov=h({token:Ea,factory:Ea.\u0275fac})};return t=y([C(il)],t),t})(),Nn=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(i){this.nodeOrGroup=i}},ol=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}},ex=(()=>{let t=class Pa{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||Pa)};static \u0275prov=h({token:Pa,factory:Pa.\u0275fac})};return t=y([C(ol)],t),t})(),tn=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(i,e){this.item=i,this.itemContainer=e}},kn=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(i){this.nodeOrGroupId=i}},tx=(()=>{let t=class Ma{_store=c(b);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,s)=>r.concat(this._getChildrenNodes(s.fId(),n)),o)}static \u0275fac=function(n){return new(n||Ma)};static \u0275prov=h({token:Ma,factory:Ma.\u0275fac})};return t=y([C(kn)],t),t})(),nx=(()=>{let t=class Ra{_store=c(b);_mediator=c(E);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),s=r.findIndex(a=>a===n);this._isAnythingNeedToBeMoved(r,s,o)&&this._mediator.execute(new ol(e,r,o,s))}_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 kn(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Ra)};static \u0275prov=h({token:Ra,factory:Ra.\u0275fac})};return t=y([C(tn)],t),t})(),ix=(()=>{let t=class Na{_dragSession=c(U);_mediator=c(E);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new tn(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||Na)};static \u0275prov=h({token:Na,factory:Na.\u0275fac})};return t=y([C(Nn)],t),t})(),ox=[Yv,Kv,Zv,Qv,Jv,ix],rl=class{static fToken=Symbol("ResetZoomRequest")},rx=(()=>{let t=class ka{_store=c(b);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||ka)};static \u0275prov=h({token:ka,factory:ka.\u0275fac})};return t=y([C(rl)],t),t})(),sl=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}},sx=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),ax=new Set(["drag-canvas","selection-area"]),cx=(()=>{let t=class Oa{_mediator=c(E);_store=c(b);_dragContext=c(U,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(_e.ZOOM)}get _isDragStarted(){return this._mediator.execute(new At)}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 s=this._getDragZoomMode();if(s==="blocked")return;s==="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 V.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(sx.has(o)){e=!0;continue}if(!ax.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=V.fromPoint(this._dragContext.onPointerDownPosition).add(V.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||Oa)};static \u0275prov=h({token:Oa,factory:Oa.\u0275fac})};return t=y([C(sl)],t),t})(),dx=[rx,cx],al=class{static fToken=Symbol("MinimapDrawNodesRequest")},lx=(()=>{let t=class Fa{_browser=c(we);_store=c(b);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;return!n||!o?[]:this._store.nodes.getAll().map(s=>this._renderNode(s,n,o))}_renderNode(e,n,o){let r=Cn("rect",this._browser);Yl(this._nodeRect(e,n,o),r);let s=e instanceof Cl;return r.classList.add("f-component",s?"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=z.elementTransform(z.fromElement(e.hostElement),n.hostElement);return z.div(r,o.transform.scale)}_minimapClasses(e){let n=e.fMinimapClass();return Array.isArray(n)?n:[n]}static \u0275fac=function(n){return new(n||Fa)};static \u0275prov=h({token:Fa,factory:Fa.\u0275fac})};return t=y([C(al)],t),t})(),cl=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(i,e){this.svg=i,this.minSize=e}},ux=(()=>{let t=class Aa{_mediator=c(E);_store=c(b);handle({svg:e,minSize:n}){let o=this._store.fFlow,r=this._store.fCanvas;if(!o||!r)return{scale:1,viewBox:z.initialize(0,0,0,0)};let s=this._contentRectInMinimapSpace(o,r,n),a=this._minimapRectInFlowSpace(e,o),d=this._viewportScale(s,a),u=this._viewportViewBox(s,a,d);return{scale:d,viewBox:u}}_contentRectInMinimapSpace(e,n,o){let r=this._nodesBoundingBox(),s=z.elementTransform(r,e.hostElement),a=z.div(s,n.transform.scale);return uh(a,o)}_nodesBoundingBox(){return this._mediator.execute(new En)??z.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return z.elementTransform(z.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),s=e.x-(r.width-e.width)/2,a=e.y-(r.height-e.height)/2;return z.initialize(s,a,r.width,r.height)}_viewportSize(e,n){return ot.initialize(e.width*n||0,e.height*n||0)}static \u0275fac=function(n){return new(n||Aa)};static \u0275prov=h({token:Aa,factory:Aa.\u0275fac})};return t=y([C(cl)],t),t})(),dl=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},fx=(()=>{let t=class La{_store=c(b);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;if(!n||!o)return z.initialize();let r=z.div(z.fromElement(n.hostElement),o.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||La)};static \u0275prov=h({token:La,factory:La.\u0275fac})};return t=y([C(dl)],t),t})(),ll=class{element;scale;viewBox;constructor(i,e=1,n=z.initialize(0,0,0,0)){this.element=i,this.scale=e,this.viewBox=n}},hx=[lx,ux,fx],ul=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(i){this.position=i}},px=(()=>{let t=class za{_store=c(b);handle({position:e}){return Fn(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||za)};static \u0275prov=h({token:za,factory:za.\u0275fac})};return t=y([C(ul)],t),t})(),fl=class{static fToken=Symbol("SortNodeLayersRequest")},mx=(()=>{let t=class Ba{_store=c(b);_mediator=c(E);_browser=c(we);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 kn(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||Ba)};static \u0275prov=h({token:Ba,factory:Ba.\u0275fac})};return t=y([C(fl)],t),t})(),Ai=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(i){this.itemsContainer=i}},_x=(()=>{let t=class Ga{_store=c(b);_browser=c(we);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(d=>e.contains(d.hostElement));if(r.length<2||!r.some(d=>!!d.fParentId()))return;let s=this._buildChildrenByParentId(r),a=new Map;for(let d of r){let u=this._getSortedChildrenBeforeParent(e,o,d,s,a);u.length&&this._moveBeforeNextSibling(e,u,d.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,s){let a=n.get(o.hostElement);if(a===void 0)return[];let d=this._getDeepChildren(o.fId(),r,s);if(!d.length)return[];let u=[];for(let f of d){let g=f.hostElement;if(!e.contains(g))continue;let x=n.get(g);x===void 0||x>=a||u.push(g)}return u.sort((f,g)=>(n.get(f)??0)-(n.get(g)??0)),u}_buildChildrenByParentId(e){let n=new Map;for(let o of e){let r=o.fParentId();if(!r)continue;let s=n.get(r)??[];s.push(o),n.set(r,s)}return n}_getDeepChildren(e,n,o){let r=o.get(e);if(r)return r;let s=[],a=[...n.get(e)??[]],d=new Set([e]);for(;a.length;){let u=a.pop();if(!u)continue;let f=u.fId();if(d.has(f))continue;d.add(f),s.push(u);let g=n.get(f);g?.length&&a.push(...g)}return o.set(e,s),s}_moveBeforeNextSibling(e,n,o){let r=this._browser.document.createDocumentFragment();for(let s of n)r.appendChild(s);e.insertBefore(r,o)}static \u0275fac=function(n){return new(n||Ga)};static \u0275prov=h({token:Ga,factory:Ga.\u0275fac})};return t=y([C(Ai)],t),t})(),hl=class{static fToken=Symbol("SortItemLayersRequest")},gx=(()=>{let t=class Ha{_store=c(b);_mediator=c(E);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 Ai(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new fl),this._mediator.execute(new Ai(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||Ha)};static \u0275prov=h({token:Ha,factory:Ha.\u0275fac})};return t=y([C(hl)],t),t})();function Cn(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}function Je(t,i){return i(t)}function rt(t){return!0}function yx(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var Cx=[...B_,...XC,...E_,...kv,...pv,...Xv,...Dv,...ox,...dx,...hx,...Jg,tx,e0,o0,px,gx,_x,mx,nx,ex],vx=0,Mp=(()=>{class t{_destroyRef=c(Ke);_elementReference=c(Ce);_fBrowser=c(we);_stateChanges=new Qe;get hostElement(){return this._elementReference.nativeElement}id=A(`f-pattern-${vx++}`);vColor=A("rgba(0,0,0,0.1)");hColor=A("rgba(0,0,0,0.1)");vSize=A(20,{transform:ze});hSize=A(20,{transform:ze});_transform=Tt.default();_position=O.initialize();_size=ot.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=Cn("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=Cn("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=Cn("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new ht(this._stateChanges).pipe(pl()).listen(this._destroyRef,()=>this._redraw())}ngOnChanges(e){(e.vSize||e.hSize||e.vColor||e.hColor)&&this._refresh()}_redraw(){this._calculatePattern(),this._redrawPattern(),this._redrawLine(this._vLine,this.vColor(),this._size.width,0,this._size.width,this._size.height),this._redrawLine(this._hLine,this.hColor(),0,this._size.height,this._size.width,this._size.height)}_calculatePattern(){this._position.x=this._transform.position.x+this._transform.scaledPosition.x,this._position.y=this._transform.position.y+this._transform.scaledPosition.y,this._size=ot.initialize(this.hSize()*this._transform.scale,this.vSize()*this._transform.scale)}_redrawPattern(){this._pattern.setAttribute("x",`${this._position.x}`),this._pattern.setAttribute("y",`${this._position.y}`),this._pattern.setAttribute("width",`${this._size.width}`),this._pattern.setAttribute("height",`${this._size.height}`)}_redrawLine(e,n,o,r,s,a){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${o}`),e.setAttribute("x2",`${s}`),e.setAttribute("y1",`${r}`),e.setAttribute("y2",`${a}`)}setTransform(e){this._transform=e,this._refresh()}_refresh(){this._stateChanges.notify()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=J({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,o){n&2&&K("id",o.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[Ie([{provide:au,useExisting:t}]),cn],decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})();var xx=new oe("F_BACKGROUND"),wx=(()=>{class t{hostElement=c(Ce).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,standalone:!1})}return t})(),Rp=(()=>{class t extends wx{_mediator=c(E);fBackgroundPattern=Ji(au);ngOnInit(){this._mediator.execute(new $t(_e.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new ja(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new qt(_e.BACKGROUND))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-background"]],contentQueries:function(n,o,r){n&1&&$l(r,o.fBackgroundPattern,au,5),n&2&&nt()},hostAttrs:[1,"f-component","f-background"],features:[Ie([{provide:xx,useExisting:t}]),he],ngContentSelectors:t_,decls:2,vars:0,template:function(n,o){n&1&&(Gt(),qe(),Ve(0,"svg"),ve(1),Xe())},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 Sf=class{position;scale;constructor(i,e){this.position=i,this.scale=e}},bx=new oe("F_CANVAS"),Ix=(()=>{class t{transform=Tt.default();_fCanvasChange=new Qe;destroyRef=c(Ke);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new ht(this._fCanvasChange).pipe(Va(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new Sf(O.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,standalone:!1})}return t})(),Li=(()=>{class t extends Ix{_mediator=c(E);_componentsStore=c(b);_elementReference=c(Ce);_injector=c(je);_flowId;fCanvasChange=it();position=A(O.initialize(),{transform:O.castToPoint});scale=A(1,{transform:ze});debounceTime=A(0,{transform:ze});debounce=H(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=Se.required("fGroupsContainer");fNodesContainer=Se.required("fNodesContainer");fConnectionsContainer=Se.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new $d).fId(),this._mediator.execute(new Wa(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){fe(()=>{this._mediator.execute(new Xa(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){fe(()=>{this._mediator.execute(new Ya(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new ti(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=Tt.toString(this.transform),this._mediator.execute(new Rt)}redrawWithAnimation(){this._mediator.execute(new ti(this.transform)),this.hostElement.style.transition=`transform ${yx()?80:150}ms ease-in-out`,this.hostElement.style.transform=Tt.toString(this.transform),Wh(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new $a(e,n))})}fitToScreen(e=O.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new qa(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new Qa(e))})}getScale(){return this.transform.scale||1}setScale(e,n=O.initialize()){this._mediator.execute(new Ja(e,n))}resetScale(){this._mediator.execute(new Za)}ngOnDestroy(){this._mediator.execute(new Ka)}_afterRedraw(e){this._mediator.execute(new Oi(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>$f(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-canvas"]],viewQuery:function(n,o){n&1&&Ct(o.fGroupsContainer,n_,5)(o.fNodesContainer,i_,5)(o.fConnectionsContainer,o_,5),n&2&&nt(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[Ie([{provide:bx,useExisting:t}]),he],ngContentSelectors:s_,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,o){n&1&&(Gt(r_),Ki(0),Ve(1,"div",null,0),ve(3),Xe(),Ve(4,"div",3,1),ve(6,1),ve(7,2),ve(8,3),Xe(),Ve(9,"div",null,2),ve(11,4),Xe(),Zi())},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 Sx=0,Np=(()=>{class t extends Fg{fId=A(`f-connection-${Sx++}`,{alias:"fConnectionId"});fOutputId=A("",{transform:e=>Sn(e)||""});fInputId=A("",{transform:e=>Sn(e)||""});fRadius=8;fOffset=12;fBehavior=Pt.FIXED;fType=Et.STRAIGHT;fSelectionDisabled=A(!1,{transform:pe});fReassignableStart=A(!1,{transform:pe});fDraggingDisabled=A(!1,{alias:"fReassignDisabled",transform:pe});fInputSide=A(Be.DEFAULT,{transform:e=>_n(e,"fInputSide",Be)});fOutputSide=A(Be.DEFAULT,{transform:e=>_n(e,"fOutputSide",Be)});get boundingElement(){return this.fPath().hostElement}_mediator=c(E);ngOnInit(){this._mediator.execute(new ec(this))}ngOnChanges(){this._mediator.execute(new Wt)}ngOnDestroy(){this._mediator.execute(new bc(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,o){n&2&&(K("id",o.fId()),Le("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",ze],fOffset:[2,"fOffset","fOffset",ze],fBehavior:[2,"fBehavior","fBehavior",e=>_n(e,"fBehavior",Pt)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[Ie([{provide:ml,useExisting:t}]),he,cn],ngContentSelectors:c_,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&&(Gt(a_),qe(),p(0,"svg",1),G(1,"defs",null,0),ve(3),p(4,"g",2),N(5,d_,1,1,":svg:linearGradient",3),G(6,"path",4),p(7,"g"),G(8,"path",5),N(9,l_,1,0,":svg:circle",6),G(10,"circle",7),m()()(),ve(11,1),ve(12,2),ve(13,3),N(14,u_,1,0)),n&2){let r;l(5),k((r=o.fGradient())?5:-1,r),l(),K("d",o.path),l(2),P("useGradient",!!o.fGradient()),K("d",o.path),l(),k(o.fReassignableStart()?9:-1),l(5),k(o.fContents().length?14:-1)}},dependencies:[Tu,Rg,Ng,Sg,Mg],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 Tx=new oe("F_MAGNETIC_LINES"),Dx=(()=>{class t{hostElement=c(Ce).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,standalone:!1})}return t})();var kp=(()=>{class t extends Dx{threshold=A(10,{transform:ze,alias:"fAlignThreshold"});_mediator=c(E);ngOnInit(){this._mediator.execute(new $t(_e.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new qt(_e.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[Ie([{provide:Tx,useExisting:t}]),he],decls:0,vars:0,template:function(n,o){},styles:[f_]})}return t})();var ou=(()=>{class t{fMinSize=A(1e3);_mediator=c(E);hostElement=c(Ce).nativeElement;model=new ll(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new cl(this.hostElement,this.fMinSize()));this.model=new ll(this.hostElement,e,n),fh(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),ru=(()=>{class t{_mediator=c(E);_elementRef=c(Ce);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new al).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),su=(()=>{class t{_mediator=c(E);hostElement=c(Ce).nativeElement;redraw(){Yl(this._mediator.execute(new dl),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),Ex=new oe("F_MINIMAP_BASE"),Px=(()=>{class t{hostElement=c(Ce).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=be({type:t,standalone:!1})}return t})(),Op=(()=>{class t extends Px{_destroyRef=c(Ke);_mediator=c(E);_browser=c(we);_store=c(b);_canvas=Se.required(ru);_flow=Se.required(ou);_minimapView=Se.required(su);fMinSize=A(1e3);fNodeRenderLimit=A(1500,{transform:ze});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new $t(_e.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new Ua).pipe(pl(),__()).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 qt(_e.MINIMAP))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-minimap"]],viewQuery:function(n,o){n&1&&Ct(o._canvas,ru,5)(o._flow,ou,5)(o._minimapView,su,5),n&2&&nt(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[Ie([{provide:Ex,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&&(qe(),p(0,"svg",0),G(1,"g",1)(2,"rect",2),m()),n&2&&P("fMinSize",o.fMinSize())},dependencies:[ou,ru,su],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var Mx=0,Rx=120,Fp=(()=>{class t extends If{_destroyRef=c(Ke);_mediator=c(E);_browser=c(we);_componentsStore=c(b);_cache=c(pt);_injector=c(je);fId=A(`f-flow-${Mx++}`,{alias:"fFlowId"});fCache=A(!1,{transform:pe});hostElement=c(Ce).nativeElement;fNodesRendered=it();fFullRendered=it();fLoaded=it();ngOnInit(){this._mediator.execute(new Wd(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){fe(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new ht(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(pl(),Va(Rx),m_()).listen(this._destroyRef,()=>{this._mediator.execute(new At)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new hl),this._mediator.execute(new Kd),this._mediator.execute(new Oi(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new Zd),this._destroyRef)),this._mediator.execute(new Wt))})}_listenConnectionsChanges(){this._mediator.execute(new gn).listen(this._destroyRef,()=>{if(!this._mediator.execute(new At)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new Jd(this._destroyRef));return}this._mediator.execute(new di)}})}redraw(){this._mediator.execute(new Wt)}reset(){this._mediator.execute(new Qd)}getNodesBoundingBox(){return this._mediator.execute(new Hd)}getSelection(){return this._mediator.execute(new Fi)}getPositionInFlow(e){return this._mediator.execute(new ul(e))}getState(e){return this._mediator.execute(new Xd(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new gn).pipe(yh()).listen(this._destroyRef,()=>{this._mediator.execute(new il)})}select(e,n,o=!0){this._mediator.execute(new gn).pipe(yh()).listen(this._destroyRef,()=>{this._mediator.execute(new nl(e,n,o))})}clearSelection(){this._mediator.execute(new el)}ngOnDestroy(){this._mediator.execute(new Yd(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,o){n&2&&K("id",o.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[Ie([E,...I_,tp,On,...Cx,U,...WC,{provide:Pf,useExisting:t}]),he],ngContentSelectors:p_,decls:7,vars:0,template:function(n,o){n&1&&(Gt(h_),Ki(0),ve(1),ve(2,1),ve(3,2),ve(4,3),ve(5,4),ve(6,5),Zi())},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 Ap=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=c(Xi);_tpl=c(qf);_zone=c(jn);_componentsStore=c(b,{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 s=this.fVirtualForOf[n],a=this._vc.createEmbeddedView(this._tpl,{$implicit:s,index:n});this._views.push(a),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=be({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[cn]})}return t})();var xt=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(xt||{}),Nx=new oe("F_ZOOM"),Tf=class{},kx=.1,Ox=1,Fx=.5,Ax=60,Lx=.5;function zx(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function Bx(t,i,e){return Gx(t)?jx(i,e):Hx(i,e)}function Gx(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function Hx(t,i){let e=Math.abs(t)/100,n=Lp(e,kx,Ox);return i*n}function jx(t,i){if(Math.abs(t)<Fx)return 0;let e=Math.abs(t)/Ax,n=Lp(e,0,Lx);return i*n}function Lp(t,i,e){return Math.max(i,Math.min(e,t))}var zi=(()=>{class t extends Tf{_mediator=c(E);_injector=c(je);_store=c(b);_triggersListener=ae.emptyListener();isEnabled=A(!1,{alias:"fZoom",transform:pe});fWheelTrigger=rt;fDblClickTrigger=rt;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 $t(_e.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){fe(()=>{this.isEnabled(),dt(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,ae.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,ae.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!Je(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let o=zx(e);if(o===0)return;let r=this._normalizeWheelStep(e,o);r!==0&&this.setZoom(O.initialize(e.clientX,e.clientY),r,this._calculateDirection(o),!1)};_normalizeWheelStep(e,n){return Bx(e,n,this.step)}_calculateDirection(e){return e>0?xt.ZOOM_OUT:xt.ZOOM_IN}_onDoubleClick=e=>{if(!Je(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;ry(n)||n?.closest("[fLockedContext]")||this.setZoom(O.initialize(e.clientX,e.clientY),this.dblClickStep,xt.ZOOM_IN,!0)};_getToCenterPosition(e,n){return O.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(xt.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(xt.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,z.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,o,r){this._mediator.execute(new sl(e,n,o,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new rl)}_disposeListeners(){this._triggersListener(),this._triggersListener=ae.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new qt(_e.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=W(t)))(o||t)}})();static \u0275dir=be({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",ze],maximum:[2,"fZoomMaximum","maximum",ze],step:[2,"fZoomStep","step",ze],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",ze]},features:[Ie([{provide:Nx,useExisting:t}]),he]})}return t})();var zp=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Yi({type:t});static \u0275inj=Wi({imports:[to]})}return t})();var Mf={loading:"Loading collection",errorTitle:"Failed to load",emptyTitle:"No nodes match",emptyDesc:"Adjust or reset the filters above.",a11y:{toolbar:"Graph 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)"},panel:{closeLabel:"Close panel"},resetLayoutConfirm:"Reset all node positions to the automatic layout? This cannot be undone."};var Rf={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0}};var Bp={a11y:{toolbarLabel:"Toggle node kinds"}};function Ux(t,i){if(t&1&&bt(0,"i",4),t&2){let e=_();Te(e.piClass()),It("font-size",e.size(),"px")}}function Wx(t,i){if(t&1&&(qe(),Ve(0,"svg",1),bt(1,"path"),Xe()),t&2){let e=_();K("width",e.size())("height",e.size()),l(),K("d",e.svgPath())}}function $x(t,i){if(t&1&&(Ve(0,"span",4),v(1),Xe()),t&2){let e=_();It("font-size",e.size(),"px")("line-height",e.size(),"px"),l(),I(e.emoji())}}function qx(t,i){if(t&1&&(Ve(0,"span",5),v(1),Xe()),t&2){let e=_();It("font-size",e.size(),"px")("line-height",e.size(),"px"),l(),I(e.letter())}}var An=class t{kindRegistry=c(pn);kind=A.required();size=A(18);variant=H(()=>{let i=this.kindRegistry.lookup(this.kind());return i?.icon?.kind==="pi"?"pi":i?.icon?.kind==="svg"?"svg":i?.emoji?"emoji":"letter"});piClass=H(()=>{let i=this.kindRegistry.lookup(this.kind())?.icon;return i?.kind==="pi"?`pi ${i.id}`:""});svgPath=H(()=>{let i=this.kindRegistry.lookup(this.kind())?.icon;return i?.kind==="svg"?i.path:""});emoji=H(()=>this.kindRegistry.lookup(this.kind())?.emoji??"");letter=H(()=>this.kindRegistry.labelOf(this.kind()).charAt(0).toUpperCase());static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["sm-kind-icon"]],inputs:{kind:[1,"kind"],size:[1,"size"]},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(e,n){if(e&1&&N(0,Ux,1,4,"i",0)(1,Wx,2,3,":svg:svg",1)(2,$x,2,5,"span",2)(3,qx,2,5,"span",3),e&2){let o;k((o=n.variant())==="pi"?0:o==="svg"?1:o==="emoji"?2:o==="letter"?3:-1)}},styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center;justify-content:center;line-height:1}"],changeDetection:0})};var Kx=(t,i)=>i.kind;function Zx(t,i){if(t&1&&(G(0,"sm-kind-icon",4),p(1,"span"),v(2),m()),t&2){let e=_().$implicit;P("kind",e.kind)("size",16),l(2),I(e.count)}}function Qx(t,i){if(t&1){let e=Fe();p(0,"p-togglebutton",3),ie("ngModelChange",function(){let o=Z(e).$implicit,r=_();return Q(r.toggle(o.kind))}),me(1,Zx,3,3,"ng-template",null,0,dn),m()}if(t&2){let e=i.$implicit,n=_();P("ngModel",n.isActive(e.kind))("pTooltip",e.label)("ariaLabel",e.label)("styleClass","kind-palette__btn kind-palette__btn--"+e.kind),K("data-testid","kind-palette-"+e.kind)}}var xl=class t{loader=c(hn);filters=c(ao);kindRegistry=c(pn);texts=Bp;entries=H(()=>{let i=new Map;for(let e of this.loader.nodes())i.set(e.kind,(i.get(e.kind)??0)+1);return this.kindRegistry.kinds().map(e=>({kind:e.name,label:e.label,count:i.get(e.name)??0}))});isActive(i){return this.filters.isKindActive(i)}toggle(i){this.filters.toggleKind(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["app-kind-palette"]],decls:3,vars:1,consts:[["content",""],["role","toolbar","data-testid","kind-palette",1,"kind-palette"],[3,"ngModel","pTooltip","ariaLabel","styleClass"],[3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass"],[3,"kind","size"]],template:function(e,n){e&1&&(p(0,"div",1),re(1,Qx,3,5,"p-togglebutton",2,Kx),m()),e&2&&(K("aria-label",n.texts.a11y.toolbarLabel),l(),se(n.entries()))},dependencies:[uo,co,lo,ho,fo,ut,lt,An],styles:["[_nghost-%COMP%]{position:absolute;top:16px;left:16px;z-index:2;pointer-events:none}.kind-palette[_ngcontent-%COMP%]{pointer-events:auto;display:flex;flex-direction:column;gap:2px;padding:4px;background:var(--sm-bg-content);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating)}.kind-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0 .55rem;--p-togglebutton-border-radius: 999px;--p-togglebutton-content-border-radius: 999px;--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__btn .p-togglebutton-content{width:100%;height:100%;justify-content:flex-start;display:flex;align-items:center;gap:.4rem}[_nghost-%COMP%] .kind-palette__btn .p-togglebutton-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--note[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-note)}"],changeDetection:0})};var Gp={llm:{what:{label:"what",tooltip:"What it does (LLM-inferred summary)"},when:{label:"when",tooltip:"When to use (LLM-inferred)"},style:{label:"style",tooltip:"Interaction style (LLM-inferred)"},does:{label:"does",tooltip:"Capabilities (LLM-inferred)"},steps:{label:"steps",tooltip:"Recipe / ordered steps (LLM-inferred)"},pre:{label:"pre",tooltip:"Preconditions (LLM-inferred)"},out:{label:"out",tooltip:"Outputs / produced artifacts (LLM-inferred)"},fx:{label:"fx",tooltip:"Side effects (LLM-inferred)"},eg:{label:"eg",tooltip:"Invocation example (LLM-inferred)"},topics:{label:"topics",tooltip:"Topics covered (LLM-inferred)"},facts:{label:"facts",tooltip:"Key facts (LLM-inferred discrete claims)"}},meta:{model:"model",allowed:"allowed",tools:"tools",tags:"tags"},stats:{errors:t=>`${t} error${t===1?"":"s"}`,warns:t=>`${t} warning${t===1?"":"s"}`,tools:t=>`${t} tool${t===1?"":"s"}`,toolsBreakdown:(t,i)=>`${t} allowlist + ${i} pre-approved`,linksIn:t=>`${t} incoming link${t===1?"":"s"}`,linksOut:t=>`${t} outgoing link${t===1?"":"s"}`,extRefs:t=>`${t} external URL${t===1?"":"s"} in body`,bytes:t=>`${t.toLocaleString("en-US")} bytes`,tokens:t=>`${t.toLocaleString("en-US")} tokens`,daysAgo:(t,i)=>`updated ${t} (${i} day${i===1?"":"s"} ago)`},stability:{experimental:"experimental",deprecated:"deprecated"},safety:{injection:t=>`injection${t?`: ${t}`:""}`},confidence:t=>`LLM summary \xB7 confidence ${t.toFixed(2)}`,ariaExpand:"Expand"};var Jx=(t,i)=>i.step,ew=(t,i)=>i.ruleId+i.message;function tw(t,i){if(t&1&&(p(0,"span",24),v(1),m()),t&2){let e=_(),n=q(0),o=q(2);Te("sm-gnode__llm-marker--"+o),P("pTooltip",e.texts.confidence(n.confidence)),l(),Wn("",e.confidencePct(),"%")}}function nw(t,i){if(t&1&&(p(0,"span",11)(1,"span",25),v(2,"T"),m(),v(3),m()),t&2){let e=_(),n=q(1);P("pTooltip",e.texts.stats.tokens(n.tokensTotal)),l(3),I(e.tokensShort())}}function iw(t,i){if(t&1&&(p(0,"span",12)(1,"span",25),v(2,"B"),m(),v(3),m()),t&2){let e=_(),n=q(1);P("pTooltip",e.texts.stats.bytes(n.bytesTotal)),l(3),I(e.bytesShort())}}function ow(t,i){if(t&1&&(p(0,"span",13),G(1,"i",26),v(2),m()),t&2){let e=i,n=_();P("pTooltip",n.texts.stats.daysAgo(e.iso,e.days)),l(2),I(e.short)}}function rw(t,i){t&1&&(p(0,"span",14),v(1),m()),t&2&&(l(),I(i))}function sw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.what.tooltip),l(),I(n.texts.llm.what.label),l(2),I(e.whatItCovers)}}function aw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function cw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,aw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.topics.tooltip),l(),I(n.texts.llm.topics.label),l(2),se(e.topics)}}function dw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function lw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,dw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.facts.tooltip),l(),I(n.texts.llm.facts.label),l(2),se(e.keyFacts)}}function uw(t,i){if(t&1&&(N(0,sw,5,3,"div",27),N(1,cw,6,2,"div",27),N(2,lw,6,2,"div",27)),t&2){let e=i,n=_(2);k(n.showLlmWhat?0:-1),l(),k(e.topics!=null&&e.topics.length?1:-1),l(),k(e.keyFacts!=null&&e.keyFacts.length?2:-1)}}function fw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.what.tooltip),l(),I(n.texts.llm.what.label),l(2),I(e.whatItDoes)}}function hw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.when.tooltip),l(),I(n.texts.llm.when.label),l(2),I(e.whenToUse)}}function pw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.style.tooltip),l(),I(n.texts.llm.style.label),l(2),I(e.interactionStyle)}}function mw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function _w(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,mw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.does.tooltip),l(),I(n.texts.llm.does.label),l(2),se(e.capabilities)}}function gw(t,i){if(t&1&&(N(0,fw,5,3,"div",27),N(1,hw,5,3,"div",27),N(2,pw,5,3,"div",27),N(3,_w,6,2,"div",27)),t&2){let e=i,n=_(2);k(n.showLlmWhat?0:-1),l(),k(e.whenToUse?1:-1),l(),k(e.interactionStyle?2:-1),l(),k(e.capabilities!=null&&e.capabilities.length?3:-1)}}function yw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.what.tooltip),l(),I(n.texts.llm.what.label),l(2),I(e.whatItDoes)}}function Cw(t,i){if(t&1&&v(0),t&2){let e=i.$implicit,n=i.$index,o=i.$count;Zf("",e.step,". ",e.description,"",n===o-1?"":" \xB7 ")}}function vw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),re(4,Cw,1,3,null,null,Jx),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.steps.tooltip),l(),I(n.texts.llm.steps.label),l(2),se(e.recipe)}}function xw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function ww(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,xw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.pre.tooltip),l(),I(n.texts.llm.pre.label),l(2),se(e.preconditions)}}function bw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function Iw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,bw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.out.tooltip),l(),I(n.texts.llm.out.label),l(2),se(e.outputs)}}function Sw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function Tw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,Sw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.fx.tooltip),l(),I(n.texts.llm.fx.label),l(2),se(e.sideEffects)}}function Dw(t,i){if(t&1&&(N(0,yw,5,3,"div",27),N(1,vw,6,2,"div",27),N(2,ww,6,2,"div",27),N(3,Iw,6,2,"div",27),N(4,Tw,6,2,"div",27)),t&2){let e=i,n=_(2);k(n.showLlmWhat?0:-1),l(),k(e.recipe!=null&&e.recipe.length?1:-1),l(),k(e.preconditions!=null&&e.preconditions.length?2:-1),l(),k(e.outputs!=null&&e.outputs.length?3:-1),l(),k(e.sideEffects!=null&&e.sideEffects.length?4:-1)}}function Ew(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"span"),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.what.tooltip),l(),I(n.texts.llm.what.label),l(2),I(e.whatItDoes)}}function Pw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"code",31),v(4),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.eg.tooltip),l(),I(n.texts.llm.eg.label),l(2),I(e.invocationExample)}}function Mw(t,i){if(t&1&&(p(0,"span",30),v(1),m()),t&2){let e=i.$implicit;l(),I(e)}}function Rw(t,i){if(t&1&&(p(0,"div",27)(1,"span",28),v(2),m(),p(3,"div",29),re(4,Mw,2,1,"span",30,Ne),m()()),t&2){let e=_(),n=_(2);l(),P("pTooltip",n.texts.llm.fx.tooltip),l(),I(n.texts.llm.fx.label),l(2),se(e.sideEffects)}}function Nw(t,i){if(t&1&&(N(0,Ew,5,3,"div",27),N(1,Pw,5,3,"div",27),N(2,Rw,6,2,"div",27)),t&2){let e=i,n=_(2);k(n.showLlmWhat?0:-1),l(),k(e.invocationExample?1:-1),l(),k(e.sideEffects!=null&&e.sideEffects.length?2:-1)}}function kw(t,i){if(t&1&&(p(0,"div",16),N(1,uw,3,3),N(2,gw,4,4),N(3,Dw,5,5),N(4,Nw,3,3),m()),t&2){let e,n,o,r,s=_();l(),k((e=s.summaryNote())?1:-1,e),l(),k((n=s.summaryAgent())?2:-1,n),l(),k((o=s.summarySkill())?3:-1,o),l(),k((r=s.summaryCommand())?4:-1,r)}}function Ow(t,i){if(t&1&&(p(0,"div",17),v(1),m()),t&2){let e=_();l(),I(e.description())}}function Fw(t,i){if(t&1&&(p(0,"div",32)(1,"div",33)(2,"span",34),v(3),m(),p(4,"span",35),v(5),m()()()),t&2){let e=_(),n=_();l(3),I(n.texts.meta.model),l(2),I(e.model)}}function Aw(t,i){t&1&&N(0,Fw,6,2,"div",32),t&2&&k(i.model?0:-1)}function Lw(t,i){if(t&1&&(p(0,"div",37),G(1,"i",38),p(2,"code",39),v(3),m(),p(4,"span",40),v(5),m()()),t&2){let e=i.$implicit;Te("sm-gnode__issue--"+e.severity),P("pTooltip",e.detail??e.ruleId+" \xB7 "+e.message),l(),Le("pi",!0)("pi-times-circle",e.severity==="error")("pi-exclamation-triangle",e.severity==="warn"),l(2),I(e.ruleId),l(2),I(e.message)}}function zw(t,i){if(t&1&&(p(0,"div",18),re(1,Lw,6,11,"div",36,ew),m()),t&2){let e=_();l(),se(e.visibleIssues())}}function Bw(t,i){if(t&1&&(p(0,"span",20),G(1,"i",41),p(2,"span",42),v(3),m()()),t&2){let e=_();P("pTooltip",e.texts.stats.errors(e.errorCount())),l(3),I(e.errorCount())}}function Gw(t,i){if(t&1&&(p(0,"span",21),G(1,"i",43),p(2,"span",42),v(3),m()()),t&2){let e=_();P("pTooltip",e.texts.stats.warns(e.warnCount())),l(3),I(e.warnCount())}}function Hw(t,i){if(t&1&&(p(0,"span",22),G(1,"i",44),p(2,"span",42),v(3),m()()),t&2){let e=_();P("pTooltip",e.toolsTooltip()),l(3),I(e.toolsCount())}}function jw(t,i){if(t&1&&(p(0,"span",22)(1,"span",45),v(2,"\u2193"),m(),p(3,"span",42),v(4),m()()),t&2){let e=_(),n=q(1);P("pTooltip",e.texts.stats.linksIn(n.linksIn)),l(4),I(n.linksIn)}}function Vw(t,i){if(t&1&&(p(0,"span",22)(1,"span",45),v(2,"\u2191"),m(),p(3,"span",42),v(4),m()()),t&2){let e=_(),n=q(1);P("pTooltip",e.texts.stats.linksOut(n.linksOut)),l(4),I(n.linksOut)}}function Uw(t,i){if(t&1&&(p(0,"span",22),G(1,"i",46),p(2,"span",42),v(3),m()()),t&2){let e=_(),n=q(1);P("pTooltip",e.texts.stats.extRefs(n.externalRefsCount)),l(3),I(n.externalRefsCount)}}function Ww(t,i){if(t&1&&(p(0,"span",22),qe(),p(1,"svg",48),G(2,"path",49)(3,"path",50)(4,"path",51),m()()),t&2){let e=_(2);P("pTooltip",e.texts.stability.experimental)}}function $w(t,i){if(t&1&&(p(0,"span",22),G(1,"i",52),m()),t&2){let e=_(2);P("pTooltip",e.texts.stability.deprecated)}}function qw(t,i){if(t&1&&(p(0,"span",47),qe(),p(1,"svg",48),G(2,"path",53)(3,"line",54)(4,"line",55),m()()),t&2){let e=_(2);P("pTooltip",e.texts.safety.injection(e.injectionType()))}}function Xw(t,i){if(t&1&&(p(0,"div",23),N(1,Ww,5,1,"span",22),N(2,$w,2,1,"span",22),N(3,qw,5,1,"span",47),m()),t&2){let e=_();l(),k(e.stability()==="experimental"?1:-1),l(),k(e.stability()==="deprecated"?2:-1),l(),k(e.hasInjection()?3:-1)}}var bl=class t{node=A.required();stats=A({linksIn:0,linksOut:0});summary=A(null);issues=A([]);selected=A(!1);highlighted=A(!1);dimmed=A(!1);texts=Gp;showLlmWhat=!1;showLlmConfidence=!1;expanded=Ht(!1);fmAgent=H(()=>{let i=this.node();return i.kind==="agent"?i.frontmatter:null});summaryAgent=H(()=>{let i=this.summary();return i?.kind==="agent"?i:null});summarySkill=H(()=>{let i=this.summary();return i?.kind==="skill"?i:null});summaryCommand=H(()=>{let i=this.summary();return i?.kind==="command"?i:null});summaryNote=H(()=>{let i=this.summary();return i?.kind==="note"?i:null});hasLlmCluster=H(()=>{let i=this.summary();return i===null?!1:this.showLlmWhat?!0:this.hasNonWhatLlmContent(i)});hasNonWhatLlmContent(i){switch(i.kind){case"note":return(i.topics?.length??0)>0||(i.keyFacts?.length??0)>0;case"agent":return!!i.whenToUse||!!i.interactionStyle||(i.capabilities?.length??0)>0;case"skill":return(i.recipe?.length??0)>0||(i.preconditions?.length??0)>0||(i.outputs?.length??0)>0||(i.sideEffects?.length??0)>0;case"command":return!!i.invocationExample||(i.sideEffects?.length??0)>0;default:return!1}}hasInjection=H(()=>this.summary()?.safety.injectionDetected===!0);confidenceTier=H(()=>{let i=this.summary();return i?i.confidence>.8?"high":i.confidence>=.5?"med":"low":null});confidencePct=H(()=>{let i=this.summary();return i?Math.round(i.confidence*100):null});injectionType=H(()=>{let i=this.summary();return i?.safety.injectionDetected?i.safety.injectionType??null:null});visibleIssues=H(()=>this.issues().filter(i=>i.severity==="error"||i.severity==="warn"));errorCount=H(()=>this.visibleIssues().filter(i=>i.severity==="error").length);warnCount=H(()=>this.visibleIssues().filter(i=>i.severity==="warn").length);nodeColor=H(()=>{let i=this.node().frontmatter.metadata.color;return typeof i=="string"&&i.length>0?i:null});bytesShort=H(()=>{let i=this.stats().bytesTotal;return i===void 0?null:Hp(i)});tokensShort=H(()=>{let i=this.stats().tokensTotal;return i===void 0?null:Hp(i)});daysAgo=H(()=>{let i=this.node().frontmatter.metadata.updated;if(!i)return null;let e=new Date(i);if(isNaN(e.getTime()))return null;let n=Math.max(0,Math.floor((Date.now()-e.getTime())/864e5));return{short:`${n}d`,iso:typeof i=="string"?i:e.toISOString(),days:n}});version=H(()=>{let i=this.node().frontmatter.metadata.version;return i?`v${i}`:null});stability=H(()=>this.node().frontmatter.metadata.stability??null);displayName=H(()=>this.node().frontmatter.name||this.node().path);description=H(()=>this.node().frontmatter.description??"");toolsCount=H(()=>{let i=this.node().frontmatter,e=Array.isArray(i.tools)?i.tools.length:0,n=Array.isArray(i.allowedTools)?i.allowedTools.length:0;return e+n});toolsTooltip=H(()=>{let i=this.node().frontmatter,e=Array.isArray(i.tools)?i.tools.length:0,n=Array.isArray(i.allowedTools)?i.allowedTools.length:0;return this.texts.stats.toolsBreakdown(e,n)});toggleExpanded(i){i.stopPropagation(),this.expanded.update(e=>!e)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["sm-node-card"]],hostAttrs:[1,"sm-gnode"],hostVars:24,hostBindings:function(e,n){e&2&&(It("--node-color",n.nodeColor()),Le("sm-gnode--skill",n.node().kind==="skill")("sm-gnode--agent",n.node().kind==="agent")("sm-gnode--command",n.node().kind==="command")("sm-gnode--note",n.node().kind==="note")("sm-gnode--danger",n.hasInjection())("sm-gnode--with-color",!!n.nodeColor())("sm-gnode--deprecated",n.stability()==="deprecated")("sm-gnode--expanded",n.expanded())("sm-gnode--selected",n.selected())("sm-gnode--highlighted",n.highlighted())("sm-gnode--dimmed",n.dimmed()))},inputs:{node:[1,"node"],stats:[1,"stats"],summary:[1,"summary"],issues:[1,"issues"],selected:[1,"selected"],highlighted:[1,"highlighted"],dimmed:[1,"dimmed"],expanded:[1,"expanded"]},outputs:{expanded:"expandedChange"},decls:32,vars:24,consts:[[1,"sm-gnode__main"],["aria-hidden","true",1,"sm-gnode__icon-box"],[3,"kind","size"],[1,"sm-gnode__content"],[1,"sm-gnode__name-row"],[1,"sm-gnode__name",3,"pTooltip"],[1,"sm-gnode__actions"],[1,"sm-gnode__confidence",3,"class","pTooltip"],["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"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--date",3,"pTooltip"],[1,"sm-gnode__sub-version"],[1,"sm-gnode__panel"],[1,"sm-gnode__llm"],[1,"sm-gnode__desc"],[1,"sm-gnode__issues-block"],[1,"sm-gnode__footer"],[1,"sm-gnode__stat","sm-gnode__stat--error",3,"pTooltip"],[1,"sm-gnode__stat","sm-gnode__stat--warn",3,"pTooltip"],[1,"sm-gnode__stat",3,"pTooltip"],[1,"sm-gnode__footer-end"],[1,"sm-gnode__confidence",3,"pTooltip"],[1,"sm-gnode__sub-key"],["aria-hidden","true",1,"pi","pi-calendar"],[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"],[1,"sm-gnode__issue",3,"class","pTooltip"],[1,"sm-gnode__issue",3,"pTooltip"],["aria-hidden","true",1,"sm-gnode__issue-icon"],[1,"sm-gnode__issue-rule"],[1,"sm-gnode__issue-msg"],["aria-hidden","true",1,"pi","pi-times-circle"],[1,"sm-gnode__stat-num"],["aria-hidden","true",1,"pi","pi-exclamation-triangle"],["aria-hidden","true",1,"pi","pi-wrench"],["aria-hidden","true"],["aria-hidden","true",1,"pi","pi-link"],[1,"sm-gnode__stat","sm-gnode__stat--danger",3,"pTooltip"],["width","14","height","14","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["d","M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"],["d","M6.453 15h11.094"],["d","M8.5 2h7"],["aria-hidden","true",1,"pi","pi-ban"],["d","M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"],["x1","12","y1","8","x2","12","y2","12"],["x1","12","y1","16","x2","12.01","y2","16"]],template:function(e,n){if(e&1&&(qn(0)(1)(2),p(3,"div",0)(4,"div",1),G(5,"sm-kind-icon",2),m(),p(6,"div",3)(7,"div",4)(8,"span",5),v(9),m()()(),p(10,"div",6),N(11,tw,2,4,"span",7),p(12,"button",8),ie("click",function(r){return n.toggleExpanded(r)}),G(13,"i",9),m()(),p(14,"div",10),N(15,nw,4,2,"span",11),N(16,iw,4,2,"span",12),N(17,ow,3,2,"span",13),N(18,rw,2,1,"span",14),m()(),p(19,"div",15),N(20,kw,5,4,"div",16),N(21,Ow,2,1,"div",17),N(22,Aw,1,1),N(23,zw,3,0,"div",18),m(),p(24,"div",19),N(25,Bw,4,2,"span",20),N(26,Gw,4,2,"span",21),N(27,Hw,4,2,"span",22),N(28,jw,5,2,"span",22),N(29,Vw,5,2,"span",22),N(30,Uw,4,2,"span",22),N(31,Xw,4,3,"div",23),m()),e&2){let o,r,s,a=n.node(),d=St(n.summary());l();let u=St(n.stats());l();let f=St(n.confidenceTier());l(3),P("kind",a.kind)("size",18),l(3),P("pTooltip",n.displayName()),l(),I(n.displayName()),l(2),k(n.showLlmConfidence&&d!==null&&f!==null?11:-1),l(),K("aria-label",n.texts.ariaExpand),l(3),k(n.tokensShort()!==null?15:-1),l(),k(n.bytesShort()!==null?16:-1),l(),k((o=n.daysAgo())?17:-1,o),l(),k((r=n.version())?18:-1,r),l(2),k(n.hasLlmCluster()?20:-1),l(),k(n.description()?21:-1),l(),k((s=n.fmAgent())?22:-1,s),l(),k(n.visibleIssues().length?23:-1),l(2),k(n.errorCount()>0?25:-1),l(),k(n.warnCount()>0?26:-1),l(),k(n.toolsCount()>0?27:-1),l(),k(u.linksIn>0?28:-1),l(),k(u.linksOut>0?29:-1),l(),k(u.externalRefsCount&&u.externalRefsCount>0?30:-1),l(),k(n.stability()==="experimental"||n.stability()==="deprecated"||n.hasInjection()?31:-1)}},dependencies:[An,ut,lt],styles:['[_nghost-%COMP%]{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,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, var(--sm-kind-note))}.sm-gnode--skill[_nghost-%COMP%]{--accent: var(--sm-kind-skill)}.sm-gnode--agent[_nghost-%COMP%]{--accent: var(--sm-kind-agent)}.sm-gnode--command[_nghost-%COMP%]{--accent: var(--sm-kind-command)}.sm-gnode--note[_nghost-%COMP%]{--accent: var(--sm-kind-note)}.sm-gnode--danger[_nghost-%COMP%]{--accent: var(--sm-severity-error)}.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%]{width:38px;height:38px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--kind-bg, var(--sm-kind-note-bg));color:var(--kind-fg, var(--sm-kind-note-fg));flex:none;font-size:1.05rem;grid-row:1 / span 2;align-self:center}.sm-gnode--skill[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-skill-bg);--kind-fg: var(--sm-kind-skill-fg)}.sm-gnode--agent[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-agent-bg);--kind-fg: var(--sm-kind-agent-fg)}.sm-gnode--command[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-command-bg);--kind-fg: var(--sm-kind-command-fg)}.sm-gnode--note[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-note-bg);--kind-fg: var(--sm-kind-note-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:center;gap:.4rem;min-width:0}.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--with-color[_nghost-%COMP%] .sm-gnode__name[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--node-color) 7%,transparent);padding:.05rem .4rem;border-radius:3px}.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:4px;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__sub[_ngcontent-%COMP%]{grid-column:2 / -1;grid-row:2;display:flex;flex-wrap:nowrap;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%}.sm-gnode__sub-version[_ngcontent-%COMP%]{margin-left:auto}.sm-gnode__sub-stat[_ngcontent-%COMP%], .sm-gnode__sub-version[_ngcontent-%COMP%]{padding:.08rem .35rem;border-radius:3px;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;cursor:help}.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:color-mix(in srgb,var(--sm-kind-agent) 7%,transparent)}.sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-command) 7%,transparent)}.sm-gnode__sub-stat--date[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-skill) 7%,transparent)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--tokens[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--tokens[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-agent) 22%,transparent);color:var(--sm-kind-agent-fg)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--bytes[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-command) 22%,transparent);color:var(--sm-kind-command-fg)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--date[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--date[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-skill) 22%,transparent);color:var(--sm-kind-skill-fg)}.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:3px;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:3px;font-size:.7rem;font-style:normal;color:var(--p-text-color)}.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:3px}.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:3px;font-size:.68rem}.sm-gnode__issues-block[_ngcontent-%COMP%]{padding:.5rem .7rem;border-top:1px solid var(--sm-border);display:flex;flex-direction:column;gap:.25rem}.sm-gnode__issue[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.35rem;font-size:.7rem;line-height:1.35;min-width:0}.sm-gnode__issue-icon[_ngcontent-%COMP%]{font-size:.7rem;flex:none}.sm-gnode__issue--error[_ngcontent-%COMP%] .sm-gnode__issue-icon[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__issue--warn[_ngcontent-%COMP%] .sm-gnode__issue-icon[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__issue-rule[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);color:var(--sm-text-muted);flex:none;font-size:.65rem}.sm-gnode__issue-msg[_ngcontent-%COMP%]{color:var(--p-text-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.sm-gnode__footer[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.7rem;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[_ngcontent-%COMP%]:empty{display:none}.sm-gnode__footer-end[_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%], .sm-gnode__stat[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{font-size:.85rem}.sm-gnode__stat-num[_ngcontent-%COMP%]{font-weight:600;color:var(--p-text-color)}.sm-gnode__stat--error[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error);padding:.1rem .4rem;border-radius:3px}.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:3px}.sm-gnode__stat--warn[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__stat--danger[_ngcontent-%COMP%]{color:var(--sm-severity-error)}'],changeDetection:0})};function Hp(t){return t<1e3?`${t}`:t<1e4?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${Math.round(t/1e3)}k`}var jp={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`,edges:t=>`${t} edges`,cacheAge:t=>`cache ${t}s`}};var Yw=["sparkline"];function Kw(t,i){if(t&1&&(p(0,"span",5),v(1,"\xB7"),m(),p(2,"span",3),v(3),m()),t&2){let e=_(3);l(3),I(e.texts.units.mb(e.heapMb()))}}function Zw(t,i){if(t&1&&(p(0,"span",5),v(1,"\xB7"),m(),p(2,"span",3),v(3),m()),t&2){let e=_(3);l(3),I(e.texts.units.cacheAge(e.cacheAgeSec()))}}function Qw(t,i){if(t&1&&(G(0,"canvas",4,1),p(2,"span",5),v(3,"\xB7"),m(),p(4,"span",3),v(5),m(),N(6,Kw,4,1),p(7,"span",5),v(8,"\xB7"),m(),p(9,"span",3),v(10),m(),p(11,"span",5),v(12,"\xB7"),m(),p(13,"span",3),v(14),m(),p(15,"span",5),v(16,"\xB7"),m(),p(17,"span",3),v(18),m(),p(19,"span",5),v(20,"\xB7"),m(),p(21,"span",3),v(22),m(),N(23,Zw,4,1)),t&2){let e=_(2);l(5),I(e.texts.units.ms(e.frameTimeMs())),l(),k(e.hasHeap()?6:-1),l(4),I(e.texts.units.longTasks(e.longTasks())),l(4),I(e.texts.units.domNodes(e.domNodes())),l(4),I(e.texts.units.nodes(e.visible(),e.total())),l(4),I(e.texts.units.edges(e.edges())),l(),k(e.cacheAgeSec()!==null?23:-1)}}function Jw(t,i){if(t&1&&(p(0,"span",3),v(1),m(),N(2,Qw,24,7)),t&2){let e=_();l(),I(e.texts.units.fps(e.fps())),l(),k(e.expanded()?2:-1)}}var eb=30,Nf=60,Il=14,Sl=class t{visible=A(0);total=A(0);edges=A(0);cacheAt=A(null);texts=jp;destroyRef=c(Ke);zone=c(jn);fps=$(0);frameTimeMs=$(0);fpsSamples=$([]);sparklineCanvas=Se("sparkline");heapMb=$(null);longTasks=$(0);domNodes=$(0);nowTick=$(performance.now());expanded=$(tb());cacheAgeSec=H(()=>{let i=this.cacheAt();return i===null?null:Math.max(0,Math.floor((this.nowTick()-i)/1e3))});hasHeap=H(()=>this.heapMb()!==null);constructor(){let i=0,e=0,n=performance.now(),o=n,r=0,s=d=>{let u=d-n;if(n=d,i+=1,e+=u,d-o>=1e3){let f=(d-o)/1e3,g=Math.round(i/f);this.fps.set(g),this.frameTimeMs.set(Math.round(e/Math.max(i,1))),this.heapMb.set(ib()),this.domNodes.set(document.querySelectorAll("*").length),this.nowTick.set(d),this.fpsSamples.update(x=>{let w=x.length>=eb?x.slice(1):x.slice();return w.push(g),w}),i=0,e=0,o=d}r=requestAnimationFrame(s)};this.zone.runOutsideAngular(()=>{r=requestAnimationFrame(s)});let a=null;if(typeof PerformanceObserver<"u")try{a=new PerformanceObserver(d=>{this.longTasks.update(u=>u+d.getEntries().length)}),a.observe({type:"longtask",buffered:!0})}catch{}this.destroyRef.onDestroy(()=>{cancelAnimationFrame(r),a?.disconnect()}),fe(()=>{let d=this.sparklineCanvas(),u=this.fpsSamples();d&&ob(d.nativeElement,u)})}setExpanded(i){this.expanded.set(i),nb(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["app-perf-hud"]],viewQuery:function(e,n){e&1&&Ct(n.sparklineCanvas,Yw,5),e&2&&nt()},inputs:{visible:[1,"visible"],total:[1,"total"],edges:[1,"edges"],cacheAt:[1,"cacheAt"]},decls:3,vars:2,consts:[["content",""],["sparkline",""],["styleClass","perf-hud","data-testid","perf-hud",3,"ngModelChange","ngModel","ariaLabel"],[1,"perf-hud__cell"],["aria-hidden","true",1,"perf-hud__sparkline"],["aria-hidden","true",1,"perf-hud__sep"]],template:function(e,n){e&1&&(p(0,"p-togglebutton",2),ie("ngModelChange",function(r){return n.setExpanded(r)}),me(1,Jw,3,2,"ng-template",null,0,dn),m()),e&2&&P("ngModel",n.expanded())("ariaLabel",n.expanded()?n.texts.a11y.collapse:n.texts.a11y.expand)},dependencies:[uo,co,lo,ho,fo],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: 999px;--p-togglebutton-content-border-radius: 999px;--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:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;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}[_nghost-%COMP%] .perf-hud .p-togglebutton-content{display:inline-flex;align-items:center;gap:.4rem}.perf-hud__cell[_ngcontent-%COMP%]{white-space:nowrap;font-variant-numeric:tabular-nums}.perf-hud__sep[_ngcontent-%COMP%]{opacity:.45}.perf-hud__sparkline[_ngcontent-%COMP%]{width:60px;height:14px;opacity:.6}"],changeDetection:0})},Vp="sm.perf-hud.expanded";function tb(){try{return localStorage.getItem(Vp)==="1"}catch{return!1}}function nb(t){try{localStorage.setItem(Vp,t?"1":"0")}catch{}}function ib(){let t=performance.memory;return t?Math.round(t.usedJSHeapSize/1024/1024):null}function ob(t,i){let e=window.devicePixelRatio||1,n=Nf*e,o=Il*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,Nf,Il),i.length<2))return;let s=Math.max(60,...i),a=Nf/(i.length-1);r.beginPath();for(let d=0;d<i.length;d+=1){let u=d*a,f=Il-i[d]/s*Il;d===0?r.moveTo(u,f):r.lineTo(u,f)}r.strokeStyle=getComputedStyle(t).color,r.lineWidth=1,r.stroke()}var Up=`
211
+ .p-card {
212
+ background: dt('card.background');
213
+ color: dt('card.color');
214
+ box-shadow: dt('card.shadow');
215
+ border-radius: dt('card.border.radius');
216
+ display: flex;
217
+ flex-direction: column;
218
+ }
219
+
220
+ .p-card-caption {
221
+ display: flex;
222
+ flex-direction: column;
223
+ gap: dt('card.caption.gap');
224
+ }
225
+
226
+ .p-card-body {
227
+ padding: dt('card.body.padding');
228
+ display: flex;
229
+ flex-direction: column;
230
+ gap: dt('card.body.gap');
231
+ }
232
+
233
+ .p-card-title {
234
+ font-size: dt('card.title.font.size');
235
+ font-weight: dt('card.title.font.weight');
236
+ }
237
+
238
+ .p-card-subtitle {
239
+ color: dt('card.subtitle.color');
240
+ }
241
+ `;var rb=["header"],sb=["title"],ab=["subtitle"],cb=["content"],db=["footer"],lb=["*",[["p-header"]],[["p-footer"]]],ub=["*","p-header","p-footer"];function fb(t,i){t&1&&tt(0)}function hb(t,i){if(t&1&&(p(0,"div",1),ve(1,1),me(2,fb,1,0,"ng-container",2),m()),t&2){let e=_();Te(e.cx("header")),P("pBind",e.ptm("header")),l(2),P("ngTemplateOutlet",e.headerTemplate||e._headerTemplate)}}function pb(t,i){if(t&1&&(zt(0),v(1),Bt()),t&2){let e=_(2);l(),I(e.header)}}function mb(t,i){t&1&&tt(0)}function _b(t,i){if(t&1&&(p(0,"div",1),me(1,pb,2,1,"ng-container",3)(2,mb,1,0,"ng-container",2),m()),t&2){let e=_();Te(e.cx("title")),P("pBind",e.ptm("title")),l(),P("ngIf",e.header&&!e._titleTemplate&&!e.titleTemplate),l(),P("ngTemplateOutlet",e.titleTemplate||e._titleTemplate)}}function gb(t,i){if(t&1&&(zt(0),v(1),Bt()),t&2){let e=_(2);l(),I(e.subheader)}}function yb(t,i){t&1&&tt(0)}function Cb(t,i){if(t&1&&(p(0,"div",1),me(1,gb,2,1,"ng-container",3)(2,yb,1,0,"ng-container",2),m()),t&2){let e=_();Te(e.cx("subtitle")),P("pBind",e.ptm("subtitle")),l(),P("ngIf",e.subheader&&!e._subtitleTemplate&&!e.subtitleTemplate),l(),P("ngTemplateOutlet",e.subtitleTemplate||e._subtitleTemplate)}}function vb(t,i){t&1&&tt(0)}function xb(t,i){t&1&&tt(0)}function wb(t,i){if(t&1&&(p(0,"div",1),ve(1,2),me(2,xb,1,0,"ng-container",2),m()),t&2){let e=_();Te(e.cx("footer")),P("pBind",e.ptm("footer")),l(2),P("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}var bb=`
242
+ ${Up}
243
+
244
+ .p-card {
245
+ display: block;
246
+ }
247
+ `,Ib={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"},Wp=(()=>{class t extends rh{name="card";style=bb;classes=Ib;static \u0275fac=(()=>{let e;return function(o){return(e||(e=W(t)))(o||t)}})();static \u0275prov=h({token:t,factory:t.\u0275fac})}return t})();var $p=new oe("CARD_INSTANCE"),Bi=(()=>{class t extends dh{componentName="Card";$pcCard=c($p,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=c(Yn,{self:!0});_componentStyle=c(Wp);onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}header;subheader;set style(e){nh(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=$(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=W(t)))(o||t)}})();static \u0275cmp=J({type:t,selectors:[["p-card"]],contentQueries:function(n,o,r){if(n&1&&Kf(r,ih,5)(r,oh,5)(r,rb,4)(r,sb,4)(r,ab,4)(r,cb,4)(r,db,4)(r,ln,4),n&2){let s;gt(s=yt())&&(o.headerFacet=s.first),gt(s=yt())&&(o.footerFacet=s.first),gt(s=yt())&&(o.headerTemplate=s.first),gt(s=yt())&&(o.titleTemplate=s.first),gt(s=yt())&&(o.subtitleTemplate=s.first),gt(s=yt())&&(o.contentTemplate=s.first),gt(s=yt())&&(o.footerTemplate=s.first),gt(s=yt())&&(o.templates=s)}},hostVars:4,hostBindings:function(n,o){n&2&&(Qi(o._style()),Te(o.cn(o.cx("root"),o.styleClass)))},inputs:{header:"header",subheader:"subheader",style:"style",styleClass:"styleClass"},features:[Ie([Wp,{provide:$p,useExisting:t},{provide:ch,useExisting:t}]),Yf([Yn]),he],ngContentSelectors:ub,decls:8,vars:11,consts:[[3,"pBind","class",4,"ngIf"],[3,"pBind"],[4,"ngTemplateOutlet"],[4,"ngIf"]],template:function(n,o){n&1&&(Gt(lb),me(0,hb,3,4,"div",0),p(1,"div",1),me(2,_b,3,5,"div",0)(3,Cb,3,5,"div",0),p(4,"div",1),ve(5),me(6,vb,1,0,"ng-container",2),m(),me(7,wb,3,4,"div",0),m()),n&2&&(P("ngIf",o.headerFacet||o.headerTemplate||o._headerTemplate),l(),Te(o.cx("body")),P("pBind",o.ptm("body")),l(),P("ngIf",o.header||o.titleTemplate||o._titleTemplate),l(),P("ngIf",o.subheader||o.subtitleTemplate||o._subtitleTemplate),l(),Te(o.cx("content")),P("pBind",o.ptm("content")),l(2),P("ngTemplateOutlet",o.contentTemplate||o._contentTemplate),l(),P("ngIf",o.footerFacet||o.footerTemplate||o._footerTemplate))},dependencies:[to,Qf,eo,oo,ro,Yn],encapsulation:2,changeDetection:0})}return t})(),Tl=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Yi({type:t});static \u0275inj=Wi({imports:[Bi,oo,ro,oo,ro]})}return t})();var Xp={emptyNoSelection:{title:"No node selected",descPrefix:"Pick a node from the ",listLink:"list",descMiddle:" or ",graphLink:"graph",descSuffix:"."},emptyNotFound:{title:"Node not found",descSuffix:" does not exist in the collection. ",backLink:"Back to list",descAfterLink:"."},backToList:"\u2190 back to list",cards:{agent:"Agent",relations:"Relations",metadata:"Metadata",tools:"Tools",external:"External",body:"Body"},fields:{model:"Model",supersededBy:"Superseded by",supersedes:"Supersedes",requires:"Requires",related:"Related",provides:"Provides",conflictsWith:"Conflicts with",tags:"Tags",toolsAllowlist:"Tools (allowlist)",allowedTools:"Allowed tools (pre-approved)",source:"Source",docs:"Docs",homepage:"Homepage",examples:"Examples",version:"Version",priority:"Priority",priorityScale:" / 10",author:"Author",authors:"Authors",license:"License",created:"Created",updated:"Updated",released:"Released",category:"Category",specCompat:"Spec compat"},body:{loading:"Loading body\u2026",empty:"This file has no body content (only frontmatter).",unavailable:"Body content unavailable \u2014 the source file may have moved or been deleted since the last scan.",renderError:"Failed to render markdown body.",refreshLabel:"Refresh body"},relations:{verifyHint:"This path is not in the current scan scope. Click to check whether the file exists.",deadConfirmed:"Verified: this path does not resolve to a known node."},authorsSeparator:", ",missing:"\u2014",placeholders:{enrichmentTitle:"Enrichment",summaryTitle:"Summary",findingsTitle:"Findings",body:"Available in v0.8.0"}};var Dl=class t{sanitizer=c(Jf);libsPromise=null;async render(i){let e=await this.loadLibs(),n=e.md.render(i),o=e.purify.sanitize(n);return this.sanitizer.bypassSecurityTrustHtml(o)}async renderToHtml(i){let e=await this.loadLibs(),n=e.md.render(i);return e.purify.sanitize(n)}loadLibs(){return this.libsPromise||(this.libsPromise=Sb()),this.libsPromise}static \u0275fac=function(e){return new(e||t)};static \u0275prov=h({token:t,factory:t.\u0275fac,providedIn:"root"})};async function Sb(){let[t,i]=await Promise.all([import("./chunk-STE4Z72W.js"),import("./chunk-N2C45VIA.js")]),e=t.default,n=new e({html:!1,linkify:!0}),o=i.default;return{md:n,purify:o}}var El=class t{title=A.required();body=A.required();icon=A("pi pi-clock");testId=A(null);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["sm-empty-state"]],inputs:{title:[1,"title"],body:[1,"body"],icon:[1,"icon"],testId:[1,"testId"]},decls:6,vars:5,consts:[[1,"empty-state-card"],["aria-hidden","true",1,"empty-state-card__icon"],[1,"empty-state-card__title"],[1,"empty-state-card__body"]],template:function(e,n){if(e&1&&(Ve(0,"div",0),bt(1,"span",1),Ve(2,"p",2),v(3),Xe(),Ve(4,"p",3),v(5),Xe()()),e&2){let o=n.testId();K("data-testid",o),l(),Te(n.icon()),l(2),I(n.title()),l(2),I(n.body())}},styles:["[_nghost-%COMP%]{display:block}.empty-state-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.5rem;padding:1rem 1.25rem;border:1px dashed var(--p-content-border-color);border-radius:var(--p-border-radius-md);background:var(--p-content-background);color:var(--p-text-muted-color)}.empty-state-card__icon[_ngcontent-%COMP%]{font-size:1.25rem;color:var(--p-text-muted-color);opacity:.7}.empty-state-card__title[_ngcontent-%COMP%]{margin:0;font-weight:600;color:var(--p-text-color)}.empty-state-card__body[_ngcontent-%COMP%]{margin:0;font-size:.85rem;line-height:1.4}"],changeDetection:0})};var Yp={cardHeader:"Linked nodes",refreshLabel:"Refresh links",outgoingHeader:"Outgoing",incomingHeader:"Incoming",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:", "};var Zp=(t,i)=>i.source+"|"+i.target+"|"+i.kind+"|"+((i.trigger==null?null:i.trigger.normalizedTrigger)??"");function Eb(t,i){if(t&1){let e=Fe();p(0,"div",4)(1,"h3",5),v(2),m(),p(3,"p-button",6),ie("onClick",function(){Z(e);let o=_(2);return Q(o.refresh())}),m()()}if(t&2){let e=_(2);l(2),I(e.texts.cardHeader),l(),P("rounded",!0)("text",!0)("ariaLabel",e.texts.refreshLabel)("pTooltip",e.texts.refreshLabel)("disabled",e.state()==="loading")}}function Pb(t,i){if(t&1&&(p(0,"p",2),v(1),m()),t&2){let e=_(2);l(),I(e.texts.loading)}}function Mb(t,i){if(t&1&&(p(0,"p",3),v(1),m()),t&2){let e=_(2);l(),I(e.texts.error)}}function Rb(t,i){if(t&1&&(p(0,"p",9),v(1),m()),t&2){let e=_(3);l(),I(e.texts.emptyOutgoing)}}function Nb(t,i){if(t&1&&(p(0,"span",17),v(1),m()),t&2){let e=_().$implicit,n=_(4);l(),$n(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function kb(t,i){if(t&1){let e=Fe();p(0,"li",13),G(1,"p-tag",14),p(2,"button",15),ie("click",function(){let o=Z(e).$implicit,r=_(4);return Q(r.onOpen(o.target))}),v(3),m(),G(4,"p-tag",16),N(5,Nb,2,2,"span",17),m()}if(t&2){let e=i.$implicit,n=_(4);K("data-testid","linked-nodes-outgoing-row-"+e.target),l(),P("value",e.kind)("severity",n.kindSeverity(e.kind)),l(),K("data-testid","linked-nodes-outgoing-link-"+e.target),l(),Wn(" ",e.target," "),l(),P("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),l(),k(e.sources.length?5:-1)}}function Ob(t,i){if(t&1&&(p(0,"ul",10),re(1,kb,6,9,"li",13,Zp),m()),t&2){let e=_(3);l(),se(e.outgoing())}}function Fb(t,i){if(t&1&&(p(0,"p",12),v(1),m()),t&2){let e=_(3);l(),I(e.texts.emptyIncoming)}}function Ab(t,i){if(t&1&&(p(0,"span",17),v(1),m()),t&2){let e=_().$implicit,n=_(4);l(),$n(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function Lb(t,i){if(t&1){let e=Fe();p(0,"li",13),G(1,"p-tag",14),p(2,"button",15),ie("click",function(){let o=Z(e).$implicit,r=_(4);return Q(r.onOpen(o.source))}),v(3),m(),G(4,"p-tag",16),N(5,Ab,2,2,"span",17),m()}if(t&2){let e=i.$implicit,n=_(4);K("data-testid","linked-nodes-incoming-row-"+e.source),l(),P("value",e.kind)("severity",n.kindSeverity(e.kind)),l(),K("data-testid","linked-nodes-incoming-link-"+e.source),l(),Wn(" ",e.source," "),l(),P("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),l(),k(e.sources.length?5:-1)}}function zb(t,i){if(t&1&&(p(0,"ul",10),re(1,Lb,6,9,"li",13,Zp),m()),t&2){let e=_(3);l(),se(e.incoming())}}function Bb(t,i){if(t&1&&(p(0,"section",7)(1,"h4",8),v(2),m(),N(3,Rb,2,1,"p",9)(4,Ob,3,0,"ul",10),m(),p(5,"section",11)(6,"h4",8),v(7),m(),N(8,Fb,2,1,"p",12)(9,zb,3,0,"ul",10),m()),t&2){let e=_(2);l(2),I(e.texts.outgoingHeader),l(),k(e.outgoing().length===0?3:4),l(4),I(e.texts.incomingHeader),l(),k(e.incoming().length===0?8:9)}}function Gb(t,i){if(t&1&&(p(0,"p-card",0),me(1,Eb,4,6,"ng-template",1),N(2,Pb,2,1,"p",2)(3,Mb,2,1,"p",3)(4,Bb,10,4),m()),t&2){let e,n=_();l(2),k((e=n.state())==="loading"?2:e==="error"?3:e==="ready"?4:-1)}}var Hb={invokes:"warn",references:"info",mentions:"secondary",supersedes:"success"},jb={high:"success",medium:"info",low:"warn"},Pl=class t{dataSource=c(so);destroyRef=c(Ke);texts=Yp;path=A(null);openPath=it();state=$("idle");outgoing=$([]);incoming=$([]);fetchToken=0;hasResults=H(()=>this.state()==="ready"&&(this.outgoing().length>0||this.incoming().length>0));constructor(){this.dataSource.events().pipe(jf(i=>i.type==="scan.completed"),sh(this.destroyRef)).subscribe(()=>{let i=this.path();i&&this.fetch(i)}),fe(()=>{let i=this.path();if(!i){this.fetchToken++,this.state.set("idle"),this.outgoing.set([]),this.incoming.set([]);return}this.fetch(i)})}refresh(){let i=this.path();i&&this.fetch(i)}onOpen(i){this.openPath.emit(i)}kindSeverity(i){return Hb[i]??"secondary"}confidenceSeverity(i){return jb[i]??"info"}confidenceLabel(i){return this.texts.confidence[i]??i}async fetch(i){let e=++this.fetchToken;this.state.set("loading");try{let[n,o]=await Promise.all([this.dataSource.listLinks({from:i}),this.dataSource.listLinks({to:i})]);if(e!==this.fetchToken)return;this.outgoing.set(n.items),this.incoming.set(o.items),this.state.set("ready")}catch{if(e!==this.fetchToken)return;this.outgoing.set([]),this.incoming.set([]),this.state.set("error")}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({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-outgoing",1,"linked-nodes-panel__section"],[1,"linked-nodes-panel__section-title"],["data-testid","linked-nodes-outgoing-empty",1,"linked-nodes-panel__status"],[1,"linked-nodes-panel__rows"],["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"],[3,"value","severity"],["type","button",1,"linked-nodes-panel__path",3,"click"],[3,"value","severity","rounded"],[1,"linked-nodes-panel__sources"]],template:function(e,n){e&1&&N(0,Gb,5,1,"p-card",0),e&2&&k(n.path()?0:-1)},dependencies:[Tl,Bi,ln,mo,po,_o,fn,un,ut,lt],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:4px;background:var(--p-content-background);border:1px solid var(--p-content-border-color)}.linked-nodes-panel__path[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85rem;color:var(--p-primary-color);background:none;border:none;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.linked-nodes-panel__path[_ngcontent-%COMP%]:hover{text-decoration:none}.linked-nodes-panel__sources[_ngcontent-%COMP%]{font-size:.75rem;color:var(--p-text-muted-color);margin-left:auto}"],changeDetection:0})};var Vb=t=>({path:t,testIdPrefix:"rel-supersededBy"}),Ub=t=>({path:t,testIdPrefix:"rel-supersedes"}),Wb=t=>({path:t,testIdPrefix:"rel-requires"}),$b=t=>({path:t,testIdPrefix:"rel-related"});function qb(t,i){if(t&1&&(p(0,"section",1)(1,"div",2),G(2,"span",3),p(3,"p",4),v(4),m(),p(5,"p",5),v(6),p(7,"a",6),v(8),m(),v(9),p(10,"a",7),v(11),m(),v(12),m()()()),t&2){let e=_();l(4),I(e.texts.emptyNoSelection.title),l(2),I(e.texts.emptyNoSelection.descPrefix),l(2),I(e.texts.emptyNoSelection.listLink),l(),I(e.texts.emptyNoSelection.descMiddle),l(2),I(e.texts.emptyNoSelection.graphLink),l(),I(e.texts.emptyNoSelection.descSuffix)}}function Xb(t,i){if(t&1&&(p(0,"section",1)(1,"div",8),G(2,"span",9),p(3,"p",4),v(4),m(),p(5,"p",5)(6,"code"),v(7),m(),v(8),p(9,"a",6),v(10),m(),v(11),m()()()),t&2){let e=_();l(4),I(e.texts.emptyNotFound.title),l(3),I(e.path()),l(),I(e.texts.emptyNotFound.descSuffix),l(2),I(e.texts.emptyNotFound.backLink),l(),I(e.texts.emptyNotFound.descAfterLink)}}function Yb(t,i){if(t&1&&G(0,"p-tag",13),t&2){_();let e=q(1),n=_();P("value",e.stability)("severity",n.stabilitySeverity(e.stability))("rounded",!0)}}function Kb(t,i){if(t&1&&(p(0,"a",14),v(1),m()),t&2){let e=_(2);l(),I(e.texts.backToList)}}function Zb(t,i){if(t&1&&G(0,"sm-empty-state",33)(1,"sm-empty-state",34)(2,"sm-empty-state",35),t&2){let e=_(2);P("title",e.texts.placeholders.enrichmentTitle)("body",e.texts.placeholders.body),l(),P("title",e.texts.placeholders.summaryTitle)("body",e.texts.placeholders.body),l(),P("title",e.texts.placeholders.findingsTitle)("body",e.texts.placeholders.body)}}function Qb(t,i){if(t&1&&(p(0,"p-card",18)(1,"dl",23)(2,"dt"),v(3),m(),p(4,"dd")(5,"code"),v(6),m()()()()),t&2){let e=_(2);P("header",e.texts.cards.agent),l(3),I(e.texts.fields.model),l(3),I(i.model??e.texts.missing)}}function Jb(t,i){t&1&&G(0,"i",40)}function eI(t,i){t&1&&G(0,"i",41)}function tI(t,i){t&1&&G(0,"i",42)}function nI(t,i){if(t&1){let e=Fe();p(0,"button",39),ie("click",function(){Z(e);let o=_().path,r=_(2);return Q(r.verifyDeadLink(o))}),N(1,Jb,1,0,"i",40)(2,eI,1,0,"i",41)(3,tI,1,0,"i",42),m()}if(t&2){let e=_(),n=e.path,o=e.testIdPrefix,r=q(0),s=_(2);Le("rel-chip__verify--confirmed",r==="dead-confirmed"),P("disabled",s.isVerifying(n))("pTooltip",r==="dead-confirmed"?s.texts.relations.deadConfirmed:s.texts.relations.verifyHint),K("data-testid",o+"-verify-"+n),l(),k(s.isVerifying(n)?1:r==="dead-confirmed"?2:3)}}function iI(t,i){if(t&1){let e=Fe();qn(0),p(1,"span",36)(2,"p-chip",37),ie("click",function(){let o=Z(e).path,r=q(0),s=_(2);return Q(r==="live"&&s.openPath(o))}),m(),N(3,nI,4,6,"button",38),m()}if(t&2){let e=i.path,n=i.testIdPrefix,o=St(_(2).linkStatus(e));l(),K("data-testid",n+"-"+e),l(),P("label",e)("styleClass",o==="live"?"chip--link":o==="dead-confirmed"?"chip--dead chip--dead-confirmed":"chip--dead"),l(),k(o!=="live"?3:-1)}}function oI(t,i){t&1&&tt(0)}function rI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),me(3,oI,1,0,"ng-container",44),m()),t&2){_(2);let e=Un(19),n=q(1),o=_();l(),I(o.texts.fields.supersededBy),l(2),P("ngTemplateOutlet",e)("ngTemplateOutletContext",Xn(3,Vb,n.supersededBy))}}function sI(t,i){t&1&&tt(0)}function aI(t,i){if(t&1&&me(0,sI,1,0,"ng-container",44),t&2){let e=i.$implicit;_(3);let n=Un(19);P("ngTemplateOutlet",n)("ngTemplateOutletContext",Xn(2,Ub,e))}}function cI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,aI,1,4,"ng-container",null,Ne),m()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.supersedes),l(2),se(e.supersedes)}}function dI(t,i){t&1&&tt(0)}function lI(t,i){if(t&1&&me(0,dI,1,0,"ng-container",44),t&2){let e=i.$implicit;_(3);let n=Un(19);P("ngTemplateOutlet",n)("ngTemplateOutletContext",Xn(2,Wb,e))}}function uI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,lI,1,4,"ng-container",null,Ne),m()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.requires),l(2),se(e.requires)}}function fI(t,i){t&1&&tt(0)}function hI(t,i){if(t&1&&me(0,fI,1,0,"ng-container",44),t&2){let e=i.$implicit;_(3);let n=Un(19);P("ngTemplateOutlet",n)("ngTemplateOutletContext",Xn(2,$b,e))}}function pI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,hI,1,4,"ng-container",null,Ne),m()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.related),l(2),se(e.related)}}function mI(t,i){if(t&1&&G(0,"p-chip",45),t&2){let e=i.$implicit;P("label",e)}}function _I(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,mI,1,1,"p-chip",45,Ne),m()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.provides),l(2),se(e.provides)}}function gI(t,i){if(t&1&&G(0,"p-chip",46),t&2){let e=i.$implicit;P("label",e)}}function yI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,gI,1,1,"p-chip",46,Ne),m()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.conflictsWith),l(2),se(e.conflictsWith)}}function CI(t,i){if(t&1&&(p(0,"p-card",19),N(1,rI,4,5),N(2,cI,5,1),N(3,uI,5,1),N(4,pI,5,1),N(5,_I,5,1),N(6,yI,5,1),m()),t&2){_();let e=q(1),n=_();P("header",n.texts.cards.relations),l(),k(e!=null&&e.supersededBy?1:-1),l(),k(!(e==null||e.supersedes==null)&&e.supersedes.length?2:-1),l(),k(!(e==null||e.requires==null)&&e.requires.length?3:-1),l(),k(!(e==null||e.related==null)&&e.related.length?4:-1),l(),k(!(e==null||e.provides==null)&&e.provides.length?5:-1),l(),k(!(e==null||e.conflictsWith==null)&&e.conflictsWith.length?6:-1)}}function vI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.priority),l(2),$n("",e.priority,"",n.texts.fields.priorityScale)}}function xI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(0),n=_();l(),I(n.texts.fields.author),l(2),I(e.author)}}function wI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(0),n=_();l(),I(n.texts.fields.authors),l(2),I(e.authors.join(n.texts.authorsSeparator))}}function bI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(0),n=_();l(),I(n.texts.fields.license),l(2),I(e.license)}}function II(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.created),l(2),I(e.created)}}function SI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.updated),l(2),I(e.updated)}}function TI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.released),l(2),I(e.released)}}function DI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd"),v(3),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.category),l(2),I(e.category)}}function EI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd")(3,"code"),v(4),m()()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.specCompat),l(3),I(e.specCompat)}}function PI(t,i){if(t&1&&G(0,"p-chip",45),t&2){let e=i.$implicit;P("label",e)}}function MI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,PI,1,1,"p-chip",45,Ne),m()),t&2){_();let e=q(1),n=_();l(),I(n.texts.fields.tags),l(2),se(e.tags)}}function RI(t,i){if(t&1&&G(0,"p-chip",45),t&2){let e=i.$implicit;P("label",e)}}function NI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,RI,1,1,"p-chip",45,Ne),m()),t&2){_(2);let e=q(0),n=_();l(),I(n.texts.fields.toolsAllowlist),l(2),se(e.tools)}}function kI(t,i){if(t&1&&G(0,"p-chip",45),t&2){let e=i.$implicit;P("label",e)}}function OI(t,i){if(t&1&&(p(0,"h4"),v(1),m(),p(2,"div",43),re(3,kI,1,1,"p-chip",45,Ne),m()),t&2){_(2);let e=q(0),n=_();l(),I(n.texts.fields.allowedTools),l(2),se(e.allowedTools)}}function FI(t,i){if(t&1&&(p(0,"p-card",24),N(1,NI,5,1),N(2,OI,5,1),m()),t&2){_();let e=q(0),n=_();P("header",n.texts.cards.tools),l(),k(e.tools!=null&&e.tools.length?1:-1),l(),k(e.allowedTools!=null&&e.allowedTools.length?2:-1)}}function AI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd")(3,"a",47),v(4),m()()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.source),l(2),P("href",e.source,Vn),l(),I(e.source)}}function LI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd")(3,"a",47),v(4),m()()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.docs),l(2),P("href",e.docsUrl,Vn),l(),I(e.docsUrl)}}function zI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd")(3,"a",47),v(4),m()()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.homepage),l(2),P("href",e.homepage,Vn),l(),I(e.homepage)}}function BI(t,i){if(t&1&&(p(0,"dt"),v(1),m(),p(2,"dd")(3,"a",47),v(4),m()()),t&2){_(2);let e=q(1),n=_();l(),I(n.texts.fields.examples),l(2),P("href",e.examplesUrl,Vn),l(),I(e.examplesUrl)}}function GI(t,i){if(t&1&&(p(0,"p-card",25)(1,"dl",23),N(2,AI,5,3),N(3,LI,5,3),N(4,zI,5,3),N(5,BI,5,3),m()()),t&2){_();let e=q(1),n=_();P("header",n.texts.cards.external),l(2),k(e!=null&&e.source?2:-1),l(),k(e!=null&&e.docsUrl?3:-1),l(),k(e!=null&&e.homepage?4:-1),l(),k(e!=null&&e.examplesUrl?5:-1)}}function HI(t,i){if(t&1){let e=Fe();p(0,"div",48)(1,"h3",49),v(2),m(),p(3,"p-button",50),ie("onClick",function(){Z(e);let o=_(2);return Q(o.refreshBody())}),m()()}if(t&2){let e=_(2);l(2),I(e.texts.cards.body),l(),P("rounded",!0)("text",!0)("ariaLabel",e.texts.body.refreshLabel)("pTooltip",e.texts.body.refreshLabel)("disabled",e.bodyState()==="loading"||!e.path())}}function jI(t,i){if(t&1&&(p(0,"p",28),v(1),m()),t&2){let e=_(2);l(),I(e.texts.body.loading)}}function VI(t,i){if(t&1&&(p(0,"p",29),v(1),m()),t&2){let e=_(2);l(),I(e.texts.body.empty)}}function UI(t,i){if(t&1&&(p(0,"p",30),v(1),m()),t&2){let e=_(2);l(),I(e.texts.body.unavailable)}}function WI(t,i){if(t&1&&(p(0,"p",31),v(1),m()),t&2){let e=_(2);l(),I(e.texts.body.renderError)}}function $I(t,i){if(t&1&&G(0,"div",32),t&2){let e=_(2);P("innerHTML",e.bodyHtml(),Uf)}}function qI(t,i){if(t&1){let e=Fe();qn(0)(1),p(2,"section",1)(3,"header",10)(4,"div",11),G(5,"p-tag",12),N(6,Yb,1,3,"p-tag",13),p(7,"h2"),v(8),m()(),N(9,Kb,2,1,"a",14),m(),p(10,"p",15)(11,"code"),v(12),m()(),p(13,"p",16),v(14),m(),p(15,"div",17),N(16,Zb,3,6),N(17,Qb,7,3,"p-card",18),me(18,iI,4,5,"ng-template",null,0,dn),N(20,CI,7,7,"p-card",19),p(21,"div",20)(22,"sm-linked-nodes-panel",21),ie("openPath",function(o){Z(e);let r=_();return Q(r.openPath(o))}),m()(),p(23,"p-card",22)(24,"dl",23)(25,"dt"),v(26),m(),p(27,"dd")(28,"code"),v(29),m()(),N(30,vI,4,3),N(31,xI,4,2),N(32,wI,4,2),N(33,bI,4,2),N(34,II,4,2),N(35,SI,4,2),N(36,TI,4,2),N(37,DI,4,2),N(38,EI,5,2),m(),N(39,MI,5,1),m(),N(40,FI,3,3,"p-card",24),N(41,GI,6,5,"p-card",25),p(42,"p-card",26),me(43,HI,4,6,"ng-template",27),N(44,jI,2,1,"p",28)(45,VI,2,1,"p",29)(46,UI,2,1,"p",30)(47,WI,2,1,"p",31)(48,$I,1,1,"div",32),m()()()}if(t&2){let e,n,o=_(),r=o.node(),s=St(r.frontmatter);l();let a=St(s.metadata);l(4),Qi(o.kindStyle(r.kind)),P("value",o.kindLabel(r.kind)),l(),k(a!=null&&a.stability?6:-1),l(2),I(s.name),l(),k(o.mode()==="standalone"?9:-1),l(3),I(r.path),l(2),I(s.description),l(2),k(o.mode()==="standalone"?16:-1),l(),k((e=o.asAgent())?17:-1,e),l(3),k(!(a==null||a.supersedes==null)&&a.supersedes.length||a!=null&&a.supersededBy||!(a==null||a.requires==null)&&a.requires.length||!(a==null||a.related==null)&&a.related.length||!(a==null||a.provides==null)&&a.provides.length||!(a==null||a.conflictsWith==null)&&a.conflictsWith.length?20:-1),l(2),P("path",r.path),l(),P("header",o.texts.cards.metadata),l(3),I(o.texts.fields.version),l(3),I((a==null?null:a.version)??o.texts.missing),l(),k((a==null?null:a.priority)!=null?30:-1),l(),k(s.author?31:-1),l(),k(s.authors!=null&&s.authors.length?32:-1),l(),k(s.license?33:-1),l(),k(a!=null&&a.created?34:-1),l(),k(a!=null&&a.updated?35:-1),l(),k(a!=null&&a.released?36:-1),l(),k(a!=null&&a.category?37:-1),l(),k(a!=null&&a.specCompat?38:-1),l(),k(!(a==null||a.tags==null)&&a.tags.length?39:-1),l(),k(s.tools!=null&&s.tools.length||s.allowedTools!=null&&s.allowedTools.length?40:-1),l(),k(a!=null&&a.source||a!=null&&a.docsUrl||a!=null&&a.homepage||a!=null&&a.examplesUrl?41:-1),l(3),k((n=o.bodyState())==="loading"?44:n==="empty"?45:n==="unavailable"?46:n==="error"?47:n==="ready"?48:-1)}}var XI={stable:"success",experimental:"info",deprecated:"warn"},Ml=class t{loader=c(hn);router=c(io);kindRegistry=c(pn);dataSource=c(so);markdown=c(Dl);texts=Xp;path=A(void 0);mode=A("standalone");node=H(()=>{let i=this.path();return i?this.loader.nodes().find(e=>e.path===i)??null:null});pathSet=H(()=>{let i=new Set;for(let e of this.loader.nodes())i.add(e.path);return i});asAgent=H(()=>this.node()?.kind==="agent"?this.node().frontmatter:null);bodyState=$("idle");bodyHtml=$(null);fetchToken=0;verifiedAlive=$(new Set);verifiedDead=$(new Set);verifyInFlight=$(new Set);constructor(){fe(()=>{let i=this.path(),e=++this.fetchToken;if(this.bodyHtml.set(null),this.verifiedAlive.set(new Set),this.verifiedDead.set(new Set),this.verifyInFlight.set(new Set),!i){this.bodyState.set("idle");return}this.bodyState.set("loading"),this.fetchAndRenderBody(i,e)})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}kindLabel(i){return this.kindRegistry.labelOf(i)}kindStyle(i){return{background:`var(--sm-kind-${i}-bg)`,color:`var(--sm-kind-${i}-fg)`}}stabilitySeverity(i){return XI[i]}openPath(i){this.router.navigate(["/graph"],{queryParams:{path:i}})}pathExists(i){return this.pathSet().has(i)}linkStatus(i){return this.pathSet().has(i)||this.verifiedAlive().has(i)?"live":this.verifiedDead().has(i)?"dead-confirmed":"dead-heuristic"}isVerifying(i){return this.verifyInFlight().has(i)}async verifyDeadLink(i){if(!(this.verifiedAlive().has(i)||this.verifiedDead().has(i))&&!this.verifyInFlight().has(i)){this.verifyInFlight.update(e=>new Set(e).add(i));try{await this.dataSource.getNode(i)===null?this.verifiedDead.update(n=>new Set(n).add(i)):this.verifiedAlive.update(n=>new Set(n).add(i))}catch{}finally{this.verifyInFlight.update(e=>{let n=new Set(e);return n.delete(i),n})}}}refreshBody(){let i=this.path();if(!i||this.bodyState()==="loading")return;let e=++this.fetchToken;this.bodyHtml.set(null),this.bodyState.set("loading"),this.fetchAndRenderBody(i,e)}async fetchAndRenderBody(i,e){try{let n=await this.dataSource.getNode(i,{includeBody:!0});if(e!==this.fetchToken)return;if(n===null){this.bodyState.set("unavailable");return}let o=n.item.body;if(o===null){this.bodyState.set("unavailable");return}if(o===void 0||o.trim().length===0){this.bodyState.set("empty");return}let r=await this.markdown.render(o);if(e!==this.fetchToken)return;this.bodyHtml.set(r),this.bodyState.set("ready")}catch{if(e!==this.fetchToken)return;this.bodyState.set("error")}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["app-inspector-view"]],hostVars:2,hostBindings:function(e,n){e&2&&Le("inspector-view--embedded",n.mode()==="embedded")},inputs:{path:[1,"path"],mode:[1,"mode"]},decls:3,vars:1,consts:[["pathChip",""],["data-testid","inspector-view",1,"inspector"],["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","/list",1,"inspector__back"],["routerLink","/graph",1,"inspector__back"],["data-testid","inspector-empty-not-found",1,"empty-state"],[1,"empty-state__icon","pi","pi-question-circle",2,"color","var(--sm-severity-warn)","opacity","1"],[1,"inspector__header"],["data-testid","inspector-title",1,"inspector__title"],[3,"value"],[3,"value","severity","rounded"],["routerLink","/list","data-testid","inspector-back",1,"inspector__back"],["data-testid","inspector-path",1,"inspector__path"],["data-testid","inspector-description",1,"inspector__desc"],[1,"inspector__grid"],["styleClass","inspector__card","data-testid","inspector-card-agent",3,"header"],["styleClass","inspector__card inspector__card--full","data-testid","inspector-card-relations",3,"header"],["data-testid","inspector-card-linked-nodes",1,"inspector__card","inspector__card--full"],[3,"openPath","path"],["styleClass","inspector__card","data-testid","inspector-card-metadata",3,"header"],[1,"kv"],["styleClass","inspector__card","data-testid","inspector-card-tools",3,"header"],["styleClass","inspector__card","data-testid","inspector-card-external",3,"header"],["styleClass","inspector__card inspector__card--full inspector__body","data-testid","inspector-card-body"],["pTemplate","header"],["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"],["icon","pi pi-sparkles","testId","inspector-empty-enrichment",3,"title","body"],["icon","pi pi-file","testId","inspector-empty-summary",3,"title","body"],["icon","pi pi-search","testId","inspector-empty-findings",3,"title","body"],[1,"rel-chip"],[3,"click","label","styleClass"],["type","button",1,"rel-chip__verify",3,"rel-chip__verify--confirmed","disabled","pTooltip"],["type","button",1,"rel-chip__verify",3,"click","disabled","pTooltip"],["aria-hidden","true",1,"pi","pi-spin","pi-spinner"],["aria-hidden","true",1,"pi","pi-times-circle"],["aria-hidden","true",1,"pi","pi-question-circle"],[1,"chips"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"label"],["styleClass","chip--warn",3,"label"],["target","_blank","rel","noopener",3,"href"],[1,"inspector__body-header"],[1,"inspector__body-title"],["icon","pi pi-refresh","severity","secondary","data-testid","inspector-body-refresh",3,"onClick","rounded","text","ariaLabel","pTooltip","disabled"]],template:function(e,n){e&1&&N(0,qb,13,6,"section",1)(1,Xb,12,5,"section",1)(2,qI,49,30,"section",1),e&2&&k(n.path()?n.node()?2:1:0)},dependencies:[th,eo,mo,po,ln,_o,lh,Tl,Bi,fn,un,ut,lt,El,Pl],styles:["[_nghost-%COMP%]{display:block}.inspector[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.inspector--empty[_ngcontent-%COMP%]{padding:2rem;color:var(--p-text-muted-color)}.inspector--empty[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:.25rem;font-size:.85rem}.inspector__header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:.5rem}.inspector__title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}.inspector__title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;letter-spacing:-.01em}.inspector__back[_ngcontent-%COMP%]{font-size:.9rem;color:var(--p-primary-color)}.inspector__path[_ngcontent-%COMP%]{margin:0}.inspector__path[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.15rem .5rem;border-radius:.25rem;font-size:.85rem;color:var(--p-text-muted-color)}.inspector__desc[_ngcontent-%COMP%]{margin:0;color:var(--p-text-color);font-size:1rem;line-height:1.5;max-width:70ch}.inspector__grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.inspector__card--full[_ngcontent-%COMP%]{grid-column:1 / -1}[_nghost-%COMP%] .inspector__card--hero .p-card{border-left:3px solid var(--p-primary-color)}.inspector__body[_ngcontent-%COMP%]{display:block}.inspector__body-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.75rem 1rem 0}.inspector__body-title[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600}.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.55;max-height:600px;overflow:auto}.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:4px;padding:.75rem;margin:.75rem 0;white-space:pre-wrap;word-wrap:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85rem;line-height:1.5;overflow-x:auto}.inspector__body-rendered[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--p-content-background);padding:.1rem .3rem;border-radius:3px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85em}.inspector__body-rendered[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:transparent;padding:0;border-radius:0}.kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.25rem .75rem;margin:0 0 .5rem;font-size:.9rem}.kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-weight:500}.kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.kv[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:.25rem;font-size:.85rem}.kv[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--p-primary-color);word-break:break-all}h4[_ngcontent-%COMP%]{margin:1rem 0 .5rem;font-size:.85rem;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color);font-weight:600}h4[_ngcontent-%COMP%]:first-child{margin-top:0}.chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.4rem}[_nghost-%COMP%] .chip--link .p-chip{cursor:pointer;background:var(--p-primary-50);color:var(--p-primary-color);transition:background .15s ease}[_nghost-%COMP%] .chip--link:hover .p-chip{background:var(--p-primary-100)}[_nghost-%COMP%] .chip--dead .p-chip{background:var(--sm-bg-hover);color:var(--p-text-muted-color);text-decoration:line-through;cursor:not-allowed}[_nghost-%COMP%] .chip--warn .p-chip{background:var(--sm-kind-command-bg);color:var(--sm-kind-command-fg)}[_nghost-%COMP%] .chip--dead-confirmed .p-chip{background:var(--sm-bg-hover);color:var(--sm-severity-error);border:1px dashed var(--sm-severity-error)}.rel-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.2rem}.rel-chip__verify[_ngcontent-%COMP%]{background:none;border:none;padding:.15rem;cursor:pointer;color:var(--p-text-muted-color);border-radius:50%;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background .15s ease}.rel-chip__verify[_ngcontent-%COMP%]:hover:not(:disabled){color:var(--p-primary-color);background:var(--sm-bg-hover)}.rel-chip__verify[_ngcontent-%COMP%]:disabled{cursor:wait;opacity:.6}.rel-chip__verify--confirmed[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.rel-chip__verify--confirmed[_ngcontent-%COMP%]:hover:not(:disabled){color:var(--sm-severity-error)}.args[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;display:flex;flex-direction:column;gap:.35rem;font-size:.9rem}.args[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:.25rem;font-size:.8rem;font-weight:500}.args__type[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-style:italic;margin-left:.25rem}.args__req[_ngcontent-%COMP%]{display:inline-block;margin-left:.5rem;padding:0 .4rem;font-size:.7rem;background:var(--sm-kind-command-bg);color:var(--sm-kind-command-fg);border-radius:.25rem;text-transform:uppercase;letter-spacing:.04em;font-weight:600}.cond[_ngcontent-%COMP%]{font-size:.8rem;word-break:break-all}.inspector__actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}@media(max-width:1280px){.inspector__grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.inspector-view--embedded[_nghost-%COMP%] .inspector[_ngcontent-%COMP%]{padding:1rem 1.1rem 1.25rem;gap:.85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__header[_ngcontent-%COMP%]{align-items:flex-start}.inspector-view--embedded[_nghost-%COMP%] .inspector__title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:1.1rem;line-height:1.25;word-break:break-word}.inspector-view--embedded[_nghost-%COMP%] .inspector__path[_ngcontent-%COMP%]{font-size:.78rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__path[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-size:.78rem;word-break:break-all}.inspector-view--embedded[_nghost-%COMP%] .inspector__desc[_ngcontent-%COMP%]{font-size:.9rem;line-height:1.45;max-width:none}.inspector-view--embedded[_nghost-%COMP%] .inspector__grid[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:.75rem}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-agent][_ngcontent-%COMP%], .inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-command][_ngcontent-%COMP%], .inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-skill][_ngcontent-%COMP%]{order:1}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-metadata][_ngcontent-%COMP%]{order:2}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-relations][_ngcontent-%COMP%]{order:3}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-linked-nodes][_ngcontent-%COMP%]{order:4}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-body][_ngcontent-%COMP%]{order:5}.inspector-view--embedded[_nghost-%COMP%] .inspector__card .p-card-body{padding:.75rem .85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card .p-card-title{font-size:.9rem;margin-bottom:.5rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color);margin:.5rem 0 .35rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.25rem .65rem;margin:0;font-size:.85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--p-text-muted-color)}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}"],changeDetection:0})};function kf(t,i){var e,n=1;t==null&&(t=0),i==null&&(i=0);function o(){var r,s=e.length,a,d=0,u=0;for(r=0;r<s;++r)a=e[r],d+=a.x,u+=a.y;for(d=(d/s-t)*n,u=(u/s-i)*n,r=0;r<s;++r)a=e[r],a.x-=d,a.y-=u}return o.initialize=function(r){e=r},o.x=function(r){return arguments.length?(t=+r,o):t},o.y=function(r){return arguments.length?(i=+r,o):i},o.strength=function(r){return arguments.length?(n=+r,o):n},o}function Qp(t){let i=+this._x.call(null,t),e=+this._y.call(null,t);return Jp(this.cover(i,e),i,e,t)}function Jp(t,i,e,n){if(isNaN(i)||isNaN(e))return t;var o,r=t._root,s={data:n},a=t._x0,d=t._y0,u=t._x1,f=t._y1,g,x,w,M,T,S,D,R;if(!r)return t._root=s,t;for(;r.length;)if((T=i>=(g=(a+u)/2))?a=g:u=g,(S=e>=(x=(d+f)/2))?d=x:f=x,o=r,!(r=r[D=S<<1|T]))return o[D]=s,t;if(w=+t._x.call(null,r.data),M=+t._y.call(null,r.data),i===w&&e===M)return s.next=r,o?o[D]=s:t._root=s,t;do o=o?o[D]=new Array(4):t._root=new Array(4),(T=i>=(g=(a+u)/2))?a=g:u=g,(S=e>=(x=(d+f)/2))?d=x:f=x;while((D=S<<1|T)===(R=(M>=x)<<1|w>=g));return o[R]=r,o[D]=s,t}function em(t){var i,e,n=t.length,o,r,s=new Array(n),a=new Array(n),d=1/0,u=1/0,f=-1/0,g=-1/0;for(e=0;e<n;++e)isNaN(o=+this._x.call(null,i=t[e]))||isNaN(r=+this._y.call(null,i))||(s[e]=o,a[e]=r,o<d&&(d=o),o>f&&(f=o),r<u&&(u=r),r>g&&(g=r));if(d>f||u>g)return this;for(this.cover(d,u).cover(f,g),e=0;e<n;++e)Jp(this,s[e],a[e],t[e]);return this}function tm(t,i){if(isNaN(t=+t)||isNaN(i=+i))return this;var e=this._x0,n=this._y0,o=this._x1,r=this._y1;if(isNaN(e))o=(e=Math.floor(t))+1,r=(n=Math.floor(i))+1;else{for(var s=o-e||1,a=this._root,d,u;e>t||t>=o||n>i||i>=r;)switch(u=(i<n)<<1|t<e,d=new Array(4),d[u]=a,a=d,s*=2,u){case 0:o=e+s,r=n+s;break;case 1:e=o-s,r=n+s;break;case 2:o=e+s,n=r-s;break;case 3:e=o-s,n=r-s;break}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._y0=n,this._x1=o,this._y1=r,this}function nm(){var t=[];return this.visit(function(i){if(!i.length)do t.push(i.data);while(i=i.next)}),t}function im(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Me(t,i,e,n,o){this.node=t,this.x0=i,this.y0=e,this.x1=n,this.y1=o}function om(t,i,e){var n,o=this._x0,r=this._y0,s,a,d,u,f=this._x1,g=this._y1,x=[],w=this._root,M,T;for(w&&x.push(new Me(w,o,r,f,g)),e==null?e=1/0:(o=t-e,r=i-e,f=t+e,g=i+e,e*=e);M=x.pop();)if(!(!(w=M.node)||(s=M.x0)>f||(a=M.y0)>g||(d=M.x1)<o||(u=M.y1)<r))if(w.length){var S=(s+d)/2,D=(a+u)/2;x.push(new Me(w[3],S,D,d,u),new Me(w[2],s,D,S,u),new Me(w[1],S,a,d,D),new Me(w[0],s,a,S,D)),(T=(i>=D)<<1|t>=S)&&(M=x[x.length-1],x[x.length-1]=x[x.length-1-T],x[x.length-1-T]=M)}else{var R=t-+this._x.call(null,w.data),L=i-+this._y.call(null,w.data),B=R*R+L*L;if(B<e){var j=Math.sqrt(e=B);o=t-j,r=i-j,f=t+j,g=i+j,n=w.data}}return n}function rm(t){if(isNaN(f=+this._x.call(null,t))||isNaN(g=+this._y.call(null,t)))return this;var i,e=this._root,n,o,r,s=this._x0,a=this._y0,d=this._x1,u=this._y1,f,g,x,w,M,T,S,D;if(!e)return this;if(e.length)for(;;){if((M=f>=(x=(s+d)/2))?s=x:d=x,(T=g>=(w=(a+u)/2))?a=w:u=w,i=e,!(e=e[S=T<<1|M]))return this;if(!e.length)break;(i[S+1&3]||i[S+2&3]||i[S+3&3])&&(n=i,D=S)}for(;e.data!==t;)if(o=e,!(e=e.next))return this;return(r=e.next)&&delete e.next,o?(r?o.next=r:delete o.next,this):i?(r?i[S]=r:delete i[S],(e=i[0]||i[1]||i[2]||i[3])&&e===(i[3]||i[2]||i[1]||i[0])&&!e.length&&(n?n[D]=e:this._root=e),this):(this._root=r,this)}function sm(t){for(var i=0,e=t.length;i<e;++i)this.remove(t[i]);return this}function am(){return this._root}function cm(){var t=0;return this.visit(function(i){if(!i.length)do++t;while(i=i.next)}),t}function dm(t){var i=[],e,n=this._root,o,r,s,a,d;for(n&&i.push(new Me(n,this._x0,this._y0,this._x1,this._y1));e=i.pop();)if(!t(n=e.node,r=e.x0,s=e.y0,a=e.x1,d=e.y1)&&n.length){var u=(r+a)/2,f=(s+d)/2;(o=n[3])&&i.push(new Me(o,u,f,a,d)),(o=n[2])&&i.push(new Me(o,r,f,u,d)),(o=n[1])&&i.push(new Me(o,u,s,a,f)),(o=n[0])&&i.push(new Me(o,r,s,u,f))}return this}function lm(t){var i=[],e=[],n;for(this._root&&i.push(new Me(this._root,this._x0,this._y0,this._x1,this._y1));n=i.pop();){var o=n.node;if(o.length){var r,s=n.x0,a=n.y0,d=n.x1,u=n.y1,f=(s+d)/2,g=(a+u)/2;(r=o[0])&&i.push(new Me(r,s,a,f,g)),(r=o[1])&&i.push(new Me(r,f,a,d,g)),(r=o[2])&&i.push(new Me(r,s,g,f,u)),(r=o[3])&&i.push(new Me(r,f,g,d,u))}e.push(n)}for(;n=e.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this}function um(t){return t[0]}function fm(t){return arguments.length?(this._x=t,this):this._x}function hm(t){return t[1]}function pm(t){return arguments.length?(this._y=t,this):this._y}function rn(t,i,e){var n=new Of(i??um,e??hm,NaN,NaN,NaN,NaN);return t==null?n:n.addAll(t)}function Of(t,i,e,n,o,r){this._x=t,this._y=i,this._x0=e,this._y0=n,this._x1=o,this._y1=r,this._root=void 0}function mm(t){for(var i={data:t.data},e=i;t=t.next;)e=e.next={data:t.data};return i}var He=rn.prototype=Of.prototype;He.copy=function(){var t=new Of(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root,e,n;if(!i)return t;if(!i.length)return t._root=mm(i),t;for(e=[{source:i,target:t._root=new Array(4)}];i=e.pop();)for(var o=0;o<4;++o)(n=i.source[o])&&(n.length?e.push({source:n,target:i.target[o]=new Array(4)}):i.target[o]=mm(n));return t};He.add=Qp;He.addAll=em;He.cover=tm;He.data=nm;He.extent=im;He.find=om;He.remove=rm;He.removeAll=sm;He.root=am;He.size=cm;He.visit=dm;He.visitAfter=lm;He.x=fm;He.y=pm;function Ee(t){return function(){return t}}function at(t){return(t()-.5)*1e-6}function YI(t){return t.x+t.vx}function KI(t){return t.y+t.vy}function Rl(t){var i,e,n,o=1,r=1;typeof t!="function"&&(t=Ee(t==null?1:+t));function s(){for(var u,f=i.length,g,x,w,M,T,S,D=0;D<r;++D)for(g=rn(i,YI,KI).visitAfter(a),u=0;u<f;++u)x=i[u],T=e[x.index],S=T*T,w=x.x+x.vx,M=x.y+x.vy,g.visit(R);function R(L,B,j,X,ye){var ne=L.data,Re=L.r,Y=T+Re;if(ne){if(ne.index>x.index){var te=w-ne.x-ne.vx,Oe=M-ne.y-ne.vy,ue=te*te+Oe*Oe;ue<Y*Y&&(te===0&&(te=at(n),ue+=te*te),Oe===0&&(Oe=at(n),ue+=Oe*Oe),ue=(Y-(ue=Math.sqrt(ue)))/ue*o,x.vx+=(te*=ue)*(Y=(Re*=Re)/(S+Re)),x.vy+=(Oe*=ue)*Y,ne.vx-=te*(Y=1-Y),ne.vy-=Oe*Y)}return}return B>w+Y||X<w-Y||j>M+Y||ye<M-Y}}function a(u){if(u.data)return u.r=e[u.data.index];for(var f=u.r=0;f<4;++f)u[f]&&u[f].r>u.r&&(u.r=u[f].r)}function d(){if(i){var u,f=i.length,g;for(e=new Array(f),u=0;u<f;++u)g=i[u],e[g.index]=+t(g,u,i)}}return s.initialize=function(u,f){i=u,n=f,d()},s.iterations=function(u){return arguments.length?(r=+u,s):r},s.strength=function(u){return arguments.length?(o=+u,s):o},s.radius=function(u){return arguments.length?(t=typeof u=="function"?u:Ee(+u),d(),s):t},s}function ZI(t){return t.index}function _m(t,i){var e=t.get(i);if(!e)throw new Error("node not found: "+i);return e}function Nl(t){var i=ZI,e=g,n,o=Ee(30),r,s,a,d,u,f=1;t==null&&(t=[]);function g(S){return 1/Math.min(a[S.source.index],a[S.target.index])}function x(S){for(var D=0,R=t.length;D<f;++D)for(var L=0,B,j,X,ye,ne,Re,Y;L<R;++L)B=t[L],j=B.source,X=B.target,ye=X.x+X.vx-j.x-j.vx||at(u),ne=X.y+X.vy-j.y-j.vy||at(u),Re=Math.sqrt(ye*ye+ne*ne),Re=(Re-r[L])/Re*S*n[L],ye*=Re,ne*=Re,X.vx-=ye*(Y=d[L]),X.vy-=ne*Y,j.vx+=ye*(Y=1-Y),j.vy+=ne*Y}function w(){if(s){var S,D=s.length,R=t.length,L=new Map(s.map((j,X)=>[i(j,X,s),j])),B;for(S=0,a=new Array(D);S<R;++S)B=t[S],B.index=S,typeof B.source!="object"&&(B.source=_m(L,B.source)),typeof B.target!="object"&&(B.target=_m(L,B.target)),a[B.source.index]=(a[B.source.index]||0)+1,a[B.target.index]=(a[B.target.index]||0)+1;for(S=0,d=new Array(R);S<R;++S)B=t[S],d[S]=a[B.source.index]/(a[B.source.index]+a[B.target.index]);n=new Array(R),M(),r=new Array(R),T()}}function M(){if(s)for(var S=0,D=t.length;S<D;++S)n[S]=+e(t[S],S,t)}function T(){if(s)for(var S=0,D=t.length;S<D;++S)r[S]=+o(t[S],S,t)}return x.initialize=function(S,D){s=S,u=D,w()},x.links=function(S){return arguments.length?(t=S,w(),x):t},x.id=function(S){return arguments.length?(i=S,x):i},x.iterations=function(S){return arguments.length?(f=+S,x):f},x.strength=function(S){return arguments.length?(e=typeof S=="function"?S:Ee(+S),M(),x):e},x.distance=function(S){return arguments.length?(o=typeof S=="function"?S:Ee(+S),T(),x):o},x}var QI={value:()=>{}};function ym(){for(var t=0,i=arguments.length,e={},n;t<i;++t){if(!(n=arguments[t]+"")||n in e||/[\s.]/.test(n))throw new Error("illegal type: "+n);e[n]=[]}return new kl(e)}function kl(t){this._=t}function JI(t,i){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");if(o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}kl.prototype=ym.prototype={constructor:kl,on:function(t,i){var e=this._,n=JI(t+"",e),o,r=-1,s=n.length;if(arguments.length<2){for(;++r<s;)if((o=(t=n[r]).type)&&(o=eS(e[o],t.name)))return o;return}if(i!=null&&typeof i!="function")throw new Error("invalid callback: "+i);for(;++r<s;)if(o=(t=n[r]).type)e[o]=gm(e[o],t.name,i);else if(i==null)for(o in e)e[o]=gm(e[o],t.name,null);return this},copy:function(){var t={},i=this._;for(var e in i)t[e]=i[e].slice();return new kl(t)},call:function(t,i){if((o=arguments.length-2)>0)for(var e=new Array(o),n=0,o,r;n<o;++n)e[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],n=0,o=r.length;n<o;++n)r[n].value.apply(i,e)},apply:function(t,i,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,r=n.length;o<r;++o)n[o].value.apply(i,e)}};function eS(t,i){for(var e=0,n=t.length,o;e<n;++e)if((o=t[e]).name===i)return o.value}function gm(t,i,e){for(var n=0,o=t.length;n<o;++n)if(t[n].name===i){t[n]=QI,t=t.slice(0,n).concat(t.slice(n+1));break}return e!=null&&t.push({name:i,value:e}),t}var Ff=ym;var Ln=0,Hi=0,Gi=0,vm=1e3,Ol,ji,Fl=0,sn=0,Al=0,Vi=typeof performance=="object"&&performance.now?performance:Date,xm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function zf(){return sn||(xm(tS),sn=Vi.now()+Al)}function tS(){sn=0}function Af(){this._call=this._time=this._next=null}Af.prototype=Ll.prototype={constructor:Af,restart:function(t,i,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?zf():+e)+(i==null?0:+i),!this._next&&ji!==this&&(ji?ji._next=this:Ol=this,ji=this),this._call=t,this._time=e,Lf()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lf())}};function Ll(t,i,e){var n=new Af;return n.restart(t,i,e),n}function wm(){zf(),++Ln;for(var t=Ol,i;t;)(i=sn-t._time)>=0&&t._call.call(void 0,i),t=t._next;--Ln}function Cm(){sn=(Fl=Vi.now())+Al,Ln=Hi=0;try{wm()}finally{Ln=0,iS(),sn=0}}function nS(){var t=Vi.now(),i=t-Fl;i>vm&&(Al-=i,Fl=t)}function iS(){for(var t,i=Ol,e,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:Ol=e);ji=t,Lf(n)}function Lf(t){if(!Ln){Hi&&(Hi=clearTimeout(Hi));var i=t-sn;i>24?(t<1/0&&(Hi=setTimeout(Cm,t-Vi.now()-Al)),Gi&&(Gi=clearInterval(Gi))):(Gi||(Fl=Vi.now(),Gi=setInterval(nS,vm)),Ln=1,xm(Cm))}}function bm(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function Im(t){return t.x}function Sm(t){return t.y}var oS=10,rS=Math.PI*(3-Math.sqrt(5));function zl(t){var i,e=1,n=.001,o=1-Math.pow(n,1/300),r=0,s=.6,a=new Map,d=Ll(g),u=Ff("tick","end"),f=bm();t==null&&(t=[]);function g(){x(),u.call("tick",i),e<n&&(d.stop(),u.call("end",i))}function x(T){var S,D=t.length,R;T===void 0&&(T=1);for(var L=0;L<T;++L)for(e+=(r-e)*o,a.forEach(function(B){B(e)}),S=0;S<D;++S)R=t[S],R.fx==null?R.x+=R.vx*=s:(R.x=R.fx,R.vx=0),R.fy==null?R.y+=R.vy*=s:(R.y=R.fy,R.vy=0);return i}function w(){for(var T=0,S=t.length,D;T<S;++T){if(D=t[T],D.index=T,D.fx!=null&&(D.x=D.fx),D.fy!=null&&(D.y=D.fy),isNaN(D.x)||isNaN(D.y)){var R=oS*Math.sqrt(.5+T),L=T*rS;D.x=R*Math.cos(L),D.y=R*Math.sin(L)}(isNaN(D.vx)||isNaN(D.vy))&&(D.vx=D.vy=0)}}function M(T){return T.initialize&&T.initialize(t,f),T}return w(),i={tick:x,restart:function(){return d.restart(g),i},stop:function(){return d.stop(),i},nodes:function(T){return arguments.length?(t=T,w(),a.forEach(M),i):t},alpha:function(T){return arguments.length?(e=+T,i):e},alphaMin:function(T){return arguments.length?(n=+T,i):n},alphaDecay:function(T){return arguments.length?(o=+T,i):+o},alphaTarget:function(T){return arguments.length?(r=+T,i):r},velocityDecay:function(T){return arguments.length?(s=1-T,i):1-s},randomSource:function(T){return arguments.length?(f=T,a.forEach(M),i):f},force:function(T,S){return arguments.length>1?(S==null?a.delete(T):a.set(T,M(S)),i):a.get(T)},find:function(T,S,D){var R=0,L=t.length,B,j,X,ye,ne;for(D==null?D=1/0:D*=D,R=0;R<L;++R)ye=t[R],B=T-ye.x,j=S-ye.y,X=B*B+j*j,X<D&&(ne=ye,D=X);return ne},on:function(T,S){return arguments.length>1?(u.on(T,S),i):u.on(T)}}}function Bl(){var t,i,e,n,o=Ee(-30),r,s=1,a=1/0,d=.81;function u(w){var M,T=t.length,S=rn(t,Im,Sm).visitAfter(g);for(n=w,M=0;M<T;++M)i=t[M],S.visit(x)}function f(){if(t){var w,M=t.length,T;for(r=new Array(M),w=0;w<M;++w)T=t[w],r[T.index]=+o(T,w,t)}}function g(w){var M=0,T,S,D=0,R,L,B;if(w.length){for(R=L=B=0;B<4;++B)(T=w[B])&&(S=Math.abs(T.value))&&(M+=T.value,D+=S,R+=S*T.x,L+=S*T.y);w.x=R/D,w.y=L/D}else{T=w,T.x=T.data.x,T.y=T.data.y;do M+=r[T.data.index];while(T=T.next)}w.value=M}function x(w,M,T,S){if(!w.value)return!0;var D=w.x-i.x,R=w.y-i.y,L=S-M,B=D*D+R*R;if(L*L/d<B)return B<a&&(D===0&&(D=at(e),B+=D*D),R===0&&(R=at(e),B+=R*R),B<s&&(B=Math.sqrt(s*B)),i.vx+=D*w.value*n/B,i.vy+=R*w.value*n/B),!0;if(w.length||B>=a)return;(w.data!==i||w.next)&&(D===0&&(D=at(e),B+=D*D),R===0&&(R=at(e),B+=R*R),B<s&&(B=Math.sqrt(s*B)));do w.data!==i&&(L=r[w.data.index]*n/B,i.vx+=D*L,i.vy+=R*L);while(w=w.next)}return u.initialize=function(w,M){t=w,e=M,f()},u.strength=function(w){return arguments.length?(o=typeof w=="function"?w:Ee(+w),f(),u):o},u.distanceMin=function(w){return arguments.length?(s=w*w,u):Math.sqrt(s)},u.distanceMax=function(w){return arguments.length?(a=w*w,u):Math.sqrt(a)},u.theta=function(w){return arguments.length?(d=w*w,u):Math.sqrt(d)},u}function Gl(t){var i=Ee(.1),e,n,o;typeof t!="function"&&(t=Ee(t==null?0:+t));function r(a){for(var d=0,u=e.length,f;d<u;++d)f=e[d],f.vx+=(o[d]-f.x)*n[d]*a}function s(){if(e){var a,d=e.length;for(n=new Array(d),o=new Array(d),a=0;a<d;++a)n[a]=isNaN(o[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return r.initialize=function(a){e=a,s()},r.strength=function(a){return arguments.length?(i=typeof a=="function"?a:Ee(+a),s(),r):i},r.x=function(a){return arguments.length?(t=typeof a=="function"?a:Ee(+a),s(),r):t},r}function Hl(t){var i=Ee(.1),e,n,o;typeof t!="function"&&(t=Ee(t==null?0:+t));function r(a){for(var d=0,u=e.length,f;d<u;++d)f=e[d],f.vy+=(o[d]-f.y)*n[d]*a}function s(){if(e){var a,d=e.length;for(n=new Array(d),o=new Array(d),a=0;a<d;++a)n[a]=isNaN(o[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return r.initialize=function(a){e=a,s()},r.strength=function(a){return arguments.length?(i=typeof a=="function"?a:Ee(+a),s(),r):i},r.y=function(a){return arguments.length?(t=typeof a=="function"?a:Ee(+a),s(),r):t},r}var Ui=260,Bf=120;function sS(t,i){let e=t.map(o=>o.path).sort(),n=i.map(o=>o.id).sort();return`${e.length}|${e.join(",")}|${n.length}|${n.join(",")}`}function Tm(){let t=null;return(i,e)=>{let n=new Set(i.map(x=>x.path)),o=new Map,r=e?.links??[];for(let x of r){if(!n.has(x.source)||!n.has(x.target)||x.source===x.target)continue;let w=dS(x.kind,x.source,x.target);o.has(w)||o.set(w,{id:w,from:x.source,to:x.target,kind:x.kind})}let s=[...o.values()],a=new Map;for(let x of i)a.set(x.path,x);let d=new Map;for(let x of e?.nodes??[])d.set(x.path,x);let u=sS(i,s);if(t&&t.fingerprint===u)return{nodesByPath:a,apiNodesByPath:d,edges:t.edges,positions:t.positions,computedAt:t.computedAt};let f=aS(i,s),g=performance.now();return t={fingerprint:u,positions:f,edges:s,computedAt:g},{nodesByPath:a,apiNodesByPath:d,edges:s,positions:f,computedAt:g}}}function aS(t,i){let e=t.map(a=>({id:a.path})),n=i.map(a=>({source:a.from,target:a.to})),o=zl(e).force("link",Nl(n).id(a=>a.id).distance(90).strength(1)).force("charge",Bl().strength(-200)).force("center",kf(0,0)).force("x",Gl(0).strength(.06)).force("y",Hl(0).strength(.06)).force("collide",Rl(Ui/2+12)).stop(),r=400;for(let a=0;a<r;a++)o.tick();let s=new Map;for(let a of e)s.set(a.id,{x:(a.x??0)-Ui/2,y:(a.y??0)-Bf/2});return s}function Dm(t,i,e,n){let o=new Set(n),r=t.map(f=>{let g={id:f.path};if(o.has(f.path))return g;let x=e[f.path];if(!x)return g;let w=x.x+Ui/2,M=x.y+Bf/2;return g.x=w,g.y=M,g.fx=w,g.fy=M,g}),s=i.map(f=>({source:f.from,target:f.to})),a=zl(r).force("link",Nl(s).id(f=>f.id).distance(90).strength(1)).force("charge",Bl().strength(-200)).force("x",Gl(0).strength(.06)).force("y",Hl(0).strength(.06)).force("collide",Rl(Ui/2+12)).stop(),d=200;for(let f=0;f<d;f++)a.tick();let u=new Map;for(let f of r)o.has(f.id)&&u.set(f.id,{x:(f.x??0)-Ui/2,y:(f.y??0)-Bf/2});return u}function Em(t,i,e){let n=t.edges.filter(a=>i.has(a.from)&&i.has(a.to)),o=new Map,r=new Map;for(let a of n)o.set(a.from,(o.get(a.from)??0)+1),r.set(a.to,(r.get(a.to)??0)+1);let s=[];for(let a of i){let d=t.nodesByPath.get(a);if(!d)continue;let u=t.apiNodesByPath.get(a),f=e[a],g=t.positions.get(a)??{x:0,y:0},x=f?{x:f.x,y:f.y}:g;s.push({id:a,path:a,view:d,kind:d.kind,position:x,stats:{linksIn:r.get(a)??0,linksOut:o.get(a)??0,bytesTotal:u?.bytes.total,tokensTotal:u?.tokens?.total,externalRefsCount:u?.externalRefsCount},summary:cS(d)})}return{nodes:s,edges:n}}function cS(t){let i={injectionDetected:!1,contentQuality:"clean"},e=(t.frontmatter.description??t.frontmatter.name??"").trim();return{kind:"note",confidence:.6,safety:i,whatItCovers:e||`${t.kind} entry`,topics:[],keyFacts:[]}}function dS(t,i,e){let[n,o]=[i,e].sort();return`${t}:${n}::${o}`}var lS=["canvasWrap"],uS=["panelCloseBtn"],Nm=(t,i)=>i.id;function fS(t,i){if(t&1&&(p(0,"div",3),G(1,"span",7),p(2,"p",8),v(3),m()()),t&2){let e=_();l(3),I(e.texts.loading)}}function hS(t,i){if(t&1&&(p(0,"div",4),G(1,"span",9),p(2,"p",8),v(3),m(),p(4,"p",10),v(5),m()()),t&2){let e=_();l(3),I(e.texts.errorTitle),l(2),I(e.error())}}function pS(t,i){if(t&1&&(p(0,"div",5),G(1,"span",11),p(2,"p",8),v(3),m(),p(4,"p",10),v(5),m()()),t&2){let e=_();l(3),I(e.texts.emptyTitle),l(2),I(e.texts.emptyDesc)}}function mS(t,i){if(t&1&&(p(0,"f-connection",29),G(1,"f-connection-marker-arrow",30),m()),t&2){let e=i.$implicit,n=_(2);Te("f-conn--"+e.kind),Le("f-conn--highlighted",n.isEdgeHighlighted(e))("f-conn--dimmed",n.isEdgeDimmed(e)),P("fOutputId",e.from+"-out")("fInputId",e.to+"-in")("fType",n.connectionType)("fBehavior",n.connectionBehavior)("fOffset",4)("fReassignDisabled",!0)("fSelectionDisabled",!0),l(),P("type",n.markerEnd)}}function _S(t,i){if(t&1){let e=Fe();zt(0,18),p(1,"div",32),ie("fNodePositionChange",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.onNodePositionChange(r.id,o))})("pointerdown",function(o){Z(e);let r=_(3);return Q(r.onNodePointerDown(o))})("click",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.selectNode(r,o))})("dblclick",function(){let o=Z(e).$implicit,r=_(3);return Q(r.openNode(o))}),G(2,"div",33),p(3,"sm-node-card",34),ie("expandedChange",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.setExpanded(r.id,o))}),m(),G(4,"div",35),m(),Bt()}if(t&2){let e=i.$implicit,n=_(3);l(),P("fNodeId",e.id)("fNodePosition",e.position),K("data-testid","graph-node-"+e.id),l(),P("fInputId",e.id+"-in")("fInputConnectableSide",n.inputSide),l(),P("node",e.view)("stats",e.stats)("summary",e.summary)("selected",n.isSelected(e.id))("highlighted",n.isHighlighted(e.id))("dimmed",n.isDimmed(e.id))("expanded",n.isExpanded(e.id)),l(),P("fOutputId",e.id+"-out")("fOutputConnectableSide",n.outputSide)}}function gS(t,i){if(t&1&&me(0,_S,5,14,"ng-container",31),t&2){let e=_(2);P("fVirtualForOf",e.graph().nodes)}}function yS(t,i){if(t&1){let e=Fe();p(0,"div",32),ie("fNodePositionChange",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.onNodePositionChange(r.id,o))})("pointerdown",function(o){Z(e);let r=_(3);return Q(r.onNodePointerDown(o))})("click",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.selectNode(r,o))})("dblclick",function(){let o=Z(e).$implicit,r=_(3);return Q(r.openNode(o))}),G(1,"div",33),p(2,"sm-node-card",34),ie("expandedChange",function(o){let r=Z(e).$implicit,s=_(3);return Q(s.setExpanded(r.id,o))}),m(),G(3,"div",35),m()}if(t&2){let e=i.$implicit,n=_(3);P("fNodeId",e.id)("fNodePosition",e.position),K("data-testid","graph-node-"+e.id),l(),P("fInputId",e.id+"-in")("fInputConnectableSide",n.inputSide),l(),P("node",e.view)("stats",e.stats)("summary",e.summary)("selected",n.isSelected(e.id))("highlighted",n.isHighlighted(e.id))("dimmed",n.isDimmed(e.id))("expanded",n.isExpanded(e.id)),l(),P("fOutputId",e.id+"-out")("fOutputConnectableSide",n.outputSide)}}function CS(t,i){if(t&1&&(zt(0,18),re(1,yS,4,14,"div",36,Nm),Bt()),t&2){let e=_(2);l(),se(e.graph().nodes)}}function vS(t,i){if(t&1&&G(0,"app-perf-hud",22),t&2){let e=_(2);P("visible",e.visibleCount())("total",e.totalCount())("edges",e.edgeCount())("cacheAt",e.layoutComputedAt())}}function xS(t,i){if(t&1){let e=Fe();p(0,"div",12,0),ie("mousedown",function(o){Z(e);let r=_();return Q(r.onCanvasMouseDown(o))})("click",function(o){Z(e);let r=_();return Q(r.onCanvasClick(o))}),p(2,"f-flow",13),ie("fLoaded",function(){Z(e);let o=_();return Q(o.onLoaded())}),p(3,"f-background"),G(4,"f-rect-pattern"),m(),G(5,"f-line-alignment",14),p(6,"f-canvas",15),ie("fCanvasChange",function(o){Z(e);let r=_();return Q(r.onCanvasChange(o))}),zt(7,16),re(8,mS,2,14,"f-connection",17,Nm),Bt(),N(10,gS,1,1,"ng-container",18)(11,CS,3,0,"ng-container",18),m(),G(12,"f-minimap"),m(),G(13,"app-kind-palette"),p(14,"aside",19)(15,"p-button",20,1),ie("onClick",function(){Z(e);let o=_();return Q(o.closePanel())}),m(),G(17,"app-inspector-view",21),m(),N(18,vS,1,4,"app-perf-hud",22),p(19,"div",23)(20,"p-button",24),ie("onClick",function(){Z(e);let o=_();return Q(o.zoomIn())}),m(),p(21,"p-button",25),ie("onClick",function(){Z(e);let o=_();return Q(o.zoomOut())}),m(),p(22,"p-button",26),ie("onClick",function(){Z(e);let o=_();return Q(o.fitToScreen())}),m(),G(23,"span",27),p(24,"p-button",28),ie("onClick",function(){Z(e);let o=_();return Q(o.resetLayout())}),m()()()}if(t&2){let e=_();l(2),P("fCache",e.perf.cache),l(3),P("fAlignThreshold",20),l(),P("position",e.viewportPosition())("scale",e.viewportScale())("fZoomStep",.06)("fZoomDblClickStep",.35)("debounceTime",150),l(2),se(e.graph().edges),l(2),k(e.perf.virtualization?10:11),l(4),Le("is-open",e.selectedNodeId()!==null),K("aria-label",e.texts.a11y.panel),l(),P("ariaLabel",e.texts.panel.closeLabel)("pTooltip",e.texts.panel.closeLabel)("text",!0)("rounded",!0),l(2),P("path",e.selectedPath()),l(),k(e.perfHud?18:-1),l(),K("aria-label",e.texts.a11y.toolbar),l(),P("ariaLabel",e.texts.toolbar.zoomIn)("pTooltip",e.texts.toolbar.zoomIn)("text",!0)("rounded",!0)("disabled",!e.canZoomIn()),l(),P("ariaLabel",e.texts.toolbar.zoomOut)("pTooltip",e.texts.toolbar.zoomOut)("text",!0)("rounded",!0)("disabled",!e.canZoomOut()),l(),P("ariaLabel",e.texts.toolbar.fitToScreen)("pTooltip",e.texts.toolbar.fitToScreen)("text",!0)("rounded",!0),l(2),P("ariaLabel",e.texts.toolbar.resetLayoutLabel)("pTooltip",e.texts.toolbar.resetLayoutTooltip)("text",!0)("rounded",!0)}}var wS=.1,bS=4,Pm=.2,km="sm.graph.viewport",Om="sm.graph.node-positions",Fm="sm.graph.node-expanded",Mm=class t{loader=c(hn);filters=c(ao);router=c(io);route=c(eh);canvas=Se(Li);zoom=Se(zi);canvasWrap=Se("canvasWrap");panelCloseBtn=Se("panelCloseBtn");outputSide=F.BOTTOM;inputSide=F.TOP;connectionType=Et.SEGMENT;connectionBehavior=Pt.FIXED;markerEnd=le.END_ALL_STATES;perf=Rf.graph.perf;perfHud=Rf.graph.perfHud;pointerDownAt=null;savedViewport=IS();hasCompletedInitialLayout=!1;viewportPosition=$(this.savedViewport?{x:this.savedViewport.x,y:this.savedViewport.y}:{x:0,y:0});viewportScale=$(this.savedViewport?.scale??1);canZoomIn=H(()=>this.viewportScale()<bS-1e-6);canZoomOut=H(()=>this.viewportScale()>wS+1e-6);texts=Mf;middlePanOrigin=null;nodePositions=$(SS());expandedNodeIds=$(TS());loading=this.loader.loading;error=this.loader.error;visibleNodes=H(()=>this.filters.apply(this.loader.nodes()));computeLayout=Tm();fullLayout=H(()=>this.computeLayout(this.loader.nodes(),this.loader.scan()));graph=H(()=>{let i=new Set(this.visibleNodes().map(e=>e.path));return Em(this.fullLayout(),i,this.nodePositions())});hasData=H(()=>this.graph().nodes.length>0);visibleCount=H(()=>this.graph().nodes.length);totalCount=H(()=>this.loader.nodes().length);edgeCount=H(()=>this.graph().edges.length);layoutComputedAt=H(()=>this.fullLayout().computedAt);selectedNodeId=$(null);selectedPath=H(()=>{let i=this.selectedNodeId();return i?this.graph().nodes.find(n=>n.id===i)?.view.path:void 0});adjacency=H(()=>{let i=new Map;for(let e of this.graph().edges)i.has(e.from)||i.set(e.from,new Set),i.has(e.to)||i.set(e.to,new Set),i.get(e.from).add(e.to),i.get(e.to).add(e.from);return i});selectionGuard=fe(()=>{let i=this.selectedNodeId();if(i===null)return;this.graph().nodes.some(n=>n.id===i)||this.selectedNodeId.set(null)});deepLinkPath=ah(this.route.queryParamMap.pipe(Hf(i=>i.get("path"))),{initialValue:this.route.snapshot.queryParamMap.get("path")});deepLinkEffect=fe(()=>{let i=this.deepLinkPath(),e=this.graph().nodes;if(e.length===0||!i)return;let n=dt(()=>this.selectedNodeId());if(n!==null&&e.find(s=>s.id===n)?.view.path===i)return;let o=e.find(r=>r.view.path===i);o&&this.selectedNodeId.set(o.id)});urlWriterEffect=fe(()=>{let i=this.selectedPath(),e=dt(()=>this.deepLinkPath());(i??null)!==(e??null)&&this.router.navigate([],{relativeTo:this.route,queryParams:{path:i??null},queryParamsHandling:"merge",replaceUrl:!0})});lastSelectionWasNonNull=!1;panelFocusEffect=fe(()=>{let i=this.selectedNodeId(),e=i!==null&&!this.lastSelectionWasNonNull;this.lastSelectionWasNonNull=i!==null,e&&queueMicrotask(()=>{this.panelCloseBtn()?.nativeElement?.querySelector("button")?.focus()})});pathsFingerprint=H(()=>this.loader.nodes().map(i=>i.path).sort().join("|"));lastPathsFingerprint=null;constructor(){fe(()=>{let i=this.visibleNodes();this.hasCompletedInitialLayout||i.length!==0&&queueMicrotask(()=>{this.hasCompletedInitialLayout=!0,this.savedViewport||this.canvas()?.fitToScreen({x:40,y:40},!1)})}),fe(()=>{let i=this.pathsFingerprint();if(!this.hasCompletedInitialLayout){this.lastPathsFingerprint=i;return}this.lastPathsFingerprint!==i&&(this.lastPathsFingerprint=i,queueMicrotask(()=>this.canvas()?.fitToScreen({x:40,y:40},!0)))}),fe(()=>{let i=new Set(this.loader.nodes().map(r=>r.path));if(i.size===0)return;let e=this.expandedNodeIds();if(e.size===0)return;let n=!1,o=new Set;for(let r of e)i.has(r)?o.add(r):n=!0;n&&(this.expandedNodeIds.set(o),Gf(o))}),fe(()=>{let i=this.loader.nodes();if(i.length===0)return;let e=this.nodePositions(),n=new Set(i.map(a=>a.path)),o=!1,r=de({},e);for(let a of Object.keys(r))n.has(a)||(delete r[a],o=!0);let s=[];for(let a of n)a in r||s.push(a);if(s.length>0){let a=this.fullLayout();if(Object.keys(r).length===0)for(let d of s){let u=a.positions.get(d);u&&(r[d]={x:u.x,y:u.y})}else{let d=Dm(i,a.edges,r,s);for(let u of s){let f=d.get(u);f&&(r[u]=f)}}o=!0}o&&(this.nodePositions.set(r),Rm(r))})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}onLoaded(){}onCanvasChange(i){if(this.viewportPosition.set({x:i.position.x,y:i.position.y}),this.viewportScale.set(i.scale),!this.hasCompletedInitialLayout)return;let e={x:i.position.x,y:i.position.y,scale:i.scale};try{localStorage.setItem(km,JSON.stringify(e))}catch{}}onNodePositionChange(i,e){this.dragBuffer||(this.dragBuffer=de({},this.nodePositions())),this.dragBuffer[i]={x:e.x,y:e.y},this.nodeDragInProgress=!0}zoomIn(){this.zoom()?.setZoom(this.getViewportCenter(),Pm,xt.ZOOM_IN,!0)}zoomOut(){this.zoom()?.setZoom(this.getViewportCenter(),Pm,xt.ZOOM_OUT,!0)}fitToScreen(){this.canvas()?.fitToScreen({x:40,y:40},!0)}resetLayout(){window.confirm(Mf.resetLayoutConfirm)&&(this.nodePositions.set({}),this.expandedNodeIds.set(new Set),Gf(new Set),queueMicrotask(()=>this.canvas()?.fitToScreen({x:40,y:40},!0)))}getViewportCenter(){let i=this.canvasWrap()?.nativeElement;if(!i)return{x:0,y:0};let e=i.getBoundingClientRect();return{x:e.width/2,y:e.height/2}}onCanvasMouseDown(i){if(i.button!==1)return;i.preventDefault();let e=this.canvas()?.getPosition()??{x:0,y:0};this.middlePanOrigin={mouseX:i.clientX,mouseY:i.clientY,canvasX:e.x,canvasY:e.y},document.addEventListener("mousemove",this.onMiddlePanMove),document.addEventListener("mouseup",this.onMiddlePanEnd)}middlePanRafId=null;pendingPanPosition=null;onMiddlePanMove=i=>{this.middlePanOrigin&&(this.pendingPanPosition={x:this.middlePanOrigin.canvasX+(i.clientX-this.middlePanOrigin.mouseX),y:this.middlePanOrigin.canvasY+(i.clientY-this.middlePanOrigin.mouseY)},this.middlePanRafId===null&&(this.middlePanRafId=requestAnimationFrame(()=>{this.middlePanRafId=null;let e=this.canvas();!e||!this.pendingPanPosition||(e.setPosition(this.pendingPanPosition),e.redraw())})))};onMiddlePanEnd=()=>{this.middlePanRafId!==null&&(cancelAnimationFrame(this.middlePanRafId),this.middlePanRafId=null),this.pendingPanPosition=null,this.middlePanOrigin=null,document.removeEventListener("mousemove",this.onMiddlePanMove),document.removeEventListener("mouseup",this.onMiddlePanEnd),this.canvas()?.emitCanvasChangeEvent()};ngOnDestroy(){this.onMiddlePanEnd()}onNodePointerDown(i){this.pointerDownAt={x:i.clientX,y:i.clientY},document.addEventListener("mouseup",this.onNodeMouseUp,{once:!0})}nodeDragInProgress=!1;dragBuffer=null;onNodeMouseUp=()=>{queueMicrotask(()=>{if(!this.nodeDragInProgress){this.dragBuffer=null;return}this.nodeDragInProgress=!1,this.dragBuffer&&(this.nodePositions.set(this.dragBuffer),this.dragBuffer=null),Rm(this.nodePositions())})};selectNode(i,e){this.isClickWithoutDrag(e)&&this.selectedNodeId.set(i.id)}closePanel(){this.selectedNodeId.set(null)}onEscape(){this.selectedNodeId()!==null&&this.closePanel()}openNode(i){this.selectedNodeId.set(i.id)}onCanvasClick(i){let e=i.target;e?.closest(".sm-gnode")||e?.closest(".graph__toolbar")||e?.closest(".perf-hud")||e?.closest(".kind-palette")||e?.closest(".graph__panel")||this.selectedNodeId.set(null)}isSelected(i){return this.selectedNodeId()===i}isHighlighted(i){let e=this.selectedNodeId();return e===null||e===i?!1:this.adjacency().get(e)?.has(i)??!1}isDimmed(i){let e=this.selectedNodeId();return e===null||e===i?!1:!(this.adjacency().get(e)?.has(i)??!1)}isExpanded(i){return this.expandedNodeIds().has(i)}setExpanded(i,e){let n=this.expandedNodeIds();if(n.has(i)===e)return;let o=new Set(n);e?o.add(i):o.delete(i),this.expandedNodeIds.set(o),Gf(o)}isEdgeHighlighted(i){let e=this.selectedNodeId();return e!==null&&(i.from===e||i.to===e)}isEdgeDimmed(i){let e=this.selectedNodeId();return e===null?!1:i.from!==e&&i.to!==e}isClickWithoutDrag(i){let e=this.pointerDownAt;if(this.pointerDownAt=null,!e)return!0;let n=i.clientX-e.x,o=i.clientY-e.y;return Math.hypot(n,o)<=4}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=J({type:t,selectors:[["app-graph-view"]],viewQuery:function(e,n){e&1&&Ct(n.canvas,Li,5)(n.zoom,zi,5)(n.canvasWrap,lS,5)(n.panelCloseBtn,uS,5),e&2&&nt(4)},hostBindings:function(e,n){e&1&&ie("keydown.escape",function(){return n.onEscape()},Wf)},decls:5,vars:1,consts:[["canvasWrap",""],["panelCloseBtn",""],["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"],[1,"empty-state__icon","pi","pi-spin","pi-spinner"],[1,"empty-state__title"],[1,"empty-state__icon","pi","pi-exclamation-circle",2,"color","var(--sm-severity-error)","opacity","1"],[1,"empty-state__desc"],[1,"empty-state__icon","pi","pi-filter-slash"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"mousedown","click"],["fDraggable","",3,"fLoaded","fCache"],[3,"fAlignThreshold"],["fZoom","",3,"fCanvasChange","position","scale","fZoomStep","fZoomDblClickStep","debounceTime"],["ngProjectAs","[fConnections]",5,["","fConnections",""]],[3,"fOutputId","fInputId","fType","fBehavior","fOffset","fReassignDisabled","fSelectionDisabled","class","f-conn--highlighted","f-conn--dimmed"],["ngProjectAs","[fNodes]",5,["","fNodes",""]],["role","complementary","data-testid","graph-panel",1,"graph__panel"],["icon","pi pi-times","severity","secondary","size","small","styleClass","graph__panel-close","data-testid","graph-panel-close",3,"onClick","ariaLabel","pTooltip","text","rounded"],["mode","embedded",3,"path"],[3,"visible","total","edges","cacheAt"],["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-refresh","severity","secondary","size","small","data-testid","graph-reset-layout",3,"onClick","ariaLabel","pTooltip","text","rounded"],[3,"fOutputId","fInputId","fType","fBehavior","fOffset","fReassignDisabled","fSelectionDisabled"],[3,"type"],["ngProjectAs","[fNodes]",5,["","fNodes",""],4,"fVirtualFor","fVirtualForOf"],["fNode","","fDragHandle","",1,"sm-gnode-host",3,"fNodePositionChange","pointerdown","click","dblclick","fNodeId","fNodePosition"],["fNodeInput","",1,"sm-gnode__connector","sm-gnode__connector--in",3,"fInputId","fInputConnectableSide"],[3,"expandedChange","node","stats","summary","selected","highlighted","dimmed","expanded"],["fNodeOutput","",1,"sm-gnode__connector","sm-gnode__connector--out",3,"fOutputId","fOutputConnectableSide"],["fNode","","fDragHandle","",1,"sm-gnode-host",3,"fNodeId","fNodePosition"]],template:function(e,n){e&1&&(p(0,"section",2),N(1,fS,4,1,"div",3)(2,hS,6,2,"div",4)(3,pS,6,2,"div",5)(4,xS,25,36,"div",6),m()),e&2&&(l(),k(n.loading()&&!n.hasData()?1:n.error()&&!n.hasData()?2:n.hasData()?4:3))},dependencies:[zp,Fp,Li,Rp,Mp,zi,Xh,Np,hp,_p,kp,Op,Cl,fp,Ap,Dp,xl,bl,Sl,Ml,fn,un,ut,lt],styles:["[_nghost-%COMP%]{display:block;height:100%}.graph[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%]{position:relative;flex:1;min-height:0;border:1px solid var(--sm-border);border-radius:.75rem;background:var(--sm-bg-content);overflow:hidden;--ff-connection-drag-handle-stroke: transparent;--ff-connector-background-color: transparent;--ff-connector-border-color: transparent;--ff-connector-connected-color: transparent;--ff-connector-node-ring-color: transparent;--ff-canvas-background-color: transparent}.graph__canvas-wrap[_ngcontent-%COMP%] f-flow[_ngcontent-%COMP%]{width:100%;height:100%}.graph__panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;width:400px;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;overflow-y:auto}.graph__panel.is-open[_ngcontent-%COMP%]{transform:translate(0);pointer-events:auto}.graph__panel-close[_ngcontent-%COMP%]{position:absolute;top:.5rem;right:.5rem;z-index:1}.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:999px;box-shadow:var(--sm-shadow-floating);z-index:2;pointer-events:auto}.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__connector[_ngcontent-%COMP%]{position:absolute;pointer-events:none}.sm-gnode__connector--out[_ngcontent-%COMP%]{bottom:calc(var(--ff-connector-size) / -2);left:50%;transform:translate(-50%)}.sm-gnode__connector--in[_ngcontent-%COMP%]{top:calc(var(--ff-connector-size) / -2);left:50%;transform:translate(-50%)}.f-conn--invokes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes);--ff-connection-width: 2.5px;--ff-marker-color: var(--sm-edge-invokes)}.f-conn--references[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references);--ff-connection-width: 2px;--ff-marker-color: var(--sm-edge-references)}.f-conn--mentions[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions);--ff-connection-width: 1.5px;--ff-marker-color: var(--sm-edge-mentions)}.f-conn--supersedes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes);--ff-connection-width: 2px;--ff-marker-color: var(--sm-edge-supersedes)}.graph__canvas-wrap[_ngcontent-%COMP%] .f-conn--supersedes .f-connection-path{stroke-dasharray:8 4}.f-conn--highlighted[_ngcontent-%COMP%]{--ff-connection-width: 3px}.f-conn--dimmed[_ngcontent-%COMP%]{opacity:.15}"],changeDetection:0})};function IS(){let t=null;try{t=localStorage.getItem(km)}catch{return null}if(!t)return null;let i;try{i=JSON.parse(t)}catch{return null}return ES(i)?i:null}function SS(){let t=null;try{t=localStorage.getItem(Om)}catch{return{}}if(!t)return{};let i;try{i=JSON.parse(t)}catch{return{}}if(typeof i!="object"||i===null)return{};let e={};for(let[n,o]of Object.entries(i))DS(o)&&(e[n]={x:o.x,y:o.y});return e}function Rm(t){try{localStorage.setItem(Om,JSON.stringify(t))}catch{}}function TS(){let t=null;try{t=localStorage.getItem(Fm)}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 Gf(t){try{localStorage.setItem(Fm,JSON.stringify([...t]))}catch{}}function DS(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 ES(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}export{Mm as GraphView};